feat: add browser configuration tool and fix STDIO mode
- Add browser_configure tool to change headless/headed mode, viewport, and user agent during session - Fix STDIO entry point by preventing stdin close handlers in STDIO mode - Fix headed mode default behavior when DISPLAY is available on Linux - Add dynamic browser configuration update mechanism in Context class 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e846cd509c
commit
aa84278d36
5 changed files with 235 additions and 12 deletions
|
|
@ -59,7 +59,6 @@ program
|
|||
.addOption(new Option('--loop-tools', 'Run loop tools').hideHelp())
|
||||
.addOption(new Option('--vision', 'Legacy option, use --caps=vision instead').hideHelp())
|
||||
.action(async options => {
|
||||
const abortController = setupExitWatchdog();
|
||||
|
||||
if (options.vision) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
@ -67,6 +66,7 @@ program
|
|||
options.caps = 'vision';
|
||||
}
|
||||
const config = await resolveCLIConfig(options);
|
||||
const abortController = setupExitWatchdog(config.server);
|
||||
|
||||
if (options.extension) {
|
||||
await runWithExtension(config, abortController);
|
||||
|
|
@ -90,7 +90,7 @@ program
|
|||
}
|
||||
});
|
||||
|
||||
function setupExitWatchdog() {
|
||||
function setupExitWatchdog(serverConfig: { host?: string; port?: number }) {
|
||||
const abortController = new AbortController();
|
||||
|
||||
let isExiting = false;
|
||||
|
|
@ -104,7 +104,9 @@ function setupExitWatchdog() {
|
|||
process.exit(0);
|
||||
};
|
||||
|
||||
process.stdin.on('close', handleExit);
|
||||
if (serverConfig.port !== undefined) {
|
||||
process.stdin.on('close', handleExit);
|
||||
}
|
||||
process.on('SIGINT', handleExit);
|
||||
process.on('SIGTERM', handleExit);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue