xytara 1.9.0 → 1.11.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
@@ -130,6 +130,17 @@ The current `1.9.0` line starts hardening the output side of that spine into cle
130
130
 
131
131
  This is intended to make grouped spine outputs easier to treat as stable artifacts and future adapter-ready boundaries instead of one-off route responses.
132
132
 
133
+ The current `1.10.0` line starts building on that by exposing reusable continuation templates on top of result packages:
134
+
135
+ - result-package continuation catalog, summary, and detail routes
136
+ - direct continuation run surfaces that preserve the default next proof path
137
+ - continuation preparation surfaces that emit proof-ready request templates
138
+ - continuation preparation summary surfaces that expose the stable prepared-artifact view directly
139
+ - continuation summaries that make the default transaction-to-proof bridge explicit instead of inferred
140
+ - prepared continuation artifacts that classify the preserved execution, economic, and proof-facing context that survives into proof-native follow-through
141
+
142
+ This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
143
+
133
144
  ## Package Surface
134
145
 
135
146
  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.9.0";
43
+ const COMMERCE_SDK_VERSION = "1.11.0";
44
44
  const COMMERCE_API_VERSION = "v1";
45
45
 
46
46
  function createClient(options) {
@@ -332,6 +332,31 @@ function buildInteractionResultPackages() {
332
332
  }));
333
333
  }
334
334
 
335
+ function buildInteractionResultPackageContinuationTemplates() {
336
+ return buildInteractionResultPackages().map((resultPackage) => ({
337
+ continuation_ref: resultPackage && resultPackage.result_package_ref
338
+ ? `continue.${resultPackage.result_package_ref}`
339
+ : null,
340
+ result_package_ref: resultPackage && resultPackage.result_package_ref ? resultPackage.result_package_ref : null,
341
+ source_ref: resultPackage && resultPackage.source_ref ? resultPackage.source_ref : null,
342
+ title: resultPackage && resultPackage.title
343
+ ? `${resultPackage.title} Continuation`
344
+ : "Interaction Result Package Continuation",
345
+ description: resultPackage && resultPackage.description
346
+ ? `${resultPackage.description} Continue through the reusable default path into proof-native follow-through.`
347
+ : "Continue through the reusable default path into proof-native follow-through.",
348
+ continuation_kind: "proof_native_default",
349
+ default_next_surface: "/v1/transaction-center/result-package-continuations/run",
350
+ default_export_surface: "/v1/transaction-center/result-packages/export",
351
+ default_proof_surface: "/v1/proof-center/result-package-handoff/run",
352
+ committed_ref: resultPackage && resultPackage.committed_ref ? resultPackage.committed_ref : null,
353
+ precommit_pack_ref: resultPackage && resultPackage.precommit_pack_ref ? resultPackage.precommit_pack_ref : null,
354
+ seam_layers: Array.isArray(resultPackage && resultPackage.seam_layers) ? resultPackage.seam_layers : [],
355
+ required_inputs: Array.isArray(resultPackage && resultPackage.required_inputs) ? resultPackage.required_inputs : [],
356
+ optional_inputs: Array.isArray(resultPackage && resultPackage.optional_inputs) ? resultPackage.optional_inputs : []
357
+ }));
358
+ }
359
+
335
360
  function buildDefaultTransactionCenter() {
336
361
  const settlementProfiles = Array.isArray(catalog.settlement_profiles) ? catalog.settlement_profiles : [];
337
362
  const defaultSettlementProfile = settlementProfiles[0] || null;
@@ -590,6 +615,20 @@ function buildInteractionResultPackageCatalog() {
590
615
  };
591
616
  }
592
617
 
618
+ function buildInteractionResultPackageContinuationCatalog() {
619
+ const center = buildDefaultTransactionCenter();
620
+ const templates = buildInteractionResultPackageContinuationTemplates();
621
+ return {
622
+ ok: true,
623
+ brand: center.brand,
624
+ product: "interaction result package continuations",
625
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
626
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
627
+ continuation_count: templates.length,
628
+ continuations: templates
629
+ };
630
+ }
631
+
593
632
  function summarizeTransactionClassPacks() {
594
633
  const catalogResponse = buildTransactionClassPackCatalog();
595
634
  const packs = Array.isArray(catalogResponse.class_packs) ? catalogResponse.class_packs : [];
@@ -655,6 +694,22 @@ function summarizeInteractionResultPackages() {
655
694
  };
656
695
  }
657
696
 
697
+ function summarizeInteractionResultPackageContinuations() {
698
+ const catalogResponse = buildInteractionResultPackageContinuationCatalog();
699
+ const templates = Array.isArray(catalogResponse.continuations) ? catalogResponse.continuations : [];
700
+ return {
701
+ ok: true,
702
+ brand: catalogResponse.brand,
703
+ product: catalogResponse.product,
704
+ default_payment_protocol: catalogResponse.default_payment_protocol,
705
+ default_settlement_mode: catalogResponse.default_settlement_mode,
706
+ continuation_count: templates.length,
707
+ continuation_refs: templates.map((entry) => entry && entry.continuation_ref).filter(Boolean),
708
+ result_package_refs: templates.map((entry) => entry && entry.result_package_ref).filter(Boolean),
709
+ continuations: templates
710
+ };
711
+ }
712
+
658
713
  function getTransactionClassPack(ref) {
659
714
  const normalized = String(ref || "").trim();
660
715
  if (!normalized) return null;
@@ -679,6 +734,12 @@ function getInteractionResultPackage(ref) {
679
734
  return buildInteractionResultPackages().find((entry) => entry && entry.result_package_ref === normalized) || null;
680
735
  }
681
736
 
737
+ function getInteractionResultPackageContinuation(ref) {
738
+ const normalized = String(ref || "").trim();
739
+ if (!normalized) return null;
740
+ return buildInteractionResultPackageContinuationTemplates().find((entry) => entry && entry.continuation_ref === normalized) || null;
741
+ }
742
+
682
743
  function buildCatalogResponse() {
683
744
  return {
684
745
  ok: true,
@@ -814,6 +875,7 @@ module.exports = {
814
875
  buildDefaultTransactionCenter,
815
876
  buildDefaultTransactionGuidedLoopCatalog,
816
877
  buildInteractionResultPackageCatalog,
878
+ buildInteractionResultPackageContinuationCatalog,
817
879
  buildInteractionSpinePathCatalog,
818
880
  buildPrecommitInteractionPackCatalog,
819
881
  buildDefaultTransactionTaskPackCatalog,
@@ -822,6 +884,7 @@ module.exports = {
822
884
  getDefaultTransactionGuidedLoop,
823
885
  getDefaultTransactionTaskPack,
824
886
  getInteractionResultPackage,
887
+ getInteractionResultPackageContinuation,
825
888
  getInteractionSpinePath,
826
889
  getPrecommitInteractionPack,
827
890
  getTransactionClassPack,
@@ -833,6 +896,7 @@ module.exports = {
833
896
  summarizeDefaultTransactionEconomics,
834
897
  summarizeDefaultTransactionGuidedLoops,
835
898
  summarizeDefaultTransactionTaskPacks,
899
+ summarizeInteractionResultPackageContinuations,
836
900
  summarizeInteractionResultPackages,
837
901
  summarizeInteractionSpinePaths,
838
902
  summarizePrecommitInteractionPacks,
@@ -1139,6 +1139,56 @@ function summarizeInteractionResultPackagePortableHandoffPayload(payload) {
1139
1139
  };
1140
1140
  }
1141
1141
 
1142
+ function summarizeInteractionResultPackageContinuationPayload(payload) {
1143
+ const item = payload && typeof payload === "object" ? payload : {};
1144
+ return {
1145
+ ok: item.ok === true,
1146
+ continuation_ref: item.continuation_ref || null,
1147
+ result_package_ref: item.result_package_ref || null,
1148
+ source_ref: item.source_ref || null,
1149
+ continuation_kind: item.continuation_kind || null,
1150
+ default_next_surface: item.default_next_surface || null,
1151
+ default_export_surface: item.default_export_surface || null,
1152
+ default_proof_surface: item.default_proof_surface || null,
1153
+ transaction_id: item.transaction_id || null,
1154
+ receipt_id: item.receipt_id || null,
1155
+ proof_ref: item.proof_ref || null,
1156
+ continuation_ready: item.continuation_ready === true,
1157
+ seam_layer_count: Number(item.seam_layer_count || 0)
1158
+ };
1159
+ }
1160
+
1161
+ function summarizeInteractionResultPackageContinuationPreparationPayload(payload) {
1162
+ const item = payload && typeof payload === "object" ? payload : {};
1163
+ const continuation = item.continuation_summary && typeof item.continuation_summary === "object"
1164
+ ? summarizeInteractionResultPackageContinuationPayload(item.continuation_summary)
1165
+ : null;
1166
+ const template = item.proof_request_template && typeof item.proof_request_template === "object"
1167
+ ? item.proof_request_template
1168
+ : {};
1169
+ const artifact = item.prepared_artifact_summary && typeof item.prepared_artifact_summary === "object"
1170
+ ? item.prepared_artifact_summary
1171
+ : {};
1172
+ return {
1173
+ ok: item.ok === true,
1174
+ continuation_ref: continuation ? continuation.continuation_ref : null,
1175
+ result_package_ref: continuation ? continuation.result_package_ref : null,
1176
+ prepared_artifact_ref: artifact.prepared_artifact_ref || null,
1177
+ target_surface: template.target_surface || null,
1178
+ review_surface: template.review_surface || null,
1179
+ continuation_ready: continuation ? continuation.continuation_ready === true : false,
1180
+ evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
1181
+ ? template.request_template.evidence_refs.length
1182
+ : 0,
1183
+ preserved_seam_layer_count: Number(
1184
+ artifact.preserved_context &&
1185
+ artifact.preserved_context.proof_handoff &&
1186
+ artifact.preserved_context.proof_handoff.seam_layer_count || 0
1187
+ ),
1188
+ proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true
1189
+ };
1190
+ }
1191
+
1142
1192
  function buildCatalogSummarySource(client) {
1143
1193
  const baseCatalog = client && client.catalogCache && typeof client.catalogCache === "object"
1144
1194
  ? client.catalogCache
@@ -2781,6 +2831,30 @@ class CommerceClient {
2781
2831
  return result && result.data ? result.data : null;
2782
2832
  }
2783
2833
 
2834
+ async getInteractionResultPackageContinuations(forceRefresh) {
2835
+ if (!forceRefresh && this.catalogSummaryCache && this.catalogSummaryCache.resultPackageContinuations) {
2836
+ return this.catalogSummaryCache.resultPackageContinuations;
2837
+ }
2838
+ const result = await this.getJson("/v1/transaction-center/result-package-continuations");
2839
+ if (!forceRefresh) {
2840
+ this.catalogSummaryCache = this.catalogSummaryCache || {};
2841
+ this.catalogSummaryCache.resultPackageContinuations = result.data;
2842
+ }
2843
+ return result.data;
2844
+ }
2845
+
2846
+ async getInteractionResultPackageContinuationsSummary(forceRefresh) {
2847
+ const result = await this.getJson("/v1/transaction-center/result-package-continuations/summary");
2848
+ return result && result.data ? result.data : { ok: true, continuation_count: 0, continuation_refs: [], continuations: [] };
2849
+ }
2850
+
2851
+ async getInteractionResultPackageContinuation(continuationRef, forceRefresh) {
2852
+ const normalized = String(continuationRef || "").trim();
2853
+ if (!normalized) return null;
2854
+ const result = await this.getJson(`/v1/transaction-center/result-package-continuation?ref=${encodeURIComponent(normalized)}`);
2855
+ return result && result.data && result.data.continuation ? result.data.continuation : null;
2856
+ }
2857
+
2784
2858
  async listSettlementPayees(forceRefresh) {
2785
2859
  const summary = await this.getSettlementPayeeSummaries(forceRefresh);
2786
2860
  return extractSummaryValues(summary, "settlement_payees", "payee_agent_id");
@@ -4171,6 +4245,82 @@ class CommerceClient {
4171
4245
  };
4172
4246
  }
4173
4247
 
4248
+ async runInteractionResultPackageContinuation(continuationRef, body, options) {
4249
+ const opts = options || {};
4250
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/run", {
4251
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.run",
4252
+ continuation_ref: String(continuationRef || "").trim(),
4253
+ body: body || {},
4254
+ callback_url: opts.callbackUrl || null,
4255
+ settlement_mode: opts.settlementMode || null,
4256
+ payment_protocol: opts.paymentProtocol || null,
4257
+ protocol: opts.protocol || null,
4258
+ integration_id: opts.integrationId || null,
4259
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4260
+ integration_context: opts.integrationContext || null
4261
+ });
4262
+ }
4263
+
4264
+ async runInteractionResultPackageContinuationSummary(continuationRef, body, options) {
4265
+ const result = await this.runInteractionResultPackageContinuation(continuationRef, body, options);
4266
+ return {
4267
+ ok: result && result.ok === true,
4268
+ continuation_ref: result && result.continuation ? result.continuation.continuation_ref || null : null,
4269
+ result_package_ref: result && result.result_package ? result.result_package.result_package_ref || null : null,
4270
+ continuation_summary: this.summarizeInteractionResultPackageContinuation(
4271
+ result && result.continuation_summary ? result.continuation_summary : null
4272
+ ),
4273
+ portable_handoff_summary: this.summarizeInteractionResultPackagePortableHandoff(
4274
+ result && result.portable_handoff_summary ? result.portable_handoff_summary : null
4275
+ ),
4276
+ seam_summary: result && result.seam_summary ? {
4277
+ ...result.seam_summary,
4278
+ proof_handoff_summary: this.summarizeProofHandoff(
4279
+ result.seam_summary && result.seam_summary.proof_handoff_summary
4280
+ ? result.seam_summary.proof_handoff_summary
4281
+ : null
4282
+ )
4283
+ } : null
4284
+ };
4285
+ }
4286
+
4287
+ async prepareInteractionResultPackageContinuation(continuationRef, body, options) {
4288
+ const opts = options || {};
4289
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare", {
4290
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.prepare",
4291
+ continuation_ref: String(continuationRef || "").trim(),
4292
+ body: body || {},
4293
+ callback_url: opts.callbackUrl || null,
4294
+ settlement_mode: opts.settlementMode || null,
4295
+ payment_protocol: opts.paymentProtocol || null,
4296
+ protocol: opts.protocol || null,
4297
+ integration_id: opts.integrationId || null,
4298
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4299
+ integration_context: opts.integrationContext || null
4300
+ });
4301
+ }
4302
+
4303
+ async prepareInteractionResultPackageContinuationSummary(continuationRef, body, options) {
4304
+ const result = await this.prepareInteractionResultPackageContinuation(continuationRef, body, options);
4305
+ return summarizeInteractionResultPackageContinuationPreparationPayload(result);
4306
+ }
4307
+
4308
+ async prepareInteractionResultPackageContinuationArtifactSummary(continuationRef, body, options) {
4309
+ const opts = options || {};
4310
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/summary", {
4311
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.prepare.summary",
4312
+ continuation_ref: String(continuationRef || "").trim(),
4313
+ body: body || {},
4314
+ callback_url: opts.callbackUrl || null,
4315
+ settlement_mode: opts.settlementMode || null,
4316
+ payment_protocol: opts.paymentProtocol || null,
4317
+ protocol: opts.protocol || null,
4318
+ integration_id: opts.integrationId || null,
4319
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4320
+ integration_context: opts.integrationContext || null
4321
+ });
4322
+ }
4323
+
4174
4324
  async runNamedTaskRoute(path, payload) {
4175
4325
  if (!this.apiKey || !this.walletId || !this.walletSecret) {
4176
4326
  throw new Error("named task routes require apiKey, walletId, and walletSecret");
@@ -5678,6 +5828,14 @@ class CommerceClient {
5678
5828
  return summarizeInteractionResultPackagePortableHandoffPayload(payload);
5679
5829
  }
5680
5830
 
5831
+ summarizeInteractionResultPackageContinuation(payload) {
5832
+ return summarizeInteractionResultPackageContinuationPayload(payload);
5833
+ }
5834
+
5835
+ summarizeInteractionResultPackageContinuationPreparation(payload) {
5836
+ return summarizeInteractionResultPackageContinuationPreparationPayload(payload);
5837
+ }
5838
+
5681
5839
  summarizeTask(task) {
5682
5840
  return summarizeCatalogTask(task);
5683
5841
  }
@@ -6431,6 +6589,8 @@ module.exports = {
6431
6589
  summarizeQuotePreviewPayload,
6432
6590
  summarizeDefaultTransactionCenterPayload,
6433
6591
  summarizeDefaultTransactionEconomicsPayload,
6592
+ summarizeInteractionResultPackageContinuationPayload,
6593
+ summarizeInteractionResultPackageContinuationPreparationPayload,
6434
6594
  summarizeInteractionResultPackagePayload,
6435
6595
  summarizeInteractionResultPackagePortableHandoffPayload,
6436
6596
  summarizeDefaultTaskPackCatalogPayload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xytara",
3
- "version": "1.9.0",
3
+ "version": "1.11.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
@@ -8,6 +8,7 @@ const {
8
8
  buildDefaultTransactionEconomics,
9
9
  buildDefaultTransactionGuidedLoopCatalog,
10
10
  buildInteractionResultPackageCatalog,
11
+ buildInteractionResultPackageContinuationCatalog,
11
12
  buildInteractionSpinePathCatalog,
12
13
  buildPrecommitInteractionPackCatalog,
13
14
  buildDefaultTransactionTaskPackCatalog,
@@ -16,6 +17,7 @@ const {
16
17
  getDefaultTransactionGuidedLoop,
17
18
  getDefaultTransactionTaskPack,
18
19
  getInteractionResultPackage,
20
+ getInteractionResultPackageContinuation,
19
21
  getInteractionSpinePath,
20
22
  getPrecommitInteractionPack,
21
23
  getTransactionClassPack,
@@ -26,6 +28,7 @@ const {
26
28
  summarizeDefaultTransactionCenter,
27
29
  summarizeDefaultTransactionEconomics,
28
30
  summarizeDefaultTransactionGuidedLoops,
31
+ summarizeInteractionResultPackageContinuations,
29
32
  summarizeInteractionResultPackages,
30
33
  summarizeInteractionSpinePaths,
31
34
  summarizeDefaultTransactionTaskPacks,
@@ -1087,6 +1090,100 @@ function summarizeInteractionResultPackagePortableHandoff(handoff) {
1087
1090
  };
1088
1091
  }
1089
1092
 
1093
+ function buildInteractionResultPackageContinuationSummary(portableHandoff, continuation) {
1094
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1095
+ return {
1096
+ ok: true,
1097
+ continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
1098
+ result_package_ref: continuation && continuation.result_package_ref ? continuation.result_package_ref : null,
1099
+ source_ref: continuation && continuation.source_ref ? continuation.source_ref : null,
1100
+ continuation_kind: continuation && continuation.continuation_kind ? continuation.continuation_kind : null,
1101
+ default_next_surface: continuation && continuation.default_next_surface ? continuation.default_next_surface : null,
1102
+ default_export_surface: continuation && continuation.default_export_surface ? continuation.default_export_surface : null,
1103
+ default_proof_surface: continuation && continuation.default_proof_surface ? continuation.default_proof_surface : null,
1104
+ transaction_id: handoff.transaction_id || null,
1105
+ receipt_id: handoff.receipt_id || null,
1106
+ proof_ref: handoff.proof_ref || null,
1107
+ continuation_ready: Boolean(handoff.result_package_ref && handoff.proof_ref),
1108
+ seam_layer_count: Array.isArray(handoff.seam_layers) ? handoff.seam_layers.length : 0
1109
+ };
1110
+ }
1111
+
1112
+ function buildPreparedContinuationArtifactSummary(portableHandoff, continuation) {
1113
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1114
+ const seamLayers = Array.isArray(handoff.seam_layers) ? handoff.seam_layers : [];
1115
+ return {
1116
+ ok: true,
1117
+ prepared_artifact_ref: continuation && continuation.continuation_ref
1118
+ ? `prepared.${continuation.continuation_ref}`
1119
+ : null,
1120
+ continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
1121
+ result_package_ref: continuation && continuation.result_package_ref ? continuation.result_package_ref : null,
1122
+ transaction_id: handoff.transaction_id || null,
1123
+ receipt_id: handoff.receipt_id || null,
1124
+ proof_ref: handoff.proof_ref || null,
1125
+ preserved_context: {
1126
+ execution_result: {
1127
+ committed_ref: handoff.committed_ref || null,
1128
+ task_ref_count: Array.isArray(handoff.task_refs) ? handoff.task_refs.length : 0
1129
+ },
1130
+ economic_state: {
1131
+ payment_protocol: handoff.payment_protocol || null,
1132
+ settlement_mode: handoff.settlement_mode || null,
1133
+ treasury_destination_id: handoff.treasury_destination_id || null
1134
+ },
1135
+ proof_handoff: {
1136
+ source_ref: handoff.source_ref || null,
1137
+ seam_layer_count: seamLayers.length,
1138
+ seam_layers: seamLayers
1139
+ }
1140
+ },
1141
+ durable_path: {
1142
+ review_surface: "/v1/proof-center/result-package-handoff/review",
1143
+ run_surface: "/v1/proof-center/result-package-handoff/run",
1144
+ proof_ready: Boolean(handoff.result_package_ref && handoff.proof_ref && handoff.transaction_id && handoff.receipt_id)
1145
+ }
1146
+ };
1147
+ }
1148
+
1149
+ function buildPreparedContinuationArtifactCompactSummary(portableHandoff, continuation) {
1150
+ const artifact = buildPreparedContinuationArtifactSummary(portableHandoff, continuation);
1151
+ const proofHandoff = artifact.preserved_context && artifact.preserved_context.proof_handoff
1152
+ ? artifact.preserved_context.proof_handoff
1153
+ : {};
1154
+ return {
1155
+ ok: artifact.ok === true,
1156
+ prepared_artifact_ref: artifact.prepared_artifact_ref || null,
1157
+ continuation_ref: artifact.continuation_ref || null,
1158
+ result_package_ref: artifact.result_package_ref || null,
1159
+ review_surface: artifact.durable_path && artifact.durable_path.review_surface
1160
+ ? artifact.durable_path.review_surface
1161
+ : null,
1162
+ run_surface: artifact.durable_path && artifact.durable_path.run_surface
1163
+ ? artifact.durable_path.run_surface
1164
+ : null,
1165
+ proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true,
1166
+ preserved_seam_layer_count: Number(proofHandoff.seam_layer_count || 0)
1167
+ };
1168
+ }
1169
+
1170
+ function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
1171
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1172
+ return {
1173
+ ok: true,
1174
+ continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
1175
+ target_surface: "/v1/proof-center/result-package-handoff/run",
1176
+ review_surface: "/v1/proof-center/result-package-handoff/review",
1177
+ request_template: {
1178
+ handoff_bundle: handoff,
1179
+ evidence_refs: handoff.proof_ref ? [handoff.proof_ref] : [],
1180
+ options: {
1181
+ legacy_identity_material_hex: "<required_for_local_demo_signing>"
1182
+ }
1183
+ }
1184
+ };
1185
+ }
1186
+
1090
1187
  function buildOperationsDashboard(filters) {
1091
1188
  const disputes = listRecords(state.disputes, filters);
1092
1189
  const refunds = listRecords(state.refunds, filters);
@@ -1274,6 +1371,26 @@ async function routeRequest(req, res) {
1274
1371
  return;
1275
1372
  }
1276
1373
 
1374
+ if (req.method === "GET" && url.pathname === "/v1/transaction-center/result-package-continuations") {
1375
+ sendJson(res, 200, buildInteractionResultPackageContinuationCatalog());
1376
+ return;
1377
+ }
1378
+
1379
+ if (req.method === "GET" && url.pathname === "/v1/transaction-center/result-package-continuations/summary") {
1380
+ sendJson(res, 200, summarizeInteractionResultPackageContinuations());
1381
+ return;
1382
+ }
1383
+
1384
+ if (req.method === "GET" && url.pathname === "/v1/transaction-center/result-package-continuation") {
1385
+ const continuation = getInteractionResultPackageContinuation(url.searchParams.get("ref"));
1386
+ if (!continuation) {
1387
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
1388
+ return;
1389
+ }
1390
+ sendJson(res, 200, { ok: true, continuation });
1391
+ return;
1392
+ }
1393
+
1277
1394
  if (req.method === "GET" && url.pathname === "/v1/transaction-center/transaction-class-packs") {
1278
1395
  sendJson(res, 200, buildTransactionClassPackCatalog());
1279
1396
  return;
@@ -1929,6 +2046,118 @@ async function routeRequest(req, res) {
1929
2046
  return;
1930
2047
  }
1931
2048
 
2049
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/run") {
2050
+ const body = await readJsonBody(req);
2051
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2052
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2053
+ if (!continuation) {
2054
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2055
+ return;
2056
+ }
2057
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2058
+ if (!resultPackage) {
2059
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2060
+ return;
2061
+ }
2062
+ const payload = buildInteractionSpinePathRunPayload({
2063
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2064
+ spine_path_ref: resultPackage.source_ref
2065
+ });
2066
+ if (!payload) {
2067
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2068
+ return;
2069
+ }
2070
+ const result = executeCommandRequest(state, payload, req.headers);
2071
+ if (result.status !== 200) {
2072
+ sendJson(res, result.status, result.payload);
2073
+ return;
2074
+ }
2075
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2076
+ sendJson(res, 200, {
2077
+ ok: true,
2078
+ continuation,
2079
+ result_package: resultPackage,
2080
+ result: result.payload,
2081
+ result_package_summary: buildInteractionResultPackageSummary(result.payload, resultPackage),
2082
+ portable_handoff_bundle: portableHandoff,
2083
+ portable_handoff_summary: summarizeInteractionResultPackagePortableHandoff(portableHandoff),
2084
+ continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
2085
+ seam_summary: buildInteractionResultSeamSummary(result.payload, resultPackage)
2086
+ });
2087
+ return;
2088
+ }
2089
+
2090
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare") {
2091
+ const body = await readJsonBody(req);
2092
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2093
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2094
+ if (!continuation) {
2095
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2096
+ return;
2097
+ }
2098
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2099
+ if (!resultPackage) {
2100
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2101
+ return;
2102
+ }
2103
+ const payload = buildInteractionSpinePathRunPayload({
2104
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2105
+ spine_path_ref: resultPackage.source_ref
2106
+ });
2107
+ if (!payload) {
2108
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2109
+ return;
2110
+ }
2111
+ const result = executeCommandRequest(state, payload, req.headers);
2112
+ if (result.status !== 200) {
2113
+ sendJson(res, result.status, result.payload);
2114
+ return;
2115
+ }
2116
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2117
+ sendJson(res, 200, {
2118
+ ok: true,
2119
+ continuation,
2120
+ result_package: resultPackage,
2121
+ result_package_summary: buildInteractionResultPackageSummary(result.payload, resultPackage),
2122
+ portable_handoff_summary: summarizeInteractionResultPackagePortableHandoff(portableHandoff),
2123
+ continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
2124
+ prepared_artifact_summary: buildPreparedContinuationArtifactSummary(portableHandoff, continuation),
2125
+ proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
2126
+ });
2127
+ return;
2128
+ }
2129
+
2130
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/summary") {
2131
+ const body = await readJsonBody(req);
2132
+ const continuationRef = String(body && body.continuation_ref || "").trim();
2133
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
2134
+ if (!continuation) {
2135
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2136
+ return;
2137
+ }
2138
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
2139
+ if (!resultPackage) {
2140
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
2141
+ return;
2142
+ }
2143
+ const payload = buildInteractionSpinePathRunPayload({
2144
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
2145
+ spine_path_ref: resultPackage.source_ref
2146
+ });
2147
+ if (!payload) {
2148
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
2149
+ return;
2150
+ }
2151
+ const result = executeCommandRequest(state, payload, req.headers);
2152
+ if (result.status !== 200) {
2153
+ sendJson(res, result.status, result.payload);
2154
+ return;
2155
+ }
2156
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
2157
+ sendJson(res, 200, buildPreparedContinuationArtifactCompactSummary(portableHandoff, continuation));
2158
+ return;
2159
+ }
2160
+
1932
2161
  if (req.method === "POST" && url.pathname === "/v1/transaction-center/default-loops/run") {
1933
2162
  const body = await readJsonBody(req);
1934
2163
  const loopRef = String(body && body.loop_ref || "").trim();