@latchet/spec 0.1.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.
@@ -0,0 +1,441 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://latchet.dev/schema/task-ledger.schema.json",
4
+ "title": "Latchet Task Event",
5
+ "type": "object",
6
+ "required": [
7
+ "id",
8
+ "task_id",
9
+ "timestamp",
10
+ "actor",
11
+ "source",
12
+ "type",
13
+ "payload"
14
+ ],
15
+ "properties": {
16
+ "id": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "task_id": {
21
+ "type": "string",
22
+ "minLength": 1
23
+ },
24
+ "timestamp": {
25
+ "type": "string",
26
+ "format": "date-time"
27
+ },
28
+ "actor": {
29
+ "type": "object",
30
+ "required": [
31
+ "kind"
32
+ ],
33
+ "properties": {
34
+ "kind": {
35
+ "type": "string",
36
+ "enum": [
37
+ "user",
38
+ "assistant",
39
+ "tool",
40
+ "system"
41
+ ]
42
+ },
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "id": {
47
+ "type": "string"
48
+ },
49
+ "provider": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "additionalProperties": false
54
+ },
55
+ "source": {
56
+ "type": "object",
57
+ "required": [
58
+ "kind"
59
+ ],
60
+ "properties": {
61
+ "kind": {
62
+ "type": "string",
63
+ "enum": [
64
+ "manual",
65
+ "cli",
66
+ "mcp",
67
+ "session",
68
+ "conversation",
69
+ "file",
70
+ "command",
71
+ "telemetry",
72
+ "import"
73
+ ]
74
+ },
75
+ "provider": {
76
+ "type": "string"
77
+ },
78
+ "reference": {
79
+ "type": "string"
80
+ },
81
+ "uri": {
82
+ "type": "string"
83
+ }
84
+ },
85
+ "additionalProperties": false
86
+ },
87
+ "type": {
88
+ "type": "string",
89
+ "enum": [
90
+ "decision",
91
+ "attempt",
92
+ "failure",
93
+ "env_quirk",
94
+ "constraint",
95
+ "artifact_ref",
96
+ "open_question",
97
+ "next_action",
98
+ "status_change",
99
+ "note",
100
+ "evidence"
101
+ ]
102
+ },
103
+ "payload": {
104
+ "type": "object",
105
+ "additionalProperties": true
106
+ },
107
+ "supersedes": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "string"
111
+ }
112
+ },
113
+ "refs": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "object",
117
+ "required": [
118
+ "kind",
119
+ "value"
120
+ ],
121
+ "properties": {
122
+ "kind": {
123
+ "type": "string",
124
+ "enum": [
125
+ "event",
126
+ "file",
127
+ "command",
128
+ "conversation",
129
+ "url",
130
+ "commit",
131
+ "issue",
132
+ "pull_request"
133
+ ]
134
+ },
135
+ "value": {
136
+ "type": "string"
137
+ },
138
+ "label": {
139
+ "type": "string"
140
+ }
141
+ },
142
+ "additionalProperties": false
143
+ }
144
+ },
145
+ "verification": {
146
+ "type": "object",
147
+ "required": [
148
+ "status"
149
+ ],
150
+ "properties": {
151
+ "status": {
152
+ "type": "string",
153
+ "enum": [
154
+ "verified",
155
+ "user_asserted",
156
+ "model_inferred",
157
+ "speculative",
158
+ "rejected"
159
+ ]
160
+ },
161
+ "note": {
162
+ "type": "string"
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ },
167
+ "redaction": {
168
+ "type": "object",
169
+ "properties": {
170
+ "contains_sensitive": {
171
+ "type": "boolean"
172
+ },
173
+ "fields": {
174
+ "type": "array",
175
+ "items": {
176
+ "type": "string"
177
+ }
178
+ },
179
+ "note": {
180
+ "type": "string"
181
+ }
182
+ },
183
+ "additionalProperties": false
184
+ }
185
+ },
186
+ "additionalProperties": false,
187
+ "allOf": [
188
+ {
189
+ "if": {
190
+ "properties": {
191
+ "type": { "const": "decision" }
192
+ }
193
+ },
194
+ "then": {
195
+ "properties": {
196
+ "payload": {
197
+ "type": "object",
198
+ "required": ["summary"],
199
+ "properties": {
200
+ "summary": { "type": "string", "minLength": 1 },
201
+ "reason": { "type": "string" },
202
+ "status": {
203
+ "type": "string",
204
+ "enum": ["proposed", "accepted", "rejected", "superseded"]
205
+ }
206
+ },
207
+ "additionalProperties": false
208
+ }
209
+ }
210
+ }
211
+ },
212
+ {
213
+ "if": {
214
+ "properties": {
215
+ "type": { "const": "attempt" }
216
+ }
217
+ },
218
+ "then": {
219
+ "properties": {
220
+ "payload": {
221
+ "type": "object",
222
+ "required": ["summary"],
223
+ "properties": {
224
+ "summary": { "type": "string", "minLength": 1 },
225
+ "outcome": { "type": "string" },
226
+ "result": {
227
+ "type": "string",
228
+ "enum": ["success", "failure", "partial"]
229
+ }
230
+ },
231
+ "additionalProperties": false
232
+ }
233
+ }
234
+ }
235
+ },
236
+ {
237
+ "if": {
238
+ "properties": {
239
+ "type": { "const": "failure" }
240
+ }
241
+ },
242
+ "then": {
243
+ "properties": {
244
+ "payload": {
245
+ "type": "object",
246
+ "required": ["summary"],
247
+ "properties": {
248
+ "summary": { "type": "string", "minLength": 1 },
249
+ "error": { "type": "string" },
250
+ "suspected_cause": { "type": "string" },
251
+ "status": {
252
+ "type": "string",
253
+ "enum": ["open", "resolved"]
254
+ }
255
+ },
256
+ "additionalProperties": false
257
+ }
258
+ }
259
+ }
260
+ },
261
+ {
262
+ "if": {
263
+ "properties": {
264
+ "type": { "const": "env_quirk" }
265
+ }
266
+ },
267
+ "then": {
268
+ "properties": {
269
+ "payload": {
270
+ "type": "object",
271
+ "required": ["summary"],
272
+ "properties": {
273
+ "summary": { "type": "string", "minLength": 1 },
274
+ "impact": { "type": "string" },
275
+ "workaround": { "type": "string" }
276
+ },
277
+ "additionalProperties": false
278
+ }
279
+ }
280
+ }
281
+ },
282
+ {
283
+ "if": {
284
+ "properties": {
285
+ "type": { "const": "constraint" }
286
+ }
287
+ },
288
+ "then": {
289
+ "properties": {
290
+ "payload": {
291
+ "type": "object",
292
+ "required": ["summary"],
293
+ "properties": {
294
+ "summary": { "type": "string", "minLength": 1 }
295
+ },
296
+ "additionalProperties": false
297
+ }
298
+ }
299
+ }
300
+ },
301
+ {
302
+ "if": {
303
+ "properties": {
304
+ "type": { "const": "artifact_ref" }
305
+ }
306
+ },
307
+ "then": {
308
+ "properties": {
309
+ "payload": {
310
+ "type": "object",
311
+ "required": ["path"],
312
+ "properties": {
313
+ "path": { "type": "string", "minLength": 1 },
314
+ "revision": { "type": "string" },
315
+ "exists": { "type": "boolean" },
316
+ "note": { "type": "string" }
317
+ },
318
+ "additionalProperties": false
319
+ }
320
+ }
321
+ }
322
+ },
323
+ {
324
+ "if": {
325
+ "properties": {
326
+ "type": { "const": "open_question" }
327
+ }
328
+ },
329
+ "then": {
330
+ "properties": {
331
+ "payload": {
332
+ "type": "object",
333
+ "required": ["question"],
334
+ "properties": {
335
+ "question": { "type": "string", "minLength": 1 },
336
+ "owner": { "type": "string" }
337
+ },
338
+ "additionalProperties": false
339
+ }
340
+ }
341
+ }
342
+ },
343
+ {
344
+ "if": {
345
+ "properties": {
346
+ "type": { "const": "next_action" }
347
+ }
348
+ },
349
+ "then": {
350
+ "properties": {
351
+ "payload": {
352
+ "type": "object",
353
+ "required": ["summary"],
354
+ "properties": {
355
+ "summary": { "type": "string", "minLength": 1 },
356
+ "priority": {
357
+ "type": "string",
358
+ "enum": ["low", "medium", "high"]
359
+ },
360
+ "prerequisites": {
361
+ "type": "array",
362
+ "items": { "type": "string" }
363
+ }
364
+ },
365
+ "additionalProperties": false
366
+ }
367
+ }
368
+ }
369
+ },
370
+ {
371
+ "if": {
372
+ "properties": {
373
+ "type": { "const": "status_change" }
374
+ }
375
+ },
376
+ "then": {
377
+ "properties": {
378
+ "payload": {
379
+ "type": "object",
380
+ "required": ["to"],
381
+ "properties": {
382
+ "to": {
383
+ "type": "string",
384
+ "enum": ["todo", "in_progress", "blocked", "done"]
385
+ },
386
+ "from": {
387
+ "type": "string",
388
+ "enum": ["todo", "in_progress", "blocked", "done"]
389
+ },
390
+ "reason": { "type": "string" }
391
+ },
392
+ "additionalProperties": false
393
+ }
394
+ }
395
+ }
396
+ },
397
+ {
398
+ "if": {
399
+ "properties": {
400
+ "type": { "const": "note" }
401
+ }
402
+ },
403
+ "then": {
404
+ "properties": {
405
+ "payload": {
406
+ "type": "object",
407
+ "required": ["summary"],
408
+ "properties": {
409
+ "summary": { "type": "string", "minLength": 1 }
410
+ },
411
+ "additionalProperties": false
412
+ }
413
+ }
414
+ }
415
+ },
416
+ {
417
+ "if": {
418
+ "properties": {
419
+ "type": { "const": "evidence" }
420
+ }
421
+ },
422
+ "then": {
423
+ "properties": {
424
+ "payload": {
425
+ "type": "object",
426
+ "required": ["summary"],
427
+ "properties": {
428
+ "summary": { "type": "string", "minLength": 1 },
429
+ "kind": {
430
+ "type": "string",
431
+ "enum": ["log", "otel", "test", "command", "session"]
432
+ },
433
+ "details": { "type": "string" }
434
+ },
435
+ "additionalProperties": false
436
+ }
437
+ }
438
+ }
439
+ }
440
+ ]
441
+ }