gm-skill 2.0.1335 → 2.0.1336

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1335",
3
+ "version": "2.0.1336",
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": {
@@ -2518,9 +2518,60 @@ async function runSpoolWatcher(instance, spoolDir) {
2518
2518
 
2519
2519
  const UPDATE_AVAILABLE_PATH = path.join(spoolDir, '.update-available.json');
2520
2520
  const UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1000;
2521
+ const UPDATE_CHECK_SHARED_CACHE = path.join(GM_TOOLS_ROOT, '.update-check-cache.json');
2522
+ const UPDATE_CHECK_CACHE_TTL_MS = 4 * 60 * 1000;
2521
2523
  let _lastKnownDrift = null;
2524
+ function readSharedUpdateCache() {
2525
+ try {
2526
+ const content = fs.readFileSync(UPDATE_CHECK_SHARED_CACHE, 'utf-8');
2527
+ const parsed = JSON.parse(content);
2528
+ if (parsed && parsed.ts && parsed.latest && (Date.now() - parsed.ts) < UPDATE_CHECK_CACHE_TTL_MS) {
2529
+ return parsed;
2530
+ }
2531
+ } catch (_) {}
2532
+ return null;
2533
+ }
2534
+ function writeSharedUpdateCache(latest, status) {
2535
+ try {
2536
+ fs.mkdirSync(path.dirname(UPDATE_CHECK_SHARED_CACHE), { recursive: true });
2537
+ const tmp = UPDATE_CHECK_SHARED_CACHE + '.tmp.' + process.pid;
2538
+ fs.writeFileSync(tmp, JSON.stringify({ ts: Date.now(), latest, status, by_pid: process.pid }));
2539
+ fs.renameSync(tmp, UPDATE_CHECK_SHARED_CACHE);
2540
+ } catch (_) {}
2541
+ }
2542
+ function applyUpdateCheckResult(installed, latest, statusCode) {
2543
+ if (statusCode !== 200) {
2544
+ logEvent('plugkit', 'update.check.error', { installed, status: statusCode });
2545
+ return;
2546
+ }
2547
+ if (!latest) return;
2548
+ if (latest === installed) {
2549
+ try { fs.unlinkSync(UPDATE_AVAILABLE_PATH); } catch (_) {}
2550
+ if (_lastKnownDrift) {
2551
+ logEvent('plugkit', 'update.cleared', { installed, was: _lastKnownDrift });
2552
+ _lastKnownDrift = null;
2553
+ }
2554
+ return;
2555
+ }
2556
+ const isDrift = latest !== installed;
2557
+ if (isDrift && _lastKnownDrift !== latest) {
2558
+ try {
2559
+ fs.writeFileSync(UPDATE_AVAILABLE_PATH, JSON.stringify({
2560
+ installed, latest, ts: Date.now(),
2561
+ update_url: `https://github.com/AnEntrypoint/plugkit-bin/releases/tag/v${latest}`,
2562
+ }));
2563
+ } catch (_) {}
2564
+ logEvent('plugkit', 'update.available', { installed, latest });
2565
+ _lastKnownDrift = latest;
2566
+ }
2567
+ }
2522
2568
  function checkForUpdate() {
2523
2569
  const installed = resolveVersion(instance);
2570
+ const cached = readSharedUpdateCache();
2571
+ if (cached) {
2572
+ applyUpdateCheckResult(installed, cached.latest, cached.status || 200);
2573
+ return;
2574
+ }
2524
2575
  const req = https.get({
2525
2576
  host: 'api.github.com',
2526
2577
  path: '/repos/AnEntrypoint/plugkit-bin/releases/latest',
@@ -2529,7 +2580,8 @@ async function runSpoolWatcher(instance, spoolDir) {
2529
2580
  }, (res) => {
2530
2581
  if (res.statusCode !== 200) {
2531
2582
  res.resume();
2532
- logEvent('plugkit', 'update.check.error', { installed, status: res.statusCode });
2583
+ writeSharedUpdateCache(null, res.statusCode);
2584
+ applyUpdateCheckResult(installed, null, res.statusCode);
2533
2585
  return;
2534
2586
  }
2535
2587
  const chunks = [];
@@ -2540,6 +2592,7 @@ async function runSpoolWatcher(instance, spoolDir) {
2540
2592
  const tag = rel && rel.tag_name;
2541
2593
  if (!tag) return;
2542
2594
  const latest = tag.replace(/^v/, '');
2595
+ writeSharedUpdateCache(latest, 200);
2543
2596
  if (latest === installed) {
2544
2597
  try { fs.unlinkSync(UPDATE_AVAILABLE_PATH); } catch (_) {}
2545
2598
  if (_lastKnownDrift) {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1335",
3
+ "version": "2.0.1336",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1335",
3
+ "version": "2.0.1336",
4
4
  "description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",