gm-plugkit 2.0.1526 → 2.0.1527

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1526",
3
+ "version": "2.0.1527",
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": {
@@ -3472,78 +3472,7 @@ async function runSpoolWatcher(instance, spoolDir) {
3472
3472
  applyUpdateCheckResult(installed, cached.latest, cached.status || 200);
3473
3473
  return;
3474
3474
  }
3475
- const req = https.get({
3476
- host: 'api.github.com',
3477
- path: '/repos/AnEntrypoint/plugkit-bin/releases/latest',
3478
- headers: { 'user-agent': 'plugkit-watcher', 'accept': 'application/json' },
3479
- timeout: 5000,
3480
- }, (res) => {
3481
- if (res.statusCode !== 200) {
3482
- res.resume();
3483
- writeSharedUpdateCache(null, res.statusCode);
3484
- applyUpdateCheckResult(installed, null, res.statusCode);
3485
- checkUpdateViaNpm(installed);
3486
- return;
3487
- }
3488
- const chunks = [];
3489
- res.on('data', c => chunks.push(c));
3490
- res.on('end', () => {
3491
- try {
3492
- const rel = JSON.parse(Buffer.concat(chunks).toString('utf-8'));
3493
- const tag = rel && rel.tag_name;
3494
- if (!tag) return;
3495
- const latest = tag.replace(/^v/, '');
3496
- writeSharedUpdateCache(latest, 200);
3497
- if (latest === installed) {
3498
- try { fs.unlinkSync(UPDATE_AVAILABLE_PATH); } catch (_) {}
3499
- if (_lastKnownDrift) {
3500
- logEvent('plugkit', 'update.cleared', { installed, was: _lastKnownDrift });
3501
- _lastKnownDrift = null;
3502
- }
3503
- return;
3504
- }
3505
- const update_url = `https://github.com/AnEntrypoint/plugkit-bin/releases/tag/v${latest}`;
3506
- fs.writeFileSync(UPDATE_AVAILABLE_PATH, JSON.stringify({
3507
- installed,
3508
- latest,
3509
- checked_at_ms: Date.now(),
3510
- instruction: 'plugkit is out of date. Update with: bun x gm-plugkit@latest --kill-stale-watchers; bun x gm-plugkit@latest spool. A fresh boot downloads the new wasm and respawns; an in-place running watcher does not self-download.',
3511
- update_url,
3512
- }, null, 2));
3513
- console.log(`[update] available: installed=${installed} latest=${latest} -> wrote ${UPDATE_AVAILABLE_PATH}`);
3514
- if (_lastKnownDrift !== latest) {
3515
- logEvent('plugkit', 'update.available', { installed, latest, update_url });
3516
- _lastKnownDrift = latest;
3517
- }
3518
- // NOTE: do NOT bump the disk version file here to "arm" a drift-respawn. installedVersionAtTools()
3519
- // reads that file as the source of truth for the installed version; bumping it ahead of the actual
3520
- // wasm download makes ensureReady compute versionDrift=false (file==target) and isReady()=true, so it
3521
- // returns already-ready WITHOUT downloading the new binary -- while the running instance is still the
3522
- // old version. The drift-check then sees instance(old) != file(new) forever and self-respawns in an
3523
- // infinite loop, each respawn reloading the same old wasm. The version file must only advance AFTER
3524
- // a verified binary download (bootstrap's job). Auto-update stays notify-only until ensureReady gains
3525
- // a sha-verified force-download path; see PRD watcher-autoupdate-thrash-fix.
3526
- } catch (e) {
3527
- logUpdateCheckError({ error: String(e && e.message || e) });
3528
- }
3529
- });
3530
- });
3531
- let _checkErrored = false;
3532
- req.on('timeout', () => {
3533
- if (_checkErrored) { try { req.destroy(); } catch (_) {} return; }
3534
- _checkErrored = true;
3535
- try { req.destroy(); } catch (_) {}
3536
- writeSharedUpdateCache(null, -1);
3537
- logUpdateCheckError({ error: 'timeout' });
3538
- checkUpdateViaNpm(installed);
3539
- });
3540
- req.on('error', (e) => {
3541
- if (_checkErrored) return;
3542
- _checkErrored = true;
3543
- writeSharedUpdateCache(null, -2);
3544
- logUpdateCheckError({ error: String(e && e.message || e) });
3545
- checkUpdateViaNpm(installed);
3546
- });
3475
+ checkUpdateViaNpm(installed);
3547
3476
  }
3548
3477
  setTimeout(checkForUpdate, 10_000);
3549
3478
  setInterval(checkForUpdate, UPDATE_CHECK_INTERVAL_MS);
@@ -3739,11 +3668,10 @@ async function selfHealFromGithubReleases() {
3739
3668
  });
3740
3669
  (async () => {
3741
3670
  try {
3742
- const rel = await fetchJson('https://api.github.com/repos/AnEntrypoint/plugkit-bin/releases/latest');
3743
- const tag = rel.tag_name;
3744
- if (!tag) throw new Error('no tag_name from GH Releases');
3745
- const version = tag.replace(/^v/, '');
3746
- const base = `https://github.com/AnEntrypoint/plugkit-bin/releases/download/${tag}`;
3671
+ const meta = await fetchJson('https://registry.npmjs.org/plugkit-wasm/latest');
3672
+ const version = meta && meta.version;
3673
+ if (!version) throw new Error('no version from npm plugkit-wasm');
3674
+ const base = `https://github.com/AnEntrypoint/plugkit-bin/releases/download/v${version}`;
3747
3675
  const [wasm, sha] = await Promise.all([
3748
3676
  fetchBuf(`${base}/plugkit.wasm`),
3749
3677
  fetchBuf(`${base}/plugkit.wasm.sha256`).then(b => b.toString('utf-8').trim().split(/\s+/)[0]).catch(() => ''),