xytara 3.1.16 → 3.2.0

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 (390) hide show
  1. package/README.md +120 -92
  2. package/RELEASE_NOTES.md +7 -3
  3. package/START_HERE.md +56 -224
  4. package/bin/xytara.js +21 -8
  5. package/client.js +79 -1
  6. package/lib/{delivery_receipt.js → delivery_receipt_verify.js} +14 -100
  7. package/package.json +25 -35
  8. package/scripts/verify_client.js +418 -0
  9. package/scripts/verify_release_candidate.js +146 -45
  10. package/.env.example +0 -173
  11. package/ADAPTER_START_HERE.md +0 -56
  12. package/BSV_TERANODE_PLATFORM_DISCONTINUITY_RUNBOOK.md +0 -126
  13. package/CARRIED_HANDOFF_DEMO.md +0 -60
  14. package/EXAMPLE_PATHS.md +0 -53
  15. package/FINAL_CONTRACT.md +0 -498
  16. package/PARTNER_READY_PATH.md +0 -71
  17. package/PUBLIC_DEMO_SCRIPT.md +0 -78
  18. package/REAL_PAYMENT_SETUP.md +0 -320
  19. package/SERVICE_CONTRACT.md +0 -419
  20. package/SUPABASE_RUNTIME_STATE_SETUP.md +0 -61
  21. package/TERMINOLOGY.md +0 -50
  22. package/WHY_XYTARA_XOONYA.md +0 -63
  23. package/XT1_EXECUTION_TRUTH_STANDARD.md +0 -78
  24. package/XYTARA_ADAPTER_PROTOCOL_TRUTH_MODEL.md +0 -75
  25. package/XYTARA_AUTONOMOUS_ENTRY_MODEL.md +0 -124
  26. package/XYTARA_DEFAULT_PATH_MODEL.md +0 -84
  27. package/XYTARA_EXECUTION_TRUTH_MODEL.md +0 -171
  28. package/XYTARA_PAYMENT_RAIL_TRUTH_MODEL.md +0 -68
  29. package/adapters/AUTHORING_GUIDE.md +0 -244
  30. package/adapters/ONBOARDING_POSTURE.md +0 -61
  31. package/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md +0 -84
  32. package/adapters/adapter-manifest.schema.json +0 -283
  33. package/adapters/examples/example-execution-adapter.js +0 -61
  34. package/adapters/examples/example-execution-adapter.manifest.json +0 -81
  35. package/adapters/examples/example-settlement-adapter.js +0 -55
  36. package/adapters/examples/example-settlement-adapter.manifest.json +0 -78
  37. package/adapters/examples/example-third-party-acp-registration.submission-bundle.json +0 -124
  38. package/adapters/examples/example-third-party-erc8004-registration.submission-bundle.json +0 -121
  39. package/adapters/examples/example-third-party-identity-registration.certification-pack.json +0 -22
  40. package/adapters/examples/example-third-party-identity-registration.record.json +0 -26
  41. package/adapters/examples/example-third-party-identity-registration.submission-bundle.json +0 -126
  42. package/adapters/examples/example-third-party-langchain-registration.submission-bundle.json +0 -124
  43. package/adapters/examples/example-third-party-mpp-registration.submission-bundle.json +0 -120
  44. package/adapters/examples/example-third-party-registration.certification-pack.json +0 -22
  45. package/adapters/examples/example-third-party-registration.record.json +0 -28
  46. package/adapters/examples/example-third-party-registration.submission-bundle.json +0 -126
  47. package/adapters/examples/example-third-party-settlement-registration.certification-pack.json +0 -22
  48. package/adapters/examples/example-third-party-settlement-registration.record.json +0 -26
  49. package/adapters/examples/example-third-party-settlement-registration.submission-bundle.json +0 -127
  50. package/adapters/examples/langchain-reference-execution-adapter.js +0 -81
  51. package/adapters/examples/langchain-reference-execution-adapter.manifest.json +0 -79
  52. package/adapters/examples/langgraph-reference-execution-adapter.js +0 -81
  53. package/adapters/examples/langgraph-reference-execution-adapter.manifest.json +0 -79
  54. package/adapters/examples/minimal-third-party-execution-adapter.js +0 -61
  55. package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +0 -79
  56. package/adapters/examples/minimal-third-party-execution-registration.record.json +0 -26
  57. package/adapters/examples/minimal-third-party-execution.certification-pack.json +0 -22
  58. package/adapters/examples/minimal-third-party-execution.submission-bundle.json +0 -126
  59. package/adapters/integration-certification-pack.schema.json +0 -82
  60. package/adapters/integration-registration-record.schema.json +0 -114
  61. package/adapters/integration-submission-bundle-set.schema.json +0 -39
  62. package/adapters/integration-submission-bundle.schema.json +0 -34
  63. package/adapters/interfaces.js +0 -56
  64. package/bin/xytara-release.js +0 -1429
  65. package/examples/_demo_env.js +0 -40
  66. package/examples/adapter_review_walkthrough.js +0 -54
  67. package/examples/export_carried_handoff.js +0 -81
  68. package/examples/funded_runtime_walkthrough.js +0 -71
  69. package/examples/partner_launch_walkthrough.js +0 -44
  70. package/examples/quickstart.js +0 -3256
  71. package/fixtures/catalog.js +0 -1156
  72. package/index.js +0 -395
  73. package/integrations/dispatch.js +0 -276
  74. package/integrations/registry-snapshot.schema.json +0 -36
  75. package/integrations/registry.js +0 -2261
  76. package/integrations/views.js +0 -28
  77. package/lib/a2a_lane_contract.js +0 -104
  78. package/lib/a2a_rpc.js +0 -287
  79. package/lib/a2c_lane_contract.js +0 -111
  80. package/lib/account_auth.js +0 -585
  81. package/lib/acp_lane_contract.js +0 -54
  82. package/lib/activity_audit_contract.js +0 -322
  83. package/lib/adapter_certification_contract.js +0 -130
  84. package/lib/adapter_depth_contract.js +0 -218
  85. package/lib/adapter_pack.js +0 -118
  86. package/lib/adapter_partner_pack.js +0 -89
  87. package/lib/adapter_promotion_pack.js +0 -89
  88. package/lib/adapter_protocol_truth_contract.js +0 -229
  89. package/lib/agent_identity.js +0 -162
  90. package/lib/announcement_pack.js +0 -61
  91. package/lib/artifact_distribution_lane_contract.js +0 -54
  92. package/lib/asyncapi_contract.js +0 -150
  93. package/lib/auth_interop_contract.js +0 -80
  94. package/lib/authority_binding_lifecycle_contract.js +0 -182
  95. package/lib/autonomous_entry_contract.js +0 -409
  96. package/lib/bolt_adapter.js +0 -187
  97. package/lib/bolt_lane_contract.js +0 -55
  98. package/lib/bolt_payment_front.js +0 -224
  99. package/lib/business_cockpit.js +0 -378
  100. package/lib/buyer_event_log.js +0 -230
  101. package/lib/buyer_safety_policy.js +0 -132
  102. package/lib/capability_execution_truth.js +0 -276
  103. package/lib/capability_registry.js +0 -633
  104. package/lib/catalog_contract.js +0 -966
  105. package/lib/catalog_family_model.js +0 -193
  106. package/lib/catalog_views.js +0 -55
  107. package/lib/cdp_jwt.js +0 -57
  108. package/lib/checkout_event_security.js +0 -142
  109. package/lib/checkout_processor_adapter.js +0 -217
  110. package/lib/cloudevents_contract.js +0 -80
  111. package/lib/command_flow.js +0 -911
  112. package/lib/commerce_artifacts.js +0 -591
  113. package/lib/commerce_authority.js +0 -449
  114. package/lib/commerce_bridge.js +0 -274
  115. package/lib/commerce_cases.js +0 -399
  116. package/lib/commerce_checkout.js +0 -509
  117. package/lib/commerce_coordination.js +0 -346
  118. package/lib/commerce_economics.js +0 -4017
  119. package/lib/commerce_identity.js +0 -578
  120. package/lib/commerce_quotes.js +0 -266
  121. package/lib/commerce_reports.js +0 -14461
  122. package/lib/commerce_runtime.js +0 -322
  123. package/lib/commerce_shell.js +0 -257
  124. package/lib/crypto_agility_matrix.js +0 -125
  125. package/lib/default_path_contract.js +0 -412
  126. package/lib/delivery_summary_contract.js +0 -95
  127. package/lib/ecosystem_entry.js +0 -64
  128. package/lib/erc8004_lane_contract.js +0 -65
  129. package/lib/event_system_lane_contract.js +0 -75
  130. package/lib/execution_dedupe.js +0 -86
  131. package/lib/execution_truth_contract.js +0 -234
  132. package/lib/external_credit_bridge.js +0 -142
  133. package/lib/external_execution_policy.js +0 -143
  134. package/lib/external_execution_runtime.js +0 -238
  135. package/lib/feature_control_lane_contract.js +0 -54
  136. package/lib/first_run_conversion_contract.js +0 -290
  137. package/lib/framework_lane_contract.js +0 -89
  138. package/lib/framework_provider_promotion.js +0 -235
  139. package/lib/full_catalog_contract.js +0 -525
  140. package/lib/go_live_operator_pack.js +0 -391
  141. package/lib/http_transport.js +0 -99
  142. package/lib/identity_auth.js +0 -175
  143. package/lib/identity_interop_contract.js +0 -82
  144. package/lib/integration_matrix_contract.js +0 -102
  145. package/lib/l402_adapter.js +0 -241
  146. package/lib/l402_lane_contract.js +0 -55
  147. package/lib/l402_payment_front.js +0 -265
  148. package/lib/launch_narrative.js +0 -53
  149. package/lib/lifecycle_continuity_contract.js +0 -115
  150. package/lib/machine_identity_registry_contract.js +0 -199
  151. package/lib/major_rails_lane_contract.js +0 -150
  152. package/lib/market_lane_contract.js +0 -467
  153. package/lib/market_lane_depth_contract.js +0 -182
  154. package/lib/market_lane_promotion_contract.js +0 -210
  155. package/lib/market_lane_trace_contract.js +0 -278
  156. package/lib/mcp_lane_contract.js +0 -137
  157. package/lib/mpp_adapter.js +0 -237
  158. package/lib/network_transport.js +0 -110
  159. package/lib/offline_verifiability_recovery_contract.js +0 -155
  160. package/lib/openapi_contract.js +0 -300
  161. package/lib/operational_receipt_contract.js +0 -165
  162. package/lib/operator_intelligence.js +0 -407
  163. package/lib/outreach_copy_pack.js +0 -51
  164. package/lib/outreach_message_pack.js +0 -71
  165. package/lib/outreach_proof.js +0 -71
  166. package/lib/outreach_target_pack.js +0 -60
  167. package/lib/partner_intelligence.js +0 -105
  168. package/lib/payment_config.js +0 -257
  169. package/lib/payment_front_registry.js +0 -53
  170. package/lib/payment_protocol_contract.js +0 -165
  171. package/lib/payment_rail_truth_contract.js +0 -324
  172. package/lib/payment_verification.js +0 -357
  173. package/lib/phase_10_closeout_pack.js +0 -45
  174. package/lib/phase_10_completion_pack.js +0 -76
  175. package/lib/phase_10_decision_record_pack.js +0 -54
  176. package/lib/phase_10_decision_resolution_pack.js +0 -53
  177. package/lib/phase_10_demand_signal_adapters_runtime_pack.js +0 -74
  178. package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +0 -74
  179. package/lib/phase_10_freeze_baseline_pack.js +0 -67
  180. package/lib/phase_10_freeze_review_pack.js +0 -64
  181. package/lib/phase_10_gate_pack.js +0 -57
  182. package/lib/phase_10_long_tail_continuity_pack.js +0 -80
  183. package/lib/phase_10_long_tail_ecosystem_pack.js +0 -66
  184. package/lib/phase_10_niche_extension_registry_runtime_pack.js +0 -74
  185. package/lib/phase_1_claude_mcp_pack.js +0 -60
  186. package/lib/phase_1_claude_mcp_runtime_pack.js +0 -52
  187. package/lib/phase_1_ecosystem_pack.js +0 -67
  188. package/lib/phase_1_openai_codex_pack.js +0 -60
  189. package/lib/phase_1_openai_codex_runtime_pack.js +0 -52
  190. package/lib/phase_2_base_runtime_pack.js +0 -71
  191. package/lib/phase_2_base_usdc_runtime_pack.js +0 -72
  192. package/lib/phase_2_closeout_pack.js +0 -65
  193. package/lib/phase_2_completion_pack.js +0 -113
  194. package/lib/phase_2_decision_record_pack.js +0 -66
  195. package/lib/phase_2_decision_resolution_pack.js +0 -69
  196. package/lib/phase_2_eth_runtime_pack.js +0 -70
  197. package/lib/phase_2_evm_base_runtime_pack.js +0 -73
  198. package/lib/phase_2_evm_runtime_pack.js +0 -71
  199. package/lib/phase_2_flip_preview_pack.js +0 -60
  200. package/lib/phase_2_freeze_review_pack.js +0 -99
  201. package/lib/phase_2_gate_pack.js +0 -77
  202. package/lib/phase_2_payment_rails_pack.js +0 -71
  203. package/lib/phase_2_usdc_runtime_pack.js +0 -71
  204. package/lib/phase_3_brc_runtime_pack.js +0 -81
  205. package/lib/phase_3_bsv_teranode_runtime_pack.js +0 -83
  206. package/lib/phase_3_closeout_pack.js +0 -62
  207. package/lib/phase_3_completion_pack.js +0 -94
  208. package/lib/phase_3_decision_record_pack.js +0 -64
  209. package/lib/phase_3_decision_resolution_pack.js +0 -69
  210. package/lib/phase_3_freeze_baseline_pack.js +0 -67
  211. package/lib/phase_3_freeze_review_pack.js +0 -80
  212. package/lib/phase_3_gate_pack.js +0 -76
  213. package/lib/phase_3_metanet_runtime_pack.js +0 -81
  214. package/lib/phase_3_native_bsv_pack.js +0 -91
  215. package/lib/phase_3_native_continuity_pack.js +0 -82
  216. package/lib/phase_4_attestation_runtime_pack.js +0 -75
  217. package/lib/phase_4_closeout_pack.js +0 -45
  218. package/lib/phase_4_completion_pack.js +0 -94
  219. package/lib/phase_4_decision_record_pack.js +0 -54
  220. package/lib/phase_4_decision_resolution_pack.js +0 -45
  221. package/lib/phase_4_erc8004_runtime_pack.js +0 -76
  222. package/lib/phase_4_freeze_baseline_pack.js +0 -67
  223. package/lib/phase_4_freeze_review_pack.js +0 -68
  224. package/lib/phase_4_gate_pack.js +0 -58
  225. package/lib/phase_4_identity_registry_runtime_pack.js +0 -75
  226. package/lib/phase_4_identity_trust_pack.js +0 -73
  227. package/lib/phase_4_trust_continuity_pack.js +0 -86
  228. package/lib/phase_5_antelope_runtime_pack.js +0 -76
  229. package/lib/phase_5_closeout_pack.js +0 -44
  230. package/lib/phase_5_completion_pack.js +0 -82
  231. package/lib/phase_5_constellation_dag_runtime_pack.js +0 -76
  232. package/lib/phase_5_decision_record_pack.js +0 -54
  233. package/lib/phase_5_decision_resolution_pack.js +0 -45
  234. package/lib/phase_5_digibyte_dgb_runtime_pack.js +0 -76
  235. package/lib/phase_5_freeze_baseline_pack.js +0 -67
  236. package/lib/phase_5_freeze_review_pack.js +0 -68
  237. package/lib/phase_5_gate_pack.js +0 -58
  238. package/lib/phase_5_hedera_hbar_runtime_pack.js +0 -76
  239. package/lib/phase_5_kaspa_kas_runtime_pack.js +0 -76
  240. package/lib/phase_5_major_rails_continuity_pack.js +0 -86
  241. package/lib/phase_5_major_rails_pack.js +0 -110
  242. package/lib/phase_5_metal_runtime_pack.js +0 -76
  243. package/lib/phase_5_polkadot_dot_runtime_pack.js +0 -76
  244. package/lib/phase_5_proton_xpr_runtime_pack.js +0 -76
  245. package/lib/phase_5_solana_runtime_pack.js +0 -76
  246. package/lib/phase_6_autogen_runtime_pack.js +0 -72
  247. package/lib/phase_6_closeout_pack.js +0 -46
  248. package/lib/phase_6_completion_pack.js +0 -77
  249. package/lib/phase_6_decision_record_pack.js +0 -54
  250. package/lib/phase_6_decision_resolution_pack.js +0 -53
  251. package/lib/phase_6_framework_continuity_pack.js +0 -81
  252. package/lib/phase_6_framework_runtime_pack.js +0 -68
  253. package/lib/phase_6_freeze_baseline_pack.js +0 -68
  254. package/lib/phase_6_freeze_review_pack.js +0 -65
  255. package/lib/phase_6_gate_pack.js +0 -59
  256. package/lib/phase_6_langchain_runtime_pack.js +0 -72
  257. package/lib/phase_6_langgraph_runtime_pack.js +0 -72
  258. package/lib/phase_6_semantic_kernel_runtime_pack.js +0 -72
  259. package/lib/phase_7_closeout_pack.js +0 -45
  260. package/lib/phase_7_completion_pack.js +0 -85
  261. package/lib/phase_7_decision_record_pack.js +0 -53
  262. package/lib/phase_7_decision_resolution_pack.js +0 -53
  263. package/lib/phase_7_event_system_continuity_pack.js +0 -89
  264. package/lib/phase_7_event_system_pack.js +0 -76
  265. package/lib/phase_7_freeze_baseline_pack.js +0 -74
  266. package/lib/phase_7_freeze_review_pack.js +0 -65
  267. package/lib/phase_7_gate_pack.js +0 -58
  268. package/lib/phase_7_kafka_runtime_pack.js +0 -74
  269. package/lib/phase_7_mqtt_runtime_pack.js +0 -74
  270. package/lib/phase_7_nats_runtime_pack.js +0 -74
  271. package/lib/phase_7_webhook_event_bus_runtime_pack.js +0 -74
  272. package/lib/phase_8_closeout_pack.js +0 -46
  273. package/lib/phase_8_completion_pack.js +0 -82
  274. package/lib/phase_8_decision_record_pack.js +0 -54
  275. package/lib/phase_8_decision_resolution_pack.js +0 -53
  276. package/lib/phase_8_external_receipt_import_runtime_pack.js +0 -74
  277. package/lib/phase_8_external_result_import_runtime_pack.js +0 -74
  278. package/lib/phase_8_freeze_baseline_pack.js +0 -71
  279. package/lib/phase_8_freeze_review_pack.js +0 -64
  280. package/lib/phase_8_gate_pack.js +0 -58
  281. package/lib/phase_8_proof_bridge_continuity_pack.js +0 -86
  282. package/lib/phase_8_proof_bridges_pack.js +0 -72
  283. package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +0 -74
  284. package/lib/phase_9_closeout_pack.js +0 -46
  285. package/lib/phase_9_completion_pack.js +0 -82
  286. package/lib/phase_9_custody_refs_runtime_pack.js +0 -74
  287. package/lib/phase_9_decision_record_pack.js +0 -54
  288. package/lib/phase_9_decision_resolution_pack.js +0 -53
  289. package/lib/phase_9_freeze_baseline_pack.js +0 -71
  290. package/lib/phase_9_freeze_review_pack.js +0 -64
  291. package/lib/phase_9_gate_pack.js +0 -58
  292. package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +0 -74
  293. package/lib/phase_9_treasury_connectivity_pack.js +0 -72
  294. package/lib/phase_9_treasury_continuity_pack.js +0 -86
  295. package/lib/phase_9_treasury_destinations_runtime_pack.js +0 -74
  296. package/lib/phase_program_pack.js +0 -120
  297. package/lib/pricing_optimization_contract.js +0 -775
  298. package/lib/protocol_lane_contract.js +0 -117
  299. package/lib/provenance_lane_contract.js +0 -54
  300. package/lib/provider_lane_contract.js +0 -240
  301. package/lib/provider_network_contract.js +0 -149
  302. package/lib/provider_payout_execution.js +0 -155
  303. package/lib/provider_registry.js +0 -852
  304. package/lib/provider_runtime_journey_contract.js +0 -183
  305. package/lib/public_surface_policy_contract.js +0 -111
  306. package/lib/publish_plan.js +0 -51
  307. package/lib/rate_limiter.js +0 -81
  308. package/lib/record_queries.js +0 -48
  309. package/lib/release_candidate.js +0 -50
  310. package/lib/release_center.js +0 -1093
  311. package/lib/release_history.js +0 -205
  312. package/lib/release_manifest.js +0 -113
  313. package/lib/release_pack.js +0 -453
  314. package/lib/request_rate_limit.js +0 -144
  315. package/lib/resource_views.js +0 -31
  316. package/lib/revenue_launch_path_contract.js +0 -326
  317. package/lib/route_matchers.js +0 -34
  318. package/lib/route_params.js +0 -19
  319. package/lib/runtime_bridge.js +0 -124
  320. package/lib/runtime_operations_worker.js +0 -282
  321. package/lib/runtime_state_store.js +0 -495
  322. package/lib/settlement_bsv_live.js +0 -600
  323. package/lib/settlement_bsv_teranode.js +0 -117
  324. package/lib/settlement_lane_contract.js +0 -111
  325. package/lib/shared_signals_lane_contract.js +0 -54
  326. package/lib/signed_audit_provenance_contract.js +0 -83
  327. package/lib/soft_launch_pack.js +0 -78
  328. package/lib/stablecoin_lane_contract.js +0 -76
  329. package/lib/stripe_mpp_lane_contract.js +0 -96
  330. package/lib/stripe_mpp_payment_front.js +0 -258
  331. package/lib/telemetry_lane_contract.js +0 -54
  332. package/lib/treasury_destinations_contract.js +0 -764
  333. package/lib/treasury_egress_policy_contract.js +0 -91
  334. package/lib/treasury_lane_contract.js +0 -84
  335. package/lib/trust_portability_boundary_contract.js +0 -72
  336. package/lib/x402_facilitator.js +0 -198
  337. package/lib/x402_lane_contract.js +0 -136
  338. package/lib/x402_settlement_recovery.js +0 -175
  339. package/scripts/buyer_events_daily_report.js +0 -79
  340. package/scripts/registry_cli.js +0 -275
  341. package/scripts/state_backup_offsite.js +0 -196
  342. package/scripts/verify_a2a_rpc.js +0 -131
  343. package/scripts/verify_adapters.js +0 -554
  344. package/scripts/verify_agent_identity.js +0 -153
  345. package/scripts/verify_all.js +0 -4963
  346. package/scripts/verify_bolt_adapter.js +0 -128
  347. package/scripts/verify_buyer_event_log.js +0 -128
  348. package/scripts/verify_buyer_safety.js +0 -141
  349. package/scripts/verify_cdp_facilitator.js +0 -110
  350. package/scripts/verify_checkout_processor.js +0 -109
  351. package/scripts/verify_commerce_bridge.js +0 -177
  352. package/scripts/verify_control_plane_contracts.js +0 -34
  353. package/scripts/verify_control_plane_routes.js +0 -70
  354. package/scripts/verify_delivery_summary.js +0 -112
  355. package/scripts/verify_examples.js +0 -19
  356. package/scripts/verify_execution_dedupe.js +0 -189
  357. package/scripts/verify_execution_surfacing.js +0 -76
  358. package/scripts/verify_external_execution_retry.js +0 -140
  359. package/scripts/verify_final_activation.js +0 -191
  360. package/scripts/verify_first_run_conversions.js +0 -81
  361. package/scripts/verify_framework_provider_promotion.js +0 -152
  362. package/scripts/verify_full_catalog.js +0 -174
  363. package/scripts/verify_integrations.js +0 -620
  364. package/scripts/verify_l402_adapter.js +0 -86
  365. package/scripts/verify_lifecycle_continuity.js +0 -96
  366. package/scripts/verify_lifecycle_spend_binding.js +0 -88
  367. package/scripts/verify_market_lane_depth.js +0 -94
  368. package/scripts/verify_market_lane_promotion.js +0 -103
  369. package/scripts/verify_market_lane_traces.js +0 -98
  370. package/scripts/verify_market_lanes.js +0 -102
  371. package/scripts/verify_mpp_adapter.js +0 -128
  372. package/scripts/verify_operator_observability_boundary.js +0 -83
  373. package/scripts/verify_pricing_experiment_plan.js +0 -124
  374. package/scripts/verify_production_readiness.js +0 -268
  375. package/scripts/verify_provider_network.js +0 -819
  376. package/scripts/verify_provider_runtime_breadth.js +0 -109
  377. package/scripts/verify_provider_runtime_journeys.js +0 -111
  378. package/scripts/verify_rate_limiter.js +0 -52
  379. package/scripts/verify_refund_credit.js +0 -106
  380. package/scripts/verify_revenue_launch_paths.js +0 -105
  381. package/scripts/verify_runtime_durability.js +0 -52
  382. package/scripts/verify_runtime_state_guard.js +0 -117
  383. package/scripts/verify_service.js +0 -15421
  384. package/scripts/verify_settlement.js +0 -116
  385. package/scripts/verify_tooling.js +0 -1412
  386. package/scripts/verify_treasury_public_boundary.js +0 -97
  387. package/scripts/verify_verify_execute_settle.js +0 -209
  388. package/scripts/verify_x402_facilitator.js +0 -307
  389. package/scripts/verify_x402_settlement_recovery.js +0 -153
  390. package/server.js +0 -12245
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- const assert = require("assert");
4
- const { createServer } = require("../server");
5
- const {
6
- buildProviderLanePack,
7
- getProviderProfileDetail,
8
- summarizeProviderLanePack
9
- } = require("../lib/provider_lane_contract");
10
-
11
- async function getJson(baseUrl, path) {
12
- const response = await fetch(`${baseUrl}${path}`);
13
- return {
14
- status: response.status,
15
- json: await response.json()
16
- };
17
- }
18
-
19
- async function main() {
20
- const previousExecutionTargets = process.env.XYTARA_EXECUTION_TARGETS_JSON;
21
- process.env.XYTARA_EXECUTION_TARGETS_JSON = JSON.stringify([
22
- {
23
- target_id: "verify-provider-runtime-mcp-target",
24
- task_ref: "adapter.mcp.invoke",
25
- endpoint_url: "http://127.0.0.1:65535/execute",
26
- provider: "xytara_mcp_executor",
27
- tool_name: "summarize",
28
- auth_token: "verify-provider-runtime-bearer",
29
- timeout_ms: 1500,
30
- enabled: true
31
- }
32
- ]);
33
-
34
- const pack = buildProviderLanePack();
35
- const summary = summarizeProviderLanePack();
36
- assert.strictEqual(pack.ok, true, "provider lane pack ok flag missing");
37
- assert.strictEqual(summary.ok, true, "provider lane summary ok flag missing");
38
- assert.strictEqual(pack.category, "machine-commerce-provider-lane-pack", "provider lane category mismatch");
39
- assert.strictEqual(pack.pack_version, "xytara-provider-lane-pack-v2", "provider lane version mismatch");
40
- assert.strictEqual(summary.summary_version, "xytara-provider-lane-pack-summary-v2", "provider lane summary version mismatch");
41
- assert.strictEqual(summary.provider_profile_count >= 2, true, "provider profile count missing");
42
- assert.strictEqual(summary.first_party_callable_profile_count >= 2, true, "provider callable profile count missing");
43
- assert.strictEqual(summary.revenue_ready_profile_count >= 2, true, "provider revenue-ready profile count missing");
44
- assert.strictEqual(summary.provider_live_anchor_profile_count >= 1, true, "provider live-anchor profile count missing");
45
- assert.strictEqual(summary.proof_followthrough_profile_count >= 2, true, "provider proof-followthrough profile count missing");
46
-
47
- const openaiProfile = getProviderProfileDetail("openai_codex");
48
- const claudeProfile = getProviderProfileDetail("claude_mcp");
49
- assert.strictEqual(Boolean(openaiProfile), true, "openai provider profile missing");
50
- assert.strictEqual(Boolean(claudeProfile), true, "claude provider profile missing");
51
- assert.strictEqual(openaiProfile.revenue_ready, true, "openai provider revenue readiness missing");
52
- assert.strictEqual(claudeProfile.provider_live_anchor_ready, true, "claude provider live anchor readiness missing");
53
- assert.strictEqual(claudeProfile.runtime_gates.promotion_ready, true, "claude provider promotion readiness missing");
54
-
55
- const server = createServer();
56
- await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
57
- const address = server.address();
58
- const baseUrl = `http://127.0.0.1:${address.port}`;
59
-
60
- try {
61
- const providerLane = await getJson(baseUrl, "/v1/providers");
62
- assert.strictEqual(providerLane.status, 200, "provider lane route failed");
63
- assert.strictEqual(providerLane.json.ok, true, "provider lane route ok flag missing");
64
- assert.strictEqual(providerLane.json.provider_profile_count >= 2, true, "provider lane route profile count missing");
65
- assert.strictEqual(providerLane.json.provider_live_anchor_profile_count >= 1, true, "provider lane route live-anchor count missing");
66
- assert.strictEqual(providerLane.json.revenue_ready_profile_count >= 2, true, "provider lane route revenue-ready count missing");
67
-
68
- const providerLaneSummary = await getJson(baseUrl, "/v1/providers/summary");
69
- assert.strictEqual(providerLaneSummary.status, 200, "provider lane summary route failed");
70
- assert.strictEqual(providerLaneSummary.json.ok, true, "provider lane summary route ok flag missing");
71
- assert.strictEqual(providerLaneSummary.json.provider_profile_count >= 2, true, "provider lane summary profile count missing");
72
- assert.strictEqual(providerLaneSummary.json.provider_live_anchor_profile_count >= 1, true, "provider lane summary live-anchor count missing");
73
- assert.strictEqual(providerLaneSummary.json.revenue_ready_profile_count >= 2, true, "provider lane summary revenue-ready count missing");
74
-
75
- const openaiDetail = await getJson(baseUrl, "/v1/providers/openai_codex");
76
- assert.strictEqual(openaiDetail.status, 200, "openai provider detail route failed");
77
- assert.strictEqual(openaiDetail.json.provider.provider_id, "openai_codex", "openai provider detail id mismatch");
78
- assert.strictEqual(openaiDetail.json.provider.runtime_gates.machine_entry_ready, true, "openai provider machine-entry gate missing");
79
- assert.strictEqual(openaiDetail.json.provider.runtime_gates.paid_execution_ready, true, "openai provider paid-execution gate missing");
80
-
81
- const claudeDetail = await getJson(baseUrl, "/v1/providers/claude_mcp");
82
- assert.strictEqual(claudeDetail.status, 200, "claude provider detail route failed");
83
- assert.strictEqual(claudeDetail.json.provider.provider_id, "claude_mcp", "claude provider detail id mismatch");
84
- assert.strictEqual(claudeDetail.json.provider.provider_live_anchor_ready, true, "claude provider live-anchor detail missing");
85
- assert.strictEqual(claudeDetail.json.provider.runtime_gates.adapter_depth_ready, true, "claude provider adapter-depth gate missing");
86
- assert.strictEqual(claudeDetail.json.provider.runtime_gates.trace_ready, true, "claude provider trace gate missing");
87
- } finally {
88
- await new Promise((resolve) => server.close(resolve));
89
- if (previousExecutionTargets === undefined) delete process.env.XYTARA_EXECUTION_TARGETS_JSON;
90
- else process.env.XYTARA_EXECUTION_TARGETS_JSON = previousExecutionTargets;
91
- }
92
-
93
- process.stdout.write(`${JSON.stringify({
94
- ok: true,
95
- product: "xytara",
96
- category: "xytara-provider-runtime-breadth-verification",
97
- provider_profile_count: summary.provider_profile_count,
98
- provider_live_anchor_profile_count: summary.provider_live_anchor_profile_count,
99
- first_party_callable_profile_count: summary.first_party_callable_profile_count,
100
- revenue_ready_profile_count: summary.revenue_ready_profile_count,
101
- proof_followthrough_profile_count: summary.proof_followthrough_profile_count,
102
- boundary: "provider_runtime_breadth_requires_named_provider_profiles_with_bounded_entry_surfaces_and_public_runtime_gates"
103
- }, null, 2)}\n`);
104
- }
105
-
106
- main().catch((error) => {
107
- console.error(error && error.stack ? error.stack : error);
108
- process.exit(1);
109
- });
@@ -1,111 +0,0 @@
1
- "use strict";
2
-
3
- const assert = require("assert");
4
- const { createServer } = require("../server");
5
- const {
6
- buildProviderRuntimeJourneyPack,
7
- getProviderRuntimeJourneyDetail,
8
- summarizeProviderRuntimeJourneyPack
9
- } = require("../lib/provider_runtime_journey_contract");
10
-
11
- async function getJson(baseUrl, path) {
12
- const response = await fetch(`${baseUrl}${path}`);
13
- return {
14
- status: response.status,
15
- json: await response.json()
16
- };
17
- }
18
-
19
- async function main() {
20
- const previousExecutionTargets = process.env.XYTARA_EXECUTION_TARGETS_JSON;
21
- process.env.XYTARA_EXECUTION_TARGETS_JSON = JSON.stringify([
22
- {
23
- target_id: "verify-provider-journey-mcp-target",
24
- task_ref: "adapter.mcp.invoke",
25
- endpoint_url: "http://127.0.0.1:65535/execute",
26
- provider: "xytara_mcp_executor",
27
- tool_name: "summarize",
28
- auth_token: "verify-provider-journey-bearer",
29
- timeout_ms: 1500,
30
- enabled: true
31
- }
32
- ]);
33
-
34
- const pack = buildProviderRuntimeJourneyPack();
35
- const summary = summarizeProviderRuntimeJourneyPack();
36
- assert.strictEqual(pack.ok, true, "provider runtime journey pack ok flag missing");
37
- assert.strictEqual(summary.ok, true, "provider runtime journey summary ok flag missing");
38
- assert.strictEqual(pack.category, "machine-commerce-provider-runtime-journey-pack", "provider runtime journey category mismatch");
39
- assert.strictEqual(summary.summary_version, "xytara-provider-runtime-journey-summary-v1", "provider runtime journey summary version mismatch");
40
- assert.strictEqual(summary.journey_count >= 2, true, "provider runtime journey count missing");
41
- assert.strictEqual(summary.first_run_ready_journey_count >= 2, true, "provider runtime first-run readiness count missing");
42
- assert.strictEqual(summary.revenue_ready_journey_count >= 2, true, "provider runtime revenue-ready journey count missing");
43
- assert.strictEqual(summary.proof_followthrough_journey_count >= 2, true, "provider runtime proof-followthrough journey count missing");
44
- assert.strictEqual(summary.provider_live_anchor_journey_count >= 1, true, "provider runtime provider-live anchor journey count missing");
45
-
46
- const openaiJourney = getProviderRuntimeJourneyDetail("openai_codex");
47
- const claudeJourney = getProviderRuntimeJourneyDetail("claude_mcp");
48
- assert.strictEqual(Boolean(openaiJourney), true, "openai runtime journey missing");
49
- assert.strictEqual(Boolean(claudeJourney), true, "claude runtime journey missing");
50
- assert.strictEqual(openaiJourney.first_run_ready, true, "openai runtime journey first-run readiness missing");
51
- assert.strictEqual(openaiJourney.proof_followthrough_ready, true, "openai runtime journey proof-followthrough missing");
52
- assert.strictEqual(claudeJourney.provider_live_anchor_ready, true, "claude runtime journey provider-live anchor missing");
53
- assert.strictEqual(claudeJourney.readiness_gates.promotion_ready, true, "claude runtime journey promotion readiness missing");
54
-
55
- const server = createServer();
56
- await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
57
- const address = server.address();
58
- const baseUrl = `http://127.0.0.1:${address.port}`;
59
-
60
- try {
61
- const journeyPack = await getJson(baseUrl, "/v1/providers/journeys");
62
- assert.strictEqual(journeyPack.status, 200, "provider runtime journeys route failed");
63
- assert.strictEqual(journeyPack.json.ok, true, "provider runtime journeys route ok flag missing");
64
- assert.strictEqual(journeyPack.json.journey_count >= 2, true, "provider runtime journeys route count missing");
65
-
66
- const journeySummary = await getJson(baseUrl, "/v1/providers/journeys/summary");
67
- assert.strictEqual(journeySummary.status, 200, "provider runtime journeys summary route failed");
68
- assert.strictEqual(journeySummary.json.ok, true, "provider runtime journeys summary ok flag missing");
69
- assert.strictEqual(journeySummary.json.first_run_ready_journey_count >= 2, true, "provider runtime journeys summary first-run count missing");
70
- assert.strictEqual(journeySummary.json.revenue_ready_journey_count >= 2, true, "provider runtime journeys summary revenue-ready count missing");
71
-
72
- const openaiDetail = await getJson(baseUrl, "/v1/providers/journeys/openai_codex");
73
- assert.strictEqual(openaiDetail.status, 200, "openai runtime journey detail route failed");
74
- assert.strictEqual(openaiDetail.json.journey.provider_id, "openai_codex", "openai runtime journey detail id mismatch");
75
- assert.strictEqual(
76
- openaiDetail.json.journey.stages.some((entry) => entry.stage_id === "quote"),
77
- true,
78
- "openai runtime journey quote stage missing"
79
- );
80
-
81
- const claudeDetail = await getJson(baseUrl, "/v1/providers/journeys/claude_mcp");
82
- assert.strictEqual(claudeDetail.status, 200, "claude runtime journey detail route failed");
83
- assert.strictEqual(claudeDetail.json.journey.provider_id, "claude_mcp", "claude runtime journey detail id mismatch");
84
- assert.strictEqual(
85
- claudeDetail.json.journey.stages.some((entry) => entry.stage_id === "execute"),
86
- true,
87
- "claude runtime journey execute stage missing"
88
- );
89
- } finally {
90
- await new Promise((resolve) => server.close(resolve));
91
- if (previousExecutionTargets === undefined) delete process.env.XYTARA_EXECUTION_TARGETS_JSON;
92
- else process.env.XYTARA_EXECUTION_TARGETS_JSON = previousExecutionTargets;
93
- }
94
-
95
- process.stdout.write(`${JSON.stringify({
96
- ok: true,
97
- product: "xytara",
98
- category: "xytara-provider-runtime-journey-verification",
99
- journey_count: summary.journey_count,
100
- first_run_ready_journey_count: summary.first_run_ready_journey_count,
101
- revenue_ready_journey_count: summary.revenue_ready_journey_count,
102
- proof_followthrough_journey_count: summary.proof_followthrough_journey_count,
103
- provider_live_anchor_journey_count: summary.provider_live_anchor_journey_count,
104
- boundary: "provider_runtime_journeys_require_named_quote_fund_execute_prove_paths_with_bounded_provider_claims"
105
- }, null, 2)}\n`);
106
- }
107
-
108
- main().catch((error) => {
109
- console.error(error && error.stack ? error.stack : error);
110
- process.exit(1);
111
- });
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- // Verifies the in-memory fixed-window rate limiter (lib/rate_limiter.js) used to
4
- // gate the L402 invoice-creating path. Offline, no network, no timers waited on.
5
-
6
- const assert = require("assert");
7
- const { createRateLimiter } = require("../lib/rate_limiter");
8
-
9
- function main() {
10
- // Per-key ceiling: first `max` hits allowed, the next denied with scope "key".
11
- const rl = createRateLimiter({ windowMs: 60000, max: 3, maxGlobal: 100 });
12
- assert.strictEqual(rl.check("1.1.1.1").allowed, true);
13
- assert.strictEqual(rl.check("1.1.1.1").allowed, true);
14
- const third = rl.check("1.1.1.1");
15
- assert.strictEqual(third.allowed, true);
16
- assert.strictEqual(third.remaining, 0);
17
- const denied = rl.check("1.1.1.1");
18
- assert.strictEqual(denied.allowed, false);
19
- assert.strictEqual(denied.scope, "key");
20
- assert.ok(denied.retryAfterMs > 0 && denied.retryAfterMs <= 60000);
21
-
22
- // A different key is independent (not affected by another key's exhaustion).
23
- assert.strictEqual(rl.check("2.2.2.2").allowed, true);
24
-
25
- // Denied hits are not counted, so they cannot push the reset further out or
26
- // starve a key beyond its window (no self-inflicted lockout extension).
27
- assert.strictEqual(rl.check("1.1.1.1").allowed, false);
28
-
29
- // Global ceiling: once the global budget is spent, a fresh key is still denied
30
- // with scope "global" (maxGlobal >= max always, so set them equal to exercise it
31
- // across distinct keys before any single key is exhausted).
32
- const g = createRateLimiter({ windowMs: 60000, max: 2, maxGlobal: 2 });
33
- assert.strictEqual(g.check("a").allowed, true); // global 1, key a 1
34
- assert.strictEqual(g.check("b").allowed, true); // global 2, key b 1
35
- const gDenied = g.check("c"); // global budget spent, key c untouched
36
- assert.strictEqual(gDenied.allowed, false);
37
- assert.strictEqual(gDenied.scope, "global");
38
-
39
- // reset() clears all buckets.
40
- g.reset();
41
- assert.strictEqual(g.check("c").allowed, true);
42
-
43
- // Config is clamped to sane floors.
44
- const clamped = createRateLimiter({ windowMs: 1, max: 0, maxGlobal: 0 });
45
- assert.ok(clamped.config.windowMs >= 1000);
46
- assert.ok(clamped.config.max >= 1);
47
- assert.ok(clamped.config.maxGlobal >= clamped.config.max);
48
-
49
- console.log("verify_rate_limiter: all rate limiter checks passed");
50
- }
51
-
52
- main();
@@ -1,106 +0,0 @@
1
- "use strict";
2
-
3
- // Verifies credit-based refund settlement: POST /v1/refunds/<id>/settle-credit returns
4
- // value to the paying account as re-spendable CREDITS (never an autonomous outbound
5
- // transfer). Covers: credit-bridge auth is mandatory (403 unset/wrong), refund_units is
6
- // required (400), the account balance actually increases by the credited units, the
7
- // operation is idempotent per refund (no double-mint on replay), a terminal refund
8
- // cannot be re-settled, and the existing refund-action route is unchanged (non-breaking).
9
-
10
- const assert = require("assert");
11
- const http = require("http");
12
-
13
- async function req(baseUrl, method, path, body, headers = {}) {
14
- const res = await fetch(`${baseUrl}${path}`, {
15
- method,
16
- headers: { "content-type": "application/json", ...headers },
17
- ...(body !== undefined ? { body: JSON.stringify(body) } : {})
18
- });
19
- let json = null;
20
- try { json = await res.json(); } catch (_) { json = null; }
21
- return { status: res.status, json };
22
- }
23
-
24
- function availableUnits(balanceJson) {
25
- if (!balanceJson) return 0;
26
- if (typeof balanceJson.available_units === "number") return balanceJson.available_units;
27
- if (balanceJson.balance && typeof balanceJson.balance.available_units === "number") return balanceJson.balance.available_units;
28
- if (balanceJson.lifecycle_totals && typeof balanceJson.lifecycle_totals.available_units === "number") return balanceJson.lifecycle_totals.available_units;
29
- return 0;
30
- }
31
-
32
- async function main() {
33
- const prevToken = process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN;
34
- const TOKEN = "test-credit-bridge-token";
35
- process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN = TOKEN;
36
- const auth = { authorization: `Bearer ${TOKEN}` };
37
-
38
- delete require.cache[require.resolve("../server")];
39
- const { createServer } = require("../server");
40
- const server = createServer();
41
- await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
42
- const baseUrl = `http://127.0.0.1:${server.address().port}`;
43
- const ACCOUNT = "acct_refund_credit_test";
44
-
45
- try {
46
- // Create a refund (operator case).
47
- let r = await req(baseUrl, "POST", "/v1/refunds", { reason_code: "service_failure", note: "test", requested_by: "operator" });
48
- assert.ok(r.json && r.json.refund && r.json.refund.refund_id, "refund created");
49
- const refundId = r.json.refund.refund_id;
50
-
51
- const before = availableUnits((await req(baseUrl, "GET", `/v1/economics/accounts/${ACCOUNT}/credit-balance`)).json);
52
-
53
- // 1. Auth mandatory: no bearer -> 403.
54
- r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50 });
55
- assert.strictEqual(r.status, 403, "settle-credit without bearer must 403");
56
-
57
- // 2. Wrong bearer -> 403.
58
- r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50 }, { authorization: "Bearer wrong" });
59
- assert.strictEqual(r.status, 403, "settle-credit with wrong bearer must 403");
60
-
61
- // 3. refund_units required -> 400.
62
- r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT }, auth);
63
- assert.strictEqual(r.status, 400, "missing refund_units must 400");
64
- assert.strictEqual(r.json.reason, "refund_units_required", "400 reason");
65
-
66
- // 4. Authorized settle -> 200, credit minted, refund completed.
67
- r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50, reason_code: "service_failure" }, auth);
68
- assert.strictEqual(r.status, 200, "authorized settle-credit must 200");
69
- assert.strictEqual(r.json.ok, true, "settle ok");
70
- assert.strictEqual(r.json.units, 50, "credited units echoed");
71
- assert.ok(r.json.credit_grant_id && r.json.credit_grant_id.startsWith("refund_credit_"), "idempotent grant id");
72
- assert.strictEqual(r.json.refund.status, "completed", "refund marked completed");
73
-
74
- // 5. Balance actually increased by the credited units.
75
- const after = availableUnits((await req(baseUrl, "GET", `/v1/economics/accounts/${ACCOUNT}/credit-balance`)).json);
76
- assert.strictEqual(after - before, 50, `balance must increase by 50 (before=${before}, after=${after})`);
77
-
78
- // 6. Idempotent: a replayed settle must NOT mint twice.
79
- r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50 }, auth);
80
- assert.strictEqual(r.status, 200, "replay still 200");
81
- assert.strictEqual(r.json.already_settled, true, "replay reports already_settled");
82
- const afterReplay = availableUnits((await req(baseUrl, "GET", `/v1/economics/accounts/${ACCOUNT}/credit-balance`)).json);
83
- assert.strictEqual(afterReplay, after, "replay must not mint credits twice");
84
-
85
- // 7. A terminal (completed) refund cannot be re-settled under a fresh account.
86
- // (Covered by idempotency above — the completed refund returns already_settled
87
- // for the original grant rather than minting to a different account.)
88
-
89
- // 8. Non-breaking: the existing refund-action route still works on a NEW refund.
90
- const r2 = await req(baseUrl, "POST", "/v1/refunds", { reason_code: "other" });
91
- const refundId2 = r2.json.refund.refund_id;
92
- r = await req(baseUrl, "POST", `/v1/refunds/${refundId2}/actions`, { action: "review", note: "reviewing" });
93
- assert.strictEqual(r.status, 200, "existing refund-action route still works");
94
- assert.strictEqual(r.json.refund.status, "under_review", "action transitioned status");
95
-
96
- console.log("xytara verify:refund-credit passed");
97
- } finally {
98
- await new Promise((resolve) => server.close(resolve));
99
- if (prevToken === undefined) delete process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN; else process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN = prevToken;
100
- }
101
- }
102
-
103
- main().catch((error) => {
104
- console.error(error && error.message ? error.message : error);
105
- process.exitCode = 1;
106
- });
@@ -1,105 +0,0 @@
1
- "use strict";
2
-
3
- const assert = require("assert");
4
- const {
5
- buildRevenueLaunchPathPack,
6
- getRevenueLaunchPathDetail,
7
- summarizeRevenueLaunchPathPack
8
- } = require("../lib/revenue_launch_path_contract");
9
- const { createServer } = require("../server");
10
-
11
- async function getJson(baseUrl, routePath) {
12
- const response = await fetch(`${baseUrl}${routePath}`);
13
- return {
14
- status: response.status,
15
- json: await response.json()
16
- };
17
- }
18
-
19
- function assertSummary(summary) {
20
- assert.strictEqual(summary.ok, true, "summary should be ok");
21
- assert.strictEqual(summary.path_count >= 3, true, "revenue launch path count missing");
22
- assert.strictEqual(summary.first_money_in_path_count >= 2, true, "first money-in path count missing");
23
- assert.strictEqual(summary.paid_execution_path_count >= 2, true, "paid execution path count missing");
24
- assert.strictEqual(summary.proof_followthrough_path_count >= 3, true, "proof followthrough path count missing");
25
- assert.strictEqual(summary.refund_or_reversal_path_count >= 2, true, "refund or reversal path count missing");
26
- assert.strictEqual(summary.operator_reconciliation_path_count >= 3, true, "operator reconciliation path count missing");
27
- assert.strictEqual(summary.hosted_checkout_path_count >= 2, true, "hosted checkout path count missing");
28
- }
29
-
30
- function assertPack(pack) {
31
- assert.strictEqual(pack.ok, true, "pack should be ok");
32
- assertSummary(pack);
33
- assert.strictEqual(Array.isArray(pack.paths), true, "paths missing");
34
- assert.strictEqual(Boolean(getRevenueLaunchPathDetail("hosted_checkout_credits_execution_proof")), true, "hosted checkout path missing");
35
- assert.strictEqual(Boolean(getRevenueLaunchPathDetail("direct_x402_execution_proof")), true, "direct x402 path missing");
36
- assert.strictEqual(Boolean(getRevenueLaunchPathDetail("refund_reversal_operator_reconciliation")), true, "refund reversal path missing");
37
- assert.strictEqual(
38
- pack.paths.every((entry) => Array.isArray(entry.required_operator_evidence) && entry.required_operator_evidence.length >= 4),
39
- true,
40
- "operator evidence requirements missing"
41
- );
42
- assert.strictEqual(
43
- pack.paths.every((entry) => typeof entry.claim_boundary === "string" && entry.claim_boundary.includes("claim_")),
44
- true,
45
- "claim boundaries missing"
46
- );
47
- }
48
-
49
- async function main() {
50
- const pack = buildRevenueLaunchPathPack();
51
- const summary = summarizeRevenueLaunchPathPack();
52
- assertPack(pack);
53
- assertSummary(summary);
54
-
55
- const server = createServer();
56
- await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
57
- const address = server.address();
58
- const baseUrl = `http://127.0.0.1:${address.port}`;
59
-
60
- try {
61
- const packResponse = await getJson(baseUrl, "/v1/revenue-launch/paths");
62
- assert.strictEqual(packResponse.status, 200, "revenue launch path pack route failed");
63
- assertPack(packResponse.json);
64
-
65
- const summaryResponse = await getJson(baseUrl, "/v1/revenue-launch/paths/summary");
66
- assert.strictEqual(summaryResponse.status, 200, "revenue launch path summary route failed");
67
- assertSummary(summaryResponse.json);
68
-
69
- const hostedCheckoutResponse = await getJson(baseUrl, "/v1/revenue-launch/paths/hosted_checkout_credits_execution_proof");
70
- assert.strictEqual(hostedCheckoutResponse.status, 200, "hosted checkout revenue launch detail failed");
71
- assert.strictEqual(hostedCheckoutResponse.json.path.first_money_in_ready, true, "hosted checkout money-in readiness missing");
72
- assert.strictEqual(hostedCheckoutResponse.json.path.refund_or_reversal_ready, true, "hosted checkout reversal readiness missing");
73
-
74
- const directX402Response = await getJson(baseUrl, "/v1/revenue-launch/paths/direct_x402_execution_proof");
75
- assert.strictEqual(directX402Response.status, 200, "direct x402 revenue launch detail failed");
76
- assert.strictEqual(directX402Response.json.path.paid_execution_ready, true, "direct x402 paid execution readiness missing");
77
- assert.strictEqual(directX402Response.json.path.proof_followthrough_ready, true, "direct x402 proof readiness missing");
78
-
79
- const reversalResponse = await getJson(baseUrl, "/v1/revenue-launch/paths/refund_reversal_operator_reconciliation");
80
- assert.strictEqual(reversalResponse.status, 200, "refund reversal revenue launch detail failed");
81
- assert.strictEqual(reversalResponse.json.path.refund_or_reversal_ready, true, "refund reversal readiness missing");
82
- assert.strictEqual(reversalResponse.json.path.operator_reconciliation_ready, true, "refund reversal operator reconciliation missing");
83
- } finally {
84
- await new Promise((resolve) => server.close(resolve));
85
- }
86
-
87
- console.log(JSON.stringify({
88
- ok: true,
89
- product: "xytara",
90
- category: "machine-commerce-revenue-launch-path-verification",
91
- verification_version: "xytara-revenue-launch-path-verification-v1",
92
- path_count: summary.path_count,
93
- first_money_in_path_count: summary.first_money_in_path_count,
94
- paid_execution_path_count: summary.paid_execution_path_count,
95
- proof_followthrough_path_count: summary.proof_followthrough_path_count,
96
- refund_or_reversal_path_count: summary.refund_or_reversal_path_count,
97
- operator_reconciliation_path_count: summary.operator_reconciliation_path_count,
98
- boundary: "day_one_revenue_launch_claims_require_money_in_paid_execution_proof_reversal_and_operator_reconciliation_paths"
99
- }, null, 2));
100
- }
101
-
102
- main().catch((error) => {
103
- console.error(error);
104
- process.exit(1);
105
- });
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- const assert = require("assert");
4
- const { once } = require("events");
5
- const { createServer } = require("../server");
6
-
7
- async function getJson(baseUrl, pathname) {
8
- const response = await fetch(`${baseUrl}${pathname}`);
9
- return {
10
- status: response.status,
11
- json: await response.json()
12
- };
13
- }
14
-
15
- async function main() {
16
- const server = createServer();
17
- server.listen(0, "127.0.0.1");
18
- await once(server, "listening");
19
-
20
- const address = server.address();
21
- const baseUrl = `http://127.0.0.1:${address.port}`;
22
-
23
- try {
24
- const summary = await getJson(baseUrl, "/v1/runtime/durability/summary");
25
- assert.strictEqual(summary.status, 200, "runtime durability summary route failed");
26
- assert.strictEqual(summary.json.ok, true, "runtime durability summary ok flag missing");
27
- assert.strictEqual(summary.json.category, "xytara-runtime-durability-summary", "runtime durability summary category missing");
28
- assert.strictEqual(typeof summary.json.recovery_posture, "string", "runtime durability summary posture missing");
29
- assert.strictEqual(typeof summary.json.blocker_count, "number", "runtime durability summary blocker count missing");
30
- assert.strictEqual(Array.isArray(summary.json.blockers), true, "runtime durability summary blockers missing");
31
- assert.strictEqual(summary.json.blocker_count, summary.json.blockers.length, "runtime durability summary blocker count mismatch");
32
- assert.strictEqual(typeof summary.json.enabled, "boolean", "runtime durability summary enabled flag missing");
33
- assert.strictEqual(typeof summary.json.inspect_ref, "string", "runtime durability summary inspect ref missing");
34
-
35
- console.log(JSON.stringify({
36
- ok: true,
37
- product: "xytara",
38
- category: "machine-commerce-runtime-durability-summary-verification",
39
- verification_version: "xytara-runtime-durability-summary-verification-v1",
40
- blocker_count: summary.json.blocker_count,
41
- recovery_posture: summary.json.recovery_posture,
42
- boundary: "runtime_durability_summary_should_be_publicly_inspectable_and_counted"
43
- }, null, 2));
44
- } finally {
45
- server.close();
46
- }
47
- }
48
-
49
- main().catch((error) => {
50
- console.error(error && error.stack ? error.stack : error);
51
- process.exit(1);
52
- });
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- // Verifies the runtime-state WRITE GUARD: when the boot-time restore fails (backend 504), the store
4
- // must never write (a write would overwrite the good snapshot with near-empty state). It retries the
5
- // restore, merges the durable snapshot under whatever happened since boot, and only then writes.
6
-
7
- const assert = require("assert");
8
- const http = require("http");
9
- const { createRuntimeStateStore } = require("../lib/runtime_state_store");
10
-
11
- function startFakeSupabase() {
12
- const calls = { get: 0, post: 0, lastPostBody: null, keys: [] };
13
- let failReads = true;
14
- const durable = {
15
- providerRegistry: { __runtime_state_kind: "Map", value: [["mcp_executor", { provider_id: "mcp_executor", status: "active" }]] },
16
- providerPayouts: [{ payout_id: "provpay_1", status: "settled" }],
17
- acceptedPaymentNonces: { __runtime_state_kind: "Set", value: ["n_old"] }
18
- };
19
- const server = http.createServer((req, res) => {
20
- let body = "";
21
- req.on("data", (chunk) => { body += chunk; });
22
- req.on("end", () => {
23
- if (req.method === "GET") {
24
- calls.get += 1;
25
- if (failReads) { res.writeHead(504, { "content-type": "application/json" }); res.end('{"message":"Gateway Timeout"}'); return; }
26
- res.writeHead(200, { "content-type": "application/json" });
27
- res.end(JSON.stringify([{ snapshot: durable, persisted_at_iso: "2026-10-17T00:00:00.000Z" }]));
28
- return;
29
- }
30
- calls.post += 1;
31
- calls.lastPostBody = JSON.parse(body);
32
- calls.keys.push(calls.lastPostBody[0].state_key);
33
- res.writeHead(201); res.end();
34
- });
35
- });
36
- return new Promise((resolve) => server.listen(0, "127.0.0.1", () => resolve({ server, calls, recover: () => { failReads = false; } })));
37
- }
38
-
39
- async function main() {
40
- const fake = await startFakeSupabase();
41
- const store = createRuntimeStateStore({
42
- supabaseUrl: `http://127.0.0.1:${fake.server.address().port}`,
43
- supabaseServiceRoleKey: "test-key",
44
- intervalMs: 1000
45
- });
46
- const state = { providerRegistry: new Map(), providerPayouts: [], acceptedPaymentNonces: new Set() };
47
- try {
48
- // 1. Boot restore fails (504) -> writes locked.
49
- await assert.rejects(() => store.load(state), /504/, "boot restore surfaces the 504");
50
- assert.strictEqual(store.restoreConfirmed(), false, "writes locked after a failed restore");
51
- assert.strictEqual(store.inspect().writes_locked_until_restore, true, "inspect reports the lock");
52
-
53
- // 2. The process keeps serving on empty state; a post-boot write lands in memory.
54
- state.acceptedPaymentNonces.add("n_new");
55
- state.providerPayouts.push({ payout_id: "provpay_2", status: "pending" });
56
- store.markDirty();
57
- assert.strictEqual(await store.flush(state), false, "flush refused while the restore is unconfirmed");
58
- assert.strictEqual(fake.calls.post, 0, "NOTHING was written over the durable snapshot");
59
-
60
- // 3. The interval retries the restore while the backend still fails: still no write.
61
- let restoredCallback = false;
62
- store.start(state, () => { restoredCallback = true; });
63
- await new Promise((r) => setTimeout(r, 2300));
64
- assert.ok(fake.calls.get >= 2, "restore retried in the background");
65
- assert.strictEqual(fake.calls.post, 0, "still no write while the backend is down");
66
-
67
- // 4. Backend recovers: restore merges the snapshot UNDER the post-boot changes, then writes.
68
- fake.recover();
69
- await new Promise((r) => setTimeout(r, 2600));
70
- assert.strictEqual(restoredCallback, true, "onRestored fired");
71
- assert.strictEqual(store.restoreConfirmed(), true, "writes unlocked after a successful restore");
72
- assert.strictEqual(state.providerRegistry.get("mcp_executor").status, "active", "durable provider restored");
73
- assert.ok(state.acceptedPaymentNonces.has("n_old") && state.acceptedPaymentNonces.has("n_new"), "nonce sets unioned");
74
- assert.deepStrictEqual(state.providerPayouts.map((p) => p.payout_id), ["provpay_1", "provpay_2"], "ledger keeps durable + post-boot rows");
75
- assert.ok(fake.calls.post >= 1, "the merged state is persisted once writes unlock");
76
- const written = fake.calls.lastPostBody[0].snapshot;
77
- assert.strictEqual(written.providerRegistry.value[0][0], "mcp_executor", "the write carries the restored provider (no clobber)");
78
-
79
- // 5. Unchanged state is never rewritten (a read-only POST marks dirty but changes nothing).
80
- const postsBefore = fake.calls.post;
81
- store.markDirty();
82
- assert.strictEqual(await store.flush(state), false, "unchanged snapshot skipped");
83
- assert.strictEqual(fake.calls.post, postsBefore, "no write for an unchanged snapshot");
84
- assert.ok(store.inspect().skipped_unchanged_writes >= 1, "skip counted");
85
- state.acceptedPaymentNonces.add("n_newer");
86
- store.markDirty();
87
- assert.strictEqual(await store.flush(state), true, "a real change is written");
88
-
89
- // 6. Rolling history copy: written alongside the main row, under a ::history:: key.
90
- assert.ok(fake.calls.keys.some((key) => /^default::history::\d+$/.test(key)), "rolling history row written");
91
- assert.ok(fake.calls.keys.includes("default"), "main row written");
92
- assert.strictEqual(store.inspect().last_history_error, null, "history write succeeded");
93
- await store.stop(state);
94
- } finally {
95
- fake.server.close();
96
- }
97
- // 7. Quote pruning: expired never-paid quotes older than the retention are dropped; executed and
98
- // recent ones are kept.
99
- const { pruneStaleQuotes } = require("../lib/commerce_quotes");
100
- const day = 24 * 60 * 60 * 1000;
101
- const now = Date.parse("2026-10-17T00:00:00.000Z");
102
- const qs = { quotes: new Map([
103
- ["q_old_expired", { status: "expired", expires_at_iso: new Date(now - 10 * day).toISOString() }],
104
- ["q_recent_expired", { status: "expired", expires_at_iso: new Date(now - 2 * day).toISOString() }],
105
- ["q_old_executed", { status: "executed", transaction_id: "txn_1", expires_at_iso: new Date(now - 30 * day).toISOString() }],
106
- ["q_live", { status: "quoted", expires_at_iso: new Date(now + day).toISOString() }]
107
- ]) };
108
- assert.strictEqual(pruneStaleQuotes(qs, now), 1, "exactly one stale quote pruned");
109
- assert.deepStrictEqual(Array.from(qs.quotes.keys()).sort(), ["q_live", "q_old_executed", "q_recent_expired"], "executed / recent / live quotes kept");
110
-
111
- console.log("xytara verify:runtime-state-guard passed");
112
- }
113
-
114
- main().catch((error) => {
115
- console.error(error && error.message ? error.message : error);
116
- process.exitCode = 1;
117
- });