@ixo/topic-protocol 0.7.0 → 1.0.0-rc.1

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.
Files changed (77) hide show
  1. package/README.md +9 -2
  2. package/dist/schemas/action-receipt.schema.json +105 -11
  3. package/dist/schemas/decision-to-pay-template-v2.schema.json +301 -0
  4. package/dist/schemas/decision-to-pay-template.schema.json +346 -0
  5. package/dist/schemas/payable-obligation-v2.schema.json +319 -0
  6. package/dist/schemas/payable-obligation.schema.json +312 -0
  7. package/dist/schemas/payment-terms-v2.schema.json +238 -0
  8. package/dist/schemas/payment-terms.schema.json +287 -0
  9. package/dist/schemas/topic-action-request.schema.json +30 -0
  10. package/dist/schemas/topic-contract-body.schema.json +66 -0
  11. package/dist/schemas/topic-contract-state.schema.json +70 -276
  12. package/dist/schemas/topic-flow-binding.schema.json +28 -0
  13. package/dist/schemas/topic-kind-profile.schema.json +32 -2
  14. package/dist/schemas/topic-operation.schema.json +2 -2
  15. package/dist/schemas/topic-recipe.schema.json +19 -0
  16. package/dist/schemas/topic-root.schema.json +17 -1
  17. package/dist/schemas/topic-shape.schema.json +79 -0
  18. package/dist/src/action-runtime/types.d.ts +101 -0
  19. package/dist/src/action-runtime/types.js +12 -0
  20. package/dist/src/action-runtime/types.js.map +1 -0
  21. package/dist/src/contracts/schemas.d.ts +4706 -966
  22. package/dist/src/contracts/schemas.js +22 -0
  23. package/dist/src/contracts/schemas.js.map +1 -1
  24. package/dist/src/contracts/topic-contract.d.ts +38 -6
  25. package/dist/src/contracts/topic-contract.js +3 -1
  26. package/dist/src/contracts/topic-contract.js.map +1 -1
  27. package/dist/src/contracts/topic-kind-profile.d.ts +29 -0
  28. package/dist/src/contracts/topic-kind-profile.js +31 -0
  29. package/dist/src/contracts/topic-kind-profile.js.map +1 -1
  30. package/dist/src/errors.d.ts +1 -1
  31. package/dist/src/errors.js.map +1 -1
  32. package/dist/src/index.d.ts +12 -3
  33. package/dist/src/index.js +11 -2
  34. package/dist/src/index.js.map +1 -1
  35. package/dist/src/projector/payload.d.ts +18 -0
  36. package/dist/src/projector/payload.js +57 -1
  37. package/dist/src/projector/payload.js.map +1 -1
  38. package/dist/src/projector/state.js +144 -0
  39. package/dist/src/projector/state.js.map +1 -1
  40. package/dist/src/projector/types.d.ts +22 -4
  41. package/dist/src/projector/types.js.map +1 -1
  42. package/dist/src/shapes/canonical.d.ts +2 -0
  43. package/dist/src/shapes/canonical.js +20 -0
  44. package/dist/src/shapes/canonical.js.map +1 -0
  45. package/dist/src/shapes/claims.d.ts +12 -0
  46. package/dist/src/shapes/claims.js +20 -0
  47. package/dist/src/shapes/claims.js.map +1 -0
  48. package/dist/src/shapes/now.d.ts +2 -0
  49. package/dist/src/shapes/now.js +42 -0
  50. package/dist/src/shapes/now.js.map +1 -0
  51. package/dist/src/shapes/progress.d.ts +3 -0
  52. package/dist/src/shapes/progress.js +176 -0
  53. package/dist/src/shapes/progress.js.map +1 -0
  54. package/dist/src/shapes/recipes.d.ts +5 -0
  55. package/dist/src/shapes/recipes.js +337 -0
  56. package/dist/src/shapes/recipes.js.map +1 -0
  57. package/dist/src/shapes/resolver.d.ts +14 -0
  58. package/dist/src/shapes/resolver.js +111 -0
  59. package/dist/src/shapes/resolver.js.map +1 -0
  60. package/dist/src/shapes/state.d.ts +53 -0
  61. package/dist/src/shapes/state.js +2 -0
  62. package/dist/src/shapes/state.js.map +1 -0
  63. package/dist/src/shapes/types.d.ts +241 -0
  64. package/dist/src/shapes/types.js +42 -0
  65. package/dist/src/shapes/types.js.map +1 -0
  66. package/package.json +6 -2
  67. package/recipes/README.md +12 -0
  68. package/recipes/agent-delivery.json +607 -0
  69. package/recipes/registry.json +41 -0
  70. package/recipes/research-brief.json +460 -0
  71. package/recipes/verified-work-payment.json +663 -0
  72. package/templates/decision-to-pay/README.md +67 -0
  73. package/templates/decision-to-pay/milestone-payment-release.template.json +195 -0
  74. package/templates/decision-to-pay/outcome-payment-claim.template.json +198 -0
  75. package/templates/decision-to-pay/payment-on-delivery.template.json +198 -0
  76. package/templates/decision-to-pay/verified-work-payment.template.json +283 -0
  77. package/templates/decision-to-pay/verified-work-payment.v0.2.template.json +319 -0
@@ -0,0 +1,663 @@
1
+ {
2
+ "version": 1,
3
+ "code": "verified-work-payment",
4
+ "id": "https://topic-protocol.ixo.world/recipes/verified-work-payment",
5
+ "recipeVersion": "1.0.0-rc.1",
6
+ "label": "Verified work payment",
7
+ "description": "Bind one entity and claim collection, verify work, decide, execute through Flow, and observe settlement finality.",
8
+ "baseRecipe": "claims",
9
+ "creates": "draft",
10
+ "shape": {
11
+ "version": 1,
12
+ "code": "recipe/verified-work-payment",
13
+ "axes": [
14
+ {
15
+ "code": "contract",
16
+ "phase": "forming",
17
+ "required": true,
18
+ "initialState": "draft",
19
+ "states": [
20
+ {
21
+ "code": "draft"
22
+ },
23
+ {
24
+ "code": "accepted",
25
+ "terminal": true
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "code": "work",
31
+ "phase": "working",
32
+ "required": true,
33
+ "initialState": "pending",
34
+ "states": [
35
+ {
36
+ "code": "pending"
37
+ },
38
+ {
39
+ "code": "in-progress"
40
+ },
41
+ {
42
+ "code": "submitted",
43
+ "terminal": true
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "code": "verification",
49
+ "phase": "verifying",
50
+ "required": true,
51
+ "initialState": "pending",
52
+ "states": [
53
+ {
54
+ "code": "pending"
55
+ },
56
+ {
57
+ "code": "verified",
58
+ "terminal": true
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "code": "decision",
64
+ "phase": "deciding",
65
+ "required": true,
66
+ "initialState": "pending",
67
+ "states": [
68
+ {
69
+ "code": "pending"
70
+ },
71
+ {
72
+ "code": "approved",
73
+ "terminal": true
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "code": "effect",
79
+ "phase": "effecting",
80
+ "required": true,
81
+ "initialState": "pending",
82
+ "states": [
83
+ {
84
+ "code": "pending"
85
+ },
86
+ {
87
+ "code": "requested"
88
+ },
89
+ {
90
+ "code": "confirmed",
91
+ "terminal": true
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "code": "settlement",
97
+ "phase": "settling",
98
+ "required": true,
99
+ "initialState": "pending",
100
+ "states": [
101
+ {
102
+ "code": "pending"
103
+ },
104
+ {
105
+ "code": "final",
106
+ "terminal": true
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "code": "topic",
112
+ "phase": "complete",
113
+ "required": true,
114
+ "initialState": "open",
115
+ "states": [
116
+ {
117
+ "code": "open"
118
+ },
119
+ {
120
+ "code": "complete",
121
+ "terminal": true
122
+ }
123
+ ]
124
+ }
125
+ ],
126
+ "transitions": [
127
+ {
128
+ "code": "edit-terms",
129
+ "phase": "forming",
130
+ "predecessor": {
131
+ "axis": "contract",
132
+ "state": "draft"
133
+ },
134
+ "target": {
135
+ "axis": "contract",
136
+ "state": "draft"
137
+ },
138
+ "command": "topic.edit-terms",
139
+ "requiredAbility": "topic/write",
140
+ "assignedTo": {
141
+ "kind": "role",
142
+ "value": "contract-acceptor"
143
+ },
144
+ "gates": [],
145
+ "confirmation": "none",
146
+ "consequence": "shared-state",
147
+ "evidence": {
148
+ "kind": "operation",
149
+ "type": "update-contract"
150
+ },
151
+ "presentation": {
152
+ "reasonCode": "terms-need-input"
153
+ }
154
+ },
155
+ {
156
+ "code": "accept-terms",
157
+ "phase": "forming",
158
+ "predecessor": {
159
+ "axis": "contract",
160
+ "state": "draft"
161
+ },
162
+ "target": {
163
+ "axis": "contract",
164
+ "state": "accepted"
165
+ },
166
+ "command": "topic.accept-terms",
167
+ "requiredAbility": "topic/accept-contract",
168
+ "assignedTo": {
169
+ "kind": "role",
170
+ "value": "contract-acceptor"
171
+ },
172
+ "gates": [],
173
+ "confirmation": "viewer",
174
+ "consequence": "shared-state",
175
+ "evidence": {
176
+ "kind": "operation",
177
+ "type": "accept-contract"
178
+ },
179
+ "presentation": {
180
+ "reasonCode": "terms-await-acceptance"
181
+ }
182
+ },
183
+ {
184
+ "code": "start-work",
185
+ "phase": "working",
186
+ "predecessor": {
187
+ "axis": "work",
188
+ "state": "pending"
189
+ },
190
+ "target": {
191
+ "axis": "work",
192
+ "state": "in-progress"
193
+ },
194
+ "command": "topic.start-work",
195
+ "requiredAbility": "topic/write",
196
+ "assignedTo": {
197
+ "kind": "role",
198
+ "value": "worker"
199
+ },
200
+ "gates": [
201
+ {
202
+ "kind": "axis",
203
+ "axis": "contract",
204
+ "states": [
205
+ "accepted"
206
+ ]
207
+ }
208
+ ],
209
+ "confirmation": "none",
210
+ "consequence": "shared-state",
211
+ "evidence": {
212
+ "kind": "operation",
213
+ "type": "change-progress"
214
+ },
215
+ "presentation": {
216
+ "reasonCode": "start-work"
217
+ }
218
+ },
219
+ {
220
+ "code": "answer-question",
221
+ "phase": "working",
222
+ "predecessor": {
223
+ "axis": "work",
224
+ "state": "in-progress"
225
+ },
226
+ "target": {
227
+ "axis": "work",
228
+ "state": "in-progress"
229
+ },
230
+ "command": "topic.answer-question",
231
+ "requiredAbility": "topic/write",
232
+ "assignedTo": {
233
+ "kind": "role",
234
+ "value": "worker"
235
+ },
236
+ "gates": [
237
+ {
238
+ "kind": "field",
239
+ "path": "/questions/open",
240
+ "predicate": "present"
241
+ }
242
+ ],
243
+ "confirmation": "none",
244
+ "consequence": "shared-state",
245
+ "evidence": {
246
+ "kind": "operation",
247
+ "type": "answer-question"
248
+ },
249
+ "presentation": {
250
+ "reasonCode": "question-awaits-answer"
251
+ }
252
+ },
253
+ {
254
+ "code": "change-due-date",
255
+ "phase": "working",
256
+ "predecessor": {
257
+ "axis": "work",
258
+ "state": "in-progress"
259
+ },
260
+ "target": {
261
+ "axis": "work",
262
+ "state": "in-progress"
263
+ },
264
+ "command": "topic.change-due-date",
265
+ "requiredAbility": "topic/write",
266
+ "assignedTo": {
267
+ "kind": "role",
268
+ "value": "worker"
269
+ },
270
+ "gates": [
271
+ {
272
+ "kind": "field",
273
+ "path": "/outcome/target/value",
274
+ "predicate": "present"
275
+ }
276
+ ],
277
+ "confirmation": "none",
278
+ "consequence": "shared-state",
279
+ "evidence": {
280
+ "kind": "operation",
281
+ "type": "change-due-date"
282
+ },
283
+ "presentation": {
284
+ "reasonCode": "due-date-review"
285
+ }
286
+ },
287
+ {
288
+ "code": "unblock-topic",
289
+ "phase": "working",
290
+ "predecessor": {
291
+ "axis": "topic",
292
+ "state": "open"
293
+ },
294
+ "target": {
295
+ "axis": "topic",
296
+ "state": "open"
297
+ },
298
+ "command": "topic.unblock",
299
+ "requiredAbility": "topic/unblock",
300
+ "assignedTo": {
301
+ "kind": "role",
302
+ "value": "block-resolver"
303
+ },
304
+ "gates": [
305
+ {
306
+ "kind": "condition",
307
+ "states": [
308
+ "blocked"
309
+ ]
310
+ }
311
+ ],
312
+ "confirmation": "none",
313
+ "consequence": "shared-state",
314
+ "evidence": {
315
+ "kind": "operation",
316
+ "type": "unblock-topic"
317
+ },
318
+ "presentation": {
319
+ "reasonCode": "topic-blocked"
320
+ }
321
+ },
322
+ {
323
+ "code": "submit-work",
324
+ "phase": "working",
325
+ "predecessor": {
326
+ "axis": "work",
327
+ "state": "in-progress"
328
+ },
329
+ "target": {
330
+ "axis": "work",
331
+ "state": "submitted"
332
+ },
333
+ "command": "topic.record-outcome",
334
+ "requiredAbility": "topic/record-outcome",
335
+ "assignedTo": {
336
+ "kind": "role",
337
+ "value": "worker"
338
+ },
339
+ "gates": [],
340
+ "confirmation": "none",
341
+ "consequence": "shared-state",
342
+ "evidence": {
343
+ "kind": "record",
344
+ "type": "ixo.topic.work-submission",
345
+ "finality": "accepted"
346
+ },
347
+ "presentation": {
348
+ "reasonCode": "submit-work"
349
+ }
350
+ },
351
+ {
352
+ "code": "complete-topic",
353
+ "phase": "complete",
354
+ "predecessor": {
355
+ "axis": "topic",
356
+ "state": "open"
357
+ },
358
+ "target": {
359
+ "axis": "topic",
360
+ "state": "complete"
361
+ },
362
+ "command": "topic.complete",
363
+ "requiredAbility": "topic/confirm-completion",
364
+ "assignedTo": {
365
+ "kind": "role",
366
+ "value": "completion-authority"
367
+ },
368
+ "gates": [
369
+ {
370
+ "kind": "axis",
371
+ "axis": "work",
372
+ "states": [
373
+ "submitted"
374
+ ]
375
+ }
376
+ ],
377
+ "confirmation": "authority",
378
+ "consequence": "shared-state",
379
+ "evidence": {
380
+ "kind": "operation",
381
+ "type": "complete-topic"
382
+ },
383
+ "completesTopic": true,
384
+ "presentation": {
385
+ "reasonCode": "complete-topic"
386
+ }
387
+ },
388
+ {
389
+ "code": "record-verification",
390
+ "phase": "verifying",
391
+ "predecessor": {
392
+ "axis": "verification",
393
+ "state": "pending"
394
+ },
395
+ "target": {
396
+ "axis": "verification",
397
+ "state": "verified"
398
+ },
399
+ "command": "topic.record-verification",
400
+ "requiredAbility": "claim/evaluate",
401
+ "assignedTo": {
402
+ "kind": "role",
403
+ "value": "evaluator"
404
+ },
405
+ "gates": [
406
+ {
407
+ "kind": "axis",
408
+ "axis": "work",
409
+ "states": [
410
+ "submitted"
411
+ ]
412
+ }
413
+ ],
414
+ "confirmation": "none",
415
+ "consequence": "shared-state",
416
+ "evidence": {
417
+ "kind": "record",
418
+ "type": "ixo.evaluation",
419
+ "finality": "accepted"
420
+ },
421
+ "handoff": {
422
+ "kind": "flow",
423
+ "binding": "evaluation"
424
+ },
425
+ "presentation": {
426
+ "reasonCode": "verification-required"
427
+ }
428
+ },
429
+ {
430
+ "code": "record-decision",
431
+ "phase": "deciding",
432
+ "predecessor": {
433
+ "axis": "decision",
434
+ "state": "pending"
435
+ },
436
+ "target": {
437
+ "axis": "decision",
438
+ "state": "approved"
439
+ },
440
+ "command": "topic.record-decision",
441
+ "requiredAbility": "claim/decide",
442
+ "assignedTo": {
443
+ "kind": "role",
444
+ "value": "decision-authority"
445
+ },
446
+ "gates": [
447
+ {
448
+ "kind": "axis",
449
+ "axis": "verification",
450
+ "states": [
451
+ "verified"
452
+ ]
453
+ }
454
+ ],
455
+ "confirmation": "authority",
456
+ "consequence": "shared-state",
457
+ "evidence": {
458
+ "kind": "record",
459
+ "type": "ixo.decision",
460
+ "finality": "accepted"
461
+ },
462
+ "presentation": {
463
+ "reasonCode": "decision-required"
464
+ }
465
+ },
466
+ {
467
+ "code": "request-action",
468
+ "phase": "effecting",
469
+ "predecessor": {
470
+ "axis": "effect",
471
+ "state": "pending"
472
+ },
473
+ "target": {
474
+ "axis": "effect",
475
+ "state": "requested"
476
+ },
477
+ "command": "topic.request-action",
478
+ "requiredAbility": "topic/request-action",
479
+ "assignedTo": {
480
+ "kind": "role",
481
+ "value": "action-requester"
482
+ },
483
+ "gates": [
484
+ {
485
+ "kind": "axis",
486
+ "axis": "decision",
487
+ "states": [
488
+ "approved"
489
+ ]
490
+ },
491
+ {
492
+ "kind": "binding",
493
+ "type": "flow"
494
+ }
495
+ ],
496
+ "confirmation": "viewer",
497
+ "consequence": "external-effect",
498
+ "evidence": {
499
+ "kind": "operation",
500
+ "type": "request-action"
501
+ },
502
+ "handoff": {
503
+ "kind": "flow",
504
+ "binding": "action"
505
+ },
506
+ "presentation": {
507
+ "reasonCode": "action-request-required"
508
+ }
509
+ },
510
+ {
511
+ "code": "confirm-action",
512
+ "phase": "effecting",
513
+ "predecessor": {
514
+ "axis": "effect",
515
+ "state": "requested"
516
+ },
517
+ "target": {
518
+ "axis": "effect",
519
+ "state": "confirmed"
520
+ },
521
+ "command": "topic.confirm-action",
522
+ "requiredAbility": "topic/record-action",
523
+ "assignedTo": {
524
+ "kind": "role",
525
+ "value": "action-confirmer"
526
+ },
527
+ "gates": [],
528
+ "confirmation": "authority",
529
+ "consequence": "external-effect",
530
+ "evidence": {
531
+ "kind": "receipt",
532
+ "type": "ixo.action-receipt",
533
+ "finality": "final"
534
+ },
535
+ "handoff": {
536
+ "kind": "flow",
537
+ "binding": "action"
538
+ },
539
+ "presentation": {
540
+ "reasonCode": "action-confirmation-required"
541
+ }
542
+ },
543
+ {
544
+ "code": "record-settlement",
545
+ "phase": "settling",
546
+ "predecessor": {
547
+ "axis": "settlement",
548
+ "state": "pending"
549
+ },
550
+ "target": {
551
+ "axis": "settlement",
552
+ "state": "final"
553
+ },
554
+ "command": "topic.record-settlement",
555
+ "requiredAbility": "settlement/record",
556
+ "assignedTo": {
557
+ "kind": "role",
558
+ "value": "settlement-controller"
559
+ },
560
+ "gates": [
561
+ {
562
+ "kind": "axis",
563
+ "axis": "effect",
564
+ "states": [
565
+ "confirmed"
566
+ ]
567
+ }
568
+ ],
569
+ "confirmation": "authority",
570
+ "consequence": "settlement",
571
+ "evidence": {
572
+ "kind": "receipt",
573
+ "type": "ixo.settlement-receipt",
574
+ "finality": "final"
575
+ },
576
+ "handoff": {
577
+ "kind": "flow",
578
+ "binding": "settlement"
579
+ },
580
+ "presentation": {
581
+ "reasonCode": "settlement-required"
582
+ }
583
+ }
584
+ ],
585
+ "progressRules": [
586
+ {
587
+ "code": "disputed",
588
+ "condition": "disputed",
589
+ "priority": 700,
590
+ "source": {
591
+ "kind": "record",
592
+ "value": "ixo.topic.dispute"
593
+ }
594
+ },
595
+ {
596
+ "code": "failed",
597
+ "condition": "failed",
598
+ "priority": 650,
599
+ "source": {
600
+ "kind": "receipt",
601
+ "value": "failed"
602
+ }
603
+ },
604
+ {
605
+ "code": "blocked",
606
+ "condition": "blocked",
607
+ "priority": 600,
608
+ "source": {
609
+ "kind": "topic",
610
+ "value": "blocked"
611
+ },
612
+ "requiresTarget": true
613
+ },
614
+ {
615
+ "code": "waiting",
616
+ "condition": "waiting",
617
+ "priority": 500,
618
+ "source": {
619
+ "kind": "topic",
620
+ "value": "waiting"
621
+ },
622
+ "requiresTarget": true
623
+ },
624
+ {
625
+ "code": "needs-input",
626
+ "condition": "needs-input",
627
+ "priority": 400,
628
+ "source": {
629
+ "kind": "record",
630
+ "value": "ixo.topic.question"
631
+ }
632
+ },
633
+ {
634
+ "code": "needs-acceptance",
635
+ "condition": "needs-acceptance",
636
+ "priority": 350,
637
+ "source": {
638
+ "kind": "axis",
639
+ "value": "contract"
640
+ },
641
+ "states": [
642
+ "draft"
643
+ ]
644
+ }
645
+ ],
646
+ "inferredRecordPolicy": {
647
+ "autoAccept": [
648
+ "ixo.topic.fact",
649
+ "ixo.topic.summary",
650
+ "ixo.topic.classification"
651
+ ],
652
+ "neverAutoAccept": [
653
+ "ixo.topic.contract",
654
+ "ixo.topic.outcome",
655
+ "ixo.topic.authority",
656
+ "ixo.topic.action",
657
+ "ixo.claim",
658
+ "ixo.evaluation",
659
+ "ixo.settlement"
660
+ ]
661
+ }
662
+ }
663
+ }