xytara 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/.env.example +6 -0
  2. package/ADAPTER_START_HERE.md +56 -0
  3. package/BSV_TERANODE_SETUP.md +30 -1
  4. package/CARRIED_HANDOFF_DEMO.md +60 -0
  5. package/EXAMPLE_PATHS.md +53 -0
  6. package/FINAL_CONTRACT.md +6 -6
  7. package/OPERATIONS_RUNBOOK.md +65 -0
  8. package/OPERATOR_START_HERE.md +63 -0
  9. package/PARTNER_READY_PATH.md +71 -0
  10. package/PROGRAM_COMPLETE_RELEASE.md +63 -0
  11. package/PROGRAM_STATUS.md +57 -0
  12. package/PUBLIC_DEMO_SCRIPT.md +78 -0
  13. package/PUBLISH_PLAN.md +14 -0
  14. package/README.md +142 -6
  15. package/RELEASE_CHECKLIST.md +16 -0
  16. package/RELEASE_NOTES.md +28 -0
  17. package/SERVICE_CONTRACT.md +4 -4
  18. package/START_HERE.md +32 -0
  19. package/SUPABASE_RUNTIME_STATE_SETUP.md +61 -0
  20. package/WHY_XYTARA_XOONYA.md +63 -0
  21. package/adapters/examples/minimal-third-party-execution-adapter.js +61 -0
  22. package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +79 -0
  23. package/adapters/examples/minimal-third-party-execution-registration.record.json +26 -0
  24. package/adapters/examples/minimal-third-party-execution.certification-pack.json +22 -0
  25. package/adapters/examples/minimal-third-party-execution.submission-bundle.json +126 -0
  26. package/bin/xytara-release.js +1419 -0
  27. package/bin/xytara-run.js +186 -0
  28. package/examples/adapter_review_walkthrough.js +53 -0
  29. package/examples/export_carried_handoff.js +80 -0
  30. package/examples/funded_runtime_walkthrough.js +70 -0
  31. package/examples/partner_launch_walkthrough.js +43 -0
  32. package/examples/quickstart.js +3255 -0
  33. package/index.js +87 -1
  34. package/lib/adapter_pack.js +118 -0
  35. package/lib/adapter_partner_pack.js +89 -0
  36. package/lib/adapter_promotion_pack.js +89 -0
  37. package/lib/announcement_pack.js +61 -0
  38. package/lib/commerce_artifacts.js +3 -0
  39. package/lib/commerce_economics.js +14 -0
  40. package/lib/commerce_reports.js +26 -1
  41. package/lib/commerce_shell.js +18 -2
  42. package/lib/ecosystem_entry.js +64 -0
  43. package/lib/launch_narrative.js +53 -0
  44. package/lib/outreach_copy_pack.js +51 -0
  45. package/lib/outreach_message_pack.js +71 -0
  46. package/lib/outreach_proof.js +71 -0
  47. package/lib/outreach_target_pack.js +60 -0
  48. package/lib/phase_10_closeout_pack.js +45 -0
  49. package/lib/phase_10_completion_pack.js +76 -0
  50. package/lib/phase_10_decision_record_pack.js +54 -0
  51. package/lib/phase_10_decision_resolution_pack.js +53 -0
  52. package/lib/phase_10_demand_signal_adapters_runtime_pack.js +74 -0
  53. package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +74 -0
  54. package/lib/phase_10_freeze_baseline_pack.js +67 -0
  55. package/lib/phase_10_freeze_review_pack.js +64 -0
  56. package/lib/phase_10_gate_pack.js +57 -0
  57. package/lib/phase_10_long_tail_continuity_pack.js +80 -0
  58. package/lib/phase_10_long_tail_ecosystem_pack.js +66 -0
  59. package/lib/phase_10_niche_extension_registry_runtime_pack.js +74 -0
  60. package/lib/phase_1_claude_mcp_pack.js +60 -0
  61. package/lib/phase_1_claude_mcp_runtime_pack.js +52 -0
  62. package/lib/phase_1_ecosystem_pack.js +67 -0
  63. package/lib/phase_1_openai_codex_pack.js +60 -0
  64. package/lib/phase_1_openai_codex_runtime_pack.js +52 -0
  65. package/lib/phase_2_base_runtime_pack.js +71 -0
  66. package/lib/phase_2_base_usdc_runtime_pack.js +72 -0
  67. package/lib/phase_2_closeout_pack.js +65 -0
  68. package/lib/phase_2_completion_pack.js +113 -0
  69. package/lib/phase_2_decision_record_pack.js +66 -0
  70. package/lib/phase_2_decision_resolution_pack.js +69 -0
  71. package/lib/phase_2_eth_runtime_pack.js +70 -0
  72. package/lib/phase_2_evm_base_runtime_pack.js +73 -0
  73. package/lib/phase_2_evm_runtime_pack.js +71 -0
  74. package/lib/phase_2_flip_preview_pack.js +60 -0
  75. package/lib/phase_2_freeze_review_pack.js +99 -0
  76. package/lib/phase_2_gate_pack.js +77 -0
  77. package/lib/phase_2_payment_rails_pack.js +71 -0
  78. package/lib/phase_2_usdc_runtime_pack.js +71 -0
  79. package/lib/phase_3_brc_runtime_pack.js +81 -0
  80. package/lib/phase_3_bsv_teranode_runtime_pack.js +83 -0
  81. package/lib/phase_3_closeout_pack.js +62 -0
  82. package/lib/phase_3_completion_pack.js +94 -0
  83. package/lib/phase_3_decision_record_pack.js +64 -0
  84. package/lib/phase_3_decision_resolution_pack.js +69 -0
  85. package/lib/phase_3_freeze_baseline_pack.js +67 -0
  86. package/lib/phase_3_freeze_review_pack.js +80 -0
  87. package/lib/phase_3_gate_pack.js +76 -0
  88. package/lib/phase_3_metanet_runtime_pack.js +81 -0
  89. package/lib/phase_3_native_bsv_pack.js +91 -0
  90. package/lib/phase_3_native_continuity_pack.js +82 -0
  91. package/lib/phase_4_attestation_runtime_pack.js +75 -0
  92. package/lib/phase_4_closeout_pack.js +45 -0
  93. package/lib/phase_4_completion_pack.js +94 -0
  94. package/lib/phase_4_decision_record_pack.js +54 -0
  95. package/lib/phase_4_decision_resolution_pack.js +45 -0
  96. package/lib/phase_4_erc8004_runtime_pack.js +76 -0
  97. package/lib/phase_4_freeze_baseline_pack.js +67 -0
  98. package/lib/phase_4_freeze_review_pack.js +68 -0
  99. package/lib/phase_4_gate_pack.js +58 -0
  100. package/lib/phase_4_identity_registry_runtime_pack.js +75 -0
  101. package/lib/phase_4_identity_trust_pack.js +73 -0
  102. package/lib/phase_4_trust_continuity_pack.js +86 -0
  103. package/lib/phase_5_antelope_runtime_pack.js +76 -0
  104. package/lib/phase_5_closeout_pack.js +44 -0
  105. package/lib/phase_5_completion_pack.js +82 -0
  106. package/lib/phase_5_decision_record_pack.js +54 -0
  107. package/lib/phase_5_decision_resolution_pack.js +45 -0
  108. package/lib/phase_5_freeze_baseline_pack.js +67 -0
  109. package/lib/phase_5_freeze_review_pack.js +68 -0
  110. package/lib/phase_5_gate_pack.js +58 -0
  111. package/lib/phase_5_major_rails_continuity_pack.js +86 -0
  112. package/lib/phase_5_major_rails_pack.js +74 -0
  113. package/lib/phase_5_proton_xpr_runtime_pack.js +76 -0
  114. package/lib/phase_5_solana_runtime_pack.js +76 -0
  115. package/lib/phase_6_autogen_runtime_pack.js +72 -0
  116. package/lib/phase_6_closeout_pack.js +46 -0
  117. package/lib/phase_6_completion_pack.js +77 -0
  118. package/lib/phase_6_decision_record_pack.js +54 -0
  119. package/lib/phase_6_decision_resolution_pack.js +53 -0
  120. package/lib/phase_6_framework_continuity_pack.js +81 -0
  121. package/lib/phase_6_framework_runtime_pack.js +68 -0
  122. package/lib/phase_6_freeze_baseline_pack.js +68 -0
  123. package/lib/phase_6_freeze_review_pack.js +65 -0
  124. package/lib/phase_6_gate_pack.js +59 -0
  125. package/lib/phase_6_langchain_runtime_pack.js +72 -0
  126. package/lib/phase_6_langgraph_runtime_pack.js +72 -0
  127. package/lib/phase_6_semantic_kernel_runtime_pack.js +72 -0
  128. package/lib/phase_7_closeout_pack.js +45 -0
  129. package/lib/phase_7_completion_pack.js +85 -0
  130. package/lib/phase_7_decision_record_pack.js +53 -0
  131. package/lib/phase_7_decision_resolution_pack.js +53 -0
  132. package/lib/phase_7_event_system_continuity_pack.js +89 -0
  133. package/lib/phase_7_event_system_pack.js +76 -0
  134. package/lib/phase_7_freeze_baseline_pack.js +74 -0
  135. package/lib/phase_7_freeze_review_pack.js +65 -0
  136. package/lib/phase_7_gate_pack.js +58 -0
  137. package/lib/phase_7_kafka_runtime_pack.js +74 -0
  138. package/lib/phase_7_mqtt_runtime_pack.js +74 -0
  139. package/lib/phase_7_nats_runtime_pack.js +74 -0
  140. package/lib/phase_7_webhook_event_bus_runtime_pack.js +74 -0
  141. package/lib/phase_8_closeout_pack.js +46 -0
  142. package/lib/phase_8_completion_pack.js +82 -0
  143. package/lib/phase_8_decision_record_pack.js +54 -0
  144. package/lib/phase_8_decision_resolution_pack.js +53 -0
  145. package/lib/phase_8_external_receipt_import_runtime_pack.js +74 -0
  146. package/lib/phase_8_external_result_import_runtime_pack.js +74 -0
  147. package/lib/phase_8_freeze_baseline_pack.js +71 -0
  148. package/lib/phase_8_freeze_review_pack.js +64 -0
  149. package/lib/phase_8_gate_pack.js +58 -0
  150. package/lib/phase_8_proof_bridge_continuity_pack.js +86 -0
  151. package/lib/phase_8_proof_bridges_pack.js +72 -0
  152. package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +74 -0
  153. package/lib/phase_9_closeout_pack.js +46 -0
  154. package/lib/phase_9_completion_pack.js +82 -0
  155. package/lib/phase_9_custody_refs_runtime_pack.js +74 -0
  156. package/lib/phase_9_decision_record_pack.js +54 -0
  157. package/lib/phase_9_decision_resolution_pack.js +53 -0
  158. package/lib/phase_9_freeze_baseline_pack.js +71 -0
  159. package/lib/phase_9_freeze_review_pack.js +64 -0
  160. package/lib/phase_9_gate_pack.js +58 -0
  161. package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +74 -0
  162. package/lib/phase_9_treasury_connectivity_pack.js +72 -0
  163. package/lib/phase_9_treasury_continuity_pack.js +86 -0
  164. package/lib/phase_9_treasury_destinations_runtime_pack.js +74 -0
  165. package/lib/phase_program_pack.js +120 -0
  166. package/lib/publish_plan.js +51 -0
  167. package/lib/release_candidate.js +50 -0
  168. package/lib/release_center.js +1085 -0
  169. package/lib/release_history.js +72 -0
  170. package/lib/release_manifest.js +114 -0
  171. package/lib/release_pack.js +454 -0
  172. package/lib/runtime_state_store.js +354 -0
  173. package/lib/settlement_bsv_live.js +262 -13
  174. package/lib/soft_launch_pack.js +78 -0
  175. package/package.json +24 -2
  176. package/server.js +2562 -220
@@ -2,17 +2,36 @@
2
2
 
3
3
  const crypto = require("crypto");
4
4
 
5
+ const LIVE_SETTLEMENT_MODE_ALIASES = new Map([
6
+ ["live", "arc"],
7
+ ["arc", "arc"],
8
+ ["observe", "observe"],
9
+ ["observer", "observe"],
10
+ ["mock", "mock"]
11
+ ]);
12
+
5
13
  function sha256Hex(value) {
6
14
  return crypto.createHash("sha256").update(String(value || "")).digest("hex");
7
15
  }
8
16
 
9
17
  function loadBsvSettlementRuntimeConfig() {
10
- const mode = String(process.env.XYTARA_BSV_TERANODE_SETTLEMENT_RUNTIME_MODE || "mock").trim().toLowerCase() || "mock";
18
+ const modeInput = String(process.env.XYTARA_BSV_TERANODE_SETTLEMENT_RUNTIME_MODE || "mock").trim().toLowerCase() || "mock";
19
+ const mode = LIVE_SETTLEMENT_MODE_ALIASES.get(modeInput) || modeInput;
11
20
  const requiredConfirmations = Math.max(1, Number(process.env.XYTARA_BSV_TERANODE_REQUIRED_CONFIRMATIONS || 1) || 1);
21
+ const network = String(process.env.XYTARA_BSV_TERANODE_NETWORK || "mainnet").trim() || "mainnet";
22
+ const observerNetwork = network === "mainnet" ? "main" : network === "testnet" ? "test" : network;
23
+ const observerUrl = String(
24
+ process.env.XYTARA_BSV_TERANODE_OBSERVER_URL
25
+ || `https://api.whatsonchain.com/v1/bsv/${observerNetwork}`
26
+ ).trim() || null;
12
27
  return {
13
28
  mode,
14
29
  rpc_url: String(process.env.XYTARA_BSV_TERANODE_RPC_URL || "").trim() || null,
15
- network: String(process.env.XYTARA_BSV_TERANODE_NETWORK || "mainnet").trim() || "mainnet",
30
+ rpc_api_key: String(process.env.XYTARA_BSV_TERANODE_RPC_API_KEY || "").trim() || null,
31
+ rpc_auth_header: String(process.env.XYTARA_BSV_TERANODE_RPC_AUTH_HEADER || "authorization").trim() || "authorization",
32
+ rpc_auth_scheme: String(process.env.XYTARA_BSV_TERANODE_RPC_AUTH_SCHEME || "").trim(),
33
+ observer_url: observerUrl,
34
+ network,
16
35
  required_confirmations: requiredConfirmations
17
36
  };
18
37
  }
@@ -21,6 +40,140 @@ function clone(value) {
21
40
  return JSON.parse(JSON.stringify(value));
22
41
  }
23
42
 
43
+ function isLiveSettlementRuntimeMode(mode) {
44
+ return String(mode || "").trim().toLowerCase() !== "mock";
45
+ }
46
+
47
+ function buildRuntimeAuthHeaders(config) {
48
+ if (!config || !config.rpc_api_key) return {};
49
+ const headerName = config.rpc_auth_header || "authorization";
50
+ const scheme = String(config.rpc_auth_scheme || "").trim();
51
+ return {
52
+ [headerName]: scheme ? `${scheme} ${config.rpc_api_key}` : config.rpc_api_key
53
+ };
54
+ }
55
+
56
+ function extractSubmittedTransactionId(payload) {
57
+ if (!payload || typeof payload !== "object") return null;
58
+ return payload.txid || payload.txId || payload.transactionId || payload.data && payload.data.txid || null;
59
+ }
60
+
61
+ async function submitArcRawTransaction(config, rawTx) {
62
+ const response = await fetch(config.rpc_url, {
63
+ method: "POST",
64
+ headers: {
65
+ "content-type": "application/json",
66
+ ...buildRuntimeAuthHeaders(config)
67
+ },
68
+ body: JSON.stringify({ rawTx })
69
+ });
70
+ const text = await response.text();
71
+ let parsed = null;
72
+ try {
73
+ parsed = text ? JSON.parse(text) : null;
74
+ } catch (_) {
75
+ parsed = null;
76
+ }
77
+ if (!response.ok) {
78
+ return {
79
+ ok: false,
80
+ reason: "settlement_submit_failed",
81
+ status: response.status,
82
+ body: parsed || text || null
83
+ };
84
+ }
85
+ const txid = extractSubmittedTransactionId(parsed);
86
+ if (!txid) {
87
+ return {
88
+ ok: false,
89
+ reason: "settlement_submit_missing_txid",
90
+ status: response.status,
91
+ body: parsed || text || null
92
+ };
93
+ }
94
+ return {
95
+ ok: true,
96
+ txid,
97
+ provider_ref: parsed && typeof parsed === "object" ? parsed.requestId || parsed.request_id || null : null,
98
+ response: parsed || text || null
99
+ };
100
+ }
101
+
102
+ function normalizeArcStatusUrl(config, txid) {
103
+ const rpcUrl = String(config && config.rpc_url || "").replace(/\/$/, "");
104
+ if (!rpcUrl) return null;
105
+ if (rpcUrl.endsWith("/tx")) return `${rpcUrl}/${encodeURIComponent(txid)}`;
106
+ if (rpcUrl.includes("/tx/")) return rpcUrl;
107
+ return `${rpcUrl}/tx/${encodeURIComponent(txid)}`;
108
+ }
109
+
110
+ async function fetchArcTransactionStatus(config, txid) {
111
+ const statusUrl = normalizeArcStatusUrl(config, txid);
112
+ if (!statusUrl) {
113
+ return { ok: false, reason: "settlement_transport_missing" };
114
+ }
115
+ const response = await fetch(statusUrl, {
116
+ headers: buildRuntimeAuthHeaders(config)
117
+ });
118
+ const text = await response.text();
119
+ let parsed = null;
120
+ try {
121
+ parsed = text ? JSON.parse(text) : null;
122
+ } catch (_) {
123
+ parsed = null;
124
+ }
125
+ if (!response.ok) {
126
+ return {
127
+ ok: false,
128
+ reason: response.status === 404 ? "tx_not_found" : "arc_status_failed",
129
+ status: response.status,
130
+ body: parsed || text || null
131
+ };
132
+ }
133
+ return {
134
+ ok: true,
135
+ payload: parsed || null
136
+ };
137
+ }
138
+
139
+ async function fetchObserverTransactionStatus(config, txid) {
140
+ const observerBaseUrl = String(config && config.observer_url || "").replace(/\/$/, "");
141
+ if (!observerBaseUrl) {
142
+ return { ok: false, reason: "settlement_observer_missing" };
143
+ }
144
+ const response = await fetch(`${observerBaseUrl}/tx/hash/${encodeURIComponent(txid)}`);
145
+ const text = await response.text();
146
+ let parsed = null;
147
+ try {
148
+ parsed = text ? JSON.parse(text) : null;
149
+ } catch (_) {
150
+ parsed = null;
151
+ }
152
+ if (!response.ok) {
153
+ return {
154
+ ok: false,
155
+ reason: response.status === 404 ? "tx_not_found" : "observer_status_failed",
156
+ status: response.status,
157
+ body: parsed || text || null
158
+ };
159
+ }
160
+ const confirmations = Number(
161
+ parsed && (
162
+ parsed.confirmations
163
+ || parsed.confirmationCount
164
+ || parsed.confirmation_count
165
+ || parsed.data && (parsed.data.confirmations || parsed.data.confirmationCount || parsed.data.confirmation_count)
166
+ )
167
+ );
168
+ const blockhash = parsed && (parsed.blockhash || parsed.blockHash || parsed.merkleRoot || parsed.data && (parsed.data.blockhash || parsed.data.blockHash)) || null;
169
+ return {
170
+ ok: true,
171
+ confirmations: Number.isFinite(confirmations) && confirmations >= 0 ? confirmations : 0,
172
+ blockhash,
173
+ payload: parsed || null
174
+ };
175
+ }
176
+
24
177
  function buildSettlementLiveView(record) {
25
178
  if (!record) return null;
26
179
  return {
@@ -32,6 +185,7 @@ function buildSettlementLiveView(record) {
32
185
  rail: record.rail,
33
186
  confirmation_count: record.confirmation_count,
34
187
  required_confirmations: record.required_confirmations,
188
+ raw_tx_present: Boolean(record.raw_tx),
35
189
  submitted_at_iso: record.submitted_at_iso,
36
190
  observed_at_iso: record.observed_at_iso,
37
191
  confirmed_at_iso: record.confirmed_at_iso,
@@ -118,7 +272,8 @@ function createBsvSettlementRecord(state, transaction, receipt, paymentRecord) {
118
272
  finality_status: "pending_submission",
119
273
  confirmation_count: 0,
120
274
  required_confirmations: config.required_confirmations,
121
- txid: null,
275
+ txid: transaction.settlement && transaction.settlement.txid ? transaction.settlement.txid : null,
276
+ raw_tx: transaction.settlement && transaction.settlement.raw_tx ? transaction.settlement.raw_tx : null,
122
277
  provider_ref: null,
123
278
  settlement_reference:
124
279
  transaction.settlement && transaction.settlement.binding_hash
@@ -159,7 +314,7 @@ function getBsvSettlementRecord(state, settlementId) {
159
314
  return state.bsvSettlementRecords.get(settlementId) || null;
160
315
  }
161
316
 
162
- function submitBsvSettlementRecord(state, settlementId) {
317
+ async function submitBsvSettlementRecord(state, settlementId) {
163
318
  const record = getBsvSettlementRecord(state, settlementId);
164
319
  if (!record) {
165
320
  return { ok: false, reason: "settlement_not_found" };
@@ -167,14 +322,57 @@ function submitBsvSettlementRecord(state, settlementId) {
167
322
  if (record.status !== "ready_for_submission" && record.status !== "failed") {
168
323
  return { ok: true, settlement: clone(record) };
169
324
  }
325
+ const config = loadBsvSettlementRuntimeConfig();
170
326
  const submittedAtIso = new Date().toISOString();
171
- const txid = sha256Hex(`${record.settlement_id}:${record.settlement_reference}:${record.network}`).slice(0, 64);
327
+ if (config.mode === "mock") {
328
+ const txid = sha256Hex(`${record.settlement_id}:${record.settlement_reference}:${record.network}`).slice(0, 64);
329
+ const next = {
330
+ ...record,
331
+ runtime_mode: config.mode,
332
+ status: "submitted",
333
+ finality_status: "submitted",
334
+ txid,
335
+ provider_ref: `bsv_teranode_submit_${record.settlement_id}`,
336
+ submitted_at_iso: submittedAtIso,
337
+ last_error: null
338
+ };
339
+ state.bsvSettlementRecords.set(settlementId, next);
340
+ updateArtifactsForSettlementRecord(state, next);
341
+ return { ok: true, settlement: clone(next) };
342
+ }
343
+
344
+ let txid = record.txid || null;
345
+ let providerRef = record.provider_ref || null;
346
+ if (!txid && record.raw_tx && config.mode === "arc") {
347
+ const submitResult = await submitArcRawTransaction(config, record.raw_tx);
348
+ if (!submitResult.ok) {
349
+ const failed = {
350
+ ...record,
351
+ runtime_mode: config.mode,
352
+ status: "failed",
353
+ finality_status: "submission_failed",
354
+ last_error: submitResult.reason
355
+ };
356
+ state.bsvSettlementRecords.set(settlementId, failed);
357
+ updateArtifactsForSettlementRecord(state, failed);
358
+ return { ok: false, reason: submitResult.reason, settlement: clone(failed), details: submitResult.body || null };
359
+ }
360
+ txid = submitResult.txid;
361
+ providerRef = submitResult.provider_ref || `arc_submit_${record.settlement_id}`;
362
+ }
363
+ if (!txid) {
364
+ return {
365
+ ok: false,
366
+ reason: config.mode === "observe" ? "settlement_txid_missing_for_observe_mode" : "settlement_submission_material_missing"
367
+ };
368
+ }
172
369
  const next = {
173
370
  ...record,
371
+ runtime_mode: config.mode,
174
372
  status: "submitted",
175
373
  finality_status: "submitted",
176
374
  txid,
177
- provider_ref: `bsv_teranode_submit_${record.settlement_id}`,
375
+ provider_ref: providerRef || `bsv_teranode_submit_${record.settlement_id}`,
178
376
  submitted_at_iso: submittedAtIso,
179
377
  last_error: null
180
378
  };
@@ -183,7 +381,7 @@ function submitBsvSettlementRecord(state, settlementId) {
183
381
  return { ok: true, settlement: clone(next) };
184
382
  }
185
383
 
186
- function refreshBsvSettlementRecord(state, settlementId) {
384
+ async function refreshBsvSettlementRecord(state, settlementId) {
187
385
  const record = getBsvSettlementRecord(state, settlementId);
188
386
  if (!record) {
189
387
  return { ok: false, reason: "settlement_not_found" };
@@ -191,17 +389,65 @@ function refreshBsvSettlementRecord(state, settlementId) {
191
389
  if (!record.txid) {
192
390
  return { ok: false, reason: "settlement_not_submitted" };
193
391
  }
392
+ const config = loadBsvSettlementRuntimeConfig();
393
+ if (config.mode === "mock") {
394
+ const refreshCount = (record.refresh_count || 0) + 1;
395
+ const confirmationCount = Math.min(record.required_confirmations + 1, record.confirmation_count + 1);
396
+ let status = "observed";
397
+ let finalityStatus = "observed";
398
+ let observedAtIso = record.observed_at_iso;
399
+ let confirmedAtIso = record.confirmed_at_iso;
400
+ let finalizedAtIso = record.finalized_at_iso;
401
+ const nowIso = new Date().toISOString();
402
+
403
+ if (!observedAtIso) observedAtIso = nowIso;
404
+ if (confirmationCount >= record.required_confirmations) {
405
+ status = "confirmed";
406
+ finalityStatus = "confirmed";
407
+ confirmedAtIso = confirmedAtIso || nowIso;
408
+ }
409
+ if (confirmationCount > record.required_confirmations) {
410
+ status = "finalized";
411
+ finalityStatus = "finalized";
412
+ finalizedAtIso = finalizedAtIso || nowIso;
413
+ }
414
+
415
+ const next = {
416
+ ...record,
417
+ refresh_count: refreshCount,
418
+ confirmation_count: confirmationCount,
419
+ status,
420
+ finality_status: finalityStatus,
421
+ observed_at_iso: observedAtIso,
422
+ confirmed_at_iso: confirmedAtIso,
423
+ finalized_at_iso: finalizedAtIso
424
+ };
425
+ state.bsvSettlementRecords.set(settlementId, next);
426
+ updateArtifactsForSettlementRecord(state, next);
427
+ return { ok: true, settlement: clone(next) };
428
+ }
194
429
 
195
430
  const refreshCount = (record.refresh_count || 0) + 1;
196
- const confirmationCount = Math.min(record.required_confirmations + 1, record.confirmation_count + 1);
197
- let status = "observed";
198
- let finalityStatus = "observed";
431
+ let status = "submitted";
432
+ let finalityStatus = "submitted";
199
433
  let observedAtIso = record.observed_at_iso;
200
434
  let confirmedAtIso = record.confirmed_at_iso;
201
435
  let finalizedAtIso = record.finalized_at_iso;
436
+ let confirmationCount = Number(record.confirmation_count || 0);
202
437
  const nowIso = new Date().toISOString();
203
438
 
204
- if (!observedAtIso) observedAtIso = nowIso;
439
+ const arcStatus = config.mode === "arc"
440
+ ? await fetchArcTransactionStatus(config, record.txid)
441
+ : { ok: false, reason: "arc_status_not_requested" };
442
+ const observerStatus = await fetchObserverTransactionStatus(config, record.txid);
443
+ if (arcStatus.ok || observerStatus.ok) {
444
+ observedAtIso = observedAtIso || nowIso;
445
+ status = "observed";
446
+ finalityStatus = "observed";
447
+ }
448
+ if (observerStatus.ok) {
449
+ confirmationCount = observerStatus.confirmations;
450
+ }
205
451
  if (confirmationCount >= record.required_confirmations) {
206
452
  status = "confirmed";
207
453
  finalityStatus = "confirmed";
@@ -212,16 +458,19 @@ function refreshBsvSettlementRecord(state, settlementId) {
212
458
  finalityStatus = "finalized";
213
459
  finalizedAtIso = finalizedAtIso || nowIso;
214
460
  }
215
-
216
461
  const next = {
217
462
  ...record,
463
+ runtime_mode: config.mode,
218
464
  refresh_count: refreshCount,
219
465
  confirmation_count: confirmationCount,
220
466
  status,
221
467
  finality_status: finalityStatus,
222
468
  observed_at_iso: observedAtIso,
223
469
  confirmed_at_iso: confirmedAtIso,
224
- finalized_at_iso: finalizedAtIso
470
+ finalized_at_iso: finalizedAtIso,
471
+ last_error: observerStatus.ok || arcStatus.ok
472
+ ? null
473
+ : observerStatus.reason || arcStatus.reason || record.last_error
225
474
  };
226
475
  state.bsvSettlementRecords.set(settlementId, next);
227
476
  updateArtifactsForSettlementRecord(state, next);
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ const packageJson = require("../package.json");
4
+
5
+ function buildSoftLaunchPack() {
6
+ return {
7
+ ok: true,
8
+ product: packageJson.name,
9
+ category: "machine-commerce-soft-launch-pack",
10
+ message_core: {
11
+ headline: "governed machine commerce for builders who need paid execution, reusable credits, and proof-aware followthrough",
12
+ short_pitch: "xytara gives agent builders and tool authors a machine-commerce spine for quote, pay, execute, inspect, and continue into proof without stitching together separate systems.",
13
+ when_to_lead: [
14
+ "when an agent or tool needs a paid capability path",
15
+ "when repeat usage should use funded account balance instead of repeated manual payment",
16
+ "when execution must stay inspectable and continue cleanly into proof review"
17
+ ]
18
+ },
19
+ first_targets: [
20
+ {
21
+ audience_ref: "agent_builder",
22
+ first_message: "start with one paid machine run and inspect the release center afterward",
23
+ first_proof_path: "scenario.direct_pay.trust_verify"
24
+ },
25
+ {
26
+ audience_ref: "adapter_author",
27
+ first_message: "start from the minimal third-party starter and inspect promotion workflow next",
28
+ first_proof_path: "partner.execution.minimal_echo"
29
+ },
30
+ {
31
+ audience_ref: "tool_or_marketplace_author",
32
+ first_message: "start with the launch summary and compare xytara against patchwork alternatives",
33
+ first_proof_path: "scenario.direct_pay.trust_verify"
34
+ }
35
+ ],
36
+ first_artifacts: {
37
+ release_center: "/v1/release-center/summary",
38
+ announcement: "/v1/announcement-pack/summary",
39
+ outreach_proof: "/v1/outreach-proof/summary",
40
+ adapter_partners: "/v1/adapter-partners/summary",
41
+ first_cli: "xytara-release --center --summary",
42
+ first_run_cli: "xytara-run --url https://xytara.onrender.com --account acct_demo --command \"cli-run\" --task trust.verify --body-json '{\"subject_id\":\"subject-1\"}' --wallet-id merchant_wallet_main --wallet-secret YOUR_LOCAL_SIGNED_SECRET --txid YOUR_BSV_TXID"
43
+ },
44
+ outreach_sequence: [
45
+ "send the short pitch and first proof path to a small builder set",
46
+ "point each audience to the matching first artifact and cli",
47
+ "watch which first path they actually try",
48
+ "collect install, wording, and trust-posture confusion",
49
+ "tighten docs and first-run friction before broader outreach"
50
+ ],
51
+ feedback_watchlist: [
52
+ "install friction",
53
+ "first-run confusion",
54
+ "adapter authoring confusion",
55
+ "promotion trust-model confusion",
56
+ "difference between direct pay and funded-runtime paths"
57
+ ]
58
+ };
59
+ }
60
+
61
+ function summarizeSoftLaunchPack() {
62
+ const pack = buildSoftLaunchPack();
63
+ return {
64
+ ok: true,
65
+ product: pack.product,
66
+ category: pack.category,
67
+ target_count: pack.first_targets.length,
68
+ artifact_count: Object.keys(pack.first_artifacts).length,
69
+ outreach_step_count: pack.outreach_sequence.length,
70
+ feedback_watch_count: pack.feedback_watchlist.length,
71
+ first_cli: pack.first_artifacts.first_cli
72
+ };
73
+ }
74
+
75
+ module.exports = {
76
+ buildSoftLaunchPack,
77
+ summarizeSoftLaunchPack
78
+ };
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "xytara",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Machine commerce SDK for discovery, quoting, execution, lifecycle inspection, and adapters.",
5
5
  "main": "index.js",
6
+ "bin": {
7
+ "xytara-run": "./bin/xytara-run.js",
8
+ "xytara-release": "./bin/xytara-release.js"
9
+ },
6
10
  "type": "commonjs",
7
11
  "license": "Apache-2.0",
8
12
  "homepage": "https://xytara.com",
@@ -33,12 +37,28 @@
33
37
  "index.js",
34
38
  "client.js",
35
39
  "server.js",
40
+ "bin/",
36
41
  "fixtures/",
37
42
  "integrations/",
38
43
  "lib/",
39
44
  "adapters/",
45
+ "RELEASE_NOTES.md",
46
+ "RELEASE_CHECKLIST.md",
47
+ "PUBLISH_PLAN.md",
40
48
  ".env.example",
41
49
  "README.md",
50
+ "PROGRAM_STATUS.md",
51
+ "OPERATOR_START_HERE.md",
52
+ "OPERATIONS_RUNBOOK.md",
53
+ "PROGRAM_COMPLETE_RELEASE.md",
54
+ "WHY_XYTARA_XOONYA.md",
55
+ "CARRIED_HANDOFF_DEMO.md",
56
+ "PARTNER_READY_PATH.md",
57
+ "EXAMPLE_PATHS.md",
58
+ "PUBLIC_DEMO_SCRIPT.md",
59
+ "SUPABASE_RUNTIME_STATE_SETUP.md",
60
+ "ADAPTER_START_HERE.md",
61
+ "examples/",
42
62
  "BSV_TERANODE_SETUP.md",
43
63
  "REAL_PAYMENT_SETUP.md",
44
64
  "START_HERE.md",
@@ -60,6 +80,8 @@
60
80
  "verify:tooling": "node scripts/verify_tooling.js",
61
81
  "verify:examples": "node scripts/verify_examples.js",
62
82
  "verify:service": "node scripts/verify_service.js",
63
- "verify:all": "node scripts/verify_all.js && node scripts/verify_integrations.js && node scripts/verify_adapters.js && node scripts/verify_tooling.js && node scripts/verify_examples.js && node scripts/verify_service.js"
83
+ "verify:release-candidate": "node scripts/verify_release_candidate.js",
84
+ "verify:all": "node scripts/verify_all.js && node scripts/verify_integrations.js && node scripts/verify_adapters.js && node scripts/verify_tooling.js && node scripts/verify_examples.js && node scripts/verify_service.js",
85
+ "prepublishOnly": "npm run verify:release-candidate"
64
86
  }
65
87
  }