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
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const { createServer } = require("../server");
|
|
5
|
-
const {
|
|
6
|
-
buildProviderLanePack,
|
|
7
|
-
getProviderProfileDetail,
|
|
8
|
-
summarizeProviderLanePack
|
|
9
|
-
} = require("../lib/provider_lane_contract");
|
|
10
|
-
|
|
11
|
-
async function getJson(baseUrl, path) {
|
|
12
|
-
const response = await fetch(`${baseUrl}${path}`);
|
|
13
|
-
return {
|
|
14
|
-
status: response.status,
|
|
15
|
-
json: await response.json()
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function main() {
|
|
20
|
-
const previousExecutionTargets = process.env.XYTARA_EXECUTION_TARGETS_JSON;
|
|
21
|
-
process.env.XYTARA_EXECUTION_TARGETS_JSON = JSON.stringify([
|
|
22
|
-
{
|
|
23
|
-
target_id: "verify-provider-runtime-mcp-target",
|
|
24
|
-
task_ref: "adapter.mcp.invoke",
|
|
25
|
-
endpoint_url: "http://127.0.0.1:65535/execute",
|
|
26
|
-
provider: "xytara_mcp_executor",
|
|
27
|
-
tool_name: "summarize",
|
|
28
|
-
auth_token: "verify-provider-runtime-bearer",
|
|
29
|
-
timeout_ms: 1500,
|
|
30
|
-
enabled: true
|
|
31
|
-
}
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
const pack = buildProviderLanePack();
|
|
35
|
-
const summary = summarizeProviderLanePack();
|
|
36
|
-
assert.strictEqual(pack.ok, true, "provider lane pack ok flag missing");
|
|
37
|
-
assert.strictEqual(summary.ok, true, "provider lane summary ok flag missing");
|
|
38
|
-
assert.strictEqual(pack.category, "machine-commerce-provider-lane-pack", "provider lane category mismatch");
|
|
39
|
-
assert.strictEqual(pack.pack_version, "xytara-provider-lane-pack-v2", "provider lane version mismatch");
|
|
40
|
-
assert.strictEqual(summary.summary_version, "xytara-provider-lane-pack-summary-v2", "provider lane summary version mismatch");
|
|
41
|
-
assert.strictEqual(summary.provider_profile_count >= 2, true, "provider profile count missing");
|
|
42
|
-
assert.strictEqual(summary.first_party_callable_profile_count >= 2, true, "provider callable profile count missing");
|
|
43
|
-
assert.strictEqual(summary.revenue_ready_profile_count >= 2, true, "provider revenue-ready profile count missing");
|
|
44
|
-
assert.strictEqual(summary.provider_live_anchor_profile_count >= 1, true, "provider live-anchor profile count missing");
|
|
45
|
-
assert.strictEqual(summary.proof_followthrough_profile_count >= 2, true, "provider proof-followthrough profile count missing");
|
|
46
|
-
|
|
47
|
-
const openaiProfile = getProviderProfileDetail("openai_codex");
|
|
48
|
-
const claudeProfile = getProviderProfileDetail("claude_mcp");
|
|
49
|
-
assert.strictEqual(Boolean(openaiProfile), true, "openai provider profile missing");
|
|
50
|
-
assert.strictEqual(Boolean(claudeProfile), true, "claude provider profile missing");
|
|
51
|
-
assert.strictEqual(openaiProfile.revenue_ready, true, "openai provider revenue readiness missing");
|
|
52
|
-
assert.strictEqual(claudeProfile.provider_live_anchor_ready, true, "claude provider live anchor readiness missing");
|
|
53
|
-
assert.strictEqual(claudeProfile.runtime_gates.promotion_ready, true, "claude provider promotion readiness missing");
|
|
54
|
-
|
|
55
|
-
const server = createServer();
|
|
56
|
-
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
57
|
-
const address = server.address();
|
|
58
|
-
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const providerLane = await getJson(baseUrl, "/v1/providers");
|
|
62
|
-
assert.strictEqual(providerLane.status, 200, "provider lane route failed");
|
|
63
|
-
assert.strictEqual(providerLane.json.ok, true, "provider lane route ok flag missing");
|
|
64
|
-
assert.strictEqual(providerLane.json.provider_profile_count >= 2, true, "provider lane route profile count missing");
|
|
65
|
-
assert.strictEqual(providerLane.json.provider_live_anchor_profile_count >= 1, true, "provider lane route live-anchor count missing");
|
|
66
|
-
assert.strictEqual(providerLane.json.revenue_ready_profile_count >= 2, true, "provider lane route revenue-ready count missing");
|
|
67
|
-
|
|
68
|
-
const providerLaneSummary = await getJson(baseUrl, "/v1/providers/summary");
|
|
69
|
-
assert.strictEqual(providerLaneSummary.status, 200, "provider lane summary route failed");
|
|
70
|
-
assert.strictEqual(providerLaneSummary.json.ok, true, "provider lane summary route ok flag missing");
|
|
71
|
-
assert.strictEqual(providerLaneSummary.json.provider_profile_count >= 2, true, "provider lane summary profile count missing");
|
|
72
|
-
assert.strictEqual(providerLaneSummary.json.provider_live_anchor_profile_count >= 1, true, "provider lane summary live-anchor count missing");
|
|
73
|
-
assert.strictEqual(providerLaneSummary.json.revenue_ready_profile_count >= 2, true, "provider lane summary revenue-ready count missing");
|
|
74
|
-
|
|
75
|
-
const openaiDetail = await getJson(baseUrl, "/v1/providers/openai_codex");
|
|
76
|
-
assert.strictEqual(openaiDetail.status, 200, "openai provider detail route failed");
|
|
77
|
-
assert.strictEqual(openaiDetail.json.provider.provider_id, "openai_codex", "openai provider detail id mismatch");
|
|
78
|
-
assert.strictEqual(openaiDetail.json.provider.runtime_gates.machine_entry_ready, true, "openai provider machine-entry gate missing");
|
|
79
|
-
assert.strictEqual(openaiDetail.json.provider.runtime_gates.paid_execution_ready, true, "openai provider paid-execution gate missing");
|
|
80
|
-
|
|
81
|
-
const claudeDetail = await getJson(baseUrl, "/v1/providers/claude_mcp");
|
|
82
|
-
assert.strictEqual(claudeDetail.status, 200, "claude provider detail route failed");
|
|
83
|
-
assert.strictEqual(claudeDetail.json.provider.provider_id, "claude_mcp", "claude provider detail id mismatch");
|
|
84
|
-
assert.strictEqual(claudeDetail.json.provider.provider_live_anchor_ready, true, "claude provider live-anchor detail missing");
|
|
85
|
-
assert.strictEqual(claudeDetail.json.provider.runtime_gates.adapter_depth_ready, true, "claude provider adapter-depth gate missing");
|
|
86
|
-
assert.strictEqual(claudeDetail.json.provider.runtime_gates.trace_ready, true, "claude provider trace gate missing");
|
|
87
|
-
} finally {
|
|
88
|
-
await new Promise((resolve) => server.close(resolve));
|
|
89
|
-
if (previousExecutionTargets === undefined) delete process.env.XYTARA_EXECUTION_TARGETS_JSON;
|
|
90
|
-
else process.env.XYTARA_EXECUTION_TARGETS_JSON = previousExecutionTargets;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
process.stdout.write(`${JSON.stringify({
|
|
94
|
-
ok: true,
|
|
95
|
-
product: "xytara",
|
|
96
|
-
category: "xytara-provider-runtime-breadth-verification",
|
|
97
|
-
provider_profile_count: summary.provider_profile_count,
|
|
98
|
-
provider_live_anchor_profile_count: summary.provider_live_anchor_profile_count,
|
|
99
|
-
first_party_callable_profile_count: summary.first_party_callable_profile_count,
|
|
100
|
-
revenue_ready_profile_count: summary.revenue_ready_profile_count,
|
|
101
|
-
proof_followthrough_profile_count: summary.proof_followthrough_profile_count,
|
|
102
|
-
boundary: "provider_runtime_breadth_requires_named_provider_profiles_with_bounded_entry_surfaces_and_public_runtime_gates"
|
|
103
|
-
}, null, 2)}\n`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
main().catch((error) => {
|
|
107
|
-
console.error(error && error.stack ? error.stack : error);
|
|
108
|
-
process.exit(1);
|
|
109
|
-
});
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const { createServer } = require("../server");
|
|
5
|
-
const {
|
|
6
|
-
buildProviderRuntimeJourneyPack,
|
|
7
|
-
getProviderRuntimeJourneyDetail,
|
|
8
|
-
summarizeProviderRuntimeJourneyPack
|
|
9
|
-
} = require("../lib/provider_runtime_journey_contract");
|
|
10
|
-
|
|
11
|
-
async function getJson(baseUrl, path) {
|
|
12
|
-
const response = await fetch(`${baseUrl}${path}`);
|
|
13
|
-
return {
|
|
14
|
-
status: response.status,
|
|
15
|
-
json: await response.json()
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function main() {
|
|
20
|
-
const previousExecutionTargets = process.env.XYTARA_EXECUTION_TARGETS_JSON;
|
|
21
|
-
process.env.XYTARA_EXECUTION_TARGETS_JSON = JSON.stringify([
|
|
22
|
-
{
|
|
23
|
-
target_id: "verify-provider-journey-mcp-target",
|
|
24
|
-
task_ref: "adapter.mcp.invoke",
|
|
25
|
-
endpoint_url: "http://127.0.0.1:65535/execute",
|
|
26
|
-
provider: "xytara_mcp_executor",
|
|
27
|
-
tool_name: "summarize",
|
|
28
|
-
auth_token: "verify-provider-journey-bearer",
|
|
29
|
-
timeout_ms: 1500,
|
|
30
|
-
enabled: true
|
|
31
|
-
}
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
const pack = buildProviderRuntimeJourneyPack();
|
|
35
|
-
const summary = summarizeProviderRuntimeJourneyPack();
|
|
36
|
-
assert.strictEqual(pack.ok, true, "provider runtime journey pack ok flag missing");
|
|
37
|
-
assert.strictEqual(summary.ok, true, "provider runtime journey summary ok flag missing");
|
|
38
|
-
assert.strictEqual(pack.category, "machine-commerce-provider-runtime-journey-pack", "provider runtime journey category mismatch");
|
|
39
|
-
assert.strictEqual(summary.summary_version, "xytara-provider-runtime-journey-summary-v1", "provider runtime journey summary version mismatch");
|
|
40
|
-
assert.strictEqual(summary.journey_count >= 2, true, "provider runtime journey count missing");
|
|
41
|
-
assert.strictEqual(summary.first_run_ready_journey_count >= 2, true, "provider runtime first-run readiness count missing");
|
|
42
|
-
assert.strictEqual(summary.revenue_ready_journey_count >= 2, true, "provider runtime revenue-ready journey count missing");
|
|
43
|
-
assert.strictEqual(summary.proof_followthrough_journey_count >= 2, true, "provider runtime proof-followthrough journey count missing");
|
|
44
|
-
assert.strictEqual(summary.provider_live_anchor_journey_count >= 1, true, "provider runtime provider-live anchor journey count missing");
|
|
45
|
-
|
|
46
|
-
const openaiJourney = getProviderRuntimeJourneyDetail("openai_codex");
|
|
47
|
-
const claudeJourney = getProviderRuntimeJourneyDetail("claude_mcp");
|
|
48
|
-
assert.strictEqual(Boolean(openaiJourney), true, "openai runtime journey missing");
|
|
49
|
-
assert.strictEqual(Boolean(claudeJourney), true, "claude runtime journey missing");
|
|
50
|
-
assert.strictEqual(openaiJourney.first_run_ready, true, "openai runtime journey first-run readiness missing");
|
|
51
|
-
assert.strictEqual(openaiJourney.proof_followthrough_ready, true, "openai runtime journey proof-followthrough missing");
|
|
52
|
-
assert.strictEqual(claudeJourney.provider_live_anchor_ready, true, "claude runtime journey provider-live anchor missing");
|
|
53
|
-
assert.strictEqual(claudeJourney.readiness_gates.promotion_ready, true, "claude runtime journey promotion readiness missing");
|
|
54
|
-
|
|
55
|
-
const server = createServer();
|
|
56
|
-
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
57
|
-
const address = server.address();
|
|
58
|
-
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const journeyPack = await getJson(baseUrl, "/v1/providers/journeys");
|
|
62
|
-
assert.strictEqual(journeyPack.status, 200, "provider runtime journeys route failed");
|
|
63
|
-
assert.strictEqual(journeyPack.json.ok, true, "provider runtime journeys route ok flag missing");
|
|
64
|
-
assert.strictEqual(journeyPack.json.journey_count >= 2, true, "provider runtime journeys route count missing");
|
|
65
|
-
|
|
66
|
-
const journeySummary = await getJson(baseUrl, "/v1/providers/journeys/summary");
|
|
67
|
-
assert.strictEqual(journeySummary.status, 200, "provider runtime journeys summary route failed");
|
|
68
|
-
assert.strictEqual(journeySummary.json.ok, true, "provider runtime journeys summary ok flag missing");
|
|
69
|
-
assert.strictEqual(journeySummary.json.first_run_ready_journey_count >= 2, true, "provider runtime journeys summary first-run count missing");
|
|
70
|
-
assert.strictEqual(journeySummary.json.revenue_ready_journey_count >= 2, true, "provider runtime journeys summary revenue-ready count missing");
|
|
71
|
-
|
|
72
|
-
const openaiDetail = await getJson(baseUrl, "/v1/providers/journeys/openai_codex");
|
|
73
|
-
assert.strictEqual(openaiDetail.status, 200, "openai runtime journey detail route failed");
|
|
74
|
-
assert.strictEqual(openaiDetail.json.journey.provider_id, "openai_codex", "openai runtime journey detail id mismatch");
|
|
75
|
-
assert.strictEqual(
|
|
76
|
-
openaiDetail.json.journey.stages.some((entry) => entry.stage_id === "quote"),
|
|
77
|
-
true,
|
|
78
|
-
"openai runtime journey quote stage missing"
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
const claudeDetail = await getJson(baseUrl, "/v1/providers/journeys/claude_mcp");
|
|
82
|
-
assert.strictEqual(claudeDetail.status, 200, "claude runtime journey detail route failed");
|
|
83
|
-
assert.strictEqual(claudeDetail.json.journey.provider_id, "claude_mcp", "claude runtime journey detail id mismatch");
|
|
84
|
-
assert.strictEqual(
|
|
85
|
-
claudeDetail.json.journey.stages.some((entry) => entry.stage_id === "execute"),
|
|
86
|
-
true,
|
|
87
|
-
"claude runtime journey execute stage missing"
|
|
88
|
-
);
|
|
89
|
-
} finally {
|
|
90
|
-
await new Promise((resolve) => server.close(resolve));
|
|
91
|
-
if (previousExecutionTargets === undefined) delete process.env.XYTARA_EXECUTION_TARGETS_JSON;
|
|
92
|
-
else process.env.XYTARA_EXECUTION_TARGETS_JSON = previousExecutionTargets;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
process.stdout.write(`${JSON.stringify({
|
|
96
|
-
ok: true,
|
|
97
|
-
product: "xytara",
|
|
98
|
-
category: "xytara-provider-runtime-journey-verification",
|
|
99
|
-
journey_count: summary.journey_count,
|
|
100
|
-
first_run_ready_journey_count: summary.first_run_ready_journey_count,
|
|
101
|
-
revenue_ready_journey_count: summary.revenue_ready_journey_count,
|
|
102
|
-
proof_followthrough_journey_count: summary.proof_followthrough_journey_count,
|
|
103
|
-
provider_live_anchor_journey_count: summary.provider_live_anchor_journey_count,
|
|
104
|
-
boundary: "provider_runtime_journeys_require_named_quote_fund_execute_prove_paths_with_bounded_provider_claims"
|
|
105
|
-
}, null, 2)}\n`);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
main().catch((error) => {
|
|
109
|
-
console.error(error && error.stack ? error.stack : error);
|
|
110
|
-
process.exit(1);
|
|
111
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Verifies the in-memory fixed-window rate limiter (lib/rate_limiter.js) used to
|
|
4
|
-
// gate the L402 invoice-creating path. Offline, no network, no timers waited on.
|
|
5
|
-
|
|
6
|
-
const assert = require("assert");
|
|
7
|
-
const { createRateLimiter } = require("../lib/rate_limiter");
|
|
8
|
-
|
|
9
|
-
function main() {
|
|
10
|
-
// Per-key ceiling: first `max` hits allowed, the next denied with scope "key".
|
|
11
|
-
const rl = createRateLimiter({ windowMs: 60000, max: 3, maxGlobal: 100 });
|
|
12
|
-
assert.strictEqual(rl.check("1.1.1.1").allowed, true);
|
|
13
|
-
assert.strictEqual(rl.check("1.1.1.1").allowed, true);
|
|
14
|
-
const third = rl.check("1.1.1.1");
|
|
15
|
-
assert.strictEqual(third.allowed, true);
|
|
16
|
-
assert.strictEqual(third.remaining, 0);
|
|
17
|
-
const denied = rl.check("1.1.1.1");
|
|
18
|
-
assert.strictEqual(denied.allowed, false);
|
|
19
|
-
assert.strictEqual(denied.scope, "key");
|
|
20
|
-
assert.ok(denied.retryAfterMs > 0 && denied.retryAfterMs <= 60000);
|
|
21
|
-
|
|
22
|
-
// A different key is independent (not affected by another key's exhaustion).
|
|
23
|
-
assert.strictEqual(rl.check("2.2.2.2").allowed, true);
|
|
24
|
-
|
|
25
|
-
// Denied hits are not counted, so they cannot push the reset further out or
|
|
26
|
-
// starve a key beyond its window (no self-inflicted lockout extension).
|
|
27
|
-
assert.strictEqual(rl.check("1.1.1.1").allowed, false);
|
|
28
|
-
|
|
29
|
-
// Global ceiling: once the global budget is spent, a fresh key is still denied
|
|
30
|
-
// with scope "global" (maxGlobal >= max always, so set them equal to exercise it
|
|
31
|
-
// across distinct keys before any single key is exhausted).
|
|
32
|
-
const g = createRateLimiter({ windowMs: 60000, max: 2, maxGlobal: 2 });
|
|
33
|
-
assert.strictEqual(g.check("a").allowed, true); // global 1, key a 1
|
|
34
|
-
assert.strictEqual(g.check("b").allowed, true); // global 2, key b 1
|
|
35
|
-
const gDenied = g.check("c"); // global budget spent, key c untouched
|
|
36
|
-
assert.strictEqual(gDenied.allowed, false);
|
|
37
|
-
assert.strictEqual(gDenied.scope, "global");
|
|
38
|
-
|
|
39
|
-
// reset() clears all buckets.
|
|
40
|
-
g.reset();
|
|
41
|
-
assert.strictEqual(g.check("c").allowed, true);
|
|
42
|
-
|
|
43
|
-
// Config is clamped to sane floors.
|
|
44
|
-
const clamped = createRateLimiter({ windowMs: 1, max: 0, maxGlobal: 0 });
|
|
45
|
-
assert.ok(clamped.config.windowMs >= 1000);
|
|
46
|
-
assert.ok(clamped.config.max >= 1);
|
|
47
|
-
assert.ok(clamped.config.maxGlobal >= clamped.config.max);
|
|
48
|
-
|
|
49
|
-
console.log("verify_rate_limiter: all rate limiter checks passed");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
main();
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Verifies credit-based refund settlement: POST /v1/refunds/<id>/settle-credit returns
|
|
4
|
-
// value to the paying account as re-spendable CREDITS (never an autonomous outbound
|
|
5
|
-
// transfer). Covers: credit-bridge auth is mandatory (403 unset/wrong), refund_units is
|
|
6
|
-
// required (400), the account balance actually increases by the credited units, the
|
|
7
|
-
// operation is idempotent per refund (no double-mint on replay), a terminal refund
|
|
8
|
-
// cannot be re-settled, and the existing refund-action route is unchanged (non-breaking).
|
|
9
|
-
|
|
10
|
-
const assert = require("assert");
|
|
11
|
-
const http = require("http");
|
|
12
|
-
|
|
13
|
-
async function req(baseUrl, method, path, body, headers = {}) {
|
|
14
|
-
const res = await fetch(`${baseUrl}${path}`, {
|
|
15
|
-
method,
|
|
16
|
-
headers: { "content-type": "application/json", ...headers },
|
|
17
|
-
...(body !== undefined ? { body: JSON.stringify(body) } : {})
|
|
18
|
-
});
|
|
19
|
-
let json = null;
|
|
20
|
-
try { json = await res.json(); } catch (_) { json = null; }
|
|
21
|
-
return { status: res.status, json };
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function availableUnits(balanceJson) {
|
|
25
|
-
if (!balanceJson) return 0;
|
|
26
|
-
if (typeof balanceJson.available_units === "number") return balanceJson.available_units;
|
|
27
|
-
if (balanceJson.balance && typeof balanceJson.balance.available_units === "number") return balanceJson.balance.available_units;
|
|
28
|
-
if (balanceJson.lifecycle_totals && typeof balanceJson.lifecycle_totals.available_units === "number") return balanceJson.lifecycle_totals.available_units;
|
|
29
|
-
return 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function main() {
|
|
33
|
-
const prevToken = process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN;
|
|
34
|
-
const TOKEN = "test-credit-bridge-token";
|
|
35
|
-
process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN = TOKEN;
|
|
36
|
-
const auth = { authorization: `Bearer ${TOKEN}` };
|
|
37
|
-
|
|
38
|
-
delete require.cache[require.resolve("../server")];
|
|
39
|
-
const { createServer } = require("../server");
|
|
40
|
-
const server = createServer();
|
|
41
|
-
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
42
|
-
const baseUrl = `http://127.0.0.1:${server.address().port}`;
|
|
43
|
-
const ACCOUNT = "acct_refund_credit_test";
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
// Create a refund (operator case).
|
|
47
|
-
let r = await req(baseUrl, "POST", "/v1/refunds", { reason_code: "service_failure", note: "test", requested_by: "operator" });
|
|
48
|
-
assert.ok(r.json && r.json.refund && r.json.refund.refund_id, "refund created");
|
|
49
|
-
const refundId = r.json.refund.refund_id;
|
|
50
|
-
|
|
51
|
-
const before = availableUnits((await req(baseUrl, "GET", `/v1/economics/accounts/${ACCOUNT}/credit-balance`)).json);
|
|
52
|
-
|
|
53
|
-
// 1. Auth mandatory: no bearer -> 403.
|
|
54
|
-
r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50 });
|
|
55
|
-
assert.strictEqual(r.status, 403, "settle-credit without bearer must 403");
|
|
56
|
-
|
|
57
|
-
// 2. Wrong bearer -> 403.
|
|
58
|
-
r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50 }, { authorization: "Bearer wrong" });
|
|
59
|
-
assert.strictEqual(r.status, 403, "settle-credit with wrong bearer must 403");
|
|
60
|
-
|
|
61
|
-
// 3. refund_units required -> 400.
|
|
62
|
-
r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT }, auth);
|
|
63
|
-
assert.strictEqual(r.status, 400, "missing refund_units must 400");
|
|
64
|
-
assert.strictEqual(r.json.reason, "refund_units_required", "400 reason");
|
|
65
|
-
|
|
66
|
-
// 4. Authorized settle -> 200, credit minted, refund completed.
|
|
67
|
-
r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50, reason_code: "service_failure" }, auth);
|
|
68
|
-
assert.strictEqual(r.status, 200, "authorized settle-credit must 200");
|
|
69
|
-
assert.strictEqual(r.json.ok, true, "settle ok");
|
|
70
|
-
assert.strictEqual(r.json.units, 50, "credited units echoed");
|
|
71
|
-
assert.ok(r.json.credit_grant_id && r.json.credit_grant_id.startsWith("refund_credit_"), "idempotent grant id");
|
|
72
|
-
assert.strictEqual(r.json.refund.status, "completed", "refund marked completed");
|
|
73
|
-
|
|
74
|
-
// 5. Balance actually increased by the credited units.
|
|
75
|
-
const after = availableUnits((await req(baseUrl, "GET", `/v1/economics/accounts/${ACCOUNT}/credit-balance`)).json);
|
|
76
|
-
assert.strictEqual(after - before, 50, `balance must increase by 50 (before=${before}, after=${after})`);
|
|
77
|
-
|
|
78
|
-
// 6. Idempotent: a replayed settle must NOT mint twice.
|
|
79
|
-
r = await req(baseUrl, "POST", `/v1/refunds/${refundId}/settle-credit`, { account_id: ACCOUNT, refund_units: 50 }, auth);
|
|
80
|
-
assert.strictEqual(r.status, 200, "replay still 200");
|
|
81
|
-
assert.strictEqual(r.json.already_settled, true, "replay reports already_settled");
|
|
82
|
-
const afterReplay = availableUnits((await req(baseUrl, "GET", `/v1/economics/accounts/${ACCOUNT}/credit-balance`)).json);
|
|
83
|
-
assert.strictEqual(afterReplay, after, "replay must not mint credits twice");
|
|
84
|
-
|
|
85
|
-
// 7. A terminal (completed) refund cannot be re-settled under a fresh account.
|
|
86
|
-
// (Covered by idempotency above — the completed refund returns already_settled
|
|
87
|
-
// for the original grant rather than minting to a different account.)
|
|
88
|
-
|
|
89
|
-
// 8. Non-breaking: the existing refund-action route still works on a NEW refund.
|
|
90
|
-
const r2 = await req(baseUrl, "POST", "/v1/refunds", { reason_code: "other" });
|
|
91
|
-
const refundId2 = r2.json.refund.refund_id;
|
|
92
|
-
r = await req(baseUrl, "POST", `/v1/refunds/${refundId2}/actions`, { action: "review", note: "reviewing" });
|
|
93
|
-
assert.strictEqual(r.status, 200, "existing refund-action route still works");
|
|
94
|
-
assert.strictEqual(r.json.refund.status, "under_review", "action transitioned status");
|
|
95
|
-
|
|
96
|
-
console.log("xytara verify:refund-credit passed");
|
|
97
|
-
} finally {
|
|
98
|
-
await new Promise((resolve) => server.close(resolve));
|
|
99
|
-
if (prevToken === undefined) delete process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN; else process.env.XYTARA_CREDIT_BRIDGE_BEARER_TOKEN = prevToken;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
main().catch((error) => {
|
|
104
|
-
console.error(error && error.message ? error.message : error);
|
|
105
|
-
process.exitCode = 1;
|
|
106
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const {
|
|
5
|
-
buildRevenueLaunchPathPack,
|
|
6
|
-
getRevenueLaunchPathDetail,
|
|
7
|
-
summarizeRevenueLaunchPathPack
|
|
8
|
-
} = require("../lib/revenue_launch_path_contract");
|
|
9
|
-
const { createServer } = require("../server");
|
|
10
|
-
|
|
11
|
-
async function getJson(baseUrl, routePath) {
|
|
12
|
-
const response = await fetch(`${baseUrl}${routePath}`);
|
|
13
|
-
return {
|
|
14
|
-
status: response.status,
|
|
15
|
-
json: await response.json()
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function assertSummary(summary) {
|
|
20
|
-
assert.strictEqual(summary.ok, true, "summary should be ok");
|
|
21
|
-
assert.strictEqual(summary.path_count >= 3, true, "revenue launch path count missing");
|
|
22
|
-
assert.strictEqual(summary.first_money_in_path_count >= 2, true, "first money-in path count missing");
|
|
23
|
-
assert.strictEqual(summary.paid_execution_path_count >= 2, true, "paid execution path count missing");
|
|
24
|
-
assert.strictEqual(summary.proof_followthrough_path_count >= 3, true, "proof followthrough path count missing");
|
|
25
|
-
assert.strictEqual(summary.refund_or_reversal_path_count >= 2, true, "refund or reversal path count missing");
|
|
26
|
-
assert.strictEqual(summary.operator_reconciliation_path_count >= 3, true, "operator reconciliation path count missing");
|
|
27
|
-
assert.strictEqual(summary.hosted_checkout_path_count >= 2, true, "hosted checkout path count missing");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function assertPack(pack) {
|
|
31
|
-
assert.strictEqual(pack.ok, true, "pack should be ok");
|
|
32
|
-
assertSummary(pack);
|
|
33
|
-
assert.strictEqual(Array.isArray(pack.paths), true, "paths missing");
|
|
34
|
-
assert.strictEqual(Boolean(getRevenueLaunchPathDetail("hosted_checkout_credits_execution_proof")), true, "hosted checkout path missing");
|
|
35
|
-
assert.strictEqual(Boolean(getRevenueLaunchPathDetail("direct_x402_execution_proof")), true, "direct x402 path missing");
|
|
36
|
-
assert.strictEqual(Boolean(getRevenueLaunchPathDetail("refund_reversal_operator_reconciliation")), true, "refund reversal path missing");
|
|
37
|
-
assert.strictEqual(
|
|
38
|
-
pack.paths.every((entry) => Array.isArray(entry.required_operator_evidence) && entry.required_operator_evidence.length >= 4),
|
|
39
|
-
true,
|
|
40
|
-
"operator evidence requirements missing"
|
|
41
|
-
);
|
|
42
|
-
assert.strictEqual(
|
|
43
|
-
pack.paths.every((entry) => typeof entry.claim_boundary === "string" && entry.claim_boundary.includes("claim_")),
|
|
44
|
-
true,
|
|
45
|
-
"claim boundaries missing"
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function main() {
|
|
50
|
-
const pack = buildRevenueLaunchPathPack();
|
|
51
|
-
const summary = summarizeRevenueLaunchPathPack();
|
|
52
|
-
assertPack(pack);
|
|
53
|
-
assertSummary(summary);
|
|
54
|
-
|
|
55
|
-
const server = createServer();
|
|
56
|
-
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
57
|
-
const address = server.address();
|
|
58
|
-
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const packResponse = await getJson(baseUrl, "/v1/revenue-launch/paths");
|
|
62
|
-
assert.strictEqual(packResponse.status, 200, "revenue launch path pack route failed");
|
|
63
|
-
assertPack(packResponse.json);
|
|
64
|
-
|
|
65
|
-
const summaryResponse = await getJson(baseUrl, "/v1/revenue-launch/paths/summary");
|
|
66
|
-
assert.strictEqual(summaryResponse.status, 200, "revenue launch path summary route failed");
|
|
67
|
-
assertSummary(summaryResponse.json);
|
|
68
|
-
|
|
69
|
-
const hostedCheckoutResponse = await getJson(baseUrl, "/v1/revenue-launch/paths/hosted_checkout_credits_execution_proof");
|
|
70
|
-
assert.strictEqual(hostedCheckoutResponse.status, 200, "hosted checkout revenue launch detail failed");
|
|
71
|
-
assert.strictEqual(hostedCheckoutResponse.json.path.first_money_in_ready, true, "hosted checkout money-in readiness missing");
|
|
72
|
-
assert.strictEqual(hostedCheckoutResponse.json.path.refund_or_reversal_ready, true, "hosted checkout reversal readiness missing");
|
|
73
|
-
|
|
74
|
-
const directX402Response = await getJson(baseUrl, "/v1/revenue-launch/paths/direct_x402_execution_proof");
|
|
75
|
-
assert.strictEqual(directX402Response.status, 200, "direct x402 revenue launch detail failed");
|
|
76
|
-
assert.strictEqual(directX402Response.json.path.paid_execution_ready, true, "direct x402 paid execution readiness missing");
|
|
77
|
-
assert.strictEqual(directX402Response.json.path.proof_followthrough_ready, true, "direct x402 proof readiness missing");
|
|
78
|
-
|
|
79
|
-
const reversalResponse = await getJson(baseUrl, "/v1/revenue-launch/paths/refund_reversal_operator_reconciliation");
|
|
80
|
-
assert.strictEqual(reversalResponse.status, 200, "refund reversal revenue launch detail failed");
|
|
81
|
-
assert.strictEqual(reversalResponse.json.path.refund_or_reversal_ready, true, "refund reversal readiness missing");
|
|
82
|
-
assert.strictEqual(reversalResponse.json.path.operator_reconciliation_ready, true, "refund reversal operator reconciliation missing");
|
|
83
|
-
} finally {
|
|
84
|
-
await new Promise((resolve) => server.close(resolve));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
console.log(JSON.stringify({
|
|
88
|
-
ok: true,
|
|
89
|
-
product: "xytara",
|
|
90
|
-
category: "machine-commerce-revenue-launch-path-verification",
|
|
91
|
-
verification_version: "xytara-revenue-launch-path-verification-v1",
|
|
92
|
-
path_count: summary.path_count,
|
|
93
|
-
first_money_in_path_count: summary.first_money_in_path_count,
|
|
94
|
-
paid_execution_path_count: summary.paid_execution_path_count,
|
|
95
|
-
proof_followthrough_path_count: summary.proof_followthrough_path_count,
|
|
96
|
-
refund_or_reversal_path_count: summary.refund_or_reversal_path_count,
|
|
97
|
-
operator_reconciliation_path_count: summary.operator_reconciliation_path_count,
|
|
98
|
-
boundary: "day_one_revenue_launch_claims_require_money_in_paid_execution_proof_reversal_and_operator_reconciliation_paths"
|
|
99
|
-
}, null, 2));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
main().catch((error) => {
|
|
103
|
-
console.error(error);
|
|
104
|
-
process.exit(1);
|
|
105
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("assert");
|
|
4
|
-
const { once } = require("events");
|
|
5
|
-
const { createServer } = require("../server");
|
|
6
|
-
|
|
7
|
-
async function getJson(baseUrl, pathname) {
|
|
8
|
-
const response = await fetch(`${baseUrl}${pathname}`);
|
|
9
|
-
return {
|
|
10
|
-
status: response.status,
|
|
11
|
-
json: await response.json()
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async function main() {
|
|
16
|
-
const server = createServer();
|
|
17
|
-
server.listen(0, "127.0.0.1");
|
|
18
|
-
await once(server, "listening");
|
|
19
|
-
|
|
20
|
-
const address = server.address();
|
|
21
|
-
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const summary = await getJson(baseUrl, "/v1/runtime/durability/summary");
|
|
25
|
-
assert.strictEqual(summary.status, 200, "runtime durability summary route failed");
|
|
26
|
-
assert.strictEqual(summary.json.ok, true, "runtime durability summary ok flag missing");
|
|
27
|
-
assert.strictEqual(summary.json.category, "xytara-runtime-durability-summary", "runtime durability summary category missing");
|
|
28
|
-
assert.strictEqual(typeof summary.json.recovery_posture, "string", "runtime durability summary posture missing");
|
|
29
|
-
assert.strictEqual(typeof summary.json.blocker_count, "number", "runtime durability summary blocker count missing");
|
|
30
|
-
assert.strictEqual(Array.isArray(summary.json.blockers), true, "runtime durability summary blockers missing");
|
|
31
|
-
assert.strictEqual(summary.json.blocker_count, summary.json.blockers.length, "runtime durability summary blocker count mismatch");
|
|
32
|
-
assert.strictEqual(typeof summary.json.enabled, "boolean", "runtime durability summary enabled flag missing");
|
|
33
|
-
assert.strictEqual(typeof summary.json.inspect_ref, "string", "runtime durability summary inspect ref missing");
|
|
34
|
-
|
|
35
|
-
console.log(JSON.stringify({
|
|
36
|
-
ok: true,
|
|
37
|
-
product: "xytara",
|
|
38
|
-
category: "machine-commerce-runtime-durability-summary-verification",
|
|
39
|
-
verification_version: "xytara-runtime-durability-summary-verification-v1",
|
|
40
|
-
blocker_count: summary.json.blocker_count,
|
|
41
|
-
recovery_posture: summary.json.recovery_posture,
|
|
42
|
-
boundary: "runtime_durability_summary_should_be_publicly_inspectable_and_counted"
|
|
43
|
-
}, null, 2));
|
|
44
|
-
} finally {
|
|
45
|
-
server.close();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
main().catch((error) => {
|
|
50
|
-
console.error(error && error.stack ? error.stack : error);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
});
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Verifies the runtime-state WRITE GUARD: when the boot-time restore fails (backend 504), the store
|
|
4
|
-
// must never write (a write would overwrite the good snapshot with near-empty state). It retries the
|
|
5
|
-
// restore, merges the durable snapshot under whatever happened since boot, and only then writes.
|
|
6
|
-
|
|
7
|
-
const assert = require("assert");
|
|
8
|
-
const http = require("http");
|
|
9
|
-
const { createRuntimeStateStore } = require("../lib/runtime_state_store");
|
|
10
|
-
|
|
11
|
-
function startFakeSupabase() {
|
|
12
|
-
const calls = { get: 0, post: 0, lastPostBody: null, keys: [] };
|
|
13
|
-
let failReads = true;
|
|
14
|
-
const durable = {
|
|
15
|
-
providerRegistry: { __runtime_state_kind: "Map", value: [["mcp_executor", { provider_id: "mcp_executor", status: "active" }]] },
|
|
16
|
-
providerPayouts: [{ payout_id: "provpay_1", status: "settled" }],
|
|
17
|
-
acceptedPaymentNonces: { __runtime_state_kind: "Set", value: ["n_old"] }
|
|
18
|
-
};
|
|
19
|
-
const server = http.createServer((req, res) => {
|
|
20
|
-
let body = "";
|
|
21
|
-
req.on("data", (chunk) => { body += chunk; });
|
|
22
|
-
req.on("end", () => {
|
|
23
|
-
if (req.method === "GET") {
|
|
24
|
-
calls.get += 1;
|
|
25
|
-
if (failReads) { res.writeHead(504, { "content-type": "application/json" }); res.end('{"message":"Gateway Timeout"}'); return; }
|
|
26
|
-
res.writeHead(200, { "content-type": "application/json" });
|
|
27
|
-
res.end(JSON.stringify([{ snapshot: durable, persisted_at_iso: "2026-10-17T00:00:00.000Z" }]));
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
calls.post += 1;
|
|
31
|
-
calls.lastPostBody = JSON.parse(body);
|
|
32
|
-
calls.keys.push(calls.lastPostBody[0].state_key);
|
|
33
|
-
res.writeHead(201); res.end();
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
return new Promise((resolve) => server.listen(0, "127.0.0.1", () => resolve({ server, calls, recover: () => { failReads = false; } })));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function main() {
|
|
40
|
-
const fake = await startFakeSupabase();
|
|
41
|
-
const store = createRuntimeStateStore({
|
|
42
|
-
supabaseUrl: `http://127.0.0.1:${fake.server.address().port}`,
|
|
43
|
-
supabaseServiceRoleKey: "test-key",
|
|
44
|
-
intervalMs: 1000
|
|
45
|
-
});
|
|
46
|
-
const state = { providerRegistry: new Map(), providerPayouts: [], acceptedPaymentNonces: new Set() };
|
|
47
|
-
try {
|
|
48
|
-
// 1. Boot restore fails (504) -> writes locked.
|
|
49
|
-
await assert.rejects(() => store.load(state), /504/, "boot restore surfaces the 504");
|
|
50
|
-
assert.strictEqual(store.restoreConfirmed(), false, "writes locked after a failed restore");
|
|
51
|
-
assert.strictEqual(store.inspect().writes_locked_until_restore, true, "inspect reports the lock");
|
|
52
|
-
|
|
53
|
-
// 2. The process keeps serving on empty state; a post-boot write lands in memory.
|
|
54
|
-
state.acceptedPaymentNonces.add("n_new");
|
|
55
|
-
state.providerPayouts.push({ payout_id: "provpay_2", status: "pending" });
|
|
56
|
-
store.markDirty();
|
|
57
|
-
assert.strictEqual(await store.flush(state), false, "flush refused while the restore is unconfirmed");
|
|
58
|
-
assert.strictEqual(fake.calls.post, 0, "NOTHING was written over the durable snapshot");
|
|
59
|
-
|
|
60
|
-
// 3. The interval retries the restore while the backend still fails: still no write.
|
|
61
|
-
let restoredCallback = false;
|
|
62
|
-
store.start(state, () => { restoredCallback = true; });
|
|
63
|
-
await new Promise((r) => setTimeout(r, 2300));
|
|
64
|
-
assert.ok(fake.calls.get >= 2, "restore retried in the background");
|
|
65
|
-
assert.strictEqual(fake.calls.post, 0, "still no write while the backend is down");
|
|
66
|
-
|
|
67
|
-
// 4. Backend recovers: restore merges the snapshot UNDER the post-boot changes, then writes.
|
|
68
|
-
fake.recover();
|
|
69
|
-
await new Promise((r) => setTimeout(r, 2600));
|
|
70
|
-
assert.strictEqual(restoredCallback, true, "onRestored fired");
|
|
71
|
-
assert.strictEqual(store.restoreConfirmed(), true, "writes unlocked after a successful restore");
|
|
72
|
-
assert.strictEqual(state.providerRegistry.get("mcp_executor").status, "active", "durable provider restored");
|
|
73
|
-
assert.ok(state.acceptedPaymentNonces.has("n_old") && state.acceptedPaymentNonces.has("n_new"), "nonce sets unioned");
|
|
74
|
-
assert.deepStrictEqual(state.providerPayouts.map((p) => p.payout_id), ["provpay_1", "provpay_2"], "ledger keeps durable + post-boot rows");
|
|
75
|
-
assert.ok(fake.calls.post >= 1, "the merged state is persisted once writes unlock");
|
|
76
|
-
const written = fake.calls.lastPostBody[0].snapshot;
|
|
77
|
-
assert.strictEqual(written.providerRegistry.value[0][0], "mcp_executor", "the write carries the restored provider (no clobber)");
|
|
78
|
-
|
|
79
|
-
// 5. Unchanged state is never rewritten (a read-only POST marks dirty but changes nothing).
|
|
80
|
-
const postsBefore = fake.calls.post;
|
|
81
|
-
store.markDirty();
|
|
82
|
-
assert.strictEqual(await store.flush(state), false, "unchanged snapshot skipped");
|
|
83
|
-
assert.strictEqual(fake.calls.post, postsBefore, "no write for an unchanged snapshot");
|
|
84
|
-
assert.ok(store.inspect().skipped_unchanged_writes >= 1, "skip counted");
|
|
85
|
-
state.acceptedPaymentNonces.add("n_newer");
|
|
86
|
-
store.markDirty();
|
|
87
|
-
assert.strictEqual(await store.flush(state), true, "a real change is written");
|
|
88
|
-
|
|
89
|
-
// 6. Rolling history copy: written alongside the main row, under a ::history:: key.
|
|
90
|
-
assert.ok(fake.calls.keys.some((key) => /^default::history::\d+$/.test(key)), "rolling history row written");
|
|
91
|
-
assert.ok(fake.calls.keys.includes("default"), "main row written");
|
|
92
|
-
assert.strictEqual(store.inspect().last_history_error, null, "history write succeeded");
|
|
93
|
-
await store.stop(state);
|
|
94
|
-
} finally {
|
|
95
|
-
fake.server.close();
|
|
96
|
-
}
|
|
97
|
-
// 7. Quote pruning: expired never-paid quotes older than the retention are dropped; executed and
|
|
98
|
-
// recent ones are kept.
|
|
99
|
-
const { pruneStaleQuotes } = require("../lib/commerce_quotes");
|
|
100
|
-
const day = 24 * 60 * 60 * 1000;
|
|
101
|
-
const now = Date.parse("2026-10-17T00:00:00.000Z");
|
|
102
|
-
const qs = { quotes: new Map([
|
|
103
|
-
["q_old_expired", { status: "expired", expires_at_iso: new Date(now - 10 * day).toISOString() }],
|
|
104
|
-
["q_recent_expired", { status: "expired", expires_at_iso: new Date(now - 2 * day).toISOString() }],
|
|
105
|
-
["q_old_executed", { status: "executed", transaction_id: "txn_1", expires_at_iso: new Date(now - 30 * day).toISOString() }],
|
|
106
|
-
["q_live", { status: "quoted", expires_at_iso: new Date(now + day).toISOString() }]
|
|
107
|
-
]) };
|
|
108
|
-
assert.strictEqual(pruneStaleQuotes(qs, now), 1, "exactly one stale quote pruned");
|
|
109
|
-
assert.deepStrictEqual(Array.from(qs.quotes.keys()).sort(), ["q_live", "q_old_executed", "q_recent_expired"], "executed / recent / live quotes kept");
|
|
110
|
-
|
|
111
|
-
console.log("xytara verify:runtime-state-guard passed");
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
main().catch((error) => {
|
|
115
|
-
console.error(error && error.message ? error.message : error);
|
|
116
|
-
process.exitCode = 1;
|
|
117
|
-
});
|