wicked-crew 0.7.7 → 0.7.9

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 (120) hide show
  1. package/dist/api/audit.d.ts +9 -1
  2. package/dist/api/audit.d.ts.map +1 -1
  3. package/dist/api/audit.js +11 -3
  4. package/dist/api/audit.js.map +1 -1
  5. package/dist/api/delivery-index.d.ts +94 -7
  6. package/dist/api/delivery-index.d.ts.map +1 -1
  7. package/dist/api/delivery-index.js +182 -4
  8. package/dist/api/delivery-index.js.map +1 -1
  9. package/dist/api/elicitation-cache.d.ts +10 -0
  10. package/dist/api/elicitation-cache.d.ts.map +1 -1
  11. package/dist/api/elicitation-cache.js +18 -0
  12. package/dist/api/elicitation-cache.js.map +1 -1
  13. package/dist/api/governance-steering.d.ts +8 -0
  14. package/dist/api/governance-steering.d.ts.map +1 -1
  15. package/dist/api/governance-steering.js +36 -12
  16. package/dist/api/governance-steering.js.map +1 -1
  17. package/dist/api/post-hoc-deliver.d.ts +38 -0
  18. package/dist/api/post-hoc-deliver.d.ts.map +1 -0
  19. package/dist/api/post-hoc-deliver.js +57 -0
  20. package/dist/api/post-hoc-deliver.js.map +1 -0
  21. package/dist/api/routes.d.ts +34 -7
  22. package/dist/api/routes.d.ts.map +1 -1
  23. package/dist/api/routes.js +314 -35
  24. package/dist/api/routes.js.map +1 -1
  25. package/dist/api/seat-signin.d.ts +18 -2
  26. package/dist/api/seat-signin.d.ts.map +1 -1
  27. package/dist/api/seat-signin.js +21 -2
  28. package/dist/api/seat-signin.js.map +1 -1
  29. package/dist/api/server.d.ts +22 -7
  30. package/dist/api/server.d.ts.map +1 -1
  31. package/dist/api/server.js +131 -22
  32. package/dist/api/server.js.map +1 -1
  33. package/dist/api/stall-watchdog.d.ts +46 -21
  34. package/dist/api/stall-watchdog.d.ts.map +1 -1
  35. package/dist/api/stall-watchdog.js +193 -19
  36. package/dist/api/stall-watchdog.js.map +1 -1
  37. package/dist/api/steering-landing.d.ts +130 -0
  38. package/dist/api/steering-landing.d.ts.map +1 -0
  39. package/dist/api/steering-landing.js +367 -0
  40. package/dist/api/steering-landing.js.map +1 -0
  41. package/dist/api/testing.d.ts +3 -0
  42. package/dist/api/testing.d.ts.map +1 -1
  43. package/dist/api/testing.js +146 -18
  44. package/dist/api/testing.js.map +1 -1
  45. package/dist/api/unit-output.d.ts.map +1 -1
  46. package/dist/api/unit-output.js +7 -1
  47. package/dist/api/unit-output.js.map +1 -1
  48. package/dist/campaigns/plan.d.ts +46 -0
  49. package/dist/campaigns/plan.d.ts.map +1 -1
  50. package/dist/campaigns/plan.js +80 -0
  51. package/dist/campaigns/plan.js.map +1 -1
  52. package/dist/campaigns/routes.d.ts +2 -2
  53. package/dist/campaigns/worktrees.d.ts +39 -0
  54. package/dist/campaigns/worktrees.d.ts.map +1 -0
  55. package/dist/campaigns/worktrees.js +95 -0
  56. package/dist/campaigns/worktrees.js.map +1 -0
  57. package/dist/cli/index.js +46 -13
  58. package/dist/cli/index.js.map +1 -1
  59. package/dist/core/adapter.d.ts +65 -13
  60. package/dist/core/adapter.d.ts.map +1 -1
  61. package/dist/core/adapter.js +148 -31
  62. package/dist/core/adapter.js.map +1 -1
  63. package/dist/core/bridge-reaper.d.ts +54 -9
  64. package/dist/core/bridge-reaper.d.ts.map +1 -1
  65. package/dist/core/bridge-reaper.js +116 -11
  66. package/dist/core/bridge-reaper.js.map +1 -1
  67. package/dist/core/types.d.ts +25 -12
  68. package/dist/core/types.d.ts.map +1 -1
  69. package/dist/core/types.js +14 -0
  70. package/dist/core/types.js.map +1 -1
  71. package/dist/interactive/chat-events.d.ts.map +1 -1
  72. package/dist/interactive/chat-events.js +5 -2
  73. package/dist/interactive/chat-events.js.map +1 -1
  74. package/dist/interactive/demo-events.d.ts.map +1 -1
  75. package/dist/interactive/demo-events.js +5 -2
  76. package/dist/interactive/demo-events.js.map +1 -1
  77. package/dist/interactive/doc-delete-routes.d.ts +69 -0
  78. package/dist/interactive/doc-delete-routes.d.ts.map +1 -0
  79. package/dist/interactive/doc-delete-routes.js +240 -0
  80. package/dist/interactive/doc-delete-routes.js.map +1 -0
  81. package/dist/interactive/doc-ledger-sweep.d.ts +53 -0
  82. package/dist/interactive/doc-ledger-sweep.d.ts.map +1 -0
  83. package/dist/interactive/doc-ledger-sweep.js +45 -0
  84. package/dist/interactive/doc-ledger-sweep.js.map +1 -0
  85. package/dist/interactive/draft-events.d.ts.map +1 -1
  86. package/dist/interactive/draft-events.js +5 -2
  87. package/dist/interactive/draft-events.js.map +1 -1
  88. package/dist/interactive/edit-events.d.ts.map +1 -1
  89. package/dist/interactive/edit-events.js +5 -2
  90. package/dist/interactive/edit-events.js.map +1 -1
  91. package/dist/interactive/ledger.d.ts +20 -0
  92. package/dist/interactive/ledger.d.ts.map +1 -1
  93. package/dist/interactive/ledger.js +32 -0
  94. package/dist/interactive/ledger.js.map +1 -1
  95. package/dist/interactive/ws-relay.d.ts +10 -0
  96. package/dist/interactive/ws-relay.d.ts.map +1 -1
  97. package/dist/interactive/ws-relay.js +16 -0
  98. package/dist/interactive/ws-relay.js.map +1 -1
  99. package/dist/projects/graph-paths.d.ts +7 -22
  100. package/dist/projects/graph-paths.d.ts.map +1 -1
  101. package/dist/projects/graph-paths.js +10 -37
  102. package/dist/projects/graph-paths.js.map +1 -1
  103. package/dist/projects/settings.d.ts +32 -2
  104. package/dist/projects/settings.d.ts.map +1 -1
  105. package/dist/projects/settings.js +48 -6
  106. package/dist/projects/settings.js.map +1 -1
  107. package/dist/projects/state-home.d.ts +42 -0
  108. package/dist/projects/state-home.d.ts.map +1 -0
  109. package/dist/projects/state-home.js +55 -0
  110. package/dist/projects/state-home.js.map +1 -0
  111. package/dist/qe/acceptance.d.ts +9 -0
  112. package/dist/qe/acceptance.d.ts.map +1 -1
  113. package/dist/qe/acceptance.js +21 -1
  114. package/dist/qe/acceptance.js.map +1 -1
  115. package/dist/studio/assets/index-gtE6scX0.js +537 -0
  116. package/dist/studio/index.html +1 -1
  117. package/dist/studio/testid-inventory.json +154 -153
  118. package/endpoint-manifest.json +28 -2
  119. package/package.json +4 -4
  120. package/dist/studio/assets/index-BjCZdfES.js +0 -537
@@ -1,4 +1,5 @@
1
- // Worker stall watchdog (crew#287): platform-native liveness detection for executing runs.
1
+ // Worker stall watchdog (crew#287 detection + crew#341 escalation): platform-native liveness
2
+ // for executing runs, and — opt-in — recovery when liveness is gone.
2
3
  //
3
4
  // A wedged worker emits nothing — no unitOutputDelta, no gate frames — and its run sits in
4
5
  // `executing` until an operator notices by absence (run 8aa1cd42: a design unit burned 3+ hours
@@ -14,12 +15,41 @@
14
15
  // - once per quiet period: after the frame fires, the run stays alerted until a NEW event for
15
16
  // it arrives; a second quiet period then emits a second frame.
16
17
  //
17
- // DETECTION ONLY. The watchdog never cancels, mutates, or re-dispatches a run — the operator
18
- // decides. The synthetic frame goes straight to the /ws fan-out, never back through the engine
19
- // relay, so it cannot stamp or re-arm itself.
20
- import { DEFAULT_WORKER_STALL_MINUTES } from '../core/types.js';
18
+ // THE ESCALATION LADDER (crew#341) — detection now drives action, but only when armed:
19
+ //
20
+ // notify (always) → act (opt-in, `workerStallEscalateMinutes` > 0) → fail loud
21
+ //
22
+ // - OFF BY DEFAULT. The issue's design: automatic recovery on a run that is merely slow rather
23
+ // than wedged would be worse than the wedge. `workerStallEscalateMinutes` absent/0 keeps the
24
+ // watchdog detection-only — bit-for-bit the crew#287 behaviour.
25
+ // - When armed, a run still silent past the escalation threshold (never before the detection
26
+ // threshold — the ladder notifies before it acts) gets ONE escalation per quiet period:
27
+ // - action `reassign` (default): recycle the wedged cursor unit IN PLACE via the engine's
28
+ // `reassignUnit` — the stale turn is superseded (not folded as a failure), the worker
29
+ // session closed, the attempt bumped, the unit re-dispatched to the same seat; queued
30
+ // operator injects survive into the fresh turn. This is both of crew#341's candidate
31
+ // recoveries in one primitive.
32
+ // - action `notify`: the fail-loud rung — surface a `needsYou` frame + an audit entry and
33
+ // leave the run alone.
34
+ // - A per-run budget (`workerStallMaxEscalations`, default 2) caps AUTOMATIC reassigns: a
35
+ // worker that wedges deterministically must reach a human, not loop through re-dispatches
36
+ // forever. A spent budget answers further quiet periods with `outcome: "exhausted"`.
37
+ // - Every escalation is REPORTED on its own distinctly-named /ws frame —
38
+ // `workerStallEscalated` (`workerStalled` is already two producers deep: the daemon's
39
+ // synthetic detection frame AND the engine's PTY-path event) — and AUDITED via the crew
40
+ // audit trail (`run.stall.escalated`), because an automated actor touching a run is a
41
+ // privileged action exactly like an operator doing it.
42
+ //
43
+ // The synthetic frames go straight to the /ws fan-out, never back through the engine relay, so
44
+ // they cannot stamp or re-arm the watchdog themselves. A SUCCESSFUL reassign, by contrast,
45
+ // makes the engine emit real events (workerSessionClosed, unitReassigned, unitDispatched, …),
46
+ // which restamp the clock and re-arm both stages — a re-wedged fresh turn walks the same ladder
47
+ // with the remaining budget.
48
+ import { DEFAULT_WORKER_STALL_ESCALATE_ACTION, DEFAULT_WORKER_STALL_MAX_ESCALATIONS, DEFAULT_WORKER_STALL_MINUTES, } from '../core/types.js';
21
49
  /** Default sweep cadence — frequent enough that `quietForMs` is at most ~30s stale. */
22
50
  export const DEFAULT_SWEEP_INTERVAL_MS = 30_000;
51
+ /** Bound on the `error` excerpt an escalation frame / audit entry carries. */
52
+ const ESCALATION_ERROR_EXCERPT_CHARS = 300;
23
53
  export class WorkerStallWatchdog {
24
54
  deps;
25
55
  /** run id → epoch ms of the last engine event observed for it (or the seed, see sweep). */
@@ -28,6 +58,10 @@ export class WorkerStallWatchdog {
28
58
  lastOrd = new Map();
29
59
  /** Runs already alerted for the CURRENT quiet period (cleared by any new event). */
30
60
  alerted = new Set();
61
+ /** Runs already escalated for the CURRENT quiet period (cleared by any new event). */
62
+ escalated = new Set();
63
+ /** run id → automatic reassigns consumed (the crew#341 budget). Pruned with the run. */
64
+ escalationCount = new Map();
31
65
  now;
32
66
  log;
33
67
  handle = null;
@@ -46,6 +80,7 @@ export class WorkerStallWatchdog {
46
80
  if (typeof event.ord === 'number')
47
81
  this.lastOrd.set(session, event.ord);
48
82
  this.alerted.delete(session);
83
+ this.escalated.delete(session);
49
84
  }
50
85
  /** One detection pass. Public so tests drive it directly; the armed interval calls it too. */
51
86
  async sweep() {
@@ -63,15 +98,19 @@ export class WorkerStallWatchdog {
63
98
  }
64
99
  const ids = new Set(executing.map((r) => r.id));
65
100
  // Prune state for runs no longer executing (completed / cancelled / awaiting_human):
66
- // their silence is not a stall, and a later return to executing starts a fresh clock.
101
+ // their silence is not a stall, and a later return to executing starts a fresh clock —
102
+ // and a fresh escalation budget (the run left the wedge; a NEW wedge is a new fact).
67
103
  for (const key of [...this.lastEventAt.keys()]) {
68
104
  if (!ids.has(key)) {
69
105
  this.lastEventAt.delete(key);
70
106
  this.lastOrd.delete(key);
71
107
  this.alerted.delete(key);
108
+ this.escalated.delete(key);
109
+ this.escalationCount.delete(key);
72
110
  }
73
111
  }
74
112
  const thresholdMs = await this.thresholdMs();
113
+ const escalation = await this.escalationArmed(thresholdMs);
75
114
  const now = this.now();
76
115
  for (const run of executing) {
77
116
  const last = this.lastEventAt.get(run.id);
@@ -84,19 +123,29 @@ export class WorkerStallWatchdog {
84
123
  continue;
85
124
  }
86
125
  const quietForMs = now - last;
87
- if (quietForMs < thresholdMs || this.alerted.has(run.id))
88
- continue;
89
- this.alerted.add(run.id);
90
- const ord = this.lastOrd.get(run.id) ?? run.ord;
91
- this.deps.broadcast({
92
- type: 'workerStalled',
93
- session: run.id,
94
- ...(ord !== undefined ? { ord } : {}),
95
- quietForMs,
96
- });
97
- this.log(`[stall-watchdog] run ${run.id}${ord !== undefined ? ` (unit ${ord})` : ''} silent for ` +
98
- `${(quietForMs / 60_000).toFixed(1)} min — workerStalled frame broadcast ` +
99
- `(detection only: the run was NOT touched; the operator decides)`);
126
+ // ── stage 1: detect + notify (crew#287, always on) ──────────────────────────────
127
+ if (quietForMs >= thresholdMs && !this.alerted.has(run.id)) {
128
+ this.alerted.add(run.id);
129
+ const ord = this.lastOrd.get(run.id) ?? run.ord;
130
+ this.deps.broadcast({
131
+ type: 'workerStalled',
132
+ session: run.id,
133
+ ...(ord !== undefined ? { ord } : {}),
134
+ quietForMs,
135
+ });
136
+ this.log(`[stall-watchdog] run ${run.id}${ord !== undefined ? ` (unit ${ord})` : ''} silent for ` +
137
+ `${(quietForMs / 60_000).toFixed(1)} min — workerStalled frame broadcast` +
138
+ (escalation === undefined
139
+ ? ` (detection only: the run was NOT touched; the operator decides)`
140
+ : ` (escalation armed at ${(escalation.thresholdMs / 60_000).toFixed(1)} min)`));
141
+ }
142
+ // ── stage 2: act (crew#341, opt-in) — never before stage 1's threshold ──────────
143
+ if (escalation !== undefined &&
144
+ quietForMs >= escalation.thresholdMs &&
145
+ !this.escalated.has(run.id)) {
146
+ this.escalated.add(run.id);
147
+ await this.escalate(run, quietForMs, escalation);
148
+ }
100
149
  }
101
150
  }
102
151
  finally {
@@ -134,5 +183,130 @@ export class WorkerStallWatchdog {
134
183
  : DEFAULT_WORKER_STALL_MINUTES;
135
184
  return m * 60_000;
136
185
  }
186
+ /**
187
+ * Resolve the escalation stage for THIS sweep, or `undefined` while it is off. Fail-safe on
188
+ * a throwing config read: acting on a run is exactly the wrong response to uncertainty, so a
189
+ * failed read logs and keeps this sweep detection-only.
190
+ */
191
+ async escalationArmed(detectMs) {
192
+ if (this.deps.escalation === undefined)
193
+ return undefined;
194
+ let cfg;
195
+ try {
196
+ cfg = await this.deps.escalation.config();
197
+ }
198
+ catch (err) {
199
+ this.log(`[stall-watchdog] escalation config read failed, staying detection-only this sweep: ${String(err)}`);
200
+ return undefined;
201
+ }
202
+ const minutes = cfg?.minutes;
203
+ if (typeof minutes !== 'number' || !Number.isFinite(minutes) || minutes <= 0) {
204
+ return undefined; // OFF — the crew#341 default
205
+ }
206
+ const action = cfg?.action === 'notify' ? 'notify' : DEFAULT_WORKER_STALL_ESCALATE_ACTION;
207
+ const rawMax = cfg?.maxPerRun;
208
+ // Same 1..10 envelope the settings route enforces — the createServer override seam must
209
+ // not admit a budget large enough to hammer reassignUnit on a deterministically wedging run.
210
+ const maxPerRun = typeof rawMax === 'number' && Number.isFinite(rawMax) && Math.floor(rawMax) >= 1
211
+ ? Math.min(Math.floor(rawMax), 10)
212
+ : DEFAULT_WORKER_STALL_MAX_ESCALATIONS;
213
+ // The ladder notifies before it acts: an escalation threshold set below the detection
214
+ // threshold acts AT the detection threshold, never before it.
215
+ return { thresholdMs: Math.max(minutes * 60_000, detectMs), action, maxPerRun };
216
+ }
217
+ /** Perform one escalation for `run`, emit its `workerStallEscalated` frame, audit, log. */
218
+ async escalate(run, quietForMs, escalation) {
219
+ // Prefer the cursor ord read from the engine THIS sweep (`run.ord`) over the last event's
220
+ // ord: `reassignUnit` validates against the live cursor, and events can predate a rework.
221
+ const ord = run.ord ?? this.lastOrd.get(run.id);
222
+ const base = {
223
+ type: 'workerStallEscalated',
224
+ session: run.id,
225
+ ...(ord !== undefined ? { ord } : {}),
226
+ quietForMs,
227
+ };
228
+ let frame;
229
+ if (escalation.action === 'notify') {
230
+ // The fail-loud rung: surface for a human, touch nothing. No budget — notifying is free.
231
+ frame = { ...base, action: 'notify', outcome: 'ok', needsYou: true };
232
+ }
233
+ else {
234
+ const used = this.escalationCount.get(run.id) ?? 0;
235
+ if (used >= escalation.maxPerRun) {
236
+ frame = {
237
+ ...base,
238
+ action: 'reassign',
239
+ outcome: 'exhausted',
240
+ needsYou: true,
241
+ escalations: used,
242
+ };
243
+ }
244
+ else if (ord === undefined) {
245
+ // Cannot name the cursor unit — the engine would reject any ord we invent. Loud, no
246
+ // budget consumed: nothing was attempted.
247
+ frame = {
248
+ ...base,
249
+ action: 'reassign',
250
+ outcome: 'failed',
251
+ needsYou: true,
252
+ escalations: used,
253
+ error: 'cursor unit unknown: the run listing carried no ord for this run',
254
+ };
255
+ }
256
+ else {
257
+ // Budget is consumed by the ATTEMPT, success or not — a rejecting engine call must not
258
+ // be retried indefinitely on the platform's own initiative.
259
+ this.escalationCount.set(run.id, used + 1);
260
+ try {
261
+ await this.deps.escalation?.reassign(run.id, ord, run.cli);
262
+ frame = {
263
+ ...base,
264
+ action: 'reassign',
265
+ outcome: 'ok',
266
+ needsYou: false,
267
+ escalations: used + 1,
268
+ ...(run.cli !== undefined ? { cli: run.cli } : {}),
269
+ };
270
+ }
271
+ catch (err) {
272
+ frame = {
273
+ ...base,
274
+ action: 'reassign',
275
+ outcome: 'failed',
276
+ needsYou: true,
277
+ escalations: used + 1,
278
+ error: String(err instanceof Error ? err.message : err).slice(0, ESCALATION_ERROR_EXCERPT_CHARS),
279
+ };
280
+ }
281
+ }
282
+ }
283
+ this.deps.broadcast(frame);
284
+ try {
285
+ this.deps.escalation?.audit?.(frame);
286
+ }
287
+ catch (err) {
288
+ this.log(`[stall-watchdog] escalation audit sink failed: ${String(err)}`);
289
+ }
290
+ const where = `run ${run.id}${ord !== undefined ? ` (unit ${ord})` : ''}`;
291
+ const quiet = `${(quietForMs / 60_000).toFixed(1)} min silent`;
292
+ if (frame.action === 'notify') {
293
+ this.log(`[stall-watchdog] ESCALATED ${where}: ${quiet} — action notify (fail-loud): ` +
294
+ `needs-you frame broadcast, the run was NOT touched`);
295
+ }
296
+ else if (frame.outcome === 'ok') {
297
+ this.log(`[stall-watchdog] ESCALATED ${where}: ${quiet} — reassigned in place` +
298
+ `${run.cli !== undefined ? ` (seat ${run.cli})` : ''} ` +
299
+ `(automatic recovery ${frame.escalations}/${escalation.maxPerRun}; the stale turn is ` +
300
+ `superseded and the unit re-dispatched)`);
301
+ }
302
+ else if (frame.outcome === 'exhausted') {
303
+ this.log(`[stall-watchdog] ESCALATION EXHAUSTED for ${where}: ${quiet} and the per-run budget ` +
304
+ `(${escalation.maxPerRun}) is spent — needs-you frame broadcast; a human must intervene`);
305
+ }
306
+ else {
307
+ this.log(`[stall-watchdog] ESCALATION FAILED for ${where}: ${quiet} — the reassign did not ` +
308
+ `happen (${frame.error ?? 'unknown error'}); needs-you frame broadcast`);
309
+ }
310
+ }
137
311
  }
138
312
  //# sourceMappingURL=stall-watchdog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stall-watchdog.js","sourceRoot":"","sources":["../../src/api/stall-watchdog.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,EAAE;AACF,2FAA2F;AAC3F,gGAAgG;AAChG,gGAAgG;AAChG,yFAAyF;AACzF,EAAE;AACF,2FAA2F;AAC3F,2FAA2F;AAC3F,4FAA4F;AAC5F,yFAAyF;AACzF,wFAAwF;AACxF,kFAAkF;AAClF,8FAA8F;AAC9F,iEAAiE;AACjE,EAAE;AACF,6FAA6F;AAC7F,+FAA+F;AAC/F,8CAA8C;AAG9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAoBhE,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAsBhD,MAAM,OAAO,mBAAmB;IAYD;IAX7B,2FAA2F;IAC1E,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzD,sDAAsD;IACrC,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrD,oFAAoF;IACnE,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5B,GAAG,CAAe;IAClB,GAAG,CAAsB;IAClC,MAAM,GAA0B,IAAI,CAAC;IACrC,QAAQ,GAAG,KAAK,CAAC;IAEzB,YAA6B,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;QAClD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;IAED,+FAA+F;IAC/F,MAAM,CAAC,KAAgB;QACrB,MAAM,OAAO,GACX,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC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S,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;gBACvD,uBAAuB,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,SAAS,sBAAsB;gBACtF,wCAAwC,CAC3C,CAAC;QACJ,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;YACzC,IAAI,CAAC,GAAG,CACN,6CAA6C,KAAK,KAAK,KAAK,0BAA0B;gBACpF,IAAI,UAAU,CAAC,SAAS,gEAAgE,CAC3F,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CACN,0CAA0C,KAAK,KAAK,KAAK,0BAA0B;gBACjF,WAAW,KAAK,CAAC,KAAK,IAAI,eAAe,8BAA8B,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * THE STEERING-AUTHOR LANDING (crew#388) — the post-approval write that closes TH-12.
3
+ *
4
+ * ## The defect
5
+ *
6
+ * The `steering-author` workflow's doctrine says "approved rules land via the rules CRUD with
7
+ * `provenance.source: "chat"` — the run itself writes nothing", and the propose phase tells the
8
+ * worker "do not write them yourself". Correct on both counts — evaluator≠creator — but NO
9
+ * component performed the write: the generic `POST /runs/:id/gate` only confirmed the gate, core
10
+ * has no steering-author hook, and the studio's `onRunResolved` only reloads rules. Every
11
+ * chat-authored rule ever approved was silently lost, orphaned as prose in the run's transcript
12
+ * (campaign 2026-09-01, scenario C5, run f3db4335).
13
+ *
14
+ * ## The design
15
+ *
16
+ * The landing is CREW-side, on APPROVE of the propose gate — the run keeps writing nothing to the
17
+ * store. The proposal is read machine-readably first: the propose phase now ALSO writes the
18
+ * proposed-rules JSON to a declared per-run artifact (`<steering inbox>/proposed-rules.json`,
19
+ * inside the run's own `extraWriteRoots`) — an ARTIFACT of the proposal, not a store write, so
20
+ * evaluator≠creator holds. Parsing the propose unit's stored transcript is the FALLBACK (runs
21
+ * launched before this fix, or a worker that ignored the file contract), and the cached gate
22
+ * prompt is the last resort (the transcript is written only on approval, so a store hiccup there
23
+ * still has the prompt core composed FROM that output).
24
+ *
25
+ * Invariants:
26
+ * - AUDITABLE — every landed rule records `governance.rule.upserted` with the chat provenance
27
+ * and the run id, exactly as the doctrine documents; a landing that could not happen records
28
+ * `governance.steering.landing_failed` with the reason.
29
+ * - IDEMPOTENT — a durable marker (`landed.json` beside the proposal) is written after a full
30
+ * landing; a replayed approve (daemon restart mid-request, double-driven gate) finds it and
31
+ * re-lands nothing. The rule write itself is an UPSERT keyed by rule id, so even a lost
32
+ * marker degrades to a same-content overwrite, never a duplicate rule.
33
+ * - FAIL-LOUD — when no source yields a parseable proposal the approve still succeeds for the
34
+ * RUN (the gate decision is the operator's and already happened), but the response and the
35
+ * audit trail carry an explicit `landing.outcome: "failed"` with the reason. A silent no-op
36
+ * is the bug this module exists to end.
37
+ * - AMEND-APPROVE — an approve carrying an amend note lands the proposal UNCHANGED: the amend
38
+ * steers the RUN (core injects it into the run's continuation), not the rule text. An
39
+ * operator who wants different rules rejects and re-authors; editing rule text inside a gate
40
+ * note would land words nobody reviewed as JSON nobody saw.
41
+ */
42
+ import type { CoreAdapter } from '../core/adapter.js';
43
+ import type { Actor, ConformanceRule, SessionView, WorkflowDef } from '../core/types.js';
44
+ export { STEERING_PROPOSAL_FILENAME } from './governance-steering.js';
45
+ import type { AuditLog } from './audit.js';
46
+ /** The workflow whose propose gate this landing serves. */
47
+ export declare const STEERING_AUTHOR_WORKFLOW = "steering-author";
48
+ /** Durable idempotency marker written beside the proposal after a full landing. */
49
+ export declare const STEERING_LANDED_MARKER_FILENAME = "landed.json";
50
+ /** Where the propose phase is told to write its machine-readable proposal. */
51
+ export declare function steeringProposalPath(runId: string): string;
52
+ /** Where a completed landing records what it landed (replay dedupe). */
53
+ export declare function steeringLandedMarkerPath(runId: string): string;
54
+ /**
55
+ * The steering fields a rule write may carry (the merged model's additions) — mirrored by
56
+ * `POST /governance/rules`, which refuses them on a pre-steering engine because the engine
57
+ * would silently DROP them and persist a rule that enforces differently than written. The
58
+ * landing applies the same guard: authored-then-downgraded is a loud landing failure, never
59
+ * a quiet field amputation.
60
+ */
61
+ export declare const STEERING_RULE_FIELDS: readonly ["steering_type", "applies_to", "excludes", "weight", "effect", "trigger", "obligations", "criteria"];
62
+ /** Where the landed proposal was read from, most-preferred first. */
63
+ export type SteeringProposalSource = 'deliverable' | 'transcript' | 'gate-prompt';
64
+ /**
65
+ * The `landing` field on the `POST /runs/:id/gate` (and gated `/resume`) 200 body — present
66
+ * ONLY when the approved gate was a steering-author propose gate. Published as
67
+ * `SteeringLandingResult` in wicked-crew-api-types.
68
+ */
69
+ export interface SteeringLandingResult {
70
+ /** `landed` = every proposed rule is in the store; `failed` = the RUN still advanced but the
71
+ * landing (wholly or partly) did not — `error` says why, and the audit trail carries it. */
72
+ outcome: 'landed' | 'failed';
73
+ /** Rule ids actually upserted (all of them on `landed`; the partial set on a partial `failed`). */
74
+ ruleIds: string[];
75
+ /** Where the proposal was read from. Absent when no source yielded one. */
76
+ source?: SteeringProposalSource;
77
+ /** `true` when a replayed approve found the durable marker — nothing was re-landed. */
78
+ alreadyLanded?: boolean;
79
+ /** Present iff `outcome: "failed"` — the loud, operator-readable reason. */
80
+ error?: string;
81
+ }
82
+ /** True when this run IS a steering-author run (by workflow id, or — for runs whose stored
83
+ * `workflow_id` is core's `wf-<uuid>` instance id — by exact phase sequence). Defensive on a
84
+ * view without a `workflow_id` (partial-stub adapters in tests; a free-text run has no def):
85
+ * "not steering-author" is the honest answer there, and the legacy gate path must not 500. */
86
+ export declare function isSteeringAuthorRun(run: SessionView, workflows: WorkflowDef[]): boolean;
87
+ /**
88
+ * Recover the default steering type from the author route's own problem-statement preamble
89
+ * (`Author steering rules for the '<type>' steering type …`) so a proposed rule that omitted
90
+ * `steering_type` still lands on the sub-page the operator authored it for. `undefined` when
91
+ * the problem does not carry the preamble (a hand-launched run) — the engine's serde default
92
+ * (`architecture`) then applies, same as any other write.
93
+ */
94
+ export declare function steeringTypeFromProblem(problem: string): string | undefined;
95
+ /** A parsed-but-not-yet-normalized proposal entry. */
96
+ type RawRule = Record<string, unknown>;
97
+ /**
98
+ * Extract the proposed rules from free text — the whole text as JSON first (the deliverable
99
+ * file's shape), then each fenced code block, then every balanced top-level `[...]` in the
100
+ * text (the transcript / gate-prompt shape, where the JSON array is embedded in prose).
101
+ * `null` when nothing parses to a non-empty array of `{id, statement}` objects.
102
+ */
103
+ export declare function extractProposedRules(text: string): RawRule[] | null;
104
+ /**
105
+ * Stamp the chat provenance and the recovered default steering type onto one proposed rule.
106
+ * `source: "chat"` is FORCED, not defaulted — the landing is the doctrine's one write path for
107
+ * chat-authored rules, and a worker that wrote some other source into its proposal must not be
108
+ * able to disguise where the rule came from. Everything else passes through untouched: the
109
+ * ENGINE's upsert path is the one spelling of what a valid rule is.
110
+ */
111
+ export declare function normalizeProposedRule(raw: RawRule, defaultType?: string): ConformanceRule;
112
+ /** The adapter surface the landing needs — narrow, so tests stub exactly what runs. */
113
+ export type SteeringLandingAdapter = Pick<CoreAdapter, 'workOutput' | 'upsertConformanceRule' | 'steeringSupported'>;
114
+ export interface SteeringLandingDeps {
115
+ adapter: SteeringLandingAdapter;
116
+ audit: AuditLog;
117
+ actor: Actor;
118
+ }
119
+ /**
120
+ * Perform the landing for an APPROVED steering-author propose gate. Called AFTER
121
+ * `confirmGate` resolved — the gate decision is already durable; this function's only job is
122
+ * the write the doctrine promised. Never throws: every failure is folded into a loud
123
+ * `outcome: "failed"` result (and the audit trail), because a landing error must not turn an
124
+ * already-successful gate approval into an HTTP 500.
125
+ *
126
+ * `gatePrompt` is the cached gate prompt captured BEFORE the confirm (terminal events prune
127
+ * the cache) — the last-resort proposal source.
128
+ */
129
+ export declare function landSteeringProposal(deps: SteeringLandingDeps, run: SessionView, gatePrompt?: string): Promise<SteeringLandingResult>;
130
+ //# sourceMappingURL=steering-landing.d.ts.map
@@ -0,0 +1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