gm-plugkit 2.0.1154 → 2.0.1155
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 +21 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1155",
|
|
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
|
@@ -871,6 +871,7 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
871
871
|
|
|
872
872
|
const UPDATE_AVAILABLE_PATH = path.join(spoolDir, '.update-available.json');
|
|
873
873
|
const UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1000;
|
|
874
|
+
let _lastKnownDrift = null;
|
|
874
875
|
function checkForUpdate() {
|
|
875
876
|
const installed = resolveVersion(instance);
|
|
876
877
|
const req = https.get({
|
|
@@ -879,7 +880,11 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
879
880
|
headers: { 'user-agent': 'plugkit-watcher', 'accept': 'application/json' },
|
|
880
881
|
timeout: 5000,
|
|
881
882
|
}, (res) => {
|
|
882
|
-
if (res.statusCode !== 200) {
|
|
883
|
+
if (res.statusCode !== 200) {
|
|
884
|
+
res.resume();
|
|
885
|
+
logEvent('plugkit', 'update.check.error', { installed, status: res.statusCode });
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
883
888
|
const chunks = [];
|
|
884
889
|
res.on('data', c => chunks.push(c));
|
|
885
890
|
res.on('end', () => {
|
|
@@ -890,21 +895,32 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
890
895
|
const latest = tag.replace(/^v/, '');
|
|
891
896
|
if (latest === installed) {
|
|
892
897
|
try { fs.unlinkSync(UPDATE_AVAILABLE_PATH); } catch (_) {}
|
|
898
|
+
if (_lastKnownDrift) {
|
|
899
|
+
logEvent('plugkit', 'update.cleared', { installed, was: _lastKnownDrift });
|
|
900
|
+
_lastKnownDrift = null;
|
|
901
|
+
}
|
|
893
902
|
return;
|
|
894
903
|
}
|
|
904
|
+
const update_url = `https://github.com/AnEntrypoint/plugkit-bin/releases/tag/v${latest}`;
|
|
895
905
|
fs.writeFileSync(UPDATE_AVAILABLE_PATH, JSON.stringify({
|
|
896
906
|
installed,
|
|
897
907
|
latest,
|
|
898
908
|
checked_at_ms: Date.now(),
|
|
899
909
|
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}.',
|
|
900
|
-
update_url
|
|
910
|
+
update_url,
|
|
901
911
|
}, null, 2));
|
|
902
912
|
console.log(`[update] available: installed=${installed} latest=${latest} → wrote ${UPDATE_AVAILABLE_PATH}`);
|
|
903
|
-
|
|
913
|
+
if (_lastKnownDrift !== latest) {
|
|
914
|
+
logEvent('plugkit', 'update.available', { installed, latest, update_url });
|
|
915
|
+
_lastKnownDrift = latest;
|
|
916
|
+
}
|
|
917
|
+
} catch (e) {
|
|
918
|
+
logEvent('plugkit', 'update.check.error', { error: String(e && e.message || e) });
|
|
919
|
+
}
|
|
904
920
|
});
|
|
905
921
|
});
|
|
906
|
-
req.on('timeout', () => req.destroy());
|
|
907
|
-
req.on('error', () => {});
|
|
922
|
+
req.on('timeout', () => { req.destroy(); logEvent('plugkit', 'update.check.error', { error: 'timeout' }); });
|
|
923
|
+
req.on('error', (e) => logEvent('plugkit', 'update.check.error', { error: String(e && e.message || e) }));
|
|
908
924
|
}
|
|
909
925
|
setTimeout(checkForUpdate, 10_000);
|
|
910
926
|
setInterval(checkForUpdate, UPDATE_CHECK_INTERVAL_MS);
|