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