xytara 3.1.16 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -92
- package/RELEASE_NOTES.md +7 -3
- package/START_HERE.md +56 -224
- package/bin/xytara.js +21 -8
- package/client.js +79 -1
- package/lib/{delivery_receipt.js → delivery_receipt_verify.js} +14 -100
- package/package.json +25 -35
- package/scripts/verify_client.js +418 -0
- package/scripts/verify_release_candidate.js +146 -45
- package/.env.example +0 -173
- package/ADAPTER_START_HERE.md +0 -56
- package/BSV_TERANODE_PLATFORM_DISCONTINUITY_RUNBOOK.md +0 -126
- package/CARRIED_HANDOFF_DEMO.md +0 -60
- package/EXAMPLE_PATHS.md +0 -53
- package/FINAL_CONTRACT.md +0 -498
- package/PARTNER_READY_PATH.md +0 -71
- package/PUBLIC_DEMO_SCRIPT.md +0 -78
- package/REAL_PAYMENT_SETUP.md +0 -320
- package/SERVICE_CONTRACT.md +0 -419
- package/SUPABASE_RUNTIME_STATE_SETUP.md +0 -61
- package/TERMINOLOGY.md +0 -50
- package/WHY_XYTARA_XOONYA.md +0 -63
- package/XT1_EXECUTION_TRUTH_STANDARD.md +0 -78
- package/XYTARA_ADAPTER_PROTOCOL_TRUTH_MODEL.md +0 -75
- package/XYTARA_AUTONOMOUS_ENTRY_MODEL.md +0 -124
- package/XYTARA_DEFAULT_PATH_MODEL.md +0 -84
- package/XYTARA_EXECUTION_TRUTH_MODEL.md +0 -171
- package/XYTARA_PAYMENT_RAIL_TRUTH_MODEL.md +0 -68
- package/adapters/AUTHORING_GUIDE.md +0 -244
- package/adapters/ONBOARDING_POSTURE.md +0 -61
- package/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md +0 -84
- package/adapters/adapter-manifest.schema.json +0 -283
- package/adapters/examples/example-execution-adapter.js +0 -61
- package/adapters/examples/example-execution-adapter.manifest.json +0 -81
- package/adapters/examples/example-settlement-adapter.js +0 -55
- package/adapters/examples/example-settlement-adapter.manifest.json +0 -78
- package/adapters/examples/example-third-party-acp-registration.submission-bundle.json +0 -124
- package/adapters/examples/example-third-party-erc8004-registration.submission-bundle.json +0 -121
- package/adapters/examples/example-third-party-identity-registration.certification-pack.json +0 -22
- package/adapters/examples/example-third-party-identity-registration.record.json +0 -26
- package/adapters/examples/example-third-party-identity-registration.submission-bundle.json +0 -126
- package/adapters/examples/example-third-party-langchain-registration.submission-bundle.json +0 -124
- package/adapters/examples/example-third-party-mpp-registration.submission-bundle.json +0 -120
- package/adapters/examples/example-third-party-registration.certification-pack.json +0 -22
- package/adapters/examples/example-third-party-registration.record.json +0 -28
- package/adapters/examples/example-third-party-registration.submission-bundle.json +0 -126
- package/adapters/examples/example-third-party-settlement-registration.certification-pack.json +0 -22
- package/adapters/examples/example-third-party-settlement-registration.record.json +0 -26
- package/adapters/examples/example-third-party-settlement-registration.submission-bundle.json +0 -127
- package/adapters/examples/langchain-reference-execution-adapter.js +0 -81
- package/adapters/examples/langchain-reference-execution-adapter.manifest.json +0 -79
- package/adapters/examples/langgraph-reference-execution-adapter.js +0 -81
- package/adapters/examples/langgraph-reference-execution-adapter.manifest.json +0 -79
- package/adapters/examples/minimal-third-party-execution-adapter.js +0 -61
- package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +0 -79
- package/adapters/examples/minimal-third-party-execution-registration.record.json +0 -26
- package/adapters/examples/minimal-third-party-execution.certification-pack.json +0 -22
- package/adapters/examples/minimal-third-party-execution.submission-bundle.json +0 -126
- package/adapters/integration-certification-pack.schema.json +0 -82
- package/adapters/integration-registration-record.schema.json +0 -114
- package/adapters/integration-submission-bundle-set.schema.json +0 -39
- package/adapters/integration-submission-bundle.schema.json +0 -34
- package/adapters/interfaces.js +0 -56
- package/bin/xytara-release.js +0 -1429
- package/examples/_demo_env.js +0 -40
- package/examples/adapter_review_walkthrough.js +0 -54
- package/examples/export_carried_handoff.js +0 -81
- package/examples/funded_runtime_walkthrough.js +0 -71
- package/examples/partner_launch_walkthrough.js +0 -44
- package/examples/quickstart.js +0 -3256
- package/fixtures/catalog.js +0 -1156
- package/index.js +0 -395
- package/integrations/dispatch.js +0 -276
- package/integrations/registry-snapshot.schema.json +0 -36
- package/integrations/registry.js +0 -2261
- package/integrations/views.js +0 -28
- package/lib/a2a_lane_contract.js +0 -104
- package/lib/a2a_rpc.js +0 -287
- package/lib/a2c_lane_contract.js +0 -111
- package/lib/account_auth.js +0 -585
- package/lib/acp_lane_contract.js +0 -54
- package/lib/activity_audit_contract.js +0 -322
- package/lib/adapter_certification_contract.js +0 -130
- package/lib/adapter_depth_contract.js +0 -218
- package/lib/adapter_pack.js +0 -118
- package/lib/adapter_partner_pack.js +0 -89
- package/lib/adapter_promotion_pack.js +0 -89
- package/lib/adapter_protocol_truth_contract.js +0 -229
- package/lib/agent_identity.js +0 -162
- package/lib/announcement_pack.js +0 -61
- package/lib/artifact_distribution_lane_contract.js +0 -54
- package/lib/asyncapi_contract.js +0 -150
- package/lib/auth_interop_contract.js +0 -80
- package/lib/authority_binding_lifecycle_contract.js +0 -182
- package/lib/autonomous_entry_contract.js +0 -409
- package/lib/bolt_adapter.js +0 -187
- package/lib/bolt_lane_contract.js +0 -55
- package/lib/bolt_payment_front.js +0 -224
- package/lib/business_cockpit.js +0 -378
- package/lib/buyer_event_log.js +0 -230
- package/lib/buyer_safety_policy.js +0 -132
- package/lib/capability_execution_truth.js +0 -276
- package/lib/capability_registry.js +0 -633
- package/lib/catalog_contract.js +0 -966
- package/lib/catalog_family_model.js +0 -193
- package/lib/catalog_views.js +0 -55
- package/lib/cdp_jwt.js +0 -57
- package/lib/checkout_event_security.js +0 -142
- package/lib/checkout_processor_adapter.js +0 -217
- package/lib/cloudevents_contract.js +0 -80
- package/lib/command_flow.js +0 -911
- package/lib/commerce_artifacts.js +0 -591
- package/lib/commerce_authority.js +0 -449
- package/lib/commerce_bridge.js +0 -274
- package/lib/commerce_cases.js +0 -399
- package/lib/commerce_checkout.js +0 -509
- package/lib/commerce_coordination.js +0 -346
- package/lib/commerce_economics.js +0 -4017
- package/lib/commerce_identity.js +0 -578
- package/lib/commerce_quotes.js +0 -266
- package/lib/commerce_reports.js +0 -14461
- package/lib/commerce_runtime.js +0 -322
- package/lib/commerce_shell.js +0 -257
- package/lib/crypto_agility_matrix.js +0 -125
- package/lib/default_path_contract.js +0 -412
- package/lib/delivery_summary_contract.js +0 -95
- package/lib/ecosystem_entry.js +0 -64
- package/lib/erc8004_lane_contract.js +0 -65
- package/lib/event_system_lane_contract.js +0 -75
- package/lib/execution_dedupe.js +0 -86
- package/lib/execution_truth_contract.js +0 -234
- package/lib/external_credit_bridge.js +0 -142
- package/lib/external_execution_policy.js +0 -143
- package/lib/external_execution_runtime.js +0 -238
- package/lib/feature_control_lane_contract.js +0 -54
- package/lib/first_run_conversion_contract.js +0 -290
- package/lib/framework_lane_contract.js +0 -89
- package/lib/framework_provider_promotion.js +0 -235
- package/lib/full_catalog_contract.js +0 -525
- package/lib/go_live_operator_pack.js +0 -391
- package/lib/http_transport.js +0 -99
- package/lib/identity_auth.js +0 -175
- package/lib/identity_interop_contract.js +0 -82
- package/lib/integration_matrix_contract.js +0 -102
- package/lib/l402_adapter.js +0 -241
- package/lib/l402_lane_contract.js +0 -55
- package/lib/l402_payment_front.js +0 -265
- package/lib/launch_narrative.js +0 -53
- package/lib/lifecycle_continuity_contract.js +0 -115
- package/lib/machine_identity_registry_contract.js +0 -199
- package/lib/major_rails_lane_contract.js +0 -150
- package/lib/market_lane_contract.js +0 -467
- package/lib/market_lane_depth_contract.js +0 -182
- package/lib/market_lane_promotion_contract.js +0 -210
- package/lib/market_lane_trace_contract.js +0 -278
- package/lib/mcp_lane_contract.js +0 -137
- package/lib/mpp_adapter.js +0 -237
- package/lib/network_transport.js +0 -110
- package/lib/offline_verifiability_recovery_contract.js +0 -155
- package/lib/openapi_contract.js +0 -300
- package/lib/operational_receipt_contract.js +0 -165
- package/lib/operator_intelligence.js +0 -407
- package/lib/outreach_copy_pack.js +0 -51
- package/lib/outreach_message_pack.js +0 -71
- package/lib/outreach_proof.js +0 -71
- package/lib/outreach_target_pack.js +0 -60
- package/lib/partner_intelligence.js +0 -105
- package/lib/payment_config.js +0 -257
- package/lib/payment_front_registry.js +0 -53
- package/lib/payment_protocol_contract.js +0 -165
- package/lib/payment_rail_truth_contract.js +0 -324
- package/lib/payment_verification.js +0 -357
- package/lib/phase_10_closeout_pack.js +0 -45
- package/lib/phase_10_completion_pack.js +0 -76
- package/lib/phase_10_decision_record_pack.js +0 -54
- package/lib/phase_10_decision_resolution_pack.js +0 -53
- package/lib/phase_10_demand_signal_adapters_runtime_pack.js +0 -74
- package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +0 -74
- package/lib/phase_10_freeze_baseline_pack.js +0 -67
- package/lib/phase_10_freeze_review_pack.js +0 -64
- package/lib/phase_10_gate_pack.js +0 -57
- package/lib/phase_10_long_tail_continuity_pack.js +0 -80
- package/lib/phase_10_long_tail_ecosystem_pack.js +0 -66
- package/lib/phase_10_niche_extension_registry_runtime_pack.js +0 -74
- package/lib/phase_1_claude_mcp_pack.js +0 -60
- package/lib/phase_1_claude_mcp_runtime_pack.js +0 -52
- package/lib/phase_1_ecosystem_pack.js +0 -67
- package/lib/phase_1_openai_codex_pack.js +0 -60
- package/lib/phase_1_openai_codex_runtime_pack.js +0 -52
- package/lib/phase_2_base_runtime_pack.js +0 -71
- package/lib/phase_2_base_usdc_runtime_pack.js +0 -72
- package/lib/phase_2_closeout_pack.js +0 -65
- package/lib/phase_2_completion_pack.js +0 -113
- package/lib/phase_2_decision_record_pack.js +0 -66
- package/lib/phase_2_decision_resolution_pack.js +0 -69
- package/lib/phase_2_eth_runtime_pack.js +0 -70
- package/lib/phase_2_evm_base_runtime_pack.js +0 -73
- package/lib/phase_2_evm_runtime_pack.js +0 -71
- package/lib/phase_2_flip_preview_pack.js +0 -60
- package/lib/phase_2_freeze_review_pack.js +0 -99
- package/lib/phase_2_gate_pack.js +0 -77
- package/lib/phase_2_payment_rails_pack.js +0 -71
- package/lib/phase_2_usdc_runtime_pack.js +0 -71
- package/lib/phase_3_brc_runtime_pack.js +0 -81
- package/lib/phase_3_bsv_teranode_runtime_pack.js +0 -83
- package/lib/phase_3_closeout_pack.js +0 -62
- package/lib/phase_3_completion_pack.js +0 -94
- package/lib/phase_3_decision_record_pack.js +0 -64
- package/lib/phase_3_decision_resolution_pack.js +0 -69
- package/lib/phase_3_freeze_baseline_pack.js +0 -67
- package/lib/phase_3_freeze_review_pack.js +0 -80
- package/lib/phase_3_gate_pack.js +0 -76
- package/lib/phase_3_metanet_runtime_pack.js +0 -81
- package/lib/phase_3_native_bsv_pack.js +0 -91
- package/lib/phase_3_native_continuity_pack.js +0 -82
- package/lib/phase_4_attestation_runtime_pack.js +0 -75
- package/lib/phase_4_closeout_pack.js +0 -45
- package/lib/phase_4_completion_pack.js +0 -94
- package/lib/phase_4_decision_record_pack.js +0 -54
- package/lib/phase_4_decision_resolution_pack.js +0 -45
- package/lib/phase_4_erc8004_runtime_pack.js +0 -76
- package/lib/phase_4_freeze_baseline_pack.js +0 -67
- package/lib/phase_4_freeze_review_pack.js +0 -68
- package/lib/phase_4_gate_pack.js +0 -58
- package/lib/phase_4_identity_registry_runtime_pack.js +0 -75
- package/lib/phase_4_identity_trust_pack.js +0 -73
- package/lib/phase_4_trust_continuity_pack.js +0 -86
- package/lib/phase_5_antelope_runtime_pack.js +0 -76
- package/lib/phase_5_closeout_pack.js +0 -44
- package/lib/phase_5_completion_pack.js +0 -82
- package/lib/phase_5_constellation_dag_runtime_pack.js +0 -76
- package/lib/phase_5_decision_record_pack.js +0 -54
- package/lib/phase_5_decision_resolution_pack.js +0 -45
- package/lib/phase_5_digibyte_dgb_runtime_pack.js +0 -76
- package/lib/phase_5_freeze_baseline_pack.js +0 -67
- package/lib/phase_5_freeze_review_pack.js +0 -68
- package/lib/phase_5_gate_pack.js +0 -58
- package/lib/phase_5_hedera_hbar_runtime_pack.js +0 -76
- package/lib/phase_5_kaspa_kas_runtime_pack.js +0 -76
- package/lib/phase_5_major_rails_continuity_pack.js +0 -86
- package/lib/phase_5_major_rails_pack.js +0 -110
- package/lib/phase_5_metal_runtime_pack.js +0 -76
- package/lib/phase_5_polkadot_dot_runtime_pack.js +0 -76
- package/lib/phase_5_proton_xpr_runtime_pack.js +0 -76
- package/lib/phase_5_solana_runtime_pack.js +0 -76
- package/lib/phase_6_autogen_runtime_pack.js +0 -72
- package/lib/phase_6_closeout_pack.js +0 -46
- package/lib/phase_6_completion_pack.js +0 -77
- package/lib/phase_6_decision_record_pack.js +0 -54
- package/lib/phase_6_decision_resolution_pack.js +0 -53
- package/lib/phase_6_framework_continuity_pack.js +0 -81
- package/lib/phase_6_framework_runtime_pack.js +0 -68
- package/lib/phase_6_freeze_baseline_pack.js +0 -68
- package/lib/phase_6_freeze_review_pack.js +0 -65
- package/lib/phase_6_gate_pack.js +0 -59
- package/lib/phase_6_langchain_runtime_pack.js +0 -72
- package/lib/phase_6_langgraph_runtime_pack.js +0 -72
- package/lib/phase_6_semantic_kernel_runtime_pack.js +0 -72
- package/lib/phase_7_closeout_pack.js +0 -45
- package/lib/phase_7_completion_pack.js +0 -85
- package/lib/phase_7_decision_record_pack.js +0 -53
- package/lib/phase_7_decision_resolution_pack.js +0 -53
- package/lib/phase_7_event_system_continuity_pack.js +0 -89
- package/lib/phase_7_event_system_pack.js +0 -76
- package/lib/phase_7_freeze_baseline_pack.js +0 -74
- package/lib/phase_7_freeze_review_pack.js +0 -65
- package/lib/phase_7_gate_pack.js +0 -58
- package/lib/phase_7_kafka_runtime_pack.js +0 -74
- package/lib/phase_7_mqtt_runtime_pack.js +0 -74
- package/lib/phase_7_nats_runtime_pack.js +0 -74
- package/lib/phase_7_webhook_event_bus_runtime_pack.js +0 -74
- package/lib/phase_8_closeout_pack.js +0 -46
- package/lib/phase_8_completion_pack.js +0 -82
- package/lib/phase_8_decision_record_pack.js +0 -54
- package/lib/phase_8_decision_resolution_pack.js +0 -53
- package/lib/phase_8_external_receipt_import_runtime_pack.js +0 -74
- package/lib/phase_8_external_result_import_runtime_pack.js +0 -74
- package/lib/phase_8_freeze_baseline_pack.js +0 -71
- package/lib/phase_8_freeze_review_pack.js +0 -64
- package/lib/phase_8_gate_pack.js +0 -58
- package/lib/phase_8_proof_bridge_continuity_pack.js +0 -86
- package/lib/phase_8_proof_bridges_pack.js +0 -72
- package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +0 -74
- package/lib/phase_9_closeout_pack.js +0 -46
- package/lib/phase_9_completion_pack.js +0 -82
- package/lib/phase_9_custody_refs_runtime_pack.js +0 -74
- package/lib/phase_9_decision_record_pack.js +0 -54
- package/lib/phase_9_decision_resolution_pack.js +0 -53
- package/lib/phase_9_freeze_baseline_pack.js +0 -71
- package/lib/phase_9_freeze_review_pack.js +0 -64
- package/lib/phase_9_gate_pack.js +0 -58
- package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +0 -74
- package/lib/phase_9_treasury_connectivity_pack.js +0 -72
- package/lib/phase_9_treasury_continuity_pack.js +0 -86
- package/lib/phase_9_treasury_destinations_runtime_pack.js +0 -74
- package/lib/phase_program_pack.js +0 -120
- package/lib/pricing_optimization_contract.js +0 -775
- package/lib/protocol_lane_contract.js +0 -117
- package/lib/provenance_lane_contract.js +0 -54
- package/lib/provider_lane_contract.js +0 -240
- package/lib/provider_network_contract.js +0 -149
- package/lib/provider_payout_execution.js +0 -155
- package/lib/provider_registry.js +0 -852
- package/lib/provider_runtime_journey_contract.js +0 -183
- package/lib/public_surface_policy_contract.js +0 -111
- package/lib/publish_plan.js +0 -51
- package/lib/rate_limiter.js +0 -81
- package/lib/record_queries.js +0 -48
- package/lib/release_candidate.js +0 -50
- package/lib/release_center.js +0 -1093
- package/lib/release_history.js +0 -205
- package/lib/release_manifest.js +0 -113
- package/lib/release_pack.js +0 -453
- package/lib/request_rate_limit.js +0 -144
- package/lib/resource_views.js +0 -31
- package/lib/revenue_launch_path_contract.js +0 -326
- package/lib/route_matchers.js +0 -34
- package/lib/route_params.js +0 -19
- package/lib/runtime_bridge.js +0 -124
- package/lib/runtime_operations_worker.js +0 -282
- package/lib/runtime_state_store.js +0 -495
- package/lib/settlement_bsv_live.js +0 -600
- package/lib/settlement_bsv_teranode.js +0 -117
- package/lib/settlement_lane_contract.js +0 -111
- package/lib/shared_signals_lane_contract.js +0 -54
- package/lib/signed_audit_provenance_contract.js +0 -83
- package/lib/soft_launch_pack.js +0 -78
- package/lib/stablecoin_lane_contract.js +0 -76
- package/lib/stripe_mpp_lane_contract.js +0 -96
- package/lib/stripe_mpp_payment_front.js +0 -258
- package/lib/telemetry_lane_contract.js +0 -54
- package/lib/treasury_destinations_contract.js +0 -764
- package/lib/treasury_egress_policy_contract.js +0 -91
- package/lib/treasury_lane_contract.js +0 -84
- package/lib/trust_portability_boundary_contract.js +0 -72
- package/lib/x402_facilitator.js +0 -198
- package/lib/x402_lane_contract.js +0 -136
- package/lib/x402_settlement_recovery.js +0 -175
- package/scripts/buyer_events_daily_report.js +0 -79
- package/scripts/registry_cli.js +0 -275
- package/scripts/state_backup_offsite.js +0 -196
- package/scripts/verify_a2a_rpc.js +0 -131
- package/scripts/verify_adapters.js +0 -554
- package/scripts/verify_agent_identity.js +0 -153
- package/scripts/verify_all.js +0 -4963
- package/scripts/verify_bolt_adapter.js +0 -128
- package/scripts/verify_buyer_event_log.js +0 -128
- package/scripts/verify_buyer_safety.js +0 -141
- package/scripts/verify_cdp_facilitator.js +0 -110
- package/scripts/verify_checkout_processor.js +0 -109
- package/scripts/verify_commerce_bridge.js +0 -177
- package/scripts/verify_control_plane_contracts.js +0 -34
- package/scripts/verify_control_plane_routes.js +0 -70
- package/scripts/verify_delivery_summary.js +0 -112
- package/scripts/verify_examples.js +0 -19
- package/scripts/verify_execution_dedupe.js +0 -189
- package/scripts/verify_execution_surfacing.js +0 -76
- package/scripts/verify_external_execution_retry.js +0 -140
- package/scripts/verify_final_activation.js +0 -191
- package/scripts/verify_first_run_conversions.js +0 -81
- package/scripts/verify_framework_provider_promotion.js +0 -152
- package/scripts/verify_full_catalog.js +0 -174
- package/scripts/verify_integrations.js +0 -620
- package/scripts/verify_l402_adapter.js +0 -86
- package/scripts/verify_lifecycle_continuity.js +0 -96
- package/scripts/verify_lifecycle_spend_binding.js +0 -88
- package/scripts/verify_market_lane_depth.js +0 -94
- package/scripts/verify_market_lane_promotion.js +0 -103
- package/scripts/verify_market_lane_traces.js +0 -98
- package/scripts/verify_market_lanes.js +0 -102
- package/scripts/verify_mpp_adapter.js +0 -128
- package/scripts/verify_operator_observability_boundary.js +0 -83
- package/scripts/verify_pricing_experiment_plan.js +0 -124
- package/scripts/verify_production_readiness.js +0 -268
- package/scripts/verify_provider_network.js +0 -819
- package/scripts/verify_provider_runtime_breadth.js +0 -109
- package/scripts/verify_provider_runtime_journeys.js +0 -111
- package/scripts/verify_rate_limiter.js +0 -52
- package/scripts/verify_refund_credit.js +0 -106
- package/scripts/verify_revenue_launch_paths.js +0 -105
- package/scripts/verify_runtime_durability.js +0 -52
- package/scripts/verify_runtime_state_guard.js +0 -117
- package/scripts/verify_service.js +0 -15421
- package/scripts/verify_settlement.js +0 -116
- package/scripts/verify_tooling.js +0 -1412
- package/scripts/verify_treasury_public_boundary.js +0 -97
- package/scripts/verify_verify_execute_settle.js +0 -209
- package/scripts/verify_x402_facilitator.js +0 -307
- package/scripts/verify_x402_settlement_recovery.js +0 -153
- package/server.js +0 -12245
package/lib/commerce_runtime.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { createCommandArtifacts } = require("./commerce_artifacts");
|
|
4
|
-
const { createQuote, hydrateQuoteStates, markQuoteExecuted } = require("./commerce_quotes");
|
|
5
|
-
const { listRecords } = require("./record_queries");
|
|
6
|
-
const { createBsvSettlementRecord } = require("./settlement_bsv_live");
|
|
7
|
-
const {
|
|
8
|
-
actOnDispute,
|
|
9
|
-
actOnRefund,
|
|
10
|
-
actOnRemediationTicket,
|
|
11
|
-
createDispute,
|
|
12
|
-
createRefund,
|
|
13
|
-
createRemediationTicket,
|
|
14
|
-
settleRefundAsCredit
|
|
15
|
-
} = require("./commerce_cases");
|
|
16
|
-
|
|
17
|
-
function createRuntimeState() {
|
|
18
|
-
return {
|
|
19
|
-
quotes: new Map(),
|
|
20
|
-
checkoutPurchaseIntents: new Map(),
|
|
21
|
-
checkoutSessions: new Map(),
|
|
22
|
-
checkoutEvents: new Map(),
|
|
23
|
-
externalCreditGrants: new Map(),
|
|
24
|
-
accountAuthorityBindings: new Map(),
|
|
25
|
-
accountSpendCredentials: new Map(),
|
|
26
|
-
accountSpendCredentialsByToken: new Map(),
|
|
27
|
-
machineIdentityBindings: new Map(),
|
|
28
|
-
operatorParticipants: new Map(),
|
|
29
|
-
networkParticipants: new Map(),
|
|
30
|
-
runtimeBridgeDispatches: new Map(),
|
|
31
|
-
agentAccounts: new Map(),
|
|
32
|
-
transactions: new Map(),
|
|
33
|
-
receipts: new Map(),
|
|
34
|
-
paymentLedger: [],
|
|
35
|
-
bsvSettlementRecords: new Map(),
|
|
36
|
-
providerRegistry: new Map(),
|
|
37
|
-
providerSettlementLedger: [],
|
|
38
|
-
providerPayouts: [],
|
|
39
|
-
acceptedPaymentNonces: new Set(),
|
|
40
|
-
acceptedAgentSignatures: new Map(),
|
|
41
|
-
inFlightPaymentAuthorizations: new Map(),
|
|
42
|
-
economicsBudgets: new Map(),
|
|
43
|
-
economicsAgents: new Map(),
|
|
44
|
-
economicsReceipts: new Map(),
|
|
45
|
-
economicsAllocations: [],
|
|
46
|
-
economicsRailCredits: [],
|
|
47
|
-
economicsEntitlements: new Map(),
|
|
48
|
-
economicsCreditSpends: [],
|
|
49
|
-
economicsUsageMeters: new Map(),
|
|
50
|
-
economicsInterpretationHandoffs: [],
|
|
51
|
-
economicsJobActions: [],
|
|
52
|
-
coordinationHandoffs: [],
|
|
53
|
-
zoneAdmissionCases: [],
|
|
54
|
-
deliveries: new Map(),
|
|
55
|
-
pendingExecutions: new Map(),
|
|
56
|
-
disputes: new Map(),
|
|
57
|
-
refunds: new Map(),
|
|
58
|
-
remediationTickets: new Map()
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function buildDeliveryEvent(event, delivery, atIso, extra) {
|
|
63
|
-
return {
|
|
64
|
-
event,
|
|
65
|
-
at_iso: atIso,
|
|
66
|
-
status: delivery.status,
|
|
67
|
-
callback_url: delivery.callback_url || null,
|
|
68
|
-
output_ref: delivery.output_ref || null,
|
|
69
|
-
proof_ref: delivery.proof_ref || null,
|
|
70
|
-
...(extra || {})
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function buildCallbackDeliveryState(callbackUrl, deliveredAtIso, options = {}) {
|
|
75
|
-
if (!callbackUrl) return null;
|
|
76
|
-
const opts = options || {};
|
|
77
|
-
const initialStatus = opts.initial_status || (deliveredAtIso ? "queued" : "pending_execution");
|
|
78
|
-
return {
|
|
79
|
-
status: initialStatus,
|
|
80
|
-
attempt_count: 0,
|
|
81
|
-
max_attempts: null,
|
|
82
|
-
last_attempt_at_iso: null,
|
|
83
|
-
next_attempt_at_iso: deliveredAtIso || null,
|
|
84
|
-
delivered_at_iso: null,
|
|
85
|
-
failed_at_iso: null,
|
|
86
|
-
last_error: null,
|
|
87
|
-
last_response_status: null,
|
|
88
|
-
signature_mode: "hmac_sha256"
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function completePendingExecution(state, transactionId) {
|
|
93
|
-
if (!transactionId || !state.pendingExecutions.has(transactionId) || !state.transactions.has(transactionId)) {
|
|
94
|
-
return state.transactions.get(transactionId) || null;
|
|
95
|
-
}
|
|
96
|
-
const pending = state.pendingExecutions.get(transactionId);
|
|
97
|
-
const current = state.transactions.get(transactionId);
|
|
98
|
-
if (!pending || !current || Date.now() < pending.readyAtMs) {
|
|
99
|
-
return current;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const completedAtIso = new Date(pending.readyAtMs).toISOString();
|
|
103
|
-
const next = {
|
|
104
|
-
transaction: {
|
|
105
|
-
...current.transaction,
|
|
106
|
-
status: "completed",
|
|
107
|
-
completed_at_iso: completedAtIso,
|
|
108
|
-
timing: {
|
|
109
|
-
...current.transaction.timing,
|
|
110
|
-
completed_at_iso: completedAtIso,
|
|
111
|
-
duration_ms: pending.durationMs,
|
|
112
|
-
observed_latency_class: pending.observedLatencyClass,
|
|
113
|
-
assessment: pending.assessment
|
|
114
|
-
},
|
|
115
|
-
execution: {
|
|
116
|
-
...current.transaction.execution,
|
|
117
|
-
status: "completed"
|
|
118
|
-
},
|
|
119
|
-
remediation: {
|
|
120
|
-
...current.transaction.remediation,
|
|
121
|
-
updated_at_iso: completedAtIso
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
receipt: {
|
|
125
|
-
...current.receipt,
|
|
126
|
-
status: "completed",
|
|
127
|
-
created_at_iso: completedAtIso,
|
|
128
|
-
timing: {
|
|
129
|
-
...current.receipt.timing,
|
|
130
|
-
completed_at_iso: completedAtIso,
|
|
131
|
-
duration_ms: pending.durationMs,
|
|
132
|
-
observed_latency_class: pending.observedLatencyClass,
|
|
133
|
-
assessment: pending.assessment
|
|
134
|
-
},
|
|
135
|
-
remediation: {
|
|
136
|
-
...current.receipt.remediation,
|
|
137
|
-
updated_at_iso: completedAtIso
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
command: current.command
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
state.transactions.set(transactionId, next);
|
|
144
|
-
state.receipts.set(next.receipt.receipt_id, next);
|
|
145
|
-
if (pending.quoteId && state.quotes.has(pending.quoteId)) {
|
|
146
|
-
const quote = state.quotes.get(pending.quoteId);
|
|
147
|
-
state.quotes.set(pending.quoteId, {
|
|
148
|
-
...quote,
|
|
149
|
-
status: "executed",
|
|
150
|
-
payment_recorded_at_iso: completedAtIso,
|
|
151
|
-
executed_at_iso: completedAtIso
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (pending.deliveryId && state.deliveries.has(pending.deliveryId)) {
|
|
155
|
-
const delivery = state.deliveries.get(pending.deliveryId);
|
|
156
|
-
const nextDelivery = {
|
|
157
|
-
...delivery,
|
|
158
|
-
status: "delivered",
|
|
159
|
-
delivered_at_iso: completedAtIso,
|
|
160
|
-
receipt_id: next.receipt.receipt_id,
|
|
161
|
-
proof_ref: next.receipt.proof_ref,
|
|
162
|
-
attempt_count: (delivery.attempt_count || 0) + 1,
|
|
163
|
-
last_attempt_at_iso: completedAtIso,
|
|
164
|
-
history: [
|
|
165
|
-
...(Array.isArray(delivery.history) ? delivery.history : []),
|
|
166
|
-
buildDeliveryEvent("delivered", { ...delivery, status: "delivered", proof_ref: next.receipt.proof_ref }, completedAtIso, {
|
|
167
|
-
attempt_number: (delivery.attempt_count || 0) + 1
|
|
168
|
-
})
|
|
169
|
-
],
|
|
170
|
-
callback_delivery: delivery.callback_url
|
|
171
|
-
? {
|
|
172
|
-
...(delivery.callback_delivery || buildCallbackDeliveryState(delivery.callback_url, completedAtIso)),
|
|
173
|
-
status: "queued",
|
|
174
|
-
next_attempt_at_iso: completedAtIso,
|
|
175
|
-
last_error: null,
|
|
176
|
-
failed_at_iso: null
|
|
177
|
-
}
|
|
178
|
-
: null
|
|
179
|
-
};
|
|
180
|
-
state.deliveries.set(pending.deliveryId, nextDelivery);
|
|
181
|
-
}
|
|
182
|
-
state.pendingExecutions.delete(transactionId);
|
|
183
|
-
return next;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function hydratePendingExecutions(state) {
|
|
187
|
-
for (const transactionId of Array.from(state.pendingExecutions.keys())) {
|
|
188
|
-
completePendingExecution(state, transactionId);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function createCommandResult(state, payload, quote, options) {
|
|
193
|
-
const opts = options || {};
|
|
194
|
-
const deferredCompletion = payload && payload.defer_completion === true;
|
|
195
|
-
const { transaction, receipt, command } = createCommandArtifacts(payload, quote, {
|
|
196
|
-
deferredCompletion,
|
|
197
|
-
paymentVerification: opts.paymentVerification || null,
|
|
198
|
-
externalExecution: opts.externalExecution || null
|
|
199
|
-
});
|
|
200
|
-
const result = { transaction, receipt, command };
|
|
201
|
-
state.transactions.set(transaction.transaction_id, result);
|
|
202
|
-
state.receipts.set(receipt.receipt_id, result);
|
|
203
|
-
let paymentRecord = null;
|
|
204
|
-
if (!opts.skipPaymentLedger) {
|
|
205
|
-
paymentRecord = {
|
|
206
|
-
payment_id: `pay_${quote.quote_id}`,
|
|
207
|
-
quote_id: quote.quote_id,
|
|
208
|
-
transaction_id: transaction.transaction_id,
|
|
209
|
-
receipt_id: receipt.receipt_id,
|
|
210
|
-
account_id: quote.account_id,
|
|
211
|
-
amount_minor: quote.amount_minor,
|
|
212
|
-
currency: quote.currency,
|
|
213
|
-
settlement_adapter: quote.settlement_adapter,
|
|
214
|
-
settlement_integration_id: quote.settlement_integration_id || null,
|
|
215
|
-
recorded_at_iso: receipt.created_at_iso,
|
|
216
|
-
payment: transaction.payment,
|
|
217
|
-
settlement: transaction.settlement,
|
|
218
|
-
treasury: transaction.treasury,
|
|
219
|
-
default_path: transaction.default_path,
|
|
220
|
-
payment_verification: opts.paymentVerification
|
|
221
|
-
? {
|
|
222
|
-
verification_mode: opts.paymentVerification.verification_mode || null,
|
|
223
|
-
wallet_id: opts.paymentVerification.wallet_id || null,
|
|
224
|
-
age_seconds: Number.isFinite(Number(opts.paymentVerification.age_seconds))
|
|
225
|
-
? Number(opts.paymentVerification.age_seconds)
|
|
226
|
-
: null
|
|
227
|
-
}
|
|
228
|
-
: null
|
|
229
|
-
};
|
|
230
|
-
state.paymentLedger = [
|
|
231
|
-
paymentRecord,
|
|
232
|
-
...(Array.isArray(state.paymentLedger) ? state.paymentLedger : [])
|
|
233
|
-
].slice(0, 100);
|
|
234
|
-
const liveSettlement = createBsvSettlementRecord(state, transaction, receipt, paymentRecord);
|
|
235
|
-
if (liveSettlement) {
|
|
236
|
-
paymentRecord.live_settlement = {
|
|
237
|
-
settlement_id: liveSettlement.settlement_id,
|
|
238
|
-
status: liveSettlement.status,
|
|
239
|
-
finality_status: liveSettlement.finality_status,
|
|
240
|
-
txid: liveSettlement.txid,
|
|
241
|
-
rail: liveSettlement.rail
|
|
242
|
-
};
|
|
243
|
-
transaction.settlement.live = paymentRecord.live_settlement;
|
|
244
|
-
receipt.settlement.live = paymentRecord.live_settlement;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if (opts.creditSpend) {
|
|
248
|
-
transaction.credit_spend = opts.creditSpend;
|
|
249
|
-
receipt.credit_spend = opts.creditSpend;
|
|
250
|
-
}
|
|
251
|
-
const deliveryRecord = {
|
|
252
|
-
delivery_id: `delivery_${transaction.transaction_id}`,
|
|
253
|
-
transaction_id: transaction.transaction_id,
|
|
254
|
-
receipt_id: receipt.receipt_id,
|
|
255
|
-
quote_id: quote.quote_id,
|
|
256
|
-
account_id: quote.account_id,
|
|
257
|
-
callback_url: transaction.callback_url,
|
|
258
|
-
output_ref: transaction.output_ref,
|
|
259
|
-
proof_ref: receipt.proof_ref,
|
|
260
|
-
payment_id: paymentRecord ? paymentRecord.payment_id : null,
|
|
261
|
-
delivery_target_kind: transaction.callback_url ? "callback" : "direct",
|
|
262
|
-
status: deferredCompletion ? "pending_delivery" : "delivered",
|
|
263
|
-
created_at_iso: transaction.created_at_iso,
|
|
264
|
-
delivered_at_iso: deferredCompletion ? null : receipt.created_at_iso,
|
|
265
|
-
attempt_count: deferredCompletion ? 0 : 1,
|
|
266
|
-
last_attempt_at_iso: deferredCompletion ? null : receipt.created_at_iso,
|
|
267
|
-
callback_delivery: buildCallbackDeliveryState(
|
|
268
|
-
transaction.callback_url,
|
|
269
|
-
deferredCompletion ? null : receipt.created_at_iso,
|
|
270
|
-
{
|
|
271
|
-
initial_status: deferredCompletion ? "pending_execution" : "queued"
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
history: [
|
|
275
|
-
buildDeliveryEvent("created", {
|
|
276
|
-
callback_url: transaction.callback_url,
|
|
277
|
-
output_ref: transaction.output_ref,
|
|
278
|
-
proof_ref: receipt.proof_ref,
|
|
279
|
-
status: deferredCompletion ? "pending_delivery" : "delivered"
|
|
280
|
-
}, transaction.created_at_iso),
|
|
281
|
-
...(!deferredCompletion ? [
|
|
282
|
-
buildDeliveryEvent("delivered", {
|
|
283
|
-
callback_url: transaction.callback_url,
|
|
284
|
-
output_ref: transaction.output_ref,
|
|
285
|
-
proof_ref: receipt.proof_ref,
|
|
286
|
-
status: "delivered"
|
|
287
|
-
}, receipt.created_at_iso, { attempt_number: 1 })
|
|
288
|
-
] : [])
|
|
289
|
-
]
|
|
290
|
-
};
|
|
291
|
-
state.deliveries.set(deliveryRecord.delivery_id, deliveryRecord);
|
|
292
|
-
markQuoteExecuted(state, quote, result, paymentRecord, { deferredCompletion });
|
|
293
|
-
if (deferredCompletion) {
|
|
294
|
-
state.pendingExecutions.set(transaction.transaction_id, {
|
|
295
|
-
readyAtMs: Date.now() + 300,
|
|
296
|
-
quoteId: quote.quote_id,
|
|
297
|
-
deliveryId: deliveryRecord.delivery_id,
|
|
298
|
-
durationMs: 250,
|
|
299
|
-
observedLatencyClass: "instant",
|
|
300
|
-
assessment: "within_posture"
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
module.exports = {
|
|
307
|
-
buildCallbackDeliveryState,
|
|
308
|
-
completePendingExecution,
|
|
309
|
-
createCommandResult,
|
|
310
|
-
createDispute,
|
|
311
|
-
createQuote,
|
|
312
|
-
createRefund,
|
|
313
|
-
createRemediationTicket,
|
|
314
|
-
createRuntimeState,
|
|
315
|
-
hydrateQuoteStates,
|
|
316
|
-
hydratePendingExecutions,
|
|
317
|
-
actOnDispute,
|
|
318
|
-
actOnRefund,
|
|
319
|
-
actOnRemediationTicket,
|
|
320
|
-
settleRefundAsCredit,
|
|
321
|
-
listRecords
|
|
322
|
-
};
|
package/lib/commerce_shell.js
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const crypto = require("crypto");
|
|
4
|
-
|
|
5
|
-
function normalizeString(value) {
|
|
6
|
-
return String(value == null ? "" : value).trim();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function shellHash(seed) {
|
|
10
|
-
return crypto.createHash("sha256").update(seed).digest("hex");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function buildShellRef(prefix, seed) {
|
|
14
|
-
return `${prefix}.${shellHash(JSON.stringify(seed)).slice(0, 16)}`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function buildAgentAccountPublicView(payload, includeOnboarding = false) {
|
|
18
|
-
const item = payload && typeof payload === "object" ? payload : {};
|
|
19
|
-
const view = {
|
|
20
|
-
ok: item.ok === true,
|
|
21
|
-
account: item.account && typeof item.account === "object" ? item.account : null
|
|
22
|
-
};
|
|
23
|
-
if (includeOnboarding) {
|
|
24
|
-
view.onboarding = item.onboarding && typeof item.onboarding === "object" ? item.onboarding : null;
|
|
25
|
-
}
|
|
26
|
-
return view;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function createAgentAccount(state, body) {
|
|
30
|
-
const input = body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
31
|
-
const requestedLabel = normalizeString(input.label || input.name || input.account_label || "");
|
|
32
|
-
const settlementMode = normalizeString(input.settlement_mode || "ethereum_evm");
|
|
33
|
-
const protocol = normalizeString(input.protocol || "mcp");
|
|
34
|
-
const adapterProfile = normalizeString(input.adapter_profile || "default");
|
|
35
|
-
const seed = shellHash(JSON.stringify({
|
|
36
|
-
requestedLabel,
|
|
37
|
-
settlementMode,
|
|
38
|
-
protocol,
|
|
39
|
-
adapterProfile,
|
|
40
|
-
createdAt: new Date().toISOString()
|
|
41
|
-
}));
|
|
42
|
-
const accountId = `acct_${seed.slice(0, 12)}`;
|
|
43
|
-
const walletId = `wallet_${seed.slice(12, 24)}`;
|
|
44
|
-
const apiKey = `xytara_live_${seed.slice(24, 48)}`;
|
|
45
|
-
const walletSecret = `xytara_wallet_${seed.slice(0, 32)}`;
|
|
46
|
-
const account = {
|
|
47
|
-
account_id: accountId,
|
|
48
|
-
wallet_id: walletId,
|
|
49
|
-
label: requestedLabel || accountId,
|
|
50
|
-
settlement_mode: settlementMode,
|
|
51
|
-
protocol,
|
|
52
|
-
adapter_profile: adapterProfile,
|
|
53
|
-
status: "active",
|
|
54
|
-
created_at_iso: new Date().toISOString()
|
|
55
|
-
};
|
|
56
|
-
const payload = {
|
|
57
|
-
ok: true,
|
|
58
|
-
account,
|
|
59
|
-
onboarding: {
|
|
60
|
-
api_key: apiKey,
|
|
61
|
-
wallet_secret: walletSecret,
|
|
62
|
-
default_headers: {
|
|
63
|
-
authorization: `Bearer ${apiKey}`,
|
|
64
|
-
"x-xytara-wallet-id": walletId
|
|
65
|
-
},
|
|
66
|
-
default_context: {
|
|
67
|
-
account_id: accountId,
|
|
68
|
-
settlement_mode: settlementMode,
|
|
69
|
-
protocol
|
|
70
|
-
},
|
|
71
|
-
next_surfaces: {
|
|
72
|
-
transaction_center: "/v1/transaction-center",
|
|
73
|
-
operations_dashboard: `/v1/operations/dashboard?account_id=${encodeURIComponent(accountId)}`,
|
|
74
|
-
operator_shell_summary: "/v1/operator-shell/summary"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
state.agentAccounts.set(accountId, payload);
|
|
79
|
-
return payload;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function listAgentAccounts(state) {
|
|
83
|
-
const accounts = Array.from(state.agentAccounts.values()).map((entry) => entry.account);
|
|
84
|
-
return {
|
|
85
|
-
ok: true,
|
|
86
|
-
count: accounts.length,
|
|
87
|
-
accounts
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getAgentAccount(state, accountId) {
|
|
92
|
-
const payload = state.agentAccounts.get(accountId) || null;
|
|
93
|
-
return payload ? buildAgentAccountPublicView(payload, false) : null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function buildOperatorShellCenter() {
|
|
97
|
-
return {
|
|
98
|
-
center_ref: "operator-shell.center",
|
|
99
|
-
account_issue_surface: "/v1/agent-accounts",
|
|
100
|
-
summary_surface: "/v1/operator-shell/summary",
|
|
101
|
-
workflow_pack_surface: "/v1/operator-shell/workflow-pack",
|
|
102
|
-
admin_pack_surface: "/v1/operator-shell/admin-pack",
|
|
103
|
-
supported_capabilities: [
|
|
104
|
-
"agent_account_onboarding",
|
|
105
|
-
"operator_shell_summary",
|
|
106
|
-
"workflow_packaging",
|
|
107
|
-
"admin_packaging",
|
|
108
|
-
"cross_layer_visibility",
|
|
109
|
-
"hosted_checkout_review_visibility"
|
|
110
|
-
]
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function summarizeOperatorShellCenter() {
|
|
115
|
-
const center = buildOperatorShellCenter();
|
|
116
|
-
return {
|
|
117
|
-
center_ref: center.center_ref,
|
|
118
|
-
capability_count: center.supported_capabilities.length,
|
|
119
|
-
account_issue_surface: center.account_issue_surface,
|
|
120
|
-
workflow_pack_surface: center.workflow_pack_surface
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function buildOperatorShellSummary(input) {
|
|
125
|
-
const body = input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
126
|
-
const accountId = normalizeString(body.account_id || "acct_demo");
|
|
127
|
-
const operationsDashboard = body.operations_dashboard || {};
|
|
128
|
-
const operatorExportPack = body.operator_export_pack || {};
|
|
129
|
-
const economicsOperatorView = body.economics_operator_view || {};
|
|
130
|
-
const economicsOperatorDashboard = body.economics_operator_dashboard || {};
|
|
131
|
-
const coordinationOperatorView = body.coordination_operator_view || {};
|
|
132
|
-
const coordinationAdminView = body.coordination_admin_view || {};
|
|
133
|
-
const hostedCheckoutOperatorSummary = body.hosted_checkout_operator_summary || {};
|
|
134
|
-
const entitlementReplenishmentSummary = body.entitlement_replenishment_summary || {};
|
|
135
|
-
const runtimeDurability = body.runtime_durability || {};
|
|
136
|
-
const nativeSettlementReadiness = body.native_settlement_readiness || {};
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
ok: true,
|
|
140
|
-
shell_summary_ref: buildShellRef("operator-shell.summary", {
|
|
141
|
-
account_id: accountId,
|
|
142
|
-
attention_count: operationsDashboard.attention_count || 0,
|
|
143
|
-
export_version: operatorExportPack.export_version || null
|
|
144
|
-
}),
|
|
145
|
-
account_id: accountId,
|
|
146
|
-
shell_surfaces: {
|
|
147
|
-
operations_dashboard: "/v1/operations/dashboard",
|
|
148
|
-
operator_export_pack: "/v1/operator-export-pack",
|
|
149
|
-
economics_operator_view: `/v1/economics/accounts/${encodeURIComponent(accountId)}/operator-view`,
|
|
150
|
-
economics_operator_dashboard: `/v1/economics/accounts/${encodeURIComponent(accountId)}/operator-dashboard`,
|
|
151
|
-
coordination_operator_view: "/v1/coordination-center/operator-view",
|
|
152
|
-
coordination_admin_view: "/v1/coordination-center/admin-view",
|
|
153
|
-
hosted_checkout_purchase_intents: `/v1/checkout/purchase-intents?account_id=${encodeURIComponent(accountId)}`,
|
|
154
|
-
hosted_checkout_runtime_bridge_dispatches: `/v1/runtime-bridge/dispatches?account_id=${encodeURIComponent(accountId)}`,
|
|
155
|
-
runtime_durability: "/v1/runtime/durability",
|
|
156
|
-
native_settlement_readiness: "/v1/settlement/bsv-teranode/readiness",
|
|
157
|
-
proof_governance_dashboard: "/v1/proof-center/governance/dashboard",
|
|
158
|
-
proof_bridge_admin_pack: "/v1/proof-center/bridge/admin-pack"
|
|
159
|
-
},
|
|
160
|
-
shell_state: {
|
|
161
|
-
attention_count: Number(operationsDashboard.attention_count || 0),
|
|
162
|
-
open_issue_count: Number(operationsDashboard.open_issue_count || 0),
|
|
163
|
-
export_generated_at_iso: operatorExportPack.generated_at_iso || null,
|
|
164
|
-
economics_receipt_count: Number(
|
|
165
|
-
economicsOperatorDashboard.receipt_summary && economicsOperatorDashboard.receipt_summary.receipt_count || 0
|
|
166
|
-
),
|
|
167
|
-
coordination_zone_count: Number(coordinationAdminView.zone_count || coordinationOperatorView.zone_count || 0),
|
|
168
|
-
hosted_checkout_purchase_intent_count: Number(hostedCheckoutOperatorSummary.purchase_intent_count || 0),
|
|
169
|
-
hosted_checkout_refund_review_required_count: Number(hostedCheckoutOperatorSummary.refund_review_required_count || 0),
|
|
170
|
-
hosted_checkout_execution_dispatched_count: Number(hostedCheckoutOperatorSummary.execution_dispatched_count || 0),
|
|
171
|
-
hosted_checkout_auto_compensated_count: Number(hostedCheckoutOperatorSummary.auto_compensated_count || 0),
|
|
172
|
-
hosted_checkout_compensation_review_required_count: Number(hostedCheckoutOperatorSummary.compensation_review_required_count || 0),
|
|
173
|
-
hosted_checkout_compensation_failed_count: Number(hostedCheckoutOperatorSummary.compensation_failed_count || 0),
|
|
174
|
-
low_balance_entitlement_count: Number(entitlementReplenishmentSummary.low_balance_count || 0),
|
|
175
|
-
depleted_entitlement_count: Number(entitlementReplenishmentSummary.depleted_count || 0),
|
|
176
|
-
runtime_snapshot_enabled: runtimeDurability.enabled === true,
|
|
177
|
-
runtime_snapshot_exists: runtimeDurability.snapshot_exists === true,
|
|
178
|
-
runtime_recovery_posture: runtimeDurability.recovery_posture || null,
|
|
179
|
-
native_settlement_runtime_mode: runtimeDurability.enabled === true || nativeSettlementReadiness.runtime_mode
|
|
180
|
-
? nativeSettlementReadiness.runtime_mode || null
|
|
181
|
-
: null,
|
|
182
|
-
native_settlement_ready: nativeSettlementReadiness.ready === true,
|
|
183
|
-
native_settlement_blocker_count: Array.isArray(nativeSettlementReadiness.blockers)
|
|
184
|
-
? nativeSettlementReadiness.blockers.length
|
|
185
|
-
: 0
|
|
186
|
-
},
|
|
187
|
-
linked_refs: {
|
|
188
|
-
operations_dashboard_ref: buildShellRef("operator-shell.operations-dashboard", {
|
|
189
|
-
account_id: accountId,
|
|
190
|
-
attention_count: operationsDashboard.attention_count || 0,
|
|
191
|
-
attention_signal_count: operationsDashboard.attention_signal_count || 0
|
|
192
|
-
}),
|
|
193
|
-
economics_operator_view_ref: economicsOperatorView.operator_view_ref || null,
|
|
194
|
-
economics_operator_dashboard_ref: economicsOperatorDashboard.operator_dashboard_ref || null,
|
|
195
|
-
coordination_operator_view_ref: coordinationOperatorView.operator_view_ref || null,
|
|
196
|
-
coordination_admin_view_ref: coordinationAdminView.admin_view_ref || null,
|
|
197
|
-
hosted_checkout_operator_summary_ref: hostedCheckoutOperatorSummary.operator_summary_ref || null
|
|
198
|
-
,
|
|
199
|
-
entitlement_replenishment_summary_ref: entitlementReplenishmentSummary.entitlement_count != null
|
|
200
|
-
? `/v1/economics/accounts/${encodeURIComponent(accountId)}/entitlements/replenishment-summary`
|
|
201
|
-
: null,
|
|
202
|
-
runtime_durability_ref: runtimeDurability.inspect_ref || "/v1/runtime/durability",
|
|
203
|
-
native_settlement_readiness_ref: nativeSettlementReadiness.readiness_ref || "/v1/settlement/bsv-teranode/readiness"
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function buildOperatorShellWorkflowPack(summary) {
|
|
209
|
-
const shellSummary = buildOperatorShellSummary(summary);
|
|
210
|
-
return {
|
|
211
|
-
ok: true,
|
|
212
|
-
workflow_pack_ref: buildShellRef("operator-shell.workflow-pack", shellSummary),
|
|
213
|
-
shell_summary_ref: shellSummary.shell_summary_ref,
|
|
214
|
-
account_id: shellSummary.account_id,
|
|
215
|
-
workflow_steps: [
|
|
216
|
-
"issue_or_select_agent_account",
|
|
217
|
-
"start_or_review_governed_transaction",
|
|
218
|
-
"review_hosted_checkout_purchase_and_refund_queue",
|
|
219
|
-
"inspect_economics_and_coordination",
|
|
220
|
-
"export_operator_pack",
|
|
221
|
-
"handoff_to_proof_review_when_needed"
|
|
222
|
-
],
|
|
223
|
-
linked_surfaces: shellSummary.shell_surfaces
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function buildOperatorShellAdminPack(summary) {
|
|
228
|
-
const shellSummary = buildOperatorShellSummary(summary);
|
|
229
|
-
const workflowPack = buildOperatorShellWorkflowPack(summary);
|
|
230
|
-
return {
|
|
231
|
-
ok: true,
|
|
232
|
-
admin_pack_ref: buildShellRef("operator-shell.admin-pack", {
|
|
233
|
-
shell_summary_ref: shellSummary.shell_summary_ref,
|
|
234
|
-
workflow_pack_ref: workflowPack.workflow_pack_ref
|
|
235
|
-
}),
|
|
236
|
-
shell_summary_ref: shellSummary.shell_summary_ref,
|
|
237
|
-
workflow_pack_ref: workflowPack.workflow_pack_ref,
|
|
238
|
-
operator_refs: shellSummary.linked_refs,
|
|
239
|
-
export_surface: "/v1/operator-export-pack",
|
|
240
|
-
guidance: [
|
|
241
|
-
"operator_shell_is_a_public_control_surface_inside_xytara",
|
|
242
|
-
"operator_shell_does_not_create_a_separate_product_identity"
|
|
243
|
-
]
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
module.exports = {
|
|
248
|
-
buildAgentAccountPublicView,
|
|
249
|
-
createAgentAccount,
|
|
250
|
-
listAgentAccounts,
|
|
251
|
-
getAgentAccount,
|
|
252
|
-
buildOperatorShellCenter,
|
|
253
|
-
summarizeOperatorShellCenter,
|
|
254
|
-
buildOperatorShellSummary,
|
|
255
|
-
buildOperatorShellWorkflowPack,
|
|
256
|
-
buildOperatorShellAdminPack
|
|
257
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const packageJson = require("../package.json");
|
|
4
|
-
|
|
5
|
-
function buildCryptoAgilityMatrixPack() {
|
|
6
|
-
return {
|
|
7
|
-
ok: true,
|
|
8
|
-
product: packageJson.name,
|
|
9
|
-
category: "naxytra-crypto-agility-matrix",
|
|
10
|
-
pack_version: "naxytra-crypto-agility-matrix-v1",
|
|
11
|
-
doctrine: "xytara_consumes_crypto_agility_rules_without_claiming_unverified_future_algorithms_as_core_truth",
|
|
12
|
-
model_state: "core_now",
|
|
13
|
-
core_claim: "the stack must be explicit about which algorithms are core today, supported today, future lane, blocked, or never core",
|
|
14
|
-
lane_classes: [
|
|
15
|
-
{
|
|
16
|
-
lane_class: "core_today",
|
|
17
|
-
description: "verified and claimable today",
|
|
18
|
-
items: [
|
|
19
|
-
"sha256_domain_separated_commitments",
|
|
20
|
-
"ed25519",
|
|
21
|
-
"secp256k1",
|
|
22
|
-
"p256",
|
|
23
|
-
"native_anchor_binding",
|
|
24
|
-
"line_rate_transport_frame"
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
lane_class: "supported_today",
|
|
29
|
-
description: "supported as interop or external verification lanes today",
|
|
30
|
-
items: [
|
|
31
|
-
"jwt",
|
|
32
|
-
"jws",
|
|
33
|
-
"jwk",
|
|
34
|
-
"did",
|
|
35
|
-
"vc",
|
|
36
|
-
"sd_jwt_vc",
|
|
37
|
-
"webauthn_cose_when_verifier_present"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
lane_class: "future_lane",
|
|
42
|
-
description: "explicit future cryptographic direction, not claimable as the current core",
|
|
43
|
-
items: [
|
|
44
|
-
"ml_dsa",
|
|
45
|
-
"slh_dsa",
|
|
46
|
-
"xoonya_native_hybrid_v1",
|
|
47
|
-
"xoonya_native_atom_v2"
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
lane_class: "blocked_until_vectors",
|
|
52
|
-
description: "not claimable until validators and vectors exist",
|
|
53
|
-
items: [
|
|
54
|
-
"webauthn_cose",
|
|
55
|
-
"dilithium",
|
|
56
|
-
"falcon",
|
|
57
|
-
"sphincs_plus"
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
lane_class: "never_core",
|
|
62
|
-
description: "must never become implicit or silent core behavior",
|
|
63
|
-
items: [
|
|
64
|
-
"silent_algorithm_negotiation",
|
|
65
|
-
"implicit_downgrade",
|
|
66
|
-
"unversioned_signature_assumptions",
|
|
67
|
-
"hidden_verifier_boundaries"
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
signature_suites: [
|
|
72
|
-
{ suite_id: "ed25519", state: "core_today" },
|
|
73
|
-
{ suite_id: "secp256k1", state: "core_today" },
|
|
74
|
-
{ suite_id: "p256", state: "core_today" },
|
|
75
|
-
{ suite_id: "webauthn-cose", state: "blocked_until_vectors" },
|
|
76
|
-
{ suite_id: "dilithium", state: "blocked_until_vectors" },
|
|
77
|
-
{ suite_id: "falcon", state: "blocked_until_vectors" },
|
|
78
|
-
{ suite_id: "sphincs-plus", state: "blocked_until_vectors" },
|
|
79
|
-
{ suite_id: "ml-dsa", state: "future_lane" },
|
|
80
|
-
{ suite_id: "slh-dsa", state: "future_lane" }
|
|
81
|
-
],
|
|
82
|
-
proof_envelope_rules: [
|
|
83
|
-
"signature_suite_must_be_explicit",
|
|
84
|
-
"unsupported_suites_must_not_be_claimed_as_verified",
|
|
85
|
-
"native_proof_methods_remain_optional",
|
|
86
|
-
"envelopes_must_not_redefine_receipt_validity",
|
|
87
|
-
"envelope_claims_must_stay_bounded_to_verified_behavior"
|
|
88
|
-
],
|
|
89
|
-
linked_surfaces: {
|
|
90
|
-
native_standard_ref: "/v1/proof-center/native-standard",
|
|
91
|
-
native_standard_summary_ref: "/v1/proof-center/native-standard/summary",
|
|
92
|
-
native_atom_spec_ref: "/v1/proof-center/native-atom-spec",
|
|
93
|
-
native_payload_profile_ref: "/v1/proof-center/native-payload-profile",
|
|
94
|
-
native_anchor_profile_ref: "/v1/proof-center/native-anchor-profile"
|
|
95
|
-
},
|
|
96
|
-
claim_boundary: "claim_the_crypto_agility_policy_for_xytara_only_without_claiming_unverified_future_algorithms_as_current_core_truth"
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function summarizeCryptoAgilityMatrixPack() {
|
|
101
|
-
const pack = buildCryptoAgilityMatrixPack();
|
|
102
|
-
return {
|
|
103
|
-
ok: true,
|
|
104
|
-
product: pack.product,
|
|
105
|
-
category: pack.category,
|
|
106
|
-
summary_version: "naxytra-crypto-agility-matrix-summary-v1",
|
|
107
|
-
pack_version: pack.pack_version,
|
|
108
|
-
model_state: pack.model_state,
|
|
109
|
-
lane_class_count: pack.lane_classes.length,
|
|
110
|
-
signature_suite_count: pack.signature_suites.length,
|
|
111
|
-
rule_count: pack.proof_envelope_rules.length,
|
|
112
|
-
linked_surfaces: pack.linked_surfaces
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function getCryptoAgilitySuiteDetail(suiteId) {
|
|
117
|
-
const normalized = String(suiteId || "").trim().toLowerCase();
|
|
118
|
-
return (buildCryptoAgilityMatrixPack().signature_suites || []).find((entry) => entry.suite_id === normalized) || null;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
module.exports = {
|
|
122
|
-
buildCryptoAgilityMatrixPack,
|
|
123
|
-
summarizeCryptoAgilityMatrixPack,
|
|
124
|
-
getCryptoAgilitySuiteDetail
|
|
125
|
-
};
|