@cleocode/contracts 2026.3.38 → 2026.3.39

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/src/index.ts CHANGED
@@ -6,293 +6,284 @@
6
6
  * Implementation packages (@cleocode/core, @cleocode/cleo) import from here.
7
7
  */
8
8
 
9
- // === Status Registry (MUST be first — everything depends on this) ===
10
- export {
11
- // Constants
12
- TASK_STATUSES,
13
- SESSION_STATUSES,
14
- LIFECYCLE_PIPELINE_STATUSES,
15
- LIFECYCLE_STAGE_STATUSES,
16
- ADR_STATUSES,
17
- GATE_STATUSES,
18
- MANIFEST_STATUSES,
19
- // Derived types
20
- type TaskStatus,
21
- type SessionStatus,
22
- type PipelineStatus,
23
- type StageStatus,
24
- type AdrStatus,
25
- type GateStatus,
26
- type ManifestStatus,
27
- // Terminal state sets
28
- TERMINAL_TASK_STATUSES,
29
- TERMINAL_PIPELINE_STATUSES,
30
- TERMINAL_STAGE_STATUSES,
31
- // Registry
32
- type EntityType,
33
- STATUS_REGISTRY,
34
- isValidStatus,
35
- // Display icons
36
- PIPELINE_STATUS_ICONS,
37
- STAGE_STATUS_ICONS,
38
- TASK_STATUS_SYMBOLS_UNICODE,
39
- TASK_STATUS_SYMBOLS_ASCII,
40
- } from './status-registry.js';
41
-
42
- // === Task Types ===
9
+ // === Provider Adapter Contracts ===
10
+ export type { AdapterHealthStatus, CLEOProviderAdapter } from './adapter.js';
11
+ // === Archive Types ===
43
12
  export type {
44
- TaskPriority,
45
- TaskType,
46
- TaskSize,
47
- EpicLifecycle,
48
- TaskOrigin,
49
- VerificationAgent,
50
- VerificationGate,
51
- VerificationFailure,
52
- TaskVerification,
53
- TaskProvenance,
54
- TaskRelation,
55
- Task,
56
- TaskCreate,
57
- CompletedTask,
58
- CancelledTask,
59
- PhaseStatus,
60
- Phase,
61
- PhaseTransition,
62
- ReleaseStatus,
63
- Release,
64
- ProjectMeta,
65
- FileMeta,
66
- SessionNote,
67
- TaskWorkState,
68
- TaskFile,
69
- } from './task.js';
70
-
71
- // === Session Types ===
72
- export { SessionView } from './session.js';
13
+ ArchiveCycleTimesReport,
14
+ ArchiveDailyTrend,
15
+ ArchivedTask,
16
+ ArchiveLabelEntry,
17
+ ArchiveMetadata,
18
+ ArchiveMonthlyTrend,
19
+ ArchivePhaseEntry,
20
+ ArchivePriorityEntry,
21
+ ArchiveReportType,
22
+ ArchiveStatsEnvelope,
23
+ ArchiveSummaryReport,
24
+ ArchiveTrendsReport,
25
+ CycleTimeDistribution,
26
+ CycleTimePercentiles,
27
+ } from './archive.js';
28
+ // === Brain/Memory Types ===
73
29
  export type {
74
- SessionScope,
75
- SessionStats,
76
- SessionTaskWork,
77
- Session,
78
- } from './session.js';
79
-
80
- // === Exit Codes ===
81
- export {
82
- ExitCode,
83
- isErrorCode,
84
- isSuccessCode,
85
- isNoChangeCode,
86
- isRecoverableCode,
87
- getExitCodeName,
88
- } from './exit-codes.js';
89
-
30
+ BrainEntryRef,
31
+ BrainEntrySummary,
32
+ ContradictionDetail,
33
+ SupersededEntry,
34
+ } from './brain.js';
35
+ export type { AdapterCapabilities } from './capabilities.js';
90
36
  // === Configuration Types ===
91
37
  export type {
92
- OutputFormat,
93
- DateFormat,
94
- OutputConfig,
95
38
  BackupConfig,
39
+ CleoConfig,
40
+ ConfigSource,
41
+ DateFormat,
96
42
  EnforcementProfile,
97
43
  HierarchyConfig,
98
- SessionConfig,
99
- LogLevel,
100
- LoggingConfig,
101
- LifecycleEnforcementMode,
102
44
  LifecycleConfig,
103
- SharingMode,
45
+ LifecycleEnforcementMode,
46
+ LoggingConfig,
47
+ LogLevel,
48
+ OutputConfig,
49
+ OutputFormat,
50
+ ResolvedValue,
51
+ SessionConfig,
104
52
  SharingConfig,
105
- SignalDockMode,
53
+ SharingMode,
106
54
  SignalDockConfig,
107
- CleoConfig,
108
- ConfigSource,
109
- ResolvedValue,
55
+ SignalDockMode,
110
56
  } from './config.js';
111
-
112
- // === LAFS Envelope Types ===
113
- export {
114
- isLafsSuccess,
115
- isLafsError,
116
- isGatewayEnvelope,
117
- } from './lafs.js';
118
- export type {
119
- LAFSErrorCategory,
120
- LAFSError,
121
- Warning,
122
- LAFSTransport,
123
- MVILevel,
124
- LAFSPageNone,
125
- LAFSPageOffset,
126
- LAFSPage,
127
- LAFSMeta,
128
- LAFSEnvelope,
129
- FlagInput,
130
- ConformanceReport,
131
- LafsAlternative,
132
- LafsErrorDetail,
133
- LafsSuccess,
134
- LafsError,
135
- LafsEnvelope,
136
- GatewayMeta,
137
- GatewaySuccess,
138
- GatewayError,
139
- GatewayEnvelope,
140
- CleoResponse,
141
- } from './lafs.js';
142
-
57
+ export type { AdapterContextMonitorProvider } from './context-monitor.js';
143
58
  // === DataAccessor Interface ===
144
59
  export type {
145
60
  ArchiveFields,
146
61
  ArchiveFile,
147
- TaskQueryFilters,
62
+ DataAccessor,
148
63
  QueryTasksResult,
149
64
  TaskFieldUpdates,
65
+ TaskQueryFilters,
150
66
  TransactionAccessor,
151
- DataAccessor,
152
67
  } from './data-accessor.js';
153
-
154
- // === Provider Adapter Contracts ===
155
- export type { CLEOProviderAdapter, AdapterHealthStatus } from './adapter.js';
156
- export type { AdapterCapabilities } from './capabilities.js';
157
68
  export type { AdapterManifest, DetectionPattern } from './discovery.js';
69
+ // === Error Utilities ===
70
+ export {
71
+ createErrorResult,
72
+ createSuccessResult,
73
+ formatError,
74
+ getErrorMessage,
75
+ isErrorResult,
76
+ isErrorType,
77
+ normalizeError,
78
+ } from './errors.js';
79
+ // === Exit Codes ===
80
+ export {
81
+ ExitCode,
82
+ getExitCodeName,
83
+ isErrorCode,
84
+ isNoChangeCode,
85
+ isRecoverableCode,
86
+ isSuccessCode,
87
+ } from './exit-codes.js';
158
88
  export type { AdapterHookProvider } from './hooks.js';
159
89
  export type { AdapterInstallProvider, InstallOptions, InstallResult } from './install.js';
160
90
  export type {
91
+ CleoResponse,
92
+ ConformanceReport,
93
+ FlagInput,
94
+ GatewayEnvelope,
95
+ GatewayError,
96
+ GatewayMeta,
97
+ GatewaySuccess,
98
+ LAFSEnvelope,
99
+ LAFSError,
100
+ LAFSErrorCategory,
101
+ LAFSMeta,
102
+ LAFSPage,
103
+ LAFSPageNone,
104
+ LAFSPageOffset,
105
+ LAFSTransport,
106
+ LafsAlternative,
107
+ LafsEnvelope,
108
+ LafsError,
109
+ LafsErrorDetail,
110
+ LafsSuccess,
111
+ MVILevel,
112
+ Warning,
113
+ } from './lafs.js';
114
+ // === LAFS Envelope Types ===
115
+ export {
116
+ isGatewayEnvelope,
117
+ isLafsError,
118
+ isLafsSuccess,
119
+ } from './lafs.js';
120
+ export type {
121
+ BridgeDecision,
122
+ BridgeLearning,
123
+ BridgeObservation,
124
+ BridgePattern,
161
125
  MemoryBridgeConfig,
162
126
  MemoryBridgeContent,
163
127
  SessionSummary,
164
- BridgeLearning,
165
- BridgePattern,
166
- BridgeDecision,
167
- BridgeObservation,
168
128
  } from './memory.js';
169
- export type { AdapterSpawnProvider, SpawnContext, SpawnResult } from './spawn.js';
129
+ // === Operations Types (API wire format, namespaced to avoid collision with domain types) ===
130
+ export * as ops from './operations/index.js';
131
+ // Commonly used ops types re-exported at top level for convenience
132
+ export type { BrainState } from './operations/orchestrate.js';
170
133
  export type { AdapterPathProvider } from './provider-paths.js';
171
- export type { AdapterContextMonitorProvider } from './context-monitor.js';
172
- export type { AdapterTransportProvider } from './transport.js';
173
-
134
+ // === Result Types (Dashboard, Stats, Log, Context, Sequence, Analysis, Deps) ===
135
+ export type {
136
+ BottleneckTask,
137
+ CompleteTaskUnblocked,
138
+ ContextResult,
139
+ DashboardResult,
140
+ LabelCount,
141
+ LeveragedTask,
142
+ LogQueryResult,
143
+ SequenceResult,
144
+ StatsActivityMetrics,
145
+ StatsAllTime,
146
+ StatsCompletionMetrics,
147
+ StatsCurrentState,
148
+ StatsCycleTimes,
149
+ StatsResult,
150
+ TaskAnalysisResult,
151
+ TaskDepsResult,
152
+ TaskRef,
153
+ TaskRefPriority,
154
+ TaskSummary,
155
+ } from './results.js';
156
+ // === Session Start Result ===
157
+ export type {
158
+ Session,
159
+ SessionScope,
160
+ SessionStartResult,
161
+ SessionStats,
162
+ SessionTaskWork,
163
+ } from './session.js';
164
+ // === Session Types ===
165
+ export { SessionView } from './session.js';
166
+ export type { AdapterSpawnProvider, SpawnContext, SpawnResult } from './spawn.js';
174
167
  // === CLEO Spawn Types (distinct from adapter spawn) ===
175
168
  export type {
176
- Provider,
177
169
  CAAMPSpawnOptions,
178
170
  CAAMPSpawnResult,
171
+ CLEOSpawnAdapter,
179
172
  CLEOSpawnContext,
180
173
  CLEOSpawnResult,
181
- CLEOSpawnAdapter,
182
- TokenResolution,
174
+ Provider,
183
175
  SpawnStatus,
176
+ TokenResolution,
184
177
  } from './spawn-types.js';
185
-
186
- // === WarpChain Types ===
178
+ // === Status Registry (MUST be first — everything depends on this) ===
179
+ export {
180
+ ADR_STATUSES,
181
+ type AdrStatus,
182
+ // Registry
183
+ type EntityType,
184
+ GATE_STATUSES,
185
+ type GateStatus,
186
+ isValidStatus,
187
+ LIFECYCLE_PIPELINE_STATUSES,
188
+ LIFECYCLE_STAGE_STATUSES,
189
+ MANIFEST_STATUSES,
190
+ type ManifestStatus,
191
+ // Display icons
192
+ PIPELINE_STATUS_ICONS,
193
+ type PipelineStatus,
194
+ SESSION_STATUSES,
195
+ type SessionStatus,
196
+ STAGE_STATUS_ICONS,
197
+ STATUS_REGISTRY,
198
+ type StageStatus,
199
+ TASK_STATUS_SYMBOLS_ASCII,
200
+ TASK_STATUS_SYMBOLS_UNICODE,
201
+ // Constants
202
+ TASK_STATUSES,
203
+ // Derived types
204
+ type TaskStatus,
205
+ TERMINAL_PIPELINE_STATUSES,
206
+ TERMINAL_STAGE_STATUSES,
207
+ // Terminal state sets
208
+ TERMINAL_TASK_STATUSES,
209
+ } from './status-registry.js';
210
+ // === Task Types ===
187
211
  export type {
188
- ProtocolType,
189
- GateName,
190
- WarpStage,
191
- WarpLink,
192
- ChainShape,
193
- GateCheck,
194
- GateContract,
195
- WarpChain,
196
- ChainValidation,
197
- WarpChainInstance,
198
- GateResult,
199
- WarpChainExecution,
200
- } from './warp-chain.js';
201
-
212
+ CancelledTask,
213
+ CompletedTask,
214
+ EpicLifecycle,
215
+ FileMeta,
216
+ Phase,
217
+ PhaseStatus,
218
+ PhaseTransition,
219
+ ProjectMeta,
220
+ Release,
221
+ ReleaseStatus,
222
+ SessionNote,
223
+ Task,
224
+ TaskCreate,
225
+ TaskFile,
226
+ TaskOrigin,
227
+ TaskPriority,
228
+ TaskProvenance,
229
+ TaskRelation,
230
+ TaskSize,
231
+ TaskType,
232
+ TaskVerification,
233
+ TaskWorkState,
234
+ VerificationAgent,
235
+ VerificationFailure,
236
+ VerificationGate,
237
+ } from './task.js';
238
+ // === TaskRecord Types (string-widened for dispatch/LAFS) ===
239
+ export type {
240
+ MinimalTaskRecord,
241
+ TaskRecord,
242
+ TaskRecordRelation,
243
+ ValidationHistoryEntry,
244
+ } from './task-record.js';
245
+ // === Task Sync Types (provider-agnostic reconciliation) ===
246
+ export type {
247
+ AdapterTaskSyncProvider,
248
+ ConflictPolicy,
249
+ ExternalTask,
250
+ ExternalTaskStatus,
251
+ ReconcileAction,
252
+ ReconcileActionType,
253
+ ReconcileOptions,
254
+ ReconcileResult,
255
+ SyncSessionState,
256
+ } from './task-sync.js';
202
257
  // === Tessera Types ===
203
258
  export type {
204
- TesseraVariable,
205
- TesseraTemplate,
206
259
  TesseraInstantiationInput,
260
+ TesseraTemplate,
261
+ TesseraVariable,
207
262
  } from './tessera.js';
208
-
209
- // === Archive Types ===
210
- export type {
211
- ArchiveMetadata,
212
- ArchivedTask,
213
- ArchiveReportType,
214
- ArchiveSummaryReport,
215
- ArchivePhaseEntry,
216
- ArchiveLabelEntry,
217
- ArchivePriorityEntry,
218
- CycleTimeDistribution,
219
- CycleTimePercentiles,
220
- ArchiveCycleTimesReport,
221
- ArchiveDailyTrend,
222
- ArchiveMonthlyTrend,
223
- ArchiveTrendsReport,
224
- ArchiveStatsEnvelope,
225
- } from './archive.js';
226
-
227
263
  // === TodoWrite Types (deprecated — use task-sync types) ===
228
264
  export type {
229
- TodoWriteItemStatus,
265
+ TodoWriteChange,
266
+ TodoWriteChangeAction,
267
+ TodoWriteChangeSet,
230
268
  TodoWriteItem,
269
+ TodoWriteItemStatus,
270
+ TodoWriteMergeResult,
231
271
  TodoWriteState,
232
272
  TodoWriteSyncSessionState,
233
- TodoWriteChangeSet,
234
- TodoWriteChangeAction,
235
- TodoWriteChange,
236
- TodoWriteMergeResult,
237
273
  } from './todowrite.js';
238
-
239
- // === Task Sync Types (provider-agnostic reconciliation) ===
240
- export type {
241
- ExternalTaskStatus,
242
- ExternalTask,
243
- SyncSessionState,
244
- ConflictPolicy,
245
- ReconcileOptions,
246
- ReconcileActionType,
247
- ReconcileAction,
248
- ReconcileResult,
249
- AdapterTaskSyncProvider,
250
- } from './task-sync.js';
251
-
252
- // === Result Types (Dashboard, Stats, Log, Context, Sequence, Analysis, Deps) ===
253
- export type {
254
- TaskSummary,
255
- LabelCount,
256
- DashboardResult,
257
- StatsCurrentState,
258
- StatsCompletionMetrics,
259
- StatsActivityMetrics,
260
- StatsAllTime,
261
- StatsCycleTimes,
262
- StatsResult,
263
- LogQueryResult,
264
- ContextResult,
265
- SequenceResult,
266
- TaskRef,
267
- TaskRefPriority,
268
- LeveragedTask,
269
- BottleneckTask,
270
- TaskAnalysisResult,
271
- TaskDepsResult,
272
- CompleteTaskUnblocked,
273
- } from './results.js';
274
-
275
- // === Brain/Memory Types ===
276
- export type {
277
- BrainEntryRef,
278
- BrainEntrySummary,
279
- ContradictionDetail,
280
- SupersededEntry,
281
- } from './brain.js';
282
-
283
- // === TaskRecord Types (string-widened for dispatch/LAFS) ===
274
+ export type { AdapterTransportProvider } from './transport.js';
275
+ // === WarpChain Types ===
284
276
  export type {
285
- TaskRecordRelation,
286
- ValidationHistoryEntry,
287
- TaskRecord,
288
- MinimalTaskRecord,
289
- } from './task-record.js';
290
-
291
- // === Session Start Result ===
292
- export type { SessionStartResult } from './session.js';
293
-
294
- // === Operations Types (API wire format, namespaced to avoid collision with domain types) ===
295
- export * as ops from './operations/index.js';
296
-
297
- // Commonly used ops types re-exported at top level for convenience
298
- export type { BrainState } from './operations/orchestrate.js';
277
+ ChainShape,
278
+ ChainValidation,
279
+ GateCheck,
280
+ GateContract,
281
+ GateName,
282
+ GateResult,
283
+ ProtocolType,
284
+ WarpChain,
285
+ WarpChainExecution,
286
+ WarpChainInstance,
287
+ WarpLink,
288
+ WarpStage,
289
+ } from './warp-chain.js';
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { StageStatus } from '../status-registry.js';
9
+
9
10
  export type { StageStatus };
10
11
 
11
12
  /**
@@ -14,6 +14,7 @@
14
14
  * Common task types (API contract — matches CLI src/types/task.ts)
15
15
  */
16
16
  import type { TaskStatus } from '../status-registry.js';
17
+
17
18
  export type { TaskStatus };
18
19
  export type TaskPriority = 'low' | 'medium' | 'high' | 'critical';
19
20
 
package/src/session.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import type { SessionStatus } from './status-registry.js';
11
+
11
12
  export type { SessionStatus };
12
13
 
13
14
  /** Session scope JSON blob shape. */
package/src/spawn.ts CHANGED
@@ -29,4 +29,6 @@ export interface SpawnResult {
29
29
  status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
30
30
  startTime: string;
31
31
  endTime?: string;
32
+ /** Error message when status is 'failed'. Contains details about what went wrong. */
33
+ error?: string;
32
34
  }
package/src/task-sync.ts CHANGED
@@ -90,7 +90,13 @@ export interface ReconcileOptions {
90
90
  }
91
91
 
92
92
  /** The type of action the reconciliation engine will take. */
93
- export type ReconcileActionType = 'complete' | 'activate' | 'create' | 'remove' | 'skip' | 'conflict';
93
+ export type ReconcileActionType =
94
+ | 'complete'
95
+ | 'activate'
96
+ | 'create'
97
+ | 'remove'
98
+ | 'skip'
99
+ | 'conflict';
94
100
 
95
101
  /** A single reconciliation action (planned or applied). */
96
102
  export interface ReconcileAction {
@@ -156,7 +162,10 @@ export interface AdapterTaskSyncProvider {
156
162
  * @param tasks - Current CLEO tasks to push.
157
163
  * @param projectDir - Project root directory.
158
164
  */
159
- pushTaskState?(tasks: ReadonlyArray<{ id: string; title: string; status: string }>, projectDir: string): Promise<void>;
165
+ pushTaskState?(
166
+ tasks: ReadonlyArray<{ id: string; title: string; status: string }>,
167
+ projectDir: string,
168
+ ): Promise<void>;
160
169
 
161
170
  /**
162
171
  * Clean up provider-specific sync artifacts (e.g. state files).
package/src/task.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import type { TaskStatus } from './status-registry.js';
25
+
25
26
  export type { TaskStatus };
26
27
 
27
28
  /** Task priority levels. */