@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
@@ -1,318 +1,112 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://topic-protocol.ixo.world/schemas/topic-contract-state.schema.json",
4
- "title": "Qi Topic Contract state profile v2",
4
+ "title": "Qi Topic Contract state profile v3",
5
5
  "type": "object",
6
- "required": ["version", "profile", "schema", "topicId", "anchor", "manifest", "contracts", "projection", "policy", "bindings", "provenance"],
6
+ "required": ["version", "profile", "schema", "topicId", "anchor", "manifest", "contracts", "shape", "progress", "projection", "policy", "bindings", "provenance"],
7
7
  "properties": {
8
- "version": { "const": 2 },
9
- "profile": { "const": "qi.topic-contract-state/v2" },
8
+ "version": { "const": 3 },
9
+ "profile": { "const": "qi.topic-contract-state/v3" },
10
10
  "schema": { "const": "https://topic-protocol.ixo.world/schemas/topic-contract-state.schema.json" },
11
11
  "topicId": { "$ref": "#/$defs/topicId" },
12
- "anchor": { "$ref": "#/$defs/anchor" },
13
- "manifest": { "$ref": "#/$defs/manifest" },
14
- "contracts": { "$ref": "#/$defs/contractHeads" },
15
- "projection": { "$ref": "#/$defs/projection" },
16
- "policy": { "type": "object" },
17
- "bindings": { "$ref": "#/$defs/bindings" },
18
- "provenance": { "$ref": "#/$defs/provenance" },
19
- "extensions": { "type": "object" }
20
- },
21
- "additionalProperties": false,
22
- "$defs": {
23
- "topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
24
- "entryId": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
25
- "eventId": { "type": "string", "pattern": "^\\$" },
26
- "roomId": { "type": "string", "pattern": "^!" },
27
- "hash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
28
- "persistedKind": { "type": "string", "enum": ["task", "agent_task", "proposal", "evaluation", "claims", "question", "discussion", "incident"] },
29
- "kindRef": {
30
- "oneOf": [
31
- {
32
- "type": "object",
33
- "required": ["source", "kind"],
34
- "properties": { "source": { "const": "standard" }, "kind": { "$ref": "#/$defs/persistedKind" } },
35
- "additionalProperties": false
36
- },
37
- {
38
- "type": "object",
39
- "required": ["source", "customId", "label", "baseKind"],
40
- "properties": {
41
- "source": { "const": "custom" },
42
- "customId": { "type": "string", "minLength": 1, "maxLength": 128 },
43
- "label": { "type": "string", "minLength": 1, "maxLength": 80 },
44
- "baseKind": { "$ref": "#/$defs/persistedKind" }
45
- },
46
- "additionalProperties": false
47
- }
48
- ]
49
- },
50
- "kindProfileRef": {
51
- "type": "object",
52
- "required": ["id", "version", "schema", "digest"],
53
- "properties": {
54
- "id": { "type": "string", "format": "uri" },
55
- "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
56
- "schema": { "type": "string", "format": "uri" },
57
- "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
58
- },
59
- "additionalProperties": false
60
- },
61
- "kindResource": {
12
+ "anchor": {
62
13
  "type": "object",
63
- "required": ["profile", "type", "id", "version", "value"],
64
- "properties": {
65
- "profile": { "$ref": "#/$defs/kindProfileRef" },
66
- "type": { "type": "string", "minLength": 1, "maxLength": 128 },
67
- "id": { "type": "string", "minLength": 1, "maxLength": 512 },
68
- "version": { "type": "integer", "minimum": 1 },
69
- "value": { "type": "object" }
70
- },
14
+ "required": ["mode", "roomId", "rootEventId", "manifestSource"],
15
+ "properties": { "mode": { "enum": ["native", "adopted"] }, "roomId": { "type": "string", "pattern": "^!" }, "rootEventId": { "type": "string", "pattern": "^\\$" }, "manifestSource": { "enum": ["root-event", "state-event"] } },
71
16
  "additionalProperties": false
72
17
  },
73
- "anchor": {
74
- "oneOf": [
75
- {
76
- "type": "object",
77
- "required": ["mode", "roomId", "rootEventId", "manifestSource"],
78
- "properties": {
79
- "mode": { "const": "native" },
80
- "roomId": { "$ref": "#/$defs/roomId" },
81
- "rootEventId": { "$ref": "#/$defs/eventId" },
82
- "manifestSource": { "const": "root-event" }
83
- },
84
- "additionalProperties": false
85
- },
86
- {
87
- "type": "object",
88
- "required": ["mode", "roomId", "rootEventId", "manifestSource"],
89
- "properties": {
90
- "mode": { "const": "adopted" },
91
- "roomId": { "$ref": "#/$defs/roomId" },
92
- "rootEventId": { "$ref": "#/$defs/eventId" },
93
- "manifestSource": { "const": "state-event" }
94
- },
95
- "additionalProperties": false
96
- }
97
- ]
98
- },
99
18
  "manifest": {
100
19
  "type": "object",
101
- "required": ["version", "id", "title", "kind", "status", "createdBy", "createdAt"],
20
+ "required": ["version", "id", "title", "kind", "status", "createdBy", "createdAt", "baseRecipe", "shapeDigest"],
102
21
  "properties": {
103
- "version": { "const": 2 },
104
- "id": { "$ref": "#/$defs/topicId" },
105
- "title": { "type": "string", "minLength": 1, "maxLength": 280 },
106
- "kind": { "$ref": "#/$defs/persistedKind" },
107
- "status": { "type": "string", "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] },
108
- "createdBy": { "type": "string", "minLength": 1 },
109
- "createdAt": { "type": "string", "format": "date-time" }
22
+ "version": { "const": 3 }, "id": { "$ref": "#/$defs/topicId" }, "title": { "type": "string", "minLength": 1, "maxLength": 280 },
23
+ "kind": { "type": "string", "minLength": 1 }, "status": { "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] },
24
+ "createdBy": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string", "format": "date-time" },
25
+ "baseRecipe": { "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
26
+ "topicRecipeRef": { "type": "object" }, "shapeDigest": { "$ref": "#/$defs/digest" }
110
27
  },
111
28
  "additionalProperties": true
112
29
  },
113
- "provenance": {
30
+ "contracts": { "type": "object" },
31
+ "shape": {
114
32
  "type": "object",
115
- "required": ["basis", "acceptance", "sourceEventIds"],
33
+ "required": ["digest", "sources"],
116
34
  "properties": {
117
- "basis": { "type": "string", "enum": ["explicit", "contextual", "inferred", "suggested", "retrieved"] },
118
- "acceptance": { "type": "string", "enum": ["proposed", "accepted", "rejected", "superseded"] },
119
- "sourceEventIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/eventId" } },
120
- "createdBy": { "type": "string", "minLength": 1 },
121
- "createdAt": { "type": "string", "format": "date-time" }
35
+ "digest": { "$ref": "#/$defs/digest" },
36
+ "sources": { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["kind", "id", "version", "digest"], "properties": { "kind": { "enum": ["base-recipe", "topic-recipe", "kind", "topic"] }, "id": { "type": "string", "format": "uri" }, "version": { "type": "string" }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false } }
122
37
  },
123
38
  "additionalProperties": false
124
39
  },
125
- "statement": {
40
+ "progress": {
126
41
  "type": "object",
127
- "required": ["id", "text", "provenance"],
42
+ "required": ["version", "topicId", "topicRevision", "contractRevision", "shapeDigest", "phase", "condition", "reasonCode", "axisStates", "stateTags", "candidates", "provenance"],
128
43
  "properties": {
129
- "id": { "$ref": "#/$defs/entryId" },
130
- "text": { "type": "string", "minLength": 1, "maxLength": 4000 },
131
- "provenance": { "$ref": "#/$defs/provenance" }
44
+ "version": { "const": 1 }, "topicId": { "$ref": "#/$defs/topicId" }, "topicRevision": { "type": "string" }, "contractRevision": { "type": "string" },
45
+ "shapeDigest": { "$ref": "#/$defs/digest" }, "phase": { "$ref": "#/$defs/phase" }, "condition": { "$ref": "#/$defs/condition" }, "reasonCode": { "type": "string" },
46
+ "axisStates": { "type": "object", "additionalProperties": { "type": "string" } }, "stateTags": { "type": "array", "items": { "type": "object" } },
47
+ "candidates": { "type": "array", "items": { "type": "object" } }, "provenance": { "type": "array", "items": { "type": "string" } }, "block": { "type": "object" }
132
48
  },
133
49
  "additionalProperties": false
134
50
  },
135
- "temporalTarget": {
136
- "oneOf": [
137
- {
138
- "type": "object",
139
- "required": ["precision", "value", "timezone"],
140
- "properties": {
141
- "precision": { "const": "date" },
142
- "value": { "type": "string", "format": "date" },
143
- "timezone": { "type": "string", "minLength": 1, "maxLength": 128 }
144
- },
145
- "additionalProperties": false
146
- },
147
- {
148
- "type": "object",
149
- "required": ["precision", "value", "timezone"],
150
- "properties": {
151
- "precision": { "const": "datetime" },
152
- "value": { "type": "string", "format": "date-time" },
153
- "timezone": { "type": "string", "minLength": 1, "maxLength": 128 }
154
- },
155
- "additionalProperties": false
156
- }
157
- ]
158
- },
159
- "criterion": {
160
- "type": "object",
161
- "required": ["id", "description", "status"],
162
- "properties": {
163
- "id": { "$ref": "#/$defs/entryId" },
164
- "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
165
- "status": { "type": "string", "enum": ["pending", "met", "not_met", "waived"] },
166
- "verification": { "type": "object" }
167
- },
168
- "additionalProperties": false
169
- },
170
- "outcome": {
171
- "type": "object",
172
- "properties": {
173
- "statement": { "$ref": "#/$defs/statement" },
174
- "status": { "type": "string", "enum": ["proposed", "accepted", "achieved", "abandoned"] },
175
- "target": { "$ref": "#/$defs/temporalTarget" },
176
- "successCriteria": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/criterion" } },
177
- "outcomeRecordId": { "type": "string", "minLength": 1 },
178
- "abandonedReason": { "type": "string", "minLength": 1, "maxLength": 2000 }
179
- },
180
- "additionalProperties": false
181
- },
182
- "risk": {
183
- "type": "object",
184
- "required": ["id", "description", "status"],
185
- "properties": {
186
- "id": { "$ref": "#/$defs/entryId" },
187
- "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
188
- "impact": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
189
- "status": { "type": "string", "enum": ["open", "mitigated", "accepted", "closed"] },
190
- "owner": { "type": "string", "minLength": 1 },
191
- "mitigation": { "type": "string", "minLength": 1, "maxLength": 2000 }
192
- },
193
- "additionalProperties": false
194
- },
195
- "appearance": {
196
- "type": "object",
197
- "properties": {
198
- "glyph": {
199
- "oneOf": [
200
- { "type": "object", "required": ["type", "value"], "properties": { "type": { "const": "emoji" }, "value": { "type": "string", "minLength": 1, "maxLength": 16 } }, "additionalProperties": false },
201
- { "type": "object", "required": ["type", "name"], "properties": { "type": { "const": "icon" }, "name": { "type": "string", "enum": ["task", "agent", "proposal", "evaluation", "claims", "question", "discussion", "incident"] } }, "additionalProperties": false }
202
- ]
203
- }
204
- },
205
- "additionalProperties": false
206
- },
207
- "contractBody": {
51
+ "projection": {
208
52
  "type": "object",
209
- "required": ["version", "revision", "status", "kindRef", "authoredBy", "authoredAt", "workingMode", "recipe"],
53
+ "required": ["revision", "contractRevision", "title", "status", "kindRef", "attachmentCount", "operationCount"],
210
54
  "properties": {
211
- "version": { "const": 2 },
212
- "revision": { "type": "string", "minLength": 1 },
213
- "status": { "type": "string", "enum": ["draft", "accepted", "superseded"] },
214
- "kindRef": { "$ref": "#/$defs/kindRef" },
215
- "kindProfile": { "$ref": "#/$defs/kindProfileRef" },
216
- "kindResource": { "$ref": "#/$defs/kindResource" },
217
- "authoredBy": { "type": "string", "minLength": 1 },
218
- "authoredAt": { "type": "string", "format": "date-time" },
219
- "workingMode": { "type": "string", "enum": ["solo", "team", "client"] },
220
- "recipe": { "type": "string", "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
221
- "locale": { "type": "string", "minLength": 2, "maxLength": 32 },
222
- "timezone": { "type": "string", "minLength": 1, "maxLength": 128 },
223
- "temporalMode": { "type": "string", "enum": ["finite", "ongoing"] },
224
- "tags": { "type": "array", "uniqueItems": true, "maxItems": 20, "items": { "type": "string", "minLength": 1, "maxLength": 80 } },
225
- "appearance": { "$ref": "#/$defs/appearance" },
226
- "intent": { "$ref": "#/$defs/statement" },
227
- "outcome": { "$ref": "#/$defs/outcome" },
228
- "completion": { "type": "object" },
229
- "ownerId": { "type": "string", "minLength": 1 },
230
- "scope": { "type": "object" },
231
- "constraints": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/statement" } },
232
- "assumptions": { "type": "array", "maxItems": 50, "items": { "type": "object" } },
233
- "questions": { "type": "array", "maxItems": 50, "items": { "type": "object" } },
234
- "risks": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/risk" } },
235
- "participants": { "type": "array", "maxItems": 100, "items": { "type": "object" } },
236
- "roles": { "type": "array", "maxItems": 50, "items": { "type": "object" } },
237
- "agents": { "type": "array", "maxItems": 20, "items": { "type": "object" } },
238
- "decision": { "type": "object" },
239
- "plan": { "type": "object" },
240
- "attachments": { "type": "array", "maxItems": 100, "items": { "type": "object" } }
55
+ "revision": { "type": "string", "minLength": 1 }, "contractRevision": { "type": "string", "minLength": 1 }, "title": { "type": "string", "minLength": 1 },
56
+ "status": { "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] }, "kindRef": { "type": "object" },
57
+ "attachmentCount": { "type": "integer", "minimum": 0 }, "operationCount": { "type": "integer", "minimum": 0 },
58
+ "claimBinding": { "type": "object", "required": ["entityDid", "collectionId"], "properties": { "entityDid": { "type": "string" }, "collectionId": { "type": "string" } }, "additionalProperties": false },
59
+ "claimResolution": { "type": "object", "required": ["entityDid", "collectionId", "protocolDid", "rubric"], "properties": { "entityDid": { "type": "string" }, "collectionId": { "type": "string" }, "protocolDid": { "type": "string" }, "rubric": { "type": "object" } }, "additionalProperties": false }
241
60
  },
242
61
  "additionalProperties": true
243
62
  },
244
- "contractRef": {
63
+ "policy": { "type": "object" },
64
+ "bindings": {
245
65
  "type": "object",
246
- "required": ["revision", "bodyHash", "bodyRef"],
247
66
  "properties": {
248
- "revision": { "type": "string", "minLength": 1 },
249
- "bodyHash": { "$ref": "#/$defs/hash" },
250
- "bodyRef": { "type": "object" },
251
- "body": { "$ref": "#/$defs/contractBody" }
252
- },
253
- "additionalProperties": true
254
- },
255
- "effectiveContractRef": {
256
- "allOf": [
257
- { "$ref": "#/$defs/contractRef" },
258
- {
259
- "type": "object",
260
- "required": ["acceptedBy", "acceptedAt"],
261
- "properties": {
262
- "acceptedBy": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
263
- "acceptedAt": { "type": "string", "format": "date-time" }
67
+ "flows": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-flow-binding.schema.json" } },
68
+ "context": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "object",
72
+ "required": ["type", "id"],
73
+ "properties": {
74
+ "type": { "enum": ["ixo.resource", "ixo.flow", "matrix.conversation", "ixo.entity", "ixo.service"] },
75
+ "id": { "type": "string", "minLength": 1 },
76
+ "label": { "type": "string" }
77
+ },
78
+ "additionalProperties": false
79
+ }
80
+ },
81
+ "udidReferences": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "required": ["id", "role"],
86
+ "properties": {
87
+ "id": { "type": "string", "minLength": 1 },
88
+ "role": { "enum": ["evaluation", "decision", "effect", "settlement"] },
89
+ "digest": { "$ref": "#/$defs/digest" }
90
+ },
91
+ "additionalProperties": false
264
92
  }
265
93
  }
266
- ]
267
- },
268
- "contractHeads": {
269
- "type": "object",
270
- "properties": { "proposed": { "$ref": "#/$defs/contractRef" }, "effective": { "$ref": "#/$defs/effectiveContractRef" } },
271
- "additionalProperties": false
272
- },
273
- "projection": {
274
- "type": "object",
275
- "required": ["revision", "title", "status", "kindRef", "attachmentCount", "operationCount"],
276
- "properties": {
277
- "revision": { "type": "string", "minLength": 1 },
278
- "title": { "type": "string", "minLength": 1, "maxLength": 280 },
279
- "status": { "type": "string", "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] },
280
- "kindRef": { "$ref": "#/$defs/kindRef" },
281
- "kindProfile": { "$ref": "#/$defs/kindProfileRef" },
282
- "appearance": { "$ref": "#/$defs/appearance" },
283
- "attachmentCount": { "type": "integer", "minimum": 0 },
284
- "operationCount": { "type": "integer", "minimum": 0 }
285
94
  },
286
- "additionalProperties": true
95
+ "additionalProperties": false
287
96
  },
288
- "recurrence": {
97
+ "provenance": { "type": "object" }, "extensions": { "type": "object" }
98
+ },
99
+ "additionalProperties": false,
100
+ "$defs": {
101
+ "topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
102
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
103
+ "phase": { "enum": ["forming", "working", "verifying", "deciding", "effecting", "settling", "complete", "dormant"] },
104
+ "condition": { "enum": ["on-track", "needs-input", "needs-acceptance", "waiting", "blocked", "failed", "disputed", "degraded"] },
105
+ "temporalTarget": {
289
106
  "oneOf": [
290
- { "type": "object", "required": ["frequency", "time", "timezone"], "properties": { "frequency": { "const": "daily" }, "time": { "type": "string", "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$" }, "timezone": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
291
- { "type": "object", "required": ["frequency", "days", "time", "timezone"], "properties": { "frequency": { "const": "weekly" }, "days": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "enum": ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] } }, "time": { "type": "string", "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$" }, "timezone": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
107
+ { "type": "object", "required": ["precision", "value", "timezone"], "properties": { "precision": { "const": "date" }, "value": { "type": "string", "format": "date" }, "timezone": { "type": "string" } }, "additionalProperties": false },
108
+ { "type": "object", "required": ["precision", "value", "timezone"], "properties": { "precision": { "const": "datetime" }, "value": { "type": "string", "format": "date-time" }, "timezone": { "type": "string" } }, "additionalProperties": false }
292
109
  ]
293
- },
294
- "automation": {
295
- "type": "object",
296
- "required": ["provider", "scheduleId", "actionId", "recurrence", "status"],
297
- "properties": {
298
- "provider": { "const": "temporal" },
299
- "scheduleId": { "type": "string", "minLength": 1 },
300
- "actionId": { "type": "string", "minLength": 1 },
301
- "recurrence": { "$ref": "#/$defs/recurrence" },
302
- "status": { "type": "string", "enum": ["pending", "active", "paused", "failed"] },
303
- "nextRunAt": { "type": "string", "format": "date-time" }
304
- },
305
- "additionalProperties": false
306
- },
307
- "bindings": {
308
- "type": "object",
309
- "properties": {
310
- "governanceProposal": { "type": "object" },
311
- "claims": { "type": "object" },
312
- "automations": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/automation" } },
313
- "context": { "type": "array", "maxItems": 100, "items": { "type": "object" } }
314
- },
315
- "additionalProperties": false
316
110
  }
317
111
  }
318
112
  }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/topic-flow-binding.schema.json",
4
+ "title": "Topic Flow Binding v1",
5
+ "type": "object",
6
+ "required": ["version", "bindingId", "topicId", "flowUri", "flowRevision", "flowDigest", "role", "actionManifestDigest", "controllerDid", "startPolicy", "triggerPolicy", "receiptPolicy", "status", "capability", "capabilityReferences", "createdBy", "createdAt"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "bindingId": { "type": "string", "minLength": 1 },
10
+ "topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
11
+ "flowUri": { "type": "string", "pattern": "^ixo:flow:" },
12
+ "flowRevision": { "type": "string", "minLength": 1 },
13
+ "flowDigest": { "$ref": "#/$defs/digest" },
14
+ "role": { "enum": ["primary", "supporting"] },
15
+ "actionManifestDigest": { "$ref": "#/$defs/digest" },
16
+ "controllerDid": { "type": "string", "pattern": "^did:" },
17
+ "startPolicy": { "enum": ["manual", "on-topic-active", "scheduled", "event"] },
18
+ "triggerPolicy": { "type": "object" },
19
+ "receiptPolicy": { "enum": ["all", "terminal"] },
20
+ "status": { "enum": ["pending", "active", "paused", "closed", "failed"] },
21
+ "capability": { "type": "string", "minLength": 1 },
22
+ "capabilityReferences": { "type": "array", "minItems": 2, "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
23
+ "createdBy": { "type": "string", "pattern": "^did:" },
24
+ "createdAt": { "type": "string", "format": "date-time" }
25
+ },
26
+ "additionalProperties": false,
27
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
28
+ }
@@ -5,7 +5,7 @@
5
5
  "type": "object",
6
6
  "required": ["version", "id", "profileVersion", "label", "kind", "resource", "acceptance", "projection", "presentation"],
7
7
  "properties": {
8
- "version": { "const": 1 },
8
+ "version": { "enum": [1, 2] },
9
9
  "id": { "type": "string", "format": "uri" },
10
10
  "profileVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
11
11
  "label": { "type": "string", "minLength": 1, "maxLength": 80 },
@@ -76,7 +76,37 @@
76
76
  "uniqueItems": true,
77
77
  "maxItems": 20,
78
78
  "items": { "type": "string", "minLength": 1, "maxLength": 128 }
79
+ },
80
+ "actionManifest": {
81
+ "type": "object",
82
+ "required": ["version", "digest"],
83
+ "properties": {
84
+ "version": { "type": "string", "minLength": 1, "maxLength": 40 },
85
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
86
+ },
87
+ "additionalProperties": false
88
+ },
89
+ "actions": {
90
+ "type": "array",
91
+ "uniqueItems": true,
92
+ "maxItems": 50,
93
+ "items": {
94
+ "type": "object",
95
+ "required": ["type", "role"],
96
+ "properties": {
97
+ "type": { "type": "string", "pattern": "^qi/[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
98
+ "role": { "enum": ["primary", "supporting"] },
99
+ "label": { "type": "string", "minLength": 1, "maxLength": 80 }
100
+ },
101
+ "additionalProperties": false
102
+ }
79
103
  }
80
104
  },
81
- "additionalProperties": false
105
+ "additionalProperties": false,
106
+ "allOf": [
107
+ {
108
+ "if": { "properties": { "version": { "const": 2 } }, "required": ["version"] },
109
+ "then": { "properties": { "actionManifest": true, "actions": true }, "required": ["actionManifest", "actions"] }
110
+ }
111
+ ]
82
112
  }
@@ -8,7 +8,7 @@
8
8
  "version": { "enum": [1, 2] },
9
9
  "operationId": { "type": "string", "minLength": 1 },
10
10
  "topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
11
- "type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement", "redirect", "branch", "merge", "resolve-conflict"] },
11
+ "type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-flow", "update-flow-binding", "unbind-flow", "request-action", "cancel-action", "record-action-receipt", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement", "redirect", "branch", "merge", "resolve-conflict"] },
12
12
  "previousRevision": { "type": "string", "minLength": 1 },
13
13
  "actor": { "type": "string", "minLength": 1 },
14
14
  "createdAt": { "type": "string", "format": "date-time" },
@@ -20,7 +20,7 @@
20
20
  {
21
21
  "if": {
22
22
  "properties": {
23
- "type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement"] }
23
+ "type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-flow", "update-flow-binding", "unbind-flow", "request-action", "cancel-action", "record-action-receipt", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement"] }
24
24
  },
25
25
  "required": ["type"]
26
26
  },
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/topic-recipe.schema.json",
4
+ "title": "Topic Recipe v1",
5
+ "type": "object",
6
+ "required": ["version", "code", "id", "recipeVersion", "label", "description", "baseRecipe", "creates", "shape"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "code": { "enum": ["research-brief", "agent-delivery", "verified-work-payment"] },
10
+ "id": { "type": "string", "format": "uri" },
11
+ "recipeVersion": { "type": "string", "minLength": 1 },
12
+ "label": { "type": "string", "minLength": 1 },
13
+ "description": { "type": "string", "minLength": 1 },
14
+ "baseRecipe": { "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
15
+ "creates": { "const": "draft" },
16
+ "shape": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-shape.schema.json" }
17
+ },
18
+ "additionalProperties": false
19
+ }
@@ -5,7 +5,7 @@
5
5
  "type": "object",
6
6
  "required": ["version", "id", "title", "status", "createdBy", "createdAt"],
7
7
  "properties": {
8
- "version": { "enum": [1, 2] },
8
+ "version": { "enum": [1, 2, 3] },
9
9
  "id": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
10
10
  "title": { "type": "string", "minLength": 1, "maxLength": 280 },
11
11
  "kind": { "type": "string", "enum": ["discussion", "question", "decision", "proposal", "task", "incident", "flow", "agent_task", "evaluation", "claims"] },
@@ -25,6 +25,18 @@
25
25
  "additionalProperties": false
26
26
  }
27
27
  },
28
+ "baseRecipe": { "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
29
+ "topicRecipeRef": {
30
+ "type": "object",
31
+ "required": ["id", "version", "digest"],
32
+ "properties": {
33
+ "id": { "type": "string", "format": "uri" },
34
+ "version": { "type": "string", "minLength": 1 },
35
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
36
+ },
37
+ "additionalProperties": false
38
+ },
39
+ "shapeDigest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
28
40
  "overview": {
29
41
  "type": "object",
30
42
  "required": ["summary"],
@@ -49,6 +61,10 @@
49
61
  {
50
62
  "if": { "properties": { "version": { "const": 2 } }, "required": ["version"] },
51
63
  "then": { "properties": { "kind": true }, "required": ["kind"] }
64
+ },
65
+ {
66
+ "if": { "properties": { "version": { "const": 3 } }, "required": ["version"] },
67
+ "then": { "properties": { "kind": true, "baseRecipe": true, "shapeDigest": true }, "required": ["kind", "baseRecipe", "shapeDigest"] }
52
68
  }
53
69
  ]
54
70
  }