@0perator/operator 0.1.166 → 0.1.167
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.
- package/CHANGELOG.md +11 -0
- package/dist/background/index.js +33 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ Operator is AXE's terminal coding agent (npm `@0perator/operator`), running on A
|
|
|
4
4
|
Newest first. Every release bumps `src/cli.tsx` VERSION + `package.json`, adds an entry here, and ships to
|
|
5
5
|
npm + both git remotes (memjar/kode, axetechnologies/kode). Test counts are the full suite at that release.
|
|
6
6
|
|
|
7
|
+
## 0.1.167 — 2026-10-01 — Sub-agent watchdog: stall-detector, not an absolute wall-clock cap
|
|
8
|
+
- **A slow-but-progressing sub-agent is no longer killed.** The background watchdog was an *absolute* 20-minute
|
|
9
|
+
timer: a child token-starved behind the foreground on the single shared endpoint (seen live: 11 rounds, real
|
|
10
|
+
file writes, ~2.6k tokens in 20 min) got reaped mid-progress and marked "errored." It's now a true **stall
|
|
11
|
+
detector** — the clock resets on every real progress signal (a token via `onTokens`, a completed tool round
|
|
12
|
+
via `onToolBatch`), so only an agent that has made **no** progress for the window (a genuinely hung request —
|
|
13
|
+
connection open, no chunks, the case the watchdog exists for) is stopped. The stop reason is now the accurate
|
|
14
|
+
"no progress for Nm" instead of "exceeded Nm wall-clock limit". `KODE_BG_TIMEOUT_MS` still overrides the 20m
|
|
15
|
+
default. `src/background/index.ts`; `test/background-hardening.test.mts` +1 (a progressing agent survives 4×
|
|
16
|
+
the window). Full suite 791 passed, 0 failed.
|
|
17
|
+
|
|
7
18
|
## 0.1.166 — 2026-10-01 — Grandmaster wave: cache-stable prefix, flywheel anti-poison, lossless tool results, sub-agent economics
|
|
8
19
|
- **GW-04 — deterministic tool-schema prefix.** `McpHub.schemas()` now sorts by namespaced name so the
|
|
9
20
|
`[system+tools]` prefix is byte-identical across sessions/restarts — KV prefix-cache reuse is strictly
|
package/dist/background/index.js
CHANGED
|
@@ -129,20 +129,44 @@ export class BackgroundAgents {
|
|
|
129
129
|
void this.run(id, entry.info, entry.brief, entry.type);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
/** Watchdog for a
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* agent
|
|
136
|
-
* slot
|
|
132
|
+
/** Watchdog for a HUNG child — a STALL detector, NOT an absolute cap. The clock resets on every real
|
|
133
|
+
* progress signal (a token or a completed tool round, via touchProgress), so a slow-but-advancing agent —
|
|
134
|
+
* e.g. one token-starved behind the foreground on the single shared endpoint — is NEVER killed. Only an
|
|
135
|
+
* agent that has made NO progress for stallTimeoutMs (a genuinely hung request: connection open, no chunks)
|
|
136
|
+
* is stopped and its slot freed, with an explicit unmissable reason. A no-op once the agent leaves
|
|
137
|
+
* "working" (checked by id, which is never recycled). (Before this, the timer was absolute, so a correct
|
|
138
|
+
* agent crawling behind a busy foreground — 11 rounds, real file writes — was reaped mid-progress.) */
|
|
137
139
|
scheduleStallTimeout(id) {
|
|
140
|
+
const a = this.agents.get(id);
|
|
141
|
+
if (a)
|
|
142
|
+
a.lastProgressAt = Date.now(); // start the stall clock from now
|
|
143
|
+
this.armStallCheck(id, this.stallTimeoutMs);
|
|
144
|
+
}
|
|
145
|
+
/** Reset the stall clock — called on each real progress signal so a working agent can't be reaped for
|
|
146
|
+
* being SLOW (only for being SILENT). Cheap: a timestamp write the armed check reads when it fires. */
|
|
147
|
+
touchProgress(id) {
|
|
148
|
+
const a = this.agents.get(id);
|
|
149
|
+
if (a)
|
|
150
|
+
a.lastProgressAt = Date.now();
|
|
151
|
+
}
|
|
152
|
+
/** Arm (or re-arm) the one-shot stall check `delay` ms out. When it fires: if the agent progressed within
|
|
153
|
+
* the window, re-arm for the remaining time instead of killing it; only genuine silence for the full
|
|
154
|
+
* stallTimeoutMs stops it. */
|
|
155
|
+
armStallCheck(id, delay) {
|
|
156
|
+
this.clearStallTimer(id);
|
|
138
157
|
const timer = setTimeout(() => {
|
|
139
158
|
const a = this.agents.get(id);
|
|
140
159
|
if (!a || a.info.status !== "working")
|
|
141
160
|
return; // finished/stopped already — nothing to do
|
|
161
|
+
const idle = Date.now() - (a.lastProgressAt ?? Date.now());
|
|
162
|
+
if (idle < this.stallTimeoutMs) {
|
|
163
|
+
this.armStallCheck(id, this.stallTimeoutMs - idle);
|
|
164
|
+
return;
|
|
165
|
+
} // progressed → not stalled
|
|
142
166
|
const mins = Math.round(this.stallTimeoutMs / 60_000);
|
|
143
167
|
this.stop(id);
|
|
144
|
-
this.onDone(a.info, `[${id} stopped:
|
|
145
|
-
},
|
|
168
|
+
this.onDone(a.info, `[${id} stopped: no progress for ${mins}m (stalled or a hung request) — any partial result above may be incomplete]`);
|
|
169
|
+
}, Math.max(100, delay));
|
|
146
170
|
timer.unref?.();
|
|
147
171
|
const entry = this.agents.get(id);
|
|
148
172
|
if (entry)
|
|
@@ -200,7 +224,7 @@ export class BackgroundAgents {
|
|
|
200
224
|
// to what prior sends already counted. Replaces the old ≈1-per-content-delta tally, which missed
|
|
201
225
|
// every token generated as a tool-call argument or reasoning (most of a skill-writer's output — so
|
|
202
226
|
// a sub-agent that wrote thousands of tokens read as "53 tok").
|
|
203
|
-
onTokens: (t) => { info.tokens = total + t; this.onChange(); },
|
|
227
|
+
onTokens: (t) => { info.tokens = total + t; this.touchProgress(id); this.onChange(); },
|
|
204
228
|
// Reasoning stream → the "thinking" line. Coalesce (keep the tail) and throttle re-renders:
|
|
205
229
|
// a long think can emit hundreds of chunks, but the panel only needs to refresh ~1/sec.
|
|
206
230
|
onReasoning: (chunk) => {
|
|
@@ -225,6 +249,7 @@ export class BackgroundAgents {
|
|
|
225
249
|
const settled = events.map((e) => ({ name: e.name, arg: shortArg(e.args), running: false }));
|
|
226
250
|
info.steps = [...(info.steps ?? []).filter((s) => !s.running), ...settled].slice(-RECENT_STEPS);
|
|
227
251
|
info.thought = undefined;
|
|
252
|
+
this.touchProgress(id); // a completed round is unambiguous progress — reset the stall clock
|
|
228
253
|
this.onChange();
|
|
229
254
|
// This child can mutate the same session-wide task list the foreground plan pane reads (a single
|
|
230
255
|
// module-level store in registry.ts) — refresh the pane live instead of leaving it frozen until the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0perator/operator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.167",
|
|
4
4
|
"description": "Operator (KODE) — TypeScript + Ink terminal coding agent. Full-frame render, single-engine core shared across CLI/web/mobile; runs against a local Aurora model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|