gm-qwen 2.0.994 → 2.0.996
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/bin/bootstrap.js +19 -5
- package/gm.json +1 -1
- package/package.json +1 -1
package/bin/bootstrap.js
CHANGED
|
@@ -45,6 +45,14 @@ function writeBootstrapError(spec) {
|
|
|
45
45
|
} catch (_) {}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function clearBootstrapError() {
|
|
49
|
+
try {
|
|
50
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
51
|
+
const out = path.join(projectDir, '.gm', 'exec-spool', '.bootstrap-error.json');
|
|
52
|
+
fs.unlinkSync(out);
|
|
53
|
+
} catch (_) {}
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
function obsEvent(subsystem, event, fields) {
|
|
49
57
|
if (process.env.GM_LOG_DISABLE) return;
|
|
50
58
|
try {
|
|
@@ -384,8 +392,9 @@ async function bootstrap(opts) {
|
|
|
384
392
|
if (expectedSha) {
|
|
385
393
|
const actualSha = sha256OfFileSync(finalPath);
|
|
386
394
|
if (actualSha === expectedSha) {
|
|
387
|
-
|
|
395
|
+
obsEvent('bootstrap', 'decision.hit', { reason: 'sha-match', version, path: finalPath });
|
|
388
396
|
copyToGmTools(finalPath, wrapperDir, version);
|
|
397
|
+
clearBootstrapError();
|
|
389
398
|
return finalPath;
|
|
390
399
|
}
|
|
391
400
|
log(`decision: fetch reason: cache-hit-sha-mismatch (dir=v${version} expected ${expectedSha.slice(0,12)}… got ${(actualSha||'').slice(0,12)}…)`);
|
|
@@ -398,16 +407,18 @@ async function bootstrap(opts) {
|
|
|
398
407
|
try { fs.unlinkSync(finalPath); } catch (_) {}
|
|
399
408
|
try { fs.unlinkSync(okSentinel); } catch (_) {}
|
|
400
409
|
} else {
|
|
401
|
-
|
|
410
|
+
obsEvent('bootstrap', 'decision.hit', { reason: 'sentinel+no-sha-manifest', path: finalPath });
|
|
402
411
|
copyToGmTools(finalPath, wrapperDir, version);
|
|
412
|
+
clearBootstrapError();
|
|
403
413
|
return finalPath;
|
|
404
414
|
}
|
|
405
415
|
}
|
|
406
416
|
|
|
407
417
|
if (healIfShaMatches(finalPath, expectedSha, okSentinel, partialPath, 'plugkit')) {
|
|
408
|
-
|
|
418
|
+
obsEvent('bootstrap', 'decision.heal', { reason: 'sha-match', path: finalPath });
|
|
409
419
|
spawnDetachedRtkFetch(wrapperDir);
|
|
410
420
|
copyToGmTools(finalPath, wrapperDir, version);
|
|
421
|
+
clearBootstrapError();
|
|
411
422
|
return finalPath;
|
|
412
423
|
}
|
|
413
424
|
|
|
@@ -415,14 +426,16 @@ async function bootstrap(opts) {
|
|
|
415
426
|
acquireLock(lockPath);
|
|
416
427
|
try {
|
|
417
428
|
if (fs.existsSync(finalPath) && fs.existsSync(okSentinel)) {
|
|
418
|
-
|
|
429
|
+
obsEvent('bootstrap', 'decision.hit', { reason: 'lock-race-resolved', path: finalPath });
|
|
419
430
|
copyToGmTools(finalPath, wrapperDir, version);
|
|
431
|
+
clearBootstrapError();
|
|
420
432
|
return finalPath;
|
|
421
433
|
}
|
|
422
434
|
if (healIfShaMatches(finalPath, expectedSha, okSentinel, partialPath, 'plugkit')) {
|
|
423
|
-
|
|
435
|
+
obsEvent('bootstrap', 'decision.heal', { reason: 'sha-match-under-lock', path: finalPath });
|
|
424
436
|
spawnDetachedRtkFetch(wrapperDir);
|
|
425
437
|
copyToGmTools(finalPath, wrapperDir, version);
|
|
438
|
+
clearBootstrapError();
|
|
426
439
|
return finalPath;
|
|
427
440
|
}
|
|
428
441
|
|
|
@@ -484,6 +497,7 @@ async function bootstrap(opts) {
|
|
|
484
497
|
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
485
498
|
spawnDetachedRtkFetch(wrapperDir);
|
|
486
499
|
copyToGmTools(finalPath, wrapperDir, version);
|
|
500
|
+
clearBootstrapError();
|
|
487
501
|
return finalPath;
|
|
488
502
|
} finally {
|
|
489
503
|
releaseLock(lockPath);
|
package/gm.json
CHANGED