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.
- package/.env.example +6 -0
- package/ADAPTER_START_HERE.md +56 -0
- package/BSV_TERANODE_SETUP.md +30 -1
- package/CARRIED_HANDOFF_DEMO.md +60 -0
- package/EXAMPLE_PATHS.md +53 -0
- package/FINAL_CONTRACT.md +6 -6
- package/OPERATIONS_RUNBOOK.md +65 -0
- package/OPERATOR_START_HERE.md +63 -0
- package/PARTNER_READY_PATH.md +71 -0
- package/PROGRAM_COMPLETE_RELEASE.md +63 -0
- package/PROGRAM_STATUS.md +57 -0
- package/PUBLIC_DEMO_SCRIPT.md +78 -0
- package/PUBLISH_PLAN.md +14 -0
- package/README.md +142 -6
- package/RELEASE_CHECKLIST.md +16 -0
- package/RELEASE_NOTES.md +28 -0
- package/SERVICE_CONTRACT.md +4 -4
- package/START_HERE.md +32 -0
- package/SUPABASE_RUNTIME_STATE_SETUP.md +61 -0
- package/WHY_XYTARA_XOONYA.md +63 -0
- package/adapters/examples/minimal-third-party-execution-adapter.js +61 -0
- package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +79 -0
- package/adapters/examples/minimal-third-party-execution-registration.record.json +26 -0
- package/adapters/examples/minimal-third-party-execution.certification-pack.json +22 -0
- package/adapters/examples/minimal-third-party-execution.submission-bundle.json +126 -0
- package/bin/xytara-release.js +1419 -0
- package/bin/xytara-run.js +186 -0
- package/examples/adapter_review_walkthrough.js +53 -0
- package/examples/export_carried_handoff.js +80 -0
- package/examples/funded_runtime_walkthrough.js +70 -0
- package/examples/partner_launch_walkthrough.js +43 -0
- package/examples/quickstart.js +3255 -0
- package/index.js +87 -1
- package/lib/adapter_pack.js +118 -0
- package/lib/adapter_partner_pack.js +89 -0
- package/lib/adapter_promotion_pack.js +89 -0
- package/lib/announcement_pack.js +61 -0
- package/lib/commerce_artifacts.js +3 -0
- package/lib/commerce_economics.js +14 -0
- package/lib/commerce_reports.js +26 -1
- package/lib/commerce_shell.js +18 -2
- package/lib/ecosystem_entry.js +64 -0
- package/lib/launch_narrative.js +53 -0
- package/lib/outreach_copy_pack.js +51 -0
- package/lib/outreach_message_pack.js +71 -0
- package/lib/outreach_proof.js +71 -0
- package/lib/outreach_target_pack.js +60 -0
- package/lib/phase_10_closeout_pack.js +45 -0
- package/lib/phase_10_completion_pack.js +76 -0
- package/lib/phase_10_decision_record_pack.js +54 -0
- package/lib/phase_10_decision_resolution_pack.js +53 -0
- package/lib/phase_10_demand_signal_adapters_runtime_pack.js +74 -0
- package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +74 -0
- package/lib/phase_10_freeze_baseline_pack.js +67 -0
- package/lib/phase_10_freeze_review_pack.js +64 -0
- package/lib/phase_10_gate_pack.js +57 -0
- package/lib/phase_10_long_tail_continuity_pack.js +80 -0
- package/lib/phase_10_long_tail_ecosystem_pack.js +66 -0
- package/lib/phase_10_niche_extension_registry_runtime_pack.js +74 -0
- package/lib/phase_1_claude_mcp_pack.js +60 -0
- package/lib/phase_1_claude_mcp_runtime_pack.js +52 -0
- package/lib/phase_1_ecosystem_pack.js +67 -0
- package/lib/phase_1_openai_codex_pack.js +60 -0
- package/lib/phase_1_openai_codex_runtime_pack.js +52 -0
- package/lib/phase_2_base_runtime_pack.js +71 -0
- package/lib/phase_2_base_usdc_runtime_pack.js +72 -0
- package/lib/phase_2_closeout_pack.js +65 -0
- package/lib/phase_2_completion_pack.js +113 -0
- package/lib/phase_2_decision_record_pack.js +66 -0
- package/lib/phase_2_decision_resolution_pack.js +69 -0
- package/lib/phase_2_eth_runtime_pack.js +70 -0
- package/lib/phase_2_evm_base_runtime_pack.js +73 -0
- package/lib/phase_2_evm_runtime_pack.js +71 -0
- package/lib/phase_2_flip_preview_pack.js +60 -0
- package/lib/phase_2_freeze_review_pack.js +99 -0
- package/lib/phase_2_gate_pack.js +77 -0
- package/lib/phase_2_payment_rails_pack.js +71 -0
- package/lib/phase_2_usdc_runtime_pack.js +71 -0
- package/lib/phase_3_brc_runtime_pack.js +81 -0
- package/lib/phase_3_bsv_teranode_runtime_pack.js +83 -0
- package/lib/phase_3_closeout_pack.js +62 -0
- package/lib/phase_3_completion_pack.js +94 -0
- package/lib/phase_3_decision_record_pack.js +64 -0
- package/lib/phase_3_decision_resolution_pack.js +69 -0
- package/lib/phase_3_freeze_baseline_pack.js +67 -0
- package/lib/phase_3_freeze_review_pack.js +80 -0
- package/lib/phase_3_gate_pack.js +76 -0
- package/lib/phase_3_metanet_runtime_pack.js +81 -0
- package/lib/phase_3_native_bsv_pack.js +91 -0
- package/lib/phase_3_native_continuity_pack.js +82 -0
- package/lib/phase_4_attestation_runtime_pack.js +75 -0
- package/lib/phase_4_closeout_pack.js +45 -0
- package/lib/phase_4_completion_pack.js +94 -0
- package/lib/phase_4_decision_record_pack.js +54 -0
- package/lib/phase_4_decision_resolution_pack.js +45 -0
- package/lib/phase_4_erc8004_runtime_pack.js +76 -0
- package/lib/phase_4_freeze_baseline_pack.js +67 -0
- package/lib/phase_4_freeze_review_pack.js +68 -0
- package/lib/phase_4_gate_pack.js +58 -0
- package/lib/phase_4_identity_registry_runtime_pack.js +75 -0
- package/lib/phase_4_identity_trust_pack.js +73 -0
- package/lib/phase_4_trust_continuity_pack.js +86 -0
- package/lib/phase_5_antelope_runtime_pack.js +76 -0
- package/lib/phase_5_closeout_pack.js +44 -0
- package/lib/phase_5_completion_pack.js +82 -0
- package/lib/phase_5_decision_record_pack.js +54 -0
- package/lib/phase_5_decision_resolution_pack.js +45 -0
- package/lib/phase_5_freeze_baseline_pack.js +67 -0
- package/lib/phase_5_freeze_review_pack.js +68 -0
- package/lib/phase_5_gate_pack.js +58 -0
- package/lib/phase_5_major_rails_continuity_pack.js +86 -0
- package/lib/phase_5_major_rails_pack.js +74 -0
- package/lib/phase_5_proton_xpr_runtime_pack.js +76 -0
- package/lib/phase_5_solana_runtime_pack.js +76 -0
- package/lib/phase_6_autogen_runtime_pack.js +72 -0
- package/lib/phase_6_closeout_pack.js +46 -0
- package/lib/phase_6_completion_pack.js +77 -0
- package/lib/phase_6_decision_record_pack.js +54 -0
- package/lib/phase_6_decision_resolution_pack.js +53 -0
- package/lib/phase_6_framework_continuity_pack.js +81 -0
- package/lib/phase_6_framework_runtime_pack.js +68 -0
- package/lib/phase_6_freeze_baseline_pack.js +68 -0
- package/lib/phase_6_freeze_review_pack.js +65 -0
- package/lib/phase_6_gate_pack.js +59 -0
- package/lib/phase_6_langchain_runtime_pack.js +72 -0
- package/lib/phase_6_langgraph_runtime_pack.js +72 -0
- package/lib/phase_6_semantic_kernel_runtime_pack.js +72 -0
- package/lib/phase_7_closeout_pack.js +45 -0
- package/lib/phase_7_completion_pack.js +85 -0
- package/lib/phase_7_decision_record_pack.js +53 -0
- package/lib/phase_7_decision_resolution_pack.js +53 -0
- package/lib/phase_7_event_system_continuity_pack.js +89 -0
- package/lib/phase_7_event_system_pack.js +76 -0
- package/lib/phase_7_freeze_baseline_pack.js +74 -0
- package/lib/phase_7_freeze_review_pack.js +65 -0
- package/lib/phase_7_gate_pack.js +58 -0
- package/lib/phase_7_kafka_runtime_pack.js +74 -0
- package/lib/phase_7_mqtt_runtime_pack.js +74 -0
- package/lib/phase_7_nats_runtime_pack.js +74 -0
- package/lib/phase_7_webhook_event_bus_runtime_pack.js +74 -0
- package/lib/phase_8_closeout_pack.js +46 -0
- package/lib/phase_8_completion_pack.js +82 -0
- package/lib/phase_8_decision_record_pack.js +54 -0
- package/lib/phase_8_decision_resolution_pack.js +53 -0
- package/lib/phase_8_external_receipt_import_runtime_pack.js +74 -0
- package/lib/phase_8_external_result_import_runtime_pack.js +74 -0
- package/lib/phase_8_freeze_baseline_pack.js +71 -0
- package/lib/phase_8_freeze_review_pack.js +64 -0
- package/lib/phase_8_gate_pack.js +58 -0
- package/lib/phase_8_proof_bridge_continuity_pack.js +86 -0
- package/lib/phase_8_proof_bridges_pack.js +72 -0
- package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +74 -0
- package/lib/phase_9_closeout_pack.js +46 -0
- package/lib/phase_9_completion_pack.js +82 -0
- package/lib/phase_9_custody_refs_runtime_pack.js +74 -0
- package/lib/phase_9_decision_record_pack.js +54 -0
- package/lib/phase_9_decision_resolution_pack.js +53 -0
- package/lib/phase_9_freeze_baseline_pack.js +71 -0
- package/lib/phase_9_freeze_review_pack.js +64 -0
- package/lib/phase_9_gate_pack.js +58 -0
- package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +74 -0
- package/lib/phase_9_treasury_connectivity_pack.js +72 -0
- package/lib/phase_9_treasury_continuity_pack.js +86 -0
- package/lib/phase_9_treasury_destinations_runtime_pack.js +74 -0
- package/lib/phase_program_pack.js +120 -0
- package/lib/publish_plan.js +51 -0
- package/lib/release_candidate.js +50 -0
- package/lib/release_center.js +1085 -0
- package/lib/release_history.js +72 -0
- package/lib/release_manifest.js +114 -0
- package/lib/release_pack.js +454 -0
- package/lib/runtime_state_store.js +354 -0
- package/lib/settlement_bsv_live.js +262 -13
- package/lib/soft_launch_pack.js +78 -0
- package/package.json +24 -2
- package/server.js +2562 -220
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const crypto = require("crypto");
|
|
5
|
+
|
|
6
|
+
function parseArgs(argv) {
|
|
7
|
+
const args = {};
|
|
8
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
9
|
+
const token = argv[index];
|
|
10
|
+
if (!token.startsWith("--")) continue;
|
|
11
|
+
const key = token.slice(2);
|
|
12
|
+
const next = argv[index + 1];
|
|
13
|
+
if (!next || next.startsWith("--")) {
|
|
14
|
+
args[key] = true;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
args[key] = next;
|
|
18
|
+
index += 1;
|
|
19
|
+
}
|
|
20
|
+
return args;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function printUsage() {
|
|
24
|
+
process.stdout.write([
|
|
25
|
+
"Usage: xytara-run --url <service_url> --account <account_id> --command <intent> --task <task_ref> [options]",
|
|
26
|
+
"",
|
|
27
|
+
"Options:",
|
|
28
|
+
" --body-json <json> JSON body for the task payload",
|
|
29
|
+
" --wallet-id <id> Wallet id for local_signed x402 payment",
|
|
30
|
+
" --wallet-secret <secret> Shared secret for local_signed payment",
|
|
31
|
+
" --txid <txid> Existing BSV txid for bsv_teranode settlement",
|
|
32
|
+
" --raw-tx <hex> Raw BSV transaction for arc submission flows",
|
|
33
|
+
" --quote-only Stop after returning the payment challenge",
|
|
34
|
+
" --pretty Pretty-print JSON output",
|
|
35
|
+
" --help Show this help message"
|
|
36
|
+
].join("\n"));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function parseJson(value, label) {
|
|
40
|
+
if (value == null || value === "") return {};
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(value);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
throw new Error(`${label}_must_be_valid_json`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function postJson(url, payload, headers = {}) {
|
|
49
|
+
const response = await fetch(url, {
|
|
50
|
+
method: "POST",
|
|
51
|
+
headers: {
|
|
52
|
+
"content-type": "application/json",
|
|
53
|
+
...headers
|
|
54
|
+
},
|
|
55
|
+
body: JSON.stringify(payload)
|
|
56
|
+
});
|
|
57
|
+
const text = await response.text();
|
|
58
|
+
let json = null;
|
|
59
|
+
try {
|
|
60
|
+
json = text ? JSON.parse(text) : null;
|
|
61
|
+
} catch (_) {
|
|
62
|
+
json = null;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
status: response.status,
|
|
66
|
+
ok: response.ok,
|
|
67
|
+
json,
|
|
68
|
+
text
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function buildLocalSignedPaymentSignature({ quote, accountId, walletId, walletSecret, txid, rawTx }) {
|
|
73
|
+
const payment = {
|
|
74
|
+
account_id: accountId,
|
|
75
|
+
wallet_id: walletId,
|
|
76
|
+
quote_id: quote.quote_id,
|
|
77
|
+
amount_minor: quote.amount_minor,
|
|
78
|
+
currency: quote.currency,
|
|
79
|
+
settlement_mode: quote.settlement.mode,
|
|
80
|
+
settlement_binding_hash: quote.settlement_binding_hash
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
if (quote.settlement && quote.settlement.mode === "bsv_teranode") {
|
|
84
|
+
payment.bsv_teranode = {
|
|
85
|
+
network: quote.settlement.hints && quote.settlement.hints.network ? quote.settlement.hints.network : null,
|
|
86
|
+
merchant_address: quote.settlement.hints && quote.settlement.hints.merchant_address ? quote.settlement.hints.merchant_address : null,
|
|
87
|
+
amount_satoshis: quote.settlement.hints && quote.settlement.hints.amount_satoshis != null ? quote.settlement.hints.amount_satoshis : null,
|
|
88
|
+
settlement_reference: quote.settlement.hints && quote.settlement.hints.settlement_reference ? quote.settlement.hints.settlement_reference : null
|
|
89
|
+
};
|
|
90
|
+
if (txid) payment.bsv_teranode.txid = txid;
|
|
91
|
+
if (rawTx) payment.bsv_teranode.raw_tx = rawTx;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
payment.issued_at_iso = new Date().toISOString();
|
|
95
|
+
payment.nonce = `xytara-cli-${Date.now()}`;
|
|
96
|
+
|
|
97
|
+
const encoded = Buffer.from(JSON.stringify(payment), "utf8").toString("base64url");
|
|
98
|
+
const signature = crypto.createHmac("sha256", walletSecret).update(encoded).digest("hex");
|
|
99
|
+
return Buffer.from(JSON.stringify({
|
|
100
|
+
scheme: "exact",
|
|
101
|
+
wallet_id: walletId,
|
|
102
|
+
payload: encoded,
|
|
103
|
+
signature
|
|
104
|
+
}), "utf8").toString("base64url");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function writeOutput(payload, pretty) {
|
|
108
|
+
process.stdout.write(JSON.stringify(payload, null, pretty ? 2 : 0));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function main() {
|
|
112
|
+
const args = parseArgs(process.argv.slice(2));
|
|
113
|
+
if (args.help) {
|
|
114
|
+
printUsage();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const serviceUrl = String(args.url || "").replace(/\/$/, "");
|
|
119
|
+
const accountId = String(args.account || "").trim();
|
|
120
|
+
const command = String(args.command || "").trim();
|
|
121
|
+
const taskRef = String(args.task || args["task-ref"] || "").trim();
|
|
122
|
+
const body = parseJson(args["body-json"], "body_json");
|
|
123
|
+
const walletId = String(args["wallet-id"] || "").trim();
|
|
124
|
+
const walletSecret = String(args["wallet-secret"] || "").trim();
|
|
125
|
+
const txid = String(args.txid || "").trim() || null;
|
|
126
|
+
const rawTx = String(args["raw-tx"] || "").trim() || null;
|
|
127
|
+
const pretty = args.pretty === true;
|
|
128
|
+
|
|
129
|
+
if (!serviceUrl || !accountId || !command || !taskRef) {
|
|
130
|
+
printUsage();
|
|
131
|
+
process.exitCode = 1;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const executeUrl = `${serviceUrl}/x402/commands/execute`;
|
|
136
|
+
const payload = {
|
|
137
|
+
account_id: accountId,
|
|
138
|
+
command,
|
|
139
|
+
task_ref: taskRef,
|
|
140
|
+
body
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const challengeResult = await postJson(executeUrl, payload);
|
|
144
|
+
if (challengeResult.ok) {
|
|
145
|
+
writeOutput(challengeResult.json || { ok: true }, pretty);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (challengeResult.status !== 402 || !challengeResult.json || !challengeResult.json.payment_required) {
|
|
149
|
+
writeOutput(challengeResult.json || { ok: false, status: challengeResult.status, body: challengeResult.text || null }, pretty);
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (args["quote-only"] === true || !walletId || !walletSecret) {
|
|
155
|
+
writeOutput(challengeResult.json, pretty);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const quote = challengeResult.json.payment_required.quote;
|
|
160
|
+
const paymentSignature = buildLocalSignedPaymentSignature({
|
|
161
|
+
quote,
|
|
162
|
+
accountId,
|
|
163
|
+
walletId,
|
|
164
|
+
walletSecret,
|
|
165
|
+
txid,
|
|
166
|
+
rawTx
|
|
167
|
+
});
|
|
168
|
+
const paidPayload = {
|
|
169
|
+
...payload,
|
|
170
|
+
quote_id: quote.quote_id
|
|
171
|
+
};
|
|
172
|
+
const paidResult = await postJson(executeUrl, paidPayload, {
|
|
173
|
+
"payment-signature": paymentSignature
|
|
174
|
+
});
|
|
175
|
+
if (!paidResult.ok) {
|
|
176
|
+
writeOutput(paidResult.json || { ok: false, status: paidResult.status, body: paidResult.text || null }, pretty);
|
|
177
|
+
process.exitCode = 1;
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
writeOutput(paidResult.json || { ok: true }, pretty);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
main().catch((error) => {
|
|
184
|
+
process.stderr.write(`${error.message}\n`);
|
|
185
|
+
process.exitCode = 1;
|
|
186
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("assert");
|
|
4
|
+
const { createServer } = require("../server");
|
|
5
|
+
|
|
6
|
+
async function fetchJson(url) {
|
|
7
|
+
const response = await fetch(url);
|
|
8
|
+
assert.strictEqual(response.ok, true, `request failed: ${url}`);
|
|
9
|
+
return response.json();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function postJson(url, body) {
|
|
13
|
+
const response = await fetch(url, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: {
|
|
16
|
+
"content-type": "application/json"
|
|
17
|
+
},
|
|
18
|
+
body: JSON.stringify(body)
|
|
19
|
+
});
|
|
20
|
+
assert.strictEqual(response.ok, true, `request failed: ${url}`);
|
|
21
|
+
return response.json();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
const server = createServer();
|
|
26
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
27
|
+
const { port } = server.address();
|
|
28
|
+
const baseUrl = `http://127.0.0.1:${port}`;
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const partnerSummary = await fetchJson(`${baseUrl}/v1/adapter-partners/summary`);
|
|
32
|
+
assert.strictEqual(typeof partnerSummary.category, "string", "adapter partner summary missing");
|
|
33
|
+
|
|
34
|
+
const readiness = await fetchJson(`${baseUrl}/v1/integrations/promotion-readiness`);
|
|
35
|
+
assert.strictEqual(readiness.ok, true, "promotion readiness summary missing");
|
|
36
|
+
|
|
37
|
+
const actionPreview = await postJson(`${baseUrl}/v1/integrations/promotion-actions/preview`, {
|
|
38
|
+
integration_id: "partner.protocol.acme_mcp",
|
|
39
|
+
action: "complete_certification"
|
|
40
|
+
});
|
|
41
|
+
assert.strictEqual(actionPreview.ok, true, "promotion action preview missing");
|
|
42
|
+
assert.strictEqual(actionPreview.valid_now, true, "promotion action preview should be valid");
|
|
43
|
+
|
|
44
|
+
console.log("xytara adapter review walkthrough passed");
|
|
45
|
+
} finally {
|
|
46
|
+
await new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
main().catch((error) => {
|
|
51
|
+
console.error(error);
|
|
52
|
+
process.exitCode = 1;
|
|
53
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("assert");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const { createServer } = require("../server");
|
|
7
|
+
const { createClient } = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function parseOutputPath(argv) {
|
|
10
|
+
const args = Array.isArray(argv) ? argv : [];
|
|
11
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
12
|
+
if (args[index] === "--output" && args[index + 1]) {
|
|
13
|
+
return path.resolve(process.cwd(), args[index + 1]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return path.resolve(process.cwd(), "examples", "generated.carried-handoff.json");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function main() {
|
|
20
|
+
const outputPath = parseOutputPath(process.argv.slice(2));
|
|
21
|
+
const server = createServer();
|
|
22
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
23
|
+
const address = server.address();
|
|
24
|
+
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const client = createClient({
|
|
28
|
+
baseUrl,
|
|
29
|
+
apiKey: "demo-api-key",
|
|
30
|
+
walletId: "demo-wallet",
|
|
31
|
+
walletSecret: "demo-wallet-secret",
|
|
32
|
+
accountId: "acct_demo"
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const health = await client.getHealthSummary();
|
|
36
|
+
assert.strictEqual(health.status, "ok", "health summary missing");
|
|
37
|
+
|
|
38
|
+
const exported = await client.exportInteractionResultPackage("result.spine.job.commitment", {
|
|
39
|
+
job_type: "batch.render",
|
|
40
|
+
job_id: "job-carried-handoff-demo",
|
|
41
|
+
source_zone_id: "zone.alpha",
|
|
42
|
+
target_zone_id: "zone.beta",
|
|
43
|
+
interaction_class: "cross_zone_job"
|
|
44
|
+
}, {
|
|
45
|
+
command: "carried-handoff-demo-export"
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
assert.strictEqual(
|
|
49
|
+
exported.portable_handoff_bundle.result_package_ref,
|
|
50
|
+
"result.spine.job.commitment",
|
|
51
|
+
"portable handoff result package ref missing"
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const reviewInput = {
|
|
55
|
+
handoff_bundle: exported.portable_handoff_bundle
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
59
|
+
fs.writeFileSync(outputPath, JSON.stringify(reviewInput, null, 2));
|
|
60
|
+
|
|
61
|
+
process.stdout.write(JSON.stringify({
|
|
62
|
+
ok: true,
|
|
63
|
+
output_file: outputPath,
|
|
64
|
+
result_package_ref: exported.portable_handoff_bundle.result_package_ref,
|
|
65
|
+
committed_ref: exported.portable_handoff_bundle.committed_ref,
|
|
66
|
+
proof_review_summary_surface: "/v1/proof-center/result-package-handoff/review/summary",
|
|
67
|
+
proof_run_surface: "/v1/proof-center/result-package-handoff/run",
|
|
68
|
+
next_xoonya_cli: `xoonya-review --file "${outputPath}" --summary`
|
|
69
|
+
}, null, 2));
|
|
70
|
+
} finally {
|
|
71
|
+
await new Promise((resolve, reject) => {
|
|
72
|
+
server.close((error) => (error ? reject(error) : resolve()));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
main().catch((error) => {
|
|
78
|
+
process.stderr.write(`${error.stack || error.message}\n`);
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("assert");
|
|
4
|
+
const { createServer } = require("../server");
|
|
5
|
+
|
|
6
|
+
async function fetchJson(url, options) {
|
|
7
|
+
const response = await fetch(url, options);
|
|
8
|
+
assert.strictEqual(response.ok, true, `request failed: ${url}`);
|
|
9
|
+
return response.json();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function postJson(url, body, headers = {}) {
|
|
13
|
+
return fetchJson(url, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: {
|
|
16
|
+
"content-type": "application/json",
|
|
17
|
+
authorization: "Bearer demo-api-key",
|
|
18
|
+
...headers
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify(body)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
const server = createServer();
|
|
26
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
27
|
+
const { port } = server.address();
|
|
28
|
+
const baseUrl = `http://127.0.0.1:${port}`;
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const packSummary = await fetchJson(`${baseUrl}/v1/credit-packs/summary`);
|
|
32
|
+
assert.strictEqual(packSummary.ok, true, "credit pack summary missing");
|
|
33
|
+
assert.strictEqual(packSummary.credit_pack_count > 0, true, "credit pack count missing");
|
|
34
|
+
|
|
35
|
+
const grant = await postJson(
|
|
36
|
+
`${baseUrl}/v1/credit-bridge/grants`,
|
|
37
|
+
{
|
|
38
|
+
account_id: "acct_demo",
|
|
39
|
+
pack_id: "credits.agent",
|
|
40
|
+
grant_units: 120,
|
|
41
|
+
settlement_ref: "settlement-funded-runtime-demo-1",
|
|
42
|
+
external_ref: "external-funded-runtime-demo-1"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
authorization: "Bearer demo-credit-bridge-token"
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
assert.strictEqual(grant.ok, true, "credit bridge grant missing");
|
|
49
|
+
|
|
50
|
+
const balance = await fetchJson(`${baseUrl}/v1/economics/accounts/acct_demo/credit-balance`);
|
|
51
|
+
assert.strictEqual(balance.account_id, "acct_demo", "credit balance missing");
|
|
52
|
+
assert.strictEqual(balance.available_units > 0, true, "credit balance not funded");
|
|
53
|
+
|
|
54
|
+
const preview = await postJson(`${baseUrl}/v1/economics/rails/credits/preview-spend`, {
|
|
55
|
+
account_id: "acct_demo",
|
|
56
|
+
task_ref: "trust.verify",
|
|
57
|
+
units: 40
|
|
58
|
+
});
|
|
59
|
+
assert.strictEqual(preview.ok, true, "credit preview missing");
|
|
60
|
+
|
|
61
|
+
console.log("xytara funded runtime walkthrough passed");
|
|
62
|
+
} finally {
|
|
63
|
+
await new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main().catch((error) => {
|
|
68
|
+
console.error(error);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("assert");
|
|
4
|
+
const { createServer } = require("../server");
|
|
5
|
+
|
|
6
|
+
async function fetchJson(url, options) {
|
|
7
|
+
const response = await fetch(url, options);
|
|
8
|
+
assert.strictEqual(response.ok, true, `request failed: ${url}`);
|
|
9
|
+
return response.json();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
const server = createServer();
|
|
14
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
15
|
+
const address = server.address();
|
|
16
|
+
const baseUrl = `http://127.0.0.1:${address.port}`;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const releaseCenterSummary = await fetchJson(`${baseUrl}/v1/release-center/summary`);
|
|
20
|
+
assert.strictEqual(typeof releaseCenterSummary.category, "string", "release-center summary category missing");
|
|
21
|
+
|
|
22
|
+
const releaseCandidateSummary = await fetchJson(`${baseUrl}/v1/release-candidate/summary`);
|
|
23
|
+
assert.strictEqual(typeof releaseCandidateSummary.category, "string", "release-candidate summary category missing");
|
|
24
|
+
|
|
25
|
+
const durability = await fetchJson(`${baseUrl}/v1/runtime/durability`);
|
|
26
|
+
assert.strictEqual(durability.ok, true, "durability surface missing");
|
|
27
|
+
assert.strictEqual(typeof durability.operator_guidance, "string", "durability guidance missing");
|
|
28
|
+
|
|
29
|
+
const adapterPartnersSummary = await fetchJson(`${baseUrl}/v1/adapter-partners/summary`);
|
|
30
|
+
assert.strictEqual(typeof adapterPartnersSummary.category, "string", "adapter partners summary category missing");
|
|
31
|
+
|
|
32
|
+
console.log("xytara partner launch walkthrough passed");
|
|
33
|
+
} finally {
|
|
34
|
+
await new Promise((resolve, reject) => {
|
|
35
|
+
server.close((error) => (error ? reject(error) : resolve()));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
main().catch((error) => {
|
|
41
|
+
console.error(error);
|
|
42
|
+
process.exitCode = 1;
|
|
43
|
+
});
|