gm-skill 2.0.1501 → 2.0.1503

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.1501",
3
+ "version": "2.0.1503",
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": {
@@ -787,11 +787,22 @@ function sleepSync(ms) {
787
787
  spawnSync(process.execPath, ['-e', `setTimeout(()=>{}, ${ms})`], { timeout: ms + 2000 });
788
788
  }
789
789
 
790
- function runBrowserRunner(pw, args, timeoutMs) {
790
+ function playwriterHomeFor(cwd, claudeSessionId) {
791
+ if (process.env.PLAYWRITER_HOME) return process.env.PLAYWRITER_HOME;
792
+ if (!cwd) return path.join(GM_TOOLS_ROOT, `pw-sock-${sessionProfileSlug(claudeSessionId)}`);
793
+ try { ensureGitignored(cwd, '.gm/pw-sock-*/'); } catch (_) {}
794
+ return path.join(cwd, '.gm', `pw-sock-${sessionProfileSlug(claudeSessionId)}`);
795
+ }
796
+
797
+ function runBrowserRunner(pw, args, timeoutMs, cwd, claudeSessionId) {
791
798
  const allArgs = [...pw.baseArgs, ...args];
792
799
  const useShell = !!pw.shell;
793
800
  const spawnCmd = useShell && /\s/.test(pw.cmd) ? `"${pw.cmd}"` : pw.cmd;
794
801
  const spawnArgs = useShell ? allArgs.map(a => /[\s"]/.test(String(a)) ? `"${String(a).replace(/"/g, '\\"')}"` : a) : allArgs;
802
+ const env = { ...process.env };
803
+ const sockDir = playwriterHomeFor(cwd, claudeSessionId);
804
+ try { fs.mkdirSync(sockDir, { recursive: true }); } catch (_) {}
805
+ env.PLAYWRITER_HOME = sockDir;
795
806
  // Stamp a busy window before the synchronous spawn so the blocked event loop's stale heartbeat
796
807
  // is not misread as a dead watcher. Pad past the spawn timeout for teardown.
797
808
  _writeStatusBusy((timeoutMs || 30000) + 5000);
@@ -800,7 +811,7 @@ function runBrowserRunner(pw, args, timeoutMs) {
800
811
  timeout: timeoutMs,
801
812
  shell: useShell,
802
813
  windowsHide: true,
803
- env: process.env,
814
+ env,
804
815
  });
805
816
  }
806
817
 
@@ -2293,7 +2304,30 @@ async function runSpoolWatcher(instance, spoolDir) {
2293
2304
  child.unref();
2294
2305
  try { logEvent('plugkit', 'gm-plugkit.self-stale-respawn', { running_version: own, latest_version: latest }); } catch (_) {}
2295
2306
  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 (_) {}
2296
- setTimeout(() => process.exit(0), 2000);
2307
+ // Wait for the replacement's fresh heartbeat before exiting (mirror the
2308
+ // version-drift path) instead of a blind 2s exit: the gm-plugkit download can
2309
+ // take many seconds, and exiting early lets the supervisor relaunch the SAME
2310
+ // stale version before the new one lands, so the update never sticks.
2311
+ const myPid = process.pid;
2312
+ const respawnDeadline = Date.now() + 90000;
2313
+ const exitSelfStale = () => { try { process.exit(0); } catch (_) {} };
2314
+ const pollSelfStaleReplacement = () => {
2315
+ try {
2316
+ const st = JSON.parse(fs.readFileSync(STATUS_PATH_FOR_TEARDOWN, 'utf8'));
2317
+ const freshHeartbeat = st && st.ts && (Date.now() - st.ts) < 15000;
2318
+ const differentProc = st && st.pid && st.pid !== myPid;
2319
+ if (freshHeartbeat && differentProc) {
2320
+ try { logEvent('plugkit', 'gm-plugkit.self-stale-respawn-confirmed', { old_pid: myPid, new_pid: st.pid, new_version: st.version, latest_version: latest }); } catch (_) {}
2321
+ return exitSelfStale();
2322
+ }
2323
+ } catch (_) {}
2324
+ if (Date.now() > respawnDeadline) {
2325
+ try { logEvent('plugkit', 'gm-plugkit.self-stale-respawn-timeout', { old_pid: myPid, waited_ms: 90000 }); } catch (_) {}
2326
+ return exitSelfStale();
2327
+ }
2328
+ setTimeout(pollSelfStaleReplacement, 1500);
2329
+ };
2330
+ setTimeout(pollSelfStaleReplacement, 3000);
2297
2331
  } catch (e) {
2298
2332
  console.error(`[plugkit-wasm] failed to spawn replacement on self-stale: ${e.message}`);
2299
2333
  }
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1501",
3
+ "version": "2.0.1503",
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.1501",
3
+ "version": "2.0.1503",
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",