wicked-crew-api-types 0.36.0 → 0.38.0

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 (2) hide show
  1. package/index.d.ts +590 -5
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -137,6 +137,70 @@ export type RoutingInfo =
137
137
  | { method: 'evaluator_distinct'; winner: string; was: string }
138
138
  | { method: 'tool' };
139
139
 
140
+ /**
141
+ * `GET /health` (api-types 0.37.0 — the shape was previously undeclared here; `status`,
142
+ * `version` and `ping` are unchanged since 0.1). `capabilities` (additive) names what the
143
+ * running daemon + its engine addon can actually do, so a client never promises a behaviour the
144
+ * deployment cannot keep:
145
+ * - `deliverGate` — the engine pauses before the composed `deliver` phase pushes and opens the
146
+ * PR unless the launch said `deliverGate: 'auto'` (F-E2E-030; wicked-core-ts ≥ 0.7.24).
147
+ * `false` (or the whole object absent — a daemon before 0.7.33) ⇒ delivery follows verify
148
+ * UNATTENDED; a composer must say so instead of promising a gate, and must not send
149
+ * `deliverGate` (an older daemon's launch schema rejects it).
150
+ * - `revisesPr` (api-types 0.38.0, additive) — the daemon accepts `LaunchRunBody.revisesPr`
151
+ * (crew#550). Absent or `false` ⇒ a composer must NOT send it (an older daemon's launch
152
+ * schema rejects it with a 400) and says "this daemon cannot revise a PR" instead.
153
+ *
154
+ * The object is the named {@link HealthCapabilities} since 0.38.0 — the same shape 0.37.0 declared
155
+ * inline, so nothing a 0.37.0 client compiled against moves.
156
+ */
157
+ export interface HealthResponse {
158
+ status: string;
159
+ version: string;
160
+ ping: string;
161
+ capabilities?: HealthCapabilities;
162
+ /**
163
+ * Blockers the daemon reports while it still SERVES (additive; wicked-core#411 / wicked-crew#497).
164
+ * One kind today — `state-home.unregistered`: the daemon's state home holds an entry the worker
165
+ * Read fence cannot classify, so every governed launch would be refused and `POST /runs` answers
166
+ * **409** `state_home_unregistered` until it is gone (`GET /diagnostics.stateHome` has the
167
+ * detail). ABSENT when there is nothing to say, and on a daemon before this field. A composer
168
+ * shows it as the blocker it is; `status` stays `ok` — the daemon is up, it refuses to launch.
169
+ */
170
+ warnings?: HealthWarning[];
171
+ /**
172
+ * The BASE skill posture for the NEXT launch (crew#554; additive) — what a composer's confirm
173
+ * line renders as `discipline skill: <name> gen N` (or `MISSING — runs will be refused at
174
+ * intake` under `baseSkillPolicy: 'require'`, `MISSING — runs proceed without it` under
175
+ * `'warn'`). `null` when the setting is off or the skills seam is disabled; absent on a daemon
176
+ * before this field. Cached by the daemon — reading it costs no I/O.
177
+ */
178
+ baseSkill?: BaseSkillPosture | null;
179
+ }
180
+
181
+ /**
182
+ * `GET /health.capabilities` (api-types 0.38.0 — named; 0.37.0 declared the same shape inline on
183
+ * {@link HealthResponse}). What the running daemon + its engine addon can actually do; every key
184
+ * is a promise the deployment keeps, so a client reads it before offering the behaviour.
185
+ */
186
+ export interface HealthCapabilities {
187
+ /** See {@link HealthResponse} — the engine's deliver gate exists (wicked-core-ts ≥ 0.7.24). */
188
+ deliverGate: boolean;
189
+ /**
190
+ * `LaunchRunBody.revisesPr` is accepted (crew#550; crew ≥ 0.7.36). ABSENT on a daemon before
191
+ * the field — read as `false`: do not send `revisesPr` to such a daemon.
192
+ */
193
+ revisesPr?: boolean;
194
+ }
195
+
196
+ /** One `GET /health.warnings[]` entry (additive; wicked-core#411 / wicked-crew#497). */
197
+ export interface HealthWarning {
198
+ /** `state-home.unregistered` today; open for later kinds. */
199
+ kind: string;
200
+ severity: 'warning' | 'error';
201
+ message: string;
202
+ }
203
+
140
204
  /** A run (`AgentSession`). */
141
205
  export interface AgentSession {
142
206
  id: string;
@@ -147,6 +211,14 @@ export interface AgentSession {
147
211
  clis: string[];
148
212
  status: SessionStatus;
149
213
  human_confirm: HumanConfirm;
214
+ /**
215
+ * Whether the run's deliver phase may push and open its PR WITHOUT a human confirming it
216
+ * first (F-E2E-030; api-types 0.37.0, additive). `false` — the engine pauses before the `deliver` Tool unit
217
+ * whatever `human_confirm` says; `true` — the launch opted out explicitly (`deliverGate:
218
+ * 'auto'`). ABSENT on runs from an engine that predates the deliver gate (wicked-core-ts <
219
+ * 0.7.24): such an engine delivers unattended — render no gate promise for it.
220
+ */
221
+ auto_deliver?: boolean;
150
222
  unit_ix: number;
151
223
  attempt: number;
152
224
  workdir: string | null;
@@ -282,6 +354,23 @@ export interface AgentSession {
282
354
  * now; a joined `AgentSession.cost` is a follow-up once that store exists.
283
355
  */
284
356
  created_at?: number;
357
+ /**
358
+ * When this run reached a TERMINAL status — unix SECONDS (api-types 0.38.0; crew#496 / studio#230).
359
+ * Mirrors {@link created_at}: daemon-derived at DTO assembly on BOTH `GET /runs` and
360
+ * `GET /runs/:id` from a `run.ended` audit entry the daemon records when it sees the run's
361
+ * terminal frame (`sessionCompleted` | `sessionFailed` | `runCancelled`), joined like
362
+ * {@link retry_of} / {@link guidance} and hydrated from the same trail scan at boot. Together with
363
+ * {@link created_at} ("started" ≡ "created" — the ONE launch instant) it gives a run its own clock;
364
+ * a skin prefers these over the moment it happened to attach.
365
+ *
366
+ * ABSENT — never `null`, never fabricated — when the daemon has no `run.ended` entry: a run
367
+ * still live, a run that terminalled before this field existed or before THIS daemon booted
368
+ * (no re-emission at boot), a lost trail, or the one crash window between the engine's status
369
+ * write and the daemon's synchronous audit record. Read with `typeof === 'number'`; a duration
370
+ * or a "finished N minutes ago" MUST be omitted for an undated run, never derived from now.
371
+ * Distinct from {@link finished_at} (engine-side unix MILLIS, retention bookkeeping).
372
+ */
373
+ ended_at?: number;
285
374
  /**
286
375
  * The interactive DOCUMENT this run answered (wave 6, F-4R2-006 root fix; api-types 0.36.0) —
287
376
  * daemon-joined at DTO assembly on `GET /runs` and `GET /runs/:id` from the interactive seams'
@@ -346,6 +435,14 @@ export interface WorkUnit {
346
435
  * before the field existed, and on an older engine.
347
436
  */
348
437
  executes_code?: boolean;
438
+ /**
439
+ * The BASE skill this unit follows (wicked-core#468; additive, skip-if-none on the wire): the
440
+ * run's role-keyed discipline skill, copied onto every AGENT unit at plan time (never a Tool
441
+ * unit). The unit header renders it with the unit's `role` as `discipline: <name> §<role> gen N`,
442
+ * `N` from the unit's `skillsSnapshotHanded.gen` frame. Absent on runs without one, on units
443
+ * planned before the field existed, and on an older engine.
444
+ */
445
+ base_skill_ref?: string | null;
349
446
  }
350
447
 
351
448
  /** A run plus its ordered units (`SessionView`) — the shape `GET /runs` returns. */
@@ -412,6 +509,14 @@ export interface OnboardRef {
412
509
  * the message — no operator hand-edit involved.
413
510
  */
414
511
  export interface SeatHealth {
512
+ /**
513
+ * `inactive` is NO LONGER PRODUCED from crew 0.7.36 (api-types 0.38.0 doc; DES-L3 R5): the daemon
514
+ * stopped flipping a seat on `stepFailed{workerError}`, on quota/401/timeout phrases and on
515
+ * repeated ACP fallback — seat standing is the engine's per-run ballot bench
516
+ * (`AgentSession.benched_seats`) plus the seat's own auth refusal (`RosterSeat.auth`). The token
517
+ * stays in the union so a daemon before 0.7.36 still parses; a reader treats it exactly as
518
+ * before (a seat-level error, recovery by the probe or a restart).
519
+ */
415
520
  status: 'active' | 'inactive';
416
521
  /** Bounded excerpt of the last seat-level error; present while `inactive`. */
417
522
  message?: string;
@@ -496,12 +601,18 @@ export interface RosterSeat {
496
601
  * `councilSeatFailed` evidence (`non_zero_exit` / `timed_out`, the derivative `benched` kind
497
602
  * excluded), folded over a bounded window (`window_ms`) and cleared by the seat's next ok unit
498
603
  * output. `council_eligible` is false while it is present.
604
+ *
605
+ * @deprecated ABSENT from crew 0.7.36 (DES-L3 R5b): the daemon-wide council-failure ledger is
606
+ * retired — the engine benches a dead seat per run at its own ballot threshold and the run DTO
607
+ * carries the bench (`AgentSession.benched_seats`). Removed from this contract one minor later;
608
+ * a reader must tolerate absence today.
499
609
  */
500
610
  council_bench?: RosterSeatCouncilBench;
501
611
  [k: string]: unknown;
502
612
  }
503
613
 
504
- /** `RosterSeat.council_bench` (api-types 0.35.0). */
614
+ /** `RosterSeat.council_bench` (api-types 0.35.0).
615
+ * @deprecated ABSENT from crew 0.7.36 (see {@link RosterSeat.council_bench}); removed one minor later. */
505
616
  export interface RosterSeatCouncilBench {
506
617
  /** Primary ballot failures inside the window. */
507
618
  failures: number;
@@ -602,6 +713,26 @@ export interface GateInfo {
602
713
  export interface GateDecision {
603
714
  approve: boolean;
604
715
  amend?: string;
716
+ /**
717
+ * The decision ARM (api-types 0.38.0, additive; DES-L1 PR-1B / crew PR-2, crew ≥ 0.7.36 on
718
+ * wicked-core-ts ≥ 0.7.27). Absent = today's two-arm mapping: `approve: true` approves (retry
719
+ * the same unit, `amend` steers it), `approve: false` rejects (cancels the run, keeps a dirty
720
+ * worktree). `'request_changes'` — an ESCALATION gate only: rewind to the most recent creator
721
+ * phase at or before the gated unit, hand it the evaluator's findings (+ `amend` as the note)
722
+ * and re-dispatch it (`unitReworkAmended{scope: 'request_changes'}` → `resumed` →
723
+ * `unitDispatched{attempt: last + 1}`); requires `approve: false` — a disagreement between
724
+ * `action` and `approve` answers 400, a gate with no creator phase before it 409. An older
725
+ * daemon's strict schema rejects the key with a 400 — omit it against such servers.
726
+ */
727
+ action?: 'approve' | 'request_changes' | 'reject';
728
+ /**
729
+ * Where an approve's `amend` lands (api-types 0.38.0, additive; same release as `action`).
730
+ * Absent = `'cursor'` (today: the gated unit's description). `'creator'` — the first creator
731
+ * phase at or after the cursor receives it (`unitReworkAmended{scope: 'creator'}`) while the
732
+ * cursor dispatches unamended: the intake steer that must reach the fix phase, not triage.
733
+ * Identical text already present on the target is not appended twice.
734
+ */
735
+ amendScope?: 'cursor' | 'creator';
605
736
  }
606
737
 
607
738
  /**
@@ -620,6 +751,12 @@ export interface ReassignRequest {
620
751
  * fields cover the frames the daemon and the studio inspect; the index
621
752
  * signature keeps the shape additive-safe so new variants pass through
622
753
  * untouched (DES-STUDIO-001 §2.1, §5.1).
754
+ *
755
+ * Exact per-frame shapes for consumers that narrow on `type`: the cockpit
756
+ * {@link InsightEvent} union, the gate-evidence {@link GateEvidenceEvent}
757
+ * union, and — typed in api-types 0.38.0 as the engine already emits them —
758
+ * the 11-key {@link GateEscalatedEvent}, {@link SandboxPostureEvent} and
759
+ * {@link WorktreeRetainedEvent}.
623
760
  */
624
761
  export interface CoreEvent {
625
762
  type: string;
@@ -746,6 +883,9 @@ export interface CoreEvent {
746
883
  degradedReason?: string | null;
747
884
  degraded_reason?: string | null;
748
885
  seatConstraint?: string | null;
886
+ /** `unitDistributed` (wicked-core#461): the evaluator ≠ creator fallback as a field — see
887
+ * `UnitDistributedEvent.distinctnessFallback`. */
888
+ distinctnessFallback?: 'creator_seat' | null;
749
889
  /** `gateEvaluated` (wave 6, F-7R2-005): `true` when NOTHING gated the unit — render as UNGATED. */
750
890
  ungated?: boolean;
751
891
  /** `gateEvaluated` (wave 6): why, when `ungated`. */
@@ -920,8 +1060,20 @@ export interface RecordedEvent extends CoreEvent {
920
1060
  * is required and spans every frame of the run; that one is optional and scoped to a stream. The
921
1061
  * name is inherited from the wire and narrowed here rather than renamed, because the wire is what
922
1062
  * `runEvents` returns.
1063
+ *
1064
+ * Across a daemon RESTART the counter is re-seeded from the trail's highest `seq` + 1, so `seq`
1065
+ * stays strictly increasing over the whole trail — but two records of one run may be separated
1066
+ * by an engine that lost every in-flight frame in between (api-types 0.38.0; crew#513).
923
1067
  */
924
1068
  seq: number;
1069
+ /**
1070
+ * Stamped `true` on exactly ONE record per restart: the first frame a fresh engine writes for a
1071
+ * run whose trail already existed (wicked-core `event_log.rs`; api-types 0.38.0, crew#513). Every
1072
+ * other record omits the key — never `false`. A timeline reads it as a "daemon restarted here"
1073
+ * boundary: frames the previous process never wrote are not coming, and the run's `ended_at` may
1074
+ * be absent for that reason.
1075
+ */
1076
+ daemonRestarted?: true;
925
1077
  }
926
1078
 
927
1079
  /**
@@ -942,6 +1094,20 @@ export interface UnitDispatchedEvent {
942
1094
  session: string;
943
1095
  ord: number;
944
1096
  attempt: number;
1097
+ /**
1098
+ * The BASE skill directive this dispatch carries (wicked-core#468; additive): the run's
1099
+ * role-keyed discipline skill and the `§<role>` section the unit was told to follow. Emitted
1100
+ * unconditionally by an engine that has it — `null` when the run declares none; ABSENT on an
1101
+ * older engine. The generation it is handed from is the same unit's `skillsSnapshotHanded.gen`
1102
+ * (the handoff is where the generation is known truthfully). A run page renders
1103
+ * `discipline: <name> §<role> gen N`.
1104
+ *
1105
+ * `handed` (api-types 0.38.0, additive; wicked-core#479 — typed AHEAD of its producer, which
1106
+ * lands in the wave-3 core-ts): `true` when the admitted snapshot holds the base skill and the
1107
+ * carrier delivered it (the skill form is not `Unloaded`); `false` when the run only NAMED it.
1108
+ * ABSENT ⇒ UNKNOWN (an engine before the field) — render `gen ?`, never "not handed".
1109
+ */
1110
+ baseSkill?: { name: string; role: 'creator' | 'evaluator' | 'neutral'; handed?: boolean } | null;
945
1111
  }
946
1112
 
947
1113
  /** §3 B3 — token/cost burn for one unit run. `costUsd` is `null` when no cost is known. */
@@ -1056,6 +1222,16 @@ export interface GateEvaluatedEvent {
1056
1222
  * validator gated it) — `"no eligible judge seat distinct from creator \`claude\` (roster: …;
1057
1223
  * benched: …)"`. `null` when a judge ran or none was wanted; absent on an older engine. */
1058
1224
  judgeSkippedReason?: string | null;
1225
+ /**
1226
+ * The evaluator's own `VERDICT:` token (api-types 0.38.0, additive; DES-L1 PR-1A, wicked-core-ts
1227
+ * ≥ 0.7.27): after trimming leading decoration, the LAST line whose first token is `VERDICT`
1228
+ * decides — `"PASS"`, `"FAIL"`, or whatever token the seat wrote (`"CONDITIONAL"` is not PASS).
1229
+ * Parsed for an Evaluator-role agent unit only; `null` for creator / neutral / tool units and
1230
+ * when no such line exists (then `denial.source` is `evaluator_verdict` and the gate escalates
1231
+ * `verdict_not_pass`). ABSENT on an engine before the field — a reader treats absent as "not
1232
+ * parsed", never as PASS.
1233
+ */
1234
+ evaluatorVerdict?: string | null;
1059
1235
  }
1060
1236
 
1061
1237
  /** Foundation wave: session started with enriched context. */
@@ -1208,15 +1384,88 @@ export interface ValidationPinAttachedEvent {
1208
1384
  criterion: string;
1209
1385
  }
1210
1386
 
1211
- /** P2 — a HumanConfirmIf gate escalated to human review. */
1387
+ /**
1388
+ * P2 — a HumanConfirmIf gate escalated to human review. Since wicked-core#464 every fold DENIAL
1389
+ * parks the run here too (followed by `awaitingHuman{gateKind: 'escalation'}`), and `condition`
1390
+ * names the CLASS: `evaluator_mutated_worktree` (the worktree guard) · `boundary_deny` (input
1391
+ * governance refused a tool call) · `dead_seat` (the seat is unusable — signed out / not installed /
1392
+ * benched) · `floor_failed` (a deterministic floor: repo checks, pinned validator, substance,
1393
+ * deliverables) · `verdict_not_pass` (the layer-2 judge, a worker failure, or — wicked-core-ts ≥
1394
+ * 0.7.27 — the evaluator's own `VERDICT` line), or a def-declared `human_confirm_if` condition
1395
+ * (`defGate: true`). `verdictSummary` is the denial reason.
1396
+ *
1397
+ * The seven additive keys (api-types 0.38.0 — the engine has emitted all eleven fields, twelve JSON
1398
+ * keys with `type`, since wicked-core#464; `event.rs::GateEscalated`) carry what a decision arm
1399
+ * needs without re-reading the unit. ABSENT on a daemon whose engine predates them; when present
1400
+ * they are ALWAYS all present.
1401
+ */
1212
1402
  export interface GateEscalatedEvent {
1213
1403
  type: 'gateEscalated';
1214
1404
  session: string;
1215
1405
  ord: number;
1216
1406
  condition: string;
1217
1407
  verdictSummary: string;
1408
+ /** The attempt whose output — persisted as the unit's REJECTED transcript — this gate reviews. */
1409
+ attempt?: number;
1410
+ /**
1411
+ * The raw denial LAYER token (`gateEvaluated.denial.source`): `worktree_guard` ·
1412
+ * `input_governance` · `dead_seat` · `repo_checks` · `repo_checks_timeout` · `pinned_validator`
1413
+ * · `substance` · `deliverables` · `agent_validator` · `worker_failure` · `evaluator_verdict`
1414
+ * (0.7.27) · `governance`. `""` (EMPTY) = a hook veto whose source identity was folded away
1415
+ * (`actor.rs` `boundary_deny` arm with no structured denial) — a reader keys copy on
1416
+ * `(condition, denialSource)` and treats `""` beside `boundary_deny` as input governance.
1417
+ */
1418
+ denialSource?: string;
1419
+ /** `true` when the unit's OWN def declared this escalation (`human_confirm_if`); `false` = engine-authored. */
1420
+ defGate?: boolean;
1421
+ /** The phase produced output text — the precondition of an "accept the captured output" arm. */
1422
+ outputCaptured?: boolean;
1423
+ /**
1424
+ * The worktree guard's restore outcome, mirroring {@link WorktreeRestoredEvent} — meaningful for
1425
+ * `evaluator_mutated_worktree` only; `false` / `[]` / `null` for every other class.
1426
+ */
1427
+ restored?: boolean;
1428
+ /** The paths the restore discarded (`git status --porcelain` status + path), as {@link WorktreeRestoredEvent.discarded}. */
1429
+ discarded?: { status: string; path: string }[];
1430
+ /** The `refs/wicked/suggestions/<run>/<ord>/<attempt>` ref holding the discarded changes; `null` when none. */
1431
+ suggestionRef?: string | null;
1218
1432
  }
1219
1433
 
1434
+ /**
1435
+ * F-E2E-039 (api-types 0.38.0; emitted since wicked-core `pipeline.rs` armed it): the containment
1436
+ * POSTURE a unit's worker actually ran under, once per dispatch, so a skin can say it instead of
1437
+ * implying an OS sandbox that was never armed. `os` — the registry seat record arms an OS write
1438
+ * boundary (macOS `sandbox-exec` / Linux `bwrap`); `advisory` — the record arms none, so
1439
+ * containment is the worktree guard plus the command-text fences, which a shell can evade.
1440
+ * `reason` is the engine's sentence naming the deciding record/flag.
1441
+ */
1442
+ export type SandboxPostureEvent = {
1443
+ type: 'sandboxPosture';
1444
+ session: string;
1445
+ ord: number;
1446
+ /** The registry seat key. */
1447
+ cli: string;
1448
+ posture: 'os' | 'advisory';
1449
+ reason: string;
1450
+ };
1451
+
1452
+ /**
1453
+ * F-RC1-064 / F-E2E-028 (api-types 0.38.0; emitted since wicked-core#456): a TERMINAL run's
1454
+ * worktree was KEPT because it holds uncommitted work the run branch does not carry — named on the
1455
+ * wire so a skin can point the operator at the path. Cancel and the terminal reap apply the same
1456
+ * rule; the retention window (`WICKED_COMPLETED_WORKTREE_KEEP_DAYS`) then reaps it clean-only. A
1457
+ * clean tree is reaped and emits nothing. Session-level (no `ord`). Both new frames are `type`
1458
+ * aliases on purpose — see {@link EvaluatorMutatedWorktreeEvent}: an alias satisfies `CoreEvent`'s
1459
+ * index signature and relays through the CoreEvent-typed broadcast seams unchanged.
1460
+ */
1461
+ export type WorktreeRetainedEvent = {
1462
+ type: 'worktreeRetained';
1463
+ session: string;
1464
+ /** The kept worktree's absolute path (the engine's; a skin never resolves it). */
1465
+ path: string;
1466
+ reason: string;
1467
+ };
1468
+
1220
1469
  /** P2 — a tool-executor command was dispatched (non-agent unit). */
1221
1470
  export interface ToolExecutorDispatchedEvent {
1222
1471
  type: 'toolExecutorDispatched';
@@ -1323,6 +1572,51 @@ export interface RepoCheckRun {
1323
1572
  /** The last 4 KiB of each stream — the evidence, verbatim. */
1324
1573
  stdoutTail: string;
1325
1574
  stderrTail: string;
1575
+ /**
1576
+ * The baseline-diff floor's evidence (api-types 0.38.0 — the seven keys the engine has emitted
1577
+ * since wicked-core#469 / #476). PRESENT ON EVERY CHECK from that engine on: the one producer of
1578
+ * this camelCase form, `event.rs::check_run_json`, writes all seven every time — `0` / `null` / `[]`
1579
+ * when there is nothing to say (the Rust `Option` → `null` rule; the struct's own
1580
+ * `skip_serializing_if` governs the persisted record, not this frame). ABSENT only on an older
1581
+ * engine — the `?:` is that one case, so read with `== null`, never `=== undefined`. `boundS` — the
1582
+ * EFFECTIVE wall-clock bound the check ran under, seconds (base × host-load factor; a bare number,
1583
+ * `0` when unknown); `boundNote` — how it was derived, for the operator (`null` when none).
1584
+ */
1585
+ boundS?: number;
1586
+ boundNote?: string | null;
1587
+ /**
1588
+ * Failure identifiers streamed off the runner's output (`test a::b ... FAILED`, ` FAIL file >
1589
+ * name`, `path: error TS1234: …`) — what the baseline diff compares. `[]` when the runner's format
1590
+ * is not one the scanner knows (the diff then compares exit codes).
1591
+ */
1592
+ failureIds?: string[];
1593
+ /**
1594
+ * Set when the check FAILED and the same check was run on the base (`base`): `regression` (head
1595
+ * failures absent on the base — denies) or `pre_existing_in_sandbox` (equal failure sets — never
1596
+ * this change's doing); `floor_env_mismatch` was emitted by engines before wicked-core-ts 0.7.27
1597
+ * and is retired. An OPEN string — new tokens may follow; `null` when the check passed,
1598
+ * timed out, could not run, or no base comparison was possible (the check then denies as before).
1599
+ */
1600
+ classification?: string | null;
1601
+ /** Head failures that ALSO fail on the base (never this change's doing); `[]` when none. */
1602
+ preExisting?: string[];
1603
+ /** Head failures ABSENT on the base — the regressions that deny; `[]` when none. */
1604
+ regressions?: string[];
1605
+ /** The same check run on the run BASE, when the floor ran it; `null` otherwise. */
1606
+ base?: RepoCheckBaseRun | null;
1607
+ }
1608
+
1609
+ /**
1610
+ * `RepoCheckRun.base` — the same check on the run base (api-types 0.38.0; wicked-core
1611
+ * `repo_checks.rs::BaseRun`, serialised by `event.rs::base_run_json`). Typed as an OPEN object this
1612
+ * release; the engine writes all four keys every time: `head` (the base commit), `cached` (read back
1613
+ * from this run's cache), `run` (a nested check run — `null` when the base could not be run) and
1614
+ * `error` (why not: export failed, the base declares no such check, its install failed, the repo
1615
+ * opted out — the head check then denies fail-closed; `null` when it ran). The fields are named in
1616
+ * the next minor (DES-L2 2C); read them through `unknown` narrowing until then.
1617
+ */
1618
+ export interface RepoCheckBaseRun {
1619
+ [k: string]: unknown;
1326
1620
  }
1327
1621
 
1328
1622
  /** wicked-core F-039 — the engine ran the repository's OWN checks in the worktree for the def's
@@ -1594,6 +1888,15 @@ export interface UnitReworkAmendedEvent {
1594
1888
  amendment: string;
1595
1889
  /** The unit's description after the amendment was injected. */
1596
1890
  updatedDescription: string;
1891
+ /**
1892
+ * WHICH unit received the text and WHY (api-types 0.38.0, additive; DES-L1 PR-1B, wicked-core-ts ≥
1893
+ * 0.7.27): `'cursor'` — the gated unit, today's approve-with-steer (`GateDecision.amendScope`
1894
+ * absent or `'cursor'`); `'creator'` — the first creator phase at/after the cursor
1895
+ * (`amendScope: 'creator'`); `'request_changes'` — the creator phase the gate rewound to, and
1896
+ * `amendment` then carries the evaluator's full findings + the operator's note. ABSENT on an
1897
+ * engine before the field — read as `'cursor'`.
1898
+ */
1899
+ scope?: 'cursor' | 'creator' | 'request_changes';
1597
1900
  }
1598
1901
 
1599
1902
  /** P2 — a worker's ApplyStepResult arrived and output is ready to be gated. Fires before GateDecided.
@@ -1680,6 +1983,20 @@ export interface UnitDistributedEvent {
1680
1983
  /** WHY the candidate seats were narrowed BEFORE the council voted (core#401): a non-portable
1681
1984
  * skill constrained the unit to a claude seat. `null` when every roster seat was a candidate. */
1682
1985
  seatConstraint: string | null;
1986
+ /**
1987
+ * The evaluator ≠ creator DISCLOSURE as a field (wicked-core#461, crew#556): `'creator_seat'` when a
1988
+ * review/test unit STAYS on a seat that built what it checks because no eligible seat distinct from
1989
+ * the builders admits it — a single-eligible-seat roster, or a bench that emptied the pool
1990
+ * (`degradedReason` then says which; on a bench-free single-seat roster it stays `null`, so this
1991
+ * field is the ONLY disclosure). `null` otherwise. The fallback seat is always a still-eligible one:
1992
+ * a benched or dead seat is never the fallback.
1993
+ *
1994
+ * OPTIONAL on this side of the wire deliberately: the engine emits the key unconditionally (`null`,
1995
+ * never absent — the `seatConstraint` rule) from the wicked-core release carrying #461 on, but an
1996
+ * older engine does not send it at all, and this contract must read frames from both. Consumers
1997
+ * guard with `== null`, never `=== undefined`.
1998
+ */
1999
+ distinctnessFallback?: 'creator_seat' | null;
1683
2000
  /** @deprecated api-types 0.36.0 — the engine emits `routingMethod`; removed in 0.37. */
1684
2001
  routing_method?: 'council' | 'degraded' | 'evaluator_distinct' | 'tool';
1685
2002
  /** @deprecated api-types 0.36.0 — the engine emits `agreementPct`; removed in 0.37. */
@@ -2052,6 +2369,11 @@ export interface SkillBaselineRecord {
2052
2369
  * the portable form names that skill (`wicked-garden-<x>`) instead;
2053
2370
  * - `requires-harness:claude` — the author declared `metadata.requires-harness: claude` in the
2054
2371
  * frontmatter: the skill genuinely needs the Claude harness (not an authoring defect).
2372
+ * - `claude-dispatch` (api-types 0.38.0; crew ≥ 0.7.36, DES-L6 D-21) — the body CALLS a Claude
2373
+ * Code dispatch primitive (`Task(`, `Skill(`, `context: fork`, `AskUserQuestion`, `TaskCreate`)
2374
+ * that no other seat has: a pi/opencode/codex worker cannot follow it. The portable form is the
2375
+ * plain-prose Hand-off paragraph. Reported by the publisher; garden's lint fails the same
2376
+ * skill (12.38.0). An older daemon never emits the token.
2055
2377
  */
2056
2378
  export type SkillPortabilityReason =
2057
2379
  | 'plugin-root'
@@ -2059,7 +2381,8 @@ export type SkillPortabilityReason =
2059
2381
  | 'cwd-script'
2060
2382
  | 'relative-link'
2061
2383
  | 'cross-skill-path'
2062
- | 'requires-harness:claude';
2384
+ | 'requires-harness:claude'
2385
+ | 'claude-dispatch';
2063
2386
 
2064
2387
  /** Per-reason portability of a skill (F-079, api-types 0.34.0) — reported beside `portable`. */
2065
2388
  export interface SkillPortability {
@@ -2358,6 +2681,17 @@ export interface SkillMutationResult extends SkillAnalyzeResult {
2358
2681
  * (`snapshot: null`), not a 409. */
2359
2682
  export interface SkillPublishResult extends SkillAnalyzeResult {
2360
2683
  snapshot: { gen: number; path: string; contentHash: string; skills: number } | null;
2684
+ /** The BASE skill posture AFTER this publish (crew#554): `present: false` with a `finding` is the
2685
+ * "published a snapshot without the discipline skill" warning. Absent on a daemon before it. */
2686
+ baseSkill?: BaseSkillPosture | null;
2687
+ /**
2688
+ * `true` when the publish found NOTHING to publish (api-types 0.38.0; crew#547 / DES-L6, crew ≥
2689
+ * 0.7.36): the effective tree's `contentHash` equals the current generation's, so no new
2690
+ * `snapshots/<gen>/` was minted, `current` did not move and `snapshot` is the CURRENT generation
2691
+ * (its `gen` unchanged). ABSENT (never `false`) on a publish that staged a generation, and on a
2692
+ * daemon before the field — a skin shows "already published as gen N", not a new generation.
2693
+ */
2694
+ unchanged?: true;
2361
2695
  }
2362
2696
 
2363
2697
  /** `POST /skills/refresh-baseline` 200 body — the three-way merge per FILE (baseline_old /
@@ -2379,6 +2713,9 @@ export interface SkillRefreshResult extends SkillAnalyzeResult {
2379
2713
  removed: string[];
2380
2714
  /** Skills flagged `conflict` by this refresh. */
2381
2715
  conflicts: string[];
2716
+ /** The BASE skill posture AFTER this refresh (crew#554): a refresh moves the CATALOG, not the handed
2717
+ * generation, so `inCatalog: true, present: false` reads "publish to hand it". Absent on a daemon before it. */
2718
+ baseSkill?: BaseSkillPosture | null;
2382
2719
  }
2383
2720
 
2384
2721
  /** The 409 body of a `/skills` mutation whose `expectedRevision` is stale — a CAS conflict, the
@@ -3000,6 +3337,30 @@ export interface LaunchRunBody {
3000
3337
  * omit the field entirely against pre-0.18 servers.
3001
3338
  */
3002
3339
  deliver?: 'pr' | 'none';
3340
+ /**
3341
+ * Who confirms the deliver phase (F-E2E-030; api-types 0.37.0, additive). `'human'` — the default when omitted:
3342
+ * the ENGINE pauses before the composed `deliver` Tool unit pushes the run branch and opens the
3343
+ * PR, whatever `humanConfirm` says (the push leaves the machine under the daemon's active gh
3344
+ * account, so it is confirmed unless the caller opts out). `'auto'` — the caller's EXPLICIT
3345
+ * opt-out: the push and PR follow verify unattended; a client sending it must name the posture
3346
+ * "auto-deliver" to its operator. `humanConfirm: 'none'` is NOT an opt-out (it is that field's
3347
+ * default and typo fallback). Requires wicked-core-ts ≥ 0.7.24 / crew ≥ 0.7.33 for the gate to
3348
+ * exist at all — read `AgentSession.auto_deliver` to learn whether the engine knows it. An
3349
+ * older daemon's launch schema rejects the field with a 400 — omit it against such servers.
3350
+ */
3351
+ deliverGate?: 'human' | 'auto';
3352
+ /**
3353
+ * REVISE an existing pull request instead of opening a new one (api-types 0.38.0, additive;
3354
+ * crew#550 / DES-L9, crew ≥ 0.7.36 on wicked-core-ts ≥ 0.7.27): the number of an OPEN same-repo PR.
3355
+ * The daemon resolves its head branch (`gh pr view` in the registered clone), the engine bases the
3356
+ * run's worktree on that head, and the deliver phase pushes exactly the run's commits to that
3357
+ * branch and comments the run record on the PR — no second PR, no rebase. Needs `repoRef` and
3358
+ * `workflow` (400 without), a resolved `deliver: 'pr'` (409 otherwise; an explicit
3359
+ * `deliver: 'none'` is a 400), and the PR must be OPEN and not from a fork (409 naming why).
3360
+ * Send it ONLY when `GET /health.capabilities.revisesPr === true` — an older daemon's strict
3361
+ * launch schema rejects the key with a 400.
3362
+ */
3363
+ revisesPr?: number;
3003
3364
  /**
3004
3365
  * Retry lineage (DES-UX-001 §8.3, CREW-UX-3; api-types 0.8.0): the id of the run this
3005
3366
  * launch retries. Must name an EXISTING run id — an unknown id fails the launch (400 with
@@ -3185,6 +3546,15 @@ export interface WorkflowDef {
3185
3546
  phases: PhaseDef[];
3186
3547
  /** True for built-in workflows that have dedicated entry points and must not appear in the work-mode selector. */
3187
3548
  is_system?: boolean;
3549
+ /**
3550
+ * The BASE skill every agent phase of THIS workflow follows (wicked-core#468; additive, engine
3551
+ * ≥ the release carrying it — an older engine's strict def parser refuses the key). The engine
3552
+ * leads every unit prompt with `Invoke your skill "<base>" … and follow its §<role> section`
3553
+ * before the phase's `skill_ref` directive. Absent ⇒ the daemon's `SystemSettings.baseSkillRef`
3554
+ * default (exported as `WICKED_BASE_SKILL_REF`); `""` ⇒ an explicit opt-out for this workflow.
3555
+ * Gated at intake: a launch whose snapshot lacks the skill is refused before any unit is planned.
3556
+ */
3557
+ base_skill_ref?: string | null;
3188
3558
  }
3189
3559
 
3190
3560
  /** Top-level requirements_graph.json artifact (schema 1.0.0). */
@@ -3249,7 +3619,15 @@ export interface CodeGraphEdge { src: string; tgt: string; }
3249
3619
  export interface CodeGraphData {
3250
3620
  nodes: CodeGraphNode[];
3251
3621
  edges: CodeGraphEdge[];
3622
+ /** Counts of the SERVED SLICE (`graph-view --limit`, `SystemSettings.graphNodeLimit`) — what is in `nodes`/`edges`. */
3252
3623
  stats: { nodeCount: number; edgeCount: number; fileCount: number };
3624
+ /**
3625
+ * Whole-graph counts (api-types 0.38.0, additive; crew#505 / F-RC1-100): what the repository's
3626
+ * estate database holds in total, from `wicked-estate stats`, so a tile can read "150 of 5,470
3627
+ * symbols shown" instead of presenting the slice as the repo. ABSENT when the stats line did not
3628
+ * parse or on a daemon before the field — then only the slice is known; never substitute `stats`.
3629
+ */
3630
+ totals?: { nodes: number; edges: number; files: number };
3253
3631
  }
3254
3632
 
3255
3633
  /**
@@ -3311,6 +3689,26 @@ export interface SystemSettings {
3311
3689
  * launches (those are always `'none'`).
3312
3690
  */
3313
3691
  deliverDefault?: 'pr' | 'none';
3692
+ /**
3693
+ * The BASE skill every governed agent unit follows (crew#554 / wicked-core#468; additive): the
3694
+ * frontmatter name the daemon exports as the engine-config default `WICKED_BASE_SKILL_REF`, so
3695
+ * the engine leads EVERY unit prompt with `Invoke your skill "<base>" … and follow its §<role>
3696
+ * section` (`creator` | `evaluator` | `neutral`) ahead of the phase's own `skill_ref` directive.
3697
+ * A workflow def's own `base_skill_ref` overrides it (`""` there = opt-out for that workflow).
3698
+ * Shipped default `"wicked-garden-governed-worker"`; `""` = OFF (the variable is deleted).
3699
+ * Absent reads as the shipped default.
3700
+ */
3701
+ baseSkillRef?: string;
3702
+ /**
3703
+ * What a published snapshot WITHOUT the base skill means (crew#554; additive). `'warn'` (the
3704
+ * default): the daemon exports the variable ONLY when the current generation holds the skill —
3705
+ * otherwise runs proceed without the discipline directive and `GET /diagnostics.skills` carries a
3706
+ * `skills.base-skill` WARNING (a fresh install lacks the skill until the garden that ships it is
3707
+ * published). `'require'`: the variable is always exported and the engine REFUSES every launch at
3708
+ * intake until a generation holding the skill is published (`POST /runs` → 422
3709
+ * `base_skill_refused`); the finding is an `error`.
3710
+ */
3711
+ baseSkillPolicy?: 'warn' | 'require';
3314
3712
  /**
3315
3713
  * The stall watchdog's DETECTION threshold (crew#287; api-types 0.18.0 — previously a
3316
3714
  * daemon-local extension): minutes a run in `executing` may go without ANY engine event on the
@@ -3363,6 +3761,18 @@ export interface SystemSettings {
3363
3761
  [key: `studio.${string}`]: unknown;
3364
3762
  }
3365
3763
 
3764
+ /**
3765
+ * `GET /settings` → 200 (api-types 0.38.0 — the body's first named type; the shape `{ settings }`
3766
+ * is unchanged since 0.1). `path` (additive; DES-L10 PR-L10-6, crew ≥ 0.7.35) is the ABSOLUTE
3767
+ * path of the settings file the daemon reads and writes (`WICKED_CREW_SYSTEM_SETTINGS` honoured),
3768
+ * so a skin names the real file instead of a guessed default. ABSENT on a daemon before the field
3769
+ * — render "the daemon's settings file", never a fabricated path.
3770
+ */
3771
+ export interface SettingsResponse {
3772
+ settings: SystemSettings;
3773
+ path?: string;
3774
+ }
3775
+
3366
3776
  // ── Requirements management (server-side search + overrides; crew api/requirements.ts) ──
3367
3777
  export interface RequirementSummary {
3368
3778
  key: string;
@@ -3997,6 +4407,31 @@ export interface ChatListResponse {
3997
4407
  chats: ChatSummary[];
3998
4408
  }
3999
4409
 
4410
+ /**
4411
+ * Token/cost burn of ONE seat's chat turn (api-types 0.38.0; DES-L5, crew ≥ 0.7.35 on wicked-core-ts
4412
+ * ≥ 0.7.26) — mirrors the engine's `Usage` (`workflow.rs`) as `chatReply.usage`: `null` on bridges
4413
+ * that emit no usage (pi, agy). `costUsd` is `null` when no price is known — never `0`.
4414
+ */
4415
+ export interface ChatUsage {
4416
+ inputTokens: number;
4417
+ outputTokens: number;
4418
+ cacheReadTokens: number;
4419
+ cacheCreationTokens: number;
4420
+ costUsd: number | null;
4421
+ }
4422
+
4423
+ /**
4424
+ * One record of a chat's persisted transcript (api-types 0.38.0; DES-L5 D-13): the daemon appends
4425
+ * the operator's message and every seat's reply to `<state home>/chats/<id>.jsonl` for the CHAT'S
4426
+ * LIFETIME (dropped on `chatClosed`, cleared at boot) and serves them on `GET /chats/:id.messages`
4427
+ * in append order. `at` is epoch millis; `turnId` is always present (only turn-stamped frames are
4428
+ * persisted). A `seat` record's `ok: false` text names the reason (a budget eviction reads
4429
+ * "exceeded the N s turn budget … target it on your next message to re-seat it").
4430
+ */
4431
+ export type ChatTranscriptRecord =
4432
+ | { at: number; turnId: string; kind: 'user'; text: string; seats: string[] }
4433
+ | { at: number; turnId: string; kind: 'seat'; cliKey: string; text: string; ok: boolean; usage: ChatUsage | null };
4434
+
4000
4435
  /** `GET /chats/:id` → 200. */
4001
4436
  export interface ChatDetailResponse {
4002
4437
  chatId: string;
@@ -4007,6 +4442,12 @@ export interface ChatDetailResponse {
4007
4442
  * the admission copy survives a reload; `null` for a chat this daemon did not open; absent on a
4008
4443
  * daemon predating the field. */
4009
4444
  refused?: ChatSeatRefusal[] | null;
4445
+ /**
4446
+ * The chat's transcript so far (api-types 0.38.0, additive; DES-L5, crew ≥ 0.7.35) — `[]` for a
4447
+ * chat with no persisted turn yet; ABSENT on a daemon predating the field (a rejoin then shows
4448
+ * "session continues" without history). Unbounded — a reply may be up to the engine's cap.
4449
+ */
4450
+ messages?: ChatTranscriptRecord[];
4010
4451
  }
4011
4452
 
4012
4453
  // ── Project code graph (DES-PROJECT-001; the co-located multi-repo graph) ──────
@@ -4594,6 +5035,10 @@ export interface DiagnosticsResponse {
4594
5035
  skills: DiagnosticsSkills;
4595
5036
  /** Whether the engine's governance evidence is LANDING (api-types 0.31.0, crew#495) — see `DiagnosticsGovernance`. */
4596
5037
  governance: DiagnosticsGovernance;
5038
+ /** The state-home classification (additive; wicked-core#411 / wicked-crew#497) — see
5039
+ * `DiagnosticsStateHome`. `null` on a daemon booted without the watch (some tests); ABSENT on a
5040
+ * daemon before this field. */
5041
+ stateHome?: DiagnosticsStateHome | null;
4597
5042
  }
4598
5043
 
4599
5044
  // ── Diagnostics — governance store + dead letters (api-types 0.31.0, crew#495 / F-022) ─────────
@@ -4702,14 +5147,19 @@ export interface DiagnosticsSkillsFinding {
4702
5147
  * crew#535) = the CURRENT generation was published under OTHER portability rules than the daemon
4703
5148
  * now runs — accepted (the snapshot is never rewritten; the runtime stays `published`), the rows
4704
5149
  * that now derive differently are named (`SkillsManifestResponse.current.drift`), and a publish
4705
- * records the running rules and clears it. */
5150
+ * records the running rules and clears it; `skills.base-skill` (crew#554 / wicked-core#468) =
5151
+ * the configured BASE skill (`SystemSettings.baseSkillRef`) is not in the current generation —
5152
+ * a `warning` under `baseSkillPolicy: 'warn'` (runs proceed without the discipline directive),
5153
+ * an `error` under `'require'` (the engine refuses every launch at intake); cleared by a publish
5154
+ * that hands it. Also carried as `DiagnosticsSkills.baseSkill.finding`. */
4706
5155
  kind:
4707
5156
  | 'skills.fallback'
4708
5157
  | 'skills.blocked'
4709
5158
  | 'skills.config'
4710
5159
  | 'skills.source'
4711
5160
  | 'skills.manifest'
4712
- | 'skills.stale-rules';
5161
+ | 'skills.stale-rules'
5162
+ | 'skills.base-skill';
4713
5163
  severity: 'warning' | 'error';
4714
5164
  message: string;
4715
5165
  }
@@ -4738,6 +5188,141 @@ export interface DiagnosticsSkills {
4738
5188
  * layout. `null` only when `disabled`. */
4739
5189
  stateHome: string | null;
4740
5190
  findings: DiagnosticsSkillsFinding[];
5191
+ /** The BASE skill posture (crew#554) — the System page's "discipline skill" row beside the skills
5192
+ * generation; its `finding` (when the generation lacks the skill) also rides `findings`. `null`
5193
+ * when the setting is off or the seam is `disabled`. A daemon before this field omits the key
5194
+ * (read it as `null`). */
5195
+ baseSkill: BaseSkillPosture | null;
5196
+ }
5197
+
5198
+ /**
5199
+ * The BASE skill in force for the next launch (crew#554 — the launcher half of wicked-core#468).
5200
+ * The engine leads EVERY agent unit's prompt with one role-keyed directive naming this skill and
5201
+ * the unit's `§<role>` section; a launch whose handed snapshot lacks it is refused at intake. The
5202
+ * daemon judges the setting against the CURRENT published generation and exports
5203
+ * `WICKED_BASE_SKILL_REF` per `policy` (see `SystemSettings.baseSkillPolicy`). Carried by
5204
+ * `GET /health.baseSkill`, `GET /diagnostics.skills.baseSkill`, `POST /skills/publish` and
5205
+ * `POST /skills/refresh-baseline` results, and the 422 `base_skill_refused` launch body.
5206
+ */
5207
+ export interface BaseSkillPosture {
5208
+ /** The frontmatter name (`wicked-garden-governed-worker` by default). */
5209
+ name: string;
5210
+ policy: 'warn' | 'require';
5211
+ /** The published generation the engine is handed holds the skill — the intake admission passes. */
5212
+ present: boolean;
5213
+ /** The editor catalog holds the skill enabled — the NEXT publish hands it. */
5214
+ inCatalog: boolean;
5215
+ /** The generation judged (`current`), or `null` when nothing is published. */
5216
+ gen: number | null;
5217
+ /** What `WICKED_BASE_SKILL_REF` is exported as right now: the name, or `null` = unset (runs proceed without a base skill). */
5218
+ engineInput: string | null;
5219
+ /** The `skills.base-skill` finding when the generation lacks the skill (`warning` under `warn`, `error` under `require`); `null` when it holds it. */
5220
+ finding: DiagnosticsSkillsFinding | null;
5221
+ }
5222
+
5223
+ /**
5224
+ * `POST /runs` **422** (crew#554): the engine refused the launch AT INTAKE because the handed skills
5225
+ * snapshot lacks the run's base skill (`SkillsError::BaseSkillRefused` — `baseSkillPolicy:
5226
+ * 'require'`, or a workflow def's own `base_skill_ref`). Nothing was planned or persisted; no run
5227
+ * id exists. `error` is the engine's message naming the skill; `baseSkill` is the daemon's posture
5228
+ * at refusal time; `remedy` names the fix (publish a generation holding it, or relax the policy).
5229
+ */
5230
+ export interface BaseSkillRefusedResponse {
5231
+ code: 'base_skill_refused';
5232
+ error: string;
5233
+ baseSkill: BaseSkillPosture | null;
5234
+ remedy: string;
5235
+ }
5236
+
5237
+ // ── Diagnostics — the state-home classification (additive; wicked-core#411 / wicked-crew#497) ───
5238
+ //
5239
+ // The worker Read fence over the daemon state home is an EXPLICIT registry (design v3.1 §1): an
5240
+ // entry it does not classify refuses the launch by name, fail closed. Right — but it used to fire
5241
+ // at the run's FIRST WORKER, after a planning council and the intake gate, labelled "triage judge
5242
+ // errored", while the daemon booted green (F-RC1-011, F-RC2-020, F-032/F-033). Now the daemon
5243
+ // surveys the state home at boot and on every read of this block, logs one error line per entry
5244
+ // (`recentErrors`), warns on `GET /health`, and answers `POST /runs` 409 `state_home_unregistered`
5245
+ // while a handed snapshot derives a state home with such an entry; the engine refuses at intake.
5246
+
5247
+ /** One entry the state-home registry cannot classify. */
5248
+ export interface DiagnosticsStateHomeEntry {
5249
+ /** The entry's name as listed. */
5250
+ name: string;
5251
+ /** Its absolute path on the daemon host. */
5252
+ path: string;
5253
+ /** `state-home` — a top-level entry; `skills-root` — a child of `<state home>/skills` that is
5254
+ * neither the read slot (`snapshots`) nor a registered denied child. */
5255
+ level: 'state-home' | 'skills-root';
5256
+ }
5257
+
5258
+ /** One finding of the state-home survey — the same text `GET /health.warnings[]` carries. */
5259
+ export interface DiagnosticsStateHomeFinding {
5260
+ kind: 'state-home.unregistered';
5261
+ severity: 'error';
5262
+ message: string;
5263
+ }
5264
+
5265
+ /**
5266
+ * `GET /diagnostics` → `stateHome`: which state home the worker Read fence classifies, every entry
5267
+ * it cannot classify there, who classified, and whether that refuses launches. Honest throughout:
5268
+ * a field the daemon cannot answer is `null`, never invented.
5269
+ */
5270
+ export interface DiagnosticsStateHome {
5271
+ /** The state home surveyed, or `null` when neither input yields one. */
5272
+ stateHome: string | null;
5273
+ /** `snapshot` — derived from the handed `WICKED_SKILLS_SNAPSHOT` by its
5274
+ * `<state home>/skills/snapshots/<gen>` shape (the directory the fence classifies); `db` — the
5275
+ * core db's parent, surveyed for information when no snapshot is handed. */
5276
+ derivedFrom: 'snapshot' | 'db' | null;
5277
+ /** Who classified: the engine (`Core.preflightStateHome`, the fence's own code), crew's registry
5278
+ * copy on an addon without it, or nobody (`unavailable`: no db path and no snapshot). */
5279
+ source: 'engine' | 'crew' | 'unavailable';
5280
+ unregistered: DiagnosticsStateHomeEntry[];
5281
+ /** `true` exactly when a HANDED snapshot derives a state home with unregistered entries — the
5282
+ * condition the engine refuses every launch on, and what `POST /runs` answers 409 for. */
5283
+ refusesLaunches: boolean;
5284
+ findings: DiagnosticsStateHomeFinding[];
5285
+ /** What to do, in operator terms — the same text the 409 body and every finding end with. */
5286
+ remedy: string;
5287
+ /** Why the survey could not run (an unresolvable snapshot, an unlistable directory), or `null`. */
5288
+ error: string | null;
5289
+ /** When this survey was taken (unix ms). */
5290
+ checkedAt: number;
5291
+ }
5292
+
5293
+ /**
5294
+ * The `POST /runs` **409** body while the state home refuses launches (`code:
5295
+ * 'state_home_unregistered'`): the configuration error as fields — every entry and the remedy —
5296
+ * so a composer can show the blocker instead of a bare string.
5297
+ */
5298
+ export interface StateHomeBlockerBody {
5299
+ error: string;
5300
+ code: 'state_home_unregistered';
5301
+ stateHome: string | null;
5302
+ unregistered: DiagnosticsStateHomeEntry[];
5303
+ remedy: string;
5304
+ }
5305
+
5306
+ /**
5307
+ * The `POST /runs` **409** body when the engine refuses the launch at intake because the roster has
5308
+ * NO eligible seat (`code: 'no_eligible_seat'`; wicked-core#461's typed `NoEligibleSeat`, crew#556):
5309
+ * the plan needs a seat and every configured seat was benched by the launcher — signed out, out of
5310
+ * quota, not installed (crew's `council_eligible: false` → the engine's `health.usable: false`).
5311
+ * Nothing was persisted, nothing reached the wire. A 409, not a 400: the body is well-formed and the
5312
+ * same request succeeds once a seat is signed in — the conflict is with the roster's current
5313
+ * standing (the `state_home_unregistered` rule), and not a 5xx: the engine is healthy and said no.
5314
+ */
5315
+ export interface NoEligibleSeatBody {
5316
+ /** The engine's own text: `no eligible seat for <run>: <benched> — sign a seat in, or add one, …`. */
5317
+ error: string;
5318
+ code: 'no_eligible_seat';
5319
+ /** The refused run id (never persisted). */
5320
+ runId: string;
5321
+ /** The bench, seat by seat with its cause — `"2 of 2 seats benched: codex (signed out — launcher),
5322
+ * copilot (quota exhausted — launcher)"` — the engine's `benched_summary`, verbatim. */
5323
+ benched: string;
5324
+ /** What to do, in operator terms. */
5325
+ remedy: string;
4741
5326
  }
4742
5327
 
4743
5328
  // ── Memory proposal queue (DES-MEM-FACETED-001 §5.0, api-types 0.21.0) ─────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew-api-types",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "description": "The wire contract of the wicked-crew daemon's /api/v1 REST surface and /ws CoreEvent frames \u2014 types only, zero runtime",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",