@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
@@ -1,344 +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": {
114
- "type": "object",
115
- "required": ["basis", "acceptance", "sourceEventIds"],
116
- "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" }
122
- },
123
- "additionalProperties": false
124
- },
125
- "statement": {
126
- "type": "object",
127
- "required": ["id", "text", "provenance"],
128
- "properties": {
129
- "id": { "$ref": "#/$defs/entryId" },
130
- "text": { "type": "string", "minLength": 1, "maxLength": 4000 },
131
- "provenance": { "$ref": "#/$defs/provenance" }
132
- },
133
- "additionalProperties": false
134
- },
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": {
30
+ "contracts": { "type": "object" },
31
+ "shape": {
183
32
  "type": "object",
184
- "required": ["id", "description", "status"],
33
+ "required": ["digest", "sources"],
185
34
  "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 }
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 } }
192
37
  },
193
38
  "additionalProperties": false
194
39
  },
195
- "appearance": {
40
+ "progress": {
196
41
  "type": "object",
42
+ "required": ["version", "topicId", "topicRevision", "contractRevision", "shapeDigest", "phase", "condition", "reasonCode", "axisStates", "stateTags", "candidates", "provenance"],
197
43
  "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
- }
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" }
204
48
  },
205
49
  "additionalProperties": false
206
50
  },
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
264
79
  }
265
- }
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
- "actions": {
80
+ },
81
+ "udidReferences": {
286
82
  "type": "array",
287
- "maxItems": 500,
288
83
  "items": {
289
84
  "type": "object",
290
- "required": ["request", "status", "operationId"],
85
+ "required": ["id", "role"],
291
86
  "properties": {
292
- "request": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-action-request.schema.json" },
293
- "latestReceipt": { "$ref": "https://topic-protocol.ixo.world/schemas/action-receipt.schema.json#/$defs/v2" },
294
- "status": { "enum": ["requested", "awaiting_confirmation", "running", "succeeded", "failed", "rejected", "cancelled", "needs_verification"] },
295
- "operationId": { "type": "string", "minLength": 1 }
87
+ "id": { "type": "string", "minLength": 1 },
88
+ "role": { "enum": ["evaluation", "decision", "effect", "settlement"] },
89
+ "digest": { "$ref": "#/$defs/digest" }
296
90
  },
297
91
  "additionalProperties": false
298
92
  }
299
93
  }
300
94
  },
301
- "additionalProperties": true
95
+ "additionalProperties": false
302
96
  },
303
- "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": {
304
106
  "oneOf": [
305
- { "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 },
306
- { "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 }
307
109
  ]
308
- },
309
- "automation": {
310
- "type": "object",
311
- "required": ["provider", "scheduleId", "recurrence", "status"],
312
- "properties": {
313
- "provider": { "const": "temporal" },
314
- "scheduleId": { "type": "string", "minLength": 1 },
315
- "actionId": { "type": "string", "minLength": 1 },
316
- "target": {
317
- "oneOf": [
318
- { "type": "object", "required": ["kind", "actionType"], "properties": { "kind": { "const": "action" }, "actionType": { "type": "string", "pattern": "^qi/" } }, "additionalProperties": false },
319
- { "type": "object", "required": ["kind", "bindingId"], "properties": { "kind": { "const": "flow" }, "bindingId": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
320
- ]
321
- },
322
- "recurrence": { "$ref": "#/$defs/recurrence" },
323
- "status": { "type": "string", "enum": ["pending", "active", "paused", "failed"] },
324
- "nextRunAt": { "type": "string", "format": "date-time" }
325
- },
326
- "additionalProperties": false,
327
- "anyOf": [
328
- { "properties": { "actionId": true }, "required": ["actionId"] },
329
- { "properties": { "target": true }, "required": ["target"] }
330
- ]
331
- },
332
- "bindings": {
333
- "type": "object",
334
- "properties": {
335
- "governanceProposal": { "type": "object" },
336
- "claims": { "type": "object" },
337
- "automations": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/automation" } },
338
- "flows": { "type": "array", "maxItems": 20, "items": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-flow-binding.schema.json" } },
339
- "context": { "type": "array", "maxItems": 100, "items": { "type": "object" } }
340
- },
341
- "additionalProperties": false
342
110
  }
343
111
  }
344
112
  }
@@ -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
  }
@@ -0,0 +1,79 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/topic-shape.schema.json",
4
+ "title": "Topic Shape v1",
5
+ "type": "object",
6
+ "required": ["version", "code", "axes", "transitions", "progressRules", "inferredRecordPolicy"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "code": { "type": "string", "minLength": 1 },
10
+ "axes": {
11
+ "type": "array",
12
+ "minItems": 1,
13
+ "items": {
14
+ "type": "object",
15
+ "required": ["code", "phase", "required", "initialState", "states"],
16
+ "properties": {
17
+ "code": { "type": "string", "minLength": 1 },
18
+ "phase": { "$ref": "#/$defs/phase" },
19
+ "required": { "type": "boolean" },
20
+ "initialState": { "type": "string", "minLength": 1 },
21
+ "states": {
22
+ "type": "array",
23
+ "minItems": 2,
24
+ "items": {
25
+ "type": "object",
26
+ "required": ["code"],
27
+ "properties": {
28
+ "code": { "type": "string", "minLength": 1 },
29
+ "labelKey": { "type": "string", "minLength": 1 },
30
+ "terminal": { "type": "boolean" },
31
+ "condition": { "$ref": "#/$defs/condition" }
32
+ },
33
+ "additionalProperties": false
34
+ }
35
+ }
36
+ },
37
+ "additionalProperties": false
38
+ }
39
+ },
40
+ "transitions": {
41
+ "type": "array",
42
+ "minItems": 1,
43
+ "items": {
44
+ "type": "object",
45
+ "required": ["code", "phase", "predecessor", "target", "command", "requiredAbility", "assignedTo", "gates", "confirmation", "consequence", "evidence"],
46
+ "properties": {
47
+ "code": { "type": "string", "minLength": 1 },
48
+ "phase": { "$ref": "#/$defs/phase" },
49
+ "predecessor": { "$ref": "#/$defs/axisState" },
50
+ "target": { "$ref": "#/$defs/axisState" },
51
+ "command": { "type": "string", "minLength": 1 },
52
+ "requiredAbility": { "type": "string", "minLength": 1 },
53
+ "assignedTo": {
54
+ "type": "object",
55
+ "required": ["kind", "value"],
56
+ "properties": { "kind": { "enum": ["actor", "role"] }, "value": { "type": "string", "minLength": 1 } },
57
+ "additionalProperties": false
58
+ },
59
+ "gates": { "type": "array", "items": { "type": "object", "required": ["kind"], "properties": { "kind": { "enum": ["field", "field-any", "record", "receipt", "axis", "binding", "condition"] } }, "additionalProperties": true } },
60
+ "confirmation": { "enum": ["none", "viewer", "authority"] },
61
+ "consequence": { "enum": ["none", "shared-state", "external-effect", "settlement"] },
62
+ "evidence": { "type": "object", "required": ["kind", "type"], "properties": { "kind": { "enum": ["operation", "record", "receipt"] }, "type": { "type": "string", "minLength": 1 }, "finality": { "enum": ["observed", "accepted", "verified", "final"] } }, "additionalProperties": false },
63
+ "completesTopic": { "type": "boolean" },
64
+ "handoff": { "type": "object", "required": ["kind", "binding"], "properties": { "kind": { "enum": ["flow", "resource"] }, "binding": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
65
+ "presentation": { "type": "object" }
66
+ },
67
+ "additionalProperties": false
68
+ }
69
+ },
70
+ "progressRules": { "type": "array", "items": { "type": "object", "required": ["code", "condition", "priority", "source"], "properties": { "code": { "type": "string" }, "condition": { "$ref": "#/$defs/condition" }, "priority": { "type": "integer" }, "source": { "type": "object" }, "states": { "type": "array", "items": { "type": "string" } }, "requiresTarget": { "type": "boolean" } }, "additionalProperties": false } },
71
+ "inferredRecordPolicy": { "type": "object", "required": ["autoAccept", "neverAutoAccept"], "properties": { "autoAccept": { "type": "array", "items": { "type": "string" } }, "neverAutoAccept": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }
72
+ },
73
+ "additionalProperties": false,
74
+ "$defs": {
75
+ "phase": { "enum": ["forming", "working", "verifying", "deciding", "effecting", "settling", "complete", "dormant"] },
76
+ "condition": { "enum": ["on-track", "needs-input", "needs-acceptance", "waiting", "blocked", "failed", "disputed", "degraded"] },
77
+ "axisState": { "type": "object", "required": ["axis", "state"], "properties": { "axis": { "type": "string", "minLength": 1 }, "state": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
78
+ }
79
+ }