gm-skill 2.0.1176 → 2.0.1178

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.1176` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1178` — 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
 
@@ -178,27 +178,18 @@ async function extractNpmPackageWasm(destPath, version) {
178
178
  log(`extracting npm package ${NPM_PACKAGE}@${version} to ${tempDir}`);
179
179
  obsEvent('bootstrap', 'npm.extract.start', { package: NPM_PACKAGE, version });
180
180
 
181
- let cmd, args;
182
- if (process.platform === 'win32') {
183
- const npxCli = resolveNpxJsCli();
184
- if (npxCli) {
185
- cmd = process.execPath;
186
- args = [npxCli, NPM_PACKAGE + '@' + version, '--prefix', tempDir];
187
- } else {
188
- cmd = 'npx.cmd';
189
- args = [NPM_PACKAGE + '@' + version, '--prefix', tempDir];
190
- }
191
- } else {
192
- cmd = 'npx';
193
- args = [NPM_PACKAGE + '@' + version, '--prefix', tempDir];
194
- }
181
+ fs.writeFileSync(path.join(tempDir, 'package.json'), JSON.stringify({ name: 'plugkit-extract', version: '0.0.0', private: true }));
182
+
183
+ const cmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
184
+ const args = ['install', '--no-audit', '--no-fund', '--no-save', NPM_PACKAGE + '@' + version];
195
185
 
196
186
  const result = spawnSync(cmd, args, {
187
+ cwd: tempDir,
197
188
  stdio: ['ignore', 'pipe', 'pipe'],
198
189
  timeout: ATTEMPT_TIMEOUT_MS,
199
190
  encoding: 'utf8',
200
191
  windowsHide: true,
201
- shell: process.platform === 'win32' && cmd === 'npx.cmd',
192
+ shell: process.platform === 'win32',
202
193
  });
203
194
 
204
195
  if (result.error) throw result.error;
@@ -1039,6 +1039,46 @@ async function runSpoolWatcher(instance, spoolDir) {
1039
1039
  acquireLock();
1040
1040
  setInterval(refreshLock, 5000);
1041
1041
 
1042
+ const PEER_REGISTRY_PATH = path.join(os.homedir(), '.claude', 'gm-tools', 'peer-registry.json');
1043
+ function registerSelfAsPeer() {
1044
+ try {
1045
+ let reg = {};
1046
+ try { reg = JSON.parse(fs.readFileSync(PEER_REGISTRY_PATH, 'utf-8')); } catch (_) {}
1047
+ reg[process.cwd()] = { pid: process.pid, ts: Date.now(), sha: _ownWrapperSha12 };
1048
+ fs.writeFileSync(PEER_REGISTRY_PATH, JSON.stringify(reg, null, 2));
1049
+ } catch (_) {}
1050
+ }
1051
+ registerSelfAsPeer();
1052
+ setInterval(registerSelfAsPeer, 30_000);
1053
+
1054
+ function sweepStalePeers() {
1055
+ if (!_ownWrapperSha12) return;
1056
+ let reg = {};
1057
+ try { reg = JSON.parse(fs.readFileSync(PEER_REGISTRY_PATH, 'utf-8')); } catch (_) { return; }
1058
+ for (const peerCwd of Object.keys(reg)) {
1059
+ if (peerCwd === process.cwd()) continue;
1060
+ const peerLock = path.join(peerCwd, '.gm', 'exec-spool', '.watcher.lock');
1061
+ let content = '';
1062
+ try { content = fs.readFileSync(peerLock, 'utf-8').trim(); } catch (_) { continue; }
1063
+ const parts = content.split('|');
1064
+ const peerPid = parseInt(parts[0], 10);
1065
+ const peerTs = parseInt(parts[1], 10);
1066
+ const peerSha = parts[2] || '';
1067
+ if (!peerPid || !peerSha) continue;
1068
+ const age = Date.now() - peerTs;
1069
+ if (age > 15000) continue;
1070
+ if (peerSha === _ownWrapperSha12) continue;
1071
+ try {
1072
+ process.kill(peerPid, 0);
1073
+ } catch (_) { continue; }
1074
+ logEvent('plugkit', 'peer.stale-wrapper-killed', { peer_cwd: peerCwd, peer_pid: peerPid, peer_sha: peerSha, own_sha: _ownWrapperSha12, lock_age_ms: age });
1075
+ console.error(`[plugkit-wasm] peer-sweep killing stale-wrapper watcher pid=${peerPid} cwd=${peerCwd} sha=${peerSha} (own=${_ownWrapperSha12})`);
1076
+ try { process.kill(peerPid, 'SIGTERM'); } catch (_) {}
1077
+ }
1078
+ }
1079
+ setInterval(sweepStalePeers, 60_000);
1080
+ setTimeout(sweepStalePeers, 5000);
1081
+
1042
1082
  const IDLE_LIMIT_MS = parseInt(process.env.PLUGKIT_IDLE_LIMIT_MS, 10) || 15 * 60 * 1000;
1043
1083
  const IDLE_CHECK_MS = 60_000;
1044
1084
  const SHUTDOWN_REASON_PATH = path.join(spoolDir, '.shutdown-reason.json');
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1176",
3
+ "version": "2.0.1178",
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.1176",
3
+ "version": "2.0.1178",
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.1176"
42
+ "gm-plugkit": "^2.0.1178"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"