xytara 1.12.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 +2 -0
- package/index.js +1 -1
- package/lib/commerce_client.js +44 -0
- package/package.json +1 -1
- package/server.js +121 -0
package/README.md
CHANGED
|
@@ -139,6 +139,8 @@ 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.
|
package/index.js
CHANGED
package/lib/commerce_client.js
CHANGED
|
@@ -1175,14 +1175,24 @@ 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
|
+
: {};
|
|
1178
1184
|
return {
|
|
1179
1185
|
ok: item.ok === true,
|
|
1180
1186
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
1181
1187
|
result_package_ref: continuation ? continuation.result_package_ref : null,
|
|
1182
1188
|
prepared_artifact_ref: artifact.prepared_artifact_ref || null,
|
|
1183
1189
|
extension_seam_ref: extension.extension_seam_ref || null,
|
|
1190
|
+
reusable_default_ref: reusableDefault.reusable_default_ref || null,
|
|
1184
1191
|
target_surface: template.target_surface || null,
|
|
1185
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,
|
|
1186
1196
|
continuation_ready: continuation ? continuation.continuation_ready === true : false,
|
|
1187
1197
|
evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
|
|
1188
1198
|
? template.request_template.evidence_refs.length
|
|
@@ -1193,7 +1203,9 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1193
1203
|
artifact.preserved_context.proof_handoff.seam_layer_count || 0
|
|
1194
1204
|
),
|
|
1195
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,
|
|
1196
1207
|
future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
|
|
1208
|
+
reusable_default_target_surface: reusableDefaultTemplate.target_surface || null,
|
|
1197
1209
|
extension_target_surface: extensionTemplate.target_surface || null
|
|
1198
1210
|
};
|
|
1199
1211
|
}
|
|
@@ -4346,6 +4358,38 @@ class CommerceClient {
|
|
|
4346
4358
|
});
|
|
4347
4359
|
}
|
|
4348
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
|
+
|
|
4349
4393
|
async runNamedTaskRoute(path, payload) {
|
|
4350
4394
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4351
4395
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1219,6 +1219,61 @@ 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
|
+
|
|
1222
1277
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1223
1278
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1224
1279
|
return {
|
|
@@ -2175,6 +2230,8 @@ async function routeRequest(req, res) {
|
|
|
2175
2230
|
continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
|
|
2176
2231
|
prepared_artifact_summary: buildPreparedContinuationArtifactSummary(portableHandoff, continuation),
|
|
2177
2232
|
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2233
|
+
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2234
|
+
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2178
2235
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
|
|
2179
2236
|
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2180
2237
|
});
|
|
@@ -2211,11 +2268,75 @@ async function routeRequest(req, res) {
|
|
|
2211
2268
|
sendJson(res, 200, {
|
|
2212
2269
|
...buildPreparedContinuationArtifactCompactSummary(portableHandoff, continuation),
|
|
2213
2270
|
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2271
|
+
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2272
|
+
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2214
2273
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
|
|
2215
2274
|
});
|
|
2216
2275
|
return;
|
|
2217
2276
|
}
|
|
2218
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
|
+
|
|
2219
2340
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/extension-template") {
|
|
2220
2341
|
const body = await readJsonBody(req);
|
|
2221
2342
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|