fix(browser): harden CDP readiness

This commit is contained in:
Peter Steinberger
2026-01-01 16:15:12 +00:00
parent 9f704d7aa7
commit 538c1eb660
7 changed files with 269 additions and 27 deletions

View File

@@ -4,6 +4,7 @@ import {
browserCloseTab,
browserFocusTab,
browserOpenTab,
browserResetProfile,
browserStart,
browserStatus,
browserStop,
@@ -87,6 +88,32 @@ export function registerBrowserManageCommands(
}
});
browser
.command("reset-profile")
.description("Reset clawd browser profile (moves it to Trash)")
.action(async (_opts, cmd) => {
const parent = parentOpts(cmd);
const baseUrl = resolveBrowserControlUrl(parent?.url);
try {
const result = await browserResetProfile(baseUrl);
if (parent?.json) {
defaultRuntime.log(JSON.stringify(result, null, 2));
return;
}
if (!result.moved) {
defaultRuntime.log(info("🦞 clawd browser profile already missing."));
return;
}
const dest = result.to ?? result.from;
defaultRuntime.log(
info(`🦞 clawd browser profile moved to Trash (${dest})`),
);
} catch (err) {
defaultRuntime.error(danger(String(err)));
defaultRuntime.exit(1);
}
});
browser
.command("tabs")
.description("List open tabs")