gm-codex 2.0.952 → 2.0.954
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/.codex-plugin/plugin.json +1 -1
- package/bin/bootstrap.js +35 -22
- package/gm.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
package/bin/bootstrap.js
CHANGED
|
@@ -299,7 +299,7 @@ function pruneOldVersions(root, keepVersion, keepRtkVersion) {
|
|
|
299
299
|
if (fs.existsSync(lock) && !isLockStale(lock)) continue;
|
|
300
300
|
if (fs.existsSync(lock)) { try { fs.unlinkSync(lock); } catch (_) {} }
|
|
301
301
|
try {
|
|
302
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
302
|
+
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 1, retryDelay: 50 });
|
|
303
303
|
log(`pruned ${dir}`);
|
|
304
304
|
} catch (err) { log(`prune skip ${dir}: ${err.message}`); }
|
|
305
305
|
}
|
|
@@ -327,15 +327,15 @@ async function bootstrap(opts) {
|
|
|
327
327
|
|
|
328
328
|
if (fs.existsSync(finalPath) && fs.existsSync(okSentinel)) {
|
|
329
329
|
if (!opts.silent) log(`cache hit: ${finalPath}`);
|
|
330
|
-
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
331
330
|
proactiveKillForNewInstall(version, finalPath);
|
|
331
|
+
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
332
332
|
return finalPath;
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
if (healIfShaMatches(finalPath, expectedSha, okSentinel, partialPath, 'plugkit')) {
|
|
336
336
|
if (!opts.silent) log(`cache heal (sha match): ${finalPath}`);
|
|
337
|
-
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
338
337
|
proactiveKillForNewInstall(version, finalPath);
|
|
338
|
+
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
339
339
|
try { await bootstrapRtk(verDir, version, wrapperDir, opts.silent, root); }
|
|
340
340
|
catch (err) { log(`rtk fetch skipped: ${err.message}`); }
|
|
341
341
|
return finalPath;
|
|
@@ -345,14 +345,14 @@ async function bootstrap(opts) {
|
|
|
345
345
|
acquireLock(lockPath);
|
|
346
346
|
try {
|
|
347
347
|
if (fs.existsSync(finalPath) && fs.existsSync(okSentinel)) {
|
|
348
|
-
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
349
348
|
proactiveKillForNewInstall(version, finalPath);
|
|
349
|
+
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
350
350
|
return finalPath;
|
|
351
351
|
}
|
|
352
352
|
if (healIfShaMatches(finalPath, expectedSha, okSentinel, partialPath, 'plugkit')) {
|
|
353
353
|
log(`cache heal (sha match) under lock: ${finalPath}`);
|
|
354
|
-
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
355
354
|
proactiveKillForNewInstall(version, finalPath);
|
|
355
|
+
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
356
356
|
try { await bootstrapRtk(verDir, version, wrapperDir, opts.silent, root); }
|
|
357
357
|
catch (err) { log(`rtk fetch skipped: ${err.message}`); }
|
|
358
358
|
return finalPath;
|
|
@@ -396,8 +396,8 @@ async function bootstrap(opts) {
|
|
|
396
396
|
fs.writeFileSync(okSentinel, new Date().toISOString());
|
|
397
397
|
log(`installed ${finalPath}`);
|
|
398
398
|
obsEvent('bootstrap', 'install.done', { path: finalPath, version, kind: 'plugkit' });
|
|
399
|
-
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
400
399
|
proactiveKillForNewInstall(version, finalPath);
|
|
400
|
+
pruneOldVersions(root, version, readRtkVersion(wrapperDir));
|
|
401
401
|
try { await bootstrapRtk(verDir, version, wrapperDir, opts.silent, root); }
|
|
402
402
|
catch (err) { log(`rtk fetch skipped: ${err.message}`); }
|
|
403
403
|
return finalPath;
|
|
@@ -519,7 +519,7 @@ function killPid(pid) {
|
|
|
519
519
|
if (os.platform() === 'win32' && pidAlive(pid)) {
|
|
520
520
|
try {
|
|
521
521
|
const { spawnSync } = require('child_process');
|
|
522
|
-
spawnSync('taskkill', ['/F', '/PID', String(pid)], { stdio: 'ignore', windowsHide: true });
|
|
522
|
+
spawnSync('taskkill', ['/F', '/PID', String(pid)], { stdio: 'ignore', windowsHide: true, timeout: 3000, killSignal: 'SIGKILL' });
|
|
523
523
|
} catch (_) {}
|
|
524
524
|
}
|
|
525
525
|
return true;
|
|
@@ -548,21 +548,34 @@ function listRunningPlugkitImagePaths() {
|
|
|
548
548
|
try {
|
|
549
549
|
const { spawnSync } = require('child_process');
|
|
550
550
|
if (os.platform() === 'win32') {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
551
|
+
let parsed = null;
|
|
552
|
+
try {
|
|
553
|
+
const p = spawnSync('powershell', ['-NoProfile', '-NonInteractive', '-Command', "Get-Process plugkit* -ErrorAction SilentlyContinue | Select-Object Id,Path | ConvertTo-Json -Compress"], { windowsHide: true, encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL' });
|
|
554
|
+
const text = ((p && p.stdout) || '').trim();
|
|
555
|
+
if (text) {
|
|
556
|
+
const j = JSON.parse(text);
|
|
557
|
+
parsed = Array.isArray(j) ? j : [j];
|
|
558
|
+
}
|
|
559
|
+
} catch (_) {}
|
|
560
|
+
if (parsed) {
|
|
561
|
+
for (const item of parsed) {
|
|
562
|
+
if (!item) continue;
|
|
563
|
+
const pid = parseInt(item.Id, 10);
|
|
564
|
+
if (!Number.isFinite(pid)) continue;
|
|
565
|
+
out.push({ pid, path: (item.Path || '').trim() });
|
|
566
|
+
}
|
|
567
|
+
} else {
|
|
568
|
+
const r = spawnSync('tasklist', ['/FI', 'IMAGENAME eq plugkit*', '/FO', 'CSV', '/NH'], { windowsHide: true, encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL' });
|
|
569
|
+
const text = (r && r.stdout) || '';
|
|
570
|
+
const seen = new Set();
|
|
571
|
+
for (const line of text.split(/\r?\n/)) {
|
|
572
|
+
const m = line.match(/^"([^"]+)","(\d+)"/);
|
|
573
|
+
if (!m) continue;
|
|
574
|
+
const pid = parseInt(m[2], 10);
|
|
575
|
+
if (!Number.isFinite(pid) || seen.has(pid)) continue;
|
|
576
|
+
seen.add(pid);
|
|
577
|
+
out.push({ pid, path: '' });
|
|
578
|
+
}
|
|
566
579
|
}
|
|
567
580
|
} else if (os.platform() === 'linux') {
|
|
568
581
|
let entries = [];
|
package/gm.json
CHANGED
package/package.json
CHANGED