@cleocode/contracts 2026.3.38 → 2026.3.40

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,275 @@
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 ===
187
- 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
-
202
- // === Tessera Types ===
203
- export type {
204
- TesseraVariable,
205
- TesseraTemplate,
206
- TesseraInstantiationInput,
207
- } from './tessera.js';
208
-
209
- // === Archive 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 ===
210
211
  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
- // === TodoWrite Types (deprecated — use task-sync types) ===
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) ===
228
239
  export type {
229
- TodoWriteItemStatus,
230
- TodoWriteItem,
231
- TodoWriteState,
232
- TodoWriteSyncSessionState,
233
- TodoWriteChangeSet,
234
- TodoWriteChangeAction,
235
- TodoWriteChange,
236
- TodoWriteMergeResult,
237
- } from './todowrite.js';
238
-
240
+ MinimalTaskRecord,
241
+ TaskRecord,
242
+ TaskRecordRelation,
243
+ ValidationHistoryEntry,
244
+ } from './task-record.js';
239
245
  // === Task Sync Types (provider-agnostic reconciliation) ===
240
246
  export type {
241
- ExternalTaskStatus,
242
- ExternalTask,
243
- SyncSessionState,
244
247
  ConflictPolicy,
245
- ReconcileOptions,
246
- ReconcileActionType,
248
+ ExternalLinkType,
249
+ ExternalTask,
250
+ ExternalTaskLink,
251
+ ExternalTaskProvider,
252
+ ExternalTaskStatus,
247
253
  ReconcileAction,
254
+ ReconcileActionType,
255
+ ReconcileOptions,
248
256
  ReconcileResult,
249
- AdapterTaskSyncProvider,
257
+ SyncDirection,
250
258
  } 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 ===
259
+ // === Tessera Types ===
276
260
  export type {
277
- BrainEntryRef,
278
- BrainEntrySummary,
279
- ContradictionDetail,
280
- SupersededEntry,
281
- } from './brain.js';
282
-
283
- // === TaskRecord Types (string-widened for dispatch/LAFS) ===
261
+ TesseraInstantiationInput,
262
+ TesseraTemplate,
263
+ TesseraVariable,
264
+ } from './tessera.js';
265
+ export type { AdapterTransportProvider } from './transport.js';
266
+ // === WarpChain Types ===
284
267
  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';
268
+ ChainShape,
269
+ ChainValidation,
270
+ GateCheck,
271
+ GateContract,
272
+ GateName,
273
+ GateResult,
274
+ ProtocolType,
275
+ WarpChain,
276
+ WarpChainExecution,
277
+ WarpChainInstance,
278
+ WarpLink,
279
+ WarpStage,
280
+ } 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
  }