gm-skill 2.0.1270 → 2.0.1272

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/README.md CHANGED
@@ -35,7 +35,7 @@ An earlier generation fanned out fifteen per-platform downstream repos (gm-cc, g
35
35
 
36
36
  ## Version
37
37
 
38
- `2.0.1270` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1272` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
39
39
 
40
40
  ## Source of truth
41
41
 
@@ -1 +1 @@
1
- 0.1.468
1
+ 0.1.469
package/bin/plugkit.wasm CHANGED
Binary file
@@ -1 +1 @@
1
- 89f0141b6e50ced98a5216b7ed553da3f529bac96f6d9e2927a1ed1737223d62 plugkit.wasm
1
+ 9067bff0bc3048f8f49179b62920b87eca4cc67dd6d339491f42b7c47e44f93f plugkit.wasm
@@ -616,14 +616,66 @@ function scrubBrowserRunnerText(s) {
616
616
  return t;
617
617
  }
618
618
 
619
+ function findInstalledChromiumBinary() {
620
+ try {
621
+ if (process.env.PLAYWRITER_BROWSER_PATH && fs.existsSync(process.env.PLAYWRITER_BROWSER_PATH)) {
622
+ return process.env.PLAYWRITER_BROWSER_PATH;
623
+ }
624
+ const roots = [];
625
+ if (process.platform === 'win32') {
626
+ const lad = process.env.LOCALAPPDATA;
627
+ if (lad) roots.push(path.join(lad, 'ms-playwright'));
628
+ } else {
629
+ const home = process.env.HOME || '';
630
+ if (home) {
631
+ roots.push(path.join(home, '.cache', 'ms-playwright'));
632
+ roots.push(path.join(home, 'Library', 'Caches', 'ms-playwright'));
633
+ }
634
+ }
635
+ const exeName = process.platform === 'win32' ? 'chrome.exe' : (process.platform === 'darwin' ? 'Chromium.app/Contents/MacOS/Chromium' : 'chrome');
636
+ const subdirs = process.platform === 'win32'
637
+ ? ['chrome-win64', 'chrome-win']
638
+ : process.platform === 'darwin' ? ['chrome-mac'] : ['chrome-linux'];
639
+ const found = [];
640
+ for (const root of roots) {
641
+ if (!fs.existsSync(root)) continue;
642
+ for (const name of fs.readdirSync(root)) {
643
+ if (!/^chromium-\d+$/.test(name)) continue;
644
+ for (const sub of subdirs) {
645
+ const candidate = path.join(root, name, sub, exeName);
646
+ if (fs.existsSync(candidate)) {
647
+ const ver = parseInt(name.split('-')[1], 10) || 0;
648
+ found.push({ ver, candidate });
649
+ }
650
+ }
651
+ }
652
+ }
653
+ if (found.length === 0) return null;
654
+ found.sort((a, b) => b.ver - a.ver);
655
+ return found[0].candidate;
656
+ } catch (_) {
657
+ return null;
658
+ }
659
+ }
660
+
619
661
  function startManagedBrowser(pw, profileDir) {
620
662
  const args = [...pw.baseArgs, 'browser', 'start', '--user-data-dir', profileDir, '--headless'];
663
+ const env = { ...process.env };
664
+ if (!env.PLAYWRITER_BROWSER_PATH) {
665
+ const browserBin = findInstalledChromiumBinary();
666
+ if (browserBin) {
667
+ env.PLAYWRITER_BROWSER_PATH = browserBin;
668
+ logEvent('plugkit', 'browser.binary-resolved', { path: browserBin });
669
+ } else {
670
+ logEvent('plugkit', 'browser.binary-missing', {});
671
+ }
672
+ }
621
673
  const child = spawn(pw.cmd, args, {
622
674
  detached: true,
623
675
  stdio: 'ignore',
624
676
  shell: pw.shell,
625
677
  windowsHide: true,
626
- env: process.env,
678
+ env,
627
679
  ...(process.platform === 'win32' ? { creationFlags: 0x08000000 | 0x00000008 } : {}),
628
680
  });
629
681
  const pid = child.pid;
@@ -631,17 +683,54 @@ function startManagedBrowser(pw, profileDir) {
631
683
  return pid;
632
684
  }
633
685
 
634
- function waitForExtensionReady(pw, timeoutMs) {
635
- const deadline = Date.now() + (timeoutMs || 30000);
686
+ function isColdRunProfile(profileDir) {
687
+ try {
688
+ if (!fs.existsSync(profileDir)) return true;
689
+ const entries = fs.readdirSync(profileDir);
690
+ if (entries.length === 0) return true;
691
+ if (!entries.some(n => n === 'Default' || n === 'Local State')) return true;
692
+ return false;
693
+ } catch (_) {
694
+ return true;
695
+ }
696
+ }
697
+
698
+ function waitForExtensionReady(pw, profileDir, opts) {
699
+ const cold = (opts && typeof opts.cold === 'boolean') ? opts.cold : isColdRunProfile(profileDir);
700
+ const timeoutMs = (opts && opts.timeoutMs) || (cold ? 180000 : 30000);
701
+ const start = Date.now();
702
+ const deadline = start + timeoutMs;
703
+ const backoff = [2000, 4000, 8000];
704
+ let attempt = 0;
636
705
  let lastErr = '';
706
+ let lastProgressAt = start;
637
707
  while (Date.now() < deadline) {
638
- const r = runPlaywriter(pw, ['session', 'new'], 15000);
639
- if (r.status === 0) return r;
640
- lastErr = scrubBrowserRunnerText(r.stderr || r.stdout || '');
641
- sleepSync(500);
708
+ const remaining = deadline - Date.now();
709
+ const innerTimeout = Math.max(28000, Math.min(remaining, 30000));
710
+ const r = runPlaywriter(pw, ['session', 'new'], innerTimeout);
711
+ if (r && r.status === 0) return r;
712
+ lastErr = scrubBrowserRunnerText((r && (r.stderr || r.stdout)) || '');
713
+ const now = Date.now();
714
+ if (now - lastProgressAt >= 10000) {
715
+ logEvent('plugkit', 'browser.extension-wait', {
716
+ elapsed_ms: now - start,
717
+ cold_run: cold,
718
+ profileDir,
719
+ attempt,
720
+ });
721
+ lastProgressAt = now;
722
+ }
723
+ const sleepMs = backoff[Math.min(attempt, backoff.length - 1)];
724
+ attempt++;
725
+ if (Date.now() + sleepMs >= deadline) break;
726
+ sleepSync(sleepMs);
642
727
  }
643
- const err = new Error(`managed browser session start failed: ${lastErr || 'timeout waiting for extension'}`);
728
+ const flavor = cold
729
+ ? `cold-run timeout after ${Math.round((Date.now() - start) / 1000)}s waiting for managed browser extension to connect (first run downloads chromium ~150MB and installs the extension; if this persists the extension never registered with the relay server)`
730
+ : `warm-run timeout after ${Math.round((Date.now() - start) / 1000)}s waiting for managed browser extension to reconnect (profile exists but extension is not registering; relay server may be wedged)`;
731
+ const err = new Error(`managed browser session start failed: ${flavor}${lastErr ? ` :: ${lastErr}` : ''}`);
644
732
  err._lastErr = lastErr;
733
+ err._coldRun = cold;
645
734
  throw err;
646
735
  }
647
736
 
@@ -675,9 +764,12 @@ function getOrCreateBrowserSession(cwd, claudeSessionId, pw) {
675
764
  }
676
765
  }
677
766
  cleanDeadProfileFragments(cwd);
767
+ const probedProfile = path.join(cwd, '.gm', 'browser-profile');
768
+ const coldRun = isColdRunProfile(probedProfile);
678
769
  const profileDir = acquireProfileDir(cwd);
770
+ logEvent('plugkit', 'browser.start', { profileDir, cold_run: coldRun });
679
771
  const browserPid = startManagedBrowser(pw, profileDir);
680
- const newR = waitForExtensionReady(pw, 30000);
772
+ const newR = waitForExtensionReady(pw, profileDir, { cold: coldRun });
681
773
  const stripAnsi = (s) => s.replace(/\x1b\[[0-9;]*m/g, '');
682
774
  const out = stripAnsi(newR.stdout || '').trim();
683
775
  let pwSessionId = null;
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1270",
3
+ "version": "2.0.1272",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.468"
20
+ "plugkitVersion": "0.1.469"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1270",
3
+ "version": "2.0.1272",
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",
@@ -39,7 +39,7 @@
39
39
  "gm.json"
40
40
  ],
41
41
  "dependencies": {
42
- "gm-plugkit": "^2.0.1270"
42
+ "gm-plugkit": "^2.0.1272"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"