gm-plugkit 2.0.1821 → 2.0.1823
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/package.json +1 -1
- package/plugkit-wasm-wrapper.js +29 -0
- package/plugkit.version +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1823",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/plugkit-wasm-wrapper.js
CHANGED
|
@@ -4397,6 +4397,35 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
4397
4397
|
} catch (_) {}
|
|
4398
4398
|
logEvent('plugkit', 'update.available', { installed, latest });
|
|
4399
4399
|
_lastKnownDrift = latest;
|
|
4400
|
+
selfRespawnOnUpdate(installed, latest);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
function selfRespawnOnUpdate(installed, latest) {
|
|
4404
|
+
const guardPath = path.join(GM_TOOLS_ROOT, '.wasm-update-respawn-guard.json');
|
|
4405
|
+
let guard = {};
|
|
4406
|
+
try { guard = JSON.parse(fs.readFileSync(guardPath, 'utf8')); } catch (_) {}
|
|
4407
|
+
const sameTarget = guard.last_latest === latest;
|
|
4408
|
+
const attempts = sameTarget ? (guard.attempts || 0) : 0;
|
|
4409
|
+
if (attempts >= 3) {
|
|
4410
|
+
logEvent('plugkit', 'update.auto-respawn-abandoned', { installed, latest, attempts, note: 'wasm-registry version keeps drifting after 3 self-respawn attempts; agent must run bun x gm-plugkit@latest spool manually' });
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
try {
|
|
4414
|
+
fs.writeFileSync(guardPath, JSON.stringify({ attempts: attempts + 1, last_latest: latest, ts: Date.now() }));
|
|
4415
|
+
} catch (_) {}
|
|
4416
|
+
logEvent('plugkit', 'update.auto-applying', { installed, latest, attempt: attempts + 1, note: 'plugkit-wasm registry drift; self-respawning via bun x gm-plugkit@latest spool' });
|
|
4417
|
+
try {
|
|
4418
|
+
const bunPath = process.env.GM_BUN_PATH || 'bun';
|
|
4419
|
+
const child = _childProcess.spawn(bunPath, ['x', 'gm-plugkit@latest', 'spool'], {
|
|
4420
|
+
cwd: process.cwd(),
|
|
4421
|
+
detached: true,
|
|
4422
|
+
stdio: 'ignore',
|
|
4423
|
+
windowsHide: true,
|
|
4424
|
+
env: { ...process.env, PLUGKIT_BOOT_REASON: 'self-respawn-from-wasm-registry-drift' },
|
|
4425
|
+
});
|
|
4426
|
+
child.unref();
|
|
4427
|
+
} catch (e) {
|
|
4428
|
+
logEvent('plugkit', 'update.auto-respawn-spawn-failed', { installed, latest, error: String(e && e.message || e) });
|
|
4400
4429
|
}
|
|
4401
4430
|
}
|
|
4402
4431
|
function checkUpdateViaNpm(installed) {
|
package/plugkit.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.835
|