@cleocode/contracts 2026.4.0 → 2026.4.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 (55) hide show
  1. package/dist/adapter.d.ts +60 -0
  2. package/dist/adapter.d.ts.map +1 -1
  3. package/dist/brain.d.ts +19 -0
  4. package/dist/brain.d.ts.map +1 -1
  5. package/dist/capabilities.d.ts +1 -0
  6. package/dist/capabilities.d.ts.map +1 -1
  7. package/dist/conduit.d.ts +5 -0
  8. package/dist/conduit.d.ts.map +1 -1
  9. package/dist/config.d.ts +38 -3
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/errors.d.ts +30 -0
  12. package/dist/errors.d.ts.map +1 -1
  13. package/dist/errors.js +30 -0
  14. package/dist/errors.js.map +1 -1
  15. package/dist/install.d.ts +1 -1
  16. package/dist/install.d.ts.map +1 -1
  17. package/dist/lafs.d.ts +167 -11
  18. package/dist/lafs.d.ts.map +1 -1
  19. package/dist/lafs.js +57 -3
  20. package/dist/lafs.js.map +1 -1
  21. package/dist/memory.d.ts +77 -0
  22. package/dist/memory.d.ts.map +1 -1
  23. package/dist/operations/issues.d.ts +1 -1
  24. package/dist/operations/issues.d.ts.map +1 -1
  25. package/dist/operations/session.d.ts +1 -1
  26. package/dist/operations/session.js +1 -1
  27. package/dist/operations/tasks.d.ts +1 -1
  28. package/dist/operations/tasks.js +1 -1
  29. package/dist/results.d.ts +89 -0
  30. package/dist/results.d.ts.map +1 -1
  31. package/dist/session.d.ts +78 -0
  32. package/dist/session.d.ts.map +1 -1
  33. package/dist/session.js +5 -0
  34. package/dist/session.js.map +1 -1
  35. package/dist/status-registry.d.ts +1 -1
  36. package/dist/status-registry.js +1 -1
  37. package/dist/task.d.ts +106 -33
  38. package/dist/task.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/adapter.ts +60 -0
  41. package/src/brain.ts +19 -0
  42. package/src/capabilities.ts +1 -0
  43. package/src/conduit.ts +3 -0
  44. package/src/config.ts +38 -3
  45. package/src/errors.ts +30 -0
  46. package/src/install.ts +1 -1
  47. package/src/lafs.ts +169 -13
  48. package/src/memory.ts +77 -0
  49. package/src/operations/issues.ts +1 -1
  50. package/src/operations/session.ts +1 -1
  51. package/src/operations/tasks.ts +1 -1
  52. package/src/results.ts +89 -0
  53. package/src/session.ts +78 -0
  54. package/src/status-registry.ts +1 -1
  55. package/src/task.ts +106 -33
package/src/task.ts CHANGED
@@ -68,35 +68,57 @@ export type VerificationGate =
68
68
 
69
69
  /** Verification failure log entry. */
70
70
  export interface VerificationFailure {
71
+ /** Verification round number when the failure occurred. */
71
72
  round: number;
73
+ /** Agent that performed the verification and reported the failure. */
72
74
  agent: string;
75
+ /** Human-readable description of why verification failed. */
73
76
  reason: string;
77
+ /** ISO 8601 timestamp of when the failure was recorded. */
74
78
  timestamp: string;
75
79
  }
76
80
 
77
81
  /** Task verification state. */
78
82
  export interface TaskVerification {
83
+ /** Whether all required verification gates have passed. */
79
84
  passed: boolean;
85
+ /** Current verification round number (starts at 1). */
80
86
  round: number;
87
+ /** Gate pass/fail/pending status for each verification gate. */
81
88
  gates: Partial<Record<VerificationGate, boolean | null>>;
89
+ /** The last agent that performed a verification check, or `null`. */
82
90
  lastAgent: VerificationAgent | null;
91
+ /** ISO 8601 timestamp of the most recent verification update, or `null`. */
83
92
  lastUpdated: string | null;
93
+ /** Ordered log of all verification failures across rounds. */
84
94
  failureLog: VerificationFailure[];
85
- /** ISO timestamp set when verification was first initialized on task creation (T061). */
95
+ /**
96
+ * ISO timestamp set when verification was first initialized on task creation (T061).
97
+ * @defaultValue undefined
98
+ */
86
99
  initializedAt?: string | null;
87
100
  }
88
101
 
89
102
  /** Task provenance tracking. */
90
103
  export interface TaskProvenance {
104
+ /** Agent or user that created this task, or `null` if unknown. */
91
105
  createdBy: string | null;
106
+ /** Agent or user that last modified this task, or `null` if unknown. */
92
107
  modifiedBy: string | null;
108
+ /** Session ID during which this task was created, or `null`. */
93
109
  sessionId: string | null;
94
110
  }
95
111
 
96
112
  /** A single task relation entry. */
97
113
  export interface TaskRelation {
114
+ /** ID of the related task. */
98
115
  taskId: string;
116
+ /** Relation type (e.g. `"blocks"`, `"related-to"`, `"duplicates"`). */
99
117
  type: string;
118
+ /**
119
+ * Optional reason explaining the relationship.
120
+ * @defaultValue undefined
121
+ */
100
122
  reason?: string;
101
123
  }
102
124
 
@@ -126,82 +148,88 @@ export interface Task {
126
148
  /** Task priority level. Defaults to `'medium'` on creation. */
127
149
  priority: TaskPriority;
128
150
 
129
- /** Task type in hierarchy. Inferred from parent context if not specified. */
151
+ /** Task type in hierarchy. Inferred from parent context if not specified. @defaultValue undefined */
130
152
  type?: TaskType;
131
153
 
132
- /** ID of the parent task. `null` for root-level tasks. */
154
+ /** ID of the parent task. `null` for root-level tasks. @defaultValue undefined */
133
155
  parentId?: string | null;
134
156
 
135
- /** Sort position within sibling scope. */
157
+ /** Sort position within sibling scope. @defaultValue undefined */
136
158
  position?: number | null;
137
159
 
138
- /** Optimistic concurrency version for position changes. */
160
+ /** Optimistic concurrency version for position changes. @defaultValue undefined */
139
161
  positionVersion?: number;
140
162
 
141
- /** Relative scope sizing (small/medium/large). NOT a time estimate. */
163
+ /** Relative scope sizing (small/medium/large). NOT a time estimate. @defaultValue undefined */
142
164
  size?: TaskSize | null;
143
165
 
144
- /** Phase slug this task belongs to. */
166
+ /** Phase slug this task belongs to. @defaultValue undefined */
145
167
  phase?: string;
146
168
 
147
- /** File paths associated with this task. */
169
+ /** File paths associated with this task. @defaultValue undefined */
148
170
  files?: string[];
149
171
 
150
- /** Acceptance criteria for completion. */
172
+ /** Acceptance criteria for completion. @defaultValue undefined */
151
173
  acceptance?: string[];
152
174
 
153
- /** IDs of tasks this task depends on. */
175
+ /** IDs of tasks this task depends on. @defaultValue undefined */
154
176
  depends?: string[];
155
177
 
156
- /** Related task entries (non-dependency relationships). */
178
+ /** Related task entries (non-dependency relationships). @defaultValue undefined */
157
179
  relates?: TaskRelation[];
158
180
 
159
- /** Epic lifecycle state. Only meaningful when `type = 'epic'`. */
181
+ /** Epic lifecycle state. Only meaningful when `type = 'epic'`. @defaultValue undefined */
160
182
  epicLifecycle?: EpicLifecycle | null;
161
183
 
162
- /** When true, epic will not auto-complete when all children are done. */
184
+ /** When true, epic will not auto-complete when all children are done. @defaultValue undefined */
163
185
  noAutoComplete?: boolean | null;
164
186
 
165
- /** Reason the task is blocked (free-form text). */
187
+ /** Reason the task is blocked (free-form text). @defaultValue undefined */
166
188
  blockedBy?: string;
167
189
 
168
- /** Timestamped notes appended during task lifecycle. */
190
+ /** Timestamped notes appended during task lifecycle. @defaultValue undefined */
169
191
  notes?: string[];
170
192
 
171
- /** Classification labels for filtering and grouping. */
193
+ /** Classification labels for filtering and grouping. @defaultValue undefined */
172
194
  labels?: string[];
173
195
 
174
- /** Task origin/provenance category. */
196
+ /** Task origin/provenance category. @defaultValue undefined */
175
197
  origin?: TaskOrigin | null;
176
198
 
177
199
  /** ISO 8601 timestamp of task creation. Must not be in the future. */
178
200
  createdAt: string;
179
201
 
180
- /** ISO 8601 timestamp of last update. Set automatically on mutation. */
202
+ /** ISO 8601 timestamp of last update. Set automatically on mutation. @defaultValue undefined */
181
203
  updatedAt?: string | null;
182
204
 
183
205
  /**
184
206
  * ISO 8601 timestamp of task completion. Set when `status` transitions to `'done'`.
185
207
  * See {@link CompletedTask} for the status-narrowed type where this is required.
208
+ *
209
+ * @defaultValue undefined
186
210
  */
187
211
  completedAt?: string;
188
212
 
189
213
  /**
190
214
  * ISO 8601 timestamp of task cancellation. Set when `status` transitions to `'cancelled'`.
191
215
  * See {@link CancelledTask} for the status-narrowed type where this is required.
216
+ *
217
+ * @defaultValue undefined
192
218
  */
193
219
  cancelledAt?: string;
194
220
 
195
221
  /**
196
222
  * Reason for cancellation. Required when `status = 'cancelled'`.
197
223
  * See {@link CancelledTask} for the status-narrowed type where this is required.
224
+ *
225
+ * @defaultValue undefined
198
226
  */
199
227
  cancellationReason?: string;
200
228
 
201
- /** Verification pipeline state. */
229
+ /** Verification pipeline state. @defaultValue undefined */
202
230
  verification?: TaskVerification | null;
203
231
 
204
- /** Provenance tracking (who created/modified, which session). */
232
+ /** Provenance tracking (who created/modified, which session). @defaultValue undefined */
205
233
  provenance?: TaskProvenance | null;
206
234
 
207
235
  /**
@@ -212,10 +240,11 @@ export interface Task {
212
240
  *
213
241
  * Auto-assigned on creation; only moves forward through stages.
214
242
  * @task T060
243
+ * @defaultValue undefined
215
244
  */
216
245
  pipelineStage?: string | null;
217
246
 
218
- /** Agent ID that has claimed/is assigned to this task. Null when unclaimed. */
247
+ /** Agent ID that has claimed/is assigned to this task. Null when unclaimed. @defaultValue undefined */
219
248
  assignee?: string | null;
220
249
  }
221
250
 
@@ -243,40 +272,40 @@ export interface TaskCreate {
243
272
  */
244
273
  description: string;
245
274
 
246
- /** Initial status. Defaults to `'pending'`. */
275
+ /** Initial status. Defaults to `'pending'`. @defaultValue 'pending' */
247
276
  status?: TaskStatus;
248
277
 
249
- /** Priority level. Defaults to `'medium'`. */
278
+ /** Priority level. Defaults to `'medium'`. @defaultValue 'medium' */
250
279
  priority?: TaskPriority;
251
280
 
252
- /** Task type. Inferred from parent context if not specified. */
281
+ /** Task type. Inferred from parent context if not specified. @defaultValue undefined */
253
282
  type?: TaskType;
254
283
 
255
- /** Parent task ID for hierarchy placement. */
284
+ /** Parent task ID for hierarchy placement. @defaultValue undefined */
256
285
  parentId?: string | null;
257
286
 
258
- /** Relative scope sizing. Defaults to `'medium'`. */
287
+ /** Relative scope sizing. Defaults to `'medium'`. @defaultValue 'medium' */
259
288
  size?: TaskSize;
260
289
 
261
- /** Phase slug to assign. Inherited from project.currentPhase if not specified. */
290
+ /** Phase slug to assign. Inherited from project.currentPhase if not specified. @defaultValue undefined */
262
291
  phase?: string;
263
292
 
264
- /** Classification labels. */
293
+ /** Classification labels. @defaultValue undefined */
265
294
  labels?: string[];
266
295
 
267
- /** File paths associated with this task. */
296
+ /** File paths associated with this task. @defaultValue undefined */
268
297
  files?: string[];
269
298
 
270
- /** Acceptance criteria. */
299
+ /** Acceptance criteria. @defaultValue undefined */
271
300
  acceptance?: string[];
272
301
 
273
- /** IDs of tasks this task depends on. */
302
+ /** IDs of tasks this task depends on. @defaultValue undefined */
274
303
  depends?: string[];
275
304
 
276
- /** Initial note to attach. */
305
+ /** Initial note to attach. @defaultValue undefined */
277
306
  notes?: string;
278
307
 
279
- /** Sort position. Auto-calculated if not specified. */
308
+ /** Sort position. Auto-calculated if not specified. @defaultValue undefined */
280
309
  position?: number;
281
310
  }
282
311
 
@@ -318,21 +347,33 @@ export type PhaseStatus = 'pending' | 'active' | 'completed';
318
347
 
319
348
  /** Phase definition. */
320
349
  export interface Phase {
350
+ /** Sort order of this phase in the project lifecycle. */
321
351
  order: number;
352
+ /** Human-readable phase name. */
322
353
  name: string;
354
+ /** Phase description. @defaultValue undefined */
323
355
  description?: string;
356
+ /** Current phase lifecycle status. */
324
357
  status: PhaseStatus;
358
+ /** ISO 8601 timestamp of when the phase started. @defaultValue undefined */
325
359
  startedAt?: string | null;
360
+ /** ISO 8601 timestamp of when the phase completed. @defaultValue undefined */
326
361
  completedAt?: string | null;
327
362
  }
328
363
 
329
364
  /** Phase transition record. */
330
365
  export interface PhaseTransition {
366
+ /** Slug of the phase that transitioned. */
331
367
  phase: string;
368
+ /** Type of transition that occurred. */
332
369
  transitionType: 'started' | 'completed' | 'rollback';
370
+ /** ISO 8601 timestamp of the transition. */
333
371
  timestamp: string;
372
+ /** Number of tasks in the phase at transition time. */
334
373
  taskCount: number;
374
+ /** Previous phase slug for rollback transitions. @defaultValue undefined */
335
375
  fromPhase?: string | null;
376
+ /** Optional reason for the transition. @defaultValue undefined */
336
377
  reason?: string;
337
378
  }
338
379
 
@@ -341,52 +382,84 @@ export type ReleaseStatus = 'planned' | 'active' | 'released';
341
382
 
342
383
  /** Release definition. */
343
384
  export interface Release {
385
+ /** Semantic version string (e.g. `"v2026.4.0"`). */
344
386
  version: string;
387
+ /** Current release lifecycle status. */
345
388
  status: ReleaseStatus;
389
+ /** Target release date in ISO 8601. @defaultValue undefined */
346
390
  targetDate?: string | null;
391
+ /** Actual release date in ISO 8601. @defaultValue undefined */
347
392
  releasedAt?: string | null;
393
+ /** Task IDs included in this release. */
348
394
  tasks: string[];
395
+ /** Release notes text. @defaultValue undefined */
349
396
  notes?: string | null;
397
+ /** Generated changelog content. @defaultValue undefined */
350
398
  changelog?: string | null;
351
399
  }
352
400
 
353
401
  /** Project metadata. */
354
402
  export interface ProjectMeta {
403
+ /** Project name from `.cleo/project-context.json`. */
355
404
  name: string;
405
+ /** Slug of the currently active phase. @defaultValue undefined */
356
406
  currentPhase?: string | null;
407
+ /** Phase definitions keyed by slug. */
357
408
  phases: Record<string, Phase>;
409
+ /** Ordered history of phase transitions. @defaultValue undefined */
358
410
  phaseHistory?: PhaseTransition[];
411
+ /** Release definitions for the project. @defaultValue undefined */
359
412
  releases?: Release[];
360
413
  }
361
414
 
362
415
  /** File metadata (_meta block). */
363
416
  export interface FileMeta {
417
+ /** Schema version of the task data file. */
364
418
  schemaVersion: string;
419
+ /** Spec version for forward compatibility. @defaultValue undefined */
365
420
  specVersion?: string;
421
+ /** Integrity checksum of the data file. */
366
422
  checksum: string;
423
+ /** Configuration version used when the file was last written. */
367
424
  configVersion: string;
425
+ /** ID of the last session that modified this file. @defaultValue undefined */
368
426
  lastSessionId?: string | null;
427
+ /** ID of the currently active session. @defaultValue undefined */
369
428
  activeSession?: string | null;
429
+ /** Number of active sessions at last write. @defaultValue undefined */
370
430
  activeSessionCount?: number;
431
+ /** Path to the sessions storage file. @defaultValue undefined */
371
432
  sessionsFile?: string | null;
433
+ /** Monotonically increasing file generation counter. @defaultValue undefined */
372
434
  generation?: number;
373
435
  }
374
436
 
375
437
  /** Session note in taskWork block. */
376
438
  export interface SessionNote {
439
+ /** Note text content. */
377
440
  note: string;
441
+ /** ISO 8601 timestamp of when the note was recorded. */
378
442
  timestamp: string;
443
+ /** Conversation ID for multi-turn context. @defaultValue undefined */
379
444
  conversationId?: string | null;
445
+ /** Agent that recorded this note. @defaultValue undefined */
380
446
  agent?: string | null;
381
447
  }
382
448
 
383
449
  /** Task work state. */
384
450
  export interface TaskWorkState {
451
+ /** ID of the task currently being worked on. @defaultValue undefined */
385
452
  currentTask?: string | null;
453
+ /** Slug of the current project phase. @defaultValue undefined */
386
454
  currentPhase?: string | null;
455
+ /** ISO 8601 timestamp until which work is blocked. @defaultValue undefined */
387
456
  blockedUntil?: string | null;
457
+ /** Most recent session note (legacy, use sessionNotes). @defaultValue undefined */
388
458
  sessionNote?: string | null;
459
+ /** Ordered list of session notes. @defaultValue undefined */
389
460
  sessionNotes?: SessionNote[];
461
+ /** Suggested next action for the agent. @defaultValue undefined */
390
462
  nextAction?: string | null;
463
+ /** ID of the primary session managing this work state. @defaultValue undefined */
391
464
  primarySession?: string | null;
392
465
  }