gm-skill 2.0.1266 → 2.0.1268

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.1266` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1268` — 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.467
1
+ 0.1.468
package/bin/plugkit.wasm CHANGED
Binary file
@@ -1 +1 @@
1
- 21a0c7b54788cec3dc35cbc00c4847ced155a2c8336b0c01d0987d2cc2247f06 plugkit.wasm
1
+ 89f0141b6e50ced98a5216b7ed553da3f529bac96f6d9e2927a1ed1737223d62 plugkit.wasm
@@ -420,7 +420,84 @@ function writeJsonFile(fp, value) {
420
420
  try { fs.writeFileSync(fp, JSON.stringify(value, null, 2)); } catch (_) {}
421
421
  }
422
422
 
423
+ function msPlaywrightCacheRoots() {
424
+ const roots = [];
425
+ if (process.env.PLAYWRIGHT_BROWSERS_PATH) roots.push(process.env.PLAYWRIGHT_BROWSERS_PATH);
426
+ if (process.platform === 'win32') {
427
+ if (process.env.LOCALAPPDATA) roots.push(path.join(process.env.LOCALAPPDATA, 'ms-playwright'));
428
+ } else if (process.platform === 'darwin') {
429
+ if (process.env.HOME) roots.push(path.join(process.env.HOME, 'Library', 'Caches', 'ms-playwright'));
430
+ } else {
431
+ if (process.env.HOME) roots.push(path.join(process.env.HOME, '.cache', 'ms-playwright'));
432
+ }
433
+ return roots.filter(r => r && fs.existsSync(r));
434
+ }
435
+
436
+ function chromiumExeFromCacheRoot(root) {
437
+ try {
438
+ const entries = fs.readdirSync(root)
439
+ .filter(n => /^chromium-\d+$/.test(n))
440
+ .sort((a, b) => parseInt(b.split('-')[1], 10) - parseInt(a.split('-')[1], 10));
441
+ const subdirs = process.platform === 'win32'
442
+ ? ['chrome-win64', 'chrome-win']
443
+ : process.platform === 'darwin'
444
+ ? ['chrome-mac/Chromium.app/Contents/MacOS/Chromium']
445
+ : ['chrome-linux'];
446
+ const exeName = process.platform === 'win32' ? 'chrome.exe'
447
+ : process.platform === 'darwin' ? null
448
+ : 'chrome';
449
+ for (const e of entries) {
450
+ for (const sub of subdirs) {
451
+ const p = exeName ? path.join(root, e, sub, exeName) : path.join(root, e, sub);
452
+ if (fs.existsSync(p)) return p;
453
+ }
454
+ }
455
+ } catch (_) {}
456
+ return null;
457
+ }
458
+
459
+ function findBundledChromium() {
460
+ for (const root of msPlaywrightCacheRoots()) {
461
+ const exe = chromiumExeFromCacheRoot(root);
462
+ if (exe) return exe;
463
+ }
464
+ try {
465
+ const npmR = spawnSync('npm', ['root', '-g'], { encoding: 'utf-8', shell: true, windowsHide: true, timeout: 5000 });
466
+ if (npmR.status === 0 && npmR.stdout.trim()) {
467
+ 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);
471
+ if (exe) return exe;
472
+ }
473
+ }
474
+ } catch (_) {}
475
+ return null;
476
+ }
477
+
478
+ function ensureBundledChromium(pw) {
479
+ const existing = findBundledChromium();
480
+ 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 });
485
+ const r = spawnSync(installer.cmd, installer.args, {
486
+ encoding: 'utf-8',
487
+ timeout: 600000,
488
+ shell: installer.shell,
489
+ windowsHide: true,
490
+ env: { ...process.env, PLAYWRIGHT_BROWSERS_PATH: process.env.PLAYWRIGHT_BROWSERS_PATH || '' },
491
+ });
492
+ logEvent('bootstrap', 'browser.chromium-install.done', { status: r.status });
493
+ const after = findBundledChromium();
494
+ if (after) return { exe: after, installed: true };
495
+ return { exe: null, installed: false, error: r.stderr || r.stdout || 'install failed' };
496
+ }
497
+
423
498
  function findChrome() {
499
+ const bundled = findBundledChromium();
500
+ if (bundled) return bundled;
424
501
  if (process.platform === 'win32') {
425
502
  const candidates = [
426
503
  path.join(process.env.PROGRAMFILES || 'C:\\Program Files', 'Google', 'Chrome', 'Application', 'chrome.exe'),
@@ -630,7 +707,7 @@ function runPlaywriter(pw, args, timeoutMs) {
630
707
  function scrubBrowserRunnerText(s) {
631
708
  if (!s || typeof s !== 'string') return s;
632
709
  let t = s;
633
- t = t.replace(/playwriter/gi, 'managed browser session');
710
+ t = t.replace(/(^|[^A-Za-z0-9_\\/.-])playwriter(?![A-Za-z0-9_\\/.-])/gi, (m, pre) => `${pre}managed browser session`);
634
711
  t = t.replace(/Click the[^.\n]*?extension[^.\n]*?icon[^.\n]*?\.?/gi, '');
635
712
  t = t.replace(/(connected\s+)?browser\s+extension(\s+is)?\s+not\s+connected\b[^.\n]*\.?/gi, '');
636
713
  t = t.replace(/no\s+connected\s+browsers?\b[^.\n]*\.?/gi, '');
@@ -670,8 +747,13 @@ function getOrCreateBrowserSession(cwd, claudeSessionId, pw) {
670
747
  }
671
748
  }
672
749
  cleanDeadProfileFragments(cwd);
673
- const chrome = findChrome();
674
- if (!chrome) throw new Error('Chrome not found. Please install Google Chrome.');
750
+ let chrome = findBundledChromium();
751
+ if (!chrome) {
752
+ const ensured = ensureBundledChromium(pw);
753
+ if (ensured.exe) chrome = ensured.exe;
754
+ }
755
+ if (!chrome) chrome = findChrome();
756
+ if (!chrome) throw new Error('No chromium binary available. Run: npx playwright install chromium');
675
757
  const profileDir = acquireProfileDir(cwd);
676
758
  const port = findFreePortSync();
677
759
  const chromeArgs = [
@@ -701,7 +783,7 @@ function getOrCreateBrowserSession(cwd, claudeSessionId, pw) {
701
783
  sleepSync(300);
702
784
  }
703
785
  if (!alive) throw new Error(`Chrome failed to open debug port ${port}`);
704
- const newR = runPlaywriter(pw, ['session', 'new', `--direct=localhost:${port}`], 30000);
786
+ const newR = runPlaywriter(pw, ['session', 'new', '--direct', `localhost:${port}`], 30000);
705
787
  if (newR.status !== 0) throw new Error(`managed browser session start failed: ${scrubBrowserRunnerText(newR.stderr || newR.stdout || 'unknown')}`);
706
788
  const stripAnsi = (s) => s.replace(/\x1b\[[0-9;]*m/g, '');
707
789
  const out = stripAnsi(newR.stdout || '').trim();
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1266",
3
+ "version": "2.0.1268",
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.467"
20
+ "plugkitVersion": "0.1.468"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1266",
3
+ "version": "2.0.1268",
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.1266"
42
+ "gm-plugkit": "^2.0.1268"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"
@@ -22,6 +22,6 @@ bun x gm-plugkit@latest spool > /dev/null 2>&1 &
22
22
 
23
23
  **Batch writes, waits, and reads together.** Each agent turn costs cycles; the dispatch shape `Write request → wait → Read response` is one logical step, not three. Issue all three in a single message — the Write tool call and the Read tool call go in the same `<function_calls>` block. The Read may return "file does not exist" if plugkit is mid-verb; that's fine, retry with one more Read in the next message rather than spreading the cycle across three turns. Fan-out is the same shape — dispatching three independent verbs (`prd-add g1`, `prd-add g2`, `prd-add g3`) means three Write tool calls in one block, then three Read tool calls in one block. Serial dispatch when you could be parallel is wasted cycles. The only sequencing constraint is real data dependency: if verb B needs the response of verb A, those go in separate turns; otherwise batch.
24
24
 
25
- Response body is not a mutation surface. Memory writes route through `memorize-fire` only — another verb YOU dispatch.
25
+ Response body is not a mutation surface. Memory writes route through `memorize-fire` only — another verb YOU dispatch. **Never** write persistent memory to platform-specific paths (`~/.claude/projects/*/memory/`, `~/.codex/memory/`, `~/.cursor/*`, etc.) — those don't transport between agent platforms and break the moment a session runs under a different harness. The only two portable surfaces are (a) dispatched `memorize-fire` (which writes through plugkit to the rs-learn store that travels with the project) and (b) `AGENTS.md` for project-tracked rules. If you reach for a `Write` tool on a memory directory under `~/`, stop — that's the lock-in anti-pattern.
26
26
 
27
27
  On turn entry (first `instruction` dispatch after a >30s idle gap or session-start), plugkit attaches an `auto_recall` pack to your `instruction` response: `{query, hits, fired_at, turn_entry: true}`. The query is derived from `.gm/last-prompt.txt` / `.gm/turn-state.json`; hits are the top recall results plugkit pulled before serving your instruction. Read `auto_recall.hits` alongside the existing `recall_hits` (which is the phase+PRD-subject pack) — both surface prior memory, but `auto_recall` is the per-turn user-prompt pack and only fires on turn entry. Subsequent `instruction` dispatches in the same turn carry no `auto_recall` field (or carry the same pack from the turn-start fire); do not re-trigger it manually.