gm-codex 2.0.963 → 2.0.965

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.963",
3
+ "version": "2.0.965",
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
- 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
+ e6a70d4414197614f0132430a563258d6a6b16a6a96f7a5ce3599c3d05f2d9c2 plugkit-win32-x64.exe
2
+ 7a98fc23c8beb0b2679926c344fa15741c33bbfa84211aa7dffbc076370c7cad plugkit-win32-arm64.exe
3
+ fe3e93427aa9f17230aded1485f0b29c8b8b7df778e20c3f1f1fc32faa810e7b plugkit-darwin-x64
4
+ e311f3aa6468d84b208ab5217aa710a6a5f78a80680f9ca5c076a4b9dc49f43f plugkit-darwin-arm64
5
+ 441a202db12f95984083d2423d6680fcd2eec89a223f86adcd70467b1ddbf3f8 plugkit-linux-x64
6
+ eb9f181db8a0cf95176e08c0306ced37559f67665c256ccfc0718cccb51f1e2c plugkit-linux-arm64
@@ -1 +1 @@
1
- 0.1.326
1
+ 0.1.327
package/bin/rtk.sha256 CHANGED
@@ -1,5 +1,5 @@
1
- 663246b9187bc75ca00a8d4b8c9ec7ee6c91db4d8416fa696ba8338f6488d484 rtk-win32-x64.exe
2
- 2c55b8abad5b499cf1914c2b57847f707d0fdb981b1113baddf7ff53b694976d rtk-win32-arm64.exe
1
+ af41a7b21ded4bbc289b9f96840ddefb49d2ab804575acb1d4257e9e32cd1066 rtk-win32-x64.exe
2
+ e0c225f75d495f7b4578ab2546ef97eac93621b75c67f93828a4ae6749974e65 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.963",
3
+ "version": "2.0.965",
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.326"
26
+ "plugkitVersion": "0.1.327"
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-codex",
3
- "version": "2.0.963",
3
+ "version": "2.0.965",
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.963",
3
+ "version": "2.0.965",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",