gm-plugkit 2.0.1268 → 2.0.1269

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.1268",
3
+ "version": "2.0.1269",
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": {
@@ -420,9 +420,10 @@ function writeJsonFile(fp, value) {
420
420
  try { fs.writeFileSync(fp, JSON.stringify(value, null, 2)); } catch (_) {}
421
421
  }
422
422
 
423
- function msPlaywrightCacheRoots() {
423
+ function bundledBrowserCacheRoots() {
424
424
  const roots = [];
425
- if (process.env.PLAYWRIGHT_BROWSERS_PATH) roots.push(process.env.PLAYWRIGHT_BROWSERS_PATH);
425
+ const envOverride = process.env.PLAYWRIGHT_BROWSERS_PATH;
426
+ if (envOverride) roots.push(envOverride);
426
427
  if (process.platform === 'win32') {
427
428
  if (process.env.LOCALAPPDATA) roots.push(path.join(process.env.LOCALAPPDATA, 'ms-playwright'));
428
429
  } else if (process.platform === 'darwin') {
@@ -457,7 +458,7 @@ function chromiumExeFromCacheRoot(root) {
457
458
  }
458
459
 
459
460
  function findBundledChromium() {
460
- for (const root of msPlaywrightCacheRoots()) {
461
+ for (const root of bundledBrowserCacheRoots()) {
461
462
  const exe = chromiumExeFromCacheRoot(root);
462
463
  if (exe) return exe;
463
464
  }
@@ -465,9 +466,9 @@ function findBundledChromium() {
465
466
  const npmR = spawnSync('npm', ['root', '-g'], { encoding: 'utf-8', shell: true, windowsHide: true, timeout: 5000 });
466
467
  if (npmR.status === 0 && npmR.stdout.trim()) {
467
468
  const root = npmR.stdout.trim().split(/\r?\n/).pop();
468
- const pwBrowsers = path.join(root, 'playwriter', 'node_modules', '@xmorse', 'playwright-core', '.local-browsers');
469
- if (fs.existsSync(pwBrowsers)) {
470
- const exe = chromiumExeFromCacheRoot(pwBrowsers);
469
+ const localBrowsers = path.join(root, 'playwriter', 'node_modules', '@xmorse', 'playwright-core', '.local-browsers');
470
+ if (fs.existsSync(localBrowsers)) {
471
+ const exe = chromiumExeFromCacheRoot(localBrowsers);
471
472
  if (exe) return exe;
472
473
  }
473
474
  }
@@ -478,18 +479,18 @@ function findBundledChromium() {
478
479
  function ensureBundledChromium(pw) {
479
480
  const existing = findBundledChromium();
480
481
  if (existing) return { exe: existing, installed: false };
481
- const installer = pw && pw.cmd
482
- ? { cmd: pw.cmd, args: [...pw.baseArgs, 'install', 'chromium'], shell: pw.shell }
483
- : { cmd: 'npx', args: ['-y', 'playwright', 'install', 'chromium'], shell: true };
484
- logEvent('bootstrap', 'browser.chromium-install.start', { via: installer.cmd });
482
+ if (!pw || !pw.cmd) {
483
+ return { exe: null, installed: false, error: 'playwriter not available to install browser' };
484
+ }
485
+ const installer = { cmd: pw.cmd, args: [...pw.baseArgs, 'install', 'chromium'], shell: pw.shell };
486
+ logEvent('bootstrap', 'browser.bundled-install.start', { via: 'playwriter' });
485
487
  const r = spawnSync(installer.cmd, installer.args, {
486
488
  encoding: 'utf-8',
487
489
  timeout: 600000,
488
490
  shell: installer.shell,
489
491
  windowsHide: true,
490
- env: { ...process.env, PLAYWRIGHT_BROWSERS_PATH: process.env.PLAYWRIGHT_BROWSERS_PATH || '' },
491
492
  });
492
- logEvent('bootstrap', 'browser.chromium-install.done', { status: r.status });
493
+ logEvent('bootstrap', 'browser.bundled-install.done', { status: r.status });
493
494
  const after = findBundledChromium();
494
495
  if (after) return { exe: after, installed: true };
495
496
  return { exe: null, installed: false, error: r.stderr || r.stdout || 'install failed' };
@@ -753,7 +754,7 @@ function getOrCreateBrowserSession(cwd, claudeSessionId, pw) {
753
754
  if (ensured.exe) chrome = ensured.exe;
754
755
  }
755
756
  if (!chrome) chrome = findChrome();
756
- if (!chrome) throw new Error('No chromium binary available. Run: npx playwright install chromium');
757
+ if (!chrome) throw new Error('No chromium binary available. Run: bun x playwriter@latest install chromium');
757
758
  const profileDir = acquireProfileDir(cwd);
758
759
  const port = findFreePortSync();
759
760
  const chromeArgs = [