xytara 1.24.0 → 1.26.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/FINAL_CONTRACT.md +498 -0
- package/README.md +46 -0
- package/SERVICE_CONTRACT.md +105 -0
- package/START_HERE.md +61 -0
- package/TERMINOLOGY.md +50 -0
- package/index.js +1 -1
- package/lib/commerce_client.js +48 -0
- package/package.json +5 -1
- package/server.js +145 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# xytara Final Contract
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
`xytara` is the machine transaction and execution layer.
|
|
6
|
+
|
|
7
|
+
It exists to let agents, developers, and systems:
|
|
8
|
+
|
|
9
|
+
- discover machine capabilities
|
|
10
|
+
- quote work before execution
|
|
11
|
+
- pay through one or more supported payment paths
|
|
12
|
+
- execute tasks and workflows
|
|
13
|
+
- receive deliverables
|
|
14
|
+
- inspect lifecycle state
|
|
15
|
+
- integrate third-party adapters
|
|
16
|
+
- emit proof through `xoonya`
|
|
17
|
+
|
|
18
|
+
`xytara` is not the proof foundation itself.
|
|
19
|
+
It consumes and emits proof-compatible facts, but its primary job is machine commerce and execution.
|
|
20
|
+
|
|
21
|
+
## Public Release Stance
|
|
22
|
+
|
|
23
|
+
This product is being prepared as a first public release from private lineage.
|
|
24
|
+
|
|
25
|
+
That means:
|
|
26
|
+
|
|
27
|
+
- prior internal SDK and service shapes are design history, not public obligations
|
|
28
|
+
- useful capability should be preserved where it strengthens the final product
|
|
29
|
+
- historical private helper sprawl does not automatically define the public contract
|
|
30
|
+
|
|
31
|
+
The public baseline should therefore be chosen for product quality, clarity, extensibility, and end-to-end usefulness, not for backward compatibility with prior private repos.
|
|
32
|
+
|
|
33
|
+
## Product Boundary
|
|
34
|
+
|
|
35
|
+
`xytara` owns:
|
|
36
|
+
|
|
37
|
+
- task catalog
|
|
38
|
+
- workflow catalog
|
|
39
|
+
- quote generation
|
|
40
|
+
- pricing logic
|
|
41
|
+
- payment negotiation
|
|
42
|
+
- payment rail adapters
|
|
43
|
+
- execution adapters
|
|
44
|
+
- settlement adapters
|
|
45
|
+
- delivery and result surfaces
|
|
46
|
+
- lifecycle inspection
|
|
47
|
+
- operator visibility
|
|
48
|
+
- adapter manifests and adapter onboarding surfaces
|
|
49
|
+
|
|
50
|
+
`xytara` does not own:
|
|
51
|
+
|
|
52
|
+
- base proof semantics
|
|
53
|
+
- base receipt semantics
|
|
54
|
+
- proof canonicalization rules
|
|
55
|
+
- base proof bundle semantics
|
|
56
|
+
|
|
57
|
+
Those belong to `xoonya`.
|
|
58
|
+
|
|
59
|
+
## Core Doctrine
|
|
60
|
+
|
|
61
|
+
`xytara` is the hot-state, machine-transaction layer.
|
|
62
|
+
|
|
63
|
+
Its doctrine is:
|
|
64
|
+
|
|
65
|
+
- discover
|
|
66
|
+
- quote
|
|
67
|
+
- pay
|
|
68
|
+
- execute
|
|
69
|
+
- deliver
|
|
70
|
+
- inspect
|
|
71
|
+
- prove
|
|
72
|
+
|
|
73
|
+
The commerce layer may evolve quickly.
|
|
74
|
+
Its proof boundary must remain strict.
|
|
75
|
+
|
|
76
|
+
## Required Product Capabilities
|
|
77
|
+
|
|
78
|
+
### 1. Discovery
|
|
79
|
+
|
|
80
|
+
The system must expose machine-discoverable catalogs of:
|
|
81
|
+
|
|
82
|
+
- tasks
|
|
83
|
+
- workflows
|
|
84
|
+
- settlement profiles
|
|
85
|
+
- planning facets
|
|
86
|
+
- operational list and summary surfaces
|
|
87
|
+
|
|
88
|
+
Discovery must support:
|
|
89
|
+
|
|
90
|
+
- raw row access
|
|
91
|
+
- summary access
|
|
92
|
+
- value-list access where useful
|
|
93
|
+
- filterable query paths
|
|
94
|
+
|
|
95
|
+
### 2. Quote Before Execution
|
|
96
|
+
|
|
97
|
+
Every payable execution path must support quote or price discovery before irreversible work begins.
|
|
98
|
+
|
|
99
|
+
The quote system must support:
|
|
100
|
+
|
|
101
|
+
- single-task quotes
|
|
102
|
+
- workflow/task-set quotes
|
|
103
|
+
- preview flows where execution outcome is not yet committed
|
|
104
|
+
- dynamic and static pricing models
|
|
105
|
+
|
|
106
|
+
### 3. Payment Paths
|
|
107
|
+
|
|
108
|
+
The commerce layer must support multiple payment modes.
|
|
109
|
+
|
|
110
|
+
At minimum, the architecture must permit:
|
|
111
|
+
|
|
112
|
+
- machine-native pay-per-use negotiation
|
|
113
|
+
- human-friendly billing / credits
|
|
114
|
+
- settlement-aware downstream accounting
|
|
115
|
+
|
|
116
|
+
The public contract must stay payment-rail-neutral.
|
|
117
|
+
|
|
118
|
+
### 4. Execution
|
|
119
|
+
|
|
120
|
+
The system must support:
|
|
121
|
+
|
|
122
|
+
- direct task execution
|
|
123
|
+
- workflow execution
|
|
124
|
+
- synchronous result flows
|
|
125
|
+
- asynchronous result flows
|
|
126
|
+
- waited result flows
|
|
127
|
+
- lifecycle inspection after execution
|
|
128
|
+
|
|
129
|
+
### 5. Delivery
|
|
130
|
+
|
|
131
|
+
Execution outputs must be representable as deliverables.
|
|
132
|
+
|
|
133
|
+
The delivery contract must support:
|
|
134
|
+
|
|
135
|
+
- inline outputs
|
|
136
|
+
- artifact references
|
|
137
|
+
- linked records
|
|
138
|
+
- monitor snapshots
|
|
139
|
+
- activity snapshots
|
|
140
|
+
|
|
141
|
+
### 6. Lifecycle and Operator Surfaces
|
|
142
|
+
|
|
143
|
+
The system must expose lifecycle and operator-facing surfaces for:
|
|
144
|
+
|
|
145
|
+
- quotes
|
|
146
|
+
- transactions
|
|
147
|
+
- receipts
|
|
148
|
+
- payments / ledger records
|
|
149
|
+
- deliveries
|
|
150
|
+
- disputes
|
|
151
|
+
- refunds
|
|
152
|
+
- remediation tickets
|
|
153
|
+
- reports
|
|
154
|
+
|
|
155
|
+
The operator layer must provide:
|
|
156
|
+
|
|
157
|
+
- summaries
|
|
158
|
+
- counts and aggregates
|
|
159
|
+
- status views
|
|
160
|
+
- open issue views
|
|
161
|
+
- execution exception views
|
|
162
|
+
- dashboard views
|
|
163
|
+
- drill-down record retrieval
|
|
164
|
+
|
|
165
|
+
### 7. Adapter Extensibility
|
|
166
|
+
|
|
167
|
+
The commerce layer must be intentionally extensible by third parties.
|
|
168
|
+
|
|
169
|
+
This is a first-class product requirement.
|
|
170
|
+
|
|
171
|
+
## Required Separation Boundaries
|
|
172
|
+
|
|
173
|
+
### 1. Execution vs Proof
|
|
174
|
+
|
|
175
|
+
Execution describes what happened and produces externally consequential event facts.
|
|
176
|
+
|
|
177
|
+
Proof commits to those facts.
|
|
178
|
+
|
|
179
|
+
`xytara` must not redefine proof semantics.
|
|
180
|
+
|
|
181
|
+
### 2. Commerce vs Settlement Rail
|
|
182
|
+
|
|
183
|
+
The commerce layer negotiates and coordinates payment and execution.
|
|
184
|
+
|
|
185
|
+
Settlement rails are plugged in as adapters.
|
|
186
|
+
|
|
187
|
+
The public commerce contract must not collapse into one rail’s worldview.
|
|
188
|
+
|
|
189
|
+
### 3. Commerce vs Governance
|
|
190
|
+
|
|
191
|
+
The commerce layer may enforce configured rules and policies needed for execution and transaction processing.
|
|
192
|
+
|
|
193
|
+
But it should not become an all-purpose political governance system.
|
|
194
|
+
|
|
195
|
+
### 4. Hot State vs Cold Truth
|
|
196
|
+
|
|
197
|
+
Hot operational state belongs in commerce.
|
|
198
|
+
|
|
199
|
+
Cold portable truth belongs in proof.
|
|
200
|
+
|
|
201
|
+
The commerce layer may reference proof artifacts and emit them, but must not absorb their base semantics.
|
|
202
|
+
|
|
203
|
+
## Public Commerce Model
|
|
204
|
+
|
|
205
|
+
The public commerce contract should center on the following abstractions.
|
|
206
|
+
|
|
207
|
+
### A. Task
|
|
208
|
+
|
|
209
|
+
A task is the smallest directly executable commercial capability.
|
|
210
|
+
|
|
211
|
+
Every public task should have:
|
|
212
|
+
|
|
213
|
+
- stable reference
|
|
214
|
+
- summary representation
|
|
215
|
+
- pricing representation
|
|
216
|
+
- schema/template representation where applicable
|
|
217
|
+
- execution mode
|
|
218
|
+
- adapter identity
|
|
219
|
+
- capability metadata
|
|
220
|
+
|
|
221
|
+
### B. Workflow
|
|
222
|
+
|
|
223
|
+
A workflow is a composed machine capability built from one or more tasks.
|
|
224
|
+
|
|
225
|
+
Every public workflow should have:
|
|
226
|
+
|
|
227
|
+
- stable reference
|
|
228
|
+
- summary representation
|
|
229
|
+
- pricing representation
|
|
230
|
+
- task composition metadata
|
|
231
|
+
- execution and failure posture metadata
|
|
232
|
+
|
|
233
|
+
### C. Quote
|
|
234
|
+
|
|
235
|
+
A quote is the priced and versioned commercial offer for a machine action.
|
|
236
|
+
|
|
237
|
+
Quotes may be:
|
|
238
|
+
|
|
239
|
+
- previews
|
|
240
|
+
- execution quotes
|
|
241
|
+
- workflow quotes
|
|
242
|
+
- batch quotes
|
|
243
|
+
|
|
244
|
+
### D. Result / Deliverable
|
|
245
|
+
|
|
246
|
+
A result is the execution outcome.
|
|
247
|
+
|
|
248
|
+
A deliverable is the artifact or structured output accessible to the caller or downstream systems.
|
|
249
|
+
|
|
250
|
+
### E. Lifecycle Record
|
|
251
|
+
|
|
252
|
+
Lifecycle records track operational state across the quote -> execution -> delivery -> issue/remediation path.
|
|
253
|
+
|
|
254
|
+
## Required Adapter Classes
|
|
255
|
+
|
|
256
|
+
The final public system must support explicit adapter classes.
|
|
257
|
+
|
|
258
|
+
### 1. Execution Adapter
|
|
259
|
+
|
|
260
|
+
Wraps an execution backend or runtime capability.
|
|
261
|
+
|
|
262
|
+
Responsibilities:
|
|
263
|
+
|
|
264
|
+
- execute supported task(s)
|
|
265
|
+
- surface deterministic input/output contracts
|
|
266
|
+
- expose capability metadata
|
|
267
|
+
- produce proof-compatible event facts
|
|
268
|
+
|
|
269
|
+
### 2. Settlement Adapter
|
|
270
|
+
|
|
271
|
+
Handles external settlement or anchoring coordination where needed.
|
|
272
|
+
|
|
273
|
+
Responsibilities:
|
|
274
|
+
|
|
275
|
+
- accept settlement targets
|
|
276
|
+
- expose external references
|
|
277
|
+
- support verification-ready references back into lifecycle state
|
|
278
|
+
|
|
279
|
+
### 3. Payment Rail Adapter
|
|
280
|
+
|
|
281
|
+
Handles a payment negotiation and payment confirmation path.
|
|
282
|
+
|
|
283
|
+
Responsibilities:
|
|
284
|
+
|
|
285
|
+
- advertise payment capability
|
|
286
|
+
- perform negotiation / payment admission logic
|
|
287
|
+
- produce settlement/payment references usable by lifecycle systems
|
|
288
|
+
|
|
289
|
+
### 4. Agent Protocol Adapter
|
|
290
|
+
|
|
291
|
+
Wraps agent-facing invocation or integration protocols.
|
|
292
|
+
|
|
293
|
+
Examples:
|
|
294
|
+
|
|
295
|
+
- MCP-style consumption
|
|
296
|
+
- other machine-callable protocol surfaces
|
|
297
|
+
|
|
298
|
+
Responsibilities:
|
|
299
|
+
|
|
300
|
+
- expose discovery and invocation in a machine-native way
|
|
301
|
+
- preserve underlying quote/pay/execute semantics
|
|
302
|
+
|
|
303
|
+
### 5. Identity / Registry Adapter
|
|
304
|
+
|
|
305
|
+
Handles external identity, trust, registry, or discovery linkage where needed.
|
|
306
|
+
|
|
307
|
+
Responsibilities:
|
|
308
|
+
|
|
309
|
+
- surface references, identities, and compatibility metadata
|
|
310
|
+
- remain additive, not redefining the commerce core
|
|
311
|
+
|
|
312
|
+
## Third-Party Adapter Contract
|
|
313
|
+
|
|
314
|
+
Third-party adapter support is a product surface, not a private implementation detail.
|
|
315
|
+
|
|
316
|
+
The final system must include:
|
|
317
|
+
|
|
318
|
+
- stable adapter interfaces
|
|
319
|
+
- manifest schema
|
|
320
|
+
- capability metadata schema
|
|
321
|
+
- certification harness
|
|
322
|
+
- compatibility/version rules
|
|
323
|
+
- example adapters
|
|
324
|
+
- adapter authoring docs
|
|
325
|
+
|
|
326
|
+
### Third-party adapter lifecycle
|
|
327
|
+
|
|
328
|
+
1. Implement adapter interface
|
|
329
|
+
2. Publish adapter manifest
|
|
330
|
+
3. Pass certification harness
|
|
331
|
+
4. Register into catalog or adapter registry
|
|
332
|
+
5. Promote from staging to production
|
|
333
|
+
|
|
334
|
+
### Required adapter properties
|
|
335
|
+
|
|
336
|
+
Every adapter must define:
|
|
337
|
+
|
|
338
|
+
- adapter identity
|
|
339
|
+
- adapter version
|
|
340
|
+
- adapter class
|
|
341
|
+
- supported capabilities
|
|
342
|
+
- failure semantics
|
|
343
|
+
- timeout behavior
|
|
344
|
+
- idempotency behavior
|
|
345
|
+
- health contract
|
|
346
|
+
- proof hook behavior
|
|
347
|
+
|
|
348
|
+
## Payment Model
|
|
349
|
+
|
|
350
|
+
The system must support multiple commercial modes without collapsing into one payment ideology.
|
|
351
|
+
|
|
352
|
+
### Publicly acceptable modes
|
|
353
|
+
|
|
354
|
+
- pay-per-use machine negotiation
|
|
355
|
+
- credits / usage units
|
|
356
|
+
- human-facing billing / invoicing / top-up style models
|
|
357
|
+
- batch or workflow pricing
|
|
358
|
+
|
|
359
|
+
### Rule
|
|
360
|
+
|
|
361
|
+
No public commerce contract should require a single chain, single stablecoin, or single card processor to remain valid.
|
|
362
|
+
|
|
363
|
+
## Pricing Model
|
|
364
|
+
|
|
365
|
+
The system must support:
|
|
366
|
+
|
|
367
|
+
- fixed pricing
|
|
368
|
+
- dynamic pricing
|
|
369
|
+
- pricing basis metadata
|
|
370
|
+
- pricing band metadata
|
|
371
|
+
- pricing currency metadata
|
|
372
|
+
- bundle/workflow pricing
|
|
373
|
+
|
|
374
|
+
The first production release should keep pricing explainable and stable enough for trust.
|
|
375
|
+
|
|
376
|
+
More advanced adaptive pricing may be layered later, but it must not make the catalog unintelligible.
|
|
377
|
+
|
|
378
|
+
## Settlement Model
|
|
379
|
+
|
|
380
|
+
Settlement is distinct from execution.
|
|
381
|
+
|
|
382
|
+
### Rule
|
|
383
|
+
|
|
384
|
+
Execution success and settlement finality may be related, but they are not identical concepts.
|
|
385
|
+
|
|
386
|
+
The commerce system must preserve explicit separation between:
|
|
387
|
+
|
|
388
|
+
- task execution
|
|
389
|
+
- result production
|
|
390
|
+
- settlement/anchoring/finality reference
|
|
391
|
+
|
|
392
|
+
## Operator Model
|
|
393
|
+
|
|
394
|
+
The operator layer is a required product surface.
|
|
395
|
+
|
|
396
|
+
### Required outcomes
|
|
397
|
+
|
|
398
|
+
Operators must be able to:
|
|
399
|
+
|
|
400
|
+
- inspect active operational issues
|
|
401
|
+
- inspect execution exceptions
|
|
402
|
+
- view top-level dashboard state
|
|
403
|
+
- drill into affected records
|
|
404
|
+
- retrieve status and aggregate summaries
|
|
405
|
+
|
|
406
|
+
This may begin as API and CLI surfaces before a full UI is finished.
|
|
407
|
+
|
|
408
|
+
## Public Entry Surfaces
|
|
409
|
+
|
|
410
|
+
The final public commerce product should support:
|
|
411
|
+
|
|
412
|
+
- package / SDK surface
|
|
413
|
+
- service API surface
|
|
414
|
+
- CLI surface
|
|
415
|
+
- machine-tool surface
|
|
416
|
+
|
|
417
|
+
### One-line use principle
|
|
418
|
+
|
|
419
|
+
The public product story must support the practical flow:
|
|
420
|
+
|
|
421
|
+
run command -> see catalog -> define task(s) -> get quote(s) -> pay -> receive deliverable(s) -> verify proof
|
|
422
|
+
|
|
423
|
+
This is not just an example.
|
|
424
|
+
It is part of the product contract.
|
|
425
|
+
|
|
426
|
+
## Proof Relationship
|
|
427
|
+
|
|
428
|
+
The commerce layer must emit facts and receipts in a way compatible with `xoonya`.
|
|
429
|
+
|
|
430
|
+
### Rule
|
|
431
|
+
|
|
432
|
+
Commerce may:
|
|
433
|
+
|
|
434
|
+
- emit proof-compatible canonical event facts
|
|
435
|
+
- emit receipts via proof integration
|
|
436
|
+
- expose proof references in results and lifecycle records
|
|
437
|
+
|
|
438
|
+
Commerce may not:
|
|
439
|
+
|
|
440
|
+
- redefine proof semantics
|
|
441
|
+
- redefine receipt validity
|
|
442
|
+
- turn commerce metadata into the base proof contract
|
|
443
|
+
|
|
444
|
+
## Versioning Strategy
|
|
445
|
+
|
|
446
|
+
Commerce versioning should distinguish between:
|
|
447
|
+
|
|
448
|
+
- core product contract changes
|
|
449
|
+
- adapter API changes
|
|
450
|
+
- catalog/schema changes
|
|
451
|
+
- optional helper additions
|
|
452
|
+
|
|
453
|
+
Breaking changes to adapter contracts and commerce contract surfaces must be explicit.
|
|
454
|
+
|
|
455
|
+
## Conformance Requirements
|
|
456
|
+
|
|
457
|
+
The final commerce product must maintain conformance across:
|
|
458
|
+
|
|
459
|
+
- discovery surfaces
|
|
460
|
+
- quote/pay/execute paths
|
|
461
|
+
- batch paths
|
|
462
|
+
- lifecycle inspection
|
|
463
|
+
- operator summaries
|
|
464
|
+
- proof integration
|
|
465
|
+
- adapter certification
|
|
466
|
+
|
|
467
|
+
## What Must Survive From Internal Lineages
|
|
468
|
+
|
|
469
|
+
From the internal stack, the following semantic wins should survive:
|
|
470
|
+
|
|
471
|
+
- clean separation of execution and proof
|
|
472
|
+
- clean separation of execution and settlement
|
|
473
|
+
- batching and ordering as explicit concerns
|
|
474
|
+
- adapter-first design
|
|
475
|
+
- neutral commerce over multiple rails
|
|
476
|
+
- proof-backed lifecycle state
|
|
477
|
+
- operator-grade visibility
|
|
478
|
+
|
|
479
|
+
Historical internal labels and names should not survive publicly.
|
|
480
|
+
|
|
481
|
+
## Final Product Position
|
|
482
|
+
|
|
483
|
+
`xytara` should become:
|
|
484
|
+
|
|
485
|
+
- the machine transaction layer
|
|
486
|
+
- the machine execution layer
|
|
487
|
+
- the machine delivery layer
|
|
488
|
+
- the operator-visible machine commerce layer
|
|
489
|
+
|
|
490
|
+
It should be:
|
|
491
|
+
|
|
492
|
+
- protocol-agnostic
|
|
493
|
+
- rail-flexible
|
|
494
|
+
- adapter-extensible
|
|
495
|
+
- machine-native
|
|
496
|
+
- proof-backed
|
|
497
|
+
|
|
498
|
+
That is the correct public role for the final commerce product.
|
package/README.md
CHANGED
|
@@ -16,6 +16,34 @@ It exists to let agents, developers, and systems:
|
|
|
16
16
|
|
|
17
17
|
This repo is the hot-state commerce layer. It does not define base proof semantics. It references and emits proof-compatible facts, while `xoonya` owns canonical proof.
|
|
18
18
|
|
|
19
|
+
## Start Here
|
|
20
|
+
|
|
21
|
+
If you are new to the public stack, use this order:
|
|
22
|
+
|
|
23
|
+
1. read [START_HERE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/START_HERE.md)
|
|
24
|
+
2. run `node examples/quickstart.js`
|
|
25
|
+
3. run `npm run verify:all`
|
|
26
|
+
4. use [FINAL_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/FINAL_CONTRACT.md) and [SERVICE_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/SERVICE_CONTRACT.md) as the durable public contract
|
|
27
|
+
|
|
28
|
+
If you are building adapters, continue with:
|
|
29
|
+
|
|
30
|
+
- [adapters/AUTHORING_GUIDE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/AUTHORING_GUIDE.md)
|
|
31
|
+
- [adapters/ONBOARDING_POSTURE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/ONBOARDING_POSTURE.md)
|
|
32
|
+
- [adapters/THIRD_PARTY_SUBMISSION_PROCESS.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md)
|
|
33
|
+
|
|
34
|
+
## Production Path
|
|
35
|
+
|
|
36
|
+
The intended production-facing default path is now:
|
|
37
|
+
|
|
38
|
+
1. discover a capability
|
|
39
|
+
2. preview or quote the transaction path
|
|
40
|
+
3. execute through the default machine path
|
|
41
|
+
4. inspect the transaction-side result and lifecycle state
|
|
42
|
+
5. hand the result into `xoonya`
|
|
43
|
+
6. review and run the proof-side completion path
|
|
44
|
+
|
|
45
|
+
The rest of this README explains the full surface area and milestone trail, but the public starting posture should now be understandable from that one default path.
|
|
46
|
+
|
|
19
47
|
## Commerce Loop
|
|
20
48
|
|
|
21
49
|
The public product loop is:
|
|
@@ -244,6 +272,24 @@ The current `1.24.0` line starts turning that adapter-integrable operating path
|
|
|
244
272
|
|
|
245
273
|
This is intended to make the transaction-side continuation path easier to use as the obvious first public adapter path instead of only a path that is integrable with a little extra coordination.
|
|
246
274
|
|
|
275
|
+
The current `1.25.0` line starts turning that adapter-ready default path into a clearer adapter-complete default path:
|
|
276
|
+
|
|
277
|
+
- complete-default-path summaries on top of the default operating-path path
|
|
278
|
+
- compact complete-default-path bundles for direct adapter-facing complete-path posture
|
|
279
|
+
- default complete-default-path summaries for the next proof-side complete-default-path run posture
|
|
280
|
+
- clearer complete-default-path ids and stable complete-path carry
|
|
281
|
+
|
|
282
|
+
This is intended to make the transaction-side continuation path easier to adopt as the complete public default path an outside builder can use without needing private interpretation.
|
|
283
|
+
|
|
284
|
+
The current `1.26.0` line finalizes that public shape into a cleaner production-ready package:
|
|
285
|
+
|
|
286
|
+
- a publishable [START_HERE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/START_HERE.md) onboarding path
|
|
287
|
+
- clearer top-level README entry points for the default production flow
|
|
288
|
+
- publishable contract and terminology docs carried in the package tarball
|
|
289
|
+
- naming cleanup that keeps the public story anchored to `xytara` and `xoonya`
|
|
290
|
+
|
|
291
|
+
This is intended to make the public transaction-side package feel like a finished production-facing product instead of a strong stack that still assumes milestone-history context.
|
|
292
|
+
|
|
247
293
|
## Package Surface
|
|
248
294
|
|
|
249
295
|
The SDK is broad, but it stays organized into a few repeatable families instead of one-off surfaces.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# xytara Service Contract
|
|
2
|
+
|
|
3
|
+
This file freezes the public service contract for `xytara`.
|
|
4
|
+
|
|
5
|
+
## Public Routes
|
|
6
|
+
|
|
7
|
+
Core routes:
|
|
8
|
+
|
|
9
|
+
- `GET /health`
|
|
10
|
+
- `GET /v1/catalog`
|
|
11
|
+
- `GET /v1/catalog/summary`
|
|
12
|
+
- `GET /v1/catalog/task?ref=<task_ref_or_alias>`
|
|
13
|
+
- `GET /v1/catalog/workflows`
|
|
14
|
+
- `GET /v1/catalog/workflow?ref=<workflow_ref_or_alias>`
|
|
15
|
+
- `POST /v1/payment-quotes`
|
|
16
|
+
- `POST /v1/commands/execute`
|
|
17
|
+
- `POST /x402/commands/execute`
|
|
18
|
+
|
|
19
|
+
Named first-class lanes:
|
|
20
|
+
|
|
21
|
+
- `POST /v1/trust/handoffs/emit`
|
|
22
|
+
- `POST /v1/trust/handoffs/validate`
|
|
23
|
+
- `POST /v1/execution-receipts/handoffs/emit`
|
|
24
|
+
- `POST /v1/execution-receipts/handoffs/validate`
|
|
25
|
+
- `POST /v1/receipt-ledger/handoffs/emit`
|
|
26
|
+
- `POST /v1/receipt-ledger/handoffs/validate`
|
|
27
|
+
- `POST /v1/admission/preview`
|
|
28
|
+
- `POST /v1/runtime/emit`
|
|
29
|
+
- `POST /v1/runtime/anchor`
|
|
30
|
+
- `POST /v1/runtime/emit-anchor`
|
|
31
|
+
- `POST /v1/registry/register`
|
|
32
|
+
- `POST /v1/anchoring/submit`
|
|
33
|
+
- `POST /v1/mcp/tools/invoke`
|
|
34
|
+
- `POST /x402/mcp/tools/invoke`
|
|
35
|
+
|
|
36
|
+
Lifecycle and operator routes:
|
|
37
|
+
|
|
38
|
+
- `GET /v1/payment-quotes`
|
|
39
|
+
- `GET /v1/payment-quotes/:quote_id`
|
|
40
|
+
- `GET /v1/governed-transactions`
|
|
41
|
+
- `GET /v1/governed-transactions/:transaction_id`
|
|
42
|
+
- `GET /v1/receipts`
|
|
43
|
+
- `GET /v1/receipts/:receipt_id`
|
|
44
|
+
- `GET /v1/payment-ledger`
|
|
45
|
+
- `GET /v1/payment-ledger/:payment_id`
|
|
46
|
+
- `GET /v1/deliveries`
|
|
47
|
+
- `GET /v1/deliveries/:delivery_id`
|
|
48
|
+
- `GET /v1/disputes`
|
|
49
|
+
- `POST /v1/disputes`
|
|
50
|
+
- `GET /v1/disputes/:dispute_id`
|
|
51
|
+
- `POST /v1/disputes/:dispute_id/actions`
|
|
52
|
+
- `GET /v1/refunds`
|
|
53
|
+
- `POST /v1/refunds`
|
|
54
|
+
- `GET /v1/refunds/:refund_id`
|
|
55
|
+
- `POST /v1/refunds/:refund_id/actions`
|
|
56
|
+
- `POST /v1/remediation-tickets`
|
|
57
|
+
- `GET /v1/remediation-tickets`
|
|
58
|
+
- `GET /v1/remediation-tickets/:ticket_id`
|
|
59
|
+
- `POST /v1/remediation-tickets/:ticket_id/actions`
|
|
60
|
+
- `GET /v1/reconciliation-report`
|
|
61
|
+
- `GET /v1/operator-export-pack`
|
|
62
|
+
- `GET /v1/operations/dashboard`
|
|
63
|
+
- `GET /v1/operations/attention-records`
|
|
64
|
+
|
|
65
|
+
## Error-Shape Expectations
|
|
66
|
+
|
|
67
|
+
Primary error posture:
|
|
68
|
+
|
|
69
|
+
- malformed or invalid requests return `400`
|
|
70
|
+
- payment-required flows return `402`
|
|
71
|
+
- expired quotes return `409`
|
|
72
|
+
- missing routes return `404`
|
|
73
|
+
- unexpected server failures return `500`
|
|
74
|
+
|
|
75
|
+
Expected top-level error shapes:
|
|
76
|
+
|
|
77
|
+
- generic failure:
|
|
78
|
+
- `{ "ok": false, "reason": "<message>" }`
|
|
79
|
+
- payment challenge:
|
|
80
|
+
- `{ "ok": false, "payment_required": { ... } }`
|
|
81
|
+
- expired quote:
|
|
82
|
+
- `{ "ok": false, "reason": "quote_expired", "quote": { ... } }`
|
|
83
|
+
- not found:
|
|
84
|
+
- `{ "ok": false, "reason": "not_found", "path": "<path>" }`
|
|
85
|
+
|
|
86
|
+
Named resource-view responses may return resource-specific missing reasons such as `quote_not_found` or `delivery_not_found`, but the top-level failure posture should remain predictable.
|
|
87
|
+
|
|
88
|
+
## Final-Loop Verification
|
|
89
|
+
|
|
90
|
+
The constitutional commerce loop for `xytara` is:
|
|
91
|
+
|
|
92
|
+
1. discover
|
|
93
|
+
2. quote
|
|
94
|
+
3. pay or receive payment challenge
|
|
95
|
+
4. execute
|
|
96
|
+
5. deliver
|
|
97
|
+
6. inspect
|
|
98
|
+
7. prove or reference proof-compatible facts
|
|
99
|
+
|
|
100
|
+
This loop is exercised through:
|
|
101
|
+
|
|
102
|
+
- package verification
|
|
103
|
+
- adapter verification
|
|
104
|
+
- quickstart verification
|
|
105
|
+
- service verification
|
package/START_HERE.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# xytara Start Here
|
|
2
|
+
|
|
3
|
+
This is the shortest reliable path for understanding and using the public `xytara` package in production-facing order.
|
|
4
|
+
|
|
5
|
+
## 1. Understand The Role
|
|
6
|
+
|
|
7
|
+
`xytara` is the transaction-side half of the public stack.
|
|
8
|
+
|
|
9
|
+
Its job is to let a caller:
|
|
10
|
+
|
|
11
|
+
1. discover a machine capability
|
|
12
|
+
2. quote or preview the path
|
|
13
|
+
3. execute through the default transaction flow
|
|
14
|
+
4. inspect result and lifecycle state
|
|
15
|
+
5. hand the result into `xoonya` for proof-native completion
|
|
16
|
+
|
|
17
|
+
## 2. Run The Fastest Real Example
|
|
18
|
+
|
|
19
|
+
Run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
node examples/quickstart.js
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This is the fastest way to see the intended package story end-to-end.
|
|
26
|
+
|
|
27
|
+
## 3. Verify The Whole Package
|
|
28
|
+
|
|
29
|
+
Run:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run verify:all
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This is the production-confidence check for the published package surface.
|
|
36
|
+
|
|
37
|
+
## 4. Read The Durable Contract
|
|
38
|
+
|
|
39
|
+
For long-term product understanding, read:
|
|
40
|
+
|
|
41
|
+
- [FINAL_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/FINAL_CONTRACT.md)
|
|
42
|
+
- [SERVICE_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/SERVICE_CONTRACT.md)
|
|
43
|
+
- [TERMINOLOGY.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/TERMINOLOGY.md)
|
|
44
|
+
|
|
45
|
+
## 5. If You Are Building Adapters
|
|
46
|
+
|
|
47
|
+
Continue with:
|
|
48
|
+
|
|
49
|
+
- [adapters/AUTHORING_GUIDE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/AUTHORING_GUIDE.md)
|
|
50
|
+
- [adapters/ONBOARDING_POSTURE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/ONBOARDING_POSTURE.md)
|
|
51
|
+
- [adapters/THIRD_PARTY_SUBMISSION_PROCESS.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md)
|
|
52
|
+
|
|
53
|
+
## 6. Production Reading Rule
|
|
54
|
+
|
|
55
|
+
If you only remember one thing, remember this:
|
|
56
|
+
|
|
57
|
+
The main public path is no longer "read every milestone layer."
|
|
58
|
+
|
|
59
|
+
It is:
|
|
60
|
+
|
|
61
|
+
discover -> preview/quote -> execute -> inspect -> hand off to `xoonya`
|
package/TERMINOLOGY.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# xytara Terminology
|
|
2
|
+
|
|
3
|
+
This file freezes the public terminology used by `xytara`.
|
|
4
|
+
|
|
5
|
+
The goal is:
|
|
6
|
+
|
|
7
|
+
- one public name for the repo
|
|
8
|
+
- one stable commerce vocabulary
|
|
9
|
+
- no private-lineage naming leakage
|
|
10
|
+
|
|
11
|
+
## Public Name
|
|
12
|
+
|
|
13
|
+
- repo name: `xytara`
|
|
14
|
+
- package name: `xytara`
|
|
15
|
+
- service name: `xytara`
|
|
16
|
+
|
|
17
|
+
Use `xytara` only for this repo and its public commerce identity.
|
|
18
|
+
|
|
19
|
+
## Preferred Commerce Terms
|
|
20
|
+
|
|
21
|
+
Use these terms consistently:
|
|
22
|
+
|
|
23
|
+
- `catalog`
|
|
24
|
+
- `task`
|
|
25
|
+
- `workflow`
|
|
26
|
+
- `task set`
|
|
27
|
+
- `quote`
|
|
28
|
+
- `payment`
|
|
29
|
+
- `execute`
|
|
30
|
+
- `deliver`
|
|
31
|
+
- `inspect`
|
|
32
|
+
- `operator`
|
|
33
|
+
- `adapter`
|
|
34
|
+
- `settlement profile`
|
|
35
|
+
- `lifecycle`
|
|
36
|
+
|
|
37
|
+
## Cross-Repo Reference Rule
|
|
38
|
+
|
|
39
|
+
If this repo needs to mention the other repo, use generic wording:
|
|
40
|
+
|
|
41
|
+
- `the proof repo`
|
|
42
|
+
- `the proof layer`
|
|
43
|
+
|
|
44
|
+
Do not brand the other repo inside this repo's core public copy.
|
|
45
|
+
|
|
46
|
+
## Naming Rule
|
|
47
|
+
|
|
48
|
+
This repo should read like a self-contained public commerce product with an explicit proof boundary.
|
|
49
|
+
|
|
50
|
+
If wording does not strengthen that outcome, keep it generic.
|
package/index.js
CHANGED
package/lib/commerce_client.js
CHANGED
|
@@ -4968,6 +4968,54 @@ class CommerceClient {
|
|
|
4968
4968
|
});
|
|
4969
4969
|
}
|
|
4970
4970
|
|
|
4971
|
+
async prepareInteractionResultPackageCompleteDefaultPathSummary(continuationRef, body, options) {
|
|
4972
|
+
const opts = options || {};
|
|
4973
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/complete-default-path-summary", {
|
|
4974
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.complete.default.path.summary",
|
|
4975
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4976
|
+
body: body || {},
|
|
4977
|
+
callback_url: opts.callbackUrl || null,
|
|
4978
|
+
settlement_mode: opts.settlementMode || null,
|
|
4979
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4980
|
+
protocol: opts.protocol || null,
|
|
4981
|
+
integration_id: opts.integrationId || null,
|
|
4982
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4983
|
+
integration_context: opts.integrationContext || null
|
|
4984
|
+
});
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
async prepareInteractionResultPackageCompleteDefaultPathBundle(continuationRef, body, options) {
|
|
4988
|
+
const opts = options || {};
|
|
4989
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/complete-default-path-bundle", {
|
|
4990
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.complete.default.path.bundle",
|
|
4991
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4992
|
+
body: body || {},
|
|
4993
|
+
callback_url: opts.callbackUrl || null,
|
|
4994
|
+
settlement_mode: opts.settlementMode || null,
|
|
4995
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4996
|
+
protocol: opts.protocol || null,
|
|
4997
|
+
integration_id: opts.integrationId || null,
|
|
4998
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4999
|
+
integration_context: opts.integrationContext || null
|
|
5000
|
+
});
|
|
5001
|
+
}
|
|
5002
|
+
|
|
5003
|
+
async prepareInteractionResultPackageCompleteDefaultPathDefaultSummary(continuationRef, body, options) {
|
|
5004
|
+
const opts = options || {};
|
|
5005
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/complete-default-path-default-summary", {
|
|
5006
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.complete.default.path.default.summary",
|
|
5007
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
5008
|
+
body: body || {},
|
|
5009
|
+
callback_url: opts.callbackUrl || null,
|
|
5010
|
+
settlement_mode: opts.settlementMode || null,
|
|
5011
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
5012
|
+
protocol: opts.protocol || null,
|
|
5013
|
+
integration_id: opts.integrationId || null,
|
|
5014
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
5015
|
+
integration_context: opts.integrationContext || null
|
|
5016
|
+
});
|
|
5017
|
+
}
|
|
5018
|
+
|
|
4971
5019
|
async runNamedTaskRoute(path, payload) {
|
|
4972
5020
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4973
5021
|
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.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Machine commerce SDK for discovery, quoting, execution, lifecycle inspection, and adapters.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"adapters/",
|
|
40
40
|
".env.example",
|
|
41
41
|
"README.md",
|
|
42
|
+
"START_HERE.md",
|
|
43
|
+
"FINAL_CONTRACT.md",
|
|
44
|
+
"SERVICE_CONTRACT.md",
|
|
45
|
+
"TERMINOLOGY.md",
|
|
42
46
|
"LICENSE",
|
|
43
47
|
"NOTICE"
|
|
44
48
|
],
|
package/server.js
CHANGED
|
@@ -1880,6 +1880,58 @@ function buildPreparedContinuationDefaultOperatingPathRunSummary(portableHandoff
|
|
|
1880
1880
|
};
|
|
1881
1881
|
}
|
|
1882
1882
|
|
|
1883
|
+
function buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation) {
|
|
1884
|
+
const operatingPath = buildPreparedContinuationDefaultOperatingPathRunSummary(portableHandoff, continuation);
|
|
1885
|
+
return {
|
|
1886
|
+
ok: operatingPath.ok === true,
|
|
1887
|
+
default_operating_path_ref: operatingPath.default_operating_path_ref || null,
|
|
1888
|
+
complete_default_path_ref: operatingPath.default_operating_path_ref
|
|
1889
|
+
? `complete.${operatingPath.default_operating_path_ref}`
|
|
1890
|
+
: null,
|
|
1891
|
+
complete_default_path_ids: Array.isArray(operatingPath.stable_default_operating_path_ids)
|
|
1892
|
+
? operatingPath.stable_default_operating_path_ids
|
|
1893
|
+
: [],
|
|
1894
|
+
complete_default_path_carry: operatingPath.default_operating_path_carry || {},
|
|
1895
|
+
adapter_complete_by_default: operatingPath.operating_path_ready_by_default === true,
|
|
1896
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/complete-default-path"
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
function buildPreparedContinuationAdapterCompleteDefaultPathBundle(portableHandoff, continuation) {
|
|
1901
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1902
|
+
const summary = buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation);
|
|
1903
|
+
return {
|
|
1904
|
+
ok: true,
|
|
1905
|
+
complete_default_path_summary: summary,
|
|
1906
|
+
complete_default_path_template: {
|
|
1907
|
+
ok: true,
|
|
1908
|
+
complete_default_path_ref: summary.complete_default_path_ref || null,
|
|
1909
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/complete-default-path",
|
|
1910
|
+
request_template: {
|
|
1911
|
+
handoff_bundle: handoff
|
|
1912
|
+
},
|
|
1913
|
+
stable_boundary_ids: Array.isArray(summary.complete_default_path_ids) ? summary.complete_default_path_ids : []
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
function buildPreparedContinuationDefaultCompletePathRunSummary(portableHandoff, continuation) {
|
|
1919
|
+
const completePath = buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation);
|
|
1920
|
+
return {
|
|
1921
|
+
ok: completePath.ok === true,
|
|
1922
|
+
complete_default_path_ref: completePath.complete_default_path_ref || null,
|
|
1923
|
+
default_complete_default_path_ref: completePath.complete_default_path_ref
|
|
1924
|
+
? `default.${completePath.complete_default_path_ref}`
|
|
1925
|
+
: null,
|
|
1926
|
+
stable_default_complete_default_path_ids: Array.isArray(completePath.complete_default_path_ids)
|
|
1927
|
+
? completePath.complete_default_path_ids
|
|
1928
|
+
: [],
|
|
1929
|
+
default_complete_default_path_carry: completePath.complete_default_path_carry || {},
|
|
1930
|
+
complete_default_path_ready: completePath.adapter_complete_by_default === true,
|
|
1931
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/complete-default-path-run"
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1883
1935
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1884
1936
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1885
1937
|
return {
|
|
@@ -3970,6 +4022,99 @@ async function routeRequest(req, res) {
|
|
|
3970
4022
|
return;
|
|
3971
4023
|
}
|
|
3972
4024
|
|
|
4025
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/complete-default-path-summary") {
|
|
4026
|
+
const body = await readJsonBody(req);
|
|
4027
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
4028
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
4029
|
+
if (!continuation) {
|
|
4030
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4031
|
+
return;
|
|
4032
|
+
}
|
|
4033
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4034
|
+
if (!resultPackage) {
|
|
4035
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4036
|
+
return;
|
|
4037
|
+
}
|
|
4038
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4039
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4040
|
+
spine_path_ref: resultPackage.source_ref
|
|
4041
|
+
});
|
|
4042
|
+
if (!payload) {
|
|
4043
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4044
|
+
return;
|
|
4045
|
+
}
|
|
4046
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4047
|
+
if (result.status !== 200) {
|
|
4048
|
+
sendJson(res, result.status, result.payload);
|
|
4049
|
+
return;
|
|
4050
|
+
}
|
|
4051
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4052
|
+
sendJson(res, 200, buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation));
|
|
4053
|
+
return;
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/complete-default-path-bundle") {
|
|
4057
|
+
const body = await readJsonBody(req);
|
|
4058
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
4059
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
4060
|
+
if (!continuation) {
|
|
4061
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4062
|
+
return;
|
|
4063
|
+
}
|
|
4064
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4065
|
+
if (!resultPackage) {
|
|
4066
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4067
|
+
return;
|
|
4068
|
+
}
|
|
4069
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4070
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4071
|
+
spine_path_ref: resultPackage.source_ref
|
|
4072
|
+
});
|
|
4073
|
+
if (!payload) {
|
|
4074
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4075
|
+
return;
|
|
4076
|
+
}
|
|
4077
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4078
|
+
if (result.status !== 200) {
|
|
4079
|
+
sendJson(res, result.status, result.payload);
|
|
4080
|
+
return;
|
|
4081
|
+
}
|
|
4082
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4083
|
+
sendJson(res, 200, buildPreparedContinuationAdapterCompleteDefaultPathBundle(portableHandoff, continuation));
|
|
4084
|
+
return;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/complete-default-path-default-summary") {
|
|
4088
|
+
const body = await readJsonBody(req);
|
|
4089
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
4090
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
4091
|
+
if (!continuation) {
|
|
4092
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4093
|
+
return;
|
|
4094
|
+
}
|
|
4095
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4096
|
+
if (!resultPackage) {
|
|
4097
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
4100
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4101
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4102
|
+
spine_path_ref: resultPackage.source_ref
|
|
4103
|
+
});
|
|
4104
|
+
if (!payload) {
|
|
4105
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4109
|
+
if (result.status !== 200) {
|
|
4110
|
+
sendJson(res, result.status, result.payload);
|
|
4111
|
+
return;
|
|
4112
|
+
}
|
|
4113
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4114
|
+
sendJson(res, 200, buildPreparedContinuationDefaultCompletePathRunSummary(portableHandoff, continuation));
|
|
4115
|
+
return;
|
|
4116
|
+
}
|
|
4117
|
+
|
|
3973
4118
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3974
4119
|
const body = await readJsonBody(req);
|
|
3975
4120
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|