xytara 1.12.0 → 1.14.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 CHANGED
@@ -139,10 +139,21 @@ The current `1.10.0` line starts building on that by exposing reusable continuat
139
139
  - continuation summaries that make the default transaction-to-proof bridge explicit instead of inferred
140
140
  - prepared continuation artifacts that classify the preserved execution, economic, and proof-facing context that survives into proof-native follow-through
141
141
  - extension-seam summaries that distinguish stable carry from future adapter-ready boundary points on that durable path
142
+ - reusable-default summaries that expose the stable prepared artifact as a clearer default follow-through pattern
143
+ - reusable-default template surfaces that package that same default path into a direct proof-side review request
142
144
  - extension-template surfaces that turn the durable transaction-side artifact into a reusable proof-side extension-review request
143
145
 
144
146
  This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
145
147
 
148
+ The current `1.14.0` line starts hardening that reusable path into a clearer public composition contract:
149
+
150
+ - prepared-artifact composition-contract summaries
151
+ - composition-contract template surfaces for proof-side contract review
152
+ - compact composition-contract bundles for direct transaction-side contract reuse
153
+ - clearer public contract ids across the reusable-default continuation path
154
+
155
+ This is intended to make the transaction-side continuation path easier to treat as a stable public contract instead of only a strong reusable default.
156
+
146
157
  ## Package Surface
147
158
 
148
159
  The SDK is broad, but it stays organized into a few repeatable families instead of one-off surfaces.
package/index.js CHANGED
@@ -40,7 +40,7 @@ const {
40
40
  } = require("./integrations/registry");
41
41
 
42
42
  const COMMERCE_SDK_NAME = "xytara";
43
- const COMMERCE_SDK_VERSION = "1.12.0";
43
+ const COMMERCE_SDK_VERSION = "1.14.0";
44
44
  const COMMERCE_API_VERSION = "v1";
45
45
 
46
46
  function createClient(options) {
@@ -1175,14 +1175,30 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
1175
1175
  const extensionTemplate = item.extension_template && typeof item.extension_template === "object"
1176
1176
  ? item.extension_template
1177
1177
  : {};
1178
+ const reusableDefault = item.reusable_default_summary && typeof item.reusable_default_summary === "object"
1179
+ ? item.reusable_default_summary
1180
+ : {};
1181
+ const reusableDefaultTemplate = item.reusable_default_template && typeof item.reusable_default_template === "object"
1182
+ ? item.reusable_default_template
1183
+ : {};
1184
+ const compositionContract = item.composition_contract_summary && typeof item.composition_contract_summary === "object"
1185
+ ? item.composition_contract_summary
1186
+ : {};
1187
+ const compositionContractTemplate = item.composition_contract_template && typeof item.composition_contract_template === "object"
1188
+ ? item.composition_contract_template
1189
+ : {};
1178
1190
  return {
1179
1191
  ok: item.ok === true,
1180
1192
  continuation_ref: continuation ? continuation.continuation_ref : null,
1181
1193
  result_package_ref: continuation ? continuation.result_package_ref : null,
1182
1194
  prepared_artifact_ref: artifact.prepared_artifact_ref || null,
1183
1195
  extension_seam_ref: extension.extension_seam_ref || null,
1196
+ reusable_default_ref: reusableDefault.reusable_default_ref || null,
1184
1197
  target_surface: template.target_surface || null,
1185
1198
  review_surface: template.review_surface || null,
1199
+ default_review_surface: reusableDefault.default_followthrough && reusableDefault.default_followthrough.review_surface
1200
+ ? reusableDefault.default_followthrough.review_surface
1201
+ : null,
1186
1202
  continuation_ready: continuation ? continuation.continuation_ready === true : false,
1187
1203
  evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
1188
1204
  ? template.request_template.evidence_refs.length
@@ -1193,7 +1209,12 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
1193
1209
  artifact.preserved_context.proof_handoff.seam_layer_count || 0
1194
1210
  ),
1195
1211
  proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true,
1212
+ reusable_by_default: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
1213
+ composition_contract_ref: compositionContract.composition_contract_ref || null,
1214
+ contract_ready: compositionContract.contract_ready === true,
1196
1215
  future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
1216
+ reusable_default_target_surface: reusableDefaultTemplate.target_surface || null,
1217
+ composition_contract_target_surface: compositionContractTemplate.target_surface || null,
1197
1218
  extension_target_surface: extensionTemplate.target_surface || null
1198
1219
  };
1199
1220
  }
@@ -4346,6 +4367,86 @@ class CommerceClient {
4346
4367
  });
4347
4368
  }
4348
4369
 
4370
+ async prepareInteractionResultPackageReusableDefaultSummary(continuationRef, body, options) {
4371
+ const opts = options || {};
4372
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/default-summary", {
4373
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.default.summary",
4374
+ continuation_ref: String(continuationRef || "").trim(),
4375
+ body: body || {},
4376
+ callback_url: opts.callbackUrl || null,
4377
+ settlement_mode: opts.settlementMode || null,
4378
+ payment_protocol: opts.paymentProtocol || null,
4379
+ protocol: opts.protocol || null,
4380
+ integration_id: opts.integrationId || null,
4381
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4382
+ integration_context: opts.integrationContext || null
4383
+ });
4384
+ }
4385
+
4386
+ async prepareInteractionResultPackageReusableDefaultTemplate(continuationRef, body, options) {
4387
+ const opts = options || {};
4388
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/default-template", {
4389
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.default.template",
4390
+ continuation_ref: String(continuationRef || "").trim(),
4391
+ body: body || {},
4392
+ callback_url: opts.callbackUrl || null,
4393
+ settlement_mode: opts.settlementMode || null,
4394
+ payment_protocol: opts.paymentProtocol || null,
4395
+ protocol: opts.protocol || null,
4396
+ integration_id: opts.integrationId || null,
4397
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4398
+ integration_context: opts.integrationContext || null
4399
+ });
4400
+ }
4401
+
4402
+ async prepareInteractionResultPackageCompositionContractSummary(continuationRef, body, options) {
4403
+ const opts = options || {};
4404
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/contract-summary", {
4405
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.contract.summary",
4406
+ continuation_ref: String(continuationRef || "").trim(),
4407
+ body: body || {},
4408
+ callback_url: opts.callbackUrl || null,
4409
+ settlement_mode: opts.settlementMode || null,
4410
+ payment_protocol: opts.paymentProtocol || null,
4411
+ protocol: opts.protocol || null,
4412
+ integration_id: opts.integrationId || null,
4413
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4414
+ integration_context: opts.integrationContext || null
4415
+ });
4416
+ }
4417
+
4418
+ async prepareInteractionResultPackageCompositionContractBundle(continuationRef, body, options) {
4419
+ const opts = options || {};
4420
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/contract-bundle", {
4421
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.contract.bundle",
4422
+ continuation_ref: String(continuationRef || "").trim(),
4423
+ body: body || {},
4424
+ callback_url: opts.callbackUrl || null,
4425
+ settlement_mode: opts.settlementMode || null,
4426
+ payment_protocol: opts.paymentProtocol || null,
4427
+ protocol: opts.protocol || null,
4428
+ integration_id: opts.integrationId || null,
4429
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4430
+ integration_context: opts.integrationContext || null
4431
+ });
4432
+ }
4433
+
4434
+ async prepareInteractionResultPackageCompositionContractTemplate(continuationRef, body, options) {
4435
+ const opts = options || {};
4436
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/contract-template", {
4437
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.contract.template",
4438
+ continuation_ref: String(continuationRef || "").trim(),
4439
+ body: body || {},
4440
+ callback_url: opts.callbackUrl || null,
4441
+ settlement_mode: opts.settlementMode || null,
4442
+ payment_protocol: opts.paymentProtocol || null,
4443
+ protocol: opts.protocol || null,
4444
+ integration_id: opts.integrationId || null,
4445
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4446
+ integration_context: opts.integrationContext || null
4447
+ });
4448
+ }
4449
+
4349
4450
  async runNamedTaskRoute(path, payload) {
4350
4451
  if (!this.apiKey || !this.walletId || !this.walletSecret) {
4351
4452
  throw new Error("named task routes require apiKey, walletId, and walletSecret");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xytara",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "Machine commerce SDK for discovery, quoting, execution, lifecycle inspection, and adapters.",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/server.js CHANGED
@@ -1219,6 +1219,126 @@ function buildPreparedContinuationExtensionTemplate(portableHandoff, continuatio
1219
1219
  };
1220
1220
  }
1221
1221
 
1222
+ function buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation) {
1223
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1224
+ const seamLayers = Array.isArray(handoff.seam_layers) ? handoff.seam_layers : [];
1225
+ const taskRefs = Array.isArray(handoff.task_refs) ? handoff.task_refs : [];
1226
+ return {
1227
+ ok: true,
1228
+ reusable_default_ref: continuation && continuation.continuation_ref
1229
+ ? `default.${continuation.continuation_ref}`
1230
+ : null,
1231
+ continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
1232
+ prepared_artifact_ref: continuation && continuation.continuation_ref
1233
+ ? `prepared.${continuation.continuation_ref}`
1234
+ : null,
1235
+ stable_default_carry: {
1236
+ execution_context: {
1237
+ committed_ref: handoff.committed_ref || null,
1238
+ task_ref_count: taskRefs.length
1239
+ },
1240
+ economic_context: {
1241
+ payment_protocol: handoff.payment_protocol || null,
1242
+ settlement_mode: handoff.settlement_mode || null,
1243
+ treasury_destination_id: handoff.treasury_destination_id || null
1244
+ },
1245
+ proof_context: {
1246
+ source_ref: handoff.source_ref || null,
1247
+ seam_layer_count: seamLayers.length
1248
+ }
1249
+ },
1250
+ default_followthrough: {
1251
+ review_surface: "/v1/proof-center/result-package-handoff/review/default-continuation",
1252
+ review_summary_surface: "/v1/proof-center/result-package-handoff/review/summary",
1253
+ run_surface: "/v1/proof-center/result-package-handoff/run",
1254
+ reusable_by_default: Boolean(handoff.result_package_ref && handoff.transaction_id && handoff.receipt_id && handoff.proof_ref)
1255
+ }
1256
+ };
1257
+ }
1258
+
1259
+ function buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation) {
1260
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1261
+ const summary = buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation);
1262
+ return {
1263
+ ok: true,
1264
+ reusable_default_ref: summary.reusable_default_ref || null,
1265
+ target_surface: "/v1/proof-center/result-package-handoff/review/default-continuation",
1266
+ request_template: {
1267
+ handoff_bundle: handoff
1268
+ },
1269
+ stable_boundary_ids: [
1270
+ "prepared_artifact_default",
1271
+ "review_default_continuation",
1272
+ "proof_run"
1273
+ ]
1274
+ };
1275
+ }
1276
+
1277
+ function buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation) {
1278
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1279
+ const reusableDefault = buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation);
1280
+ const seamLayers = Array.isArray(handoff.seam_layers) ? handoff.seam_layers : [];
1281
+ return {
1282
+ ok: true,
1283
+ composition_contract_ref: continuation && continuation.continuation_ref
1284
+ ? `contract.${continuation.continuation_ref}`
1285
+ : null,
1286
+ reusable_default_ref: reusableDefault.reusable_default_ref || null,
1287
+ public_contract_ids: [
1288
+ "prepared_artifact",
1289
+ "reusable_default_review",
1290
+ "proof_run"
1291
+ ],
1292
+ contract_carry: {
1293
+ execution_context: {
1294
+ committed_ref: handoff.committed_ref || null,
1295
+ stable: Boolean(handoff.committed_ref)
1296
+ },
1297
+ economic_context: {
1298
+ payment_protocol: handoff.payment_protocol || null,
1299
+ settlement_mode: handoff.settlement_mode || null,
1300
+ treasury_destination_id: handoff.treasury_destination_id || null
1301
+ },
1302
+ proof_context: {
1303
+ source_ref: handoff.source_ref || null,
1304
+ seam_layer_count: seamLayers.length
1305
+ }
1306
+ },
1307
+ helper_only_summary_ids: [
1308
+ "extension_seam_summary",
1309
+ "portable_handoff_summary"
1310
+ ],
1311
+ contract_ready: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
1312
+ next_surface: "/v1/proof-center/result-package-handoff/review/contract-summary"
1313
+ };
1314
+ }
1315
+
1316
+ function buildPreparedContinuationCompositionContractTemplate(portableHandoff, continuation) {
1317
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1318
+ const summary = buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation);
1319
+ return {
1320
+ ok: true,
1321
+ composition_contract_ref: summary.composition_contract_ref || null,
1322
+ target_surface: "/v1/proof-center/result-package-handoff/review/contract-summary",
1323
+ request_template: {
1324
+ handoff_bundle: handoff
1325
+ },
1326
+ stable_boundary_ids: [
1327
+ "prepared_artifact_contract",
1328
+ "review_contract_summary",
1329
+ "proof_run"
1330
+ ]
1331
+ };
1332
+ }
1333
+
1334
+ function buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation) {
1335
+ return {
1336
+ ok: true,
1337
+ composition_contract_summary: buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation),
1338
+ composition_contract_template: buildPreparedContinuationCompositionContractTemplate(portableHandoff, continuation)
1339
+ };
1340
+ }
1341
+
1222
1342
  function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
1223
1343
  const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1224
1344
  return {
@@ -2175,6 +2295,9 @@ async function routeRequest(req, res) {
2175
2295
  continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
2176
2296
  prepared_artifact_summary: buildPreparedContinuationArtifactSummary(portableHandoff, continuation),
2177
2297
  extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
2298
+ reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
2299
+ reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
2300
+ ...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
2178
2301
  extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
2179
2302
  proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
2180
2303
  });
@@ -2211,11 +2334,169 @@ async function routeRequest(req, res) {
2211
2334
  sendJson(res, 200, {
2212
2335
  ...buildPreparedContinuationArtifactCompactSummary(portableHandoff, continuation),
2213
2336
  extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
2337
+ reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
2338
+ reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
2339
+ ...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
2214
2340
  extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
2215
2341
  });
2216
2342
  return;
2217
2343
  }
2218
2344
 
2345
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/default-summary") {
2346
+ const body = await readJsonBody(req);
2347
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2348
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2349
+ if (!continuation) {
2350
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2351
+ return;
2352
+ }
2353
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2354
+ if (!resultPackage) {
2355
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2356
+ return;
2357
+ }
2358
+ const payload = buildInteractionSpinePathRunPayload({
2359
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2360
+ spine_path_ref: resultPackage.source_ref
2361
+ });
2362
+ if (!payload) {
2363
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2364
+ return;
2365
+ }
2366
+ const result = executeCommandRequest(state, payload, req.headers);
2367
+ if (result.status !== 200) {
2368
+ sendJson(res, result.status, result.payload);
2369
+ return;
2370
+ }
2371
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2372
+ sendJson(res, 200, buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation));
2373
+ return;
2374
+ }
2375
+
2376
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-summary") {
2377
+ const body = await readJsonBody(req);
2378
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2379
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2380
+ if (!continuation) {
2381
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2382
+ return;
2383
+ }
2384
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2385
+ if (!resultPackage) {
2386
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2387
+ return;
2388
+ }
2389
+ const payload = buildInteractionSpinePathRunPayload({
2390
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2391
+ spine_path_ref: resultPackage.source_ref
2392
+ });
2393
+ if (!payload) {
2394
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2395
+ return;
2396
+ }
2397
+ const result = executeCommandRequest(state, payload, req.headers);
2398
+ if (result.status !== 200) {
2399
+ sendJson(res, result.status, result.payload);
2400
+ return;
2401
+ }
2402
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2403
+ sendJson(res, 200, buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation));
2404
+ return;
2405
+ }
2406
+
2407
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-bundle") {
2408
+ const body = await readJsonBody(req);
2409
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2410
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2411
+ if (!continuation) {
2412
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2413
+ return;
2414
+ }
2415
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2416
+ if (!resultPackage) {
2417
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2418
+ return;
2419
+ }
2420
+ const payload = buildInteractionSpinePathRunPayload({
2421
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2422
+ spine_path_ref: resultPackage.source_ref
2423
+ });
2424
+ if (!payload) {
2425
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2426
+ return;
2427
+ }
2428
+ const result = executeCommandRequest(state, payload, req.headers);
2429
+ if (result.status !== 200) {
2430
+ sendJson(res, result.status, result.payload);
2431
+ return;
2432
+ }
2433
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2434
+ sendJson(res, 200, buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation));
2435
+ return;
2436
+ }
2437
+
2438
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
2439
+ const body = await readJsonBody(req);
2440
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2441
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2442
+ if (!continuation) {
2443
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2444
+ return;
2445
+ }
2446
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2447
+ if (!resultPackage) {
2448
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2449
+ return;
2450
+ }
2451
+ const payload = buildInteractionSpinePathRunPayload({
2452
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2453
+ spine_path_ref: resultPackage.source_ref
2454
+ });
2455
+ if (!payload) {
2456
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2457
+ return;
2458
+ }
2459
+ const result = executeCommandRequest(state, payload, req.headers);
2460
+ if (result.status !== 200) {
2461
+ sendJson(res, result.status, result.payload);
2462
+ return;
2463
+ }
2464
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2465
+ sendJson(res, 200, buildPreparedContinuationCompositionContractTemplate(portableHandoff, continuation));
2466
+ return;
2467
+ }
2468
+
2469
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/default-template") {
2470
+ const body = await readJsonBody(req);
2471
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2472
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2473
+ if (!continuation) {
2474
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2475
+ return;
2476
+ }
2477
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2478
+ if (!resultPackage) {
2479
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2480
+ return;
2481
+ }
2482
+ const payload = buildInteractionSpinePathRunPayload({
2483
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2484
+ spine_path_ref: resultPackage.source_ref
2485
+ });
2486
+ if (!payload) {
2487
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2488
+ return;
2489
+ }
2490
+ const result = executeCommandRequest(state, payload, req.headers);
2491
+ if (result.status !== 200) {
2492
+ sendJson(res, result.status, result.payload);
2493
+ return;
2494
+ }
2495
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2496
+ sendJson(res, 200, buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation));
2497
+ return;
2498
+ }
2499
+
2219
2500
  if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/extension-template") {
2220
2501
  const body = await readJsonBody(req);
2221
2502
  const continuationRef = String(body && body.continuation_ref || "").trim();