gm-plugkit 2.0.1512 → 2.0.1513

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1512",
3
+ "version": "2.0.1513",
4
4
  "description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -12,6 +12,9 @@ import { fileURLToPath } from 'url';
12
12
  // (browser/chromium spawn, long exec) stamp a busy_until window into .status.json before the
13
13
  // blocking call, so a liveness probe reads "busy" not "dead" while the event loop is blocked.
14
14
  let _writeStatusBusy = () => {};
15
+ // Latest busy_until epoch ms stamped by a long synchronous verb (codesearch rebuild, chromium
16
+ // spawn). scanStalledTurns reads it so a busy watcher is not mis-flagged as an idle stall.
17
+ let _lastBusyUntil = 0;
15
18
 
16
19
  function spawnSync(cmd, args, opts) {
17
20
  return _rawSpawnSync(cmd, args, { windowsHide: true, ...(opts || {}) });
@@ -373,6 +376,10 @@ function turnTick(sess, verb, taskBase, phase, prdPending) {
373
376
  const STALL_MS = 300_000;
374
377
  function scanStalledTurns() {
375
378
  const now = Date.now();
379
+ // A long synchronous verb (codesearch index rebuild, chromium spawn) stamps busy_until and
380
+ // blocks the spool — the agent is legitimately waiting, not stalled. Honor it exactly as
381
+ // supervisor.js checkWatcherHealth does, so a busy watcher never emits a false mid-chain-stall.
382
+ if (_lastBusyUntil && _lastBusyUntil > now) return;
376
383
  for (const [key, t] of _turns) {
377
384
  if (!t || typeof t !== 'object' || !Number.isFinite(t.startTs)) continue;
378
385
  if (t.stallEmitted) continue;
@@ -3095,7 +3102,7 @@ async function runSpoolWatcher(instance, spoolDir) {
3095
3102
  // busy_until tells probes "alive but synchronously busy until this epoch ms" — read it
3096
3103
  // alongside ts: a stale ts whose busy_until is still in the future is a busy watcher, not
3097
3104
  // a dead one. The pre-verb writeStatus(busyMs) stamps it before the blocking call.
3098
- if (busyMs && busyMs > 0) rec.busy_until = now + busyMs;
3105
+ if (busyMs && busyMs > 0) { rec.busy_until = now + busyMs; _lastBusyUntil = rec.busy_until; }
3099
3106
  fs.writeFileSync(STATUS_PATH, JSON.stringify(rec));
3100
3107
  } catch (_) {}
3101
3108
  }