feat(aistudio): add Google AI Studio browser automation adapter - #2288
Open
a179-sanae wants to merge 9 commits into
Open
feat(aistudio): add Google AI Studio browser automation adapter#2288a179-sanae wants to merge 9 commits into
a179-sanae wants to merge 9 commits into
Conversation
Browser-driven commands for Google AI Studio: ask (prompt with model/settings control), image (generation with local export), models, status, plus cookie-based login/whoami via the shared site-auth helper. Includes zh-CN DOM fixtures and unit tests. Synced from the runtime copy at ~/.opencli/clis/aistudio; text prompts default to gemini-3.7-flash.
…t, guard toggles - waitForAIStudioResponse: complete-but-empty shells and still-decoding images are exempt from the 45s stall detector, making the dedicated 60s empty-shell timeout reachable again; streamed thinking text counts as activity so long reasoning phases no longer trip the detector - empty-shell window restore is skipped in background window mode - ask: remove --new-chat, which could never continue a conversation (ephemeral site session + model selection always navigates to /prompts/new_chat); every ask is now explicitly a fresh chat - default text model configurable via OPENCLI_AISTUDIO_MODEL - image: validate --max-output-tokens as a positive integer - setAIStudioToggle: only issue the native CDP click when the synthesized click did not flip the switch; an unconditional retry double-toggled MDC switches on current AI Studio builds (found by live testing with the camelia profile) - dedupe run-settings label i18n maps; fix indentation and whitespace nits Verified live: status/models/ask (plain, run settings, env model override) and image generation with download; 88 adapter tests pass.
…mon readiness Introduce preferredContextId alongside the hard contextId pin: the daemon arbitrates the config-default profile against live connections (falls back when only one profile is live, errors when multiple are connected and the default is offline), so readiness never hangs on a stale default. Also allow adapters to restore a minimized window before native key input via Browser.getWindowForTarget/setWindowBounds and Page.bringToFront in the CDP allowlist, and expose Page.windowMode for adapter reads. Rebuild extension dist.
# Conflicts: # src/browser/bridge.ts # src/browser/daemon-client.test.ts # src/browser/daemon-client.ts # src/browser/daemon-transport.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a browser adapter for Google AI Studio to the built-in command set — upstreamed from a user-level adapter that has been running locally:
aistudio ask— text & image prompts with full Run settings (temperature, top-p, max tokens, system instruction, structured output, code execution, function calling, Google Search/Maps grounding, URL context, media resolution, stop sequences, safety settings), Markdown-preserving output via Copy-as-Markdownaistudio image— image generation with local savingaistudio models— live model picker discovery with category/availability filteringaistudio status/aistudio whoami/aistudio login— session state and Google login flow helpersImplementation notes:
Strategy.COOKIE,browser: true), reusing the existing daemon/session machineryRelated issue: none
Type of Change
Checklist
npx vitest run clis/aistudio/— 4 files, 96 tests passed, 200+ assertions)Documentation (if adding/modifying an adapter)
docs/adapters/—docs/adapters/browser/aistudio.mddocs/adapters/index.mdtabledocs/.vitepress/config.mtsREADME.md/README.zh-CN.md(aistudio row in the built-in command tables)promptis positional inask/image)CliErrorsubclasses (ArgumentError/EmptyResultError/AuthRequiredError/CommandExecutionError)Platform changes
preferredContextId):--profile/OPENCLI_PROFILEremains a hard pin; the config-default profile is now a soft preference threaded through daemon readiness (/status?preferredContextId=). The daemon arbitrates it against live connections — falls back when only one profile is live, errors when multiple are connected and the default is offline — so readiness never hangs on a stale default.Browser.getWindowForTarget,Browser.setWindowBounds,Page.bringToFrontso adapters can restore a minimized window before native key input.Page.windowModeexposed for adapter reads.cli-manifest.jsonregisters the aistudio commands; docs indocs/adapters/browser/aistudio.md.Happy to split the platform changes into a separate PR if preferred.
Screenshots / Output