@cleocode/contracts 2026.4.151 → 2026.4.152
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 +149 -405
- package/dist/facade.d.ts +2 -0
- package/dist/facade.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/operations/admin.d.ts +0 -70
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/index.d.ts +2 -0
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +2 -0
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/nexus.d.ts +31 -1
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/pipeline.d.ts +15 -0
- package/dist/operations/pipeline.d.ts.map +1 -0
- package/dist/operations/pipeline.js +15 -0
- package/dist/operations/pipeline.js.map +1 -0
- package/dist/operations/session.d.ts +3 -0
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +10 -271
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js +10 -3
- package/dist/operations/tasks.js.map +1 -1
- package/package.json +9 -1
- package/src/facade.ts +2 -0
- package/src/index.ts +1 -1
- package/src/operations/admin.ts +0 -88
- package/src/operations/index.ts +2 -0
- package/src/operations/nexus.ts +31 -1
- package/src/operations/pipeline.ts +13 -0
- package/src/operations/session.ts +3 -0
- package/src/operations/tasks.ts +10 -309
package/README.md
CHANGED
|
@@ -1,491 +1,235 @@
|
|
|
1
1
|
# @cleocode/contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Canonical wire-format type surface for the CLEO ecosystem. All operation `Params`/`Result` types, domain discriminated unions, LAFS envelope types, and shared primitives live here — making this package the **SSoT** (single source of truth) for every CLEO dispatch operation.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Position in the Architecture
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`@cleocode/contracts` is the **leaf package** in the CLEO dependency graph — it has zero runtime dependencies. Every other CLEO package imports from here; nothing here imports from them.
|
|
8
8
|
|
|
9
|
-
All domain types (Task, Session, DataAccessor, etc.) are defined here. Implementation packages (`@cleocode/core`, `@cleocode/cleo`) import from here.
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @cleocode/contracts
|
|
15
9
|
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
packages/contracts/ ← wire-format SSoT (this package)
|
|
11
|
+
└── src/operations/ ← <Domain>Ops discriminated unions + Params/Result types
|
|
12
|
+
packages/core/ ← SDK implementation (imports Params/Result from here)
|
|
13
|
+
packages/cleo/ ← CLI dispatch (imports XOps + OpsFromCore from here)
|
|
14
|
+
packages/cleo-os/ ← harness adapters (imports adapter contracts from here)
|
|
15
|
+
packages/studio/ ← Studio routes (imports operation types from here)
|
|
19
16
|
```
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
yarn add @cleocode/contracts
|
|
23
|
-
```
|
|
18
|
+
Per **ADR-057** (Contracts/Core SSoT layering), every Core function that backs a dispatch operation MUST import its `<Op>Params` and `<Op>Result` types from this package. Per **ADR-058** (Dispatch Type Inference via `OpsFromCore<C>`), dispatch handlers derive their full type-safety from these contracts rather than declaring parallel types inline.
|
|
24
19
|
|
|
25
|
-
##
|
|
20
|
+
## The `<Op>Params` / `<Op>Result` Pattern
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
Each dispatch-ready operation is represented by a pair of types:
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
- **`<Op>Params`** — the wire-format input shape the CLI/Studio/SDK sends to Core.
|
|
25
|
+
- **`<Op>Result`** — the wire-format output shape Core returns (wrapped in a `LafsEnvelope`).
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
import type {
|
|
33
|
-
Task,
|
|
34
|
-
TaskCreate,
|
|
35
|
-
TaskPriority,
|
|
36
|
-
TaskStatus,
|
|
37
|
-
TaskType,
|
|
38
|
-
TaskSize,
|
|
39
|
-
EpicLifecycle,
|
|
40
|
-
Phase,
|
|
41
|
-
PhaseStatus,
|
|
42
|
-
PhaseTransition,
|
|
43
|
-
VerificationGate,
|
|
44
|
-
TaskVerification,
|
|
45
|
-
TaskWorkState
|
|
46
|
-
} from '@cleocode/contracts';
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
#### Session Types
|
|
27
|
+
These pairs are collected into a **`<Domain>Ops` discriminated union** (a plain TypeScript record type). The union maps operation names to `readonly [Params, Result]` tuples:
|
|
50
28
|
|
|
51
29
|
```typescript
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
30
|
+
// packages/contracts/src/operations/tasks.ts
|
|
31
|
+
export type TasksOps = {
|
|
32
|
+
readonly show: readonly [TasksShowParams, TasksShowResult];
|
|
33
|
+
readonly list: readonly [TasksListParams, TasksListResult];
|
|
34
|
+
readonly find: readonly [TasksFindParams, TasksFindResult];
|
|
35
|
+
readonly add: readonly [TasksAddParams, TasksAddResult];
|
|
36
|
+
readonly update: readonly [TasksUpdateQueryParams, TasksUpdateQueryResult];
|
|
37
|
+
readonly complete: readonly [TasksCompleteQueryParams, TasksCompleteQueryResult];
|
|
38
|
+
// ... (all operations in the tasks domain)
|
|
39
|
+
};
|
|
60
40
|
```
|
|
61
41
|
|
|
62
|
-
|
|
42
|
+
The dispatch layer uses `TypedDomainHandler<TasksOps>` to get compile-time narrowing on every branch. When a Params or Result type changes in this file, TypeScript surfaces the break immediately at every call site — no silent drift.
|
|
63
43
|
|
|
64
|
-
|
|
65
|
-
import type {
|
|
66
|
-
BrainEntryRef,
|
|
67
|
-
BrainEntrySummary,
|
|
68
|
-
ContradictionDetail,
|
|
69
|
-
SupersededEntry,
|
|
70
|
-
MemoryBridgeConfig,
|
|
71
|
-
MemoryBridgeContent,
|
|
72
|
-
BridgeDecision,
|
|
73
|
-
BridgeLearning,
|
|
74
|
-
BridgeObservation,
|
|
75
|
-
BridgePattern,
|
|
76
|
-
SessionSummary
|
|
77
|
-
} from '@cleocode/contracts';
|
|
78
|
-
```
|
|
44
|
+
### `OpsFromCore<C>` — Inference Helper
|
|
79
45
|
|
|
80
|
-
|
|
46
|
+
For domains where Core functions already follow the ADR-057 D1 uniform signature (`async fn(projectRoot: string, params: <Op>Params): Promise<<Op>Result>`), the dispatch layer can skip writing a manual `<Domain>Ops` type. Instead it uses `OpsFromCore<C>` (defined in `packages/cleo/src/dispatch/adapters/typed.ts`, introduced in T1436) to **infer** the Params/Result pairs directly from the Core function signatures:
|
|
81
47
|
|
|
82
48
|
```typescript
|
|
83
|
-
import type {
|
|
84
|
-
|
|
85
|
-
TransactionAccessor,
|
|
86
|
-
TaskQueryFilters,
|
|
87
|
-
QueryTasksResult,
|
|
88
|
-
TaskFieldUpdates,
|
|
89
|
-
ArchiveFields,
|
|
90
|
-
ArchiveFile
|
|
91
|
-
} from '@cleocode/contracts';
|
|
92
|
-
```
|
|
49
|
+
import type { OpsFromCore } from '@cleocode/cleo/dispatch/adapters/typed';
|
|
50
|
+
import * as taskCore from '@cleocode/core/tasks';
|
|
93
51
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
import {
|
|
100
|
-
TASK_STATUSES,
|
|
101
|
-
SESSION_STATUSES,
|
|
102
|
-
LIFECYCLE_STAGE_STATUSES,
|
|
103
|
-
LIFECYCLE_PIPELINE_STATUSES,
|
|
104
|
-
GATE_STATUSES,
|
|
105
|
-
ADR_STATUSES,
|
|
106
|
-
MANIFEST_STATUSES,
|
|
107
|
-
isValidStatus,
|
|
108
|
-
STATUS_REGISTRY,
|
|
109
|
-
TASK_STATUS_SYMBOLS_ASCII,
|
|
110
|
-
TASK_STATUS_SYMBOLS_UNICODE,
|
|
111
|
-
PIPELINE_STATUS_ICONS,
|
|
112
|
-
STAGE_STATUS_ICONS,
|
|
113
|
-
TERMINAL_TASK_STATUSES,
|
|
114
|
-
TERMINAL_STAGE_STATUSES,
|
|
115
|
-
TERMINAL_PIPELINE_STATUSES
|
|
116
|
-
} from '@cleocode/contracts';
|
|
52
|
+
// Automatically derives TasksOps-equivalent types from Core's signatures.
|
|
53
|
+
type InferredTasksOps = OpsFromCore<typeof taskCore>;
|
|
54
|
+
```
|
|
117
55
|
|
|
118
|
-
|
|
119
|
-
const isValid = isValidStatus('task', 'in_progress');
|
|
56
|
+
The contracts package supplies the `Params`/`Result` types that Core functions are annotated with — so `OpsFromCore<C>` and the hand-written `<Domain>Ops` type stay in sync automatically.
|
|
120
57
|
|
|
121
|
-
|
|
122
|
-
const icon = TASK_STATUS_SYMBOLS_UNICODE['completed'];
|
|
123
|
-
```
|
|
58
|
+
See **ADR-058** for the full migration recipe, tier classification (thin wrapper / engine wrapper / manual `TypedOpRecord`), and escape hatches.
|
|
124
59
|
|
|
125
|
-
|
|
60
|
+
## Usage Examples
|
|
126
61
|
|
|
127
|
-
|
|
62
|
+
### 1. Importing operation types for a tasks domain handler
|
|
128
63
|
|
|
129
64
|
```typescript
|
|
130
|
-
import {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
isNoChangeCode
|
|
65
|
+
import type {
|
|
66
|
+
TasksOps,
|
|
67
|
+
TasksAddParams,
|
|
68
|
+
TasksAddResult,
|
|
69
|
+
TasksShowParams,
|
|
70
|
+
TasksShowResult,
|
|
137
71
|
} from '@cleocode/contracts';
|
|
138
72
|
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
73
|
+
// Use in a TypedDomainHandler — params/result are compile-time checked.
|
|
74
|
+
async function addTask(
|
|
75
|
+
projectRoot: string,
|
|
76
|
+
params: TasksAddParams,
|
|
77
|
+
): Promise<TasksAddResult> {
|
|
78
|
+
// ...implementation...
|
|
142
79
|
}
|
|
143
80
|
```
|
|
144
81
|
|
|
145
|
-
###
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
import type {
|
|
149
|
-
CleoConfig,
|
|
150
|
-
ConfigSource,
|
|
151
|
-
LogLevel,
|
|
152
|
-
LoggingConfig,
|
|
153
|
-
SessionConfig,
|
|
154
|
-
LifecycleConfig,
|
|
155
|
-
LifecycleEnforcementMode,
|
|
156
|
-
EnforcementProfile,
|
|
157
|
-
SharingConfig,
|
|
158
|
-
SharingMode,
|
|
159
|
-
SignalDockConfig,
|
|
160
|
-
SignalDockMode,
|
|
161
|
-
OutputConfig,
|
|
162
|
-
OutputFormat,
|
|
163
|
-
DateFormat,
|
|
164
|
-
BackupConfig,
|
|
165
|
-
HierarchyConfig,
|
|
166
|
-
ResolvedValue
|
|
167
|
-
} from '@cleocode/contracts';
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### LAFS (Language-Agnostic Feedback Schema)
|
|
171
|
-
|
|
172
|
-
Standardized envelope format for API responses:
|
|
82
|
+
### 2. Importing session operation types and the `SessionOps` union
|
|
173
83
|
|
|
174
84
|
```typescript
|
|
175
|
-
import type {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
LAFSPageOffset,
|
|
182
|
-
LAFSPageNone,
|
|
183
|
-
LAFSMeta,
|
|
184
|
-
MVILevel,
|
|
185
|
-
Warning,
|
|
186
|
-
LafsAlternative,
|
|
187
|
-
CleoResponse,
|
|
188
|
-
GatewayEnvelope,
|
|
189
|
-
GatewaySuccess,
|
|
190
|
-
GatewayError,
|
|
191
|
-
GatewayMeta,
|
|
192
|
-
ConformanceReport,
|
|
193
|
-
FlagInput,
|
|
194
|
-
LAFSError,
|
|
195
|
-
LAFSErrorCategory,
|
|
196
|
-
LAFSTransport
|
|
197
|
-
} from '@cleocode/contracts';
|
|
198
|
-
|
|
199
|
-
import {
|
|
200
|
-
isLafsSuccess,
|
|
201
|
-
isLafsError,
|
|
202
|
-
isGatewayEnvelope
|
|
85
|
+
import type {
|
|
86
|
+
SessionOps,
|
|
87
|
+
SessionStartParams,
|
|
88
|
+
SessionStartResult,
|
|
89
|
+
SessionEndParams,
|
|
90
|
+
SessionEndResult,
|
|
203
91
|
} from '@cleocode/contracts';
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Provider Adapter Contracts
|
|
207
92
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
AdapterCapabilities,
|
|
213
|
-
AdapterContextMonitorProvider,
|
|
214
|
-
AdapterHookProvider,
|
|
215
|
-
AdapterInstallProvider,
|
|
216
|
-
InstallOptions,
|
|
217
|
-
InstallResult,
|
|
218
|
-
AdapterSpawnProvider,
|
|
219
|
-
SpawnContext,
|
|
220
|
-
SpawnResult,
|
|
221
|
-
AdapterTransportProvider,
|
|
222
|
-
AdapterPathProvider,
|
|
223
|
-
AdapterTaskSyncProvider,
|
|
224
|
-
ExternalTask,
|
|
225
|
-
ExternalTaskStatus,
|
|
226
|
-
ReconcileAction,
|
|
227
|
-
ReconcileActionType,
|
|
228
|
-
ReconcileOptions,
|
|
229
|
-
ReconcileResult,
|
|
230
|
-
SyncSessionState,
|
|
231
|
-
ConflictPolicy
|
|
232
|
-
} from '@cleocode/contracts';
|
|
93
|
+
// SessionOps is the discriminated union consumed by TypedDomainHandler<SessionOps>.
|
|
94
|
+
// Keying into it gives the exact [Params, Result] tuple for each operation.
|
|
95
|
+
type StartTuple = SessionOps['start'];
|
|
96
|
+
// ^ readonly [SessionStartParams, SessionStartResult]
|
|
233
97
|
```
|
|
234
98
|
|
|
235
|
-
###
|
|
236
|
-
|
|
237
|
-
Provider-agnostic reconciliation types:
|
|
99
|
+
### 3. Working with LAFS envelopes and exit codes
|
|
238
100
|
|
|
239
101
|
```typescript
|
|
240
|
-
import
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
ReconcileResult,
|
|
247
|
-
SyncSessionState,
|
|
248
|
-
ConflictPolicy
|
|
102
|
+
import {
|
|
103
|
+
isLafsSuccess,
|
|
104
|
+
isLafsError,
|
|
105
|
+
ExitCode,
|
|
106
|
+
isSuccessCode,
|
|
107
|
+
type LafsEnvelope,
|
|
249
108
|
} from '@cleocode/contracts';
|
|
250
|
-
```
|
|
251
109
|
|
|
252
|
-
|
|
110
|
+
function handleCLIResponse(response: LafsEnvelope<unknown>, code: number): void {
|
|
111
|
+
if (isLafsSuccess(response)) {
|
|
112
|
+
console.log('data:', response.data);
|
|
113
|
+
} else if (isLafsError(response)) {
|
|
114
|
+
console.error('error:', response.error.message);
|
|
115
|
+
}
|
|
253
116
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
ArchiveSummaryReport,
|
|
259
|
-
ArchiveTrendsReport,
|
|
260
|
-
ArchiveCycleTimesReport,
|
|
261
|
-
ArchiveStatsEnvelope,
|
|
262
|
-
ArchiveReportType,
|
|
263
|
-
ArchiveDailyTrend,
|
|
264
|
-
ArchiveMonthlyTrend,
|
|
265
|
-
ArchiveLabelEntry,
|
|
266
|
-
ArchivePhaseEntry,
|
|
267
|
-
ArchivePriorityEntry,
|
|
268
|
-
CycleTimeDistribution,
|
|
269
|
-
CycleTimePercentiles
|
|
270
|
-
} from '@cleocode/contracts';
|
|
117
|
+
if (!isSuccessCode(code)) {
|
|
118
|
+
process.exit(code);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
271
121
|
```
|
|
272
122
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
Dashboard and statistics results:
|
|
123
|
+
## Versioning Policy
|
|
276
124
|
|
|
277
|
-
|
|
278
|
-
import type {
|
|
279
|
-
DashboardResult,
|
|
280
|
-
StatsResult,
|
|
281
|
-
StatsActivityMetrics,
|
|
282
|
-
StatsAllTime,
|
|
283
|
-
StatsCompletionMetrics,
|
|
284
|
-
StatsCurrentState,
|
|
285
|
-
StatsCycleTimes,
|
|
286
|
-
ContextResult,
|
|
287
|
-
LogQueryResult,
|
|
288
|
-
SequenceResult,
|
|
289
|
-
TaskDepsResult,
|
|
290
|
-
TaskAnalysisResult,
|
|
291
|
-
TaskRef,
|
|
292
|
-
TaskRefPriority,
|
|
293
|
-
TaskSummary,
|
|
294
|
-
LabelCount,
|
|
295
|
-
CompleteTaskUnblocked,
|
|
296
|
-
BottleneckTask,
|
|
297
|
-
LeveragedTask
|
|
298
|
-
} from '@cleocode/contracts';
|
|
299
|
-
```
|
|
125
|
+
`@cleocode/contracts` follows **CalVer `YYYY.MM.patch`** (e.g., `2026.4.151`). The version is the calendar position of the release, not a semantic compatibility signal. Breaking changes to operation types (renamed fields, removed Params properties) are tracked via ADR entries and announced in the CHANGELOG. Consumers should pin to a specific version and review the CHANGELOG on upgrades.
|
|
300
126
|
|
|
301
|
-
|
|
127
|
+
The package is published to npm with `"access": "public"` — see `publishConfig` in `package.json`. It is **not** marked `"private"`.
|
|
302
128
|
|
|
303
|
-
|
|
129
|
+
## Sub-path Exports
|
|
304
130
|
|
|
305
|
-
|
|
306
|
-
import type {
|
|
307
|
-
TaskRecord,
|
|
308
|
-
MinimalTaskRecord,
|
|
309
|
-
TaskRecordRelation,
|
|
310
|
-
ValidationHistoryEntry
|
|
311
|
-
} from '@cleocode/contracts';
|
|
312
|
-
```
|
|
131
|
+
The package exposes several sub-path entry points in addition to the root `"."`:
|
|
313
132
|
|
|
314
|
-
|
|
133
|
+
| Sub-path | Contents |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `.` (root) | All domain types, LAFS envelope types, exit codes, status registry, and re-exported operation types (`ops.*`, `TasksOps`, `SessionOps`, …) |
|
|
136
|
+
| `./operations/*` | Individual operation files by domain (e.g., `./operations/tasks`, `./operations/session`) |
|
|
137
|
+
| `./nexus-contract-ops` | Nexus contract operation types |
|
|
138
|
+
| `./nexus-living-brain-ops` | BRAIN super-domain living-brain operation types |
|
|
139
|
+
| `./nexus-query-ops` | Nexus query operation types |
|
|
140
|
+
| `./nexus-route-ops` | Nexus route operation types |
|
|
141
|
+
| `./nexus-tasks-bridge-ops` | Nexus–Tasks bridge operation types |
|
|
315
142
|
|
|
316
|
-
|
|
143
|
+
Example:
|
|
317
144
|
|
|
318
145
|
```typescript
|
|
319
|
-
import
|
|
320
|
-
|
|
321
|
-
CLEOSpawnContext,
|
|
322
|
-
CLEOSpawnResult,
|
|
323
|
-
CAAMPSpawnOptions,
|
|
324
|
-
CAAMPSpawnResult,
|
|
325
|
-
Provider,
|
|
326
|
-
SpawnStatus,
|
|
327
|
-
TokenResolution
|
|
328
|
-
} from '@cleocode/contracts';
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Tessera Types
|
|
332
|
-
|
|
333
|
-
Template instantiation types:
|
|
146
|
+
// Root import — preferred for most consumers
|
|
147
|
+
import type { TasksOps, TasksAddParams } from '@cleocode/contracts';
|
|
334
148
|
|
|
335
|
-
|
|
336
|
-
import type {
|
|
337
|
-
TesseraTemplate,
|
|
338
|
-
TesseraVariable,
|
|
339
|
-
TesseraInstantiationInput
|
|
340
|
-
} from '@cleocode/contracts';
|
|
149
|
+
// Sub-path import — useful when you need tree-shaking at the type level
|
|
150
|
+
import type { TasksOps } from '@cleocode/contracts/operations/tasks';
|
|
341
151
|
```
|
|
342
152
|
|
|
343
|
-
|
|
153
|
+
## ADR Cross-References
|
|
344
154
|
|
|
345
|
-
|
|
155
|
+
| ADR | Topic |
|
|
156
|
+
|---|---|
|
|
157
|
+
| [ADR-057](../../docs/adr/ADR-057-contracts-core-ssot.md) | Contracts/Core SSoT layering — uniform `(projectRoot, params)` Core API and `OpsFromCore`-inferred dispatch |
|
|
158
|
+
| [ADR-058](../../docs/adr/ADR-058-dispatch-type-inference.md) | Dispatch type inference via `OpsFromCore<C>` — pattern, migration recipe, escape hatches |
|
|
159
|
+
| [ADR-039](../../docs/adr/ADR-039-lafs-envelope-spec.md) | LAFS envelope format — `LafsEnvelope<T>`, `LafsSuccess`, `LafsError` |
|
|
160
|
+
| [ADR-056](../../docs/adr/ADR-056-db-ssot.md) | DB SSoT layering (supplements the contracts SSoT for storage types) |
|
|
346
161
|
|
|
347
|
-
|
|
348
|
-
import type {
|
|
349
|
-
WarpChain,
|
|
350
|
-
WarpChainInstance,
|
|
351
|
-
WarpChainExecution,
|
|
352
|
-
WarpStage,
|
|
353
|
-
WarpLink,
|
|
354
|
-
GateContract,
|
|
355
|
-
GateName,
|
|
356
|
-
GateCheck,
|
|
357
|
-
GateResult,
|
|
358
|
-
ChainValidation,
|
|
359
|
-
ChainShape,
|
|
360
|
-
ProtocolType
|
|
361
|
-
} from '@cleocode/contracts';
|
|
362
|
-
```
|
|
162
|
+
## API Overview
|
|
363
163
|
|
|
364
|
-
###
|
|
164
|
+
### Operation Types (Wire Format)
|
|
365
165
|
|
|
366
|
-
All
|
|
166
|
+
All domains follow the `<Op>Params` / `<Op>Result` naming convention. Available domain operation files under `src/operations/`:
|
|
367
167
|
|
|
368
|
-
|
|
369
|
-
|
|
168
|
+
| Domain file | `XOps` type | Description |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `tasks.ts` | `TasksOps` | Task CRUD, query, lifecycle, sync, claim |
|
|
171
|
+
| `session.ts` | `SessionOps` | Session start/end/resume, briefing, handoff |
|
|
172
|
+
| `brain.ts` | — | BRAIN super-graph wire types |
|
|
173
|
+
| `memory.ts` | `MemoryOps` | Observations, patterns, decisions, tiers |
|
|
174
|
+
| `nexus.ts` | `NexusOps` | Code intelligence, wiki, impact |
|
|
175
|
+
| `lifecycle.ts` | `LifecycleOps` | Epic lifecycle pipeline stages |
|
|
176
|
+
| `orchestrate.ts` | `OrchestrateOps` | Multi-agent spawn, wave, IVTR, playbook |
|
|
177
|
+
| `pipeline.ts` | — | LOOM pipeline wave types |
|
|
178
|
+
| `admin.ts` | `AdminOps` | Backup, restore, export, import |
|
|
179
|
+
| `validate.ts` | `CheckOps` | Evidence gates, verification |
|
|
180
|
+
| `release.ts` | `ReleaseOps` | CalVer release and tag |
|
|
181
|
+
| `sentient.ts` | `SentientOps` | Tier-2 proposal management |
|
|
182
|
+
| `conduit.ts` | `ConduitOps` | Messaging transport |
|
|
183
|
+
| `research.ts` | `ResearchOps` | LOOM research stage |
|
|
184
|
+
| `skills.ts` | `SkillsOps` | Agent skill management |
|
|
185
|
+
| `playbook.ts` | `PlaybookOps` | `.cantbook` playbook execution |
|
|
186
|
+
| `worktree.ts` | `WorktreeOps` | Git worktree provisioning |
|
|
187
|
+
| `issues.ts` | `IssuesOps` | GitHub issue sync |
|
|
188
|
+
| `system.ts` | `SystemOps` | System health and diagnostics |
|
|
189
|
+
| `sticky.ts` | `StickyOps` | Sticky note capture |
|
|
370
190
|
|
|
371
|
-
|
|
372
|
-
const taskParams: ops.TaskQueryParams = { ... };
|
|
373
|
-
const createParams: ops.TaskCreateParams = { ... };
|
|
374
|
-
```
|
|
191
|
+
### LAFS Envelope Types
|
|
375
192
|
|
|
376
|
-
|
|
377
|
-
- `ops.TaskQueryParams`
|
|
378
|
-
- `ops.TaskCreateParams`
|
|
379
|
-
- `ops.TaskUpdateParams`
|
|
380
|
-
- `ops.TaskCompleteParams`
|
|
381
|
-
- `ops.SessionStartParams`
|
|
382
|
-
- `ops.SessionEndParams`
|
|
383
|
-
- `ops.MemoryObserveParams`
|
|
384
|
-
- `ops.MemorySearchParams`
|
|
385
|
-
- `ops.BrainQueryParams`
|
|
386
|
-
- `ops.ValidateParams`
|
|
387
|
-
- `ops.ReleaseParams`
|
|
388
|
-
- `ops.OrchestrateParams`
|
|
389
|
-
- `ops.ResearchParams`
|
|
390
|
-
- `ops.SkillsParams`
|
|
391
|
-
- `ops.SystemParams`
|
|
392
|
-
- `ops.IssuesParams`
|
|
393
|
-
- And more...
|
|
394
|
-
|
|
395
|
-
### Discovery Types
|
|
396
|
-
|
|
397
|
-
Provider manifest discovery:
|
|
193
|
+
Standardized response envelope (per ADR-039):
|
|
398
194
|
|
|
399
195
|
```typescript
|
|
400
|
-
import type {
|
|
401
|
-
|
|
402
|
-
DetectionPattern
|
|
403
|
-
} from '@cleocode/contracts';
|
|
196
|
+
import type { LafsEnvelope, LafsSuccess, LafsError } from '@cleocode/contracts';
|
|
197
|
+
import { isLafsSuccess, isLafsError } from '@cleocode/contracts';
|
|
404
198
|
```
|
|
405
199
|
|
|
406
|
-
###
|
|
200
|
+
### Core Domain Types
|
|
407
201
|
|
|
408
202
|
```typescript
|
|
409
|
-
import type {
|
|
410
|
-
|
|
203
|
+
import type {
|
|
204
|
+
Task, TaskCreate, TaskPriority, TaskStatus, TaskType, TaskSize,
|
|
205
|
+
Session, SessionScope,
|
|
206
|
+
DataAccessor, TransactionAccessor,
|
|
207
|
+
CleoConfig,
|
|
208
|
+
BrainEntryRef,
|
|
209
|
+
CLEOProviderAdapter,
|
|
411
210
|
} from '@cleocode/contracts';
|
|
412
211
|
```
|
|
413
212
|
|
|
414
|
-
###
|
|
213
|
+
### Status Registry
|
|
415
214
|
|
|
416
215
|
```typescript
|
|
417
|
-
import
|
|
418
|
-
|
|
216
|
+
import {
|
|
217
|
+
TASK_STATUSES,
|
|
218
|
+
isValidStatus,
|
|
219
|
+
TASK_STATUS_SYMBOLS_UNICODE,
|
|
419
220
|
} from '@cleocode/contracts';
|
|
420
221
|
```
|
|
421
222
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
### Creating a Task Type
|
|
425
|
-
|
|
426
|
-
```typescript
|
|
427
|
-
import type { TaskCreate, TaskPriority, TaskType } from '@cleocode/contracts';
|
|
428
|
-
|
|
429
|
-
const newTask: TaskCreate = {
|
|
430
|
-
title: 'Implement authentication',
|
|
431
|
-
description: 'Add JWT-based auth to the API',
|
|
432
|
-
priority: 'high' as TaskPriority,
|
|
433
|
-
type: 'feature' as TaskType,
|
|
434
|
-
size: 'medium',
|
|
435
|
-
labels: ['backend', 'security']
|
|
436
|
-
};
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
### Using the Data Accessor Interface
|
|
440
|
-
|
|
441
|
-
```typescript
|
|
442
|
-
import type { DataAccessor, TaskQueryFilters } from '@cleocode/contracts';
|
|
443
|
-
|
|
444
|
-
async function fetchHighPriorityTasks(accessor: DataAccessor) {
|
|
445
|
-
const filters: TaskQueryFilters = {
|
|
446
|
-
priority: ['high', 'urgent'],
|
|
447
|
-
status: ['pending', 'in_progress'],
|
|
448
|
-
limit: 10
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
return await accessor.queryTasks(filters);
|
|
452
|
-
}
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
### Working with LAFS Envelopes
|
|
456
|
-
|
|
457
|
-
```typescript
|
|
458
|
-
import { isLafsSuccess, isLafsError, type LafsEnvelope } from '@cleocode/contracts';
|
|
459
|
-
|
|
460
|
-
function handleResponse(response: LafsEnvelope<unknown>) {
|
|
461
|
-
if (isLafsSuccess(response)) {
|
|
462
|
-
console.log('Success:', response.data);
|
|
463
|
-
} else if (isLafsError(response)) {
|
|
464
|
-
console.error('Error:', response.error.message);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
### Status Validation
|
|
223
|
+
### Exit Codes
|
|
470
224
|
|
|
471
225
|
```typescript
|
|
472
|
-
import {
|
|
473
|
-
|
|
474
|
-
// Check if a status is valid
|
|
475
|
-
if (isValidStatus('task', 'in_progress')) {
|
|
476
|
-
console.log('Valid task status');
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// Iterate over all valid statuses
|
|
480
|
-
for (const status of TASK_STATUSES) {
|
|
481
|
-
console.log(`Valid status: ${status}`);
|
|
482
|
-
}
|
|
226
|
+
import { ExitCode, isSuccessCode, isErrorCode, getExitCodeName } from '@cleocode/contracts';
|
|
483
227
|
```
|
|
484
228
|
|
|
485
229
|
## Dependencies
|
|
486
230
|
|
|
487
|
-
This package has **no runtime dependencies**. It
|
|
231
|
+
This package has **no runtime dependencies**. It is a pure TypeScript type and constant library. The only dev dependency is `vitest` for schema validation tests.
|
|
488
232
|
|
|
489
233
|
## License
|
|
490
234
|
|
|
491
|
-
MIT
|
|
235
|
+
MIT — see [LICENSE](../../LICENSE) for details.
|
package/dist/facade.d.ts
CHANGED
|
@@ -202,6 +202,8 @@ export interface TasksAPI {
|
|
|
202
202
|
labels?: string[];
|
|
203
203
|
depends?: string[];
|
|
204
204
|
notes?: string;
|
|
205
|
+
/** Acceptance criteria items (free-text strings or structured gate specs). */
|
|
206
|
+
acceptance?: string[];
|
|
205
207
|
}): Promise<unknown>;
|
|
206
208
|
/** Find tasks by query, ID, status, or limit. */
|
|
207
209
|
find(params: {
|