xytara 3.1.0 → 3.1.2

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 (373) hide show
  1. package/.env.example +67 -58
  2. package/ADAPTER_START_HERE.md +56 -56
  3. package/CARRIED_HANDOFF_DEMO.md +60 -60
  4. package/EXAMPLE_PATHS.md +53 -53
  5. package/FINAL_CONTRACT.md +498 -498
  6. package/LICENSE +201 -201
  7. package/NOTICE +3 -3
  8. package/PARTNER_READY_PATH.md +71 -71
  9. package/PUBLIC_DEMO_SCRIPT.md +78 -78
  10. package/README.md +6 -1
  11. package/REAL_PAYMENT_SETUP.md +32 -3
  12. package/RELEASE_NOTES.md +14 -14
  13. package/SERVICE_CONTRACT.md +419 -419
  14. package/START_HERE.md +1 -1
  15. package/SUPABASE_RUNTIME_STATE_SETUP.md +61 -61
  16. package/TERMINOLOGY.md +50 -50
  17. package/WHY_XYTARA_XOONYA.md +63 -63
  18. package/XT1_EXECUTION_TRUTH_STANDARD.md +78 -78
  19. package/XYTARA_ADAPTER_PROTOCOL_TRUTH_MODEL.md +75 -75
  20. package/XYTARA_AUTONOMOUS_ENTRY_MODEL.md +124 -124
  21. package/XYTARA_DEFAULT_PATH_MODEL.md +84 -84
  22. package/XYTARA_EXECUTION_TRUTH_MODEL.md +171 -171
  23. package/XYTARA_PAYMENT_RAIL_TRUTH_MODEL.md +68 -68
  24. package/adapters/AUTHORING_GUIDE.md +243 -243
  25. package/adapters/ONBOARDING_POSTURE.md +61 -61
  26. package/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md +84 -84
  27. package/adapters/adapter-manifest.schema.json +283 -283
  28. package/adapters/examples/example-execution-adapter.js +61 -61
  29. package/adapters/examples/example-execution-adapter.manifest.json +81 -81
  30. package/adapters/examples/example-settlement-adapter.js +55 -55
  31. package/adapters/examples/example-settlement-adapter.manifest.json +78 -78
  32. package/adapters/examples/example-third-party-acp-registration.submission-bundle.json +124 -124
  33. package/adapters/examples/example-third-party-erc8004-registration.submission-bundle.json +121 -121
  34. package/adapters/examples/example-third-party-identity-registration.certification-pack.json +22 -22
  35. package/adapters/examples/example-third-party-identity-registration.record.json +26 -26
  36. package/adapters/examples/example-third-party-identity-registration.submission-bundle.json +126 -126
  37. package/adapters/examples/example-third-party-langchain-registration.submission-bundle.json +124 -124
  38. package/adapters/examples/example-third-party-mpp-registration.submission-bundle.json +120 -120
  39. package/adapters/examples/example-third-party-registration.certification-pack.json +22 -22
  40. package/adapters/examples/example-third-party-registration.record.json +28 -28
  41. package/adapters/examples/example-third-party-registration.submission-bundle.json +126 -126
  42. package/adapters/examples/example-third-party-settlement-registration.certification-pack.json +22 -22
  43. package/adapters/examples/example-third-party-settlement-registration.record.json +26 -26
  44. package/adapters/examples/example-third-party-settlement-registration.submission-bundle.json +127 -127
  45. package/adapters/examples/langchain-reference-execution-adapter.js +81 -81
  46. package/adapters/examples/langchain-reference-execution-adapter.manifest.json +79 -79
  47. package/adapters/examples/langgraph-reference-execution-adapter.js +81 -81
  48. package/adapters/examples/langgraph-reference-execution-adapter.manifest.json +79 -79
  49. package/adapters/examples/minimal-third-party-execution-adapter.js +61 -61
  50. package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +79 -79
  51. package/adapters/examples/minimal-third-party-execution-registration.record.json +26 -26
  52. package/adapters/examples/minimal-third-party-execution.certification-pack.json +22 -22
  53. package/adapters/examples/minimal-third-party-execution.submission-bundle.json +126 -126
  54. package/adapters/integration-certification-pack.schema.json +82 -82
  55. package/adapters/integration-registration-record.schema.json +114 -114
  56. package/adapters/integration-submission-bundle-set.schema.json +39 -39
  57. package/adapters/integration-submission-bundle.schema.json +34 -34
  58. package/adapters/interfaces.js +56 -56
  59. package/bin/xytara-first-run.js +244 -244
  60. package/bin/xytara-release.js +1429 -1429
  61. package/bin/xytara-run.js +186 -186
  62. package/bin/xytara.js +80 -80
  63. package/client.js +3 -3
  64. package/examples/_demo_env.js +40 -0
  65. package/examples/adapter_review_walkthrough.js +54 -53
  66. package/examples/export_carried_handoff.js +81 -80
  67. package/examples/funded_runtime_walkthrough.js +71 -70
  68. package/examples/generated.carried-handoff.json +30 -0
  69. package/examples/partner_launch_walkthrough.js +44 -43
  70. package/examples/quickstart.js +3256 -3255
  71. package/fixtures/catalog.js +1134 -1134
  72. package/index.js +395 -395
  73. package/integrations/dispatch.js +276 -276
  74. package/integrations/registry-snapshot.schema.json +36 -36
  75. package/integrations/registry.js +2261 -2261
  76. package/integrations/views.js +28 -28
  77. package/lib/a2a_lane_contract.js +104 -104
  78. package/lib/a2c_lane_contract.js +111 -111
  79. package/lib/account_auth.js +518 -518
  80. package/lib/acp_lane_contract.js +54 -54
  81. package/lib/activity_audit_contract.js +322 -322
  82. package/lib/adapter_certification_contract.js +130 -130
  83. package/lib/adapter_depth_contract.js +156 -156
  84. package/lib/adapter_pack.js +118 -118
  85. package/lib/adapter_partner_pack.js +89 -89
  86. package/lib/adapter_promotion_pack.js +89 -89
  87. package/lib/adapter_protocol_truth_contract.js +229 -229
  88. package/lib/announcement_pack.js +61 -61
  89. package/lib/artifact_distribution_lane_contract.js +54 -54
  90. package/lib/asyncapi_contract.js +150 -150
  91. package/lib/auth_interop_contract.js +80 -80
  92. package/lib/authority_binding_lifecycle_contract.js +182 -182
  93. package/lib/autonomous_entry_contract.js +409 -409
  94. package/lib/bolt_lane_contract.js +55 -55
  95. package/lib/bolt_payment_front.js +172 -172
  96. package/lib/business_cockpit.js +378 -378
  97. package/lib/capability_execution_truth.js +272 -272
  98. package/lib/capability_registry.js +633 -633
  99. package/lib/catalog_contract.js +966 -966
  100. package/lib/catalog_family_model.js +193 -193
  101. package/lib/catalog_views.js +55 -55
  102. package/lib/checkout_event_security.js +142 -142
  103. package/lib/cloudevents_contract.js +80 -80
  104. package/lib/command_flow.js +411 -406
  105. package/lib/commerce_artifacts.js +503 -503
  106. package/lib/commerce_authority.js +449 -449
  107. package/lib/commerce_cases.js +317 -317
  108. package/lib/commerce_checkout.js +509 -509
  109. package/lib/commerce_client.js +7687 -7676
  110. package/lib/commerce_coordination.js +346 -346
  111. package/lib/commerce_economics.js +4017 -4016
  112. package/lib/commerce_identity.js +578 -578
  113. package/lib/commerce_quotes.js +237 -237
  114. package/lib/commerce_reports.js +14461 -14461
  115. package/lib/commerce_runtime.js +315 -315
  116. package/lib/commerce_shell.js +257 -257
  117. package/lib/crypto_agility_matrix.js +125 -125
  118. package/lib/default_path_contract.js +412 -412
  119. package/lib/delivery_summary_contract.js +95 -95
  120. package/lib/ecosystem_entry.js +64 -64
  121. package/lib/erc8004_lane_contract.js +65 -65
  122. package/lib/event_system_lane_contract.js +75 -75
  123. package/lib/execution_truth_contract.js +234 -234
  124. package/lib/external_credit_bridge.js +142 -142
  125. package/lib/external_execution_runtime.js +132 -132
  126. package/lib/feature_control_lane_contract.js +54 -54
  127. package/lib/first_run_conversion_contract.js +290 -290
  128. package/lib/framework_lane_contract.js +89 -89
  129. package/lib/framework_provider_promotion.js +235 -235
  130. package/lib/full_catalog_contract.js +525 -525
  131. package/lib/go_live_operator_pack.js +391 -391
  132. package/lib/http_transport.js +73 -73
  133. package/lib/identity_auth.js +175 -175
  134. package/lib/identity_interop_contract.js +82 -82
  135. package/lib/integration_matrix_contract.js +102 -102
  136. package/lib/l402_lane_contract.js +55 -55
  137. package/lib/l402_payment_front.js +192 -192
  138. package/lib/launch_narrative.js +53 -53
  139. package/lib/lifecycle_continuity_contract.js +115 -115
  140. package/lib/machine_identity_registry_contract.js +199 -199
  141. package/lib/major_rails_lane_contract.js +150 -150
  142. package/lib/market_lane_contract.js +467 -467
  143. package/lib/market_lane_depth_contract.js +182 -182
  144. package/lib/market_lane_promotion_contract.js +210 -210
  145. package/lib/market_lane_trace_contract.js +278 -278
  146. package/lib/mcp_lane_contract.js +137 -137
  147. package/lib/network_transport.js +110 -110
  148. package/lib/offline_verifiability_recovery_contract.js +155 -155
  149. package/lib/openapi_contract.js +296 -296
  150. package/lib/operational_receipt_contract.js +165 -165
  151. package/lib/operator_intelligence.js +407 -407
  152. package/lib/outreach_copy_pack.js +51 -51
  153. package/lib/outreach_message_pack.js +71 -71
  154. package/lib/outreach_proof.js +71 -71
  155. package/lib/outreach_target_pack.js +60 -60
  156. package/lib/partner_intelligence.js +105 -105
  157. package/lib/payment_config.js +239 -191
  158. package/lib/payment_front_registry.js +53 -53
  159. package/lib/payment_protocol_contract.js +165 -165
  160. package/lib/payment_rail_truth_contract.js +324 -324
  161. package/lib/payment_verification.js +312 -264
  162. package/lib/phase_10_closeout_pack.js +45 -45
  163. package/lib/phase_10_completion_pack.js +76 -76
  164. package/lib/phase_10_decision_record_pack.js +54 -54
  165. package/lib/phase_10_decision_resolution_pack.js +53 -53
  166. package/lib/phase_10_demand_signal_adapters_runtime_pack.js +74 -74
  167. package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +74 -74
  168. package/lib/phase_10_freeze_baseline_pack.js +67 -67
  169. package/lib/phase_10_freeze_review_pack.js +64 -64
  170. package/lib/phase_10_gate_pack.js +57 -57
  171. package/lib/phase_10_long_tail_continuity_pack.js +80 -80
  172. package/lib/phase_10_long_tail_ecosystem_pack.js +66 -66
  173. package/lib/phase_10_niche_extension_registry_runtime_pack.js +74 -74
  174. package/lib/phase_1_claude_mcp_pack.js +60 -60
  175. package/lib/phase_1_claude_mcp_runtime_pack.js +52 -52
  176. package/lib/phase_1_ecosystem_pack.js +67 -67
  177. package/lib/phase_1_openai_codex_pack.js +60 -60
  178. package/lib/phase_1_openai_codex_runtime_pack.js +52 -52
  179. package/lib/phase_2_base_runtime_pack.js +71 -71
  180. package/lib/phase_2_base_usdc_runtime_pack.js +72 -72
  181. package/lib/phase_2_closeout_pack.js +65 -65
  182. package/lib/phase_2_completion_pack.js +113 -113
  183. package/lib/phase_2_decision_record_pack.js +66 -66
  184. package/lib/phase_2_decision_resolution_pack.js +69 -69
  185. package/lib/phase_2_eth_runtime_pack.js +70 -70
  186. package/lib/phase_2_evm_base_runtime_pack.js +73 -73
  187. package/lib/phase_2_evm_runtime_pack.js +71 -71
  188. package/lib/phase_2_flip_preview_pack.js +60 -60
  189. package/lib/phase_2_freeze_review_pack.js +99 -99
  190. package/lib/phase_2_gate_pack.js +77 -77
  191. package/lib/phase_2_payment_rails_pack.js +71 -71
  192. package/lib/phase_2_usdc_runtime_pack.js +71 -71
  193. package/lib/phase_3_brc_runtime_pack.js +81 -81
  194. package/lib/phase_3_bsv_teranode_runtime_pack.js +83 -83
  195. package/lib/phase_3_closeout_pack.js +62 -62
  196. package/lib/phase_3_completion_pack.js +94 -94
  197. package/lib/phase_3_decision_record_pack.js +64 -64
  198. package/lib/phase_3_decision_resolution_pack.js +69 -69
  199. package/lib/phase_3_freeze_baseline_pack.js +67 -67
  200. package/lib/phase_3_freeze_review_pack.js +80 -80
  201. package/lib/phase_3_gate_pack.js +76 -76
  202. package/lib/phase_3_metanet_runtime_pack.js +81 -81
  203. package/lib/phase_3_native_bsv_pack.js +91 -91
  204. package/lib/phase_3_native_continuity_pack.js +82 -82
  205. package/lib/phase_4_attestation_runtime_pack.js +75 -75
  206. package/lib/phase_4_closeout_pack.js +45 -45
  207. package/lib/phase_4_completion_pack.js +94 -94
  208. package/lib/phase_4_decision_record_pack.js +54 -54
  209. package/lib/phase_4_decision_resolution_pack.js +45 -45
  210. package/lib/phase_4_erc8004_runtime_pack.js +76 -76
  211. package/lib/phase_4_freeze_baseline_pack.js +67 -67
  212. package/lib/phase_4_freeze_review_pack.js +68 -68
  213. package/lib/phase_4_gate_pack.js +58 -58
  214. package/lib/phase_4_identity_registry_runtime_pack.js +75 -75
  215. package/lib/phase_4_identity_trust_pack.js +73 -73
  216. package/lib/phase_4_trust_continuity_pack.js +86 -86
  217. package/lib/phase_5_antelope_runtime_pack.js +76 -76
  218. package/lib/phase_5_closeout_pack.js +44 -44
  219. package/lib/phase_5_completion_pack.js +82 -82
  220. package/lib/phase_5_constellation_dag_runtime_pack.js +76 -76
  221. package/lib/phase_5_decision_record_pack.js +54 -54
  222. package/lib/phase_5_decision_resolution_pack.js +45 -45
  223. package/lib/phase_5_digibyte_dgb_runtime_pack.js +76 -76
  224. package/lib/phase_5_freeze_baseline_pack.js +67 -67
  225. package/lib/phase_5_freeze_review_pack.js +68 -68
  226. package/lib/phase_5_gate_pack.js +58 -58
  227. package/lib/phase_5_hedera_hbar_runtime_pack.js +76 -76
  228. package/lib/phase_5_kaspa_kas_runtime_pack.js +76 -76
  229. package/lib/phase_5_major_rails_continuity_pack.js +86 -86
  230. package/lib/phase_5_major_rails_pack.js +110 -110
  231. package/lib/phase_5_metal_runtime_pack.js +76 -76
  232. package/lib/phase_5_polkadot_dot_runtime_pack.js +76 -76
  233. package/lib/phase_5_proton_xpr_runtime_pack.js +76 -76
  234. package/lib/phase_5_solana_runtime_pack.js +76 -76
  235. package/lib/phase_6_autogen_runtime_pack.js +72 -72
  236. package/lib/phase_6_closeout_pack.js +46 -46
  237. package/lib/phase_6_completion_pack.js +77 -77
  238. package/lib/phase_6_decision_record_pack.js +54 -54
  239. package/lib/phase_6_decision_resolution_pack.js +53 -53
  240. package/lib/phase_6_framework_continuity_pack.js +81 -81
  241. package/lib/phase_6_framework_runtime_pack.js +68 -68
  242. package/lib/phase_6_freeze_baseline_pack.js +68 -68
  243. package/lib/phase_6_freeze_review_pack.js +65 -65
  244. package/lib/phase_6_gate_pack.js +59 -59
  245. package/lib/phase_6_langchain_runtime_pack.js +72 -72
  246. package/lib/phase_6_langgraph_runtime_pack.js +72 -72
  247. package/lib/phase_6_semantic_kernel_runtime_pack.js +72 -72
  248. package/lib/phase_7_closeout_pack.js +45 -45
  249. package/lib/phase_7_completion_pack.js +85 -85
  250. package/lib/phase_7_decision_record_pack.js +53 -53
  251. package/lib/phase_7_decision_resolution_pack.js +53 -53
  252. package/lib/phase_7_event_system_continuity_pack.js +89 -89
  253. package/lib/phase_7_event_system_pack.js +76 -76
  254. package/lib/phase_7_freeze_baseline_pack.js +74 -74
  255. package/lib/phase_7_freeze_review_pack.js +65 -65
  256. package/lib/phase_7_gate_pack.js +58 -58
  257. package/lib/phase_7_kafka_runtime_pack.js +74 -74
  258. package/lib/phase_7_mqtt_runtime_pack.js +74 -74
  259. package/lib/phase_7_nats_runtime_pack.js +74 -74
  260. package/lib/phase_7_webhook_event_bus_runtime_pack.js +74 -74
  261. package/lib/phase_8_closeout_pack.js +46 -46
  262. package/lib/phase_8_completion_pack.js +82 -82
  263. package/lib/phase_8_decision_record_pack.js +54 -54
  264. package/lib/phase_8_decision_resolution_pack.js +53 -53
  265. package/lib/phase_8_external_receipt_import_runtime_pack.js +74 -74
  266. package/lib/phase_8_external_result_import_runtime_pack.js +74 -74
  267. package/lib/phase_8_freeze_baseline_pack.js +71 -71
  268. package/lib/phase_8_freeze_review_pack.js +64 -64
  269. package/lib/phase_8_gate_pack.js +58 -58
  270. package/lib/phase_8_proof_bridge_continuity_pack.js +86 -86
  271. package/lib/phase_8_proof_bridges_pack.js +72 -72
  272. package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +74 -74
  273. package/lib/phase_9_closeout_pack.js +46 -46
  274. package/lib/phase_9_completion_pack.js +82 -82
  275. package/lib/phase_9_custody_refs_runtime_pack.js +74 -74
  276. package/lib/phase_9_decision_record_pack.js +54 -54
  277. package/lib/phase_9_decision_resolution_pack.js +53 -53
  278. package/lib/phase_9_freeze_baseline_pack.js +71 -71
  279. package/lib/phase_9_freeze_review_pack.js +64 -64
  280. package/lib/phase_9_gate_pack.js +58 -58
  281. package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +74 -74
  282. package/lib/phase_9_treasury_connectivity_pack.js +72 -72
  283. package/lib/phase_9_treasury_continuity_pack.js +86 -86
  284. package/lib/phase_9_treasury_destinations_runtime_pack.js +74 -74
  285. package/lib/phase_program_pack.js +120 -120
  286. package/lib/pricing_optimization_contract.js +775 -775
  287. package/lib/protocol_lane_contract.js +117 -117
  288. package/lib/provenance_lane_contract.js +54 -54
  289. package/lib/provider_lane_contract.js +240 -240
  290. package/lib/provider_runtime_journey_contract.js +183 -183
  291. package/lib/public_surface_policy_contract.js +111 -111
  292. package/lib/publish_plan.js +51 -51
  293. package/lib/record_queries.js +48 -48
  294. package/lib/release_candidate.js +50 -50
  295. package/lib/release_center.js +1093 -1093
  296. package/lib/release_history.js +205 -205
  297. package/lib/release_manifest.js +113 -113
  298. package/lib/release_pack.js +453 -453
  299. package/lib/request_rate_limit.js +144 -144
  300. package/lib/resource_views.js +31 -31
  301. package/lib/revenue_launch_path_contract.js +326 -326
  302. package/lib/route_matchers.js +34 -34
  303. package/lib/route_params.js +19 -19
  304. package/lib/runtime_bridge.js +124 -124
  305. package/lib/runtime_operations_worker.js +282 -282
  306. package/lib/runtime_state_store.js +354 -354
  307. package/lib/settlement_lane_contract.js +111 -111
  308. package/lib/shared_signals_lane_contract.js +54 -54
  309. package/lib/signed_audit_provenance_contract.js +83 -83
  310. package/lib/soft_launch_pack.js +78 -78
  311. package/lib/stablecoin_lane_contract.js +76 -76
  312. package/lib/stripe_mpp_lane_contract.js +96 -96
  313. package/lib/stripe_mpp_payment_front.js +158 -158
  314. package/lib/telemetry_lane_contract.js +54 -54
  315. package/lib/treasury_destinations_contract.js +764 -764
  316. package/lib/treasury_egress_policy_contract.js +91 -91
  317. package/lib/treasury_lane_contract.js +84 -84
  318. package/lib/trust_portability_boundary_contract.js +72 -72
  319. package/lib/x402_facilitator.js +155 -0
  320. package/lib/x402_lane_contract.js +118 -118
  321. package/package.json +106 -105
  322. package/scripts/registry_cli.js +275 -275
  323. package/scripts/verify_adapters.js +554 -554
  324. package/scripts/verify_all.js +4962 -4962
  325. package/scripts/verify_control_plane_contracts.js +34 -34
  326. package/scripts/verify_control_plane_routes.js +70 -70
  327. package/scripts/verify_delivery_summary.js +112 -112
  328. package/scripts/verify_examples.js +19 -19
  329. package/scripts/verify_first_run_conversions.js +81 -81
  330. package/scripts/verify_framework_provider_promotion.js +152 -152
  331. package/scripts/verify_full_catalog.js +174 -174
  332. package/scripts/verify_integrations.js +620 -620
  333. package/scripts/verify_lifecycle_continuity.js +96 -96
  334. package/scripts/verify_market_lane_depth.js +94 -94
  335. package/scripts/verify_market_lane_promotion.js +103 -103
  336. package/scripts/verify_market_lane_traces.js +98 -98
  337. package/scripts/verify_market_lanes.js +102 -102
  338. package/scripts/verify_operator_observability_boundary.js +83 -83
  339. package/scripts/verify_pricing_experiment_plan.js +124 -124
  340. package/scripts/verify_provider_runtime_breadth.js +109 -109
  341. package/scripts/verify_provider_runtime_journeys.js +111 -111
  342. package/scripts/verify_revenue_launch_paths.js +105 -105
  343. package/scripts/verify_runtime_durability.js +52 -52
  344. package/scripts/verify_service.js +15410 -15250
  345. package/scripts/verify_tooling.js +1412 -1412
  346. package/scripts/verify_treasury_public_boundary.js +97 -97
  347. package/scripts/verify_x402_facilitator.js +174 -0
  348. package/server.js +11117 -11006
  349. package/.env.production.checklist +0 -77
  350. package/.env.production.template +0 -54
  351. package/.github/workflows/publish-mcp-executor.yml +0 -43
  352. package/ADAPTER_PARTNER_PATH.md +0 -47
  353. package/ADAPTER_PROMOTION_START_HERE.md +0 -44
  354. package/BOLT_BINDINGS.production.worksheet.json +0 -31
  355. package/EXECUTION_TARGETS.production.worksheet.json +0 -73
  356. package/GO_LIVE_OPERATOR_PACK.md +0 -412
  357. package/L402_BINDINGS.production.worksheet.json +0 -30
  358. package/OPERATIONS_RUNBOOK.md +0 -115
  359. package/OPERATOR_START_HERE.md +0 -63
  360. package/OUTREACH_MESSAGES.md +0 -19
  361. package/OUTREACH_START_HERE.md +0 -36
  362. package/PRODUCTION_MANUAL_CLOSEOUT_SEQUENCE.md +0 -172
  363. package/PROGRAM_COMPLETE_RELEASE.md +0 -63
  364. package/PROGRAM_STATUS.md +0 -57
  365. package/PUBLISH_PLAN.md +0 -26
  366. package/RELEASE_CHECKLIST.md +0 -16
  367. package/SOFT_LAUNCH_KIT.md +0 -47
  368. package/services/mcp-execution-target/DISCOVERY_REGISTRY_PLAYBOOK.md +0 -141
  369. package/services/mcp-execution-target/README.md +0 -319
  370. package/services/mcp-execution-target/package.json +0 -14
  371. package/services/mcp-execution-target/server.js +0 -1031
  372. package/services/mcp-execution-target/server.json +0 -16
  373. package/services/mcp-execution-target/verify.js +0 -308
@@ -1,966 +1,966 @@
1
- "use strict";
2
-
3
- const { catalog, findCreditPack, findTask, findWorkflow } = require("../fixtures/catalog");
4
-
5
- function buildDefaultTransactionTaskPacks() {
6
- const center = buildDefaultTransactionCenter();
7
- const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
8
- ? center.default_settlement.settlement_mode
9
- : null;
10
- const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
11
- ? center.default_payment.protocol
12
- : null;
13
- const suggestedPaths = Array.isArray(center.suggested_paths) ? center.suggested_paths : [];
14
- const defaultMcpPath = suggestedPaths.find((entry) => entry && entry.path_id === "default_mcp_x402_path") || null;
15
- const defaultA2cPath = suggestedPaths.find((entry) => entry && entry.path_id === "default_a2c_tooling_flow") || null;
16
- return [
17
- {
18
- pack_ref: "default.mcp.tool.invoke",
19
- title: "Default MCP Tool Invoke",
20
- description: "Run one MCP tool through the built-in default transaction path.",
21
- pack_kind: "task_set",
22
- usage_mode: "direct_invoke",
23
- default_protocol: "mcp",
24
- default_payment_protocol: defaultPaymentProtocol,
25
- default_settlement_mode: defaultSettlementMode,
26
- suggested_path_id: defaultMcpPath ? defaultMcpPath.path_id : null,
27
- selection_reason: "first_party_default_task_pack",
28
- task_refs: ["adapter.mcp.invoke"],
29
- workflow_ref: null,
30
- required_inputs: ["tool_name"],
31
- optional_inputs: ["arguments", "settlement_mode", "payment_protocol"]
32
- },
33
- {
34
- pack_ref: "default.a2c.tooling.run",
35
- title: "Default A2C Tooling Run",
36
- description: "Open an A2C session, preview a tooling pack, and invoke an MCP tool through the default path.",
37
- pack_kind: "workflow_pack",
38
- usage_mode: "guided_flow",
39
- default_protocol: "mcp",
40
- default_payment_protocol: defaultPaymentProtocol,
41
- default_settlement_mode: defaultSettlementMode,
42
- suggested_path_id: defaultA2cPath ? defaultA2cPath.path_id : null,
43
- selection_reason: "first_party_default_workflow_pack",
44
- task_refs: ["a2c.session.open", "a2c.pack.preview", "adapter.mcp.invoke"],
45
- workflow_ref: "a2c.tooling.flow",
46
- required_inputs: ["agent_id", "channel_ref", "pack_ref", "tool_name"],
47
- optional_inputs: ["arguments", "settlement_mode", "payment_protocol"]
48
- },
49
- {
50
- pack_ref: "default.identity.anchor.run",
51
- title: "Default Identity Anchor Run",
52
- description: "Preview identity attestation, register the record, link it, and anchor the resulting commitment.",
53
- pack_kind: "workflow_pack",
54
- usage_mode: "guided_flow",
55
- default_protocol: null,
56
- default_payment_protocol: defaultPaymentProtocol,
57
- default_settlement_mode: defaultSettlementMode,
58
- suggested_path_id: null,
59
- selection_reason: "first_party_default_identity_pack",
60
- task_refs: ["identity.attest.preview", "registry.register", "identity.registry.link", "anchoring.submit"],
61
- workflow_ref: "identity.anchor.flow",
62
- required_inputs: ["subject_id", "record_type", "registry_record_id", "commitment_hash"],
63
- optional_inputs: ["registry_scope", "settlement_mode", "payment_protocol"]
64
- }
65
- ];
66
- }
67
-
68
- function buildDefaultTransactionGuidedLoops() {
69
- const center = buildDefaultTransactionCenter();
70
- const taskPacks = buildDefaultTransactionTaskPacks();
71
- const economics = buildDefaultTransactionEconomics();
72
- const buildLoop = (loopRef, packRef, title, description, stages) => {
73
- const pack = taskPacks.find((entry) => entry && entry.pack_ref === packRef) || null;
74
- return {
75
- loop_ref: loopRef,
76
- pack_ref: packRef,
77
- title,
78
- description,
79
- stage_count: Array.isArray(stages) ? stages.length : 0,
80
- stages: Array.isArray(stages) ? stages : [],
81
- default_protocol: pack && pack.default_protocol ? pack.default_protocol : center.default_protocol.protocol,
82
- default_payment_protocol: economics.payment_protocol,
83
- default_settlement_mode: economics.default_settlement_mode,
84
- suggested_path_id: pack && pack.suggested_path_id ? pack.suggested_path_id : null,
85
- workflow_ref: pack && pack.workflow_ref ? pack.workflow_ref : null
86
- };
87
- };
88
- return [
89
- buildLoop(
90
- "default.mcp.loop",
91
- "default.mcp.tool.invoke",
92
- "Default MCP Loop",
93
- "Preview, quote, pay, invoke, and inspect one MCP tool through the built-in first-party path.",
94
- ["preview", "quote", "pay", "invoke", "inspect"]
95
- ),
96
- buildLoop(
97
- "default.a2c.tooling.loop",
98
- "default.a2c.tooling.run",
99
- "Default A2C Tooling Loop",
100
- "Open a session, preview a pack, invoke a tool, and inspect the resulting linked records.",
101
- ["preview", "quote", "pay", "session", "invoke", "inspect"]
102
- ),
103
- buildLoop(
104
- "default.identity.anchor.loop",
105
- "default.identity.anchor.run",
106
- "Default Identity Anchor Loop",
107
- "Preview identity attestation, register, link, anchor, and inspect the resulting default transaction records.",
108
- ["preview", "quote", "pay", "register", "anchor", "inspect"]
109
- )
110
- ];
111
- }
112
-
113
- function buildTransactionClassPacks() {
114
- const center = buildDefaultTransactionCenter();
115
- const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
116
- ? center.default_settlement.settlement_mode
117
- : null;
118
- const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
119
- ? center.default_payment.protocol
120
- : null;
121
- return [
122
- {
123
- class_pack_ref: "transaction.trust.receipt",
124
- title: "Trust Receipt Transaction",
125
- description: "Verify trust posture and validate the paired receipt as one grouped transaction class.",
126
- workflow_ref: "trust.flow",
127
- task_refs: ["trust.verify", "receipt.validate"],
128
- category: "trust",
129
- proof_handoff_kind: "receipt_validation",
130
- default_payment_protocol: defaultPaymentProtocol,
131
- default_settlement_mode: defaultSettlementMode,
132
- required_inputs: ["subject_id", "receipt_id"],
133
- optional_inputs: ["payment_protocol", "settlement_mode"]
134
- },
135
- {
136
- class_pack_ref: "transaction.runtime.consequence",
137
- title: "Runtime Consequence Transaction",
138
- description: "Emit a runtime consequence and anchor the resulting commitment as one grouped transaction class.",
139
- workflow_ref: "runtime.consequence.flow",
140
- task_refs: ["runtime.emit", "runtime.anchor"],
141
- category: "runtime",
142
- proof_handoff_kind: "runtime_anchor",
143
- default_payment_protocol: defaultPaymentProtocol,
144
- default_settlement_mode: defaultSettlementMode,
145
- required_inputs: ["intent_id", "event_type", "event_commitment"],
146
- optional_inputs: ["payment_protocol", "settlement_mode"]
147
- },
148
- {
149
- class_pack_ref: "transaction.admission.settlement",
150
- title: "Admission Settlement Transaction",
151
- description: "Preview admission and submit settlement as one grouped transaction class.",
152
- workflow_ref: "admission.settlement.flow",
153
- task_refs: ["admission.preview", "settlement.submit"],
154
- category: "admission",
155
- proof_handoff_kind: "admission_settlement",
156
- default_payment_protocol: defaultPaymentProtocol,
157
- default_settlement_mode: defaultSettlementMode,
158
- required_inputs: ["source_zone_id", "target_zone_id", "intent_id"],
159
- optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
160
- },
161
- {
162
- class_pack_ref: "transaction.registry.anchor",
163
- title: "Registry Anchor Transaction",
164
- description: "Register a record and anchor its commitment as one grouped transaction class.",
165
- workflow_ref: "registry.anchor.flow",
166
- task_refs: ["registry.register", "anchoring.submit"],
167
- category: "registry",
168
- proof_handoff_kind: "registry_anchor",
169
- default_payment_protocol: defaultPaymentProtocol,
170
- default_settlement_mode: defaultSettlementMode,
171
- required_inputs: ["subject_id", "record_type", "commitment_hash"],
172
- optional_inputs: ["payment_protocol", "settlement_mode"]
173
- },
174
- {
175
- class_pack_ref: "transaction.job.commitment",
176
- title: "Job Commitment Transaction",
177
- description: "Quote, reserve, and commit a job as one grouped transaction class.",
178
- workflow_ref: "job.commitment.flow",
179
- task_refs: ["jobs.quote", "jobs.reserve", "jobs.commit"],
180
- category: "jobs",
181
- proof_handoff_kind: "job_commitment",
182
- default_payment_protocol: defaultPaymentProtocol,
183
- default_settlement_mode: defaultSettlementMode,
184
- required_inputs: ["job_type", "job_id"],
185
- optional_inputs: ["payment_protocol", "settlement_mode"]
186
- }
187
- ];
188
- }
189
-
190
- function buildPrecommitInteractionPacks() {
191
- const center = buildDefaultTransactionCenter();
192
- const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
193
- ? center.default_settlement.settlement_mode
194
- : null;
195
- const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
196
- ? center.default_payment.protocol
197
- : null;
198
- return [
199
- {
200
- precommit_pack_ref: "precommit.a2a.settlement.readiness",
201
- title: "A2A Settlement Readiness",
202
- description: "Negotiate, preview admission, and confirm commit posture before a committed settlement-class transaction.",
203
- category: "a2a",
204
- protocol: "a2a",
205
- task_refs: ["a2a.negotiate", "admission.preview", "a2a.commit"],
206
- default_payment_protocol: defaultPaymentProtocol,
207
- default_settlement_mode: defaultSettlementMode,
208
- commitment_signal: "a2a.commit",
209
- readiness_kind: "settlement_commit_readiness",
210
- recommended_next_surface: "/v1/transaction-center/transaction-class-packs/run",
211
- recommended_next_ref: "transaction.admission.settlement",
212
- required_inputs: ["counterparty_agent_id", "intent_id", "source_zone_id", "target_zone_id"],
213
- optional_inputs: ["task_pack_ref", "negotiation_mode", "interaction_class", "payment_protocol", "settlement_mode"]
214
- },
215
- {
216
- precommit_pack_ref: "precommit.a2c.tooling.readiness",
217
- title: "A2C Tooling Readiness",
218
- description: "Open the session, preview the tooling pack, and confirm admission posture before committed tooling execution.",
219
- category: "a2c",
220
- protocol: "a2c",
221
- task_refs: ["a2c.session.open", "a2c.pack.preview", "admission.preview"],
222
- default_payment_protocol: defaultPaymentProtocol,
223
- default_settlement_mode: defaultSettlementMode,
224
- commitment_signal: "a2c.pack.preview",
225
- readiness_kind: "tooling_commit_readiness",
226
- recommended_next_surface: "/v1/transaction-center/task-packs/invoke",
227
- recommended_next_ref: "default.a2c.tooling.run",
228
- required_inputs: ["agent_id", "channel_ref", "pack_ref", "source_zone_id", "target_zone_id"],
229
- optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
230
- },
231
- {
232
- precommit_pack_ref: "precommit.job.commitment.readiness",
233
- title: "Job Commitment Readiness",
234
- description: "Quote, preview admission, and reserve the job before committing the full job transaction class.",
235
- category: "jobs",
236
- protocol: "job",
237
- task_refs: ["jobs.quote", "admission.preview", "jobs.reserve"],
238
- default_payment_protocol: defaultPaymentProtocol,
239
- default_settlement_mode: defaultSettlementMode,
240
- commitment_signal: "jobs.reserve",
241
- readiness_kind: "job_commitment_readiness",
242
- recommended_next_surface: "/v1/transaction-center/transaction-class-packs/run",
243
- recommended_next_ref: "transaction.job.commitment",
244
- required_inputs: ["job_type", "job_id", "source_zone_id", "target_zone_id", "intent_id"],
245
- optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
246
- }
247
- ];
248
- }
249
-
250
- function buildInteractionSpinePaths() {
251
- const center = buildDefaultTransactionCenter();
252
- const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
253
- ? center.default_settlement.settlement_mode
254
- : null;
255
- const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
256
- ? center.default_payment.protocol
257
- : null;
258
- return [
259
- {
260
- spine_path_ref: "spine.a2a.settlement",
261
- title: "A2A Settlement Spine",
262
- description: "Compose negotiation, admission, commit, and settlement as one grouped machine-interaction spine path.",
263
- category: "a2a",
264
- protocol: "a2a",
265
- precommit_pack_ref: "precommit.a2a.settlement.readiness",
266
- committed_ref: "transaction.admission.settlement",
267
- task_refs: ["a2a.negotiate", "admission.preview", "a2a.commit", "settlement.submit"],
268
- default_payment_protocol: defaultPaymentProtocol,
269
- default_settlement_mode: defaultSettlementMode,
270
- proof_followthrough: "default.proof.bundle.loop",
271
- required_inputs: ["counterparty_agent_id", "intent_id", "source_zone_id", "target_zone_id"],
272
- optional_inputs: ["task_pack_ref", "negotiation_mode", "interaction_class", "payment_protocol", "settlement_mode"]
273
- },
274
- {
275
- spine_path_ref: "spine.a2c.tooling",
276
- title: "A2C Tooling Spine",
277
- description: "Compose session open, pack preview, admission posture, and committed tooling execution as one grouped path.",
278
- category: "a2c",
279
- protocol: "a2c",
280
- precommit_pack_ref: "precommit.a2c.tooling.readiness",
281
- committed_ref: "default.a2c.tooling.run",
282
- task_refs: ["a2c.session.open", "a2c.pack.preview", "admission.preview", "adapter.mcp.invoke"],
283
- default_payment_protocol: defaultPaymentProtocol,
284
- default_settlement_mode: defaultSettlementMode,
285
- proof_followthrough: "default.proof.bundle.loop",
286
- required_inputs: ["agent_id", "channel_ref", "pack_ref", "tool_name", "source_zone_id", "target_zone_id"],
287
- optional_inputs: ["arguments", "interaction_class", "payment_protocol", "settlement_mode"]
288
- },
289
- {
290
- spine_path_ref: "spine.job.commitment",
291
- title: "Job Commitment Spine",
292
- description: "Compose quote, admission, reserve, and commit as one grouped job interaction spine path.",
293
- category: "jobs",
294
- protocol: "job",
295
- precommit_pack_ref: "precommit.job.commitment.readiness",
296
- committed_ref: "transaction.job.commitment",
297
- task_refs: ["jobs.quote", "admission.preview", "jobs.reserve", "jobs.commit"],
298
- default_payment_protocol: defaultPaymentProtocol,
299
- default_settlement_mode: defaultSettlementMode,
300
- proof_followthrough: "default.proof.bundle.loop",
301
- required_inputs: ["job_type", "job_id", "source_zone_id", "target_zone_id"],
302
- optional_inputs: ["intent_id", "interaction_class", "payment_protocol", "settlement_mode"]
303
- }
304
- ];
305
- }
306
-
307
- function buildInteractionResultPackages() {
308
- return buildInteractionSpinePaths().map((path) => ({
309
- result_package_ref: path && path.spine_path_ref ? `result.${path.spine_path_ref}` : null,
310
- source_kind: "interaction_spine_path",
311
- source_ref: path && path.spine_path_ref ? path.spine_path_ref : null,
312
- title: path && path.title ? `${path.title} Result Package` : "Interaction Result Package",
313
- description: path && path.description
314
- ? `${path.description} Preserve the composed output as a stable result-side package and proof-handoff seam.`
315
- : "Preserve the composed output as a stable result-side package and proof-handoff seam.",
316
- category: path && path.category ? path.category : null,
317
- protocol: path && path.protocol ? path.protocol : null,
318
- precommit_pack_ref: path && path.precommit_pack_ref ? path.precommit_pack_ref : null,
319
- committed_ref: path && path.committed_ref ? path.committed_ref : null,
320
- proof_followthrough: path && path.proof_followthrough ? path.proof_followthrough : null,
321
- portable_handoff_surface: "/v1/transaction-center/result-packages/export",
322
- portable_proof_surface: "/v1/proof-center/result-package-handoff/run",
323
- default_payment_protocol: path && path.default_payment_protocol ? path.default_payment_protocol : null,
324
- default_settlement_mode: path && path.default_settlement_mode ? path.default_settlement_mode : null,
325
- seam_layers: [
326
- "execution_consequence",
327
- "payment_settlement_treasury",
328
- "proof_handoff"
329
- ],
330
- required_inputs: Array.isArray(path && path.required_inputs) ? path.required_inputs : [],
331
- optional_inputs: Array.isArray(path && path.optional_inputs) ? path.optional_inputs : []
332
- }));
333
- }
334
-
335
- function buildInteractionResultPackageContinuationTemplates() {
336
- return buildInteractionResultPackages().map((resultPackage) => ({
337
- continuation_ref: resultPackage && resultPackage.result_package_ref
338
- ? `continue.${resultPackage.result_package_ref}`
339
- : null,
340
- result_package_ref: resultPackage && resultPackage.result_package_ref ? resultPackage.result_package_ref : null,
341
- source_ref: resultPackage && resultPackage.source_ref ? resultPackage.source_ref : null,
342
- title: resultPackage && resultPackage.title
343
- ? `${resultPackage.title} Continuation`
344
- : "Interaction Result Package Continuation",
345
- description: resultPackage && resultPackage.description
346
- ? `${resultPackage.description} Continue through the reusable default path into proof-native follow-through.`
347
- : "Continue through the reusable default path into proof-native follow-through.",
348
- continuation_kind: "proof_native_default",
349
- default_next_surface: "/v1/transaction-center/result-package-continuations/run",
350
- default_export_surface: "/v1/transaction-center/result-packages/export",
351
- default_proof_surface: "/v1/proof-center/result-package-handoff/run",
352
- committed_ref: resultPackage && resultPackage.committed_ref ? resultPackage.committed_ref : null,
353
- precommit_pack_ref: resultPackage && resultPackage.precommit_pack_ref ? resultPackage.precommit_pack_ref : null,
354
- seam_layers: Array.isArray(resultPackage && resultPackage.seam_layers) ? resultPackage.seam_layers : [],
355
- required_inputs: Array.isArray(resultPackage && resultPackage.required_inputs) ? resultPackage.required_inputs : [],
356
- optional_inputs: Array.isArray(resultPackage && resultPackage.optional_inputs) ? resultPackage.optional_inputs : []
357
- }));
358
- }
359
-
360
- function buildDefaultTransactionCenter() {
361
- const settlementProfiles = Array.isArray(catalog.settlement_profiles) ? catalog.settlement_profiles : [];
362
- const defaultSettlementProfile = settlementProfiles[0] || null;
363
- const settlementModes = settlementProfiles
364
- .map((profile) => profile && profile.mode)
365
- .filter(Boolean);
366
- return {
367
- ok: true,
368
- brand: "xytara",
369
- product: "default transaction center",
370
- payment_scheme: catalog.payment_scheme,
371
- default_protocol: {
372
- protocol: "mcp",
373
- integration_id: "builtin.protocol.mcp",
374
- task_ref: "adapter.mcp.invoke",
375
- workflow_refs: ["a2c.tooling.flow"],
376
- selection_reason: "production_default_protocol_lane"
377
- },
378
- default_payment: {
379
- protocol: "x402",
380
- integration_id: "builtin.payment.x402",
381
- payment_scheme: catalog.payment_scheme,
382
- supported_settlement_modes: settlementModes,
383
- selection_reason: "production_default_payment_lane"
384
- },
385
- default_settlement: {
386
- integration_id: "builtin.settlement.chain",
387
- settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
388
- adapter: defaultSettlementProfile && defaultSettlementProfile.adapter ? defaultSettlementProfile.adapter : null,
389
- asset: defaultSettlementProfile && defaultSettlementProfile.asset ? defaultSettlementProfile.asset : null,
390
- payee_agent_id: defaultSettlementProfile && defaultSettlementProfile.payee_agent_id ? defaultSettlementProfile.payee_agent_id : null,
391
- payee_label: defaultSettlementProfile && defaultSettlementProfile.payee_label ? defaultSettlementProfile.payee_label : null,
392
- supported_modes: settlementModes,
393
- profile_count: settlementProfiles.length
394
- },
395
- default_treasury: {
396
- destination_kind: "account_treasury",
397
- destination_template: "treasury_{account_id}",
398
- settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
399
- payee_agent_id: defaultSettlementProfile && defaultSettlementProfile.payee_agent_id ? defaultSettlementProfile.payee_agent_id : null,
400
- payee_label: defaultSettlementProfile && defaultSettlementProfile.payee_label ? defaultSettlementProfile.payee_label : null
401
- },
402
- suggested_paths: [
403
- {
404
- path_id: "default_mcp_x402_path",
405
- path_kind: "first_party_default",
406
- protocol: "mcp",
407
- payment_protocol: "x402",
408
- settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
409
- task_ref: "adapter.mcp.invoke",
410
- integration_ids: ["builtin.protocol.mcp", "builtin.payment.x402", "builtin.settlement.chain"]
411
- },
412
- {
413
- path_id: "default_a2c_tooling_flow",
414
- path_kind: "first_party_default",
415
- protocol: "mcp",
416
- payment_protocol: "x402",
417
- settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
418
- workflow_ref: "a2c.tooling.flow",
419
- integration_ids: ["builtin.protocol.mcp", "builtin.payment.x402", "builtin.settlement.chain"]
420
- }
421
- ]
422
- };
423
- }
424
-
425
- function summarizeDefaultTransactionCenter() {
426
- const center = buildDefaultTransactionCenter();
427
- return {
428
- ok: true,
429
- brand: center.brand,
430
- product: center.product,
431
- payment_scheme: center.payment_scheme,
432
- default_protocol: center.default_protocol.protocol,
433
- default_payment_protocol: center.default_payment.protocol,
434
- default_settlement_mode: center.default_settlement.settlement_mode,
435
- default_treasury_kind: center.default_treasury.destination_kind,
436
- settlement_mode_count: Array.isArray(center.default_settlement.supported_modes) ? center.default_settlement.supported_modes.length : 0,
437
- settlement_modes: center.default_settlement.supported_modes,
438
- suggested_path_count: Array.isArray(center.suggested_paths) ? center.suggested_paths.length : 0,
439
- suggested_paths: center.suggested_paths
440
- };
441
- }
442
-
443
- function buildDefaultTransactionEconomics() {
444
- const center = buildDefaultTransactionCenter();
445
- const settlement = center.default_settlement || {};
446
- const payment = center.default_payment || {};
447
- const treasury = center.default_treasury || {};
448
- return {
449
- ok: true,
450
- brand: center.brand,
451
- product: "default transaction economics",
452
- payment_protocol: payment.protocol || null,
453
- payment_scheme: payment.payment_scheme || center.payment_scheme || null,
454
- default_settlement_mode: settlement.settlement_mode || null,
455
- supported_settlement_modes: Array.isArray(settlement.supported_modes) ? settlement.supported_modes : [],
456
- settlement_adapter: settlement.adapter || null,
457
- settlement_asset: settlement.asset || null,
458
- payee_agent_id: settlement.payee_agent_id || null,
459
- payee_label: settlement.payee_label || null,
460
- treasury_destination_kind: treasury.destination_kind || null,
461
- treasury_destination_template: treasury.destination_template || null,
462
- suggested_path_ids: Array.isArray(center.suggested_paths)
463
- ? center.suggested_paths.map((entry) => entry && entry.path_id).filter(Boolean)
464
- : []
465
- };
466
- }
467
-
468
- function summarizeDefaultTransactionEconomics() {
469
- const economics = buildDefaultTransactionEconomics();
470
- return {
471
- ok: true,
472
- brand: economics.brand,
473
- product: economics.product,
474
- payment_protocol: economics.payment_protocol,
475
- payment_scheme: economics.payment_scheme,
476
- default_settlement_mode: economics.default_settlement_mode,
477
- settlement_mode_count: economics.supported_settlement_modes.length,
478
- supported_settlement_modes: economics.supported_settlement_modes,
479
- treasury_destination_kind: economics.treasury_destination_kind,
480
- payee_agent_id: economics.payee_agent_id,
481
- suggested_path_count: economics.suggested_path_ids.length,
482
- suggested_path_ids: economics.suggested_path_ids
483
- };
484
- }
485
-
486
- function buildDefaultTransactionTaskPackCatalog() {
487
- const center = buildDefaultTransactionCenter();
488
- const packs = buildDefaultTransactionTaskPacks();
489
- return {
490
- ok: true,
491
- brand: center.brand,
492
- product: "default transaction task packs",
493
- default_protocol: center.default_protocol && center.default_protocol.protocol ? center.default_protocol.protocol : null,
494
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
495
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
496
- pack_count: packs.length,
497
- packs
498
- };
499
- }
500
-
501
- function summarizeDefaultTransactionTaskPacks() {
502
- const catalogResponse = buildDefaultTransactionTaskPackCatalog();
503
- const packs = Array.isArray(catalogResponse.packs) ? catalogResponse.packs : [];
504
- return {
505
- ok: true,
506
- brand: catalogResponse.brand,
507
- product: catalogResponse.product,
508
- default_protocol: catalogResponse.default_protocol,
509
- default_payment_protocol: catalogResponse.default_payment_protocol,
510
- default_settlement_mode: catalogResponse.default_settlement_mode,
511
- pack_count: packs.length,
512
- pack_refs: packs.map((entry) => entry && entry.pack_ref).filter(Boolean),
513
- direct_pack_count: packs.filter((entry) => entry && entry.pack_kind === "task_set").length,
514
- workflow_pack_count: packs.filter((entry) => entry && entry.pack_kind === "workflow_pack").length,
515
- packs
516
- };
517
- }
518
-
519
- function getDefaultTransactionTaskPack(ref) {
520
- const normalized = String(ref || "").trim();
521
- if (!normalized) return null;
522
- return buildDefaultTransactionTaskPacks().find((entry) => entry && entry.pack_ref === normalized) || null;
523
- }
524
-
525
- function buildDefaultTransactionGuidedLoopCatalog() {
526
- const center = buildDefaultTransactionCenter();
527
- const loops = buildDefaultTransactionGuidedLoops();
528
- return {
529
- ok: true,
530
- brand: center.brand,
531
- product: "default transaction guided loops",
532
- default_protocol: center.default_protocol && center.default_protocol.protocol ? center.default_protocol.protocol : null,
533
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
534
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
535
- loop_count: loops.length,
536
- loops
537
- };
538
- }
539
-
540
- function summarizeDefaultTransactionGuidedLoops() {
541
- const catalogResponse = buildDefaultTransactionGuidedLoopCatalog();
542
- const loops = Array.isArray(catalogResponse.loops) ? catalogResponse.loops : [];
543
- return {
544
- ok: true,
545
- brand: catalogResponse.brand,
546
- product: catalogResponse.product,
547
- default_protocol: catalogResponse.default_protocol,
548
- default_payment_protocol: catalogResponse.default_payment_protocol,
549
- default_settlement_mode: catalogResponse.default_settlement_mode,
550
- loop_count: loops.length,
551
- loop_refs: loops.map((entry) => entry && entry.loop_ref).filter(Boolean),
552
- loops
553
- };
554
- }
555
-
556
- function getDefaultTransactionGuidedLoop(ref) {
557
- const normalized = String(ref || "").trim();
558
- if (!normalized) return null;
559
- return buildDefaultTransactionGuidedLoops().find((entry) => entry && entry.loop_ref === normalized) || null;
560
- }
561
-
562
- function buildTransactionClassPackCatalog() {
563
- const center = buildDefaultTransactionCenter();
564
- const packs = buildTransactionClassPacks();
565
- return {
566
- ok: true,
567
- brand: center.brand,
568
- product: "transaction class packs",
569
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
570
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
571
- class_pack_count: packs.length,
572
- class_packs: packs
573
- };
574
- }
575
-
576
- function buildPrecommitInteractionPackCatalog() {
577
- const center = buildDefaultTransactionCenter();
578
- const packs = buildPrecommitInteractionPacks();
579
- return {
580
- ok: true,
581
- brand: center.brand,
582
- product: "precommit interaction packs",
583
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
584
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
585
- precommit_pack_count: packs.length,
586
- precommit_packs: packs
587
- };
588
- }
589
-
590
- function buildInteractionSpinePathCatalog() {
591
- const center = buildDefaultTransactionCenter();
592
- const paths = buildInteractionSpinePaths();
593
- return {
594
- ok: true,
595
- brand: center.brand,
596
- product: "interaction spine paths",
597
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
598
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
599
- spine_path_count: paths.length,
600
- spine_paths: paths
601
- };
602
- }
603
-
604
- function buildInteractionResultPackageCatalog() {
605
- const center = buildDefaultTransactionCenter();
606
- const packages = buildInteractionResultPackages();
607
- return {
608
- ok: true,
609
- brand: center.brand,
610
- product: "interaction result packages",
611
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
612
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
613
- result_package_count: packages.length,
614
- result_packages: packages
615
- };
616
- }
617
-
618
- function buildInteractionResultPackageContinuationCatalog() {
619
- const center = buildDefaultTransactionCenter();
620
- const templates = buildInteractionResultPackageContinuationTemplates();
621
- return {
622
- ok: true,
623
- brand: center.brand,
624
- product: "interaction result package continuations",
625
- default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
626
- default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
627
- continuation_count: templates.length,
628
- continuations: templates
629
- };
630
- }
631
-
632
- function summarizeTransactionClassPacks() {
633
- const catalogResponse = buildTransactionClassPackCatalog();
634
- const packs = Array.isArray(catalogResponse.class_packs) ? catalogResponse.class_packs : [];
635
- return {
636
- ok: true,
637
- brand: catalogResponse.brand,
638
- product: catalogResponse.product,
639
- default_payment_protocol: catalogResponse.default_payment_protocol,
640
- default_settlement_mode: catalogResponse.default_settlement_mode,
641
- class_pack_count: packs.length,
642
- class_pack_refs: packs.map((entry) => entry && entry.class_pack_ref).filter(Boolean),
643
- categories: Array.from(new Set(packs.map((entry) => entry && entry.category).filter(Boolean))),
644
- class_packs: packs
645
- };
646
- }
647
-
648
- function summarizePrecommitInteractionPacks() {
649
- const catalogResponse = buildPrecommitInteractionPackCatalog();
650
- const packs = Array.isArray(catalogResponse.precommit_packs) ? catalogResponse.precommit_packs : [];
651
- return {
652
- ok: true,
653
- brand: catalogResponse.brand,
654
- product: catalogResponse.product,
655
- default_payment_protocol: catalogResponse.default_payment_protocol,
656
- default_settlement_mode: catalogResponse.default_settlement_mode,
657
- precommit_pack_count: packs.length,
658
- precommit_pack_refs: packs.map((entry) => entry && entry.precommit_pack_ref).filter(Boolean),
659
- categories: Array.from(new Set(packs.map((entry) => entry && entry.category).filter(Boolean))),
660
- precommit_packs: packs
661
- };
662
- }
663
-
664
- function summarizeInteractionSpinePaths() {
665
- const catalogResponse = buildInteractionSpinePathCatalog();
666
- const paths = Array.isArray(catalogResponse.spine_paths) ? catalogResponse.spine_paths : [];
667
- return {
668
- ok: true,
669
- brand: catalogResponse.brand,
670
- product: catalogResponse.product,
671
- default_payment_protocol: catalogResponse.default_payment_protocol,
672
- default_settlement_mode: catalogResponse.default_settlement_mode,
673
- spine_path_count: paths.length,
674
- spine_path_refs: paths.map((entry) => entry && entry.spine_path_ref).filter(Boolean),
675
- categories: Array.from(new Set(paths.map((entry) => entry && entry.category).filter(Boolean))),
676
- spine_paths: paths
677
- };
678
- }
679
-
680
- function summarizeInteractionResultPackages() {
681
- const catalogResponse = buildInteractionResultPackageCatalog();
682
- const packages = Array.isArray(catalogResponse.result_packages) ? catalogResponse.result_packages : [];
683
- return {
684
- ok: true,
685
- brand: catalogResponse.brand,
686
- product: catalogResponse.product,
687
- default_payment_protocol: catalogResponse.default_payment_protocol,
688
- default_settlement_mode: catalogResponse.default_settlement_mode,
689
- result_package_count: packages.length,
690
- result_package_refs: packages.map((entry) => entry && entry.result_package_ref).filter(Boolean),
691
- source_refs: packages.map((entry) => entry && entry.source_ref).filter(Boolean),
692
- seam_layers: Array.from(new Set(packages.flatMap((entry) => Array.isArray(entry && entry.seam_layers) ? entry.seam_layers : []))),
693
- result_packages: packages
694
- };
695
- }
696
-
697
- function summarizeInteractionResultPackageContinuations() {
698
- const catalogResponse = buildInteractionResultPackageContinuationCatalog();
699
- const templates = Array.isArray(catalogResponse.continuations) ? catalogResponse.continuations : [];
700
- return {
701
- ok: true,
702
- brand: catalogResponse.brand,
703
- product: catalogResponse.product,
704
- default_payment_protocol: catalogResponse.default_payment_protocol,
705
- default_settlement_mode: catalogResponse.default_settlement_mode,
706
- continuation_count: templates.length,
707
- continuation_refs: templates.map((entry) => entry && entry.continuation_ref).filter(Boolean),
708
- result_package_refs: templates.map((entry) => entry && entry.result_package_ref).filter(Boolean),
709
- continuations: templates
710
- };
711
- }
712
-
713
- function getTransactionClassPack(ref) {
714
- const normalized = String(ref || "").trim();
715
- if (!normalized) return null;
716
- return buildTransactionClassPacks().find((entry) => entry && entry.class_pack_ref === normalized) || null;
717
- }
718
-
719
- function getPrecommitInteractionPack(ref) {
720
- const normalized = String(ref || "").trim();
721
- if (!normalized) return null;
722
- return buildPrecommitInteractionPacks().find((entry) => entry && entry.precommit_pack_ref === normalized) || null;
723
- }
724
-
725
- function getInteractionSpinePath(ref) {
726
- const normalized = String(ref || "").trim();
727
- if (!normalized) return null;
728
- return buildInteractionSpinePaths().find((entry) => entry && entry.spine_path_ref === normalized) || null;
729
- }
730
-
731
- function getInteractionResultPackage(ref) {
732
- const normalized = String(ref || "").trim();
733
- if (!normalized) return null;
734
- return buildInteractionResultPackages().find((entry) => entry && entry.result_package_ref === normalized) || null;
735
- }
736
-
737
- function getInteractionResultPackageContinuation(ref) {
738
- const normalized = String(ref || "").trim();
739
- if (!normalized) return null;
740
- return buildInteractionResultPackageContinuationTemplates().find((entry) => entry && entry.continuation_ref === normalized) || null;
741
- }
742
-
743
- function buildCatalogResponse() {
744
- return {
745
- ok: true,
746
- brand: "xytara",
747
- product: "governed transaction rail",
748
- version: catalog.version,
749
- catalog_version: catalog.version,
750
- currency: catalog.currency,
751
- payment_scheme: catalog.payment_scheme,
752
- plans: catalog.plans,
753
- capabilities: catalog.capabilities,
754
- adapters: catalog.adapters,
755
- settlement_profiles: catalog.settlement_profiles,
756
- task_categories: catalog.task_categories,
757
- workflows: catalog.workflows,
758
- surfaces: catalog.surfaces,
759
- tasks: catalog.tasks
760
- };
761
- }
762
-
763
- function summarizeCatalog() {
764
- const fullCatalog = buildCatalogResponse();
765
- return {
766
- ok: true,
767
- brand: fullCatalog.brand,
768
- product: fullCatalog.product,
769
- version: fullCatalog.catalog_version,
770
- currency: fullCatalog.currency,
771
- payment_scheme: fullCatalog.payment_scheme,
772
- capabilities: fullCatalog.capabilities,
773
- adapters: fullCatalog.adapters,
774
- task_count: fullCatalog.tasks.length,
775
- workflow_count: fullCatalog.workflows.length,
776
- category_count: fullCatalog.task_categories.length,
777
- task_categories: fullCatalog.task_categories,
778
- settlement_profile_count: fullCatalog.settlement_profiles.length,
779
- settlement_profiles: fullCatalog.settlement_profiles,
780
- workflows: fullCatalog.workflows,
781
- tasks: fullCatalog.tasks.map((task) => ({
782
- task_ref: task.public_task_ref,
783
- internal_task_ref: task.task_ref,
784
- public_task_ref: task.public_task_ref,
785
- aliases: task.public_aliases,
786
- category: task.public_category,
787
- title: task.public_title,
788
- execution_mode: task.execution_mode,
789
- pricing_band: task.pricing_band,
790
- public_launch_price: task.public_launch_price,
791
- pricing_note: task.pricing_note,
792
- latency_class: task.latency_class,
793
- failure_posture: task.failure_posture,
794
- task_family: task.task_family,
795
- lifecycle_stage: task.lifecycle_stage,
796
- market_class: task.market_class,
797
- claim_status: task.claim_status,
798
- evidence_status: task.evidence_status,
799
- capabilities: task.capabilities,
800
- adapters: task.adapters
801
- })),
802
- workflow_summaries: fullCatalog.workflows.map((workflow) => ({
803
- workflow_ref: workflow.workflow_ref,
804
- aliases: workflow.aliases,
805
- category: workflow.category,
806
- title: workflow.title,
807
- task_count: workflow.task_count,
808
- latency_class: workflow.latency_class,
809
- failure_posture: workflow.failure_posture,
810
- pricing_basis: workflow.pricing_basis
811
- }))
812
- };
813
- }
814
-
815
- function getCatalog() {
816
- return buildCatalogResponse();
817
- }
818
-
819
- function getTaskDetail(ref) {
820
- const task = findTask(ref);
821
- if (!task) {
822
- return null;
823
- }
824
- return {
825
- task_ref: task.task_ref,
826
- public_task_ref: task.public_task_ref,
827
- aliases: task.public_aliases,
828
- category: task.public_category,
829
- title: task.public_title,
830
- execution_mode: task.execution_mode,
831
- pricing_band: task.pricing_band,
832
- public_launch_price: task.public_launch_price,
833
- pricing_note: task.pricing_note,
834
- latency_class: task.latency_class,
835
- failure_posture: task.failure_posture,
836
- task_family: task.task_family,
837
- lifecycle_stage: task.lifecycle_stage,
838
- market_class: task.market_class,
839
- claim_status: task.claim_status,
840
- evidence_status: task.evidence_status,
841
- input_schema: task.input_schema,
842
- capabilities: task.capabilities,
843
- adapters: task.adapters
844
- };
845
- }
846
-
847
- function buildWorkflowShape(workflow) {
848
- const workflowTasks = (Array.isArray(workflow.task_refs) ? workflow.task_refs : [])
849
- .map((taskRef) => findTask(taskRef))
850
- .filter(Boolean)
851
- .map((task) => ({
852
- public_task_ref: task.public_task_ref,
853
- task_ref: task.task_ref,
854
- title: task.public_title,
855
- category: task.public_category,
856
- latency_class: task.latency_class,
857
- failure_posture: task.failure_posture,
858
- task_family: task.task_family,
859
- lifecycle_stage: task.lifecycle_stage,
860
- market_class: task.market_class,
861
- claim_status: task.claim_status,
862
- evidence_status: task.evidence_status,
863
- pricing_band: task.pricing_band,
864
- public_launch_price: task.public_launch_price
865
- }));
866
- return {
867
- ...workflow,
868
- pricing_note: "Workflow pricing is determined by the quoted task set, not a fixed bundle price.",
869
- task_refs: workflowTasks.map((task) => task.public_task_ref || task.task_ref),
870
- task_count: workflowTasks.length,
871
- tasks: workflowTasks
872
- };
873
- }
874
-
875
- function getWorkflowList() {
876
- return catalog.workflows.map(buildWorkflowShape);
877
- }
878
-
879
- function getWorkflowDetail(ref) {
880
- const workflow = findWorkflow(ref);
881
- if (!workflow) {
882
- return null;
883
- }
884
- return buildWorkflowShape(workflow);
885
- }
886
-
887
- function getCreditPackList() {
888
- return (Array.isArray(catalog.credit_packs) ? catalog.credit_packs : []).map((pack) => ({
889
- ...pack
890
- }));
891
- }
892
-
893
- function getCreditPackDetail(ref) {
894
- const pack = findCreditPack(ref);
895
- if (!pack) {
896
- return null;
897
- }
898
- return {
899
- ...pack
900
- };
901
- }
902
-
903
- function summarizeCreditPacks() {
904
- const packs = getCreditPackList();
905
- const categoryCounts = packs.reduce((acc, pack) => {
906
- const key = pack && pack.category ? pack.category : "unknown";
907
- acc[key] = (acc[key] || 0) + 1;
908
- return acc;
909
- }, {});
910
- const pricingBandCoverage = Array.from(new Set(
911
- packs.flatMap((pack) => Array.isArray(pack && pack.task_band_targets) ? pack.task_band_targets : []).filter(Boolean)
912
- )).sort((left, right) => String(left).localeCompare(String(right)));
913
- return {
914
- ok: true,
915
- credit_pack_count: packs.length,
916
- categories: Object.entries(categoryCounts)
917
- .map(([category, pack_count]) => ({ category, pack_count }))
918
- .sort((left, right) => String(left.category).localeCompare(String(right.category))),
919
- pricing_band_coverage_count: pricingBandCoverage.length,
920
- pricing_band_coverage: pricingBandCoverage,
921
- credit_packs: packs.map((pack) => ({
922
- pack_id: pack.pack_id,
923
- title: pack.title,
924
- category: pack.category,
925
- issued_units: pack.issued_units,
926
- intended_usage_posture: pack.intended_usage_posture
927
- }))
928
- };
929
- }
930
-
931
- module.exports = {
932
- buildCatalogResponse,
933
- buildDefaultTransactionEconomics,
934
- buildDefaultTransactionCenter,
935
- buildDefaultTransactionGuidedLoopCatalog,
936
- buildInteractionResultPackageCatalog,
937
- buildInteractionResultPackageContinuationCatalog,
938
- buildInteractionSpinePathCatalog,
939
- buildPrecommitInteractionPackCatalog,
940
- buildDefaultTransactionTaskPackCatalog,
941
- buildTransactionClassPackCatalog,
942
- getCreditPackDetail,
943
- getCreditPackList,
944
- getCatalog,
945
- getDefaultTransactionGuidedLoop,
946
- getDefaultTransactionTaskPack,
947
- getInteractionResultPackage,
948
- getInteractionResultPackageContinuation,
949
- getInteractionSpinePath,
950
- getPrecommitInteractionPack,
951
- getTransactionClassPack,
952
- getTaskDetail,
953
- getWorkflowDetail,
954
- getWorkflowList,
955
- summarizeCatalog,
956
- summarizeDefaultTransactionCenter,
957
- summarizeDefaultTransactionEconomics,
958
- summarizeDefaultTransactionGuidedLoops,
959
- summarizeDefaultTransactionTaskPacks,
960
- summarizeCreditPacks,
961
- summarizeInteractionResultPackageContinuations,
962
- summarizeInteractionResultPackages,
963
- summarizeInteractionSpinePaths,
964
- summarizePrecommitInteractionPacks,
965
- summarizeTransactionClassPacks
966
- };
1
+ "use strict";
2
+
3
+ const { catalog, findCreditPack, findTask, findWorkflow } = require("../fixtures/catalog");
4
+
5
+ function buildDefaultTransactionTaskPacks() {
6
+ const center = buildDefaultTransactionCenter();
7
+ const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
8
+ ? center.default_settlement.settlement_mode
9
+ : null;
10
+ const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
11
+ ? center.default_payment.protocol
12
+ : null;
13
+ const suggestedPaths = Array.isArray(center.suggested_paths) ? center.suggested_paths : [];
14
+ const defaultMcpPath = suggestedPaths.find((entry) => entry && entry.path_id === "default_mcp_x402_path") || null;
15
+ const defaultA2cPath = suggestedPaths.find((entry) => entry && entry.path_id === "default_a2c_tooling_flow") || null;
16
+ return [
17
+ {
18
+ pack_ref: "default.mcp.tool.invoke",
19
+ title: "Default MCP Tool Invoke",
20
+ description: "Run one MCP tool through the built-in default transaction path.",
21
+ pack_kind: "task_set",
22
+ usage_mode: "direct_invoke",
23
+ default_protocol: "mcp",
24
+ default_payment_protocol: defaultPaymentProtocol,
25
+ default_settlement_mode: defaultSettlementMode,
26
+ suggested_path_id: defaultMcpPath ? defaultMcpPath.path_id : null,
27
+ selection_reason: "first_party_default_task_pack",
28
+ task_refs: ["adapter.mcp.invoke"],
29
+ workflow_ref: null,
30
+ required_inputs: ["tool_name"],
31
+ optional_inputs: ["arguments", "settlement_mode", "payment_protocol"]
32
+ },
33
+ {
34
+ pack_ref: "default.a2c.tooling.run",
35
+ title: "Default A2C Tooling Run",
36
+ description: "Open an A2C session, preview a tooling pack, and invoke an MCP tool through the default path.",
37
+ pack_kind: "workflow_pack",
38
+ usage_mode: "guided_flow",
39
+ default_protocol: "mcp",
40
+ default_payment_protocol: defaultPaymentProtocol,
41
+ default_settlement_mode: defaultSettlementMode,
42
+ suggested_path_id: defaultA2cPath ? defaultA2cPath.path_id : null,
43
+ selection_reason: "first_party_default_workflow_pack",
44
+ task_refs: ["a2c.session.open", "a2c.pack.preview", "adapter.mcp.invoke"],
45
+ workflow_ref: "a2c.tooling.flow",
46
+ required_inputs: ["agent_id", "channel_ref", "pack_ref", "tool_name"],
47
+ optional_inputs: ["arguments", "settlement_mode", "payment_protocol"]
48
+ },
49
+ {
50
+ pack_ref: "default.identity.anchor.run",
51
+ title: "Default Identity Anchor Run",
52
+ description: "Preview identity attestation, register the record, link it, and anchor the resulting commitment.",
53
+ pack_kind: "workflow_pack",
54
+ usage_mode: "guided_flow",
55
+ default_protocol: null,
56
+ default_payment_protocol: defaultPaymentProtocol,
57
+ default_settlement_mode: defaultSettlementMode,
58
+ suggested_path_id: null,
59
+ selection_reason: "first_party_default_identity_pack",
60
+ task_refs: ["identity.attest.preview", "registry.register", "identity.registry.link", "anchoring.submit"],
61
+ workflow_ref: "identity.anchor.flow",
62
+ required_inputs: ["subject_id", "record_type", "registry_record_id", "commitment_hash"],
63
+ optional_inputs: ["registry_scope", "settlement_mode", "payment_protocol"]
64
+ }
65
+ ];
66
+ }
67
+
68
+ function buildDefaultTransactionGuidedLoops() {
69
+ const center = buildDefaultTransactionCenter();
70
+ const taskPacks = buildDefaultTransactionTaskPacks();
71
+ const economics = buildDefaultTransactionEconomics();
72
+ const buildLoop = (loopRef, packRef, title, description, stages) => {
73
+ const pack = taskPacks.find((entry) => entry && entry.pack_ref === packRef) || null;
74
+ return {
75
+ loop_ref: loopRef,
76
+ pack_ref: packRef,
77
+ title,
78
+ description,
79
+ stage_count: Array.isArray(stages) ? stages.length : 0,
80
+ stages: Array.isArray(stages) ? stages : [],
81
+ default_protocol: pack && pack.default_protocol ? pack.default_protocol : center.default_protocol.protocol,
82
+ default_payment_protocol: economics.payment_protocol,
83
+ default_settlement_mode: economics.default_settlement_mode,
84
+ suggested_path_id: pack && pack.suggested_path_id ? pack.suggested_path_id : null,
85
+ workflow_ref: pack && pack.workflow_ref ? pack.workflow_ref : null
86
+ };
87
+ };
88
+ return [
89
+ buildLoop(
90
+ "default.mcp.loop",
91
+ "default.mcp.tool.invoke",
92
+ "Default MCP Loop",
93
+ "Preview, quote, pay, invoke, and inspect one MCP tool through the built-in first-party path.",
94
+ ["preview", "quote", "pay", "invoke", "inspect"]
95
+ ),
96
+ buildLoop(
97
+ "default.a2c.tooling.loop",
98
+ "default.a2c.tooling.run",
99
+ "Default A2C Tooling Loop",
100
+ "Open a session, preview a pack, invoke a tool, and inspect the resulting linked records.",
101
+ ["preview", "quote", "pay", "session", "invoke", "inspect"]
102
+ ),
103
+ buildLoop(
104
+ "default.identity.anchor.loop",
105
+ "default.identity.anchor.run",
106
+ "Default Identity Anchor Loop",
107
+ "Preview identity attestation, register, link, anchor, and inspect the resulting default transaction records.",
108
+ ["preview", "quote", "pay", "register", "anchor", "inspect"]
109
+ )
110
+ ];
111
+ }
112
+
113
+ function buildTransactionClassPacks() {
114
+ const center = buildDefaultTransactionCenter();
115
+ const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
116
+ ? center.default_settlement.settlement_mode
117
+ : null;
118
+ const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
119
+ ? center.default_payment.protocol
120
+ : null;
121
+ return [
122
+ {
123
+ class_pack_ref: "transaction.trust.receipt",
124
+ title: "Trust Receipt Transaction",
125
+ description: "Verify trust posture and validate the paired receipt as one grouped transaction class.",
126
+ workflow_ref: "trust.flow",
127
+ task_refs: ["trust.verify", "receipt.validate"],
128
+ category: "trust",
129
+ proof_handoff_kind: "receipt_validation",
130
+ default_payment_protocol: defaultPaymentProtocol,
131
+ default_settlement_mode: defaultSettlementMode,
132
+ required_inputs: ["subject_id", "receipt_id"],
133
+ optional_inputs: ["payment_protocol", "settlement_mode"]
134
+ },
135
+ {
136
+ class_pack_ref: "transaction.runtime.consequence",
137
+ title: "Runtime Consequence Transaction",
138
+ description: "Emit a runtime consequence and anchor the resulting commitment as one grouped transaction class.",
139
+ workflow_ref: "runtime.consequence.flow",
140
+ task_refs: ["runtime.emit", "runtime.anchor"],
141
+ category: "runtime",
142
+ proof_handoff_kind: "runtime_anchor",
143
+ default_payment_protocol: defaultPaymentProtocol,
144
+ default_settlement_mode: defaultSettlementMode,
145
+ required_inputs: ["intent_id", "event_type", "event_commitment"],
146
+ optional_inputs: ["payment_protocol", "settlement_mode"]
147
+ },
148
+ {
149
+ class_pack_ref: "transaction.admission.settlement",
150
+ title: "Admission Settlement Transaction",
151
+ description: "Preview admission and submit settlement as one grouped transaction class.",
152
+ workflow_ref: "admission.settlement.flow",
153
+ task_refs: ["admission.preview", "settlement.submit"],
154
+ category: "admission",
155
+ proof_handoff_kind: "admission_settlement",
156
+ default_payment_protocol: defaultPaymentProtocol,
157
+ default_settlement_mode: defaultSettlementMode,
158
+ required_inputs: ["source_zone_id", "target_zone_id", "intent_id"],
159
+ optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
160
+ },
161
+ {
162
+ class_pack_ref: "transaction.registry.anchor",
163
+ title: "Registry Anchor Transaction",
164
+ description: "Register a record and anchor its commitment as one grouped transaction class.",
165
+ workflow_ref: "registry.anchor.flow",
166
+ task_refs: ["registry.register", "anchoring.submit"],
167
+ category: "registry",
168
+ proof_handoff_kind: "registry_anchor",
169
+ default_payment_protocol: defaultPaymentProtocol,
170
+ default_settlement_mode: defaultSettlementMode,
171
+ required_inputs: ["subject_id", "record_type", "commitment_hash"],
172
+ optional_inputs: ["payment_protocol", "settlement_mode"]
173
+ },
174
+ {
175
+ class_pack_ref: "transaction.job.commitment",
176
+ title: "Job Commitment Transaction",
177
+ description: "Quote, reserve, and commit a job as one grouped transaction class.",
178
+ workflow_ref: "job.commitment.flow",
179
+ task_refs: ["jobs.quote", "jobs.reserve", "jobs.commit"],
180
+ category: "jobs",
181
+ proof_handoff_kind: "job_commitment",
182
+ default_payment_protocol: defaultPaymentProtocol,
183
+ default_settlement_mode: defaultSettlementMode,
184
+ required_inputs: ["job_type", "job_id"],
185
+ optional_inputs: ["payment_protocol", "settlement_mode"]
186
+ }
187
+ ];
188
+ }
189
+
190
+ function buildPrecommitInteractionPacks() {
191
+ const center = buildDefaultTransactionCenter();
192
+ const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
193
+ ? center.default_settlement.settlement_mode
194
+ : null;
195
+ const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
196
+ ? center.default_payment.protocol
197
+ : null;
198
+ return [
199
+ {
200
+ precommit_pack_ref: "precommit.a2a.settlement.readiness",
201
+ title: "A2A Settlement Readiness",
202
+ description: "Negotiate, preview admission, and confirm commit posture before a committed settlement-class transaction.",
203
+ category: "a2a",
204
+ protocol: "a2a",
205
+ task_refs: ["a2a.negotiate", "admission.preview", "a2a.commit"],
206
+ default_payment_protocol: defaultPaymentProtocol,
207
+ default_settlement_mode: defaultSettlementMode,
208
+ commitment_signal: "a2a.commit",
209
+ readiness_kind: "settlement_commit_readiness",
210
+ recommended_next_surface: "/v1/transaction-center/transaction-class-packs/run",
211
+ recommended_next_ref: "transaction.admission.settlement",
212
+ required_inputs: ["counterparty_agent_id", "intent_id", "source_zone_id", "target_zone_id"],
213
+ optional_inputs: ["task_pack_ref", "negotiation_mode", "interaction_class", "payment_protocol", "settlement_mode"]
214
+ },
215
+ {
216
+ precommit_pack_ref: "precommit.a2c.tooling.readiness",
217
+ title: "A2C Tooling Readiness",
218
+ description: "Open the session, preview the tooling pack, and confirm admission posture before committed tooling execution.",
219
+ category: "a2c",
220
+ protocol: "a2c",
221
+ task_refs: ["a2c.session.open", "a2c.pack.preview", "admission.preview"],
222
+ default_payment_protocol: defaultPaymentProtocol,
223
+ default_settlement_mode: defaultSettlementMode,
224
+ commitment_signal: "a2c.pack.preview",
225
+ readiness_kind: "tooling_commit_readiness",
226
+ recommended_next_surface: "/v1/transaction-center/task-packs/invoke",
227
+ recommended_next_ref: "default.a2c.tooling.run",
228
+ required_inputs: ["agent_id", "channel_ref", "pack_ref", "source_zone_id", "target_zone_id"],
229
+ optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
230
+ },
231
+ {
232
+ precommit_pack_ref: "precommit.job.commitment.readiness",
233
+ title: "Job Commitment Readiness",
234
+ description: "Quote, preview admission, and reserve the job before committing the full job transaction class.",
235
+ category: "jobs",
236
+ protocol: "job",
237
+ task_refs: ["jobs.quote", "admission.preview", "jobs.reserve"],
238
+ default_payment_protocol: defaultPaymentProtocol,
239
+ default_settlement_mode: defaultSettlementMode,
240
+ commitment_signal: "jobs.reserve",
241
+ readiness_kind: "job_commitment_readiness",
242
+ recommended_next_surface: "/v1/transaction-center/transaction-class-packs/run",
243
+ recommended_next_ref: "transaction.job.commitment",
244
+ required_inputs: ["job_type", "job_id", "source_zone_id", "target_zone_id", "intent_id"],
245
+ optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
246
+ }
247
+ ];
248
+ }
249
+
250
+ function buildInteractionSpinePaths() {
251
+ const center = buildDefaultTransactionCenter();
252
+ const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
253
+ ? center.default_settlement.settlement_mode
254
+ : null;
255
+ const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
256
+ ? center.default_payment.protocol
257
+ : null;
258
+ return [
259
+ {
260
+ spine_path_ref: "spine.a2a.settlement",
261
+ title: "A2A Settlement Spine",
262
+ description: "Compose negotiation, admission, commit, and settlement as one grouped machine-interaction spine path.",
263
+ category: "a2a",
264
+ protocol: "a2a",
265
+ precommit_pack_ref: "precommit.a2a.settlement.readiness",
266
+ committed_ref: "transaction.admission.settlement",
267
+ task_refs: ["a2a.negotiate", "admission.preview", "a2a.commit", "settlement.submit"],
268
+ default_payment_protocol: defaultPaymentProtocol,
269
+ default_settlement_mode: defaultSettlementMode,
270
+ proof_followthrough: "default.proof.bundle.loop",
271
+ required_inputs: ["counterparty_agent_id", "intent_id", "source_zone_id", "target_zone_id"],
272
+ optional_inputs: ["task_pack_ref", "negotiation_mode", "interaction_class", "payment_protocol", "settlement_mode"]
273
+ },
274
+ {
275
+ spine_path_ref: "spine.a2c.tooling",
276
+ title: "A2C Tooling Spine",
277
+ description: "Compose session open, pack preview, admission posture, and committed tooling execution as one grouped path.",
278
+ category: "a2c",
279
+ protocol: "a2c",
280
+ precommit_pack_ref: "precommit.a2c.tooling.readiness",
281
+ committed_ref: "default.a2c.tooling.run",
282
+ task_refs: ["a2c.session.open", "a2c.pack.preview", "admission.preview", "adapter.mcp.invoke"],
283
+ default_payment_protocol: defaultPaymentProtocol,
284
+ default_settlement_mode: defaultSettlementMode,
285
+ proof_followthrough: "default.proof.bundle.loop",
286
+ required_inputs: ["agent_id", "channel_ref", "pack_ref", "tool_name", "source_zone_id", "target_zone_id"],
287
+ optional_inputs: ["arguments", "interaction_class", "payment_protocol", "settlement_mode"]
288
+ },
289
+ {
290
+ spine_path_ref: "spine.job.commitment",
291
+ title: "Job Commitment Spine",
292
+ description: "Compose quote, admission, reserve, and commit as one grouped job interaction spine path.",
293
+ category: "jobs",
294
+ protocol: "job",
295
+ precommit_pack_ref: "precommit.job.commitment.readiness",
296
+ committed_ref: "transaction.job.commitment",
297
+ task_refs: ["jobs.quote", "admission.preview", "jobs.reserve", "jobs.commit"],
298
+ default_payment_protocol: defaultPaymentProtocol,
299
+ default_settlement_mode: defaultSettlementMode,
300
+ proof_followthrough: "default.proof.bundle.loop",
301
+ required_inputs: ["job_type", "job_id", "source_zone_id", "target_zone_id"],
302
+ optional_inputs: ["intent_id", "interaction_class", "payment_protocol", "settlement_mode"]
303
+ }
304
+ ];
305
+ }
306
+
307
+ function buildInteractionResultPackages() {
308
+ return buildInteractionSpinePaths().map((path) => ({
309
+ result_package_ref: path && path.spine_path_ref ? `result.${path.spine_path_ref}` : null,
310
+ source_kind: "interaction_spine_path",
311
+ source_ref: path && path.spine_path_ref ? path.spine_path_ref : null,
312
+ title: path && path.title ? `${path.title} Result Package` : "Interaction Result Package",
313
+ description: path && path.description
314
+ ? `${path.description} Preserve the composed output as a stable result-side package and proof-handoff seam.`
315
+ : "Preserve the composed output as a stable result-side package and proof-handoff seam.",
316
+ category: path && path.category ? path.category : null,
317
+ protocol: path && path.protocol ? path.protocol : null,
318
+ precommit_pack_ref: path && path.precommit_pack_ref ? path.precommit_pack_ref : null,
319
+ committed_ref: path && path.committed_ref ? path.committed_ref : null,
320
+ proof_followthrough: path && path.proof_followthrough ? path.proof_followthrough : null,
321
+ portable_handoff_surface: "/v1/transaction-center/result-packages/export",
322
+ portable_proof_surface: "/v1/proof-center/result-package-handoff/run",
323
+ default_payment_protocol: path && path.default_payment_protocol ? path.default_payment_protocol : null,
324
+ default_settlement_mode: path && path.default_settlement_mode ? path.default_settlement_mode : null,
325
+ seam_layers: [
326
+ "execution_consequence",
327
+ "payment_settlement_treasury",
328
+ "proof_handoff"
329
+ ],
330
+ required_inputs: Array.isArray(path && path.required_inputs) ? path.required_inputs : [],
331
+ optional_inputs: Array.isArray(path && path.optional_inputs) ? path.optional_inputs : []
332
+ }));
333
+ }
334
+
335
+ function buildInteractionResultPackageContinuationTemplates() {
336
+ return buildInteractionResultPackages().map((resultPackage) => ({
337
+ continuation_ref: resultPackage && resultPackage.result_package_ref
338
+ ? `continue.${resultPackage.result_package_ref}`
339
+ : null,
340
+ result_package_ref: resultPackage && resultPackage.result_package_ref ? resultPackage.result_package_ref : null,
341
+ source_ref: resultPackage && resultPackage.source_ref ? resultPackage.source_ref : null,
342
+ title: resultPackage && resultPackage.title
343
+ ? `${resultPackage.title} Continuation`
344
+ : "Interaction Result Package Continuation",
345
+ description: resultPackage && resultPackage.description
346
+ ? `${resultPackage.description} Continue through the reusable default path into proof-native follow-through.`
347
+ : "Continue through the reusable default path into proof-native follow-through.",
348
+ continuation_kind: "proof_native_default",
349
+ default_next_surface: "/v1/transaction-center/result-package-continuations/run",
350
+ default_export_surface: "/v1/transaction-center/result-packages/export",
351
+ default_proof_surface: "/v1/proof-center/result-package-handoff/run",
352
+ committed_ref: resultPackage && resultPackage.committed_ref ? resultPackage.committed_ref : null,
353
+ precommit_pack_ref: resultPackage && resultPackage.precommit_pack_ref ? resultPackage.precommit_pack_ref : null,
354
+ seam_layers: Array.isArray(resultPackage && resultPackage.seam_layers) ? resultPackage.seam_layers : [],
355
+ required_inputs: Array.isArray(resultPackage && resultPackage.required_inputs) ? resultPackage.required_inputs : [],
356
+ optional_inputs: Array.isArray(resultPackage && resultPackage.optional_inputs) ? resultPackage.optional_inputs : []
357
+ }));
358
+ }
359
+
360
+ function buildDefaultTransactionCenter() {
361
+ const settlementProfiles = Array.isArray(catalog.settlement_profiles) ? catalog.settlement_profiles : [];
362
+ const defaultSettlementProfile = settlementProfiles[0] || null;
363
+ const settlementModes = settlementProfiles
364
+ .map((profile) => profile && profile.mode)
365
+ .filter(Boolean);
366
+ return {
367
+ ok: true,
368
+ brand: "xytara",
369
+ product: "default transaction center",
370
+ payment_scheme: catalog.payment_scheme,
371
+ default_protocol: {
372
+ protocol: "mcp",
373
+ integration_id: "builtin.protocol.mcp",
374
+ task_ref: "adapter.mcp.invoke",
375
+ workflow_refs: ["a2c.tooling.flow"],
376
+ selection_reason: "production_default_protocol_lane"
377
+ },
378
+ default_payment: {
379
+ protocol: "x402",
380
+ integration_id: "builtin.payment.x402",
381
+ payment_scheme: catalog.payment_scheme,
382
+ supported_settlement_modes: settlementModes,
383
+ selection_reason: "production_default_payment_lane"
384
+ },
385
+ default_settlement: {
386
+ integration_id: "builtin.settlement.chain",
387
+ settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
388
+ adapter: defaultSettlementProfile && defaultSettlementProfile.adapter ? defaultSettlementProfile.adapter : null,
389
+ asset: defaultSettlementProfile && defaultSettlementProfile.asset ? defaultSettlementProfile.asset : null,
390
+ payee_agent_id: defaultSettlementProfile && defaultSettlementProfile.payee_agent_id ? defaultSettlementProfile.payee_agent_id : null,
391
+ payee_label: defaultSettlementProfile && defaultSettlementProfile.payee_label ? defaultSettlementProfile.payee_label : null,
392
+ supported_modes: settlementModes,
393
+ profile_count: settlementProfiles.length
394
+ },
395
+ default_treasury: {
396
+ destination_kind: "account_treasury",
397
+ destination_template: "treasury_{account_id}",
398
+ settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
399
+ payee_agent_id: defaultSettlementProfile && defaultSettlementProfile.payee_agent_id ? defaultSettlementProfile.payee_agent_id : null,
400
+ payee_label: defaultSettlementProfile && defaultSettlementProfile.payee_label ? defaultSettlementProfile.payee_label : null
401
+ },
402
+ suggested_paths: [
403
+ {
404
+ path_id: "default_mcp_x402_path",
405
+ path_kind: "first_party_default",
406
+ protocol: "mcp",
407
+ payment_protocol: "x402",
408
+ settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
409
+ task_ref: "adapter.mcp.invoke",
410
+ integration_ids: ["builtin.protocol.mcp", "builtin.payment.x402", "builtin.settlement.chain"]
411
+ },
412
+ {
413
+ path_id: "default_a2c_tooling_flow",
414
+ path_kind: "first_party_default",
415
+ protocol: "mcp",
416
+ payment_protocol: "x402",
417
+ settlement_mode: defaultSettlementProfile && defaultSettlementProfile.mode ? defaultSettlementProfile.mode : null,
418
+ workflow_ref: "a2c.tooling.flow",
419
+ integration_ids: ["builtin.protocol.mcp", "builtin.payment.x402", "builtin.settlement.chain"]
420
+ }
421
+ ]
422
+ };
423
+ }
424
+
425
+ function summarizeDefaultTransactionCenter() {
426
+ const center = buildDefaultTransactionCenter();
427
+ return {
428
+ ok: true,
429
+ brand: center.brand,
430
+ product: center.product,
431
+ payment_scheme: center.payment_scheme,
432
+ default_protocol: center.default_protocol.protocol,
433
+ default_payment_protocol: center.default_payment.protocol,
434
+ default_settlement_mode: center.default_settlement.settlement_mode,
435
+ default_treasury_kind: center.default_treasury.destination_kind,
436
+ settlement_mode_count: Array.isArray(center.default_settlement.supported_modes) ? center.default_settlement.supported_modes.length : 0,
437
+ settlement_modes: center.default_settlement.supported_modes,
438
+ suggested_path_count: Array.isArray(center.suggested_paths) ? center.suggested_paths.length : 0,
439
+ suggested_paths: center.suggested_paths
440
+ };
441
+ }
442
+
443
+ function buildDefaultTransactionEconomics() {
444
+ const center = buildDefaultTransactionCenter();
445
+ const settlement = center.default_settlement || {};
446
+ const payment = center.default_payment || {};
447
+ const treasury = center.default_treasury || {};
448
+ return {
449
+ ok: true,
450
+ brand: center.brand,
451
+ product: "default transaction economics",
452
+ payment_protocol: payment.protocol || null,
453
+ payment_scheme: payment.payment_scheme || center.payment_scheme || null,
454
+ default_settlement_mode: settlement.settlement_mode || null,
455
+ supported_settlement_modes: Array.isArray(settlement.supported_modes) ? settlement.supported_modes : [],
456
+ settlement_adapter: settlement.adapter || null,
457
+ settlement_asset: settlement.asset || null,
458
+ payee_agent_id: settlement.payee_agent_id || null,
459
+ payee_label: settlement.payee_label || null,
460
+ treasury_destination_kind: treasury.destination_kind || null,
461
+ treasury_destination_template: treasury.destination_template || null,
462
+ suggested_path_ids: Array.isArray(center.suggested_paths)
463
+ ? center.suggested_paths.map((entry) => entry && entry.path_id).filter(Boolean)
464
+ : []
465
+ };
466
+ }
467
+
468
+ function summarizeDefaultTransactionEconomics() {
469
+ const economics = buildDefaultTransactionEconomics();
470
+ return {
471
+ ok: true,
472
+ brand: economics.brand,
473
+ product: economics.product,
474
+ payment_protocol: economics.payment_protocol,
475
+ payment_scheme: economics.payment_scheme,
476
+ default_settlement_mode: economics.default_settlement_mode,
477
+ settlement_mode_count: economics.supported_settlement_modes.length,
478
+ supported_settlement_modes: economics.supported_settlement_modes,
479
+ treasury_destination_kind: economics.treasury_destination_kind,
480
+ payee_agent_id: economics.payee_agent_id,
481
+ suggested_path_count: economics.suggested_path_ids.length,
482
+ suggested_path_ids: economics.suggested_path_ids
483
+ };
484
+ }
485
+
486
+ function buildDefaultTransactionTaskPackCatalog() {
487
+ const center = buildDefaultTransactionCenter();
488
+ const packs = buildDefaultTransactionTaskPacks();
489
+ return {
490
+ ok: true,
491
+ brand: center.brand,
492
+ product: "default transaction task packs",
493
+ default_protocol: center.default_protocol && center.default_protocol.protocol ? center.default_protocol.protocol : null,
494
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
495
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
496
+ pack_count: packs.length,
497
+ packs
498
+ };
499
+ }
500
+
501
+ function summarizeDefaultTransactionTaskPacks() {
502
+ const catalogResponse = buildDefaultTransactionTaskPackCatalog();
503
+ const packs = Array.isArray(catalogResponse.packs) ? catalogResponse.packs : [];
504
+ return {
505
+ ok: true,
506
+ brand: catalogResponse.brand,
507
+ product: catalogResponse.product,
508
+ default_protocol: catalogResponse.default_protocol,
509
+ default_payment_protocol: catalogResponse.default_payment_protocol,
510
+ default_settlement_mode: catalogResponse.default_settlement_mode,
511
+ pack_count: packs.length,
512
+ pack_refs: packs.map((entry) => entry && entry.pack_ref).filter(Boolean),
513
+ direct_pack_count: packs.filter((entry) => entry && entry.pack_kind === "task_set").length,
514
+ workflow_pack_count: packs.filter((entry) => entry && entry.pack_kind === "workflow_pack").length,
515
+ packs
516
+ };
517
+ }
518
+
519
+ function getDefaultTransactionTaskPack(ref) {
520
+ const normalized = String(ref || "").trim();
521
+ if (!normalized) return null;
522
+ return buildDefaultTransactionTaskPacks().find((entry) => entry && entry.pack_ref === normalized) || null;
523
+ }
524
+
525
+ function buildDefaultTransactionGuidedLoopCatalog() {
526
+ const center = buildDefaultTransactionCenter();
527
+ const loops = buildDefaultTransactionGuidedLoops();
528
+ return {
529
+ ok: true,
530
+ brand: center.brand,
531
+ product: "default transaction guided loops",
532
+ default_protocol: center.default_protocol && center.default_protocol.protocol ? center.default_protocol.protocol : null,
533
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
534
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
535
+ loop_count: loops.length,
536
+ loops
537
+ };
538
+ }
539
+
540
+ function summarizeDefaultTransactionGuidedLoops() {
541
+ const catalogResponse = buildDefaultTransactionGuidedLoopCatalog();
542
+ const loops = Array.isArray(catalogResponse.loops) ? catalogResponse.loops : [];
543
+ return {
544
+ ok: true,
545
+ brand: catalogResponse.brand,
546
+ product: catalogResponse.product,
547
+ default_protocol: catalogResponse.default_protocol,
548
+ default_payment_protocol: catalogResponse.default_payment_protocol,
549
+ default_settlement_mode: catalogResponse.default_settlement_mode,
550
+ loop_count: loops.length,
551
+ loop_refs: loops.map((entry) => entry && entry.loop_ref).filter(Boolean),
552
+ loops
553
+ };
554
+ }
555
+
556
+ function getDefaultTransactionGuidedLoop(ref) {
557
+ const normalized = String(ref || "").trim();
558
+ if (!normalized) return null;
559
+ return buildDefaultTransactionGuidedLoops().find((entry) => entry && entry.loop_ref === normalized) || null;
560
+ }
561
+
562
+ function buildTransactionClassPackCatalog() {
563
+ const center = buildDefaultTransactionCenter();
564
+ const packs = buildTransactionClassPacks();
565
+ return {
566
+ ok: true,
567
+ brand: center.brand,
568
+ product: "transaction class packs",
569
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
570
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
571
+ class_pack_count: packs.length,
572
+ class_packs: packs
573
+ };
574
+ }
575
+
576
+ function buildPrecommitInteractionPackCatalog() {
577
+ const center = buildDefaultTransactionCenter();
578
+ const packs = buildPrecommitInteractionPacks();
579
+ return {
580
+ ok: true,
581
+ brand: center.brand,
582
+ product: "precommit interaction packs",
583
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
584
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
585
+ precommit_pack_count: packs.length,
586
+ precommit_packs: packs
587
+ };
588
+ }
589
+
590
+ function buildInteractionSpinePathCatalog() {
591
+ const center = buildDefaultTransactionCenter();
592
+ const paths = buildInteractionSpinePaths();
593
+ return {
594
+ ok: true,
595
+ brand: center.brand,
596
+ product: "interaction spine paths",
597
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
598
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
599
+ spine_path_count: paths.length,
600
+ spine_paths: paths
601
+ };
602
+ }
603
+
604
+ function buildInteractionResultPackageCatalog() {
605
+ const center = buildDefaultTransactionCenter();
606
+ const packages = buildInteractionResultPackages();
607
+ return {
608
+ ok: true,
609
+ brand: center.brand,
610
+ product: "interaction result packages",
611
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
612
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
613
+ result_package_count: packages.length,
614
+ result_packages: packages
615
+ };
616
+ }
617
+
618
+ function buildInteractionResultPackageContinuationCatalog() {
619
+ const center = buildDefaultTransactionCenter();
620
+ const templates = buildInteractionResultPackageContinuationTemplates();
621
+ return {
622
+ ok: true,
623
+ brand: center.brand,
624
+ product: "interaction result package continuations",
625
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
626
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
627
+ continuation_count: templates.length,
628
+ continuations: templates
629
+ };
630
+ }
631
+
632
+ function summarizeTransactionClassPacks() {
633
+ const catalogResponse = buildTransactionClassPackCatalog();
634
+ const packs = Array.isArray(catalogResponse.class_packs) ? catalogResponse.class_packs : [];
635
+ return {
636
+ ok: true,
637
+ brand: catalogResponse.brand,
638
+ product: catalogResponse.product,
639
+ default_payment_protocol: catalogResponse.default_payment_protocol,
640
+ default_settlement_mode: catalogResponse.default_settlement_mode,
641
+ class_pack_count: packs.length,
642
+ class_pack_refs: packs.map((entry) => entry && entry.class_pack_ref).filter(Boolean),
643
+ categories: Array.from(new Set(packs.map((entry) => entry && entry.category).filter(Boolean))),
644
+ class_packs: packs
645
+ };
646
+ }
647
+
648
+ function summarizePrecommitInteractionPacks() {
649
+ const catalogResponse = buildPrecommitInteractionPackCatalog();
650
+ const packs = Array.isArray(catalogResponse.precommit_packs) ? catalogResponse.precommit_packs : [];
651
+ return {
652
+ ok: true,
653
+ brand: catalogResponse.brand,
654
+ product: catalogResponse.product,
655
+ default_payment_protocol: catalogResponse.default_payment_protocol,
656
+ default_settlement_mode: catalogResponse.default_settlement_mode,
657
+ precommit_pack_count: packs.length,
658
+ precommit_pack_refs: packs.map((entry) => entry && entry.precommit_pack_ref).filter(Boolean),
659
+ categories: Array.from(new Set(packs.map((entry) => entry && entry.category).filter(Boolean))),
660
+ precommit_packs: packs
661
+ };
662
+ }
663
+
664
+ function summarizeInteractionSpinePaths() {
665
+ const catalogResponse = buildInteractionSpinePathCatalog();
666
+ const paths = Array.isArray(catalogResponse.spine_paths) ? catalogResponse.spine_paths : [];
667
+ return {
668
+ ok: true,
669
+ brand: catalogResponse.brand,
670
+ product: catalogResponse.product,
671
+ default_payment_protocol: catalogResponse.default_payment_protocol,
672
+ default_settlement_mode: catalogResponse.default_settlement_mode,
673
+ spine_path_count: paths.length,
674
+ spine_path_refs: paths.map((entry) => entry && entry.spine_path_ref).filter(Boolean),
675
+ categories: Array.from(new Set(paths.map((entry) => entry && entry.category).filter(Boolean))),
676
+ spine_paths: paths
677
+ };
678
+ }
679
+
680
+ function summarizeInteractionResultPackages() {
681
+ const catalogResponse = buildInteractionResultPackageCatalog();
682
+ const packages = Array.isArray(catalogResponse.result_packages) ? catalogResponse.result_packages : [];
683
+ return {
684
+ ok: true,
685
+ brand: catalogResponse.brand,
686
+ product: catalogResponse.product,
687
+ default_payment_protocol: catalogResponse.default_payment_protocol,
688
+ default_settlement_mode: catalogResponse.default_settlement_mode,
689
+ result_package_count: packages.length,
690
+ result_package_refs: packages.map((entry) => entry && entry.result_package_ref).filter(Boolean),
691
+ source_refs: packages.map((entry) => entry && entry.source_ref).filter(Boolean),
692
+ seam_layers: Array.from(new Set(packages.flatMap((entry) => Array.isArray(entry && entry.seam_layers) ? entry.seam_layers : []))),
693
+ result_packages: packages
694
+ };
695
+ }
696
+
697
+ function summarizeInteractionResultPackageContinuations() {
698
+ const catalogResponse = buildInteractionResultPackageContinuationCatalog();
699
+ const templates = Array.isArray(catalogResponse.continuations) ? catalogResponse.continuations : [];
700
+ return {
701
+ ok: true,
702
+ brand: catalogResponse.brand,
703
+ product: catalogResponse.product,
704
+ default_payment_protocol: catalogResponse.default_payment_protocol,
705
+ default_settlement_mode: catalogResponse.default_settlement_mode,
706
+ continuation_count: templates.length,
707
+ continuation_refs: templates.map((entry) => entry && entry.continuation_ref).filter(Boolean),
708
+ result_package_refs: templates.map((entry) => entry && entry.result_package_ref).filter(Boolean),
709
+ continuations: templates
710
+ };
711
+ }
712
+
713
+ function getTransactionClassPack(ref) {
714
+ const normalized = String(ref || "").trim();
715
+ if (!normalized) return null;
716
+ return buildTransactionClassPacks().find((entry) => entry && entry.class_pack_ref === normalized) || null;
717
+ }
718
+
719
+ function getPrecommitInteractionPack(ref) {
720
+ const normalized = String(ref || "").trim();
721
+ if (!normalized) return null;
722
+ return buildPrecommitInteractionPacks().find((entry) => entry && entry.precommit_pack_ref === normalized) || null;
723
+ }
724
+
725
+ function getInteractionSpinePath(ref) {
726
+ const normalized = String(ref || "").trim();
727
+ if (!normalized) return null;
728
+ return buildInteractionSpinePaths().find((entry) => entry && entry.spine_path_ref === normalized) || null;
729
+ }
730
+
731
+ function getInteractionResultPackage(ref) {
732
+ const normalized = String(ref || "").trim();
733
+ if (!normalized) return null;
734
+ return buildInteractionResultPackages().find((entry) => entry && entry.result_package_ref === normalized) || null;
735
+ }
736
+
737
+ function getInteractionResultPackageContinuation(ref) {
738
+ const normalized = String(ref || "").trim();
739
+ if (!normalized) return null;
740
+ return buildInteractionResultPackageContinuationTemplates().find((entry) => entry && entry.continuation_ref === normalized) || null;
741
+ }
742
+
743
+ function buildCatalogResponse() {
744
+ return {
745
+ ok: true,
746
+ brand: "xytara",
747
+ product: "governed transaction rail",
748
+ version: catalog.version,
749
+ catalog_version: catalog.version,
750
+ currency: catalog.currency,
751
+ payment_scheme: catalog.payment_scheme,
752
+ plans: catalog.plans,
753
+ capabilities: catalog.capabilities,
754
+ adapters: catalog.adapters,
755
+ settlement_profiles: catalog.settlement_profiles,
756
+ task_categories: catalog.task_categories,
757
+ workflows: catalog.workflows,
758
+ surfaces: catalog.surfaces,
759
+ tasks: catalog.tasks
760
+ };
761
+ }
762
+
763
+ function summarizeCatalog() {
764
+ const fullCatalog = buildCatalogResponse();
765
+ return {
766
+ ok: true,
767
+ brand: fullCatalog.brand,
768
+ product: fullCatalog.product,
769
+ version: fullCatalog.catalog_version,
770
+ currency: fullCatalog.currency,
771
+ payment_scheme: fullCatalog.payment_scheme,
772
+ capabilities: fullCatalog.capabilities,
773
+ adapters: fullCatalog.adapters,
774
+ task_count: fullCatalog.tasks.length,
775
+ workflow_count: fullCatalog.workflows.length,
776
+ category_count: fullCatalog.task_categories.length,
777
+ task_categories: fullCatalog.task_categories,
778
+ settlement_profile_count: fullCatalog.settlement_profiles.length,
779
+ settlement_profiles: fullCatalog.settlement_profiles,
780
+ workflows: fullCatalog.workflows,
781
+ tasks: fullCatalog.tasks.map((task) => ({
782
+ task_ref: task.public_task_ref,
783
+ internal_task_ref: task.task_ref,
784
+ public_task_ref: task.public_task_ref,
785
+ aliases: task.public_aliases,
786
+ category: task.public_category,
787
+ title: task.public_title,
788
+ execution_mode: task.execution_mode,
789
+ pricing_band: task.pricing_band,
790
+ public_launch_price: task.public_launch_price,
791
+ pricing_note: task.pricing_note,
792
+ latency_class: task.latency_class,
793
+ failure_posture: task.failure_posture,
794
+ task_family: task.task_family,
795
+ lifecycle_stage: task.lifecycle_stage,
796
+ market_class: task.market_class,
797
+ claim_status: task.claim_status,
798
+ evidence_status: task.evidence_status,
799
+ capabilities: task.capabilities,
800
+ adapters: task.adapters
801
+ })),
802
+ workflow_summaries: fullCatalog.workflows.map((workflow) => ({
803
+ workflow_ref: workflow.workflow_ref,
804
+ aliases: workflow.aliases,
805
+ category: workflow.category,
806
+ title: workflow.title,
807
+ task_count: workflow.task_count,
808
+ latency_class: workflow.latency_class,
809
+ failure_posture: workflow.failure_posture,
810
+ pricing_basis: workflow.pricing_basis
811
+ }))
812
+ };
813
+ }
814
+
815
+ function getCatalog() {
816
+ return buildCatalogResponse();
817
+ }
818
+
819
+ function getTaskDetail(ref) {
820
+ const task = findTask(ref);
821
+ if (!task) {
822
+ return null;
823
+ }
824
+ return {
825
+ task_ref: task.task_ref,
826
+ public_task_ref: task.public_task_ref,
827
+ aliases: task.public_aliases,
828
+ category: task.public_category,
829
+ title: task.public_title,
830
+ execution_mode: task.execution_mode,
831
+ pricing_band: task.pricing_band,
832
+ public_launch_price: task.public_launch_price,
833
+ pricing_note: task.pricing_note,
834
+ latency_class: task.latency_class,
835
+ failure_posture: task.failure_posture,
836
+ task_family: task.task_family,
837
+ lifecycle_stage: task.lifecycle_stage,
838
+ market_class: task.market_class,
839
+ claim_status: task.claim_status,
840
+ evidence_status: task.evidence_status,
841
+ input_schema: task.input_schema,
842
+ capabilities: task.capabilities,
843
+ adapters: task.adapters
844
+ };
845
+ }
846
+
847
+ function buildWorkflowShape(workflow) {
848
+ const workflowTasks = (Array.isArray(workflow.task_refs) ? workflow.task_refs : [])
849
+ .map((taskRef) => findTask(taskRef))
850
+ .filter(Boolean)
851
+ .map((task) => ({
852
+ public_task_ref: task.public_task_ref,
853
+ task_ref: task.task_ref,
854
+ title: task.public_title,
855
+ category: task.public_category,
856
+ latency_class: task.latency_class,
857
+ failure_posture: task.failure_posture,
858
+ task_family: task.task_family,
859
+ lifecycle_stage: task.lifecycle_stage,
860
+ market_class: task.market_class,
861
+ claim_status: task.claim_status,
862
+ evidence_status: task.evidence_status,
863
+ pricing_band: task.pricing_band,
864
+ public_launch_price: task.public_launch_price
865
+ }));
866
+ return {
867
+ ...workflow,
868
+ pricing_note: "Workflow pricing is determined by the quoted task set, not a fixed bundle price.",
869
+ task_refs: workflowTasks.map((task) => task.public_task_ref || task.task_ref),
870
+ task_count: workflowTasks.length,
871
+ tasks: workflowTasks
872
+ };
873
+ }
874
+
875
+ function getWorkflowList() {
876
+ return catalog.workflows.map(buildWorkflowShape);
877
+ }
878
+
879
+ function getWorkflowDetail(ref) {
880
+ const workflow = findWorkflow(ref);
881
+ if (!workflow) {
882
+ return null;
883
+ }
884
+ return buildWorkflowShape(workflow);
885
+ }
886
+
887
+ function getCreditPackList() {
888
+ return (Array.isArray(catalog.credit_packs) ? catalog.credit_packs : []).map((pack) => ({
889
+ ...pack
890
+ }));
891
+ }
892
+
893
+ function getCreditPackDetail(ref) {
894
+ const pack = findCreditPack(ref);
895
+ if (!pack) {
896
+ return null;
897
+ }
898
+ return {
899
+ ...pack
900
+ };
901
+ }
902
+
903
+ function summarizeCreditPacks() {
904
+ const packs = getCreditPackList();
905
+ const categoryCounts = packs.reduce((acc, pack) => {
906
+ const key = pack && pack.category ? pack.category : "unknown";
907
+ acc[key] = (acc[key] || 0) + 1;
908
+ return acc;
909
+ }, {});
910
+ const pricingBandCoverage = Array.from(new Set(
911
+ packs.flatMap((pack) => Array.isArray(pack && pack.task_band_targets) ? pack.task_band_targets : []).filter(Boolean)
912
+ )).sort((left, right) => String(left).localeCompare(String(right)));
913
+ return {
914
+ ok: true,
915
+ credit_pack_count: packs.length,
916
+ categories: Object.entries(categoryCounts)
917
+ .map(([category, pack_count]) => ({ category, pack_count }))
918
+ .sort((left, right) => String(left.category).localeCompare(String(right.category))),
919
+ pricing_band_coverage_count: pricingBandCoverage.length,
920
+ pricing_band_coverage: pricingBandCoverage,
921
+ credit_packs: packs.map((pack) => ({
922
+ pack_id: pack.pack_id,
923
+ title: pack.title,
924
+ category: pack.category,
925
+ issued_units: pack.issued_units,
926
+ intended_usage_posture: pack.intended_usage_posture
927
+ }))
928
+ };
929
+ }
930
+
931
+ module.exports = {
932
+ buildCatalogResponse,
933
+ buildDefaultTransactionEconomics,
934
+ buildDefaultTransactionCenter,
935
+ buildDefaultTransactionGuidedLoopCatalog,
936
+ buildInteractionResultPackageCatalog,
937
+ buildInteractionResultPackageContinuationCatalog,
938
+ buildInteractionSpinePathCatalog,
939
+ buildPrecommitInteractionPackCatalog,
940
+ buildDefaultTransactionTaskPackCatalog,
941
+ buildTransactionClassPackCatalog,
942
+ getCreditPackDetail,
943
+ getCreditPackList,
944
+ getCatalog,
945
+ getDefaultTransactionGuidedLoop,
946
+ getDefaultTransactionTaskPack,
947
+ getInteractionResultPackage,
948
+ getInteractionResultPackageContinuation,
949
+ getInteractionSpinePath,
950
+ getPrecommitInteractionPack,
951
+ getTransactionClassPack,
952
+ getTaskDetail,
953
+ getWorkflowDetail,
954
+ getWorkflowList,
955
+ summarizeCatalog,
956
+ summarizeDefaultTransactionCenter,
957
+ summarizeDefaultTransactionEconomics,
958
+ summarizeDefaultTransactionGuidedLoops,
959
+ summarizeDefaultTransactionTaskPacks,
960
+ summarizeCreditPacks,
961
+ summarizeInteractionResultPackageContinuations,
962
+ summarizeInteractionResultPackages,
963
+ summarizeInteractionSpinePaths,
964
+ summarizePrecommitInteractionPacks,
965
+ summarizeTransactionClassPacks
966
+ };