@ixo/topic-protocol 0.8.0 → 1.0.0-rc.2

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