xytara 1.10.0 → 1.12.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 +52 -1
- package/package.json +1 -1
- package/server.js +186 -7
package/README.md
CHANGED
|
@@ -135,7 +135,11 @@ The current `1.10.0` line starts building on that by exposing reusable continuat
|
|
|
135
135
|
- result-package continuation catalog, summary, and detail routes
|
|
136
136
|
- direct continuation run surfaces that preserve the default next proof path
|
|
137
137
|
- continuation preparation surfaces that emit proof-ready request templates
|
|
138
|
+
- continuation preparation summary surfaces that expose the stable prepared-artifact view directly
|
|
138
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
|
+
- extension-seam summaries that distinguish stable carry from future adapter-ready boundary points on that durable path
|
|
142
|
+
- extension-template surfaces that turn the durable transaction-side artifact into a reusable proof-side extension-review request
|
|
139
143
|
|
|
140
144
|
This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
|
|
141
145
|
|
package/index.js
CHANGED
package/lib/commerce_client.js
CHANGED
|
@@ -1166,16 +1166,35 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1166
1166
|
const template = item.proof_request_template && typeof item.proof_request_template === "object"
|
|
1167
1167
|
? item.proof_request_template
|
|
1168
1168
|
: {};
|
|
1169
|
+
const artifact = item.prepared_artifact_summary && typeof item.prepared_artifact_summary === "object"
|
|
1170
|
+
? item.prepared_artifact_summary
|
|
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
|
+
: {};
|
|
1169
1178
|
return {
|
|
1170
1179
|
ok: item.ok === true,
|
|
1171
1180
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
1172
1181
|
result_package_ref: continuation ? continuation.result_package_ref : null,
|
|
1182
|
+
prepared_artifact_ref: artifact.prepared_artifact_ref || null,
|
|
1183
|
+
extension_seam_ref: extension.extension_seam_ref || null,
|
|
1173
1184
|
target_surface: template.target_surface || null,
|
|
1174
1185
|
review_surface: template.review_surface || null,
|
|
1175
1186
|
continuation_ready: continuation ? continuation.continuation_ready === true : false,
|
|
1176
1187
|
evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
|
|
1177
1188
|
? template.request_template.evidence_refs.length
|
|
1178
|
-
: 0
|
|
1189
|
+
: 0,
|
|
1190
|
+
preserved_seam_layer_count: Number(
|
|
1191
|
+
artifact.preserved_context &&
|
|
1192
|
+
artifact.preserved_context.proof_handoff &&
|
|
1193
|
+
artifact.preserved_context.proof_handoff.seam_layer_count || 0
|
|
1194
|
+
),
|
|
1195
|
+
proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true,
|
|
1196
|
+
future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
|
|
1197
|
+
extension_target_surface: extensionTemplate.target_surface || null
|
|
1179
1198
|
};
|
|
1180
1199
|
}
|
|
1181
1200
|
|
|
@@ -4295,6 +4314,38 @@ class CommerceClient {
|
|
|
4295
4314
|
return summarizeInteractionResultPackageContinuationPreparationPayload(result);
|
|
4296
4315
|
}
|
|
4297
4316
|
|
|
4317
|
+
async prepareInteractionResultPackageContinuationArtifactSummary(continuationRef, body, options) {
|
|
4318
|
+
const opts = options || {};
|
|
4319
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/summary", {
|
|
4320
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.prepare.summary",
|
|
4321
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4322
|
+
body: body || {},
|
|
4323
|
+
callback_url: opts.callbackUrl || null,
|
|
4324
|
+
settlement_mode: opts.settlementMode || null,
|
|
4325
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4326
|
+
protocol: opts.protocol || null,
|
|
4327
|
+
integration_id: opts.integrationId || null,
|
|
4328
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4329
|
+
integration_context: opts.integrationContext || null
|
|
4330
|
+
});
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
async prepareInteractionResultPackageExtensionTemplate(continuationRef, body, options) {
|
|
4334
|
+
const opts = options || {};
|
|
4335
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/extension-template", {
|
|
4336
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.extension.template",
|
|
4337
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4338
|
+
body: body || {},
|
|
4339
|
+
callback_url: opts.callbackUrl || null,
|
|
4340
|
+
settlement_mode: opts.settlementMode || null,
|
|
4341
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4342
|
+
protocol: opts.protocol || null,
|
|
4343
|
+
integration_id: opts.integrationId || null,
|
|
4344
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4345
|
+
integration_context: opts.integrationContext || null
|
|
4346
|
+
});
|
|
4347
|
+
}
|
|
4348
|
+
|
|
4298
4349
|
async runNamedTaskRoute(path, payload) {
|
|
4299
4350
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4300
4351
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1109,6 +1109,116 @@ function buildInteractionResultPackageContinuationSummary(portableHandoff, conti
|
|
|
1109
1109
|
};
|
|
1110
1110
|
}
|
|
1111
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 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
|
+
|
|
1112
1222
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1113
1223
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1114
1224
|
return {
|
|
@@ -2030,6 +2140,48 @@ async function routeRequest(req, res) {
|
|
|
2030
2140
|
}
|
|
2031
2141
|
|
|
2032
2142
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare") {
|
|
2143
|
+
const body = await readJsonBody(req);
|
|
2144
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2145
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2146
|
+
if (!continuation) {
|
|
2147
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2151
|
+
if (!resultPackage) {
|
|
2152
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2153
|
+
return;
|
|
2154
|
+
}
|
|
2155
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2156
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2157
|
+
spine_path_ref: resultPackage.source_ref
|
|
2158
|
+
});
|
|
2159
|
+
if (!payload) {
|
|
2160
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2161
|
+
return;
|
|
2162
|
+
}
|
|
2163
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2164
|
+
if (result.status !== 200) {
|
|
2165
|
+
sendJson(res, result.status, result.payload);
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2169
|
+
sendJson(res, 200, {
|
|
2170
|
+
ok: true,
|
|
2171
|
+
continuation,
|
|
2172
|
+
result_package: resultPackage,
|
|
2173
|
+
result_package_summary: buildInteractionResultPackageSummary(result.payload, resultPackage),
|
|
2174
|
+
portable_handoff_summary: summarizeInteractionResultPackagePortableHandoff(portableHandoff),
|
|
2175
|
+
continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
|
|
2176
|
+
prepared_artifact_summary: buildPreparedContinuationArtifactSummary(portableHandoff, continuation),
|
|
2177
|
+
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2178
|
+
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
|
|
2179
|
+
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2180
|
+
});
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/summary") {
|
|
2033
2185
|
const body = await readJsonBody(req);
|
|
2034
2186
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2035
2187
|
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
@@ -2057,14 +2209,41 @@ async function routeRequest(req, res) {
|
|
|
2057
2209
|
}
|
|
2058
2210
|
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2059
2211
|
sendJson(res, 200, {
|
|
2060
|
-
|
|
2061
|
-
continuation,
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2212
|
+
...buildPreparedContinuationArtifactCompactSummary(portableHandoff, continuation),
|
|
2213
|
+
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2214
|
+
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
|
|
2215
|
+
});
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/extension-template") {
|
|
2220
|
+
const body = await readJsonBody(req);
|
|
2221
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2222
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2223
|
+
if (!continuation) {
|
|
2224
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2227
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2228
|
+
if (!resultPackage) {
|
|
2229
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2233
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2234
|
+
spine_path_ref: resultPackage.source_ref
|
|
2067
2235
|
});
|
|
2236
|
+
if (!payload) {
|
|
2237
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2238
|
+
return;
|
|
2239
|
+
}
|
|
2240
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2241
|
+
if (result.status !== 200) {
|
|
2242
|
+
sendJson(res, result.status, result.payload);
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2246
|
+
sendJson(res, 200, buildPreparedContinuationExtensionTemplate(portableHandoff, continuation));
|
|
2068
2247
|
return;
|
|
2069
2248
|
}
|
|
2070
2249
|
|