@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,346 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/decision-to-pay-template.schema.json",
4
+ "title": "IXO Decision-to-Pay Topic Template manifest v1",
5
+ "type": "object",
6
+ "required": [
7
+ "$schema",
8
+ "version",
9
+ "id",
10
+ "templateVersion",
11
+ "label",
12
+ "description",
13
+ "maturity",
14
+ "compatibility",
15
+ "topic",
16
+ "actors",
17
+ "resources",
18
+ "protocolContracts",
19
+ "operations",
20
+ "gates",
21
+ "settlement",
22
+ "privacy",
23
+ "acceptanceCriteria"
24
+ ],
25
+ "properties": {
26
+ "$schema": { "type": "string", "minLength": 1 },
27
+ "version": { "const": 1 },
28
+ "id": { "type": "string", "pattern": "^urn:ixo:decision-to-pay:template:[a-z0-9-]+$" },
29
+ "templateVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
30
+ "label": { "type": "string", "minLength": 1, "maxLength": 120 },
31
+ "description": { "type": "string", "minLength": 1, "maxLength": 1000 },
32
+ "maturity": { "enum": ["draft", "incubating", "candidate", "stable"] },
33
+ "compatibility": { "$ref": "#/$defs/compatibility" },
34
+ "topic": { "$ref": "#/$defs/topic" },
35
+ "topology": { "$ref": "#/$defs/topology" },
36
+ "actors": {
37
+ "type": "array",
38
+ "minItems": 2,
39
+ "items": { "$ref": "#/$defs/actor" }
40
+ },
41
+ "resources": {
42
+ "type": "array",
43
+ "minItems": 1,
44
+ "items": { "$ref": "#/$defs/resource" }
45
+ },
46
+ "protocolContracts": {
47
+ "type": "array",
48
+ "minItems": 1,
49
+ "items": { "$ref": "#/$defs/protocolContract" }
50
+ },
51
+ "operations": {
52
+ "type": "array",
53
+ "minItems": 1,
54
+ "uniqueItems": true,
55
+ "items": { "$ref": "#/$defs/topicOperation" }
56
+ },
57
+ "gates": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "items": { "$ref": "#/$defs/gate" }
61
+ },
62
+ "settlement": { "$ref": "#/$defs/settlement" },
63
+ "privacy": { "$ref": "#/$defs/privacy" },
64
+ "acceptanceCriteria": {
65
+ "type": "array",
66
+ "minItems": 1,
67
+ "items": { "$ref": "#/$defs/acceptanceCriterion" }
68
+ },
69
+ "extensions": { "type": "object" }
70
+ },
71
+ "additionalProperties": false,
72
+ "$defs": {
73
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
74
+ "did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
75
+ "jsonPointer": { "type": "string", "pattern": "^/" },
76
+ "compatibility": {
77
+ "type": "object",
78
+ "required": ["protocolPackage", "protocolVersion", "sourceCommit", "implementationStatus", "requiredExtensions"],
79
+ "properties": {
80
+ "protocolPackage": { "const": "@ixo/topic-protocol" },
81
+ "protocolVersion": { "const": "0.7.0" },
82
+ "sourceCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
83
+ "implementationStatus": {
84
+ "enum": ["draft_contract_extension", "design_ready", "design_ready_extension_required", "implemented"]
85
+ },
86
+ "requiredExtensions": {
87
+ "type": "array",
88
+ "uniqueItems": true,
89
+ "items": { "type": "string", "minLength": 1 }
90
+ },
91
+ "constraints": {
92
+ "type": "array",
93
+ "items": { "type": "string", "minLength": 1 }
94
+ }
95
+ },
96
+ "additionalProperties": false
97
+ },
98
+ "persistedKind": {
99
+ "enum": ["task", "agent_task", "proposal", "evaluation", "claims", "question", "discussion", "incident"]
100
+ },
101
+ "recipe": {
102
+ "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"]
103
+ },
104
+ "kindRef": {
105
+ "oneOf": [
106
+ {
107
+ "type": "object",
108
+ "required": ["source", "kind"],
109
+ "properties": {
110
+ "source": { "const": "standard" },
111
+ "kind": { "$ref": "#/$defs/persistedKind" }
112
+ },
113
+ "additionalProperties": false
114
+ },
115
+ {
116
+ "type": "object",
117
+ "required": ["source", "customId", "label", "baseKind"],
118
+ "properties": {
119
+ "source": { "const": "custom" },
120
+ "customId": { "type": "string", "pattern": "^[a-z][a-z0-9.-]+$" },
121
+ "label": { "type": "string", "minLength": 1, "maxLength": 80 },
122
+ "baseKind": { "$ref": "#/$defs/persistedKind" }
123
+ },
124
+ "additionalProperties": false
125
+ }
126
+ ]
127
+ },
128
+ "kindProfile": {
129
+ "type": "object",
130
+ "required": ["id", "version", "schema", "digest"],
131
+ "properties": {
132
+ "id": { "type": "string", "format": "uri" },
133
+ "version": { "type": "string", "minLength": 1 },
134
+ "schema": { "type": "string", "format": "uri" },
135
+ "digest": { "$ref": "#/$defs/digest" }
136
+ },
137
+ "additionalProperties": false
138
+ },
139
+ "topic": {
140
+ "type": "object",
141
+ "required": ["primaryRole", "kindRef", "recipe", "workingMode", "temporalMode", "acceptance", "lifecyclePolicy"],
142
+ "properties": {
143
+ "primaryRole": { "enum": ["work_case", "delivery_case", "payable_milestone", "payment_claim"] },
144
+ "kindRef": { "$ref": "#/$defs/kindRef" },
145
+ "kindProfile": { "$ref": "#/$defs/kindProfile" },
146
+ "recipe": { "$ref": "#/$defs/recipe" },
147
+ "workingMode": { "enum": ["solo", "team", "client"] },
148
+ "temporalMode": { "enum": ["finite", "ongoing"] },
149
+ "acceptance": {
150
+ "type": "object",
151
+ "required": ["requiredTopicContractPaths", "allowHonestDraft"],
152
+ "properties": {
153
+ "requiredTopicContractPaths": {
154
+ "type": "array",
155
+ "uniqueItems": true,
156
+ "items": { "$ref": "#/$defs/jsonPointer" }
157
+ },
158
+ "allowHonestDraft": { "const": true }
159
+ },
160
+ "additionalProperties": false
161
+ },
162
+ "lifecyclePolicy": {
163
+ "type": "object",
164
+ "required": ["separateTopicContractOutcomeAxes", "resolveRule"],
165
+ "properties": {
166
+ "separateTopicContractOutcomeAxes": { "const": true },
167
+ "resolveRule": { "type": "string", "minLength": 1 },
168
+ "waitingRule": { "type": "string", "minLength": 1 }
169
+ },
170
+ "additionalProperties": false
171
+ }
172
+ },
173
+ "additionalProperties": false
174
+ },
175
+ "topology": {
176
+ "type": "object",
177
+ "required": ["requiresParentTopic", "onePayableUnitPerTopic"],
178
+ "properties": {
179
+ "requiresParentTopic": { "type": "boolean" },
180
+ "parentBaseKind": { "$ref": "#/$defs/persistedKind" },
181
+ "relation": { "enum": ["branches_from", "merged_into", "redirects_to", "references", "produced"] },
182
+ "onePayableUnitPerTopic": { "type": "boolean" }
183
+ },
184
+ "additionalProperties": false
185
+ },
186
+ "actor": {
187
+ "type": "object",
188
+ "required": ["role", "label", "required", "identity", "capabilities"],
189
+ "properties": {
190
+ "role": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
191
+ "label": { "type": "string", "minLength": 1 },
192
+ "required": { "type": "boolean" },
193
+ "identity": { "const": "did" },
194
+ "capabilities": {
195
+ "type": "array",
196
+ "uniqueItems": true,
197
+ "items": { "type": "string", "minLength": 1 }
198
+ },
199
+ "constraints": {
200
+ "type": "array",
201
+ "items": { "type": "string", "minLength": 1 }
202
+ }
203
+ },
204
+ "additionalProperties": false
205
+ },
206
+ "resource": {
207
+ "type": "object",
208
+ "required": ["role", "type", "required", "binding", "authority", "availability", "confidentiality"],
209
+ "properties": {
210
+ "role": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
211
+ "type": { "type": "string", "minLength": 1 },
212
+ "required": { "type": "boolean" },
213
+ "binding": { "enum": ["kind_resource", "typed_context", "vfs_attachment", "protocol_record", "external_reference"] },
214
+ "authority": { "enum": ["topic_contract", "bound_resource", "external_system", "protocol_record"] },
215
+ "availability": { "enum": ["topic_protocol_0.7", "contract_pack", "proposed_extension", "external"] },
216
+ "schemaRef": { "type": "string", "format": "uri-reference" },
217
+ "confidentiality": { "enum": ["room_encrypted", "vfs_ucan", "external_authority", "public"] },
218
+ "notes": { "type": "string", "minLength": 1 }
219
+ },
220
+ "additionalProperties": false
221
+ },
222
+ "protocolContract": {
223
+ "type": "object",
224
+ "required": ["name", "source", "schemaRef"],
225
+ "properties": {
226
+ "name": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
227
+ "source": { "enum": ["topic_protocol", "contract_pack", "proposed_extension"] },
228
+ "schemaRef": { "type": "string", "format": "uri-reference" },
229
+ "required": { "type": "boolean" }
230
+ },
231
+ "additionalProperties": false
232
+ },
233
+ "topicOperation": {
234
+ "enum": [
235
+ "propose-contract",
236
+ "update-contract",
237
+ "accept-contract",
238
+ "supersede-contract",
239
+ "bind-external-work",
240
+ "sync-external-work",
241
+ "unlink-external-work",
242
+ "submit-delivery",
243
+ "record-delivery-decision",
244
+ "record-evaluation",
245
+ "record-approval",
246
+ "record-claim",
247
+ "record-settlement",
248
+ "record-decision",
249
+ "change-status",
250
+ "redirect",
251
+ "branch",
252
+ "merge",
253
+ "resolve-conflict"
254
+ ]
255
+ },
256
+ "gateCondition": {
257
+ "type": "object",
258
+ "required": ["contract", "path", "operator"],
259
+ "properties": {
260
+ "contract": {
261
+ "enum": [
262
+ "topic-contract-state",
263
+ "payment-terms",
264
+ "payable-obligation",
265
+ "external-work-binding",
266
+ "delivery-packet",
267
+ "delivery-decision",
268
+ "evaluation-assertion",
269
+ "approval-decision",
270
+ "claim-record",
271
+ "settlement-receipt",
272
+ "operator-verification"
273
+ ]
274
+ },
275
+ "path": { "$ref": "#/$defs/jsonPointer" },
276
+ "operator": { "enum": ["exists", "equals", "min_count", "all_equal", "digest_matches"] },
277
+ "value": {}
278
+ },
279
+ "additionalProperties": false
280
+ },
281
+ "gate": {
282
+ "type": "object",
283
+ "required": ["id", "stage", "description", "all", "onFailure"],
284
+ "properties": {
285
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
286
+ "stage": { "enum": ["terms", "delivery", "evaluation", "approval", "claim", "settlement", "exception"] },
287
+ "description": { "type": "string", "minLength": 1 },
288
+ "all": {
289
+ "type": "array",
290
+ "minItems": 1,
291
+ "items": { "$ref": "#/$defs/gateCondition" }
292
+ },
293
+ "onFailure": { "enum": ["block", "human_review", "return_for_changes", "open_incident"] }
294
+ },
295
+ "additionalProperties": false
296
+ },
297
+ "settlement": {
298
+ "type": "object",
299
+ "required": ["movesFunds", "requiresExternalAdapter", "failClosed", "requiredAxes", "exactMatchFields", "terminalState"],
300
+ "properties": {
301
+ "movesFunds": { "const": false },
302
+ "requiresExternalAdapter": { "const": true },
303
+ "failClosed": { "const": true },
304
+ "requiredAxes": {
305
+ "type": "array",
306
+ "minItems": 4,
307
+ "uniqueItems": true,
308
+ "items": { "enum": ["delivery", "evaluation", "approval", "claim", "settlement"] }
309
+ },
310
+ "exactMatchFields": {
311
+ "type": "array",
312
+ "minItems": 3,
313
+ "uniqueItems": true,
314
+ "items": { "enum": ["topicId", "deliveryPacketId", "deliveryPacketDigest", "evaluationIds", "approvalId", "claimId", "amount", "asset", "recipient"] }
315
+ },
316
+ "terminalState": { "const": "confirmed" }
317
+ },
318
+ "additionalProperties": false
319
+ },
320
+ "privacy": {
321
+ "type": "object",
322
+ "required": ["topicIsConfidentialityBoundary", "topicCapabilityGrantsVfsAccess", "sensitiveResourceStorage", "minimumRoomVisibleFields"],
323
+ "properties": {
324
+ "topicIsConfidentialityBoundary": { "const": false },
325
+ "topicCapabilityGrantsVfsAccess": { "const": false },
326
+ "sensitiveResourceStorage": { "const": "encrypted_room_or_ucan_vfs" },
327
+ "minimumRoomVisibleFields": {
328
+ "type": "array",
329
+ "uniqueItems": true,
330
+ "items": { "type": "string", "minLength": 1 }
331
+ }
332
+ },
333
+ "additionalProperties": false
334
+ },
335
+ "acceptanceCriterion": {
336
+ "type": "object",
337
+ "required": ["id", "statement"],
338
+ "properties": {
339
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
340
+ "statement": { "type": "string", "minLength": 1 },
341
+ "verification": { "type": "string", "minLength": 1 }
342
+ },
343
+ "additionalProperties": false
344
+ }
345
+ }
346
+ }