Commit Graph

3 Commits

Author SHA1 Message Date
Egutierrez 91973ed6f9 feat(browser_list): añade campo headless por master
browser_list ahora reporta si cada Chromium master se lanzo en modo headless,
detectado por el flag de arranque (--headless / --headless=new / --headless=old)
leido del cmdline. Una sola llamada devuelve navegadores activos + CDP + headless,
sin tener que conectar a cada pagina para fingerprintear.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 20:05:51 +02:00
Egutierrez c2470f4f67 fix(browser_list): parse cmdline colapsado por espacios de Chromium
/proc/<pid>/cmdline normalmente separa argv por NUL, pero Chromium reescribe
su titulo de proceso in-place colapsando la region de argv a una sola cadena
separada por espacios. readProcCmdline asumia solo NUL, asi que para los
masters de Chromium devolvia un unico argv[0] gigante: isChromiumExe y el
prefijo --user-data-dir= fallaban y browser_list devolvia [] aunque hubiera
navegadores vivos.

Extrae parseCmdline (pura, testeable) con fallback a split por espacios cuando
no hay NUL. Test cubre ambos formatos + regresion de deteccion de master.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 20:02:27 +02:00
egutierrez 1fae6c1df9 feat(browser_mcp): add browser_list/launch_profile/close lifecycle tools
Three MCP tools to manage the user's Chromium instances by profile, distinct
from browser_launch's isolated automation Chrome:

- browser_list: enumerate running Chromium master processes by scanning
  /proc/*/cmdline (has --user-data-dir, no --type=). Returns pid, profile,
  user_data_dir, cdp_port, has_cdp as a JSON array.
- browser_launch_profile: launch a concrete profile using the REAL binary
  /usr/lib/chromium/chromium (bypassing the /usr/bin/chromium wrapper). No CDP
  by default so Google keeps the session for human profiles; cdp=true adds
  --remote-debugging-port + --remote-allow-origins=*. Detects DISPLAY/XAUTHORITY
  from the XFCE session and launches decoupled via setsid.
- browser_close: locate a master by profile/cdp_port/pid, SIGTERM with a 10s
  wait, then SIGKILL as a last resort.

Per-profile instances are NOT registered in the connection pool: they are
user-facing and survive the MCP dying; cleanup is explicit via browser_close.

Unit tests for cmdline master detection, flag parsing, and close-target
matching. Bumps version 0.6.0 -> 0.7.0 (42 -> 45 tools).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 18:23:45 +02:00