gm-skill 2.0.1175 → 2.0.1176

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.
package/README.md CHANGED
@@ -35,7 +35,7 @@ An earlier generation fanned out fifteen per-platform downstream repos (gm-cc, g
35
35
 
36
36
  ## Version
37
37
 
38
- `2.0.1175` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1176` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
39
39
 
40
40
  ## Source of truth
41
41
 
@@ -987,30 +987,47 @@ async function runSpoolWatcher(instance, spoolDir) {
987
987
  fs.mkdirSync(outDir, { recursive: true });
988
988
 
989
989
  const LOCK_PATH = path.join(spoolDir, '.watcher.lock');
990
+ let _ownWrapperSha12 = '';
991
+ try {
992
+ const _crypto = require('crypto');
993
+ const _wp = path.join(os.homedir(), '.claude', 'gm-tools', 'plugkit-wasm-wrapper.js');
994
+ _ownWrapperSha12 = _crypto.createHash('sha256').update(fs.readFileSync(_wp)).digest('hex').slice(0, 12);
995
+ } catch (_) {}
996
+ function lockBody() { return `${process.pid}|${Date.now()}|${_ownWrapperSha12}`; }
990
997
  function acquireLock() {
991
998
  try {
992
999
  if (fs.existsSync(LOCK_PATH)) {
993
1000
  const content = fs.readFileSync(LOCK_PATH, 'utf-8').trim();
994
- const [pidStr, tsStr] = content.split('|');
1001
+ const parts = content.split('|');
1002
+ const pidStr = parts[0];
1003
+ const tsStr = parts[1];
1004
+ const holderSha = parts[2] || '';
995
1005
  const lockTs = parseInt(tsStr, 10);
996
1006
  const age = Date.now() - lockTs;
997
1007
  if (age < 15000) {
998
- const msg = JSON.stringify({ ok: false, reason: 'another-watcher-active', pid: pidStr, age_ms: age });
999
- console.error(`[plugkit-wasm] ${msg}; refusing to start`);
1000
- try { fs.writeFileSync(path.join(spoolDir, '.lock-rejection.json'), msg); } catch (_) {}
1001
- try { logEvent('plugkit', 'watcher.lock-rejected', { holder_pid: pidStr, lock_age_ms: age }); } catch (_) {}
1002
- process.exit(75);
1008
+ if (_ownWrapperSha12 && holderSha && holderSha !== _ownWrapperSha12) {
1009
+ try { logEvent('plugkit', 'peer.stale-wrapper-takeover', { holder_pid: pidStr, holder_sha: holderSha, own_sha: _ownWrapperSha12, lock_age_ms: age }); } catch (_) {}
1010
+ console.error(`[plugkit-wasm] peer wrapper-sha mismatch (holder=${holderSha} own=${_ownWrapperSha12}); killing pid=${pidStr} and taking over`);
1011
+ try { process.kill(parseInt(pidStr, 10), 'SIGTERM'); } catch (_) {}
1012
+ } else {
1013
+ const msg = JSON.stringify({ ok: false, reason: 'another-watcher-active', pid: pidStr, age_ms: age });
1014
+ console.error(`[plugkit-wasm] ${msg}; refusing to start`);
1015
+ try { fs.writeFileSync(path.join(spoolDir, '.lock-rejection.json'), msg); } catch (_) {}
1016
+ try { logEvent('plugkit', 'watcher.lock-rejected', { holder_pid: pidStr, lock_age_ms: age }); } catch (_) {}
1017
+ process.exit(75);
1018
+ }
1019
+ } else {
1020
+ console.error(`[plugkit-wasm] stale lock (age=${age}ms); taking over`);
1003
1021
  }
1004
- console.error(`[plugkit-wasm] stale lock (age=${age}ms); taking over`);
1005
1022
  }
1006
- fs.writeFileSync(LOCK_PATH, `${process.pid}|${Date.now()}`);
1023
+ fs.writeFileSync(LOCK_PATH, lockBody());
1007
1024
  } catch (e) {
1008
1025
  console.error(`[plugkit-wasm] lock acquire failed: ${e.message}`);
1009
1026
  process.exit(1);
1010
1027
  }
1011
1028
  }
1012
1029
  function refreshLock() {
1013
- try { fs.writeFileSync(LOCK_PATH, `${process.pid}|${Date.now()}`); } catch (_) {}
1030
+ try { fs.writeFileSync(LOCK_PATH, lockBody()); } catch (_) {}
1014
1031
  }
1015
1032
  function releaseLock() {
1016
1033
  try {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1175",
3
+ "version": "2.0.1176",
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.1175",
3
+ "version": "2.0.1176",
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",
@@ -39,7 +39,7 @@
39
39
  "gm.json"
40
40
  ],
41
41
  "dependencies": {
42
- "gm-plugkit": "^2.0.1175"
42
+ "gm-plugkit": "^2.0.1176"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"