gm-copilot-cli 2.0.215 → 2.0.217

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
3
- version: 2.0.215
3
+ version: 2.0.217
4
4
  description: State machine agent with hooks, skills, and automated git enforcement
5
5
  author: AnEntrypoint
6
6
  repository: https://github.com/AnEntrypoint/gm-copilot-cli
@@ -279,7 +279,9 @@ const run = () => {
279
279
  const langExts = { nodejs: 'mjs', typescript: 'ts', deno: 'ts', python: 'py', bash: 'sh', powershell: 'ps1', go: 'go', rust: 'rs', c: 'c', cpp: 'cpp', java: 'java' };
280
280
 
281
281
  const spawnDirect = (bin, args, stdin) => {
282
- const opts = { encoding: 'utf-8', timeout: 60000, windowsHide: true, ...(cwd && { cwd }), ...(stdin !== undefined && { input: stdin }) };
282
+ const isAb = lang === 'agent-browser';
283
+ const spawnCwd = cwd || (isAb ? process.cwd() : undefined);
284
+ const opts = { encoding: 'utf-8', timeout: 60000, windowsHide: true, ...(isAb && IS_WIN && { shell: true }), ...(spawnCwd && { cwd: spawnCwd }), ...(stdin !== undefined && { input: stdin }) };
283
285
  const r = spawnSync(bin, args, opts);
284
286
  if (!r.stdout && !r.stderr && r.error) return `[spawn error: ${r.error.message}]`;
285
287
  const out = (r.stdout || '').trimEnd(), err = stripFooter(r.stderr || '').trimEnd();
@@ -364,27 +366,12 @@ const run = () => {
364
366
  const wrapped = `const __result = await (async () => {\n${safeCode}\n})();\nif (__result !== undefined) { if (typeof __result === 'object') { console.log(JSON.stringify(__result, null, 2)); } else { console.log(__result); } }`;
365
367
  result = runWithFile(lang || 'nodejs', wrapped);
366
368
  } else if (lang === 'agent-browser') {
367
- const abBin = fs.existsSync(localBin('agent-browser')) ? localBin('agent-browser') : 'agent-browser';
369
+ // agent-browser reads agent-browser.json from cwd automatically (headed, profile, session, etc.)
370
+ // Just run with shell:true so .cmd wrappers resolve, and use process.cwd() so config is picked up
371
+ const abBin = 'agent-browser';
368
372
  const AB_CMDS = new Set(['open','goto','navigate','close','quit','exit','back','forward','reload','click','dblclick','type','fill','press','check','uncheck','select','drag','upload','hover','focus','scroll','scrollintoview','wait','screenshot','pdf','snapshot','get','is','find','eval','connect','tab','frame','dialog','state','session','network','cookies','storage','set','trace','profiler','record','console','errors','highlight','inspect','diff','keyboard','mouse','install','upgrade','confirm','deny','auth','device','window']);
369
373
  const AB_GLOBAL_FLAGS = new Set(['--cdp','--headed','--headless','--session','--session-name','--auto-connect','--profile','--allow-file-access','--color-scheme','-p','--platform','--device']);
370
374
  const AB_GLOBAL_FLAGS_WITH_VALUE = new Set(['--cdp','--session','--session-name','--profile','--color-scheme','-p','--platform','--device']);
371
- function loadAbProfile(dir) {
372
- if (!dir) return [];
373
- try {
374
- const cfg = JSON.parse(fs.readFileSync(path.join(dir, '.agent-browser.json'), 'utf8'));
375
- const flags = [];
376
- if (cfg.headed) flags.push('--headed');
377
- if (cfg.headless) flags.push('--headless');
378
- if (cfg.profile) flags.push('--profile', cfg.profile);
379
- if (cfg.cdp) flags.push('--cdp', String(cfg.cdp));
380
- if (cfg.platform || cfg.p) flags.push('-p', cfg.platform || cfg.p);
381
- if (cfg.device) flags.push('--device', cfg.device);
382
- if (cfg['allow-file-access']) flags.push('--allow-file-access');
383
- if (cfg['color-scheme']) flags.push('--color-scheme', cfg['color-scheme']);
384
- return flags;
385
- } catch { return []; }
386
- }
387
- const abProfileFlags = loadAbProfile(projectDir || cwd || process.cwd());
388
375
  const AB_SESSION_STATE = path.join(os.tmpdir(), 'gm-ab-sessions.json');
389
376
  function readAbSessions() { try { return JSON.parse(fs.readFileSync(AB_SESSION_STATE, 'utf8')); } catch { return {}; } }
390
377
  function writeAbSessions(s) { try { fs.writeFileSync(AB_SESSION_STATE, JSON.stringify(s)); } catch {} }
@@ -413,21 +400,11 @@ const run = () => {
413
400
  if (isClose) delete sessions[sessionName];
414
401
  writeAbSessions(sessions);
415
402
  const openSessions = Object.entries(sessions);
416
- function mergeProfileFlags(userGlobalArgs) {
417
- const userFlagSet = new Set(userGlobalArgs.filter(f => f.startsWith('-')));
418
- const filtered = [];
419
- for (let i = 0; i < abProfileFlags.length; i++) {
420
- const f = abProfileFlags[i];
421
- if (f.startsWith('-') && userFlagSet.has(f)) { if (AB_GLOBAL_FLAGS_WITH_VALUE.has(f)) i++; continue; }
422
- filtered.push(f);
423
- }
424
- return [...filtered, ...userGlobalArgs];
425
- }
426
403
  if (AB_CMDS.has(firstWord)) {
427
404
  const lines = safeCode.split('\n').map(l => l.trim()).filter(Boolean);
428
405
  if (lines.length === 1) {
429
406
  const { globalArgs, rest } = parseAbLine(lines[0]);
430
- result = spawnDirect(abBin, [...mergeProfileFlags(globalArgs), ...rest]);
407
+ result = spawnDirect(abBin, [...globalArgs, ...rest]);
431
408
  } else {
432
409
  const hasClose = lines.some(l => { const w = (parseAbLine(l).rest[0]||'').toLowerCase(); return ['close','quit','exit'].includes(w); });
433
410
  const cmds = lines.map(l => {
@@ -435,15 +412,15 @@ const run = () => {
435
412
  const w = (rest[0]||'').toLowerCase();
436
413
  if (['open','goto','navigate'].includes(w)) sessions[sessionName] = { url: rest[1]||'?', ts: Date.now() };
437
414
  if (['close','quit','exit'].includes(w)) delete sessions[sessionName];
438
- if (!AB_CMDS.has(w)) return [...mergeProfileFlags(globalArgs), 'eval', l.trim()];
439
- return [...mergeProfileFlags(globalArgs), ...rest];
415
+ if (!AB_CMDS.has(w)) return [...globalArgs, 'eval', l.trim()];
416
+ return [...globalArgs, ...rest];
440
417
  });
441
418
  writeAbSessions(sessions);
442
419
  result = spawnDirect(abBin, ['batch'], JSON.stringify(cmds));
443
420
  if (!hasClose && openSessions.length > 0) result += `\n\n[tab] Browser session "${sessionName}" still open. Close when done:\n exec:agent-browser\n close`;
444
421
  }
445
422
  } else {
446
- result = spawnDirect(abBin, [...abProfileFlags, 'eval', '--stdin'], safeCode);
423
+ result = spawnDirect(abBin, ['eval', '--stdin'], safeCode);
447
424
  }
448
425
  if (openSessions.length > 1) {
449
426
  const stale = openSessions.filter(([n]) => n !== sessionName).map(([n,v]) => ` "${n}" → ${v.url} (${Math.round((Date.now()-v.ts)/60000)}min ago)`).join('\n');
package/index.html CHANGED
@@ -18,7 +18,7 @@
18
18
  <script type="module">
19
19
  import { createElement as h, applyDiff, Fragment } from "webjsx";
20
20
  const PLATFORM_NAME="Copilot CLI",PLATFORM_TYPE="CLI Tool",PLATFORM_TYPE_COLOR="#3b82f6";
21
- const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.215";
21
+ const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.217";
22
22
  const GITHUB_URL="https://github.com/AnEntrypoint/gm-copilot-cli",BADGE_LABEL="copilot-cli";
23
23
  const FEATURES=[{"title":"State Machine","desc":"Immutable PLAN→EXECUTE→EMIT→VERIFY→COMPLETE phases with full mutable tracking"},{"title":"Semantic Search","desc":"Natural language codebase exploration via codesearch skill — no grep needed"},{"title":"Hooks","desc":"Pre-tool, session-start, prompt-submit, and stop hooks for full lifecycle control"},{"title":"Agents","desc":"gm, codesearch, and websearch agents pre-configured and ready to use"},{"title":"MCP Integration","desc":"Model Context Protocol server support built in"},{"title":"Auto-Recovery","desc":"Supervisor hierarchy ensures the system never crashes"}],INSTALL_STEPS=[{"desc":"Install via GitHub CLI","cmd":"gh extension install AnEntrypoint/gm-copilot-cli"},{"desc":"Restart your terminal — activates automatically"}];
24
24
  const CURRENT_PLATFORM="gm-copilot-cli";
package/manifest.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: gm
2
- version: 2.0.215
2
+ version: 2.0.217
3
3
  description: State machine agent with hooks, skills, and automated git enforcement
4
4
  author: AnEntrypoint
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-copilot-cli",
3
- "version": "2.0.215",
3
+ "version": "2.0.217",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/tools.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.215",
3
+ "version": "2.0.217",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "tools": [
6
6
  {