gm-skill 2.0.1396 → 2.0.1398

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1396",
3
+ "version": "2.0.1398",
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": {
@@ -2287,11 +2287,10 @@ async function runSpoolWatcher(instance, spoolDir) {
2287
2287
  action: 'spawn-replacement-and-exit',
2288
2288
  boot_reason: bootReason,
2289
2289
  });
2290
- console.error(`[plugkit-wasm] wrapper.js drift detected — spawning replacement via bun x gm-plugkit@latest spool then exiting`);
2290
+ console.error(`[plugkit-wasm] wrapper.js drift detected — spawning replacement directly from installed wrapper then exiting`);
2291
2291
  try {
2292
2292
  const cp = require('child_process');
2293
- const bunPath = process.env.GM_BUN_PATH || 'bun';
2294
- const child = cp.spawn(bunPath, ['x', 'gm-plugkit@latest', 'spool'], {
2293
+ const child = cp.spawn(process.execPath, [_wrapperPathInstalled, 'spool'], {
2295
2294
  cwd: process.cwd(),
2296
2295
  detached: true,
2297
2296
  stdio: 'ignore',
@@ -2300,7 +2299,21 @@ async function runSpoolWatcher(instance, spoolDir) {
2300
2299
  });
2301
2300
  child.unref();
2302
2301
  } catch (e) {
2303
- console.error(`[plugkit-wasm] failed to spawn replacement: ${e.message}`);
2302
+ console.error(`[plugkit-wasm] direct node spawn failed: ${e.message}; falling back to bun x`);
2303
+ try {
2304
+ const cp = require('child_process');
2305
+ const bunPath = process.env.GM_BUN_PATH || 'bun';
2306
+ const child = cp.spawn(bunPath, ['x', 'gm-plugkit@latest', 'spool'], {
2307
+ cwd: process.cwd(),
2308
+ detached: true,
2309
+ stdio: 'ignore',
2310
+ windowsHide: true,
2311
+ env: { ...process.env, PLUGKIT_BOOT_REASON: 'self-respawn-from-wrapper-drift-fallback' },
2312
+ });
2313
+ child.unref();
2314
+ } catch (e2) {
2315
+ console.error(`[plugkit-wasm] fallback bun-x also failed: ${e2.message}`);
2316
+ }
2304
2317
  }
2305
2318
  try { fs.writeFileSync(path.join(spoolDir, '.shutdown-reason.json'), JSON.stringify({ reason: 'wrapper-drift-unsupervised', ts: Date.now(), pid: process.pid, boot_sha: _wrapperShaAtBoot.slice(0, 12), file_sha: cur.slice(0, 12) })); } catch (_) {}
2306
2319
  try { releaseLock(); } catch (_) {}
@@ -2789,6 +2802,30 @@ async function runSpoolWatcher(instance, spoolDir) {
2789
2802
  updateAvailable = { installed: upd.installed, latest: upd.latest };
2790
2803
  }
2791
2804
  } catch (_) {}
2805
+ let deviations30m = 0;
2806
+ try {
2807
+ const day = new Date().toISOString().slice(0, 10);
2808
+ const cutoff = Date.now() - 30 * 60 * 1000;
2809
+ for (const sub of ['hook', 'plugkit']) {
2810
+ const p = path.join(GM_LOG_ROOT, day, `${sub}.jsonl`);
2811
+ if (!fs.existsSync(p)) continue;
2812
+ const raw = fs.readFileSync(p, 'utf-8');
2813
+ let idx = 0;
2814
+ while (true) {
2815
+ const nl = raw.indexOf('\n', idx);
2816
+ const line = nl === -1 ? raw.slice(idx) : raw.slice(idx, nl);
2817
+ if (line.includes('"event":"deviation.')) {
2818
+ const tsm = line.match(/"ts":"([^"]+)"/);
2819
+ if (tsm) {
2820
+ const t = Date.parse(tsm[1]);
2821
+ if (Number.isFinite(t) && t >= cutoff) deviations30m++;
2822
+ }
2823
+ }
2824
+ if (nl === -1) break;
2825
+ idx = nl + 1;
2826
+ }
2827
+ }
2828
+ } catch (_) {}
2792
2829
  fs.writeFileSync(TURN_SUMMARY_PATH, JSON.stringify({
2793
2830
  ts: Date.now(),
2794
2831
  watcher_pid: process.pid,
@@ -2801,6 +2838,7 @@ async function runSpoolWatcher(instance, spoolDir) {
2801
2838
  long_gap_threshold_ms: 300000,
2802
2839
  browser_sessions_alive: browserSessions,
2803
2840
  update_available: updateAvailable,
2841
+ deviations_30m: deviations30m,
2804
2842
  }));
2805
2843
  } catch (_) {}
2806
2844
  }
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1396",
3
+ "version": "2.0.1398",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1396",
3
+ "version": "2.0.1398",
4
4
  "description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@ Your first tool call of every session is the boot probe, in one Bash invocation.
28
28
  cat .gm/exec-spool/.status.json 2>/dev/null; echo ---; cat .gm/exec-spool/.turn-summary.json 2>/dev/null; echo ---; date +%s%3N
29
29
  ```
30
30
 
31
- `.turn-summary.json` carries `phase`, `last_skill`, `prd_pending`, `last_instruction_ts`, `last_instruction_age_ms`, `long_gap_threshold_ms`, `browser_sessions_alive`, `update_available`. When age exceeds the threshold, your next non-orienting verb will be gated — dispatch `instruction` first. When `update_available` is non-null, the watcher has detected drift: kill the watcher and re-bootstrap before continuing so the next instruction lands on the fresh wasm.
31
+ `.turn-summary.json` carries `phase`, `last_skill`, `prd_pending`, `last_instruction_ts`, `last_instruction_age_ms`, `long_gap_threshold_ms`, `browser_sessions_alive`, `update_available`, `deviations_30m`. When age exceeds the threshold, your next non-orienting verb will be gated — dispatch `instruction` first. When `update_available` is non-null, the watcher has detected drift: kill the watcher and re-bootstrap before continuing so the next instruction lands on the fresh wasm. `deviations_30m` is the rolling count of `deviation.*` events from hook+plugkit logs in the past 30 min — read it instead of running gmsniff at session start; non-zero indicates active drift worth investigating before continuing.
32
32
 
33
33
  Compare `.status.json` `ts` field to the printed epoch ms. If the gap is >15000, the watcher is dead — boot it:
34
34