xytara 1.11.0 → 1.13.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 +4 -0
- package/index.js +1 -1
- package/lib/commerce_client.js +70 -1
- package/package.json +1 -1
- package/server.js +211 -1
package/README.md
CHANGED
|
@@ -138,6 +138,10 @@ The current `1.10.0` line starts building on that by exposing reusable continuat
|
|
|
138
138
|
- continuation preparation summary surfaces that expose the stable prepared-artifact view directly
|
|
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
|
+
- 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
|
|
144
|
+
- extension-template surfaces that turn the durable transaction-side artifact into a reusable proof-side extension-review request
|
|
141
145
|
|
|
142
146
|
This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
|
|
143
147
|
|
package/index.js
CHANGED
package/lib/commerce_client.js
CHANGED
|
@@ -1169,13 +1169,30 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1169
1169
|
const artifact = item.prepared_artifact_summary && typeof item.prepared_artifact_summary === "object"
|
|
1170
1170
|
? item.prepared_artifact_summary
|
|
1171
1171
|
: {};
|
|
1172
|
+
const extension = item.extension_seam_summary && typeof item.extension_seam_summary === "object"
|
|
1173
|
+
? item.extension_seam_summary
|
|
1174
|
+
: {};
|
|
1175
|
+
const extensionTemplate = item.extension_template && typeof item.extension_template === "object"
|
|
1176
|
+
? item.extension_template
|
|
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
|
+
: {};
|
|
1172
1184
|
return {
|
|
1173
1185
|
ok: item.ok === true,
|
|
1174
1186
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
1175
1187
|
result_package_ref: continuation ? continuation.result_package_ref : null,
|
|
1176
1188
|
prepared_artifact_ref: artifact.prepared_artifact_ref || null,
|
|
1189
|
+
extension_seam_ref: extension.extension_seam_ref || null,
|
|
1190
|
+
reusable_default_ref: reusableDefault.reusable_default_ref || null,
|
|
1177
1191
|
target_surface: template.target_surface || null,
|
|
1178
1192
|
review_surface: template.review_surface || null,
|
|
1193
|
+
default_review_surface: reusableDefault.default_followthrough && reusableDefault.default_followthrough.review_surface
|
|
1194
|
+
? reusableDefault.default_followthrough.review_surface
|
|
1195
|
+
: null,
|
|
1179
1196
|
continuation_ready: continuation ? continuation.continuation_ready === true : false,
|
|
1180
1197
|
evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
|
|
1181
1198
|
? template.request_template.evidence_refs.length
|
|
@@ -1185,7 +1202,11 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1185
1202
|
artifact.preserved_context.proof_handoff &&
|
|
1186
1203
|
artifact.preserved_context.proof_handoff.seam_layer_count || 0
|
|
1187
1204
|
),
|
|
1188
|
-
proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true
|
|
1205
|
+
proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true,
|
|
1206
|
+
reusable_by_default: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
|
|
1207
|
+
future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
|
|
1208
|
+
reusable_default_target_surface: reusableDefaultTemplate.target_surface || null,
|
|
1209
|
+
extension_target_surface: extensionTemplate.target_surface || null
|
|
1189
1210
|
};
|
|
1190
1211
|
}
|
|
1191
1212
|
|
|
@@ -4321,6 +4342,54 @@ class CommerceClient {
|
|
|
4321
4342
|
});
|
|
4322
4343
|
}
|
|
4323
4344
|
|
|
4345
|
+
async prepareInteractionResultPackageExtensionTemplate(continuationRef, body, options) {
|
|
4346
|
+
const opts = options || {};
|
|
4347
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/extension-template", {
|
|
4348
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.extension.template",
|
|
4349
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4350
|
+
body: body || {},
|
|
4351
|
+
callback_url: opts.callbackUrl || null,
|
|
4352
|
+
settlement_mode: opts.settlementMode || null,
|
|
4353
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4354
|
+
protocol: opts.protocol || null,
|
|
4355
|
+
integration_id: opts.integrationId || null,
|
|
4356
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4357
|
+
integration_context: opts.integrationContext || null
|
|
4358
|
+
});
|
|
4359
|
+
}
|
|
4360
|
+
|
|
4361
|
+
async prepareInteractionResultPackageReusableDefaultSummary(continuationRef, body, options) {
|
|
4362
|
+
const opts = options || {};
|
|
4363
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/default-summary", {
|
|
4364
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.default.summary",
|
|
4365
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4366
|
+
body: body || {},
|
|
4367
|
+
callback_url: opts.callbackUrl || null,
|
|
4368
|
+
settlement_mode: opts.settlementMode || null,
|
|
4369
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4370
|
+
protocol: opts.protocol || null,
|
|
4371
|
+
integration_id: opts.integrationId || null,
|
|
4372
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4373
|
+
integration_context: opts.integrationContext || null
|
|
4374
|
+
});
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
async prepareInteractionResultPackageReusableDefaultTemplate(continuationRef, body, options) {
|
|
4378
|
+
const opts = options || {};
|
|
4379
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/default-template", {
|
|
4380
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.default.template",
|
|
4381
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4382
|
+
body: body || {},
|
|
4383
|
+
callback_url: opts.callbackUrl || null,
|
|
4384
|
+
settlement_mode: opts.settlementMode || null,
|
|
4385
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4386
|
+
protocol: opts.protocol || null,
|
|
4387
|
+
integration_id: opts.integrationId || null,
|
|
4388
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4389
|
+
integration_context: opts.integrationContext || null
|
|
4390
|
+
});
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4324
4393
|
async runNamedTaskRoute(path, payload) {
|
|
4325
4394
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4326
4395
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1167,6 +1167,113 @@ function buildPreparedContinuationArtifactCompactSummary(portableHandoff, contin
|
|
|
1167
1167
|
};
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
+
function buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation) {
|
|
1171
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1172
|
+
const seamLayers = Array.isArray(handoff.seam_layers) ? handoff.seam_layers : [];
|
|
1173
|
+
return {
|
|
1174
|
+
ok: true,
|
|
1175
|
+
extension_seam_ref: continuation && continuation.continuation_ref
|
|
1176
|
+
? `extension.${continuation.continuation_ref}`
|
|
1177
|
+
: null,
|
|
1178
|
+
continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
|
|
1179
|
+
stable_carry: {
|
|
1180
|
+
execution_context: {
|
|
1181
|
+
committed_ref: handoff.committed_ref || null,
|
|
1182
|
+
task_refs: Array.isArray(handoff.task_refs) ? handoff.task_refs : []
|
|
1183
|
+
},
|
|
1184
|
+
economic_context: {
|
|
1185
|
+
payment_protocol: handoff.payment_protocol || null,
|
|
1186
|
+
settlement_mode: handoff.settlement_mode || null,
|
|
1187
|
+
treasury_destination_id: handoff.treasury_destination_id || null
|
|
1188
|
+
},
|
|
1189
|
+
proof_context: {
|
|
1190
|
+
source_ref: handoff.source_ref || null,
|
|
1191
|
+
seam_layers: seamLayers
|
|
1192
|
+
}
|
|
1193
|
+
},
|
|
1194
|
+
extension_ready_boundaries: [
|
|
1195
|
+
"prepared_artifact",
|
|
1196
|
+
"proof_review",
|
|
1197
|
+
"proof_run"
|
|
1198
|
+
],
|
|
1199
|
+
default_followthrough_kind: "prepared_to_review_to_run",
|
|
1200
|
+
future_adapter_hook_count: 3
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
function buildPreparedContinuationExtensionTemplate(portableHandoff, continuation) {
|
|
1205
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1206
|
+
const summary = buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation);
|
|
1207
|
+
return {
|
|
1208
|
+
ok: true,
|
|
1209
|
+
extension_seam_ref: summary.extension_seam_ref || null,
|
|
1210
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/extension-readiness",
|
|
1211
|
+
request_template: {
|
|
1212
|
+
handoff_bundle: handoff
|
|
1213
|
+
},
|
|
1214
|
+
stable_boundary_ids: [
|
|
1215
|
+
"prepared_artifact",
|
|
1216
|
+
"review_extension_readiness",
|
|
1217
|
+
"proof_run"
|
|
1218
|
+
]
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
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
|
+
|
|
1170
1277
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1171
1278
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1172
1279
|
return {
|
|
@@ -2122,6 +2229,10 @@ async function routeRequest(req, res) {
|
|
|
2122
2229
|
portable_handoff_summary: summarizeInteractionResultPackagePortableHandoff(portableHandoff),
|
|
2123
2230
|
continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
|
|
2124
2231
|
prepared_artifact_summary: buildPreparedContinuationArtifactSummary(portableHandoff, continuation),
|
|
2232
|
+
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2233
|
+
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2234
|
+
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2235
|
+
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
|
|
2125
2236
|
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2126
2237
|
});
|
|
2127
2238
|
return;
|
|
@@ -2154,7 +2265,106 @@ async function routeRequest(req, res) {
|
|
|
2154
2265
|
return;
|
|
2155
2266
|
}
|
|
2156
2267
|
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2157
|
-
sendJson(res, 200,
|
|
2268
|
+
sendJson(res, 200, {
|
|
2269
|
+
...buildPreparedContinuationArtifactCompactSummary(portableHandoff, continuation),
|
|
2270
|
+
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2271
|
+
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2272
|
+
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2273
|
+
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
|
|
2274
|
+
});
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/default-summary") {
|
|
2279
|
+
const body = await readJsonBody(req);
|
|
2280
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2281
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2282
|
+
if (!continuation) {
|
|
2283
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2284
|
+
return;
|
|
2285
|
+
}
|
|
2286
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2287
|
+
if (!resultPackage) {
|
|
2288
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2289
|
+
return;
|
|
2290
|
+
}
|
|
2291
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2292
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2293
|
+
spine_path_ref: resultPackage.source_ref
|
|
2294
|
+
});
|
|
2295
|
+
if (!payload) {
|
|
2296
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2297
|
+
return;
|
|
2298
|
+
}
|
|
2299
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2300
|
+
if (result.status !== 200) {
|
|
2301
|
+
sendJson(res, result.status, result.payload);
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2305
|
+
sendJson(res, 200, buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation));
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/default-template") {
|
|
2310
|
+
const body = await readJsonBody(req);
|
|
2311
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2312
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2313
|
+
if (!continuation) {
|
|
2314
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2315
|
+
return;
|
|
2316
|
+
}
|
|
2317
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2318
|
+
if (!resultPackage) {
|
|
2319
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2323
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2324
|
+
spine_path_ref: resultPackage.source_ref
|
|
2325
|
+
});
|
|
2326
|
+
if (!payload) {
|
|
2327
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2331
|
+
if (result.status !== 200) {
|
|
2332
|
+
sendJson(res, result.status, result.payload);
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2335
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2336
|
+
sendJson(res, 200, buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation));
|
|
2337
|
+
return;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/extension-template") {
|
|
2341
|
+
const body = await readJsonBody(req);
|
|
2342
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2343
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2344
|
+
if (!continuation) {
|
|
2345
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2346
|
+
return;
|
|
2347
|
+
}
|
|
2348
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2349
|
+
if (!resultPackage) {
|
|
2350
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2354
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2355
|
+
spine_path_ref: resultPackage.source_ref
|
|
2356
|
+
});
|
|
2357
|
+
if (!payload) {
|
|
2358
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2359
|
+
return;
|
|
2360
|
+
}
|
|
2361
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2362
|
+
if (result.status !== 200) {
|
|
2363
|
+
sendJson(res, result.status, result.payload);
|
|
2364
|
+
return;
|
|
2365
|
+
}
|
|
2366
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2367
|
+
sendJson(res, 200, buildPreparedContinuationExtensionTemplate(portableHandoff, continuation));
|
|
2158
2368
|
return;
|
|
2159
2369
|
}
|
|
2160
2370
|
|