xytara 1.17.0 → 1.18.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
@@ -181,6 +181,15 @@ The current `1.17.0` line starts turning that stable handoff contract into a cle
181
181
 
182
182
  This is intended to make the transaction-side continuation path easier to consume directly as a stable adapter-facing handoff surface instead of only a well-described handoff contract.
183
183
 
184
+ The current `1.18.0` line starts turning that adapter-consumable handoff surface into a clearer adapter-usable handoff package:
185
+
186
+ - adapter-usable handoff-package summaries on top of prepared handoff artifacts
187
+ - compact handoff-package bundles for direct adapter-facing use
188
+ - default handoff-package summaries for the next proof-side follow-through
189
+ - clearer adapter-facing handoff-package ids and stable usable carry
190
+
191
+ This is intended to make the transaction-side continuation path easier to use directly as a stable public handoff package instead of only a surface that still needs extra glue logic.
192
+
184
193
  ## Package Surface
185
194
 
186
195
  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.17.0";
43
+ const COMMERCE_SDK_VERSION = "1.18.0";
44
44
  const COMMERCE_API_VERSION = "v1";
45
45
 
46
46
  function createClient(options) {
@@ -4632,6 +4632,54 @@ class CommerceClient {
4632
4632
  });
4633
4633
  }
4634
4634
 
4635
+ async prepareInteractionResultPackageHandoffPackageSummary(continuationRef, body, options) {
4636
+ const opts = options || {};
4637
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-package-summary", {
4638
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.package.summary",
4639
+ continuation_ref: String(continuationRef || "").trim(),
4640
+ body: body || {},
4641
+ callback_url: opts.callbackUrl || null,
4642
+ settlement_mode: opts.settlementMode || null,
4643
+ payment_protocol: opts.paymentProtocol || null,
4644
+ protocol: opts.protocol || null,
4645
+ integration_id: opts.integrationId || null,
4646
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4647
+ integration_context: opts.integrationContext || null
4648
+ });
4649
+ }
4650
+
4651
+ async prepareInteractionResultPackageHandoffPackageBundle(continuationRef, body, options) {
4652
+ const opts = options || {};
4653
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-package-bundle", {
4654
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.package.bundle",
4655
+ continuation_ref: String(continuationRef || "").trim(),
4656
+ body: body || {},
4657
+ callback_url: opts.callbackUrl || null,
4658
+ settlement_mode: opts.settlementMode || null,
4659
+ payment_protocol: opts.paymentProtocol || null,
4660
+ protocol: opts.protocol || null,
4661
+ integration_id: opts.integrationId || null,
4662
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4663
+ integration_context: opts.integrationContext || null
4664
+ });
4665
+ }
4666
+
4667
+ async prepareInteractionResultPackageHandoffPackageDefaultSummary(continuationRef, body, options) {
4668
+ const opts = options || {};
4669
+ return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-package-default-summary", {
4670
+ command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.package.default.summary",
4671
+ continuation_ref: String(continuationRef || "").trim(),
4672
+ body: body || {},
4673
+ callback_url: opts.callbackUrl || null,
4674
+ settlement_mode: opts.settlementMode || null,
4675
+ payment_protocol: opts.paymentProtocol || null,
4676
+ protocol: opts.protocol || null,
4677
+ integration_id: opts.integrationId || null,
4678
+ integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
4679
+ integration_context: opts.integrationContext || null
4680
+ });
4681
+ }
4682
+
4635
4683
  async runNamedTaskRoute(path, payload) {
4636
4684
  if (!this.apiKey || !this.walletId || !this.walletSecret) {
4637
4685
  throw new Error("named task routes require apiKey, walletId, and walletSecret");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xytara",
3
- "version": "1.17.0",
3
+ "version": "1.18.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
@@ -1512,6 +1512,62 @@ function buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff
1512
1512
  };
1513
1513
  }
1514
1514
 
1515
+ function buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation) {
1516
+ const surface = buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation);
1517
+ return {
1518
+ ok: surface.ok === true,
1519
+ adapter_handoff_surface_ref: surface.adapter_handoff_surface_ref || null,
1520
+ adapter_handoff_package_ref: surface.adapter_handoff_surface_ref ? `package.${surface.adapter_handoff_surface_ref}` : null,
1521
+ stable_handoff_package_ids: [
1522
+ "prepared_artifact_handoff_package",
1523
+ "review_handoff_package_intake",
1524
+ "proof_run"
1525
+ ],
1526
+ usable_handoff_package_carry: surface.consumable_handoff_carry || {},
1527
+ adapter_usable: surface.adapter_consumable === true,
1528
+ next_surface: "/v1/proof-center/result-package-handoff/review/handoff-package-intake"
1529
+ };
1530
+ }
1531
+
1532
+ function buildPreparedContinuationAdapterUsableHandoffPackageBundle(portableHandoff, continuation) {
1533
+ const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1534
+ const summary = buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation);
1535
+ return {
1536
+ ok: true,
1537
+ adapter_handoff_package_summary: summary,
1538
+ adapter_handoff_package_template: {
1539
+ ok: true,
1540
+ adapter_handoff_package_ref: summary.adapter_handoff_package_ref || null,
1541
+ target_surface: "/v1/proof-center/result-package-handoff/review/handoff-package-intake",
1542
+ request_template: {
1543
+ handoff_bundle: handoff
1544
+ },
1545
+ stable_boundary_ids: [
1546
+ "prepared_artifact_handoff_package",
1547
+ "review_handoff_package_intake",
1548
+ "proof_run"
1549
+ ]
1550
+ }
1551
+ };
1552
+ }
1553
+
1554
+ function buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation) {
1555
+ const handoffPackage = buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation);
1556
+ return {
1557
+ ok: handoffPackage.ok === true,
1558
+ adapter_handoff_package_ref: handoffPackage.adapter_handoff_package_ref || null,
1559
+ default_handoff_package_ref: handoffPackage.adapter_handoff_package_ref
1560
+ ? `default.${handoffPackage.adapter_handoff_package_ref}`
1561
+ : null,
1562
+ stable_default_handoff_package_ids: Array.isArray(handoffPackage.stable_handoff_package_ids)
1563
+ ? handoffPackage.stable_handoff_package_ids
1564
+ : [],
1565
+ default_usable_handoff_package_carry: handoffPackage.usable_handoff_package_carry || {},
1566
+ package_usable_by_default: handoffPackage.adapter_usable === true,
1567
+ next_surface: "/v1/proof-center/result-package-handoff/review/handoff-package-run"
1568
+ };
1569
+ }
1570
+
1515
1571
  function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
1516
1572
  const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
1517
1573
  return {
@@ -2951,6 +3007,99 @@ async function routeRequest(req, res) {
2951
3007
  return;
2952
3008
  }
2953
3009
 
3010
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-summary") {
3011
+ const body = await readJsonBody(req);
3012
+ const continuationRef = String(body && body.continuation_ref || "").trim();
3013
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
3014
+ if (!continuation) {
3015
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
3016
+ return;
3017
+ }
3018
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
3019
+ if (!resultPackage) {
3020
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
3021
+ return;
3022
+ }
3023
+ const payload = buildInteractionSpinePathRunPayload({
3024
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
3025
+ spine_path_ref: resultPackage.source_ref
3026
+ });
3027
+ if (!payload) {
3028
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
3029
+ return;
3030
+ }
3031
+ const result = executeCommandRequest(state, payload, req.headers);
3032
+ if (result.status !== 200) {
3033
+ sendJson(res, result.status, result.payload);
3034
+ return;
3035
+ }
3036
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
3037
+ sendJson(res, 200, buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation));
3038
+ return;
3039
+ }
3040
+
3041
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-bundle") {
3042
+ const body = await readJsonBody(req);
3043
+ const continuationRef = String(body && body.continuation_ref || "").trim();
3044
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
3045
+ if (!continuation) {
3046
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
3047
+ return;
3048
+ }
3049
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
3050
+ if (!resultPackage) {
3051
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
3052
+ return;
3053
+ }
3054
+ const payload = buildInteractionSpinePathRunPayload({
3055
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
3056
+ spine_path_ref: resultPackage.source_ref
3057
+ });
3058
+ if (!payload) {
3059
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
3060
+ return;
3061
+ }
3062
+ const result = executeCommandRequest(state, payload, req.headers);
3063
+ if (result.status !== 200) {
3064
+ sendJson(res, result.status, result.payload);
3065
+ return;
3066
+ }
3067
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
3068
+ sendJson(res, 200, buildPreparedContinuationAdapterUsableHandoffPackageBundle(portableHandoff, continuation));
3069
+ return;
3070
+ }
3071
+
3072
+ if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-default-summary") {
3073
+ const body = await readJsonBody(req);
3074
+ const continuationRef = String(body && body.continuation_ref || "").trim();
3075
+ const continuation = getInteractionResultPackageContinuation(continuationRef);
3076
+ if (!continuation) {
3077
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
3078
+ return;
3079
+ }
3080
+ const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
3081
+ if (!resultPackage) {
3082
+ sendJson(res, 404, { ok: false, error: "result_package_not_found" });
3083
+ return;
3084
+ }
3085
+ const payload = buildInteractionSpinePathRunPayload({
3086
+ ...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
3087
+ spine_path_ref: resultPackage.source_ref
3088
+ });
3089
+ if (!payload) {
3090
+ sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
3091
+ return;
3092
+ }
3093
+ const result = executeCommandRequest(state, payload, req.headers);
3094
+ if (result.status !== 200) {
3095
+ sendJson(res, result.status, result.payload);
3096
+ return;
3097
+ }
3098
+ const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
3099
+ sendJson(res, 200, buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation));
3100
+ return;
3101
+ }
3102
+
2954
3103
  if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
2955
3104
  const body = await readJsonBody(req);
2956
3105
  const continuationRef = String(body && body.continuation_ref || "").trim();