4 Commits

Author SHA1 Message Date
2134532ba3 fix: drop Solana from the Tameion branch while keeping fail-closed confirmation
The cherry-picked fail-closed payment fixes imported @settlekit/solana, which
does not exist on this branch, breaking tsc -b and the api/worker suites.
Solana verification, env and session references are removed; arc/base/
ethereum keep the per-network verifier registry and the worker keeps
payTo-bound verification. A solana network is now rejected as unsupported
(400 on checkout/observe, unsupported in the worker). Also adds the missing
packages/circle project reference to the api, points the api/worker test
scripts at the root vitest config, and removes the operator's
vitest.apps.config.ts workaround.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 16:55:28 +03:00
2a4864dd49 feat: add operator API routes and public proof endpoints
/v1/operator (API key or dashboard session, scoped to the vault's org):
POST /events (caller org forced, duplicate event ids replay the recorded
decision, single-flight per event), GET /decisions[/:id], POST|GET /bills,
GET /escalations, owner-only POST /escalations/:id/approve|reject, GET and
owner-only PUT /policy which refuses drift from on-chain caps and allowlist.
/v1/public/operator: GET /proof (cached aggregates, demo org excluded) and
GET /verify/:id. Mounted with one route line in app.ts ahead of the v1
API-key group. Escalated bills close when the owner resolves them.

App-level operator tests run through vitest.apps.config.ts because the api
and worker tsconfigs reference packages/solana, absent on this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 16:15:22 +03:00
8c1d704a96 feat: add Claude operator agent, tools and decision service
OperatorAgent drives the Anthropic SDK tool runner (betaZodTool) over read
tools (treasury state, open bills, counterparty risk, payment history, x402
quotes) and policy-checked action tools that require rationale,
alternatives and confidence. claude-sonnet-5 handles revenue and ticks,
claude-opus-5-5 bills, refunds and disputes; at most 12 iterations, with
HeuristicOperator fallback when no key is set or the API fails.

OperatorService turns each event into one hash-chained DecisionRecord with
the tool trace, verdict, usage cost and outcome. The vault anchors a
pre-execution commitment hash of the reasoning; owner approvals, rejections
and 72h expiries are recorded as decisions too. Invoice and customer text
is passed as escaped untrusted data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 15:41:33 +03:00
858a1a1485 feat: add @settlekit/operator policy, allocation and decision log
OperatorPolicy.evaluate mirrors OperatorVault check order (deny reasons map
1:1 to vault errors), reuses @settlekit/treasury for allowlist and UTC-day
window, and adds stricter off-chain gates (risk, compliance, min float,
x402 budget). Exact bigint revenue split, validated operator events, and a
sha256 hash-chained decision log with tamper detection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 15:17:30 +03:00