xytara 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.env.example +29 -0
  2. package/BSV_TERANODE_SETUP.md +43 -0
  3. package/README.md +66 -7
  4. package/REAL_PAYMENT_SETUP.md +61 -0
  5. package/RELEASE_NOTES.md +12 -6
  6. package/SERVICE_CONTRACT.md +31 -0
  7. package/START_HERE.md +107 -6
  8. package/TREASURY_DESTINATIONS.example.json +66 -0
  9. package/TREASURY_DESTINATIONS.production.template.json +108 -0
  10. package/adapters/examples/langchain-reference-execution-adapter.js +81 -0
  11. package/adapters/examples/langchain-reference-execution-adapter.manifest.json +79 -0
  12. package/adapters/examples/langgraph-reference-execution-adapter.js +81 -0
  13. package/adapters/examples/langgraph-reference-execution-adapter.manifest.json +79 -0
  14. package/bin/xytara-first-run.js +244 -0
  15. package/bin/xytara.js +30 -5
  16. package/integrations/dispatch.js +7 -2
  17. package/integrations/registry.js +123 -2
  18. package/lib/activity_audit_contract.js +322 -0
  19. package/lib/adapter_depth_contract.js +156 -0
  20. package/lib/bolt_lane_contract.js +55 -0
  21. package/lib/bolt_payment_front.js +172 -0
  22. package/lib/capability_execution_truth.js +269 -0
  23. package/lib/capability_registry.js +39 -2
  24. package/lib/checkout_event_security.js +142 -0
  25. package/lib/command_flow.js +169 -36
  26. package/lib/commerce_artifacts.js +23 -4
  27. package/lib/commerce_checkout.js +134 -4
  28. package/lib/commerce_client.js +20 -0
  29. package/lib/commerce_economics.js +109 -9
  30. package/lib/commerce_runtime.js +38 -2
  31. package/lib/commerce_shell.js +4 -2
  32. package/lib/external_execution_runtime.js +132 -0
  33. package/lib/go_live_operator_pack.js +339 -0
  34. package/lib/http_transport.js +32 -0
  35. package/lib/integration_matrix_contract.js +6 -0
  36. package/lib/l402_lane_contract.js +55 -0
  37. package/lib/l402_payment_front.js +192 -0
  38. package/lib/network_transport.js +110 -0
  39. package/lib/operator_intelligence.js +215 -1
  40. package/lib/payment_config.js +80 -3
  41. package/lib/payment_front_registry.js +53 -0
  42. package/lib/payment_protocol_contract.js +165 -0
  43. package/lib/payment_verification.js +23 -3
  44. package/lib/pricing_optimization_contract.js +556 -0
  45. package/lib/release_history.js +15 -0
  46. package/lib/request_rate_limit.js +144 -0
  47. package/lib/runtime_bridge.js +10 -2
  48. package/lib/runtime_operations_worker.js +282 -0
  49. package/lib/settlement_bsv_live.js +79 -4
  50. package/lib/stripe_mpp_lane_contract.js +3 -0
  51. package/lib/stripe_mpp_payment_front.js +158 -0
  52. package/lib/treasury_destinations_contract.js +543 -0
  53. package/lib/treasury_egress_policy_contract.js +91 -0
  54. package/package.json +14 -21
  55. package/server.js +627 -88
  56. package/OPERATIONS_RUNBOOK.md +0 -66
  57. package/OPERATOR_START_HERE.md +0 -63
  58. package/PROGRAM_COMPLETE_RELEASE.md +0 -63
  59. package/PROGRAM_STATUS.md +0 -57
  60. package/PUBLISH_PLAN.md +0 -14
  61. package/RELEASE_CHECKLIST.md +0 -16
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("path");
5
+ const { spawnSync } = require("child_process");
6
+
7
+ const DEFAULT_SERVICE_URL = "https://xytara.onrender.com";
8
+ const DEFAULT_KIT_URL = "https://www.naxytra.com/v1/first-run-kit";
9
+ const DEFAULT_TEXT = "Summarize the Naxytra first-run path in one sentence.";
10
+ const ACCOUNT_PLACEHOLDER = "ACCOUNT_REF";
11
+
12
+ function buildDefaultMcpBody(text) {
13
+ return {
14
+ tool_name: "summarize",
15
+ arguments: {
16
+ text
17
+ }
18
+ };
19
+ }
20
+
21
+ function parseArgs(argv) {
22
+ const args = {};
23
+ for (let index = 0; index < argv.length; index += 1) {
24
+ const token = argv[index];
25
+ if (!token.startsWith("--")) continue;
26
+ const key = token.slice(2);
27
+ const next = argv[index + 1];
28
+ if (!next || next.startsWith("--")) {
29
+ args[key] = true;
30
+ continue;
31
+ }
32
+ args[key] = next;
33
+ index += 1;
34
+ }
35
+ return args;
36
+ }
37
+
38
+ function buildLocalKit(args = {}) {
39
+ const serviceUrl = String(args.url || DEFAULT_SERVICE_URL).replace(/\/$/, "");
40
+ const account = String(args.account || ACCOUNT_PLACEHOLDER).trim();
41
+ const text = String(args.text || DEFAULT_TEXT);
42
+ const bodyJson = JSON.stringify(buildDefaultMcpBody(text));
43
+ const quoteCommand = [
44
+ "xytara-run",
45
+ "--url", serviceUrl,
46
+ "--account", account,
47
+ "--task", "adapter.mcp.invoke",
48
+ "--command", "mcp.invoke:summarize",
49
+ "--body-json", JSON.stringify(bodyJson),
50
+ "--quote-only",
51
+ "--pretty"
52
+ ].join(" ");
53
+ const creditsFirstCommand = [
54
+ "xytara",
55
+ "first-run",
56
+ "--execute-with-credits",
57
+ "--account", account,
58
+ "--pretty"
59
+ ].join(" ");
60
+ return {
61
+ ok: true,
62
+ product: "xytara",
63
+ category: "xytara-first-run-guide",
64
+ guide_version: "xytara-first-run-guide-v1",
65
+ public_command_kit_url: DEFAULT_KIT_URL,
66
+ recommended_public_mode: "quote_only_first_then_funded_execute_then_xoonya_proof",
67
+ safe_quote_command: quoteCommand,
68
+ credits_first_execute_command: creditsFirstCommand,
69
+ runnable_quote_command: account !== ACCOUNT_PLACEHOLDER,
70
+ runnable_credits_first_execute_command: account !== ACCOUNT_PLACEHOLDER,
71
+ proof_followthrough: [
72
+ "xoonya start-here",
73
+ "xoonya first-run --verify-native --pretty"
74
+ ],
75
+ boundaries: [
76
+ "quote_only_mode_needs_no_wallet_secret",
77
+ "funded_execution_needs_direct_payment_material_or_reusable_credits",
78
+ "proof_verification_continues_in_xoonya"
79
+ ]
80
+ };
81
+ }
82
+
83
+ async function fetchPublicKit(url) {
84
+ const response = await fetch(url, { headers: { accept: "application/json" } });
85
+ if (!response.ok) {
86
+ throw new Error(`first_run_kit_fetch_failed_${response.status}`);
87
+ }
88
+ return response.json();
89
+ }
90
+
91
+ async function postJson(url, payload) {
92
+ const response = await fetch(url, {
93
+ method: "POST",
94
+ headers: {
95
+ "content-type": "application/json",
96
+ accept: "application/json"
97
+ },
98
+ body: JSON.stringify(payload)
99
+ });
100
+ const text = await response.text();
101
+ let json = null;
102
+ try {
103
+ json = text ? JSON.parse(text) : null;
104
+ } catch (_) {
105
+ json = null;
106
+ }
107
+ return {
108
+ status: response.status,
109
+ ok: response.ok,
110
+ json,
111
+ text
112
+ };
113
+ }
114
+
115
+ function writeJson(payload, pretty) {
116
+ process.stdout.write(`${JSON.stringify(payload, null, pretty ? 2 : 0)}\n`);
117
+ }
118
+
119
+ function printUsage() {
120
+ process.stdout.write([
121
+ "Usage: xytara first-run [options]",
122
+ "",
123
+ "Options:",
124
+ " --json Print the guided first-run object",
125
+ " --offline Do not fetch the public command kit",
126
+ " --run-quote Execute the safe quote-only path",
127
+ " --execute-with-credits Execute the default task with account credits",
128
+ " --account ACCOUNT_REF Account ref for quote or credits-first execution",
129
+ ` --url <service_url> Xytara service URL, default ${DEFAULT_SERVICE_URL}`,
130
+ " --text <text> Text for the default summarize task",
131
+ " --pretty Pretty-print JSON output",
132
+ " --help Show this help message"
133
+ ].join("\n"));
134
+ }
135
+
136
+ function runQuote(args) {
137
+ const account = String(args.account || "").trim();
138
+ if (!account) {
139
+ throw new Error("account_required_for_run_quote");
140
+ }
141
+ const serviceUrl = String(args.url || DEFAULT_SERVICE_URL).replace(/\/$/, "");
142
+ const text = String(args.text || DEFAULT_TEXT);
143
+ const scriptPath = path.join(__dirname, "xytara-run.js");
144
+ const result = spawnSync(process.execPath, [
145
+ scriptPath,
146
+ "--url", serviceUrl,
147
+ "--account", account,
148
+ "--task", "adapter.mcp.invoke",
149
+ "--command", "mcp.invoke:summarize",
150
+ "--body-json", JSON.stringify(buildDefaultMcpBody(text)),
151
+ "--quote-only",
152
+ ...(args.pretty ? ["--pretty"] : [])
153
+ ], { stdio: "inherit" });
154
+ process.exitCode = typeof result.status === "number" ? result.status : 1;
155
+ }
156
+
157
+ async function executeWithCredits(args) {
158
+ const account = String(args.account || "").trim();
159
+ if (!account) {
160
+ throw new Error("account_required_for_execute_with_credits");
161
+ }
162
+ const serviceUrl = String(args.url || DEFAULT_SERVICE_URL).replace(/\/$/, "");
163
+ const text = String(args.text || DEFAULT_TEXT);
164
+ const payload = {
165
+ account_id: account,
166
+ command: "mcp.invoke:summarize",
167
+ task_ref: "adapter.mcp.invoke",
168
+ payment_preference: "credits_first",
169
+ body: buildDefaultMcpBody(text)
170
+ };
171
+ const result = await postJson(`${serviceUrl}/v1/commands/execute`, payload);
172
+ writeJson(result.json || {
173
+ ok: false,
174
+ status: result.status,
175
+ body: result.text || null
176
+ }, args.pretty);
177
+ if (!result.ok) {
178
+ process.exitCode = 1;
179
+ }
180
+ }
181
+
182
+ async function main() {
183
+ const args = parseArgs(process.argv.slice(2));
184
+ if (args.help) {
185
+ printUsage();
186
+ return;
187
+ }
188
+ if (args["run-quote"]) {
189
+ runQuote(args);
190
+ return;
191
+ }
192
+ if (args["execute-with-credits"]) {
193
+ await executeWithCredits(args);
194
+ return;
195
+ }
196
+
197
+ const localGuide = buildLocalKit(args);
198
+ if (args.json) {
199
+ if (args.offline) {
200
+ writeJson(localGuide, args.pretty);
201
+ return;
202
+ }
203
+ try {
204
+ const publicKit = await fetchPublicKit(DEFAULT_KIT_URL);
205
+ writeJson({
206
+ ...localGuide,
207
+ public_command_kit: publicKit
208
+ }, args.pretty);
209
+ } catch (error) {
210
+ writeJson({
211
+ ...localGuide,
212
+ public_command_kit_fetch_error: error.message
213
+ }, args.pretty);
214
+ }
215
+ return;
216
+ }
217
+
218
+ process.stdout.write([
219
+ "xytara first-run",
220
+ "",
221
+ "Safe first step:",
222
+ ` ${localGuide.safe_quote_command}`,
223
+ "",
224
+ "Run the safe quote-only path:",
225
+ ` xytara first-run --run-quote --account ACCOUNT_REF --pretty`,
226
+ "",
227
+ "Run the funded credits-first path:",
228
+ ` xytara first-run --execute-with-credits --account ACCOUNT_REF --pretty`,
229
+ "",
230
+ "Inspect the public command kit:",
231
+ ` ${DEFAULT_KIT_URL}`,
232
+ "",
233
+ "Then prove with:",
234
+ " xoonya first-run --verify-native --pretty",
235
+ "",
236
+ "Boundary:",
237
+ " quote-only mode needs no wallet secret; funded execution needs payment material or reusable credits."
238
+ ].join("\n"));
239
+ }
240
+
241
+ main().catch((error) => {
242
+ process.stderr.write(`${error.message}\n`);
243
+ process.exitCode = 1;
244
+ });
package/bin/xytara.js CHANGED
@@ -11,11 +11,15 @@ function printUsage() {
11
11
  "Commands:",
12
12
  " release [args] Open the release/adoption/reporting surface",
13
13
  " run [args] Execute the paid runtime command path",
14
+ " first-run [args] Guide or run the safe public quote-first path",
14
15
  " start-here Print the shortest first-run path",
15
16
  " help Show this help message",
16
17
  "",
17
18
  "Fastest first run:",
18
19
  " xytara start-here",
20
+ " xytara first-run",
21
+ " xytara first-run --run-quote --account ACCOUNT_REF --pretty",
22
+ " xytara first-run --execute-with-credits --account ACCOUNT_REF --pretty",
19
23
  " xytara release --summary",
20
24
  " xytara run --help"
21
25
  ].join("\n"));
@@ -25,11 +29,30 @@ function printStartHere() {
25
29
  process.stdout.write([
26
30
  "xytara start-here",
27
31
  "",
28
- "1. xytara release --summary",
29
- "2. node examples/quickstart.js",
30
- "3. npm run verify:all",
31
- "4. Inspect /v1/providers, /v1/frameworks, /v1/protocols, /v1/integration-matrix",
32
- "5. Continue into MCP/A2A/A2C/x402/settlement lanes as needed"
32
+ "Public first-run spine:",
33
+ " quote -> pay/credits -> execute -> prove",
34
+ "",
35
+ "Guided CLI:",
36
+ " xytara first-run",
37
+ " xytara first-run --run-quote --account ACCOUNT_REF --pretty",
38
+ " xytara first-run --execute-with-credits --account ACCOUNT_REF --pretty",
39
+ "",
40
+ "1. Open https://www.naxytra.com/v1/first-run-path",
41
+ "2. Open https://www.naxytra.com/v1/first-run-kit for copyable commands.",
42
+ "3. Quote safely first:",
43
+ " xytara-run --url https://xytara.onrender.com --account ACCOUNT_REF --task adapter.mcp.invoke --command mcp.invoke:summarize --body-json \"{\\\"tool_name\\\":\\\"summarize\\\",\\\"arguments\\\":{\\\"text\\\":\\\"Summarize the Naxytra first-run path in one sentence.\\\"}}\" --quote-only --pretty",
44
+ "4. Execute with direct signed payment or credits-first on a funded account.",
45
+ "5. Hand the result into xoonya for proof review and verification.",
46
+ "",
47
+ "Boundaries:",
48
+ " quote-only mode needs no wallet secret",
49
+ " funded execution needs direct payment material or reusable credits",
50
+ " proof stays in xoonya; runtime payment state stays in xytara",
51
+ "",
52
+ "Local package confidence:",
53
+ " node examples/quickstart.js",
54
+ " npm run verify:all",
55
+ " xytara release --summary"
33
56
  ].join("\n"));
34
57
  }
35
58
 
@@ -49,6 +72,8 @@ if (!command || command === "help" || command === "--help" || command === "-h")
49
72
  delegate("xytara-release.js", rest);
50
73
  } else if (command === "run") {
51
74
  delegate("xytara-run.js", rest);
75
+ } else if (command === "first-run" || command === "firstrun") {
76
+ delegate("xytara-first-run.js", rest);
52
77
  } else {
53
78
  printUsage();
54
79
  process.exitCode = 1;
@@ -79,7 +79,11 @@ function chooseIntegration(options) {
79
79
  });
80
80
  const candidates = listIntegrations({ class: opts.adapterClass }).filter((integration) => {
81
81
  if (requestedIdsForClass.length > 0 && !requestedIdsForClass.includes(integration.integration_id)) return false;
82
- if (requestedIdsForClass.length === 0 && integration.registration.default_selection_enabled !== true) return false;
82
+ if (
83
+ requestedIdsForClass.length === 0
84
+ && opts.allowNonDefaultSelection !== true
85
+ && integration.registration.default_selection_enabled !== true
86
+ ) return false;
83
87
  if (typeof opts.predicate === "function" && !opts.predicate(integration)) return false;
84
88
  return true;
85
89
  });
@@ -181,8 +185,9 @@ function resolveIntegrationSelection(payload) {
181
185
  const executionIntegrations = resolveExecutionIntegrations(taskRefs, adapterLanes, requestedIds);
182
186
  const identityIntegrations = resolveIdentityIntegrations(taskRefs, requestedIds);
183
187
  const protocolIntegrations = protocols.map((protocol) => chooseIntegration({
184
- adapterClass: protocol === "x402" ? "payment_rail_adapter" : "agent_protocol_adapter",
188
+ adapterClass: protocol === "x402" || protocol === "l402" || protocol === "bolt" || protocol === "mpp" ? "payment_rail_adapter" : "agent_protocol_adapter",
185
189
  requestedIds,
190
+ allowNonDefaultSelection: explicitProtocol === protocol || explicitPaymentProtocol === protocol,
186
191
  predicate: (integration) => integration.protocols.includes(protocol)
187
192
  })).filter(Boolean);
188
193
  const settlementIntegration = chooseIntegration({
@@ -40,6 +40,8 @@ function createBuiltinBreadthIntegration({
40
40
  adapter_lanes = [],
41
41
  task_refs = [],
42
42
  workflow_refs = [],
43
+ required_secrets = [],
44
+ required_permissions = [],
43
45
  supported_profiles = ["default"],
44
46
  pricing_basis = "per_task",
45
47
  latency_class = "mixed",
@@ -66,8 +68,8 @@ function createBuiltinBreadthIntegration({
66
68
  adapter_lanes: sortStrings(adapter_lanes),
67
69
  task_refs: sortStrings(task_refs),
68
70
  workflow_refs: sortStrings(workflow_refs),
69
- required_secrets: [],
70
- required_permissions: [],
71
+ required_secrets: sortStrings(required_secrets),
72
+ required_permissions: sortStrings(required_permissions),
71
73
  supported_profiles: sortStrings(supported_profiles),
72
74
  supported_regions: ["global"],
73
75
  pricing_basis,
@@ -1521,6 +1523,124 @@ function buildBuiltInIntegrations() {
1521
1523
  default_for_settlement_modes: sortStrings(settlementModes)
1522
1524
  }
1523
1525
  },
1526
+ {
1527
+ integration_id: "builtin.payment.l402",
1528
+ display_name: "Built-In L402 Payment Admission",
1529
+ description: "Built-in L402-style Lightning payment admission through a gateway-signed payment front.",
1530
+ adapter_class: "payment_rail_adapter",
1531
+ adapter_version: "1.4.0",
1532
+ interface_version: "commerce-adapter-interface/v1",
1533
+ bundled: true,
1534
+ source: "builtin",
1535
+ status: "available",
1536
+ certification_state: "certified",
1537
+ certification_scope: ["builtin_runtime", "service_contract", "sdk_contract"],
1538
+ integration_maturity: "production_supported",
1539
+ selection_priority: 65,
1540
+ capabilities: ["payment.admission", "payment.challenge", "payment.permissionless_front"],
1541
+ protocols: ["l402"],
1542
+ settlement_modes: sortStrings(settlementModes),
1543
+ execution_backends: [],
1544
+ adapter_lanes: ["l402"],
1545
+ task_refs: [],
1546
+ workflow_refs: [],
1547
+ required_secrets: ["XYTARA_L402_SHARED_SECRET"],
1548
+ required_permissions: [],
1549
+ supported_profiles: ["default"],
1550
+ supported_regions: ["global"],
1551
+ pricing_basis: "quote_then_settle",
1552
+ latency_class: "near_real_time",
1553
+ proof_contract: {
1554
+ emits_proof_compatible_facts: true,
1555
+ proof_mode: "payment_admission_facts"
1556
+ },
1557
+ health_contract: {
1558
+ check_kind: "internal",
1559
+ supports_readiness: true
1560
+ },
1561
+ idempotency_contract: {
1562
+ strategy: "quote_id",
1563
+ scope: "payment_admission"
1564
+ },
1565
+ failure_contract: {
1566
+ categories: ["invalid_input", "quote_expired", "payment_missing"],
1567
+ retryable_categories: []
1568
+ },
1569
+ compatibility: {
1570
+ node: ">=18",
1571
+ commerce_contract: "xytara/v1"
1572
+ },
1573
+ operational_readiness: {
1574
+ supports_default_selection: false,
1575
+ supports_forced_selection: true,
1576
+ lifecycle: "managed_builtin",
1577
+ health_source: "internal"
1578
+ },
1579
+ selection_hints: {
1580
+ default_for_task_refs: [],
1581
+ default_for_protocols: [],
1582
+ default_for_settlement_modes: sortStrings(settlementModes)
1583
+ }
1584
+ },
1585
+ {
1586
+ integration_id: "builtin.payment.bolt",
1587
+ display_name: "Built-In BOLT Payment Admission",
1588
+ description: "Built-in BOLT-style UTXO/SPV payment admission through a signed proof-carrying payment front.",
1589
+ adapter_class: "payment_rail_adapter",
1590
+ adapter_version: "1.4.0",
1591
+ interface_version: "commerce-adapter-interface/v1",
1592
+ bundled: true,
1593
+ source: "builtin",
1594
+ status: "available",
1595
+ certification_state: "certified",
1596
+ certification_scope: ["builtin_runtime", "service_contract", "sdk_contract"],
1597
+ integration_maturity: "production_supported",
1598
+ selection_priority: 66,
1599
+ capabilities: ["payment.admission", "payment.challenge", "payment.permissionless_front", "payment.spv_proof"],
1600
+ protocols: ["bolt"],
1601
+ settlement_modes: sortStrings(settlementModes),
1602
+ execution_backends: [],
1603
+ adapter_lanes: ["bolt"],
1604
+ task_refs: [],
1605
+ workflow_refs: [],
1606
+ required_secrets: ["XYTARA_BOLT_SHARED_SECRET"],
1607
+ required_permissions: [],
1608
+ supported_profiles: ["default"],
1609
+ supported_regions: ["global"],
1610
+ pricing_basis: "quote_then_settle",
1611
+ latency_class: "near_real_time",
1612
+ proof_contract: {
1613
+ emits_proof_compatible_facts: true,
1614
+ proof_mode: "spv_or_block_header_verifiable_payment_facts"
1615
+ },
1616
+ health_contract: {
1617
+ check_kind: "internal",
1618
+ supports_readiness: true
1619
+ },
1620
+ idempotency_contract: {
1621
+ strategy: "quote_id",
1622
+ scope: "payment_admission"
1623
+ },
1624
+ failure_contract: {
1625
+ categories: ["invalid_input", "quote_expired", "payment_missing"],
1626
+ retryable_categories: []
1627
+ },
1628
+ compatibility: {
1629
+ node: ">=18",
1630
+ commerce_contract: "xytara/v1"
1631
+ },
1632
+ operational_readiness: {
1633
+ supports_default_selection: false,
1634
+ supports_forced_selection: true,
1635
+ lifecycle: "managed_builtin",
1636
+ health_source: "internal"
1637
+ },
1638
+ selection_hints: {
1639
+ default_for_task_refs: [],
1640
+ default_for_protocols: [],
1641
+ default_for_settlement_modes: sortStrings(settlementModes)
1642
+ }
1643
+ },
1524
1644
  {
1525
1645
  integration_id: "builtin.settlement.chain",
1526
1646
  display_name: "Built-In Chain Settlement",
@@ -1791,6 +1911,7 @@ function buildBuiltInIntegrations() {
1791
1911
  protocols: ["mpp"],
1792
1912
  settlement_modes: sortStrings(settlementModes),
1793
1913
  adapter_lanes: ["mpp"],
1914
+ required_secrets: ["XYTARA_MPP_SHARED_SECRET"],
1794
1915
  supported_profiles: ["payment"]
1795
1916
  }),
1796
1917
  createBuiltinBreadthIntegration({