xytara 1.5.0 → 1.7.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
@@ -75,6 +75,36 @@ The package and service also expose a default transaction center surface so the
75
75
 
76
76
  That same default center is also reflected in direct helper paths for default MCP usage, so the default path can be previewed or quoted without repeating the full integration-selection story each time.
77
77
 
78
+ The `1.6.0` convergence line starts broadening that same default path into grouped first-party entry packs:
79
+
80
+ - `default.mcp.tool.invoke`
81
+ - `default.a2c.tooling.run`
82
+ - `default.identity.anchor.run`
83
+
84
+ These default packs are intended to make the public machine loop easier to consume as grouped first-party paths instead of only as low-level primitives.
85
+
86
+ The package and service now also expose:
87
+
88
+ - default transaction economics visibility
89
+ - default transaction task-pack catalog, summary, and detail routes
90
+ - direct SDK helpers for default task-pack preview, quote, and invoke
91
+
92
+ The next `1.6.0` carry also adds guided default loops on top of those packs:
93
+
94
+ - default loop catalog and detail routes
95
+ - direct loop-run service surface
96
+ - SDK helpers that return bundled result-set, linked-record, activity, and economics summaries together
97
+
98
+ That means the first-party path is easier to both run and inspect without manually stitching together monitor, receipt, delivery, and payment-ledger helpers after execution.
99
+
100
+ The current `1.7.0` line starts widening that surface into real grouped transaction classes:
101
+
102
+ - transaction-class pack catalog, summary, and detail routes
103
+ - grouped transaction-class run routes for first-party commerce classes
104
+ - proof-handoff summaries that make the next step into `xoonya` more obvious from transaction outputs
105
+
106
+ This is the first step beyond “clear default loop” toward “broader useful machine-commerce classes plus clearer commerce-to-proof follow-through.”
107
+
78
108
  ## Package Surface
79
109
 
80
110
  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.5.0";
43
+ const COMMERCE_SDK_VERSION = "1.7.0";
44
44
  const COMMERCE_API_VERSION = "v1";
45
45
 
46
46
  function createClient(options) {
@@ -2,6 +2,191 @@
2
2
 
3
3
  const { catalog, findTask, findWorkflow } = require("../fixtures/catalog");
4
4
 
5
+ function buildDefaultTransactionTaskPacks() {
6
+ const center = buildDefaultTransactionCenter();
7
+ const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
8
+ ? center.default_settlement.settlement_mode
9
+ : null;
10
+ const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
11
+ ? center.default_payment.protocol
12
+ : null;
13
+ const suggestedPaths = Array.isArray(center.suggested_paths) ? center.suggested_paths : [];
14
+ const defaultMcpPath = suggestedPaths.find((entry) => entry && entry.path_id === "default_mcp_x402_path") || null;
15
+ const defaultA2cPath = suggestedPaths.find((entry) => entry && entry.path_id === "default_a2c_tooling_flow") || null;
16
+ return [
17
+ {
18
+ pack_ref: "default.mcp.tool.invoke",
19
+ title: "Default MCP Tool Invoke",
20
+ description: "Run one MCP tool through the built-in default transaction path.",
21
+ pack_kind: "task_set",
22
+ usage_mode: "direct_invoke",
23
+ default_protocol: "mcp",
24
+ default_payment_protocol: defaultPaymentProtocol,
25
+ default_settlement_mode: defaultSettlementMode,
26
+ suggested_path_id: defaultMcpPath ? defaultMcpPath.path_id : null,
27
+ selection_reason: "first_party_default_task_pack",
28
+ task_refs: ["adapter.mcp.invoke"],
29
+ workflow_ref: null,
30
+ required_inputs: ["tool_name"],
31
+ optional_inputs: ["arguments", "settlement_mode", "payment_protocol"]
32
+ },
33
+ {
34
+ pack_ref: "default.a2c.tooling.run",
35
+ title: "Default A2C Tooling Run",
36
+ description: "Open an A2C session, preview a tooling pack, and invoke an MCP tool through the default path.",
37
+ pack_kind: "workflow_pack",
38
+ usage_mode: "guided_flow",
39
+ default_protocol: "mcp",
40
+ default_payment_protocol: defaultPaymentProtocol,
41
+ default_settlement_mode: defaultSettlementMode,
42
+ suggested_path_id: defaultA2cPath ? defaultA2cPath.path_id : null,
43
+ selection_reason: "first_party_default_workflow_pack",
44
+ task_refs: ["a2c.session.open", "a2c.pack.preview", "adapter.mcp.invoke"],
45
+ workflow_ref: "a2c.tooling.flow",
46
+ required_inputs: ["agent_id", "channel_ref", "pack_ref", "tool_name"],
47
+ optional_inputs: ["arguments", "settlement_mode", "payment_protocol"]
48
+ },
49
+ {
50
+ pack_ref: "default.identity.anchor.run",
51
+ title: "Default Identity Anchor Run",
52
+ description: "Preview identity attestation, register the record, link it, and anchor the resulting commitment.",
53
+ pack_kind: "workflow_pack",
54
+ usage_mode: "guided_flow",
55
+ default_protocol: null,
56
+ default_payment_protocol: defaultPaymentProtocol,
57
+ default_settlement_mode: defaultSettlementMode,
58
+ suggested_path_id: null,
59
+ selection_reason: "first_party_default_identity_pack",
60
+ task_refs: ["identity.attest.preview", "registry.register", "identity.registry.link", "anchoring.submit"],
61
+ workflow_ref: "identity.anchor.flow",
62
+ required_inputs: ["subject_id", "record_type", "registry_record_id", "commitment_hash"],
63
+ optional_inputs: ["registry_scope", "settlement_mode", "payment_protocol"]
64
+ }
65
+ ];
66
+ }
67
+
68
+ function buildDefaultTransactionGuidedLoops() {
69
+ const center = buildDefaultTransactionCenter();
70
+ const taskPacks = buildDefaultTransactionTaskPacks();
71
+ const economics = buildDefaultTransactionEconomics();
72
+ const buildLoop = (loopRef, packRef, title, description, stages) => {
73
+ const pack = taskPacks.find((entry) => entry && entry.pack_ref === packRef) || null;
74
+ return {
75
+ loop_ref: loopRef,
76
+ pack_ref: packRef,
77
+ title,
78
+ description,
79
+ stage_count: Array.isArray(stages) ? stages.length : 0,
80
+ stages: Array.isArray(stages) ? stages : [],
81
+ default_protocol: pack && pack.default_protocol ? pack.default_protocol : center.default_protocol.protocol,
82
+ default_payment_protocol: economics.payment_protocol,
83
+ default_settlement_mode: economics.default_settlement_mode,
84
+ suggested_path_id: pack && pack.suggested_path_id ? pack.suggested_path_id : null,
85
+ workflow_ref: pack && pack.workflow_ref ? pack.workflow_ref : null
86
+ };
87
+ };
88
+ return [
89
+ buildLoop(
90
+ "default.mcp.loop",
91
+ "default.mcp.tool.invoke",
92
+ "Default MCP Loop",
93
+ "Preview, quote, pay, invoke, and inspect one MCP tool through the built-in first-party path.",
94
+ ["preview", "quote", "pay", "invoke", "inspect"]
95
+ ),
96
+ buildLoop(
97
+ "default.a2c.tooling.loop",
98
+ "default.a2c.tooling.run",
99
+ "Default A2C Tooling Loop",
100
+ "Open a session, preview a pack, invoke a tool, and inspect the resulting linked records.",
101
+ ["preview", "quote", "pay", "session", "invoke", "inspect"]
102
+ ),
103
+ buildLoop(
104
+ "default.identity.anchor.loop",
105
+ "default.identity.anchor.run",
106
+ "Default Identity Anchor Loop",
107
+ "Preview identity attestation, register, link, anchor, and inspect the resulting default transaction records.",
108
+ ["preview", "quote", "pay", "register", "anchor", "inspect"]
109
+ )
110
+ ];
111
+ }
112
+
113
+ function buildTransactionClassPacks() {
114
+ const center = buildDefaultTransactionCenter();
115
+ const defaultSettlementMode = center.default_settlement && center.default_settlement.settlement_mode
116
+ ? center.default_settlement.settlement_mode
117
+ : null;
118
+ const defaultPaymentProtocol = center.default_payment && center.default_payment.protocol
119
+ ? center.default_payment.protocol
120
+ : null;
121
+ return [
122
+ {
123
+ class_pack_ref: "transaction.trust.receipt",
124
+ title: "Trust Receipt Transaction",
125
+ description: "Verify trust posture and validate the paired receipt as one grouped transaction class.",
126
+ workflow_ref: "trust.flow",
127
+ task_refs: ["trust.verify", "receipt.validate"],
128
+ category: "trust",
129
+ proof_handoff_kind: "receipt_validation",
130
+ default_payment_protocol: defaultPaymentProtocol,
131
+ default_settlement_mode: defaultSettlementMode,
132
+ required_inputs: ["subject_id", "receipt_id"],
133
+ optional_inputs: ["payment_protocol", "settlement_mode"]
134
+ },
135
+ {
136
+ class_pack_ref: "transaction.runtime.consequence",
137
+ title: "Runtime Consequence Transaction",
138
+ description: "Emit a runtime consequence and anchor the resulting commitment as one grouped transaction class.",
139
+ workflow_ref: "runtime.consequence.flow",
140
+ task_refs: ["runtime.emit", "runtime.anchor"],
141
+ category: "runtime",
142
+ proof_handoff_kind: "runtime_anchor",
143
+ default_payment_protocol: defaultPaymentProtocol,
144
+ default_settlement_mode: defaultSettlementMode,
145
+ required_inputs: ["intent_id", "event_type", "event_commitment"],
146
+ optional_inputs: ["payment_protocol", "settlement_mode"]
147
+ },
148
+ {
149
+ class_pack_ref: "transaction.admission.settlement",
150
+ title: "Admission Settlement Transaction",
151
+ description: "Preview admission and submit settlement as one grouped transaction class.",
152
+ workflow_ref: "admission.settlement.flow",
153
+ task_refs: ["admission.preview", "settlement.submit"],
154
+ category: "admission",
155
+ proof_handoff_kind: "admission_settlement",
156
+ default_payment_protocol: defaultPaymentProtocol,
157
+ default_settlement_mode: defaultSettlementMode,
158
+ required_inputs: ["source_zone_id", "target_zone_id", "intent_id"],
159
+ optional_inputs: ["interaction_class", "payment_protocol", "settlement_mode"]
160
+ },
161
+ {
162
+ class_pack_ref: "transaction.registry.anchor",
163
+ title: "Registry Anchor Transaction",
164
+ description: "Register a record and anchor its commitment as one grouped transaction class.",
165
+ workflow_ref: "registry.anchor.flow",
166
+ task_refs: ["registry.register", "anchoring.submit"],
167
+ category: "registry",
168
+ proof_handoff_kind: "registry_anchor",
169
+ default_payment_protocol: defaultPaymentProtocol,
170
+ default_settlement_mode: defaultSettlementMode,
171
+ required_inputs: ["subject_id", "record_type", "commitment_hash"],
172
+ optional_inputs: ["payment_protocol", "settlement_mode"]
173
+ },
174
+ {
175
+ class_pack_ref: "transaction.job.commitment",
176
+ title: "Job Commitment Transaction",
177
+ description: "Quote, reserve, and commit a job as one grouped transaction class.",
178
+ workflow_ref: "job.commitment.flow",
179
+ task_refs: ["jobs.quote", "jobs.reserve", "jobs.commit"],
180
+ category: "jobs",
181
+ proof_handoff_kind: "job_commitment",
182
+ default_payment_protocol: defaultPaymentProtocol,
183
+ default_settlement_mode: defaultSettlementMode,
184
+ required_inputs: ["job_type", "job_id"],
185
+ optional_inputs: ["payment_protocol", "settlement_mode"]
186
+ }
187
+ ];
188
+ }
189
+
5
190
  function buildDefaultTransactionCenter() {
6
191
  const settlementProfiles = Array.isArray(catalog.settlement_profiles) ? catalog.settlement_profiles : [];
7
192
  const defaultSettlementProfile = settlementProfiles[0] || null;
@@ -85,6 +270,161 @@ function summarizeDefaultTransactionCenter() {
85
270
  };
86
271
  }
87
272
 
273
+ function buildDefaultTransactionEconomics() {
274
+ const center = buildDefaultTransactionCenter();
275
+ const settlement = center.default_settlement || {};
276
+ const payment = center.default_payment || {};
277
+ const treasury = center.default_treasury || {};
278
+ return {
279
+ ok: true,
280
+ brand: center.brand,
281
+ product: "default transaction economics",
282
+ payment_protocol: payment.protocol || null,
283
+ payment_scheme: payment.payment_scheme || center.payment_scheme || null,
284
+ default_settlement_mode: settlement.settlement_mode || null,
285
+ supported_settlement_modes: Array.isArray(settlement.supported_modes) ? settlement.supported_modes : [],
286
+ settlement_adapter: settlement.adapter || null,
287
+ settlement_asset: settlement.asset || null,
288
+ payee_agent_id: settlement.payee_agent_id || null,
289
+ payee_label: settlement.payee_label || null,
290
+ treasury_destination_kind: treasury.destination_kind || null,
291
+ treasury_destination_template: treasury.destination_template || null,
292
+ suggested_path_ids: Array.isArray(center.suggested_paths)
293
+ ? center.suggested_paths.map((entry) => entry && entry.path_id).filter(Boolean)
294
+ : []
295
+ };
296
+ }
297
+
298
+ function summarizeDefaultTransactionEconomics() {
299
+ const economics = buildDefaultTransactionEconomics();
300
+ return {
301
+ ok: true,
302
+ brand: economics.brand,
303
+ product: economics.product,
304
+ payment_protocol: economics.payment_protocol,
305
+ payment_scheme: economics.payment_scheme,
306
+ default_settlement_mode: economics.default_settlement_mode,
307
+ settlement_mode_count: economics.supported_settlement_modes.length,
308
+ supported_settlement_modes: economics.supported_settlement_modes,
309
+ treasury_destination_kind: economics.treasury_destination_kind,
310
+ payee_agent_id: economics.payee_agent_id,
311
+ suggested_path_count: economics.suggested_path_ids.length,
312
+ suggested_path_ids: economics.suggested_path_ids
313
+ };
314
+ }
315
+
316
+ function buildDefaultTransactionTaskPackCatalog() {
317
+ const center = buildDefaultTransactionCenter();
318
+ const packs = buildDefaultTransactionTaskPacks();
319
+ return {
320
+ ok: true,
321
+ brand: center.brand,
322
+ product: "default transaction task packs",
323
+ default_protocol: center.default_protocol && center.default_protocol.protocol ? center.default_protocol.protocol : null,
324
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
325
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
326
+ pack_count: packs.length,
327
+ packs
328
+ };
329
+ }
330
+
331
+ function summarizeDefaultTransactionTaskPacks() {
332
+ const catalogResponse = buildDefaultTransactionTaskPackCatalog();
333
+ const packs = Array.isArray(catalogResponse.packs) ? catalogResponse.packs : [];
334
+ return {
335
+ ok: true,
336
+ brand: catalogResponse.brand,
337
+ product: catalogResponse.product,
338
+ default_protocol: catalogResponse.default_protocol,
339
+ default_payment_protocol: catalogResponse.default_payment_protocol,
340
+ default_settlement_mode: catalogResponse.default_settlement_mode,
341
+ pack_count: packs.length,
342
+ pack_refs: packs.map((entry) => entry && entry.pack_ref).filter(Boolean),
343
+ direct_pack_count: packs.filter((entry) => entry && entry.pack_kind === "task_set").length,
344
+ workflow_pack_count: packs.filter((entry) => entry && entry.pack_kind === "workflow_pack").length,
345
+ packs
346
+ };
347
+ }
348
+
349
+ function getDefaultTransactionTaskPack(ref) {
350
+ const normalized = String(ref || "").trim();
351
+ if (!normalized) return null;
352
+ return buildDefaultTransactionTaskPacks().find((entry) => entry && entry.pack_ref === normalized) || null;
353
+ }
354
+
355
+ function buildDefaultTransactionGuidedLoopCatalog() {
356
+ const center = buildDefaultTransactionCenter();
357
+ const loops = buildDefaultTransactionGuidedLoops();
358
+ return {
359
+ ok: true,
360
+ brand: center.brand,
361
+ product: "default transaction guided loops",
362
+ default_protocol: center.default_protocol && center.default_protocol.protocol ? center.default_protocol.protocol : null,
363
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
364
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
365
+ loop_count: loops.length,
366
+ loops
367
+ };
368
+ }
369
+
370
+ function summarizeDefaultTransactionGuidedLoops() {
371
+ const catalogResponse = buildDefaultTransactionGuidedLoopCatalog();
372
+ const loops = Array.isArray(catalogResponse.loops) ? catalogResponse.loops : [];
373
+ return {
374
+ ok: true,
375
+ brand: catalogResponse.brand,
376
+ product: catalogResponse.product,
377
+ default_protocol: catalogResponse.default_protocol,
378
+ default_payment_protocol: catalogResponse.default_payment_protocol,
379
+ default_settlement_mode: catalogResponse.default_settlement_mode,
380
+ loop_count: loops.length,
381
+ loop_refs: loops.map((entry) => entry && entry.loop_ref).filter(Boolean),
382
+ loops
383
+ };
384
+ }
385
+
386
+ function getDefaultTransactionGuidedLoop(ref) {
387
+ const normalized = String(ref || "").trim();
388
+ if (!normalized) return null;
389
+ return buildDefaultTransactionGuidedLoops().find((entry) => entry && entry.loop_ref === normalized) || null;
390
+ }
391
+
392
+ function buildTransactionClassPackCatalog() {
393
+ const center = buildDefaultTransactionCenter();
394
+ const packs = buildTransactionClassPacks();
395
+ return {
396
+ ok: true,
397
+ brand: center.brand,
398
+ product: "transaction class packs",
399
+ default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
400
+ default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
401
+ class_pack_count: packs.length,
402
+ class_packs: packs
403
+ };
404
+ }
405
+
406
+ function summarizeTransactionClassPacks() {
407
+ const catalogResponse = buildTransactionClassPackCatalog();
408
+ const packs = Array.isArray(catalogResponse.class_packs) ? catalogResponse.class_packs : [];
409
+ return {
410
+ ok: true,
411
+ brand: catalogResponse.brand,
412
+ product: catalogResponse.product,
413
+ default_payment_protocol: catalogResponse.default_payment_protocol,
414
+ default_settlement_mode: catalogResponse.default_settlement_mode,
415
+ class_pack_count: packs.length,
416
+ class_pack_refs: packs.map((entry) => entry && entry.class_pack_ref).filter(Boolean),
417
+ categories: Array.from(new Set(packs.map((entry) => entry && entry.category).filter(Boolean))),
418
+ class_packs: packs
419
+ };
420
+ }
421
+
422
+ function getTransactionClassPack(ref) {
423
+ const normalized = String(ref || "").trim();
424
+ if (!normalized) return null;
425
+ return buildTransactionClassPacks().find((entry) => entry && entry.class_pack_ref === normalized) || null;
426
+ }
427
+
88
428
  function buildCatalogResponse() {
89
429
  return {
90
430
  ok: true,
@@ -216,11 +556,22 @@ function getWorkflowDetail(ref) {
216
556
 
217
557
  module.exports = {
218
558
  buildCatalogResponse,
559
+ buildDefaultTransactionEconomics,
219
560
  buildDefaultTransactionCenter,
561
+ buildDefaultTransactionGuidedLoopCatalog,
562
+ buildDefaultTransactionTaskPackCatalog,
563
+ buildTransactionClassPackCatalog,
220
564
  getCatalog,
565
+ getDefaultTransactionGuidedLoop,
566
+ getDefaultTransactionTaskPack,
567
+ getTransactionClassPack,
221
568
  getTaskDetail,
222
569
  getWorkflowDetail,
223
570
  getWorkflowList,
224
571
  summarizeCatalog,
225
- summarizeDefaultTransactionCenter
572
+ summarizeDefaultTransactionCenter,
573
+ summarizeDefaultTransactionEconomics,
574
+ summarizeDefaultTransactionGuidedLoops,
575
+ summarizeDefaultTransactionTaskPacks,
576
+ summarizeTransactionClassPacks
226
577
  };