@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
@@ -1,344 +1,37 @@
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 v4",
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": 4 },
9
+ "profile": { "const": "qi.topic-contract-state/v4" },
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" },
12
+ "anchor": { "type": "object", "required": ["mode", "roomId", "rootEventId", "manifestSource"], "properties": { "mode": { "enum": ["native", "adopted"] }, "roomId": { "type": "string", "pattern": "^!" }, "rootEventId": { "type": "string", "pattern": "^\\$" }, "manifestSource": { "enum": ["root-event", "state-event"] } }, "additionalProperties": false },
13
+ "manifest": { "type": "object", "required": ["version", "id", "title", "kind", "status", "createdBy", "createdAt", "baseRecipe", "shapeDigest"], "properties": { "version": { "const": 4 }, "id": { "$ref": "#/$defs/topicId" }, "title": { "type": "string", "minLength": 1, "maxLength": 280 }, "kind": { "type": "string", "minLength": 1 }, "status": { "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] }, "createdBy": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string", "format": "date-time" }, "baseRecipe": { "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] }, "topicRecipeRef": { "type": "object" }, "shapeDigest": { "$ref": "#/$defs/digest" } }, "additionalProperties": true },
14
+ "contracts": { "type": "object", "properties": { "proposed": { "allOf": [{ "$ref": "#/$defs/contractRef" }, { "type": "object", "properties": { "confirmations": { "type": "array", "items": { "type": "object" } }, "assents": { "type": "array", "items": { "type": "object" } } } }] }, "effective": { "allOf": [{ "$ref": "#/$defs/contractRef" }, { "type": "object", "required": ["effectiveAt", "confirmations"], "properties": { "effectiveAt": { "type": "string", "format": "date-time" }, "confirmations": { "type": "array", "items": { "type": "object" } }, "assents": { "type": "array", "items": { "type": "object" } } } }] }, "superseded": { "type": "array", "items": { "type": "object" } } }, "additionalProperties": false },
15
+ "shape": { "type": "object", "required": ["digest", "sources"], "properties": { "digest": { "$ref": "#/$defs/digest" }, "sources": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/shapeSource" } } }, "additionalProperties": false },
16
+ "progress": { "type": "object", "required": ["version", "topicId", "topicRevision", "contractRevision", "shapeDigest", "phase", "condition", "reasonCode", "axisStates", "stateTags", "candidates", "obligations", "provenance"], "properties": { "version": { "const": 2 }, "topicId": { "$ref": "#/$defs/topicId" }, "topicRevision": { "type": "string" }, "contractRevision": { "type": "string" }, "shapeDigest": { "$ref": "#/$defs/digest" }, "phase": { "$ref": "#/$defs/phase" }, "condition": { "$ref": "#/$defs/condition" }, "reasonCode": { "type": "string" }, "axisStates": { "type": "object", "additionalProperties": { "type": "string" } }, "stateTags": { "type": "array", "items": { "type": "object" } }, "candidates": { "type": "array", "items": { "type": "object" } }, "obligations": { "type": "array", "items": { "$ref": "#/$defs/obligation" } }, "primaryObligationId": { "type": "string" }, "evaluatedAt": { "type": "object" }, "provenance": { "type": "array", "items": { "type": "string" } }, "block": { "type": "object" }, "dispute": { "type": "object" } }, "additionalProperties": false },
17
+ "projection": { "type": "object", "required": ["revision", "contractRevision", "title", "status", "setupStatus", "kindRef", "attachmentCount", "operationCount"], "properties": { "revision": { "type": "string", "minLength": 1 }, "contractRevision": { "type": "string", "minLength": 1 }, "title": { "type": "string", "minLength": 1 }, "status": { "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] }, "setupStatus": { "enum": ["draft", "awaiting-confirmation", "scheduled", "confirmed", "review-due", "expired", "disputed"] }, "kindRef": { "type": "object" }, "attachmentCount": { "type": "integer", "minimum": 0 }, "operationCount": { "type": "integer", "minimum": 0 }, "claimBinding": { "type": "object" }, "claimResolution": { "type": "object" } }, "additionalProperties": true },
16
18
  "policy": { "type": "object" },
17
- "bindings": { "$ref": "#/$defs/bindings" },
18
- "provenance": { "$ref": "#/$defs/provenance" },
19
+ "bindings": { "type": "object", "properties": { "flows": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-flow-binding.schema.json" } }, "context": { "type": "array", "items": { "type": "object" } }, "udidReferences": { "type": "array", "items": { "type": "object" } } }, "additionalProperties": false },
20
+ "provenance": { "type": "object" },
19
21
  "extensions": { "type": "object" }
20
22
  },
21
23
  "additionalProperties": false,
22
24
  "$defs": {
23
25
  "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": {
62
- "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
- },
71
- "additionalProperties": false
72
- },
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
- "manifest": {
100
- "type": "object",
101
- "required": ["version", "id", "title", "kind", "status", "createdBy", "createdAt"],
102
- "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" }
110
- },
111
- "additionalProperties": true
112
- },
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": {
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": {
208
- "type": "object",
209
- "required": ["version", "revision", "status", "kindRef", "authoredBy", "authoredAt", "workingMode", "recipe"],
210
- "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" } }
241
- },
242
- "additionalProperties": true
243
- },
244
- "contractRef": {
245
- "type": "object",
246
- "required": ["revision", "bodyHash", "bodyRef"],
247
- "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" }
264
- }
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": {
286
- "type": "array",
287
- "maxItems": 500,
288
- "items": {
289
- "type": "object",
290
- "required": ["request", "status", "operationId"],
291
- "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 }
296
- },
297
- "additionalProperties": false
298
- }
299
- }
300
- },
301
- "additionalProperties": true
302
- },
303
- "recurrence": {
304
- "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 }
307
- ]
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
- }
26
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
27
+ "phase": { "enum": ["forming", "working", "verifying", "deciding", "effecting", "settling", "complete", "dormant"] },
28
+ "condition": { "enum": ["on-track", "needs-input", "needs-confirmation", "review-due", "expired", "waiting", "blocked", "failed", "disputed", "degraded"] },
29
+ "shapeSource": { "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 },
30
+ "contractRef": { "type": "object", "required": ["revision", "bodyHash", "bodyRef"], "properties": { "revision": { "type": "string" }, "bodyHash": { "$ref": "#/$defs/digest" }, "bodyRef": { "type": "object" }, "body": { "type": "object" } }, "additionalProperties": true },
31
+ "obligation": { "type": "object", "required": ["id", "code", "kind", "phase", "status", "priority", "blocking", "assignedActors", "consequence", "presentation", "provenance"], "properties": { "id": { "type": "string" }, "code": { "type": "string" }, "kind": { "enum": ["safety", "input", "confirmation", "assent", "transition", "wait", "review", "expiry", "dispute"] }, "phase": { "$ref": "#/$defs/phase" }, "status": { "enum": ["open", "ready", "waiting", "blocked", "unavailable"] }, "priority": { "type": "integer" }, "blocking": { "type": "boolean" }, "responsibility": { "type": "object" }, "assignedActors": { "type": "array", "items": { "type": "string" } }, "requiredAbility": { "type": "string" }, "consequence": { "enum": ["none", "shared-state", "external-effect", "settlement"] }, "focusPath": { "type": "string" }, "transitionCode": { "type": "string" }, "command": { "type": "string" }, "handoff": { "type": "object" }, "presentation": { "type": "object" }, "provenance": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false },
32
+ "temporalTarget": { "oneOf": [
33
+ { "type": "object", "required": ["precision", "value", "timezone"], "properties": { "precision": { "const": "date" }, "value": { "type": "string", "format": "date" }, "timezone": { "type": "string" } }, "additionalProperties": false },
34
+ { "type": "object", "required": ["precision", "value", "timezone"], "properties": { "precision": { "const": "datetime" }, "value": { "type": "string", "format": "date-time" }, "timezone": { "type": "string" } }, "additionalProperties": false }
35
+ ] }
343
36
  }
344
37
  }
@@ -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-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"] },
11
+ "type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "record-outcome", "propose-contract", "update-contract", "accept-contract", "confirm-setup", "withdraw-setup-confirmation", "record-assent", "withdraw-assent", "raise-dispute", "resolve-dispute", "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-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"] }
23
+ "type": { "enum": ["record-outcome", "propose-contract", "update-contract", "accept-contract", "confirm-setup", "withdraw-setup-confirmation", "record-assent", "withdraw-assent", "raise-dispute", "resolve-dispute", "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, 4] },
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,14 @@
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"] }
68
+ },
69
+ {
70
+ "if": { "properties": { "version": { "const": 4 } }, "required": ["version"] },
71
+ "then": { "properties": { "kind": true, "baseRecipe": true, "shapeDigest": true }, "required": ["kind", "baseRecipe", "shapeDigest"] }
52
72
  }
53
73
  ]
54
74
  }
@@ -0,0 +1,80 @@
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", "presentation"],
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"] }, "requirement": { "$ref": "#/$defs/requirement" } }, "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", "required": ["reasonCode", "actionLabelKey", "bodyKey", "purposeKey", "unlocksKey", "priority"], "properties": { "reasonCode": { "type": "string", "minLength": 1 }, "actionLabelKey": { "type": "string", "minLength": 1 }, "bodyKey": { "type": "string", "minLength": 1 }, "purposeKey": { "type": "string", "minLength": 1 }, "unlocksKey": { "type": "string", "minLength": 1 }, "priority": { "type": "integer" }, "focusPath": { "type": "string" } }, "additionalProperties": false }
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-confirmation", "review-due", "expired", "waiting", "blocked", "failed", "disputed", "degraded"] },
77
+ "requirement": { "type": "object", "required": ["code", "labelKey", "promptKey", "purposeKey", "priority"], "properties": { "code": { "type": "string", "minLength": 1 }, "labelKey": { "type": "string", "minLength": 1 }, "promptKey": { "type": "string", "minLength": 1 }, "purposeKey": { "type": "string", "minLength": 1 }, "priority": { "type": "integer" }, "focusPath": { "type": "string" }, "assignedTo": { "type": "object", "required": ["kind", "value"], "properties": { "kind": { "enum": ["actor", "role"] }, "value": { "type": "string", "minLength": 1 } }, "additionalProperties": false } }, "additionalProperties": false },
78
+ "axisState": { "type": "object", "required": ["axis", "state"], "properties": { "axis": { "type": "string", "minLength": 1 }, "state": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
79
+ }
80
+ }