gm-plugkit 2.0.1118 → 2.0.1119
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 +41 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1119",
|
|
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
|
@@ -2,6 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import crypto from 'crypto';
|
|
5
|
+
import https from 'https';
|
|
5
6
|
import { watch } from 'fs';
|
|
6
7
|
import { spawn, spawnSync } from 'child_process';
|
|
7
8
|
import net from 'net';
|
|
@@ -736,6 +737,46 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
736
737
|
setInterval(writeStatus, 5000);
|
|
737
738
|
writeStatus();
|
|
738
739
|
|
|
740
|
+
const UPDATE_AVAILABLE_PATH = path.join(spoolDir, '.update-available.json');
|
|
741
|
+
const UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1000;
|
|
742
|
+
function checkForUpdate() {
|
|
743
|
+
const installed = resolveVersion(instance);
|
|
744
|
+
const req = https.get({
|
|
745
|
+
host: 'api.github.com',
|
|
746
|
+
path: '/repos/AnEntrypoint/plugkit-bin/releases/latest',
|
|
747
|
+
headers: { 'user-agent': 'plugkit-watcher', 'accept': 'application/json' },
|
|
748
|
+
timeout: 5000,
|
|
749
|
+
}, (res) => {
|
|
750
|
+
if (res.statusCode !== 200) { res.resume(); return; }
|
|
751
|
+
const chunks = [];
|
|
752
|
+
res.on('data', c => chunks.push(c));
|
|
753
|
+
res.on('end', () => {
|
|
754
|
+
try {
|
|
755
|
+
const rel = JSON.parse(Buffer.concat(chunks).toString('utf-8'));
|
|
756
|
+
const tag = rel && rel.tag_name;
|
|
757
|
+
if (!tag) return;
|
|
758
|
+
const latest = tag.replace(/^v/, '');
|
|
759
|
+
if (latest === installed) {
|
|
760
|
+
try { fs.unlinkSync(UPDATE_AVAILABLE_PATH); } catch (_) {}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
fs.writeFileSync(UPDATE_AVAILABLE_PATH, JSON.stringify({
|
|
764
|
+
installed,
|
|
765
|
+
latest,
|
|
766
|
+
checked_at_ms: Date.now(),
|
|
767
|
+
instruction: 'plugkit is out of date. To update, close the running watcher and re-bootstrap with the @latest flag, e.g. node ~/.claude/gm-tools/plugkit-wasm-wrapper.js spool & after running bootstrap with {latest: true}.',
|
|
768
|
+
update_url: `https://github.com/AnEntrypoint/plugkit-bin/releases/tag/v${latest}`,
|
|
769
|
+
}, null, 2));
|
|
770
|
+
console.log(`[update] available: installed=${installed} latest=${latest} → wrote ${UPDATE_AVAILABLE_PATH}`);
|
|
771
|
+
} catch (_) {}
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
req.on('timeout', () => req.destroy());
|
|
775
|
+
req.on('error', () => {});
|
|
776
|
+
}
|
|
777
|
+
setTimeout(checkForUpdate, 10_000);
|
|
778
|
+
setInterval(checkForUpdate, UPDATE_CHECK_INTERVAL_MS);
|
|
779
|
+
|
|
739
780
|
const pollInterval = setInterval(async () => {
|
|
740
781
|
const existing = walkDir(inDir);
|
|
741
782
|
for (const fullPath of existing) {
|