gm-skill 2.0.1431 → 2.0.1433

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.1431",
3
+ "version": "2.0.1433",
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": {
@@ -957,13 +957,22 @@ function getOrCreateBrowserSession(cwd, claudeSessionId, pw) {
957
957
  }
958
958
  } else {
959
959
  const reason = !pidOk ? 'pid-dead' : (!cdpOk ? 'cdp-dead' : 'profile-drift');
960
- logEvent('hook', 'deviation.browser-profile-collision', {
961
- sid: claudeSessionId,
962
- stale_pid: existing.pid || null,
963
- stale_profile: existing.profileDir || null,
964
- want_profile: wantProfile,
965
- reason,
966
- });
960
+ if (reason === 'pid-dead') {
961
+ logEvent('plugkit', 'browser.stale-reclaimed', {
962
+ sid: claudeSessionId,
963
+ stale_pid: existing.pid || null,
964
+ stale_profile: existing.profileDir || null,
965
+ want_profile: wantProfile,
966
+ });
967
+ } else {
968
+ logEvent('hook', 'deviation.browser-profile-collision', {
969
+ sid: claudeSessionId,
970
+ stale_pid: existing.pid || null,
971
+ stale_profile: existing.profileDir || null,
972
+ want_profile: wantProfile,
973
+ reason,
974
+ });
975
+ }
967
976
  if (typeof gracefulCloseBrowser === 'function') {
968
977
  try { gracefulCloseBrowser(existing, `collision:${reason}`); } catch (_) {}
969
978
  } else if (pidOk && Number.isFinite(existing.pid)) {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1431",
3
+ "version": "2.0.1433",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -533,6 +533,47 @@ function ensureSupervisorInstalled() {
533
533
  }
534
534
  }
535
535
 
536
+ function ensureWrapperInstalled() {
537
+ try {
538
+ let src = null;
539
+ try {
540
+ const gmPlugkit = require('gm-plugkit');
541
+ const base = path.dirname(gmPlugkit.getPath ? gmPlugkit.getPath() : require.resolve('gm-plugkit'));
542
+ const cand = path.join(base, 'plugkit-wasm-wrapper.js');
543
+ if (fs.existsSync(cand)) src = cand;
544
+ } catch (_) {}
545
+ if (!src) {
546
+ src = resolveFromCandidates([
547
+ path.join(__dirname, '..', 'gm-plugkit', 'plugkit-wasm-wrapper.js'),
548
+ path.join(__dirname, '..', '..', 'gm-plugkit', 'plugkit-wasm-wrapper.js'),
549
+ ], 'gm-skill/gm-plugkit/plugkit-wasm-wrapper.js');
550
+ }
551
+ if (!src || !fs.existsSync(src)) {
552
+ emitBootstrapEvent('warn', 'bundled plugkit-wasm-wrapper.js not found; wrapper refresh skipped');
553
+ return null;
554
+ }
555
+ fs.mkdirSync(PLUGKIT_TOOLS_DIR, { recursive: true });
556
+ let needsWrite = true;
557
+ if (fs.existsSync(PLUGKIT_WASM_WRAPPER)) {
558
+ try {
559
+ const a = crypto.createHash('sha256').update(fs.readFileSync(src)).digest('hex');
560
+ const b = crypto.createHash('sha256').update(fs.readFileSync(PLUGKIT_WASM_WRAPPER)).digest('hex');
561
+ if (a === b) needsWrite = false;
562
+ } catch (_) {}
563
+ }
564
+ if (needsWrite) {
565
+ const tmp = PLUGKIT_WASM_WRAPPER + '.tmp';
566
+ fs.copyFileSync(src, tmp);
567
+ fs.renameSync(tmp, PLUGKIT_WASM_WRAPPER);
568
+ emitBootstrapEvent('info', 'plugkit-wasm-wrapper.js refreshed', { target: PLUGKIT_WASM_WRAPPER });
569
+ }
570
+ return PLUGKIT_WASM_WRAPPER;
571
+ } catch (e) {
572
+ emitBootstrapEvent('warn', 'ensureWrapperInstalled failed', { error: e.message });
573
+ return null;
574
+ }
575
+ }
576
+
536
577
  function findSupervisorPid() {
537
578
  try {
538
579
  const supervisorPidFile = path.join(process.cwd(), '.gm', 'exec-spool', '.supervisor.pid');
@@ -561,6 +602,7 @@ async function spawnPlugkitWatcher(wasmPath) {
561
602
  }
562
603
 
563
604
  const supervisorPath = ensureSupervisorInstalled();
605
+ ensureWrapperInstalled();
564
606
  const projectDir = process.cwd();
565
607
 
566
608
  const existingSupervisor = findSupervisorPid();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1431",
3
+ "version": "2.0.1433",
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",