gm-codex 2.0.962 → 2.0.964

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-codex",
3
- "version": "2.0.962",
3
+ "version": "2.0.964",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",
package/bin/bootstrap.js CHANGED
@@ -24,6 +24,27 @@ function log(msg) {
24
24
  try { process.stderr.write(`[plugkit-bootstrap] ${msg}\n`); } catch (_) {}
25
25
  }
26
26
 
27
+ function probeBinaryVersion(binPath) {
28
+ try {
29
+ const { spawnSync } = require('child_process');
30
+ const r = spawnSync(binPath, ['--version'], { timeout: 3000, encoding: 'utf8' });
31
+ if (r.error) return null;
32
+ const text = `${r.stdout || ''} ${r.stderr || ''}`.trim();
33
+ const m = text.match(/(\d+\.\d+\.\d+)/);
34
+ return m ? m[1] : null;
35
+ } catch (_) { return null; }
36
+ }
37
+
38
+ function writeBootstrapError(spec) {
39
+ try {
40
+ const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
41
+ const spoolDir = path.join(projectDir, '.gm', 'exec-spool');
42
+ fs.mkdirSync(spoolDir, { recursive: true });
43
+ const out = path.join(spoolDir, '.bootstrap-error.json');
44
+ fs.writeFileSync(out, JSON.stringify({ ts: new Date().toISOString(), ...spec }, null, 2));
45
+ } catch (_) {}
46
+ }
47
+
27
48
  function obsEvent(subsystem, event, fields) {
28
49
  if (process.env.GM_LOG_DISABLE) return;
29
50
  try {
@@ -326,19 +347,45 @@ async function bootstrap(opts) {
326
347
  const partialPath = `${finalPath}.partial`;
327
348
 
328
349
  if (fs.existsSync(finalPath) && fs.existsSync(okSentinel)) {
329
- if (!opts.silent) log(`cache hit: ${finalPath}`);
330
- proactiveKillForNewInstall(version, finalPath);
331
- pruneOldVersions(root, version, readRtkVersion(wrapperDir));
332
- return finalPath;
350
+ const actualVersion = probeBinaryVersion(finalPath);
351
+ if (actualVersion && actualVersion !== version) {
352
+ log(`cache version mismatch: dir=v${version} contains binary ${actualVersion} → re-fetching v${version}`);
353
+ writeBootstrapError({
354
+ expected_version: version,
355
+ cached_version: actualVersion,
356
+ error_phase: 'cache-hit-pin-mismatch',
357
+ error_message: `cached binary at ${finalPath} reports --version=${actualVersion} but cache dir pins v${version}`,
358
+ });
359
+ try { fs.unlinkSync(finalPath); } catch (_) {}
360
+ try { fs.unlinkSync(okSentinel); } catch (_) {}
361
+ } else {
362
+ if (!opts.silent) log(`cache hit: ${finalPath}${actualVersion ? ` (matches pin v${version})` : ''}`);
363
+ proactiveKillForNewInstall(version, finalPath);
364
+ pruneOldVersions(root, version, readRtkVersion(wrapperDir));
365
+ return finalPath;
366
+ }
333
367
  }
334
368
 
335
369
  if (healIfShaMatches(finalPath, expectedSha, okSentinel, partialPath, 'plugkit')) {
336
- if (!opts.silent) log(`cache heal (sha match): ${finalPath}`);
337
- proactiveKillForNewInstall(version, finalPath);
338
- pruneOldVersions(root, version, readRtkVersion(wrapperDir));
339
- try { await bootstrapRtk(verDir, version, wrapperDir, opts.silent, root); }
340
- catch (err) { log(`rtk fetch skipped: ${err.message}`); }
341
- return finalPath;
370
+ const actualVersion = probeBinaryVersion(finalPath);
371
+ if (actualVersion && actualVersion !== version) {
372
+ log(`cache heal version mismatch: dir=v${version} contains binary ${actualVersion} → re-fetching`);
373
+ writeBootstrapError({
374
+ expected_version: version,
375
+ cached_version: actualVersion,
376
+ error_phase: 'cache-heal-pin-mismatch',
377
+ error_message: `healed binary at ${finalPath} reports --version=${actualVersion} but cache dir pins v${version}`,
378
+ });
379
+ try { fs.unlinkSync(finalPath); } catch (_) {}
380
+ try { fs.unlinkSync(okSentinel); } catch (_) {}
381
+ } else {
382
+ if (!opts.silent) log(`cache heal (sha match): ${finalPath}${actualVersion ? ` (matches pin v${version})` : ''}`);
383
+ proactiveKillForNewInstall(version, finalPath);
384
+ pruneOldVersions(root, version, readRtkVersion(wrapperDir));
385
+ try { await bootstrapRtk(verDir, version, wrapperDir, opts.silent, root); }
386
+ catch (err) { log(`rtk fetch skipped: ${err.message}`); }
387
+ return finalPath;
388
+ }
342
389
  }
343
390
 
344
391
  const lockPath = path.join(verDir, '.lock');
@@ -368,12 +415,28 @@ async function bootstrap(opts) {
368
415
  } catch (_) {}
369
416
  }
370
417
  const url = `https://github.com/${RELEASE_REPO}/releases/download/v${version}/${binName}`;
371
- await downloadWithRetry(url, partialPath);
418
+ try {
419
+ await downloadWithRetry(url, partialPath);
420
+ } catch (fetchErr) {
421
+ writeBootstrapError({
422
+ expected_version: version,
423
+ cached_version: null,
424
+ error_phase: 'download',
425
+ error_message: fetchErr && fetchErr.message ? fetchErr.message : String(fetchErr),
426
+ });
427
+ throw fetchErr;
428
+ }
372
429
 
373
430
  if (expectedSha) {
374
431
  const got = await sha256OfFile(partialPath);
375
432
  if (got !== expectedSha) {
376
433
  try { fs.unlinkSync(partialPath); } catch (_) {}
434
+ writeBootstrapError({
435
+ expected_version: version,
436
+ cached_version: null,
437
+ error_phase: 'sha256-mismatch',
438
+ error_message: `sha256 mismatch for ${binName}: expected ${expectedSha}, got ${got}`,
439
+ });
377
440
  throw new Error(`sha256 mismatch for ${binName}: expected ${expectedSha}, got ${got}`);
378
441
  }
379
442
  log('sha256 verified');
@@ -1,6 +1,6 @@
1
- ce9ac28e461920fa9b8011e0c9327a939ed652a9710499475499bdf1b4b32b81 plugkit-win32-x64.exe
2
- 90b799fb9c8ea78ee9a332d6ad2ab22171f5223a89993fc28f3e1dd402563999 plugkit-win32-arm64.exe
3
- 19f79c1383cbc759cd4ea9803375183fab2889b4c64035c3a33870d4e2692158 plugkit-darwin-x64
4
- be166294b66f2300d16237ba354fbaeb4e68fd27448cc2395d0430097d33865c plugkit-darwin-arm64
5
- 291b990c734789af225032b2f67e03d08013245e246bc7b91b195d4853c7a2e5 plugkit-linux-x64
6
- 0e180fca4e39f1680565d32b0f646ba6f759c21edad112fb887652c7e711b1a3 plugkit-linux-arm64
1
+ 3303c0120222b5a50ddadec0e4986025230eae65e31a500ecaba103096de8c29 plugkit-win32-x64.exe
2
+ 6ce713b02f976106bccdad27486ddfcc9ba3b2855e9767f56559f49b426e761c plugkit-win32-arm64.exe
3
+ 50861d5cdd9abbfc384ccd2887e306b6614bba545d7ecf2a1aac5cbbf25ccbf6 plugkit-darwin-x64
4
+ 4198d955cfcac6f73c83072928b26d28888ba6a727e255702bacb197f5a1672e plugkit-darwin-arm64
5
+ 7a6696c1d025ef4de89dc7ea33e08db8331c7b8719de8d0d354405da6d5b9ff6 plugkit-linux-x64
6
+ 6372bd0c10a9058211354196105ba8e835bb57d83c3d2bbc7693d37ea708e9f6 plugkit-linux-arm64
@@ -1 +1 @@
1
- 0.1.325
1
+ 0.1.326
package/bin/rtk.sha256 CHANGED
@@ -1,5 +1,5 @@
1
- 7568b81afec0ff8f86d73847b8b43e24a772bdf6f877aae16d86ee15c173f25b rtk-win32-x64.exe
2
- eacd700320ef29945bd1269960fdfd5ca1fa82b770612d71a5e089378191f457 rtk-win32-arm64.exe
1
+ 663246b9187bc75ca00a8d4b8c9ec7ee6c91db4d8416fa696ba8338f6488d484 rtk-win32-x64.exe
2
+ 2c55b8abad5b499cf1914c2b57847f707d0fdb981b1113baddf7ff53b694976d rtk-win32-arm64.exe
3
3
  1b1e792767ed0e1e6ca0e2f0a8de02e77b06dea2f5ae667278b94baf239fcdc3 rtk-darwin-x64
4
4
  9717978d9d6216ea50c94444e00e359479b6315a17bd48c16064b267c8b0b60d rtk-darwin-arm64
5
5
  a100d3defac54194144e5723aec57e6f286b42298c67145c8428815246c9ee56 rtk-linux-x64
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.962",
3
+ "version": "2.0.964",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -23,5 +23,5 @@
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
26
- "plugkitVersion": "0.1.325"
26
+ "plugkitVersion": "0.1.326"
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-codex",
3
- "version": "2.0.962",
3
+ "version": "2.0.964",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.962",
3
+ "version": "2.0.964",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",