@cleocode/contracts 2026.4.96 → 2026.4.98

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 (68) hide show
  1. package/dist/config.d.ts +21 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/facade.d.ts +64 -2
  4. package/dist/facade.d.ts.map +1 -1
  5. package/dist/facade.js +1 -0
  6. package/dist/facade.js.map +1 -1
  7. package/dist/index.d.ts +3 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/operations/brain.d.ts +579 -0
  11. package/dist/operations/brain.d.ts.map +1 -0
  12. package/dist/operations/brain.js +39 -0
  13. package/dist/operations/brain.js.map +1 -0
  14. package/dist/operations/conduit.d.ts +151 -0
  15. package/dist/operations/conduit.d.ts.map +1 -0
  16. package/dist/operations/conduit.js +29 -0
  17. package/dist/operations/conduit.js.map +1 -0
  18. package/dist/operations/index.d.ts +4 -0
  19. package/dist/operations/index.d.ts.map +1 -1
  20. package/dist/operations/index.js +4 -0
  21. package/dist/operations/index.js.map +1 -1
  22. package/dist/operations/lifecycle.d.ts +29 -1
  23. package/dist/operations/lifecycle.d.ts.map +1 -1
  24. package/dist/operations/memory.d.ts +899 -0
  25. package/dist/operations/memory.d.ts.map +1 -0
  26. package/dist/operations/memory.js +26 -0
  27. package/dist/operations/memory.js.map +1 -0
  28. package/dist/operations/nexus.d.ts +577 -0
  29. package/dist/operations/nexus.d.ts.map +1 -0
  30. package/dist/operations/nexus.js +22 -0
  31. package/dist/operations/nexus.js.map +1 -0
  32. package/dist/operations/orchestrate.d.ts +451 -38
  33. package/dist/operations/orchestrate.d.ts.map +1 -1
  34. package/dist/operations/orchestrate.js +6 -0
  35. package/dist/operations/orchestrate.js.map +1 -1
  36. package/dist/operations/release.d.ts +78 -8
  37. package/dist/operations/release.d.ts.map +1 -1
  38. package/dist/operations/session.d.ts +26 -3
  39. package/dist/operations/session.d.ts.map +1 -1
  40. package/dist/operations/tasks.d.ts +140 -2
  41. package/dist/operations/tasks.d.ts.map +1 -1
  42. package/dist/sentient.d.ts +85 -0
  43. package/dist/sentient.d.ts.map +1 -0
  44. package/dist/sentient.js +13 -0
  45. package/dist/sentient.js.map +1 -0
  46. package/dist/status-registry.d.ts +1 -1
  47. package/dist/status-registry.d.ts.map +1 -1
  48. package/dist/status-registry.js +3 -0
  49. package/dist/status-registry.js.map +1 -1
  50. package/dist/task.d.ts +66 -0
  51. package/dist/task.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/src/config.ts +22 -0
  54. package/src/facade.ts +65 -1
  55. package/src/index.ts +12 -0
  56. package/src/operations/brain.ts +635 -0
  57. package/src/operations/conduit.ts +189 -0
  58. package/src/operations/index.ts +4 -0
  59. package/src/operations/lifecycle.ts +29 -1
  60. package/src/operations/memory.ts +1053 -0
  61. package/src/operations/nexus.ts +711 -0
  62. package/src/operations/orchestrate.ts +447 -38
  63. package/src/operations/release.ts +77 -7
  64. package/src/operations/session.ts +26 -3
  65. package/src/operations/tasks.ts +141 -3
  66. package/src/sentient.ts +100 -0
  67. package/src/status-registry.ts +3 -0
  68. package/src/task.ts +75 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Nexus Domain Operations (22 operations)
3
+ *
4
+ * Query operations: 13
5
+ * Mutate operations: 9
6
+ *
7
+ * NEXUS is the cross-project coordination layer (the BRAIN Network). It tracks
8
+ * registered projects in a global registry (`nexus.db`), serves cross-project
9
+ * task references (`project:taskId` syntax), answers dependency / blocker /
10
+ * orphan queries, and orchestrates cross-project transfers. These wire-format
11
+ * contracts describe the CLI + HTTP dispatch surface.
12
+ *
13
+ * SYNC: Canonical implementations at
14
+ * packages/core/src/nexus/* and packages/nexus/*
15
+ * Engine adapter at
16
+ * packages/cleo/src/dispatch/engines/nexus-engine.ts
17
+ *
18
+ * @task T910 — Orchestration Coherence v4 (contract surface completion)
19
+ * @see packages/cleo/src/dispatch/domains/nexus.ts
20
+ */
21
+ export {};
22
+ //# sourceMappingURL=nexus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus.js","sourceRoot":"","sources":["../../src/operations/nexus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
@@ -3,113 +3,323 @@
3
3
  *
4
4
  * Query operations: 7
5
5
  * Mutate operations: 6
6
+ *
7
+ * SYNC: Canonical implementations at
8
+ * packages/cleo/src/dispatch/engines/orchestrate-engine.ts
9
+ * packages/core/src/orchestration/*.ts
10
+ *
11
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
6
12
  */
7
13
  /**
8
14
  * Common orchestration types
9
15
  */
10
16
  export interface Wave {
17
+ /** 1-based wave number. @task T963 */
11
18
  wave: number;
19
+ /** Task IDs scheduled in this wave. @task T963 */
12
20
  taskIds: string[];
21
+ /** True when every task in the wave can run in parallel. @task T963 */
13
22
  canRunParallel: boolean;
23
+ /** Upstream wave/task dependencies. @task T963 */
14
24
  dependencies: string[];
15
25
  }
16
26
  export interface SkillDefinition {
27
+ /** Skill name. @task T963 */
17
28
  name: string;
29
+ /** Skill description. @task T963 */
18
30
  description: string;
31
+ /** Skill tags. @task T963 */
19
32
  tags: string[];
33
+ /** Preferred model. @task T963 */
20
34
  model?: string;
35
+ /** Supported protocol phases. @task T963 */
21
36
  protocols: string[];
22
37
  }
23
38
  /**
24
39
  * Query Operations
25
40
  */
41
+ /**
42
+ * Parameters for `orchestrate.status`.
43
+ *
44
+ * @remarks
45
+ * Re-synced to match `orchestrateStatus(epicId?, projectRoot?)` in
46
+ * `packages/cleo/src/dispatch/engines/orchestrate-engine.ts`. When `epicId`
47
+ * is omitted, the engine returns an overall status envelope across all
48
+ * tasks in the project.
49
+ *
50
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
51
+ */
26
52
  export interface OrchestrateStatusParams {
27
- epicId: string;
53
+ /** Epic to scope the status to. Omit for project-wide status. @task T963 */
54
+ epicId?: string;
55
+ }
56
+ /** Per-status task counts. @task T963 */
57
+ export interface OrchestrateStatusCounts {
58
+ /** Pending tasks. @task T963 */
59
+ pending: number;
60
+ /** Active tasks. @task T963 */
61
+ active: number;
62
+ /** Blocked tasks. @task T963 */
63
+ blocked: number;
64
+ /** Completed tasks. @task T963 */
65
+ done: number;
66
+ /** Cancelled tasks (epic scope only). @task T963 */
67
+ cancelled?: number;
28
68
  }
29
- export interface OrchestrateStatusResult {
69
+ /**
70
+ * Epic-scoped status (returned when `epicId` is supplied). Mirrors
71
+ * `EpicStatus` in `packages/core/src/orchestration/status.ts`.
72
+ * @task T963
73
+ */
74
+ export interface OrchestrateEpicStatus {
75
+ /** Epic task id. @task T963 */
30
76
  epicId: string;
77
+ /** Epic title. @task T963 */
78
+ epicTitle: string;
79
+ /** Count of direct children. @task T963 */
31
80
  totalTasks: number;
32
- completedTasks: number;
33
- pendingTasks: number;
34
- blockedTasks: number;
35
- currentWave: number;
36
- totalWaves: number;
37
- parallelCapacity: number;
81
+ /** Per-status breakdown of the children. @task T963 */
82
+ byStatus: OrchestrateStatusCounts;
83
+ /** Total wave count computed for the epic. @task T963 */
84
+ waves: number;
85
+ /** First non-completed wave number, or `null` when all waves done. @task T963 */
86
+ currentWave: number | null;
38
87
  }
88
+ /**
89
+ * Project-wide status (returned when `epicId` is omitted). Mirrors
90
+ * `OverallStatus` in `packages/core/src/orchestration/status.ts`.
91
+ * @task T963
92
+ */
93
+ export interface OrchestrateOverallStatus {
94
+ /** Count of detected root epics. @task T963 */
95
+ totalEpics: number;
96
+ /** Total tasks in the project. @task T963 */
97
+ totalTasks: number;
98
+ /** Per-status breakdown of the project. @task T963 */
99
+ byStatus: OrchestrateStatusCounts;
100
+ }
101
+ /** Result of `orchestrate.status` — union of epic-scoped and overall. @task T963 */
102
+ export type OrchestrateStatusResult = OrchestrateEpicStatus | OrchestrateOverallStatus;
103
+ /** Parameters for `orchestrate.next`. @task T963 */
39
104
  export interface OrchestrateNextParams {
105
+ /** Epic to pull the next task from (required). @task T963 */
40
106
  epicId: string;
41
107
  }
108
+ /**
109
+ * Result of `orchestrate.next`.
110
+ *
111
+ * @remarks
112
+ * Re-synced to match `orchestrateNext(epicId, projectRoot?)` in the engine.
113
+ * The legacy `{taskId, title, recommendedSkill, reasoning}` shape was never
114
+ * implemented — the engine returns a `nextTask | null` + alternatives
115
+ * envelope.
116
+ *
117
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
118
+ */
42
119
  export interface OrchestrateNextResult {
43
- taskId: string;
44
- title: string;
45
- recommendedSkill: string;
46
- reasoning: string;
120
+ /** Epic id that was queried. @task T963 */
121
+ epicId: string;
122
+ /** Next task to work on, or `null` when nothing ready. @task T963 */
123
+ nextTask: {
124
+ /** Task id. @task T963 */
125
+ id: string;
126
+ /** Task title. @task T963 */
127
+ title: string;
128
+ /** Priority rollup from the engine. @task T963 */
129
+ priority: string;
130
+ } | null;
131
+ /** Other ready alternatives (up to 3). Absent when `nextTask` is null. @task T963 */
132
+ alternatives?: Array<{
133
+ id: string;
134
+ title: string;
135
+ priority: string;
136
+ }>;
137
+ /** Total ready tasks for the epic. Absent when `nextTask` is null. @task T963 */
138
+ totalReady?: number;
139
+ /** Human-readable hint when nothing is ready. @task T963 */
140
+ message?: string;
47
141
  }
142
+ /** Parameters for `orchestrate.ready`. @task T963 */
48
143
  export interface OrchestrateReadyParams {
144
+ /** Epic to compute the ready set for (required). @task T963 */
49
145
  epicId: string;
50
146
  }
147
+ /**
148
+ * A single ready-task descriptor as returned by `orchestrate.ready`.
149
+ * @task T963
150
+ */
151
+ export interface OrchestrateReadyTask {
152
+ /** Task id. @task T963 */
153
+ id: string;
154
+ /** Task title. @task T963 */
155
+ title: string;
156
+ /** Engine-rolled priority. @task T963 */
157
+ priority: string;
158
+ /** IDs of tasks this one depends on (blocker/depends chain). @task T963 */
159
+ depends: string[];
160
+ }
161
+ /**
162
+ * Result of `orchestrate.ready`.
163
+ *
164
+ * @remarks
165
+ * Re-synced to match `orchestrateReady(epicId, projectRoot?)`. Returns
166
+ * the filtered ready set from `getReadyTasks` + a diagnostic `reason`
167
+ * when empty.
168
+ *
169
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
170
+ */
51
171
  export interface OrchestrateReadyResult {
52
- wave: number;
53
- taskIds: string[];
54
- parallelSafe: boolean;
172
+ /** Epic id that was queried. @task T963 */
173
+ epicId: string;
174
+ /** Ready task set (filtered to `ready === true`). @task T963 */
175
+ readyTasks: OrchestrateReadyTask[];
176
+ /** Count of ready tasks (may be zero). @task T963 */
177
+ total: number;
178
+ /** Diagnostic reason populated when `total === 0`. @task T963 */
179
+ reason?: string;
55
180
  }
181
+ /**
182
+ * Parameters for `orchestrate.analyze`.
183
+ *
184
+ * @remarks
185
+ * Re-synced: engine signature is
186
+ * `orchestrateAnalyze(epicId?, projectRoot?, mode?)`. Mode
187
+ * `critical-path` delegates to `orchestrateCriticalPath` — callers may
188
+ * branch on `mode` at the dispatch layer.
189
+ *
190
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
191
+ */
56
192
  export interface OrchestrateAnalyzeParams {
57
- epicId: string;
193
+ /**
194
+ * Epic to analyze. Required for standard mode; optional for
195
+ * `mode: 'critical-path'` which operates across the whole project.
196
+ * @task T963
197
+ */
198
+ epicId?: string;
199
+ /** Analysis mode — `undefined` | `'critical-path'`. @task T963 */
200
+ mode?: 'critical-path';
58
201
  }
202
+ /**
203
+ * Result of `orchestrate.analyze` (standard mode).
204
+ *
205
+ * @remarks
206
+ * Returns the wave plan + dependency diagnostics from
207
+ * `analyzeEpic` + `analyzeDependencies`.
208
+ *
209
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
210
+ */
59
211
  export interface OrchestrateAnalyzeResult {
212
+ /** Epic task id that was analyzed. @task T963 */
213
+ epicId: string;
214
+ /** Epic title (falls back to `epicId` when title unresolvable). @task T963 */
215
+ epicTitle: string;
216
+ /** Count of direct children. @task T963 */
217
+ totalTasks: number;
218
+ /** Computed wave plan. @task T963 */
60
219
  waves: Wave[];
61
- criticalPath: string[];
62
- estimatedParallelism: number;
63
- bottlenecks: string[];
220
+ /** Detected circular dependency chains. @task T963 */
221
+ circularDependencies: string[][];
222
+ /** Dependencies that point at nonexistent task ids. @task T963 */
223
+ missingDependencies: string[];
224
+ /**
225
+ * Adjacency-list dependency graph (taskId → depends-on ids).
226
+ * @task T963
227
+ */
228
+ dependencyGraph: Record<string, string[]>;
64
229
  }
230
+ /**
231
+ * Parameters for `orchestrate.context`.
232
+ *
233
+ * @remarks
234
+ * Re-synced to match `orchestrateContext(epicId?, projectRoot?)` in the
235
+ * engine. The legacy `tokens` field was unused; the real parameter is
236
+ * an optional `epicId` that scopes the task-count basis of the estimate.
237
+ *
238
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
239
+ */
65
240
  export interface OrchestrateContextParams {
66
- tokens?: number;
241
+ /** Epic id to scope the context estimate. Omit for project-wide. @task T963 */
242
+ epicId?: string;
67
243
  }
244
+ /**
245
+ * Result of `orchestrate.context`.
246
+ *
247
+ * @remarks
248
+ * Mirrors `ContextEstimation` in `packages/core/src/orchestration/context.ts`.
249
+ *
250
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
251
+ */
68
252
  export interface OrchestrateContextResult {
69
- currentTokens: number;
70
- maxTokens: number;
71
- percentUsed: number;
72
- level: 'safe' | 'medium' | 'high' | 'critical';
253
+ /** Epic id the estimate was scoped to, or `null` for project-wide. @task T963 */
254
+ epicId: string | null;
255
+ /** Count of tasks included in the estimate. @task T963 */
256
+ taskCount: number;
257
+ /** Count of MANIFEST.jsonl entries. @task T963 */
258
+ manifestEntries: number;
259
+ /** Rough estimated token count (taskCount * per-task weight). @task T963 */
260
+ estimatedTokens: number;
261
+ /** Human-readable recommendation. @task T963 */
73
262
  recommendation: string;
263
+ /** Context budget limits + current usage. @task T963 */
264
+ limits: {
265
+ /** Maximum orchestrator context budget. @task T963 */
266
+ orchestratorBudget: number;
267
+ /** Max files a single agent should read. @task T963 */
268
+ maxFilesPerAgent: number;
269
+ /** Current token usage (mirrors `estimatedTokens`). @task T963 */
270
+ currentUsage: number;
271
+ };
74
272
  }
273
+ /** Parameters for `orchestrate.waves`. @task T963 */
75
274
  export interface OrchestrateWavesParams {
275
+ /** Epic to compute waves for. @task T963 */
76
276
  epicId: string;
77
277
  }
78
278
  export type OrchestrateWavesResult = Wave[];
279
+ /** Parameters for `orchestrate.skill.list`. @task T963 */
79
280
  export interface OrchestrateSkillListParams {
281
+ /** Free-text filter across skill name/tags. @task T963 */
80
282
  filter?: string;
81
283
  }
82
284
  export type OrchestrateSkillListResult = SkillDefinition[];
285
+ /** Parameters for `orchestrate.bootstrap`. @task T963 */
83
286
  export interface OrchestrateBootstrapParams {
287
+ /** Bootstrap verbosity mode. @task T963 */
84
288
  speed?: 'fast' | 'full' | 'complete';
85
289
  }
86
290
  export interface BrainState {
291
+ /** Currently active session summary. @task T963 */
87
292
  session?: {
88
293
  id: string;
89
294
  name: string;
90
295
  status: string;
91
296
  startedAt: string;
92
297
  };
298
+ /** Current task context. @task T963 */
93
299
  currentTask?: {
94
300
  id: string;
95
301
  title: string;
96
302
  status: string;
97
303
  };
304
+ /** Suggested next task with score. @task T963 */
98
305
  nextSuggestion?: {
99
306
  id: string;
100
307
  title: string;
101
308
  score: number;
102
309
  };
310
+ /** Recent decisions for the brain-state rollup. @task T963 */
103
311
  recentDecisions?: Array<{
104
312
  id: string;
105
313
  decision: string;
106
314
  timestamp: string;
107
315
  }>;
316
+ /** Blockers currently affecting progress. @task T963 */
108
317
  blockers?: Array<{
109
318
  taskId: string;
110
319
  title: string;
111
320
  blockedBy: string[];
112
321
  }>;
322
+ /** Progress rollup. @task T963 */
113
323
  progress?: {
114
324
  total: number;
115
325
  done: number;
@@ -117,10 +327,12 @@ export interface BrainState {
117
327
  blocked: number;
118
328
  pending: number;
119
329
  };
330
+ /** Context drift score + contributing factors. @task T963 */
120
331
  contextDrift?: {
121
332
  score: number;
122
333
  factors: string[];
123
334
  };
335
+ /** Bootstrap envelope metadata. @task T963 */
124
336
  _meta: {
125
337
  speed: 'fast' | 'full' | 'complete';
126
338
  generatedAt: string;
@@ -130,73 +342,274 @@ export interface BrainState {
130
342
  /**
131
343
  * Mutate Operations
132
344
  */
345
+ /** Parameters for `orchestrate.startup`. @task T963 */
133
346
  export interface OrchestrateStartupParams {
347
+ /** Epic id to initialize. @task T963 */
134
348
  epicId: string;
135
349
  }
350
+ /**
351
+ * Result of `orchestrate.startup`.
352
+ *
353
+ * @remarks
354
+ * Re-synced to match `orchestrateStartup(epicId, projectRoot?)` + the
355
+ * `computeStartupSummary` output + auto-init fields. The legacy shape
356
+ * assumed nested status/analysis/firstTask envelopes; the engine actually
357
+ * returns a flat summary + auto-init metadata.
358
+ *
359
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
360
+ */
136
361
  export interface OrchestrateStartupResult {
362
+ /** Epic id that was initialized. @task T963 */
137
363
  epicId: string;
138
- status: OrchestrateStatusResult;
139
- analysis: OrchestrateAnalyzeResult;
140
- firstTask: OrchestrateNextResult;
364
+ /** Epic title. @task T963 */
365
+ epicTitle: string;
366
+ /** Always true once startup reaches return — pipeline + research stage recorded. @task T963 */
367
+ initialized: true;
368
+ /** Summary rollup of the epic's children. @task T963 */
369
+ summary: {
370
+ /** Total child count. @task T963 */
371
+ totalTasks: number;
372
+ /** Wave count. @task T963 */
373
+ totalWaves: number;
374
+ /** Count of tasks ready to spawn. @task T963 */
375
+ readyTasks: number;
376
+ /** Per-status breakdown. @task T963 */
377
+ byStatus: OrchestrateStatusCounts;
378
+ };
379
+ /** First wave payload, or `null` when epic has no children. @task T963 */
380
+ firstWave: Wave | null;
381
+ /**
382
+ * True when this startup call auto-initialized the lifecycle to the
383
+ * `research` stage. False when the epic already had a pipeline.
384
+ * @task T963
385
+ */
386
+ autoInitialized: boolean;
387
+ /**
388
+ * Current pipeline stage after startup — `research` when auto-initialized,
389
+ * `already-initialized` marker string otherwise.
390
+ * @task T963
391
+ */
392
+ currentStage: string;
141
393
  }
394
+ /**
395
+ * Parameters for `orchestrate.spawn` (T882 canonical spawn contract).
396
+ *
397
+ * @remarks
398
+ * Re-synced to match `orchestrateSpawn(taskId, protocolType, projectRoot, tier)`
399
+ * in `packages/cleo/src/dispatch/engines/orchestrate-engine.ts`. The legacy
400
+ * `{skill, model}` fields from earlier drafts were never implemented — the
401
+ * T882 rebuild (v2026.4.85) introduced `protocolType` + `tier` as the
402
+ * authoritative inputs.
403
+ *
404
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
405
+ * @task T882 — canonical spawn-prompt rebuild
406
+ */
142
407
  export interface OrchestrateSpawnParams {
408
+ /** Task ID to spawn a worker for (required). @task T963 */
143
409
  taskId: string;
144
- skill?: string;
145
- model?: string;
410
+ /**
411
+ * Protocol phase dispatched to the worker (e.g. `'research'`,
412
+ * `'implementation'`, `'validation'`). When omitted, the composer runs
413
+ * `autoDispatch` to classify the task.
414
+ * @task T963
415
+ */
416
+ protocolType?: string;
417
+ /**
418
+ * Spawn prompt tier per T882 (0=minimal, 1=standard with CLEO-INJECTION
419
+ * embed, 2=full with skill excerpts + SUBAGENT-PROTOCOL-BLOCK). When
420
+ * omitted, resolved from the agent role (orchestrator=2, lead=1, worker=0).
421
+ * @task T963
422
+ */
423
+ tier?: 0 | 1 | 2;
146
424
  }
425
+ /**
426
+ * Result of `orchestrate.spawn`.
427
+ *
428
+ * @remarks
429
+ * Re-synced to match the T932 `composeSpawnForTask` payload envelope returned
430
+ * by the orchestrate engine (prompt + atomicity verdict + traceability meta).
431
+ * Mirrors `SpawnPayload` in `packages/core/src/orchestration/spawn.ts`.
432
+ *
433
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
434
+ */
147
435
  export interface OrchestrateSpawnResult {
436
+ /** Task ID the spawn is about (mirrors `task.id`). @task T963 */
148
437
  taskId: string;
149
- skill: string;
150
- model: string;
438
+ /**
439
+ * Fully-resolved spawn prompt, copy-pastable into any LLM runtime
440
+ * (Claude, GPT-4, Gemini, open-source). Primary payload every caller
441
+ * should consume.
442
+ * @task T963
443
+ */
151
444
  prompt: string;
152
- metadata: {
153
- tokensUsed: number;
154
- protocolsInjected: string[];
155
- dependencies: string[];
445
+ /** Agent id the spawn is routed to. @task T963 */
446
+ agentId: string;
447
+ /** Role the agent will execute as (`orchestrator` | `lead` | `worker`). @task T963 */
448
+ role: string;
449
+ /** Tier of the rendered prompt (0/1/2). @task T963 */
450
+ tier: 0 | 1 | 2;
451
+ /** Harness hint driving dedup decisions (`claude-code` | `generic` | `bare`). @task T963 */
452
+ harnessHint: string;
453
+ /**
454
+ * Atomicity gate verdict from the worker file-scope guard. When
455
+ * `allowed=false`, the spawn was rejected and the orchestrate engine
456
+ * surfaces an `E_ATOMICITY_VIOLATION` error envelope.
457
+ * @task T963
458
+ */
459
+ atomicity: {
460
+ /** Whether the spawn is permitted. @task T963 */
461
+ allowed: boolean;
462
+ /** Error code when the spawn was rejected. @task T963 */
463
+ code?: string;
464
+ /** Diagnostic message. @task T963 */
465
+ message?: string;
466
+ /** Fix hint for the violation. @task T963 */
467
+ fixHint?: string;
468
+ };
469
+ /**
470
+ * Traceability / accounting metadata. Mirrors `SpawnPayloadMeta` —
471
+ * pinned `composerVersion: '3.0.0'` on every call.
472
+ * @task T963
473
+ */
474
+ meta: {
475
+ /** Tier the resolved agent was sourced from. @task T963 */
476
+ sourceTier: string;
477
+ /** Characters saved by skipping the tier-1 CLEO-INJECTION embed. @task T963 */
478
+ dedupSavedChars: number;
479
+ /** Character length of the final prompt. @task T963 */
480
+ promptChars: number;
481
+ /** Protocol phase the prompt was rendered for. @task T963 */
482
+ protocol: string;
483
+ /** ISO 8601 timestamp when the payload was generated. @task T963 */
484
+ generatedAt: string;
485
+ /** Pinned composer contract version. @task T963 */
486
+ composerVersion: '3.0.0';
487
+ };
488
+ /**
489
+ * Mirror of `meta.protocol` at the top level for legacy callers. Equals
490
+ * the resolved protocol phase (from `protocolType` param or auto-dispatch).
491
+ * @task T963
492
+ */
493
+ protocolType: string;
494
+ /**
495
+ * Active session id threaded into the prompt, or `null` when the
496
+ * orchestrator had no active session at spawn time.
497
+ * @task T963
498
+ */
499
+ sessionId: string | null;
500
+ /**
501
+ * Legacy mirror of the prompt/protocolType/tier bundle for readers that
502
+ * still consume `spawnContext.*`.
503
+ * @task T963
504
+ */
505
+ spawnContext: {
506
+ /** Task id mirrored from top level. @task T963 */
507
+ taskId: string;
508
+ /** Protocol string from the composer. @task T963 */
509
+ protocol: string;
510
+ /** Resolved protocol type. @task T963 */
511
+ protocolType: string;
512
+ /** Tier mirror. @task T963 */
513
+ tier: 0 | 1 | 2;
514
+ /** Prompt mirror. @task T963 */
515
+ prompt: string;
156
516
  };
157
517
  }
518
+ /** Parameters for `orchestrate.handoff`. @task T963 */
158
519
  export interface OrchestrateHandoffParams {
520
+ /** Task id to hand off to. @task T963 */
159
521
  taskId: string;
522
+ /** Protocol phase for the successor spawn. @task T963 */
160
523
  protocolType: string;
524
+ /** Free-form session-end note. @task T963 */
161
525
  note?: string;
526
+ /** Next-action hint for the successor. @task T963 */
162
527
  nextAction?: string;
528
+ /** Context injection variant (skill preset). @task T963 */
163
529
  variant?: string;
530
+ /** Tier override for the spawn prompt. @task T963 */
164
531
  tier?: 0 | 1 | 2;
532
+ /** Client-supplied idempotency key for handoff retries. @task T963 */
165
533
  idempotencyKey?: string;
166
534
  }
535
+ /** Result of `orchestrate.handoff`. @task T963 */
167
536
  export interface OrchestrateHandoffResult {
537
+ /** Task id that was handed off to. @task T963 */
168
538
  taskId: string;
539
+ /** Session id that was active before handoff. @task T963 */
169
540
  predecessorSessionId: string;
541
+ /** Session id that was ended. @task T963 */
170
542
  endedSessionId: string;
543
+ /** Protocol type resolved for the successor. @task T963 */
171
544
  protocolType: string;
172
545
  }
546
+ /** Validation issue surfaced by `orchestrate.validate`. @task T963 */
547
+ export interface OrchestrateValidationIssue {
548
+ /** Stable issue code (e.g. `V_NOT_FOUND`, `V_UNMET_DEP`, `V_MISSING_TITLE`). @task T963 */
549
+ code: string;
550
+ /** Human-readable diagnostic message. @task T963 */
551
+ message: string;
552
+ /** Issue severity (`error` | `warning` | `info`). @task T963 */
553
+ severity: string;
554
+ }
555
+ /** Parameters for `orchestrate.validate`. @task T963 */
173
556
  export interface OrchestrateValidateParams {
557
+ /** Task id to validate. @task T963 */
174
558
  taskId: string;
175
559
  }
560
+ /**
561
+ * Result of `orchestrate.validate`.
562
+ *
563
+ * @remarks
564
+ * Re-synced to match `validateSpawnReadiness` in
565
+ * `packages/core/src/orchestration/validate-spawn.ts`. The legacy shape
566
+ * (`{blockers, lifecycleGate, recommendations}`) never matched the engine;
567
+ * the real output is a `{ready, issues}` envelope.
568
+ *
569
+ * @task T963 — contract↔impl drift reconciliation (T910 audit)
570
+ */
176
571
  export interface OrchestrateValidateResult {
572
+ /** Task id that was validated. @task T963 */
177
573
  taskId: string;
574
+ /** Task title snapshot. @task T963 */
575
+ title: string;
576
+ /** True when the task passed every readiness check. @task T963 */
178
577
  ready: boolean;
179
- blockers: string[];
180
- lifecycleGate: 'passed' | 'failed' | 'pending';
181
- recommendations: string[];
578
+ /** Issues preventing spawn (empty array when `ready === true`). @task T963 */
579
+ issues: OrchestrateValidationIssue[];
182
580
  }
581
+ /** Parameters for `orchestrate.parallel.start`. @task T963 */
183
582
  export interface OrchestrateParallelStartParams {
583
+ /** Epic id. @task T963 */
184
584
  epicId: string;
585
+ /** Wave number to launch. @task T963 */
185
586
  wave: number;
186
587
  }
588
+ /** Result of `orchestrate.parallel.start`. @task T963 */
187
589
  export interface OrchestrateParallelStartResult {
590
+ /** Wave number launched. @task T963 */
188
591
  wave: number;
592
+ /** Task IDs in the wave. @task T963 */
189
593
  taskIds: string[];
594
+ /** ISO 8601 start timestamp. @task T963 */
190
595
  started: string;
191
596
  }
597
+ /** Parameters for `orchestrate.parallel.end`. @task T963 */
192
598
  export interface OrchestrateParallelEndParams {
599
+ /** Epic id. @task T963 */
193
600
  epicId: string;
601
+ /** Wave number that ended. @task T963 */
194
602
  wave: number;
195
603
  }
604
+ /** Result of `orchestrate.parallel.end`. @task T963 */
196
605
  export interface OrchestrateParallelEndResult {
606
+ /** Wave number. @task T963 */
197
607
  wave: number;
608
+ /** Tasks that completed successfully. @task T963 */
198
609
  completed: number;
610
+ /** Tasks that failed. @task T963 */
199
611
  failed: number;
612
+ /** Wave duration (ISO 8601 duration string). @task T963 */
200
613
  duration: string;
201
614
  }
202
615
  //# sourceMappingURL=orchestrate.d.ts.map