xytara 1.10.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 +2 -0
- package/index.js +1 -1
- package/lib/commerce_client.js +27 -1
- package/package.json +1 -1
- package/server.js +98 -8
package/README.md
CHANGED
|
@@ -135,7 +135,9 @@ 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
|
|
139
141
|
|
|
140
142
|
This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
|
|
141
143
|
|
package/index.js
CHANGED
package/lib/commerce_client.js
CHANGED
|
@@ -1166,16 +1166,26 @@ 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
|
+
: {};
|
|
1169
1172
|
return {
|
|
1170
1173
|
ok: item.ok === true,
|
|
1171
1174
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
1172
1175
|
result_package_ref: continuation ? continuation.result_package_ref : null,
|
|
1176
|
+
prepared_artifact_ref: artifact.prepared_artifact_ref || null,
|
|
1173
1177
|
target_surface: template.target_surface || null,
|
|
1174
1178
|
review_surface: template.review_surface || null,
|
|
1175
1179
|
continuation_ready: continuation ? continuation.continuation_ready === true : false,
|
|
1176
1180
|
evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
|
|
1177
1181
|
? template.request_template.evidence_refs.length
|
|
1178
|
-
: 0
|
|
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
|
|
1179
1189
|
};
|
|
1180
1190
|
}
|
|
1181
1191
|
|
|
@@ -4295,6 +4305,22 @@ class CommerceClient {
|
|
|
4295
4305
|
return summarizeInteractionResultPackageContinuationPreparationPayload(result);
|
|
4296
4306
|
}
|
|
4297
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
|
+
|
|
4298
4324
|
async runNamedTaskRoute(path, payload) {
|
|
4299
4325
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4300
4326
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1109,6 +1109,64 @@ 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
|
+
|
|
1112
1170
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1113
1171
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1114
1172
|
return {
|
|
@@ -2056,15 +2114,47 @@ async function routeRequest(req, res) {
|
|
|
2056
2114
|
return;
|
|
2057
2115
|
}
|
|
2058
2116
|
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
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
|
|
2067
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));
|
|
2068
2158
|
return;
|
|
2069
2159
|
}
|
|
2070
2160
|
|