wicked-crew-api-types 0.19.0 → 0.20.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 +55 -18
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -197,9 +197,14 @@ export interface AgentSession {
197
197
  *
198
198
  * - `'delivered'` — a PR was opened for this run (by the deliver phase, or post-hoc via
199
199
  * `POST /runs/:id/deliver`); `deliverUrl` carries the PR URL.
200
- * - `'stranded'` — a COMPLETED repo-scoped run with no recorded PR whose worktree still
201
- * exists on disk AND carries work: reviewable work nobody lifted. Derived honestly for
202
- * OLD runs too — records written before this field existed strand exactly the same way.
200
+ * - `'stranded'` — reviewable work nobody lifted, reached two ways: a COMPLETED repo-scoped
201
+ * run with no recorded PR whose worktree still exists on disk AND carries work (derived
202
+ * honestly for OLD runs too — records written before this field existed strand the same
203
+ * way); OR (crew#418) a run whose deliver phase hit a LIFT collision — a rebase conflict or
204
+ * non-fast-forward push — which the daemon reinterprets from the engine's `failed` to
205
+ * `completed`+`stranded`: its work is committed on the `wicked/<id>` branch (the engine
206
+ * reaps the now-clean worktree, but never the branch), recoverable via `POST /runs/:id/
207
+ * deliver`, which stands a throwaway worktree back up from that branch to lift it.
203
208
  * - `'vacuous'` — a COMPLETED repo-scoped run whose surviving worktree carries NO
204
209
  * contribution at all (crew#311: nothing uncommitted, no run-branch commit — units all
205
210
  * reached "done" while producing nothing). There is nothing to deliver; the recovery is a
@@ -425,6 +430,13 @@ export interface GateInfo {
425
430
  prompt: string;
426
431
  lifecycle: string;
427
432
  receivedAt: string;
433
+ /**
434
+ * Refusal-detection warning (issue #419, api-types 0.20.0). Present ONLY when the gate prompt
435
+ * reads as a pure sandbox/tool refusal — the worker reported it could not act, with no sign of
436
+ * productive work — so an operator does not approve a refusal as if it were work. Additive and
437
+ * advisory: it never gates a decision, and is omitted entirely on a normal gate.
438
+ */
439
+ refusal?: { matched: boolean; reason: string };
428
440
  }
429
441
 
430
442
  /** Approve / reject payload for the steering gate (`POST /runs/:id/gate`). On a
@@ -531,7 +543,15 @@ export interface CoreEvent {
531
543
  updatedDescription?: string;
532
544
  // unitOutputCaptured (EVT-013)
533
545
  outputBytes?: number;
534
- stepStatus?: 'ok' | 'failed' | 'cancelled';
546
+ /**
547
+ * How the worker step finished. `'elicitation_failed'` (DES-002) and `'timed_out'` (perf#4 —
548
+ * the ENGINE's own turn ceiling, `WICKED_UNIT_TIMEOUT_SECS`) widen the original trio.
549
+ * `'timed_out'` vs `'cancelled'` is THE wire distinction between the platform's deadline and
550
+ * an operator cancel: automation may key recovery on `'timed_out'`, and must treat
551
+ * `'cancelled'` as final. Older engines never send the newer values — consumers keying on
552
+ * them degrade to doing nothing, which is the safe direction.
553
+ */
554
+ stepStatus?: 'ok' | 'failed' | 'cancelled' | 'elicitation_failed' | 'timed_out';
535
555
  /** `unitOutputDelta` (api-types 0.5.1): one streamed chunk of a worker's live output text. */
536
556
  text?: string;
537
557
  // unitPlanned enrichment fields — the wire spelling is camelCase (event_to_json);
@@ -649,13 +669,15 @@ export type WorkerStalledFrame = {
649
669
 
650
670
  /**
651
671
  * The stall watchdog's ESCALATION frame (crew#341; api-types 0.18.0). DAEMON-SYNTHETIC, emitted
652
- * only when escalation is armed (`SystemSettings.workerStallEscalateMinutes` > 0 — OFF by
653
- * default) and a detected stall stays silent past that threshold. Reports what the watchdog DID
654
- * and how it ended, one escalation per quiet period:
672
+ * only when escalation is armed (`SystemSettings.workerStallEscalateMinutes` > 0 — ON by default
673
+ * as of perf#4, default 30 minutes; an explicit `0` disarms) and a detected stall stays silent
674
+ * past that threshold. Reports what the watchdog DID and how it ended, one escalation per quiet
675
+ * period:
655
676
  *
656
- * - `action: 'reassign'` — the wedged cursor unit was recycled in place (engine `reassignUnit`:
657
- * the stale turn is superseded, the session closed, the unit re-dispatched; queued operator
658
- * injects survive into the fresh turn). `outcome: 'ok' | 'failed' | 'exhausted'`.
677
+ * - `action: 'reassign'` — the wedged cursor unit was recycled (engine `reassignUnit`: the stale
678
+ * turn is superseded, the session closed, the unit re-dispatched; queued operator injects
679
+ * survive into the fresh turn), routed to a DIFFERENT seat from the run's pool when one is
680
+ * available (perf#4) and in place otherwise. `outcome: 'ok' | 'failed' | 'exhausted'`.
659
681
  * - `action: 'notify'` — surface loudly without touching the run (the fail-loud rung).
660
682
  *
661
683
  * `needsYou: true` marks the frames a human should act on (failed / exhausted / notify).
@@ -675,8 +697,14 @@ export type WorkerStallEscalatedFrame = {
675
697
  outcome: 'ok' | 'failed' | 'exhausted';
676
698
  /** True when a human should look; false = the platform recovered on its own. */
677
699
  needsYou: boolean;
678
- /** action `reassign`: the seat the unit was re-dispatched to, when known. */
700
+ /** action `reassign`: the seat the unit was re-dispatched to, when known. As of perf#4 this
701
+ * is the failover TARGET — a different seat from the run's pool when one exists, else the
702
+ * stalled seat recycled in place. */
679
703
  cli?: string;
704
+ /** action `reassign` (perf#4, additive): the seat that was stalled and reassigned AWAY from,
705
+ * when the watchdog knew it. Equal to `cli` on a single-seat in-place recycle. Absent on
706
+ * frames from daemons predating the field. */
707
+ previousCli?: string;
680
708
  /** action `reassign`: automatic reassigns consumed for this run, this one included. */
681
709
  escalations?: number;
682
710
  /** outcome `failed`: bounded excerpt of what the recovery call threw. */
@@ -939,8 +967,10 @@ export interface UnitReworkAmendedEvent {
939
967
  }
940
968
 
941
969
  /** P2 — a worker's ApplyStepResult arrived and output is ready to be gated. Fires before GateDecided.
942
- * `outputBytes` is the byte length of the worker's output; `stepStatus` is "ok"/"failed"/"cancelled";
943
- * `governed` reflects whether the runner armed input governance for this unit. */
970
+ * `outputBytes` is the byte length of the worker's output; `stepStatus` is "ok" / "failed" /
971
+ * "cancelled" / "elicitation_failed" (DES-002) / "timed_out" (perf#4 — the engine's own turn
972
+ * ceiling, kept apart from "cancelled" so an operator cancel is never mistaken for a platform
973
+ * timeout); `governed` reflects whether the runner armed input governance for this unit. */
944
974
  export interface UnitOutputCapturedEvent {
945
975
  type: 'unitOutputCaptured';
946
976
  session: string;
@@ -948,7 +978,7 @@ export interface UnitOutputCapturedEvent {
948
978
  attempt: number;
949
979
  /** Byte length of the worker's raw output — distinguishes 0-byte from 8 MB truncated. */
950
980
  outputBytes: number;
951
- stepStatus: 'ok' | 'failed' | 'cancelled';
981
+ stepStatus: 'ok' | 'failed' | 'cancelled' | 'elicitation_failed' | 'timed_out';
952
982
  governed: boolean;
953
983
  }
954
984
 
@@ -1826,16 +1856,23 @@ export interface SystemSettings {
1826
1856
  /**
1827
1857
  * The stall watchdog's ESCALATION threshold (crew#341; api-types 0.18.0): quiet minutes before
1828
1858
  * the watchdog ACTS on a detected stall (see {@link WorkerStallEscalatedFrame}). Integer
1829
- * 0..1440; **absent or 0 = escalation OFF — the shipped default** (the issue's design: automatic
1830
- * recovery on a run that is merely slow would be worse than the wedge). Values below
1859
+ * 0..1440; `0` = escalation OFF. **Absent = the daemon default (30 — armed)**: as of perf#4 the
1860
+ * ladder is ON by default (run 616c8661 burned a full 2h turn ceiling with the watchdog
1861
+ * detection-only; the engine's `reassignUnit` supersedes the wedged turn safely, so acting is
1862
+ * strictly better than watching). 30 leaves ~55% headroom over the slowest legitimate
1863
+ * time-to-first-output observed in the field (~19.4 min) while still recovering ~4x faster
1864
+ * than the 2h ceiling. Opt out with an explicit `0`. Values below
1831
1865
  * `workerStallMinutes` escalate at the detection threshold — the ladder never acts before it
1832
1866
  * has notified.
1833
1867
  */
1834
1868
  workerStallEscalateMinutes?: number;
1835
1869
  /**
1836
1870
  * What an armed escalation DOES (crew#341): `'reassign'` (default) recycles the wedged cursor
1837
- * unit in place — the engine supersedes the stale turn, closes the worker session, bumps the
1838
- * attempt, and re-dispatches (queued operator injects survive into the fresh turn);
1871
+ * unit — the engine supersedes the stale turn, closes the worker session, bumps the
1872
+ * attempt, and re-dispatches (queued operator injects survive into the fresh turn). As of
1873
+ * perf#4 the watchdog routes the re-dispatch to a DIFFERENT seat from the run's own pool when
1874
+ * one is available (a seat that just sat silent past the escalation threshold is the last
1875
+ * seat to hand the retry to), falling back to an in-place recycle on a single-seat pool.
1839
1876
  * `'notify'` is the fail-loud rung — a `needsYou` `workerStallEscalated` frame + an audit
1840
1877
  * entry, the run untouched.
1841
1878
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew-api-types",
3
- "version": "0.19.0",
3
+ "version": "0.20.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",