xytara 3.1.12 → 3.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.env.example +13 -1
  2. package/BSV_TERANODE_PLATFORM_DISCONTINUITY_RUNBOOK.md +126 -126
  3. package/README.md +28 -5
  4. package/RELEASE_NOTES.md +6 -4
  5. package/lib/a2a_rpc.js +280 -280
  6. package/lib/account_auth.js +585 -585
  7. package/lib/agent_identity.js +162 -162
  8. package/lib/bolt_adapter.js +187 -187
  9. package/lib/bolt_payment_front.js +224 -224
  10. package/lib/checkout_processor_adapter.js +217 -217
  11. package/lib/command_flow.js +722 -627
  12. package/lib/commerce_artifacts.js +591 -530
  13. package/lib/commerce_bridge.js +274 -274
  14. package/lib/commerce_cases.js +399 -399
  15. package/lib/commerce_client.js +7694 -7694
  16. package/lib/commerce_quotes.js +29 -0
  17. package/lib/commerce_runtime.js +322 -322
  18. package/lib/delivery_receipt.js +225 -0
  19. package/lib/execution_dedupe.js +86 -86
  20. package/lib/external_credit_bridge.js +142 -142
  21. package/lib/http_transport.js +81 -81
  22. package/lib/l402_adapter.js +241 -241
  23. package/lib/l402_payment_front.js +265 -265
  24. package/lib/mpp_adapter.js +237 -237
  25. package/lib/payment_config.js +253 -253
  26. package/lib/payment_verification.js +357 -356
  27. package/lib/provider_network_contract.js +1 -0
  28. package/lib/provider_payout_execution.js +155 -155
  29. package/lib/provider_registry.js +842 -842
  30. package/lib/rate_limiter.js +81 -81
  31. package/lib/runtime_state_store.js +491 -369
  32. package/lib/settlement_bsv_live.js +600 -600
  33. package/lib/settlement_bsv_teranode.js +117 -117
  34. package/lib/stripe_mpp_payment_front.js +258 -258
  35. package/lib/x402_facilitator.js +191 -191
  36. package/package.json +5 -3
  37. package/scripts/state_backup_offsite.js +196 -0
  38. package/scripts/verify_a2a_rpc.js +105 -105
  39. package/scripts/verify_agent_identity.js +153 -153
  40. package/scripts/verify_all.js +1 -1
  41. package/scripts/verify_bolt_adapter.js +128 -128
  42. package/scripts/verify_cdp_facilitator.js +110 -110
  43. package/scripts/verify_checkout_processor.js +109 -109
  44. package/scripts/verify_commerce_bridge.js +177 -177
  45. package/scripts/verify_execution_dedupe.js +189 -189
  46. package/scripts/verify_execution_surfacing.js +76 -76
  47. package/scripts/verify_final_activation.js +191 -191
  48. package/scripts/verify_l402_adapter.js +86 -86
  49. package/scripts/verify_mpp_adapter.js +128 -128
  50. package/scripts/verify_production_readiness.js +268 -268
  51. package/scripts/verify_rate_limiter.js +52 -52
  52. package/scripts/verify_refund_credit.js +106 -106
  53. package/scripts/verify_release_candidate.js +81 -81
  54. package/scripts/verify_runtime_state_guard.js +117 -0
  55. package/scripts/verify_service.js +15421 -15421
  56. package/scripts/verify_verify_execute_settle.js +208 -208
  57. package/scripts/verify_x402_facilitator.js +286 -216
  58. package/server.js +11976 -11921
package/.env.example CHANGED
@@ -98,6 +98,11 @@ XYTARA_PROVIDER_FAILOVER_MAX=3
98
98
  # routing reputation recency decay, factor in (0,1): fades older observations so recent performance
99
99
  # weighs more. 1 (default) = no decay (lifetime counts). e.g. 0.95 once the network has real history.
100
100
  XYTARA_PROVIDER_REPUTATION_DECAY=1
101
+ # Signed delivery receipts (one per paid call; public keys at GET /.well-known/delivery-receipt-keys).
102
+ # base64 PKCS#8 DER (or PEM) private keys. Ed25519 is the base signature; ML-DSA-65 adds the
103
+ # post-quantum leg (needs Node >= 24). Unset -> receipts are still issued but honestly marked unsigned.
104
+ XYTARA_DELIVERY_RECEIPT_ED25519_KEY=
105
+ XYTARA_DELIVERY_RECEIPT_MLDSA65_KEY=
101
106
  # Provider payout auto-execution via an EXTERNAL signer (the runtime stays key-less). OFF unless the
102
107
  # URL is set; otherwise payouts are recorded and the operator sends + confirms them. See services/payout-signer.
103
108
  XYTARA_PAYOUT_SIGNER_URL=
@@ -127,7 +132,14 @@ XYTARA_EXTERNAL_EXECUTION_IP_FAMILY=auto
127
132
  XYTARA_CALLBACK_IP_FAMILY=auto
128
133
  XYTARA_SETTLEMENT_IP_FAMILY=auto
129
134
  XYTARA_STATE_FILE=./var/xytara/runtime-state.json
130
- XYTARA_STATE_SNAPSHOT_INTERVAL_MS=5000
135
+ # How often the durable snapshot is checked for changes; an unchanged snapshot is never rewritten.
136
+ XYTARA_STATE_SNAPSHOT_INTERVAL_MS=15000
137
+ # Supabase mode: also keep rolling history copies of the snapshot in the same table
138
+ # (rows "<state key>::history::<n>"), one per interval, rotating over N slots. 0 disables.
139
+ XYTARA_STATE_HISTORY_INTERVAL_MS=3600000
140
+ XYTARA_STATE_HISTORY_SLOTS=24
141
+ # Expired, never-paid quotes are dropped from durable state after this long (default 7 days).
142
+ XYTARA_QUOTE_RETENTION_MS=604800000
131
143
  XYTARA_SUPABASE_URL=
132
144
  XYTARA_SUPABASE_SERVICE_ROLE_KEY=
133
145
  XYTARA_SUPABASE_STATE_TABLE=xytara_runtime_state
@@ -1,126 +1,126 @@
1
- # BSV Teranode Platform Discontinuity Runbook
2
-
3
- Date: `2026-05-06`
4
-
5
- ## Purpose
6
-
7
- This runbook explains how to keep `xytara` production-safe through the announced shutdown of the legacy Teranode web platform on `2026-05-15`.
8
-
9
- The important distinction is:
10
-
11
- - the dashboard/control-plane website is being discontinued
12
- - your runtime settlement contract in `xytara` should continue to depend on live ARC submission and live observation endpoints, not on the retiring dashboard
13
-
14
- ## What The Notice Means Operationally
15
-
16
- Treat the notice as saying:
17
-
18
- - do not depend on `https://platform.teranode.group/` remaining available for operator workflows after `2026-05-15`
19
- - existing API keys may continue working, but you should not treat that as your only launch-safe posture
20
- - if you want a replacement ARC key after the shutdown, request it proactively before launch
21
- - WhatsOnChain support and contact ownership are separate from the retiring dashboard
22
-
23
- ## Immediate Pre-3.0.0 Actions
24
-
25
- 1. Back up the operator information you still need from the legacy platform now.
26
- - current API key labels
27
- - network association
28
- - any usage or billing screenshots you care about
29
- - any endpoint, auth, or support notes you may need later
30
-
31
- 2. Do not expose or rotate secrets casually.
32
- - keep the current live ARC key in place until a tested replacement exists
33
- - treat screenshots or copied values as sensitive
34
-
35
- 3. Acquire a replacement or second ARC key before cutover if possible.
36
- - that gives us a tested rollback-safe key path instead of a launch-week scramble
37
-
38
- 4. Keep the observer path independent.
39
- - `xytara` already defaults to WhatsOnChain for observation unless overridden
40
- - if you want a different observer, set it explicitly
41
-
42
- 5. Keep the runtime provider-neutral.
43
- - prefer the neutral `XYTARA_BSV_*` aliases going forward
44
- - legacy `XYTARA_BSV_TERANODE_*` envs remain supported for compatibility
45
-
46
- ## Preferred Environment Shape Going Forward
47
-
48
- Use these neutral envs where practical:
49
-
50
- ```env
51
- XYTARA_BSV_NETWORK=mainnet
52
- XYTARA_BSV_SETTLEMENT_RUNTIME_MODE=arc
53
- XYTARA_BSV_MERCHANT_ADDRESS=<real-bsv-address-or-paymail>
54
- XYTARA_BSV_ARC_RPC_URL=<live-arc-submit-endpoint>
55
- XYTARA_BSV_ARC_RPC_API_KEY=<live-arc-api-key>
56
- XYTARA_BSV_ARC_RPC_AUTH_HEADER=authorization
57
- XYTARA_BSV_ARC_RPC_AUTH_SCHEME=
58
- XYTARA_BSV_OBSERVER_URL=https://api.whatsonchain.com/v1/bsv/main
59
- ```
60
-
61
- Legacy compatibility envs are still accepted:
62
-
63
- - `XYTARA_BSV_TERANODE_NETWORK`
64
- - `XYTARA_BSV_TERANODE_SETTLEMENT_RUNTIME_MODE`
65
- - `XYTARA_BSV_TERANODE_MERCHANT_ADDRESS`
66
- - `XYTARA_BSV_TERANODE_MERCHANT_PAYMAIL`
67
- - `XYTARA_BSV_ARC_RPC_URL`
68
- - `XYTARA_BSV_ARC_RPC_API_KEY`
69
- - `XYTARA_BSV_ARC_RPC_AUTH_HEADER`
70
- - `XYTARA_BSV_ARC_RPC_AUTH_SCHEME`
71
- - legacy `XYTARA_BSV_TERANODE_RPC_*` aliases remain accepted
72
- - `XYTARA_BSV_TERANODE_OBSERVER_URL`
73
-
74
- ## Cutover Validation Sequence
75
-
76
- After you have either confirmed the current key still works or obtained a replacement ARC key:
77
-
78
- 1. update the live Render envs for `xytara`
79
- 2. redeploy `xytara`
80
- 3. check:
81
-
82
- ```text
83
- GET /v1/settlement/bsv-teranode/readiness
84
- GET /v1/settlement/bsv-teranode
85
- GET /v1/payment-rail-truth/summary
86
- GET /v1/autonomous-entry/summary
87
- ```
88
-
89
- 4. run one real settlement path validation
90
- - one quote
91
- - one payment acceptance path
92
- - one settlement record
93
- - one submit/refresh loop
94
-
95
- 5. confirm:
96
- - live submission still works in `arc` mode
97
- - live observation still works
98
- - the runtime does not depend on the retiring dashboard
99
-
100
- ## What To Change If The Provider Changes Endpoint Or Auth Style
101
-
102
- If the ARC provider gives you:
103
-
104
- - a new submit URL
105
- - a new auth header
106
- - a new auth scheme
107
- - a replacement API key
108
-
109
- you should only need to update env values, not the public `bsv_teranode` product contract.
110
-
111
- That is exactly why the runtime should remain:
112
-
113
- - provider-neutral in config
114
- - stable in public naming
115
- - explicit in readiness checks
116
-
117
- ## Launch Rule
118
-
119
- Do not let the old dashboard shutdown weaken the `3.0.0` product truth unnecessarily.
120
-
121
- The right finish-line standard is:
122
-
123
- - `bsv_teranode` remains the native public settlement name
124
- - `xytara` remains provider-neutral behind that name
125
- - live ARC submission and live observation remain validated at operator level
126
- - the public product keeps working even if the original dashboard disappears
1
+ # BSV Teranode Platform Discontinuity Runbook
2
+
3
+ Date: `2026-05-06`
4
+
5
+ ## Purpose
6
+
7
+ This runbook explains how to keep `xytara` production-safe through the announced shutdown of the legacy Teranode web platform on `2026-05-15`.
8
+
9
+ The important distinction is:
10
+
11
+ - the dashboard/control-plane website is being discontinued
12
+ - your runtime settlement contract in `xytara` should continue to depend on live ARC submission and live observation endpoints, not on the retiring dashboard
13
+
14
+ ## What The Notice Means Operationally
15
+
16
+ Treat the notice as saying:
17
+
18
+ - do not depend on `https://platform.teranode.group/` remaining available for operator workflows after `2026-05-15`
19
+ - existing API keys may continue working, but you should not treat that as your only launch-safe posture
20
+ - if you want a replacement ARC key after the shutdown, request it proactively before launch
21
+ - WhatsOnChain support and contact ownership are separate from the retiring dashboard
22
+
23
+ ## Immediate Pre-3.0.0 Actions
24
+
25
+ 1. Back up the operator information you still need from the legacy platform now.
26
+ - current API key labels
27
+ - network association
28
+ - any usage or billing screenshots you care about
29
+ - any endpoint, auth, or support notes you may need later
30
+
31
+ 2. Do not expose or rotate secrets casually.
32
+ - keep the current live ARC key in place until a tested replacement exists
33
+ - treat screenshots or copied values as sensitive
34
+
35
+ 3. Acquire a replacement or second ARC key before cutover if possible.
36
+ - that gives us a tested rollback-safe key path instead of a launch-week scramble
37
+
38
+ 4. Keep the observer path independent.
39
+ - `xytara` already defaults to WhatsOnChain for observation unless overridden
40
+ - if you want a different observer, set it explicitly
41
+
42
+ 5. Keep the runtime provider-neutral.
43
+ - prefer the neutral `XYTARA_BSV_*` aliases going forward
44
+ - legacy `XYTARA_BSV_TERANODE_*` envs remain supported for compatibility
45
+
46
+ ## Preferred Environment Shape Going Forward
47
+
48
+ Use these neutral envs where practical:
49
+
50
+ ```env
51
+ XYTARA_BSV_NETWORK=mainnet
52
+ XYTARA_BSV_SETTLEMENT_RUNTIME_MODE=arc
53
+ XYTARA_BSV_MERCHANT_ADDRESS=<real-bsv-address-or-paymail>
54
+ XYTARA_BSV_ARC_RPC_URL=<live-arc-submit-endpoint>
55
+ XYTARA_BSV_ARC_RPC_API_KEY=<live-arc-api-key>
56
+ XYTARA_BSV_ARC_RPC_AUTH_HEADER=authorization
57
+ XYTARA_BSV_ARC_RPC_AUTH_SCHEME=
58
+ XYTARA_BSV_OBSERVER_URL=https://api.whatsonchain.com/v1/bsv/main
59
+ ```
60
+
61
+ Legacy compatibility envs are still accepted:
62
+
63
+ - `XYTARA_BSV_TERANODE_NETWORK`
64
+ - `XYTARA_BSV_TERANODE_SETTLEMENT_RUNTIME_MODE`
65
+ - `XYTARA_BSV_TERANODE_MERCHANT_ADDRESS`
66
+ - `XYTARA_BSV_TERANODE_MERCHANT_PAYMAIL`
67
+ - `XYTARA_BSV_ARC_RPC_URL`
68
+ - `XYTARA_BSV_ARC_RPC_API_KEY`
69
+ - `XYTARA_BSV_ARC_RPC_AUTH_HEADER`
70
+ - `XYTARA_BSV_ARC_RPC_AUTH_SCHEME`
71
+ - legacy `XYTARA_BSV_TERANODE_RPC_*` aliases remain accepted
72
+ - `XYTARA_BSV_TERANODE_OBSERVER_URL`
73
+
74
+ ## Cutover Validation Sequence
75
+
76
+ After you have either confirmed the current key still works or obtained a replacement ARC key:
77
+
78
+ 1. update the live Render envs for `xytara`
79
+ 2. redeploy `xytara`
80
+ 3. check:
81
+
82
+ ```text
83
+ GET /v1/settlement/bsv-teranode/readiness
84
+ GET /v1/settlement/bsv-teranode
85
+ GET /v1/payment-rail-truth/summary
86
+ GET /v1/autonomous-entry/summary
87
+ ```
88
+
89
+ 4. run one real settlement path validation
90
+ - one quote
91
+ - one payment acceptance path
92
+ - one settlement record
93
+ - one submit/refresh loop
94
+
95
+ 5. confirm:
96
+ - live submission still works in `arc` mode
97
+ - live observation still works
98
+ - the runtime does not depend on the retiring dashboard
99
+
100
+ ## What To Change If The Provider Changes Endpoint Or Auth Style
101
+
102
+ If the ARC provider gives you:
103
+
104
+ - a new submit URL
105
+ - a new auth header
106
+ - a new auth scheme
107
+ - a replacement API key
108
+
109
+ you should only need to update env values, not the public `bsv_teranode` product contract.
110
+
111
+ That is exactly why the runtime should remain:
112
+
113
+ - provider-neutral in config
114
+ - stable in public naming
115
+ - explicit in readiness checks
116
+
117
+ ## Launch Rule
118
+
119
+ Do not let the old dashboard shutdown weaken the `3.0.0` product truth unnecessarily.
120
+
121
+ The right finish-line standard is:
122
+
123
+ - `bsv_teranode` remains the native public settlement name
124
+ - `xytara` remains provider-neutral behind that name
125
+ - live ARC submission and live observation remain validated at operator level
126
+ - the public product keeps working even if the original dashboard disappears
package/README.md CHANGED
@@ -4,7 +4,8 @@ Listed on [Smithery](https://smithery.ai/server/naxytra/xytara-mcp-executor) ·
4
4
 
5
5
  **x402 pay-per-call agent-commerce runtime** — the payment and execution layer of the naxytra
6
6
  machine stack. An agent discovers a capability, pays once with x402 (gasless USDC on Base), and gets
7
- a real deliverable, with settlement and revenue reconciled on-chain. The proof-side half is
7
+ a real deliverable, settled on-chain, with the revenue split reconciled in the ledger and paid out
8
+ on-chain, plus a signed delivery receipt. The proof-side half is
8
9
  [xoonya](https://naxytra.com/xoonya).
9
10
 
10
11
  ## Proven live on Base mainnet
@@ -13,8 +14,8 @@ All demonstrated end to end on Base mainnet (provider-payout transactions are pu
13
14
  see **Proof** below):
14
15
 
15
16
  - **Open settling provider network** — a paid x402 call routes to an independently-registered
16
- execution provider, returns a real deliverable, and splits revenue on-chain (reconciled ledger,
17
- platform keeps the remainder).
17
+ execution provider, returns a real deliverable, and splits revenue — reconciled in the ledger and
18
+ paid out on-chain (platform keeps the remainder).
18
19
  - **Automated on-chain provider payouts** — a key-less runtime dispatches to an external signer that
19
20
  sends USDC on Base; reconciled, idempotent, double-pay-safe.
20
21
  - **Cryptographic bounded delegated spend** — a stolen bearer token cannot spend; each spend requires
@@ -30,10 +31,32 @@ endpoint: https://xytara-mcp-executor.onrender.com/mcp
30
31
  tools/list -> free (17 deterministic tools)
31
32
  tools/call -> 402 Payment Required with a price
32
33
  -> sign ONE gasless USDC authorization (x402 / EIP-3009)
33
- -> the Coinbase CDP facilitator verifies + settles it on Base
34
- -> the tool runs; the response carries the result + an on-chain settlement receipt
34
+ -> the Coinbase CDP facilitator verifies it; the tool runs
35
+ -> only if the tool succeeds is the payment settled on Base (a failed call is not charged)
36
+ -> the response carries the result, the on-chain settlement receipt, and a signed
37
+ delivery receipt in result._meta["naxytra.com/delivery-receipt"]
35
38
  ```
36
39
 
40
+ ## Signed delivery receipts
41
+
42
+ Every paid call returns a `naxytra-delivery-receipt/1`: the payment leg (for x402, the network,
43
+ asset, amount, payer, pay_to, and settlement transaction), the provider that delivered, and the
44
+ SHA-256 of the canonical request and of the delivered output — signed over its JCS (RFC 8785)
45
+ canonical form with Ed25519, plus ML-DSA-65 (FIPS-204) where the issuer has a post-quantum key. The
46
+ signed suite is part of the signed bytes, so stripping a signature fails verification.
47
+
48
+ ```
49
+ GET /.well-known/delivery-receipt-keys # the issuer's public keys (pin them)
50
+ GET /v1/delivery-receipts/:receipt_id # fetch a receipt the runtime issued
51
+ POST /v1/delivery-receipts/verify # free signature check
52
+ ```
53
+
54
+ Verify independently: recompute `sha256(JCS(output you received))`, check the settlement
55
+ transaction on-chain, and verify each signature over the canonical bytes with `node:crypto` or
56
+ xoonya's `verifyExternalProofSignature` (the receipt's `kid` is the key ref xoonya reports).
57
+ A receipt proves who delivered what for which paid call, unaltered since signing — **not** whether
58
+ the output was correct or good.
59
+
37
60
  Tools: `summarize`, `text.extract`, `html.to-text`, `text.chunk`, `json.validate`, `zones.lookup`,
38
61
  `keccak256`, `address.validate`, `abi.encode`, `abi.decode`, `merkle.verify`, `eip712.hash`,
39
62
  `x402.decode`, `x402.verify-receipt`, `tx.status`, `reply.draft`, `catalog`.
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,7 @@
1
- `xytara` 3.1.12 makes the public adapter-depth surface report open-network providers truthfully.
1
+ `xytara` 3.1.14 makes runtime state durable under backend failures, writes it more lightly, and backs it up off-site.
2
2
 
3
- - `/v1/adapter-depth` and `/v1/adapter-depth/summary` now count ACTIVE open-network providers that declared an adapter task as provider-live paths, alongside operator env targets. Each is labelled `routing: open_provider_registry`, and the pack lists its `depth_sources`. A pending provider never counts, and a provider is shown as shadowed (not counted) when an operator env target pins the whole lane, because env targets are routed first.
4
- - Previously the surface only looked at env targets, so it reported `provider_wiring_required` even while paid MCP calls were being served by the live registry provider. It now reports `initial_provider_live_path` for the task that provider serves.
5
- - Internal callers without runtime state keep the env-only view, so no other surface changes.
3
+ - **Write guard** — if the boot-time restore of durable state fails (e.g. the state backend times out), the runtime never writes: writing would overwrite the good snapshot with near-empty state. It retries the restore in the background, merges the snapshot under anything that happened since boot, and only then resumes writes. Proven in production during a state-backend outage: the full snapshot was restored with nothing lost.
4
+ - **Lighter writes** — the snapshot is written only when its content changed (identical rewrites are skipped and counted), the default check interval is 15s, and expired never-paid quotes are pruned after 7 days (`XYTARA_QUOTE_RETENTION_MS`).
5
+ - **Rolling history** — in Supabase mode the snapshot is also kept in rotating hourly history rows (24 by default), so a bad write can be rolled back.
6
+ - **Off-site encrypted backups** — `scripts/state_backup_offsite.js` (gzip + AES-256-GCM; refuses a near-empty snapshot so a failed scheduled run is an alert; decrypt and guarded restore modes) with a daily workflow.
7
+ - Published through npm trusted publishing (GitHub OIDC) — no npm token involved.