wicked-crew-api-types 0.32.0 → 0.33.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 +226 -10
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -590,6 +590,12 @@ export interface CoreEvent {
590
590
  denialReason?: string | null;
591
591
  /** `gateEvaluated`: the final deny-dominant decision over all layers (mirrors `gateDecided.allow`). */
592
592
  combined?: boolean;
593
+ /** `gateEvaluated` (wicked-core#431, api-types 0.33.0): WHO rendered `agentVerdict` — the council seat key
594
+ * the layer-2 judge ran under; `null` when no judge ran, and on the bus-mediated path. */
595
+ judgeCli?: string | null;
596
+ /** `gateEvaluated` (wicked-core#431): whether that judge was identity-distinct from the work's author
597
+ * (`true` = the rotation pick, `false` = the single default runner); `null` when no judge ran. */
598
+ judgeDistinct?: boolean | null;
593
599
  // sessionStarted enrichment fields (snake_case — serde wire names)
594
600
  workflow_id?: string | null;
595
601
  cli_count?: number;
@@ -688,7 +694,10 @@ export interface CoreEvent {
688
694
  /** campaignNodeStarted / campaignNodeAwaitingHuman: the node's attempt-keyed Run id. */
689
695
  runId?: string;
690
696
  // assumptionRecorded (external-transform convention) — camelCase per event_to_json
691
- kind?: string;
697
+ /** `assumptionRecorded`: the assumption kind; `councilSeatFailed`: the failure branch;
698
+ * `evaluatorToolCallDenied` (wicked-core#431, api-types 0.33.0): the ACP `toolCall.kind` — `null`
699
+ * when the agent sent none. Widened to admit that `null`; every other producer still sends a string. */
700
+ kind?: string | null;
692
701
  library?: string;
693
702
  transform?: string;
694
703
  known?: boolean;
@@ -869,7 +878,11 @@ export interface UnitDenial {
869
878
 
870
879
  /** §3 B1 — the gate's decision depth, emitted alongside `gateDecided`. `denial` is the structured
871
880
  * twin of `denialReason`: `null` when the gate approved, else the winning layer (deny-dominates) —
872
- * `worktree_guard` and `repo_checks` are the two wicked-core F-036/F-039 layers. */
881
+ * `worktree_guard` and `repo_checks` are the two wicked-core F-036/F-039 layers. `judgeCli` /
882
+ * `judgeDistinct` (wicked-core#431 / F-3R2-007, api-types 0.33.0) name WHO rendered `agentVerdict`,
883
+ * so evaluator ≠ creator is auditable from the event stream alone (compare with the unit's
884
+ * `unitDistributed.cli`). Both keys are ALWAYS present: `null` when no judge ran (`agentVerdict`
885
+ * is `null` too) and on the bus-mediated evaluator path, where the seat is not reported back. */
873
886
  export interface GateEvaluatedEvent {
874
887
  type: 'gateEvaluated';
875
888
  session: string;
@@ -885,6 +898,13 @@ export interface GateEvaluatedEvent {
885
898
  denialReason: string | null;
886
899
  denial: UnitDenial | null;
887
900
  combined: boolean;
901
+ /** The council seat key the layer-2 judge ran under (`codex`, `pi`, …) — WHO rendered
902
+ * `agentVerdict`. `null` when no judge ran, and on the bus-mediated path. */
903
+ judgeCli: string | null;
904
+ /** Whether that judge seat was IDENTITY-DISTINCT from the work's author: `true` for the rotation
905
+ * pick, `false` when the judge fell back to the single default runner (prompt-only independence).
906
+ * `null` when no judge ran or the seat is unknown. */
907
+ judgeDistinct: boolean | null;
888
908
  }
889
909
 
890
910
  /** Foundation wave: session started with enriched context. */
@@ -934,13 +954,36 @@ export interface AcpSessionStartedEvent {
934
954
  acpSessionId: string;
935
955
  }
936
956
 
937
- /** P1 — ACP unavailable or failed for a CLI; the run continues with single-shot fallback. */
957
+ /**
958
+ * `acpFallback.fallbackKind` — WHY a unit left the ACP carrier for the wrapped (single-shot) one:
959
+ * - `binary_unavailable` / `session_died` / `auth_required` — the ACP session could not be had; the
960
+ * run continues single-shot (a FAILURE of the seat's transport or account, counted by seat health);
961
+ * - `governance_requires_wrapped` — a governed unit on a seat whose ACP adapter cannot enforce input
962
+ * governance is routed to the wrapped carrier by design (crew#276);
963
+ * - `read_only_requires_wrapped` (wicked-core#431 / F-3R2-009, api-types 0.33.0) — an
964
+ * `executes_code: false` unit (an evaluator, a recon rung, a review) on an ACP seat NOT admitted to
965
+ * input governance (pi-acp, codex-acp) is routed to the wrapped carrier BEFORE any ACP turn, where
966
+ * the read-only lever is an argv fact (`--sandbox read-only` / `--exclude-tools edit,write`). No
967
+ * per-call {@link EvaluatorToolCallDeniedEvent} exists on that route — consumers must not wait for one.
968
+ * The two `*_requires_wrapped` kinds are deliberate routing, not failures — never a seat-health signal.
969
+ * Open-ended (`string & {}`) so a newer engine's kind parses in an older consumer.
970
+ */
971
+ export type AcpFallbackKind =
972
+ | 'binary_unavailable'
973
+ | 'session_died'
974
+ | 'auth_required'
975
+ | 'governance_requires_wrapped'
976
+ | 'read_only_requires_wrapped'
977
+ | (string & {});
978
+
979
+ /** P1 — ACP unavailable or failed for a CLI, or the unit was deliberately routed off ACP; the run
980
+ * continues on the wrapped carrier. `fallbackKind` says which (see {@link AcpFallbackKind}). */
938
981
  export interface AcpFallbackEvent {
939
982
  type: 'acpFallback';
940
983
  session: string;
941
984
  cliKey: string;
942
985
  reason: string;
943
- fallbackKind: string;
986
+ fallbackKind: AcpFallbackKind;
944
987
  }
945
988
 
946
989
  // ── P2 observability events ─────────────────────────────────────────────────
@@ -1089,6 +1132,17 @@ export type EvaluatorMutatedWorktreeEvent = {
1089
1132
  afterTree: string;
1090
1133
  headMoved: boolean;
1091
1134
  changed: WorktreeChangedPath[];
1135
+ /** wicked-core#431 / F-3R2-010 (api-types 0.33.0): whether the engine RESTORED the creator's tree
1136
+ * (`beforeTree`) in the worktree right after detecting the mutation — so the retry a human
1137
+ * approves runs against the VERIFIED tree, never against the evaluator's edit. When `true` a
1138
+ * {@link WorktreeRestoredEvent} follows with the discarded paths, the gate's `denialReason` says the
1139
+ * edit was discarded, and the `awaitingHuman` prompt reads "… its edit was discarded and the
1140
+ * creator's verified tree restored. Approve to retry the phase against the restored tree …" (the
1141
+ * pre-0.33.0 prompt was "confirm to retry the phase"; a card that matched the old text must
1142
+ * re-check). `false` = the restore failed or was not attempted — `restoreError` says why — and the
1143
+ * denial keeps the manual `git read-tree` remedy. */
1144
+ restored: boolean;
1145
+ restoreError: string | null;
1092
1146
  };
1093
1147
 
1094
1148
  /** One repository check the engine ran in the run's worktree (wicked-core F-039). */
@@ -1096,7 +1150,11 @@ export interface RepoCheckRun {
1096
1150
  /** `install` | `typecheck` | `lint` | `test` | `cargo-test`. */
1097
1151
  name: string;
1098
1152
  argv: string[];
1099
- /** Provenance an operator can verify: `package.json scripts.test`, `Cargo.toml`, … */
1153
+ /** Provenance an operator can verify: `package.json scripts.test`, `Cargo.toml`, … For the `install`
1154
+ * step the lockfile and WHY it ran: `package-lock.json (node_modules absent)`, `pnpm-lock.yaml (…)`,
1155
+ * `yarn.lock (…)`, `package.json (…, no lockfile)` — and, since wicked-core#431 / #433, `… (forced:
1156
+ * lockfile drift)` when the deliver lift moved a lockfile/manifest between the old base and the
1157
+ * remote tip and the re-verify re-installed (frozen lockfile, `--ignore-scripts`) before the checks. */
1100
1158
  source: string;
1101
1159
  /** The process exit code; `null` when it produced none (timed out / could not spawn). */
1102
1160
  exitCode: number | null;
@@ -1136,7 +1194,17 @@ export interface RepoCheckRun {
1136
1194
  * true`): no manifest at all, or a readable `package.json` with no string `typecheck`/`lint`/`test`
1137
1195
  * script and no `Cargo.toml`. A manifest that cannot be read or trusted still FAILS.
1138
1196
  * "Done" for a verify phase is now the exit code the engine observed, not the seat's account of
1139
- * having run the suite. `type` alias on purpose — see {@link EvaluatorMutatedWorktreeEvent}. */
1197
+ * having run the suite.
1198
+ *
1199
+ * wicked-core#431 (api-types 0.33.0): the frame ALSO arrives for the DELIVER ord — a Tool unit —
1200
+ * whenever the worktree's tree is NOT the tree the run verified when the deliver phase is about to
1201
+ * push: after a lift onto the remote tip ({@link DeliverLiftEvaluatedEvent} `outcome: 'lifted'`), on
1202
+ * a retry after a failed re-verify, after an operator's by-hand rebase, or for a run that recorded
1203
+ * no verified tree. The engine re-runs the repository's checks on the tree that would ship before
1204
+ * allowing the push (a lockfile that moved with the base forces a frozen `--ignore-scripts` install
1205
+ * first), and the deliver unit's `gateEvaluated` then carries `hasDeterministicFloor: true` with
1206
+ * this floor's `criterion`. `passed: false` there fails the deliver unit closed — nothing is pushed.
1207
+ * `type` alias on purpose — see {@link EvaluatorMutatedWorktreeEvent}. */
1140
1208
  export type RepoChecksEvaluatedEvent = {
1141
1209
  type: 'repoChecksEvaluated';
1142
1210
  session: string;
@@ -1148,9 +1216,155 @@ export type RepoChecksEvaluatedEvent = {
1148
1216
  skipped: string[];
1149
1217
  };
1150
1218
 
1151
- /** The gate-evidence events (wicked-core F-036/F-039) as a discriminated union for consumers that
1152
- * narrow on `type`; they also flow through the permissive {@link CoreEvent}. */
1153
- export type GateEvidenceEvent = EvaluatorMutatedWorktreeEvent | RepoChecksEvaluatedEvent;
1219
+ // ── wicked-core#431 gate / deliver evidence (F-3R2-013 / -010 / -009; api-types 0.33.0) ──────────
1220
+
1221
+ /** wicked-core#431 / F-3R2-010 — the engine PUT THE CREATOR'S TREE BACK after an `executes_code:
1222
+ * false` phase changed it ({@link EvaluatorMutatedWorktreeEvent} with `restored: true`): the run
1223
+ * branch's `HEAD` is back at the baseline commit when the phase had moved it (`head`), the index and
1224
+ * working tree match `tree` (the baseline the actor snapshotted at dispatch), and every path the
1225
+ * phase ADDED is deleted. `discarded` names exactly what the evaluator's edit was — the same list the
1226
+ * mutation event carried as `changed` — so the ledger shows what was thrown away, and `suggestionRef`
1227
+ * says where the discarded edit was pinned so it can be read back. Emitted at the gate fold, AFTER
1228
+ * `evaluatorMutatedWorktree` and BEFORE `gateEvaluated`. `type` alias on purpose — see
1229
+ * {@link EvaluatorMutatedWorktreeEvent}. */
1230
+ export type WorktreeRestoredEvent = {
1231
+ type: 'worktreeRestored';
1232
+ session: string;
1233
+ ord: number;
1234
+ attempt: number;
1235
+ /** The seat that ran the unit. */
1236
+ cli: string;
1237
+ /** The workflow phase id (`verify`, `adversarial-review`, …). */
1238
+ phase: string;
1239
+ /** The tree id the worktree was restored to (the creator's baseline). */
1240
+ tree: string;
1241
+ /** The commit `HEAD` was reset to when the phase had moved it; `null` when it had not. */
1242
+ head: string | null;
1243
+ discarded: WorktreeChangedPath[];
1244
+ /** Where the DISCARDED tree was pinned so the edit is never lost (wicked-core#433 review
1245
+ * F-433-008 — the seam wicked-core#432's suggestion lane reads from):
1246
+ * `refs/wicked/suggestions/<run>/<ord>/<attempt>`, a commit whose tree is the mutation event's
1247
+ * `afterTree`. `null` when the pin failed (the discarded content is then only a gc-prunable
1248
+ * dangling tree). */
1249
+ suggestionRef: string | null;
1250
+ };
1251
+
1252
+ /**
1253
+ * `deliverLiftEvaluated.outcome` — what the engine's pre-push lift onto the remote default branch did:
1254
+ * - `unchanged` — the base was already the remote tip; the deliver rebase is a no-op and the tree the
1255
+ * checks verified is the tree that ships;
1256
+ * - `lifted` — the remote moved; the run's changes were re-applied onto its tip in the worktree
1257
+ * (`treeBefore` → `treeAfter`) and the repository's own checks were RE-RUN on the lifted tree (a
1258
+ * {@link RepoChecksEvaluatedEvent} for this ord) before the push was allowed;
1259
+ * - `conflict` — the lift would conflict in `conflicts`; the worktree was left exactly as verified and
1260
+ * the deliver unit FAILED with a `deliver: LIFT-CONFLICT — …` remedy — nothing rebased or pushed
1261
+ * (crew reads that marker as a recoverable strand, `delivery: 'stranded'`);
1262
+ * - `skipped` — the lift could not be DECIDED (no remote / fetch failed / git too old / a branch
1263
+ * carrying its own commits); the worktree was never touched and the deliver script's own rebase
1264
+ * stands, as before;
1265
+ * - `failed` — the lift was decided but its APPLICATION failed part-way; the worktree may hold a
1266
+ * partial state, the deliver unit fails closed, nothing was pushed.
1267
+ * Open-ended (`string & {}`) so a newer engine's outcome parses in an older consumer.
1268
+ */
1269
+ export type DeliverLiftOutcome =
1270
+ | 'unchanged'
1271
+ | 'lifted'
1272
+ | 'conflict'
1273
+ | 'skipped'
1274
+ | 'failed'
1275
+ | (string & {});
1276
+
1277
+ /** wicked-core#431 / F-3R2-013 — before the run's `deliver` Tool phase pushed, the engine LIFTED the
1278
+ * run's work onto the remote default branch's CURRENT tip (in memory, `git merge-tree`) and said what
1279
+ * that did (see {@link DeliverLiftOutcome}). Emitted once per deliver attempt, BEFORE the deliver
1280
+ * unit's `repoChecksEvaluated` (when a re-verify ran — the tree that would ship is not the recorded
1281
+ * verified tree) / `stepFailed` (conflict, failed, or a failed re-verify) / `unitDone`. The deliver
1282
+ * gate never pushes a tree that was not verified: on `unchanged` / `lifted` the deliver command
1283
+ * receives the verified remote-tip commit as `WICKED_DELIVER_VERIFIED_BASE` and crew's script refuses
1284
+ * to rebase past it (`deliver: BASE MOVED since verification — …`). `type` alias on purpose. */
1285
+ export type DeliverLiftEvaluatedEvent = {
1286
+ type: 'deliverLiftEvaluated';
1287
+ session: string;
1288
+ ord: number;
1289
+ attempt: number;
1290
+ outcome: DeliverLiftOutcome;
1291
+ /** The remote default ref the lift targets (`origin/main`), when one was resolved. */
1292
+ baseRef: string | null;
1293
+ /** The run branch's `HEAD` before the lift (the base the work was verified on). */
1294
+ baseBefore: string | null;
1295
+ /** The remote tip the work now sits on (`lifted`) or would have (`conflict`). */
1296
+ baseAfter: string | null;
1297
+ treeBefore: string | null;
1298
+ treeAfter: string | null;
1299
+ /** The paths the lift would conflict in (`conflict`); empty otherwise. */
1300
+ conflicts: string[];
1301
+ /** Why the lift was skipped / failed, or a disclosed degradation (a failed fetch); `null` otherwise. */
1302
+ note: string | null;
1303
+ };
1304
+
1305
+ /** wicked-core#431 / F-3R2-009 — an `executes_code: false` phase (an evaluator, a recon rung, a
1306
+ * review) asked to run a WRITE-CLASS tool (edit/write/delete/move, by ACP `kind` or by tool name) and
1307
+ * the engine REFUSED the call at the carrier's permission boundary, answering the agent's own reject
1308
+ * option. Fires on the ACP carrier (`carrier: 'acp'`) for a seat whose adapter is ADMITTED to input
1309
+ * governance (claude, opencode). A guarded unit on an UNADMITTED ACP seat never starts an ACP turn —
1310
+ * it is rerouted with `acpFallback {fallbackKind: 'read_only_requires_wrapped'}` and no per-call
1311
+ * event exists on that route. A refused call costs the seat one tool call, not the phase a retry;
1312
+ * the worktree guard ({@link EvaluatorMutatedWorktreeEvent}) remains the backstop for what a
1313
+ * permission boundary cannot see (a `bash` heredoc). `type` alias on purpose. */
1314
+ export type EvaluatorToolCallDeniedEvent = {
1315
+ type: 'evaluatorToolCallDenied';
1316
+ session: string;
1317
+ ord: number;
1318
+ attempt: number;
1319
+ /** The registry seat key (ACP-path convention, as `governanceUnenforced`). */
1320
+ cli: string;
1321
+ /** The carrier the refusal happened on — `'acp'` today. Open-ended for a future carrier. */
1322
+ carrier: 'acp' | (string & {});
1323
+ /** The tool the agent asked for, as it named it (`edit`, `write`, `str_replace_based_edit_tool`, …). */
1324
+ tool: string;
1325
+ /** The ACP `toolCall.kind` when the agent sent one (`edit`, `delete`, `move`, …); `null` otherwise. */
1326
+ kind: string | null;
1327
+ /** The path the call targeted, when its arguments carried one; `null` otherwise. */
1328
+ path: string | null;
1329
+ reason: string;
1330
+ };
1331
+
1332
+ /** wicked-core#431 / F-3R2-013 — how the run's BASE commit was chosen when its worktree was minted:
1333
+ * the engine fetches `origin` and, when the registered clone's `HEAD` is strictly behind the remote
1334
+ * default branch's tip, bases the run on that tip — so the worker starts from the current code and
1335
+ * the deliver lift has nothing to move. `lifted: true` = the base moved off the clone's `HEAD` by
1336
+ * `behind` commits; `false` = `HEAD` was already the tip, or was ahead of / diverged from it (local
1337
+ * unpushed work — kept, `note` says so), or no remote default ref resolved (`baseRef: null`).
1338
+ * Emitted once per freshly minted worktree, BEFORE `worktreeReady`; a resumed run reuses its live
1339
+ * worktree and emits nothing. Session-level (no `ord`). `type` alias on purpose. */
1340
+ export type RunBaseResolvedEvent = {
1341
+ type: 'runBaseResolved';
1342
+ session: string;
1343
+ /** The remote default ref (`origin/main`), or `null` when none could be resolved. */
1344
+ baseRef: string | null;
1345
+ /** The commit the run worktree was minted from. */
1346
+ baseCommit: string;
1347
+ /** The registered clone's `HEAD` at mint time. */
1348
+ localHead: string;
1349
+ /** How many commits `localHead` was behind `baseRef`; `0` when not behind or unknown. */
1350
+ behind: number;
1351
+ /** Whether `git fetch origin` succeeded (a failed fetch is disclosed in `note`, cached refs used). */
1352
+ fetched: boolean;
1353
+ lifted: boolean;
1354
+ note: string | null;
1355
+ };
1356
+
1357
+ /** The gate-evidence events (wicked-core F-036/F-039, extended by wicked-core#431 — api-types 0.33.0
1358
+ * added {@link WorktreeRestoredEvent}, {@link DeliverLiftEvaluatedEvent} and
1359
+ * {@link EvaluatorToolCallDeniedEvent}) as a discriminated union for consumers that narrow on `type`;
1360
+ * they also flow through the permissive {@link CoreEvent}. {@link RunBaseResolvedEvent} is
1361
+ * session-level evidence and stands on its own. */
1362
+ export type GateEvidenceEvent =
1363
+ | EvaluatorMutatedWorktreeEvent
1364
+ | RepoChecksEvaluatedEvent
1365
+ | WorktreeRestoredEvent
1366
+ | DeliverLiftEvaluatedEvent
1367
+ | EvaluatorToolCallDeniedEvent;
1154
1368
 
1155
1369
  // ── P2 decisions-full observability events (wicked-core EVT-001/012/013) ────
1156
1370
 
@@ -3731,7 +3945,9 @@ export interface AcpCliDiagnostics {
3731
3945
  sessionsStarted: number;
3732
3946
  /** Count of `acpFallback` events (ACP unavailable/failed; run continued single-shot). */
3733
3947
  fallbacks: number;
3734
- /** Fallback counts by `fallbackKind` (`session_died`, `auth_required`, `binary_unavailable`, …). */
3948
+ /** Fallback counts by `fallbackKind` (`session_died`, `auth_required`, `binary_unavailable`, and the
3949
+ * two deliberate reroutes `governance_requires_wrapped` / `read_only_requires_wrapped` — see
3950
+ * {@link AcpFallbackKind}). */
3735
3951
  fallbackKinds: Record<string, number>;
3736
3952
  /** Epoch ms of the newest `acpSessionStarted`, or `null` when none recorded. */
3737
3953
  lastStartedTs: number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew-api-types",
3
- "version": "0.32.0",
3
+ "version": "0.33.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",