xytara 3.1.13 → 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 (55) hide show
  1. package/.env.example +8 -1
  2. package/BSV_TERANODE_PLATFORM_DISCONTINUITY_RUNBOOK.md +126 -126
  3. package/RELEASE_NOTES.md +6 -4
  4. package/lib/a2a_rpc.js +280 -280
  5. package/lib/account_auth.js +585 -585
  6. package/lib/agent_identity.js +162 -162
  7. package/lib/bolt_adapter.js +187 -187
  8. package/lib/bolt_payment_front.js +224 -224
  9. package/lib/checkout_processor_adapter.js +217 -217
  10. package/lib/command_flow.js +722 -722
  11. package/lib/commerce_artifacts.js +591 -591
  12. package/lib/commerce_bridge.js +274 -274
  13. package/lib/commerce_cases.js +399 -399
  14. package/lib/commerce_client.js +7694 -7694
  15. package/lib/commerce_quotes.js +29 -0
  16. package/lib/commerce_runtime.js +322 -322
  17. package/lib/execution_dedupe.js +86 -86
  18. package/lib/external_credit_bridge.js +142 -142
  19. package/lib/http_transport.js +81 -81
  20. package/lib/l402_adapter.js +241 -241
  21. package/lib/l402_payment_front.js +265 -265
  22. package/lib/mpp_adapter.js +237 -237
  23. package/lib/payment_config.js +253 -253
  24. package/lib/payment_verification.js +357 -357
  25. package/lib/provider_payout_execution.js +155 -155
  26. package/lib/provider_registry.js +842 -842
  27. package/lib/rate_limiter.js +81 -81
  28. package/lib/runtime_state_store.js +491 -369
  29. package/lib/settlement_bsv_live.js +600 -600
  30. package/lib/settlement_bsv_teranode.js +117 -117
  31. package/lib/stripe_mpp_payment_front.js +258 -258
  32. package/lib/x402_facilitator.js +191 -191
  33. package/package.json +5 -3
  34. package/scripts/state_backup_offsite.js +196 -0
  35. package/scripts/verify_a2a_rpc.js +105 -105
  36. package/scripts/verify_agent_identity.js +153 -153
  37. package/scripts/verify_all.js +1 -1
  38. package/scripts/verify_bolt_adapter.js +128 -128
  39. package/scripts/verify_cdp_facilitator.js +110 -110
  40. package/scripts/verify_checkout_processor.js +109 -109
  41. package/scripts/verify_commerce_bridge.js +177 -177
  42. package/scripts/verify_execution_dedupe.js +189 -189
  43. package/scripts/verify_execution_surfacing.js +76 -76
  44. package/scripts/verify_final_activation.js +191 -191
  45. package/scripts/verify_l402_adapter.js +86 -86
  46. package/scripts/verify_mpp_adapter.js +128 -128
  47. package/scripts/verify_production_readiness.js +268 -268
  48. package/scripts/verify_rate_limiter.js +52 -52
  49. package/scripts/verify_refund_credit.js +106 -106
  50. package/scripts/verify_release_candidate.js +81 -81
  51. package/scripts/verify_runtime_state_guard.js +117 -0
  52. package/scripts/verify_service.js +15421 -15421
  53. package/scripts/verify_verify_execute_settle.js +208 -208
  54. package/scripts/verify_x402_facilitator.js +286 -286
  55. package/server.js +11976 -11974
package/.env.example CHANGED
@@ -132,7 +132,14 @@ XYTARA_EXTERNAL_EXECUTION_IP_FAMILY=auto
132
132
  XYTARA_CALLBACK_IP_FAMILY=auto
133
133
  XYTARA_SETTLEMENT_IP_FAMILY=auto
134
134
  XYTARA_STATE_FILE=./var/xytara/runtime-state.json
135
- 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
136
143
  XYTARA_SUPABASE_URL=
137
144
  XYTARA_SUPABASE_SERVICE_ROLE_KEY=
138
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/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,7 @@
1
- `xytara` 3.1.13 adds signed delivery receipts and makes the direct MCP path charge only on success.
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
- - **Signed delivery receipts** (`naxytra-delivery-receipt/1`) on every paid call, from the runtime and from the MCP executor. A receipt binds the payment leg (for x402: network, asset, amount, payer, pay_to, settlement transaction), the provider that delivered, and the SHA-256 of the canonical request and of the delivered output. It is signed over its JCS (RFC 8785) canonical form with Ed25519, plus ML-DSA-65 (FIPS-204) where the issuer has a post-quantum key; the signed suite is inside the signed bytes, so stripping a signature fails verification. Public keys: `GET /.well-known/delivery-receipt-keys`; runtime receipts are retrievable at `GET /v1/delivery-receipts/:id`; free check at `POST /v1/delivery-receipts/verify`. Key ids use the xoonya key-ref format, so xoonya's verifier checks them too. Without a configured key a receipt is still issued and marked unsigned — never a fake signature. Boundary: a receipt proves who delivered what for which paid call, unaltered — not whether the output was correct.
4
- - **Real x402 settlement records** — for an x402-paid call the runtime's settlement, treasury, and default-path records now carry the x402 rail, network, amount, payer, pay_to, and settlement transaction, instead of the quote's unsubmitted default rail.
5
- - **MCP executor charges only on success** — `tools/call` now verifies the payment, runs the tool, and settles only if the call succeeded. A tool error, unknown tool, or bad params is never charged; if settlement fails after the work, the output is withheld and the buyer is not charged. A concurrent replay of the same signed authorization is refused (`409 payment_authorization_in_use`).
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.