gm-skill 2.0.1438 → 2.0.1439

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.1438",
3
+ "version": "2.0.1439",
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": {
@@ -2289,7 +2289,8 @@ async function runSpoolWatcher(instance, spoolDir) {
2289
2289
  action: 'spawn-replacement-and-exit',
2290
2290
  boot_reason: bootReason,
2291
2291
  });
2292
- console.error(`[plugkit-wasm] version drift detected: instance=${instV} file=${fileV} — spawning replacement via bun x gm-plugkit@latest spool then exiting`);
2292
+ console.error(`[plugkit-wasm] version drift detected: instance=${instV} file=${fileV} — spawning replacement via bun x gm-plugkit@latest spool, waiting for its heartbeat before exiting`);
2293
+ let spawnOk = false;
2293
2294
  try {
2294
2295
  const cp = require('child_process');
2295
2296
  const bunPath = process.env.GM_BUN_PATH || 'bun';
@@ -2301,14 +2302,42 @@ async function runSpoolWatcher(instance, spoolDir) {
2301
2302
  env: { ...process.env, PLUGKIT_BOOT_REASON: 'self-respawn-from-drift' },
2302
2303
  });
2303
2304
  child.unref();
2305
+ spawnOk = true;
2304
2306
  } catch (e) {
2305
2307
  console.error(`[plugkit-wasm] failed to spawn replacement: ${e.message}; exiting anyway so next agent dispatch boots fresh`);
2306
2308
  }
2307
2309
  try { fs.writeFileSync(path.join(spoolDir, '.shutdown-reason.json'), JSON.stringify({ reason: 'version-change-unsupervised', ts: Date.now(), pid: process.pid, instance_version: instV, file_version: fileV })); } catch (_) {}
2308
- try { releaseLock(); } catch (_) {}
2309
- try { fs.unlinkSync(STATUS_PATH_FOR_TEARDOWN); } catch (_) {}
2310
- try { clearBootActive(); } catch (_) {}
2311
- setTimeout(() => process.exit(0), 2000);
2310
+ const exitNow = () => {
2311
+ try { releaseLock(); } catch (_) {}
2312
+ try { fs.unlinkSync(STATUS_PATH_FOR_TEARDOWN); } catch (_) {}
2313
+ try { clearBootActive(); } catch (_) {}
2314
+ process.exit(0);
2315
+ };
2316
+ if (!spawnOk) { setTimeout(exitNow, 2000); return; }
2317
+ const myPid = process.pid;
2318
+ const respawnDeadline = Date.now() + 90000;
2319
+ const pollReplacement = () => {
2320
+ try {
2321
+ const raw = fs.readFileSync(STATUS_PATH_FOR_TEARDOWN, 'utf8');
2322
+ const st = JSON.parse(raw);
2323
+ const freshHeartbeat = st && st.ts && (Date.now() - st.ts) < 15000;
2324
+ const differentProc = st && st.pid && st.pid !== myPid;
2325
+ if (freshHeartbeat && differentProc) {
2326
+ try { logEvent('plugkit', 'version.drift-respawn-confirmed', { old_pid: myPid, new_pid: st.pid, new_version: st.version }); } catch (_) {}
2327
+ try { releaseLock(); } catch (_) {}
2328
+ try { clearBootActive(); } catch (_) {}
2329
+ process.exit(0);
2330
+ return;
2331
+ }
2332
+ } catch (_) {}
2333
+ if (Date.now() > respawnDeadline) {
2334
+ try { logEvent('plugkit', 'version.drift-respawn-timeout', { old_pid: myPid, waited_ms: 90000 }); } catch (_) {}
2335
+ exitNow();
2336
+ return;
2337
+ }
2338
+ setTimeout(pollReplacement, 1500);
2339
+ };
2340
+ setTimeout(pollReplacement, 3000);
2312
2341
  return;
2313
2342
  }
2314
2343
  logEvent('plugkit', 'version.drift', {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1438",
3
+ "version": "2.0.1439",
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.1438",
3
+ "version": "2.0.1439",
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",