@ixo/topic-protocol 0.4.0 → 0.5.0

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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ identity of a discussion.
9
9
 
10
10
  ## Status
11
11
 
12
- **Version:** 0.4.0
12
+ **Version:** 0.5.0
13
13
 
14
14
  **Maturity:** Draft implementation candidate
15
15
  **Execution source of truth:** [Linear Topic Protocol project](https://linear.app/ixo-world/project/topic-protocol-4ea58bc7910d)
@@ -22,12 +22,12 @@ and external action execution require their dedicated conformance evidence.
22
22
  ## Read this first
23
23
 
24
24
  - [Architecture decisions](docs/adr/README.md)
25
+ - [Why Topics matter](docs/topics-feature-guide.md) — a non-technical feature guide
25
26
  - [Protocol chapters](docs/protocol/README.md)
26
27
  - [Machine-readable contracts](contracts/README.md)
27
28
  - [Reference implementation](docs/reference-implementation.md)
28
29
  - [ixo-portal integration plan](docs/implementation/ixo-portal.md)
29
30
  - [Conformance and release gates](docs/conformance.md)
30
- - [Source recovery and provenance](docs/source-recovery.md)
31
31
  - [Linear issue map](docs/tracking/linear-source-of-truth.md)
32
32
 
33
33
  ## npm runtime
@@ -39,7 +39,7 @@ key-value adapter at its integration boundary.
39
39
 
40
40
  The package includes:
41
41
 
42
- - strict Draft 2020-12 validation for all 17 contracts;
42
+ - strict Draft 2020-12 validation for all 18 contracts;
43
43
  - deterministic Topic-index reconciliation, structured search, and personal ranking;
44
44
  - deterministic Topic projection from a root and authorised operations;
45
45
  - singular accepted Overview projection with deterministic conflict handling;
@@ -0,0 +1,292 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/topic-contract-state.schema.json",
4
+ "title": "Qi Topic Contract state profile v2",
5
+ "type": "object",
6
+ "required": ["version", "profile", "schema", "topicId", "anchor", "manifest", "contracts", "projection", "policy", "bindings", "provenance"],
7
+ "properties": {
8
+ "version": { "const": 2 },
9
+ "profile": { "const": "qi.topic-contract-state/v2" },
10
+ "schema": { "const": "https://topic-protocol.ixo.world/schemas/topic-contract-state.schema.json" },
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
+ "anchor": {
51
+ "oneOf": [
52
+ {
53
+ "type": "object",
54
+ "required": ["mode", "roomId", "rootEventId", "manifestSource"],
55
+ "properties": {
56
+ "mode": { "const": "native" },
57
+ "roomId": { "$ref": "#/$defs/roomId" },
58
+ "rootEventId": { "$ref": "#/$defs/eventId" },
59
+ "manifestSource": { "const": "root-event" }
60
+ },
61
+ "additionalProperties": false
62
+ },
63
+ {
64
+ "type": "object",
65
+ "required": ["mode", "roomId", "rootEventId", "manifestSource"],
66
+ "properties": {
67
+ "mode": { "const": "adopted" },
68
+ "roomId": { "$ref": "#/$defs/roomId" },
69
+ "rootEventId": { "$ref": "#/$defs/eventId" },
70
+ "manifestSource": { "const": "state-event" }
71
+ },
72
+ "additionalProperties": false
73
+ }
74
+ ]
75
+ },
76
+ "manifest": {
77
+ "type": "object",
78
+ "required": ["version", "id", "title", "kind", "status", "createdBy", "createdAt"],
79
+ "properties": {
80
+ "version": { "const": 2 },
81
+ "id": { "$ref": "#/$defs/topicId" },
82
+ "title": { "type": "string", "minLength": 1, "maxLength": 280 },
83
+ "kind": { "$ref": "#/$defs/persistedKind" },
84
+ "status": { "type": "string", "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] },
85
+ "createdBy": { "type": "string", "minLength": 1 },
86
+ "createdAt": { "type": "string", "format": "date-time" }
87
+ },
88
+ "additionalProperties": true
89
+ },
90
+ "provenance": {
91
+ "type": "object",
92
+ "required": ["basis", "acceptance", "sourceEventIds"],
93
+ "properties": {
94
+ "basis": { "type": "string", "enum": ["explicit", "contextual", "inferred", "suggested", "retrieved"] },
95
+ "acceptance": { "type": "string", "enum": ["proposed", "accepted", "rejected", "superseded"] },
96
+ "sourceEventIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/eventId" } },
97
+ "createdBy": { "type": "string", "minLength": 1 },
98
+ "createdAt": { "type": "string", "format": "date-time" }
99
+ },
100
+ "additionalProperties": false
101
+ },
102
+ "statement": {
103
+ "type": "object",
104
+ "required": ["id", "text", "provenance"],
105
+ "properties": {
106
+ "id": { "$ref": "#/$defs/entryId" },
107
+ "text": { "type": "string", "minLength": 1, "maxLength": 4000 },
108
+ "provenance": { "$ref": "#/$defs/provenance" }
109
+ },
110
+ "additionalProperties": false
111
+ },
112
+ "temporalTarget": {
113
+ "oneOf": [
114
+ {
115
+ "type": "object",
116
+ "required": ["precision", "value", "timezone"],
117
+ "properties": {
118
+ "precision": { "const": "date" },
119
+ "value": { "type": "string", "format": "date" },
120
+ "timezone": { "type": "string", "minLength": 1, "maxLength": 128 }
121
+ },
122
+ "additionalProperties": false
123
+ },
124
+ {
125
+ "type": "object",
126
+ "required": ["precision", "value", "timezone"],
127
+ "properties": {
128
+ "precision": { "const": "datetime" },
129
+ "value": { "type": "string", "format": "date-time" },
130
+ "timezone": { "type": "string", "minLength": 1, "maxLength": 128 }
131
+ },
132
+ "additionalProperties": false
133
+ }
134
+ ]
135
+ },
136
+ "criterion": {
137
+ "type": "object",
138
+ "required": ["id", "description", "status"],
139
+ "properties": {
140
+ "id": { "$ref": "#/$defs/entryId" },
141
+ "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
142
+ "status": { "type": "string", "enum": ["pending", "met", "not_met", "waived"] },
143
+ "verification": { "type": "object" }
144
+ },
145
+ "additionalProperties": false
146
+ },
147
+ "outcome": {
148
+ "type": "object",
149
+ "properties": {
150
+ "statement": { "$ref": "#/$defs/statement" },
151
+ "status": { "type": "string", "enum": ["proposed", "accepted", "achieved", "abandoned"] },
152
+ "target": { "$ref": "#/$defs/temporalTarget" },
153
+ "successCriteria": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/criterion" } },
154
+ "outcomeRecordId": { "type": "string", "minLength": 1 },
155
+ "abandonedReason": { "type": "string", "minLength": 1, "maxLength": 2000 }
156
+ },
157
+ "additionalProperties": false
158
+ },
159
+ "risk": {
160
+ "type": "object",
161
+ "required": ["id", "description", "status"],
162
+ "properties": {
163
+ "id": { "$ref": "#/$defs/entryId" },
164
+ "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
165
+ "impact": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
166
+ "status": { "type": "string", "enum": ["open", "mitigated", "accepted", "closed"] },
167
+ "owner": { "type": "string", "minLength": 1 },
168
+ "mitigation": { "type": "string", "minLength": 1, "maxLength": 2000 }
169
+ },
170
+ "additionalProperties": false
171
+ },
172
+ "appearance": {
173
+ "type": "object",
174
+ "properties": {
175
+ "glyph": {
176
+ "oneOf": [
177
+ { "type": "object", "required": ["type", "value"], "properties": { "type": { "const": "emoji" }, "value": { "type": "string", "minLength": 1, "maxLength": 16 } }, "additionalProperties": false },
178
+ { "type": "object", "required": ["type", "name"], "properties": { "type": { "const": "icon" }, "name": { "type": "string", "enum": ["task", "agent", "proposal", "evaluation", "claims", "question", "discussion", "incident"] } }, "additionalProperties": false }
179
+ ]
180
+ }
181
+ },
182
+ "additionalProperties": false
183
+ },
184
+ "contractBody": {
185
+ "type": "object",
186
+ "required": ["version", "revision", "status", "kindRef", "authoredBy", "authoredAt", "workingMode", "recipe"],
187
+ "properties": {
188
+ "version": { "const": 2 },
189
+ "revision": { "type": "string", "minLength": 1 },
190
+ "status": { "type": "string", "enum": ["draft", "accepted", "superseded"] },
191
+ "kindRef": { "$ref": "#/$defs/kindRef" },
192
+ "authoredBy": { "type": "string", "minLength": 1 },
193
+ "authoredAt": { "type": "string", "format": "date-time" },
194
+ "workingMode": { "type": "string", "enum": ["solo", "team", "client"] },
195
+ "recipe": { "type": "string", "enum": ["project", "flow", "proposal", "evaluation", "claims", "research", "discussion", "incident"] },
196
+ "locale": { "type": "string", "minLength": 2, "maxLength": 32 },
197
+ "timezone": { "type": "string", "minLength": 1, "maxLength": 128 },
198
+ "temporalMode": { "type": "string", "enum": ["finite", "ongoing"] },
199
+ "tags": { "type": "array", "uniqueItems": true, "maxItems": 20, "items": { "type": "string", "minLength": 1, "maxLength": 80 } },
200
+ "appearance": { "$ref": "#/$defs/appearance" },
201
+ "intent": { "$ref": "#/$defs/statement" },
202
+ "outcome": { "$ref": "#/$defs/outcome" },
203
+ "completion": { "type": "object" },
204
+ "ownerId": { "type": "string", "minLength": 1 },
205
+ "scope": { "type": "object" },
206
+ "constraints": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/statement" } },
207
+ "assumptions": { "type": "array", "maxItems": 50, "items": { "type": "object" } },
208
+ "questions": { "type": "array", "maxItems": 50, "items": { "type": "object" } },
209
+ "risks": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/risk" } },
210
+ "participants": { "type": "array", "maxItems": 100, "items": { "type": "object" } },
211
+ "roles": { "type": "array", "maxItems": 50, "items": { "type": "object" } },
212
+ "agents": { "type": "array", "maxItems": 20, "items": { "type": "object" } },
213
+ "decision": { "type": "object" },
214
+ "plan": { "type": "object" },
215
+ "attachments": { "type": "array", "maxItems": 100, "items": { "type": "object" } }
216
+ },
217
+ "additionalProperties": true
218
+ },
219
+ "contractRef": {
220
+ "type": "object",
221
+ "required": ["revision", "bodyHash", "bodyRef"],
222
+ "properties": {
223
+ "revision": { "type": "string", "minLength": 1 },
224
+ "bodyHash": { "$ref": "#/$defs/hash" },
225
+ "bodyRef": { "type": "object" },
226
+ "body": { "$ref": "#/$defs/contractBody" }
227
+ },
228
+ "additionalProperties": true
229
+ },
230
+ "effectiveContractRef": {
231
+ "allOf": [
232
+ { "$ref": "#/$defs/contractRef" },
233
+ {
234
+ "type": "object",
235
+ "required": ["acceptedBy", "acceptedAt"],
236
+ "properties": {
237
+ "acceptedBy": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
238
+ "acceptedAt": { "type": "string", "format": "date-time" }
239
+ }
240
+ }
241
+ ]
242
+ },
243
+ "contractHeads": {
244
+ "type": "object",
245
+ "properties": { "proposed": { "$ref": "#/$defs/contractRef" }, "effective": { "$ref": "#/$defs/effectiveContractRef" } },
246
+ "additionalProperties": false
247
+ },
248
+ "projection": {
249
+ "type": "object",
250
+ "required": ["revision", "title", "status", "kindRef", "attachmentCount", "operationCount"],
251
+ "properties": {
252
+ "revision": { "type": "string", "minLength": 1 },
253
+ "title": { "type": "string", "minLength": 1, "maxLength": 280 },
254
+ "status": { "type": "string", "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] },
255
+ "kindRef": { "$ref": "#/$defs/kindRef" },
256
+ "appearance": { "$ref": "#/$defs/appearance" },
257
+ "attachmentCount": { "type": "integer", "minimum": 0 },
258
+ "operationCount": { "type": "integer", "minimum": 0 }
259
+ },
260
+ "additionalProperties": true
261
+ },
262
+ "recurrence": {
263
+ "oneOf": [
264
+ { "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 },
265
+ { "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 }
266
+ ]
267
+ },
268
+ "automation": {
269
+ "type": "object",
270
+ "required": ["provider", "scheduleId", "actionId", "recurrence", "status"],
271
+ "properties": {
272
+ "provider": { "const": "temporal" },
273
+ "scheduleId": { "type": "string", "minLength": 1 },
274
+ "actionId": { "type": "string", "minLength": 1 },
275
+ "recurrence": { "$ref": "#/$defs/recurrence" },
276
+ "status": { "type": "string", "enum": ["pending", "active", "paused", "failed"] },
277
+ "nextRunAt": { "type": "string", "format": "date-time" }
278
+ },
279
+ "additionalProperties": false
280
+ },
281
+ "bindings": {
282
+ "type": "object",
283
+ "properties": {
284
+ "governanceProposal": { "type": "object" },
285
+ "claims": { "type": "object" },
286
+ "automations": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/automation" } },
287
+ "context": { "type": "array", "maxItems": 100, "items": { "type": "object" } }
288
+ },
289
+ "additionalProperties": false
290
+ }
291
+ }
292
+ }
@@ -6,7 +6,7 @@
6
6
  "required": ["provider", "resource", "fileId", "version", "cid", "contentHash", "path", "name", "mimeType", "size"],
7
7
  "properties": {
8
8
  "provider": { "const": "ixo.vfs" },
9
- "resource": { "type": "string", "pattern": "^ixo:filesystem/.+" },
9
+ "resource": { "type": "string", "pattern": "^ixo:filesystem(?:/.+)?$" },
10
10
  "fileId": { "type": "string", "minLength": 1 },
11
11
  "version": { "type": "integer", "minimum": 1 },
12
12
  "cid": { "type": "string", "minLength": 1 },
@@ -11,7 +11,7 @@
11
11
  "title": { "type": "string", "minLength": 1, "maxLength": 280 },
12
12
  "currentState": { "type": "string", "minLength": 1, "maxLength": 280 },
13
13
  "status": { "type": "string" },
14
- "kind": { "type": "string", "enum": ["discussion", "question", "decision", "proposal", "task", "incident", "flow"] },
14
+ "kind": { "type": "string", "enum": ["discussion", "question", "decision", "proposal", "task", "incident", "flow", "agent_task", "evaluation", "claims"] },
15
15
  "domain": {
16
16
  "type": "object",
17
17
  "required": ["id"],
@@ -5,15 +5,26 @@
5
5
  "type": "object",
6
6
  "required": ["version", "operationId", "topicId", "type", "previousRevision", "actor", "createdAt", "payload"],
7
7
  "properties": {
8
- "version": { "const": 1 },
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", "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", "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" },
15
15
  "payload": { "type": "object" },
16
16
  "capability": { "type": "string" }
17
17
  },
18
- "additionalProperties": true
18
+ "additionalProperties": true,
19
+ "allOf": [
20
+ {
21
+ "if": {
22
+ "properties": {
23
+ "type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation"] }
24
+ },
25
+ "required": ["type"]
26
+ },
27
+ "then": { "properties": { "version": { "const": 2 } } }
28
+ }
29
+ ]
19
30
  }
@@ -5,8 +5,53 @@
5
5
  "type": "object",
6
6
  "required": ["version", "topics", "autoFollow"],
7
7
  "properties": {
8
- "version": { "const": 1 },
9
- "topics": { "type": "object", "additionalProperties": { "type": "object", "required": ["notificationMode", "pinned"], "properties": { "notificationMode": { "type": "string", "enum": ["follow", "default", "mute"] }, "pinned": { "type": "boolean" }, "markedUnreadFrom": { "type": ["string", "null"] } } } },
8
+ "version": { "enum": [1, 2] },
9
+ "topics": {
10
+ "type": "object",
11
+ "additionalProperties": {
12
+ "type": "object",
13
+ "required": ["notificationMode", "pinned"],
14
+ "properties": {
15
+ "notificationMode": { "type": "string", "enum": ["follow", "default", "mute"] },
16
+ "pinned": { "type": "boolean" },
17
+ "markedUnreadFrom": { "type": ["string", "null"] },
18
+ "companion": {
19
+ "type": "object",
20
+ "required": ["oracleDid", "sessionId"],
21
+ "properties": {
22
+ "oracleDid": { "type": "string", "minLength": 1 },
23
+ "sessionId": { "type": "string", "minLength": 1 },
24
+ "lastContextRevision": { "type": "string", "minLength": 1 }
25
+ },
26
+ "additionalProperties": false
27
+ },
28
+ "reminder": {
29
+ "oneOf": [
30
+ {
31
+ "type": "object",
32
+ "required": ["mode", "at", "timezone"],
33
+ "properties": {
34
+ "mode": { "const": "at" },
35
+ "at": { "type": "string", "format": "date-time" },
36
+ "timezone": { "type": "string", "minLength": 1 }
37
+ },
38
+ "additionalProperties": false
39
+ },
40
+ {
41
+ "type": "object",
42
+ "required": ["mode", "minutes"],
43
+ "properties": {
44
+ "mode": { "const": "before_due" },
45
+ "minutes": { "type": "integer", "minimum": 0 }
46
+ },
47
+ "additionalProperties": false
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ "additionalProperties": false
53
+ }
54
+ },
10
55
  "autoFollow": { "type": "string", "enum": ["none", "started", "started_or_participated"] }
11
56
  },
12
57
  "additionalProperties": false
@@ -5,10 +5,10 @@
5
5
  "type": "object",
6
6
  "required": ["version", "id", "title", "status", "createdBy", "createdAt"],
7
7
  "properties": {
8
- "version": { "const": 1 },
8
+ "version": { "enum": [1, 2] },
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
- "kind": { "type": "string", "enum": ["discussion", "question", "decision", "proposal", "task", "incident", "flow"] },
11
+ "kind": { "type": "string", "enum": ["discussion", "question", "decision", "proposal", "task", "incident", "flow", "agent_task", "evaluation", "claims"] },
12
12
  "status": { "type": "string", "enum": ["draft", "active", "waiting", "blocked", "resolved", "archived", "redirected"] },
13
13
  "createdBy": { "type": "string", "minLength": 1 },
14
14
  "createdAt": { "type": "string", "format": "date-time" },
@@ -44,5 +44,11 @@
44
44
  "additionalProperties": false
45
45
  }
46
46
  },
47
- "additionalProperties": true
47
+ "additionalProperties": true,
48
+ "allOf": [
49
+ {
50
+ "if": { "properties": { "version": { "const": 2 } }, "required": ["version"] },
51
+ "then": { "properties": { "kind": true }, "required": ["kind"] }
52
+ }
53
+ ]
48
54
  }