@0xmaxma/claude-gateway 1.3.25 → 1.3.32

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 (72) hide show
  1. package/README.md +50 -2
  2. package/config.template.json +6 -2
  3. package/dist/agent/incident-store.d.ts +89 -0
  4. package/dist/agent/incident-store.d.ts.map +1 -0
  5. package/dist/agent/incident-store.js +299 -0
  6. package/dist/agent/incident-store.js.map +1 -0
  7. package/dist/agent/incident.d.ts +156 -0
  8. package/dist/agent/incident.d.ts.map +1 -0
  9. package/dist/agent/incident.js +177 -0
  10. package/dist/agent/incident.js.map +1 -0
  11. package/dist/agent/recovery-executor.d.ts +117 -0
  12. package/dist/agent/recovery-executor.d.ts.map +1 -0
  13. package/dist/agent/recovery-executor.js +168 -0
  14. package/dist/agent/recovery-executor.js.map +1 -0
  15. package/dist/agent/recovery-policy.d.ts +97 -0
  16. package/dist/agent/recovery-policy.d.ts.map +1 -0
  17. package/dist/agent/recovery-policy.js +164 -0
  18. package/dist/agent/recovery-policy.js.map +1 -0
  19. package/dist/agent/runner.d.ts +66 -6
  20. package/dist/agent/runner.d.ts.map +1 -1
  21. package/dist/agent/runner.js +332 -27
  22. package/dist/agent/runner.js.map +1 -1
  23. package/dist/agent/safe-mode.d.ts +61 -0
  24. package/dist/agent/safe-mode.d.ts.map +1 -0
  25. package/dist/agent/safe-mode.js +102 -0
  26. package/dist/agent/safe-mode.js.map +1 -0
  27. package/dist/agent/triage.d.ts +94 -0
  28. package/dist/agent/triage.d.ts.map +1 -0
  29. package/dist/agent/triage.js +209 -0
  30. package/dist/agent/triage.js.map +1 -0
  31. package/dist/agent/turn-trace.d.ts +120 -0
  32. package/dist/agent/turn-trace.d.ts.map +1 -0
  33. package/dist/agent/turn-trace.js +122 -0
  34. package/dist/agent/turn-trace.js.map +1 -0
  35. package/dist/api/gateway-router.d.ts +21 -0
  36. package/dist/api/gateway-router.d.ts.map +1 -1
  37. package/dist/api/gateway-router.js +58 -17
  38. package/dist/api/gateway-router.js.map +1 -1
  39. package/dist/api/router.d.ts.map +1 -1
  40. package/dist/api/router.js +104 -4
  41. package/dist/api/router.js.map +1 -1
  42. package/dist/config/migrator.d.ts +4 -0
  43. package/dist/config/migrator.d.ts.map +1 -1
  44. package/dist/config/migrator.js +60 -3
  45. package/dist/config/migrator.js.map +1 -1
  46. package/dist/history/db.d.ts +13 -1
  47. package/dist/history/db.d.ts.map +1 -1
  48. package/dist/history/db.js +67 -9
  49. package/dist/history/db.js.map +1 -1
  50. package/dist/history/types.d.ts +10 -0
  51. package/dist/history/types.d.ts.map +1 -1
  52. package/dist/index.js +3 -0
  53. package/dist/index.js.map +1 -1
  54. package/dist/session/process.d.ts +26 -0
  55. package/dist/session/process.d.ts.map +1 -1
  56. package/dist/session/process.js +77 -1
  57. package/dist/session/process.js.map +1 -1
  58. package/dist/shell/claude-pty-shell.js +59 -0
  59. package/dist/shell/claude-pty-shell.js.map +1 -1
  60. package/dist/shell/control-channel.d.ts +74 -0
  61. package/dist/shell/control-channel.d.ts.map +1 -0
  62. package/dist/shell/control-channel.js +114 -0
  63. package/dist/shell/control-channel.js.map +1 -0
  64. package/dist/types.d.ts +22 -0
  65. package/dist/types.d.ts.map +1 -1
  66. package/dist/ui/web-ui.d.ts.map +1 -1
  67. package/dist/ui/web-ui.js +103 -2
  68. package/dist/ui/web-ui.js.map +1 -1
  69. package/mcp/tools/skills/handlers.ts +4 -2
  70. package/mcp/tools/telegram/receiver-server.ts +163 -0
  71. package/mcp/tools/telegram/typing.ts +124 -0
  72. package/package.json +3 -1
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Recovery policy (Epic #195, Phase 3).
3
+ *
4
+ * Turns a (schema-validated) triage verdict into an actual recovery action —
5
+ * but only after enforcing three independent guards, so a compromised or
6
+ * mistaken triage step can never drive an unsafe intervention:
7
+ *
8
+ * 1. Per-stage whitelist. Each pipeline stage permits only a small set of
9
+ * actions (a `dispatch` stall may redeliver or restart the receiver; a
10
+ * `progress` PTY wedge may press esc or restart the session). An action
11
+ * the stage does not permit is clamped to `notify-only`, regardless of
12
+ * what triage proposed.
13
+ * 2. Budget + cooldown. Interventions are capped per turn and spaced by a
14
+ * cooldown, so a flapping stall cannot trigger an unbounded action loop.
15
+ * 3. Safe-mode escalation. Repeated PTY-stage failures recommend flipping the
16
+ * agent to the headless backend instead of retrying the same wedge.
17
+ *
18
+ * All functions are pure — no IO, no clock reads (the caller passes `now`).
19
+ * The executor that actually presses keys / restarts / flips backend lives in
20
+ * the runner; this module decides, it never acts.
21
+ */
22
+ import type { TriageVerdict, TriageAction } from './triage';
23
+ /** A recovery action the executor understands (same closed vocabulary as triage). */
24
+ export type RecoveryAction = TriageAction;
25
+ /** A selected recovery, ready for the executor. */
26
+ export interface RecoveryPlan {
27
+ action: RecoveryAction;
28
+ /** Present only for `select-option`. */
29
+ option?: number;
30
+ /** Why this action (audit/logging). */
31
+ reason: string;
32
+ }
33
+ /** The safe no-op plan. */
34
+ export declare const NOTIFY_ONLY_PLAN: RecoveryPlan;
35
+ /**
36
+ * Actions permitted per stalled stage. Deliberately conservative: destructive
37
+ * or cross-cutting actions (restart-receiver, fallback-headless) are only
38
+ * allowed where they make sense. `notify-only` is always implicitly allowed.
39
+ */
40
+ export declare const STAGE_ALLOWED_ACTIONS: Record<string, ReadonlyArray<RecoveryAction>>;
41
+ /**
42
+ * Decide the recovery plan for a stalled stage given an optional triage verdict.
43
+ * If a verdict is supplied, its action is honoured ONLY if the stage permits it;
44
+ * otherwise the plan clamps to notify-only. With no verdict, a conservative
45
+ * default action for the stage is used (still whitelist-checked).
46
+ */
47
+ export declare function selectRecoveryAction(input: {
48
+ stage: string;
49
+ failureClass: string | null;
50
+ verdict?: TriageVerdict | null;
51
+ }): RecoveryPlan;
52
+ /** Conservative default action when no triage verdict is available. */
53
+ export declare function defaultActionForStage(stage: string): RecoveryAction;
54
+ export declare const DEFAULT_MAX_INTERVENTIONS_PER_TURN = 3;
55
+ export declare const DEFAULT_COOLDOWN_MS = 30000;
56
+ export interface BudgetConfig {
57
+ maxPerTurn: number;
58
+ cooldownMs: number;
59
+ }
60
+ export declare const DEFAULT_BUDGET: BudgetConfig;
61
+ /**
62
+ * Immutable budget state for one turn. A turn is identified by `turnKey`
63
+ * (e.g. chatId + signal timestamp); when the key changes the budget resets.
64
+ */
65
+ export interface BudgetState {
66
+ turnKey: string;
67
+ attempts: number;
68
+ lastAt: number;
69
+ }
70
+ export declare function initialBudget(turnKey: string): BudgetState;
71
+ export interface BudgetVerdict {
72
+ allowed: boolean;
73
+ reason: string;
74
+ /** The state to persist for the next check (reset if the turn changed). */
75
+ next: BudgetState;
76
+ }
77
+ /**
78
+ * Decide whether an intervention is allowed now, and return the state to keep.
79
+ * Resets the counter when the turn changes; enforces the per-turn cap and the
80
+ * cooldown between attempts. Pure — the caller supplies `now`.
81
+ */
82
+ export declare function checkBudget(state: BudgetState, turnKey: string, now: number, cfg?: BudgetConfig): BudgetVerdict;
83
+ export declare const DEFAULT_SAFE_MODE_THRESHOLD = 3;
84
+ /**
85
+ * Whether repeated PTY-stage failures should escalate to safe mode (flip the
86
+ * agent to the headless backend). Pure.
87
+ */
88
+ export declare function shouldEnterSafeMode(consecutivePtyFailures: number, threshold?: number): boolean;
89
+ /**
90
+ * Whether safe mode should be lifted. Safe mode is a reactive fallback; it is
91
+ * cleared explicitly — on a successful PTY turn after a fix, or on user command.
92
+ */
93
+ export declare function shouldExitSafeMode(input: {
94
+ manualRestore?: boolean;
95
+ healthyPtyTurnObserved?: boolean;
96
+ }): boolean;
97
+ //# sourceMappingURL=recovery-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-policy.d.ts","sourceRoot":"","sources":["../../src/agent/recovery-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE3D,qFAAqF;AACrF,MAA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zB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,GAAG,GAAE,YAA6B,GACjC,aAAa,CAgBf;AAID,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,sBAAsB,EAAE,MAAM,EAC9B,SAAS,GAAE,MAAoC,GAC9C,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,GAAG,OAAO,CAEV"}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ /**
3
+ * Recovery policy (Epic #195, Phase 3).
4
+ *
5
+ * Turns a (schema-validated) triage verdict into an actual recovery action —
6
+ * but only after enforcing three independent guards, so a compromised or
7
+ * mistaken triage step can never drive an unsafe intervention:
8
+ *
9
+ * 1. Per-stage whitelist. Each pipeline stage permits only a small set of
10
+ * actions (a `dispatch` stall may redeliver or restart the receiver; a
11
+ * `progress` PTY wedge may press esc or restart the session). An action
12
+ * the stage does not permit is clamped to `notify-only`, regardless of
13
+ * what triage proposed.
14
+ * 2. Budget + cooldown. Interventions are capped per turn and spaced by a
15
+ * cooldown, so a flapping stall cannot trigger an unbounded action loop.
16
+ * 3. Safe-mode escalation. Repeated PTY-stage failures recommend flipping the
17
+ * agent to the headless backend instead of retrying the same wedge.
18
+ *
19
+ * All functions are pure — no IO, no clock reads (the caller passes `now`).
20
+ * The executor that actually presses keys / restarts / flips backend lives in
21
+ * the runner; this module decides, it never acts.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.DEFAULT_SAFE_MODE_THRESHOLD = exports.DEFAULT_BUDGET = exports.DEFAULT_COOLDOWN_MS = exports.DEFAULT_MAX_INTERVENTIONS_PER_TURN = exports.STAGE_ALLOWED_ACTIONS = exports.NOTIFY_ONLY_PLAN = void 0;
25
+ exports.selectRecoveryAction = selectRecoveryAction;
26
+ exports.defaultActionForStage = defaultActionForStage;
27
+ exports.initialBudget = initialBudget;
28
+ exports.checkBudget = checkBudget;
29
+ exports.shouldEnterSafeMode = shouldEnterSafeMode;
30
+ exports.shouldExitSafeMode = shouldExitSafeMode;
31
+ /** The safe no-op plan. */
32
+ exports.NOTIFY_ONLY_PLAN = {
33
+ action: 'notify-only',
34
+ reason: 'no permitted action',
35
+ };
36
+ /**
37
+ * Actions permitted per stalled stage. Deliberately conservative: destructive
38
+ * or cross-cutting actions (restart-receiver, fallback-headless) are only
39
+ * allowed where they make sense. `notify-only` is always implicitly allowed.
40
+ */
41
+ exports.STAGE_ALLOWED_ACTIONS = {
42
+ // Receiver/channel ingress — nothing to press; escalate the transport.
43
+ inbound: ['restart-receiver', 'notify-only'],
44
+ // Runner failed to inject — restart the session.
45
+ inject: ['restart-session', 'notify-only'],
46
+ // Session/CLI startup wedged — restart, or fall back to headless.
47
+ startup: ['restart-session', 'fallback-headless', 'notify-only'],
48
+ // Claude producing no output — a TUI overlay is the usual cause: dismiss it,
49
+ // pick a menu option, or restart; repeated failures escalate to headless.
50
+ progress: [
51
+ 'esc',
52
+ 'esc-esc',
53
+ 'enter',
54
+ 'select-option',
55
+ 'bridge-menu',
56
+ 'restart-session',
57
+ 'fallback-headless',
58
+ 'notify-only',
59
+ ],
60
+ // Turn ended, no artifact — redeliver or restart the session.
61
+ delivery: ['redeliver-forward', 'restart-session', 'notify-only'],
62
+ // Artifact written, not sent — redeliver, or restart the receiver.
63
+ dispatch: ['redeliver-forward', 'restart-receiver', 'notify-only'],
64
+ };
65
+ /**
66
+ * Decide the recovery plan for a stalled stage given an optional triage verdict.
67
+ * If a verdict is supplied, its action is honoured ONLY if the stage permits it;
68
+ * otherwise the plan clamps to notify-only. With no verdict, a conservative
69
+ * default action for the stage is used (still whitelist-checked).
70
+ */
71
+ function selectRecoveryAction(input) {
72
+ const allowed = exports.STAGE_ALLOWED_ACTIONS[input.stage] ?? ['notify-only'];
73
+ if (input.verdict) {
74
+ const a = input.verdict.action;
75
+ if (a === 'notify-only' || a === 'none') {
76
+ return { action: 'notify-only', reason: `triage:${a}` };
77
+ }
78
+ if (allowed.includes(a)) {
79
+ const plan = { action: a, reason: `triage:${input.verdict.state}` };
80
+ if (a === 'select-option' && typeof input.verdict.option === 'number') {
81
+ plan.option = input.verdict.option;
82
+ }
83
+ // select-option with no option index is not actionable → clamp.
84
+ if (a === 'select-option' && plan.option === undefined) {
85
+ return { action: 'notify-only', reason: 'select-option missing option index' };
86
+ }
87
+ return plan;
88
+ }
89
+ // Triage proposed an action this stage does not permit → refuse it.
90
+ return { action: 'notify-only', reason: `clamped: ${a} not allowed at ${input.stage}` };
91
+ }
92
+ // No triage available → deterministic default per stage.
93
+ const fallback = defaultActionForStage(input.stage);
94
+ if (allowed.includes(fallback)) {
95
+ return { action: fallback, reason: `default:${input.stage}` };
96
+ }
97
+ return exports.NOTIFY_ONLY_PLAN;
98
+ }
99
+ /** Conservative default action when no triage verdict is available. */
100
+ function defaultActionForStage(stage) {
101
+ switch (stage) {
102
+ case 'dispatch':
103
+ return 'redeliver-forward';
104
+ case 'delivery':
105
+ return 'redeliver-forward';
106
+ case 'inject':
107
+ case 'startup':
108
+ return 'restart-session';
109
+ case 'inbound':
110
+ return 'restart-receiver';
111
+ case 'progress':
112
+ // A progress wedge is ambiguous without triage; do not blindly press keys.
113
+ return 'notify-only';
114
+ default:
115
+ return 'notify-only';
116
+ }
117
+ }
118
+ // ─── Budget + cooldown ──────────────────────────────────────────────────────
119
+ exports.DEFAULT_MAX_INTERVENTIONS_PER_TURN = 3;
120
+ exports.DEFAULT_COOLDOWN_MS = 30000;
121
+ exports.DEFAULT_BUDGET = {
122
+ maxPerTurn: exports.DEFAULT_MAX_INTERVENTIONS_PER_TURN,
123
+ cooldownMs: exports.DEFAULT_COOLDOWN_MS,
124
+ };
125
+ function initialBudget(turnKey) {
126
+ return { turnKey, attempts: 0, lastAt: 0 };
127
+ }
128
+ /**
129
+ * Decide whether an intervention is allowed now, and return the state to keep.
130
+ * Resets the counter when the turn changes; enforces the per-turn cap and the
131
+ * cooldown between attempts. Pure — the caller supplies `now`.
132
+ */
133
+ function checkBudget(state, turnKey, now, cfg = exports.DEFAULT_BUDGET) {
134
+ // New turn → fresh budget.
135
+ const base = state.turnKey === turnKey ? state : initialBudget(turnKey);
136
+ if (base.attempts >= cfg.maxPerTurn) {
137
+ return { allowed: false, reason: 'budget exhausted for this turn', next: base };
138
+ }
139
+ if (base.attempts > 0 && now - base.lastAt < cfg.cooldownMs) {
140
+ return { allowed: false, reason: 'cooldown active', next: base };
141
+ }
142
+ return {
143
+ allowed: true,
144
+ reason: 'ok',
145
+ next: { turnKey, attempts: base.attempts + 1, lastAt: now },
146
+ };
147
+ }
148
+ // ─── Safe-mode escalation ─────────────────────────────────────────────────
149
+ exports.DEFAULT_SAFE_MODE_THRESHOLD = 3;
150
+ /**
151
+ * Whether repeated PTY-stage failures should escalate to safe mode (flip the
152
+ * agent to the headless backend). Pure.
153
+ */
154
+ function shouldEnterSafeMode(consecutivePtyFailures, threshold = exports.DEFAULT_SAFE_MODE_THRESHOLD) {
155
+ return consecutivePtyFailures >= threshold;
156
+ }
157
+ /**
158
+ * Whether safe mode should be lifted. Safe mode is a reactive fallback; it is
159
+ * cleared explicitly — on a successful PTY turn after a fix, or on user command.
160
+ */
161
+ function shouldExitSafeMode(input) {
162
+ return Boolean(input.manualRestore || input.healthyPtyTurnObserved);
163
+ }
164
+ //# sourceMappingURL=recovery-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-policy.js","sourceRoot":"","sources":["../../src/agent/recovery-policy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA0DH,oDAiCC;AAGD,sDAiBC;AA2BD,sCAEC;AAcD,kCAqBC;AAUD,kDAKC;AAMD,gDAKC;AAzLD,2BAA2B;AACd,QAAA,gBAAgB,GAAiB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B,mCAA2B;IAE/C,OAAO,sBAAsB,IAAI,SAAS,CAAA;AAC5C,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,KAGlC;IACC,OAAO,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;AACrE,CAAC"}
@@ -31,6 +31,9 @@ export declare class AgentRunner extends EventEmitter {
31
31
  private readonly sessionSpawnLocks;
32
32
  private readonly tooLargeRecoveries;
33
33
  private readonly tooLargeExhausted;
34
+ private readonly safeMode;
35
+ private readonly recoveryBudgets;
36
+ private readonly lastTurn;
34
37
  private readonly pendingImagePaths;
35
38
  private readonly channelCoalesce;
36
39
  private readonly coalesceWindowMs;
@@ -55,6 +58,47 @@ export declare class AgentRunner extends EventEmitter {
55
58
  * Each payload is routed to the appropriate SessionProcess by chat_id.
56
59
  */
57
60
  private startCallbackServer;
61
+ /**
62
+ * Handle POST /recover from the receiver process (Epic #195, Phase 3b).
63
+ * The watchdog detects a stall in the receiver, but recovery must run here in
64
+ * the runner, where the live control surfaces live. Runs the pure executor
65
+ * with effects bound to the affected session and returns the outcome so the
66
+ * receiver can persist it to the incident bundle.
67
+ */
68
+ private handleRecoverRequest;
69
+ /**
70
+ * Route raw interactive-terminal input to the session with this actual
71
+ * sessionId (Issue #201). The dashboard's Terminal Viewer input mode
72
+ * streams keystrokes here via the pty-stream WebSocket. Sessions are keyed by
73
+ * chatId internally, so we match on the process's own sessionId. Returns true
74
+ * only when a live pty-shell session accepted the bytes (headless / missing /
75
+ * not-writable → false), so the caller can surface an accurate result.
76
+ */
77
+ sendInputToSession(sessionId: string, data: string): boolean;
78
+ /**
79
+ * Build the recovery effects bound to one chat's session (Phase 3b). Each
80
+ * effect resolves the session fresh so it survives a restart mid-recovery.
81
+ * Keystroke effects go through the wrapper control channel; restart/backend
82
+ * effects act on the session and safe-mode manager. Effects intentionally
83
+ * omitted (redeliver-forward, restart-receiver, bridge-menu) are transport /
84
+ * wrapper concerns not bridged to the runner — the executor reports them as
85
+ * unsupported rather than guessing.
86
+ */
87
+ private buildRecoveryEffects;
88
+ /**
89
+ * Evict finished-turn budget entries (Epic #195, Phase 3b). Called on each
90
+ * budget write so the per-turn map cannot grow without bound on a long-lived
91
+ * runner. `nowMs` is the timestamp of the write just made; any entry whose last
92
+ * attempt predates the TTL belongs to a turn that is no longer being recovered.
93
+ */
94
+ private pruneRecoveryBudgets;
95
+ /**
96
+ * One-shot local `claude -p` triage runner (Phase 3b). Feeds the closed
97
+ * classification prompt on stdin and returns raw stdout. Hard timeout →
98
+ * timedOut, which the executor collapses to a safe notify-only verdict. Only
99
+ * invoked when autoRecover is enabled.
100
+ */
101
+ private recoveryTriageSpawn;
58
102
  /**
59
103
  * Handle POST /command requests from the receiver process.
60
104
  * Supports: get_model, set_model, restart.
@@ -121,6 +165,21 @@ export declare class AgentRunner extends EventEmitter {
121
165
  * The process will be lazily re-spawned on the next incoming message.
122
166
  */
123
167
  private restartProcess;
168
+ /**
169
+ * The 32MB-recovery rungs for a given healthy cap: the ladder sizes STRICTLY
170
+ * below the cap, in descending order. Filtering by `< cap` (not `<=`) drops any
171
+ * rung equal to or above the cap so a lowered cap never yields a recovery step
172
+ * that re-injects the same (or more) history — every step actually shrinks.
173
+ */
174
+ private recoveryRungs;
175
+ /**
176
+ * History re-injection cap for a spawn, given the configured healthy cap and how
177
+ * many consecutive 32MB recoveries have happened on the session. recoveryCount 0
178
+ * = healthy → the full configured cap. Each later recovery drops to the next
179
+ * rung strictly below the cap; once those are exhausted it stays at 0 (no
180
+ * history). Kept in sync with the exhaustion threshold in handleRequestTooLarge.
181
+ */
182
+ private spawnHistoryLimit;
124
183
  /**
125
184
  * Unified recovery for the recoverable "Request too large (max 32MB)" error.
126
185
  * Reached from two backends that surface the SAME error differently:
@@ -130,12 +189,13 @@ export declare class AgentRunner extends EventEmitter {
130
189
  * (is_error + "Request too large (max"); the long-lived process otherwise
131
190
  * stays alive and rejects every subsequent turn forever (Bug B).
132
191
  *
133
- * Each consecutive recovery shrinks the history re-injected on the next spawn
134
- * (TOO_LARGE_HISTORY_LADDER: 50→40→30→20→10→0) so a pathological context drops
135
- * under the 32MB ceiling. The respawn happens on the user's NEXT message (no
136
- * auto-loop), and the counter resets on the next successful result. Once even a
137
- * zero-history spawn still trips 32MB, stop escalating and ask the user to
138
- * /clear rather than climb the ladder again.
192
+ * Each consecutive recovery shrinks the history re-injected on the next spawn,
193
+ * stepping down the TOO_LARGE_HISTORY_LADDER rungs strictly below the configured
194
+ * cap (default 50 40→30→20→10→0), so a pathological context drops under the
195
+ * 32MB ceiling. The respawn happens on the user's NEXT message (no auto-loop),
196
+ * and the counter resets on the next successful result. Once even a zero-history
197
+ * spawn still trips 32MB, stop escalating and ask the user to /clear rather than
198
+ * climb the ladder again.
139
199
  */
140
200
  private handleRequestTooLarge;
141
201
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAMtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAW,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAShH,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAmB1C,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,WAAW,EAUvC,CAAC;AAaF,eAAO,MAAM,0BAA0B,OAAO,CAAC;AA6C/C,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,cAAc,CAA4B;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