gm-skill 2.0.1376 → 2.0.1378

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 +1 @@
1
- 0.1.518
1
+ 0.1.519
@@ -1 +1 @@
1
- 1e372346cf3341d735270402ec8716f604f92126909ee3eee9baff923e1de4ae plugkit.wasm
1
+ 59c02530d68b474755242ecec333cb2d154b963f39bc47685abc842f146bf247 plugkit.wasm
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1376",
3
+ "version": "2.0.1378",
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": {
@@ -2144,7 +2144,24 @@ async function runSpoolWatcher(instance, spoolDir) {
2144
2144
  if (!_selfStaleLoggedOnce) {
2145
2145
  _selfStaleLoggedOnce = true;
2146
2146
  try { logEvent('plugkit', 'gm-plugkit.self-stale', { running_version: own, latest_version: latest, detected_by: 'watcher-periodic-probe' }); } catch (_) {}
2147
- console.error(`[plugkit-wasm] gm-plugkit self-stale: running ${own}, latest npm ${latest} (marker at .gm/exec-spool/.gm-plugkit-stale.json)`);
2147
+ console.error(`[plugkit-wasm] gm-plugkit self-stale: running ${own}, latest npm ${latest} spawning replacement via bun x gm-plugkit@latest spool and exiting`);
2148
+ try {
2149
+ const cp = require('child_process');
2150
+ const bunPath = process.env.GM_BUN_PATH || 'bun';
2151
+ const child = cp.spawn(bunPath, ['x', `gm-plugkit@${latest}`, 'spool'], {
2152
+ cwd: process.cwd(),
2153
+ detached: true,
2154
+ stdio: 'ignore',
2155
+ windowsHide: true,
2156
+ env: { ...process.env, PLUGKIT_BOOT_REASON: 'self-respawn-from-self-stale' },
2157
+ });
2158
+ child.unref();
2159
+ try { logEvent('plugkit', 'gm-plugkit.self-stale-respawn', { running_version: own, latest_version: latest }); } catch (_) {}
2160
+ try { fs.writeFileSync(path.join(spoolDir, '.shutdown-reason.json'), JSON.stringify({ reason: 'gm-plugkit-self-stale', ts: Date.now(), pid: process.pid, running_version: own, latest_version: latest })); } catch (_) {}
2161
+ setTimeout(() => process.exit(0), 2000);
2162
+ } catch (e) {
2163
+ console.error(`[plugkit-wasm] failed to spawn replacement on self-stale: ${e.message}`);
2164
+ }
2148
2165
  }
2149
2166
  } catch (e) {
2150
2167
  if (!_selfStaleProbeErrorLogged) {
@@ -2258,25 +2275,32 @@ async function runSpoolWatcher(instance, spoolDir) {
2258
2275
  if (unsupervised) {
2259
2276
  if (_wrapperDriftLoggedOnce) return;
2260
2277
  _wrapperDriftLoggedOnce = true;
2261
- try {
2262
- const marker = {
2263
- ts: new Date().toISOString(),
2264
- reason: 'wrapper-has-newer-on-disk',
2265
- running_sha12: _wrapperShaAtBoot.slice(0, 12),
2266
- disk_sha12: cur.slice(0, 12),
2267
- running_pid: process.pid,
2268
- instruction: 'Wrapper code on disk has newer sha than what this watcher loaded in-memory. Drift-suppress kept the watcher alive (good), but new code only loads on restart. Kill this watcher (taskkill /F /PID ' + process.pid + ' on Windows, kill ' + process.pid + ' on POSIX) and re-bootstrap (bun x gm-plugkit@latest spool) to pick up the new wrapper.',
2269
- };
2270
- fs.writeFileSync(path.join(spoolDir, '.wrapper-stale-in-memory.json'), JSON.stringify(marker, null, 2));
2271
- } catch (_) {}
2272
- logEvent('plugkit', 'wrapper.drift-detected-no-exit', {
2278
+ logEvent('plugkit', 'wrapper.drift-self-respawn', {
2273
2279
  boot_sha: _wrapperShaAtBoot.slice(0, 12),
2274
2280
  file_sha: cur.slice(0, 12),
2275
- action: 'suppress-exit',
2276
- reason: 'no-supervisor-to-respawn',
2281
+ action: 'spawn-replacement-and-exit',
2277
2282
  boot_reason: bootReason,
2278
2283
  });
2279
- console.error(`[plugkit-wasm] wrapper.js drift detected — exit SUPPRESSED (boot_reason=${bootReason}; no supervisor to respawn)`);
2284
+ console.error(`[plugkit-wasm] wrapper.js drift detected — spawning replacement via bun x gm-plugkit@latest spool then exiting`);
2285
+ try {
2286
+ const cp = require('child_process');
2287
+ const bunPath = process.env.GM_BUN_PATH || 'bun';
2288
+ const child = cp.spawn(bunPath, ['x', 'gm-plugkit@latest', 'spool'], {
2289
+ cwd: process.cwd(),
2290
+ detached: true,
2291
+ stdio: 'ignore',
2292
+ windowsHide: true,
2293
+ env: { ...process.env, PLUGKIT_BOOT_REASON: 'self-respawn-from-wrapper-drift' },
2294
+ });
2295
+ child.unref();
2296
+ } catch (e) {
2297
+ console.error(`[plugkit-wasm] failed to spawn replacement: ${e.message}`);
2298
+ }
2299
+ 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 (_) {}
2300
+ try { releaseLock(); } catch (_) {}
2301
+ try { fs.unlinkSync(STATUS_PATH_FOR_TEARDOWN); } catch (_) {}
2302
+ try { clearBootActive(); } catch (_) {}
2303
+ setTimeout(() => process.exit(0), 2000);
2280
2304
  return;
2281
2305
  }
2282
2306
  logEvent('plugkit', 'wrapper.drift', {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1376",
3
+ "version": "2.0.1378",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.518"
20
+ "plugkitVersion": "0.1.519"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1376",
3
+ "version": "2.0.1378",
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",
@@ -40,6 +40,8 @@ bun x gm-plugkit@latest spool > /dev/null 2>&1 &
40
40
 
41
41
  Never poll the spool dir with `sleep && ls` or `Start-Sleep && Test-Path` — plugkit is synchronous from your view; if the response is not there, the watcher is dead (re-check `.status.json` mtime) or the verb is slow (check `.gm/exec-spool/.watcher.log`), not "still processing."
42
42
 
43
+ **Dead-watcher recovery is mandatory, never abandon the dispatch.** If two consecutive re-Reads return "file does not exist" AND `.status.json` ts is stale (>15s gap from current epoch), the watcher is dead. Your next call is `bun x gm-plugkit@latest spool` to boot a fresh watcher (the wrapper has self-respawn paths now — one boot deploys every queued fix to disk). Then re-dispatch the original verb. Do NOT reach for an alternative tool — puppeteer-core, agent-browser, WebFetch, raw `chrome.exe`, none of these substitute for the `browser` verb. Reaching outside plugkit when the spool surface is reachable orphans state the next session cannot reap, bypasses paper §23 witness gates, and ages the project's discipline. The recovery is always: notice dead → boot → re-dispatch. The full chain from spool-write to disk-Read-success is the only admissible loop; any short-circuit produces unreconcilable state.
44
+
43
45
  When writing the spool input from PowerShell, pass `-Encoding utf8` (or use `[System.IO.File]::WriteAllText($path, $body)` which defaults to UTF-8 no-BOM). PowerShell 5.1's default `Out-File` / `Set-Content` write UTF-16 LE with BOM, which the watcher detects and re-decodes (`spool.body-encoding-recoded` event in gmsniff), but the deviation is a fingerprint of an instruction you missed. Use `bash -c "echo -n '...' > ..."` or `Write` tool instead when the body is structured JSON.
44
46
 
45
47
  First turn body must be `{"prompt":"<user request>"}` so orient_nouns and recall_hits derive from the request; subsequent turns in the same conversation may use empty body `{}`.