mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* feat(cli): open a browser tab in a split pane with `tab create --split` `orca tab create` could only add a tab to an existing pane, so an agent had no way to put a page beside its terminal. `--split <right|left|down|up>` creates a new pane next to the calling terminal (ORCA_TAB_ID), falling back to the active pane, and opens the page there without taking focus. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNtbMA9iVj9T4rBUjn5u6W * refactor(browser): share one type for the tab-create IPC payload The preload listener, its callback, the preload API contract and main's sender each declared the payload separately, and the listener copy had already drifted from the new split fields. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(browser): open the CLI split pane and its tab in one step Creating an empty group and then filling it fails when main owns the layout, because the window's group doesn't exist until main's frame lands. createBrowserTab's split option carries both to whichever owner draws them, so the rollback for a half-made pane goes away. SSH hosts already cannot choose a new tab's group, so their CLI's split is stripped like targetGroupId. * fix(browser): split in the caller's workspace and refuse splits that can't happen A CLI run outside its workspace's directory sends no workspace, so the renderer fell back to the active one and missed the caller's terminal. The caller's tab now picks the workspace when none was named. An SSH host's split and an empty --split= both turned into a plain tab reported as success; both are refused instead. --------- Co-authored-by: Kalvin Mizzi <kalvin@mizzi.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
285 lines
10 KiB
TypeScript
285 lines
10 KiB
TypeScript
import type { CommandSpec } from '../args'
|
|
import { GLOBAL_FLAGS } from '../args'
|
|
import { withBrowserPageTarget } from './browser-page-target'
|
|
import { BROWSER_WAIT_DEFAULT_TIMEOUT_MS } from '../../shared/browser-wait-timeout'
|
|
|
|
export const BROWSER_BASIC_COMMAND_SPECS: CommandSpec[] = withBrowserPageTarget([
|
|
{
|
|
path: ['browser', 'identity', 'get'],
|
|
summary: 'Show the browser identity configured on this Orca host',
|
|
usage: 'orca browser identity get [--json]',
|
|
aliases: [['browser', 'identity', 'show']],
|
|
allowedFlags: [...GLOBAL_FLAGS]
|
|
},
|
|
{
|
|
path: ['browser', 'identity', 'set'],
|
|
summary: 'Choose the browser identity for every page on this Orca host',
|
|
usage: 'orca browser identity set --mode <clean|native> [--reset] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'mode', 'reset']
|
|
},
|
|
{
|
|
path: ['open-url'],
|
|
summary: 'Open a URL on the paired client that hosts this terminal',
|
|
usage: 'orca open-url --url <url> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'url', 'worktree']
|
|
},
|
|
{
|
|
path: ['snapshot'],
|
|
summary: 'Capture an accessibility snapshot of the active browser tab',
|
|
usage:
|
|
'orca snapshot [--interactive] [--compact] [--depth <n>] [--selector <css>] [--urls] [--delta | --full] [--worktree <selector>] [--json]',
|
|
allowedFlags: [
|
|
...GLOBAL_FLAGS,
|
|
'interactive',
|
|
'compact',
|
|
'depth',
|
|
'selector',
|
|
'urls',
|
|
'delta',
|
|
'full',
|
|
'worktree'
|
|
],
|
|
notes: [
|
|
'Without flags the snapshot is the whole accessibility tree, including page text.',
|
|
'Each page keeps one --delta baseline: a navigation, a large change or different flags return the whole tree again and replace it.'
|
|
]
|
|
},
|
|
{
|
|
path: ['screenshot'],
|
|
summary: 'Save a viewport screenshot of the active browser tab and print its path',
|
|
usage:
|
|
'orca screenshot [--format <png|jpeg>] [--if-changed] [--annotate] [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'format', 'if-changed', 'annotate', 'worktree'],
|
|
notes: [
|
|
"In Orca's desktop browser the image is in CSS pixels, so its x/y match page coordinates for `orca mouse`."
|
|
]
|
|
},
|
|
{
|
|
path: ['click'],
|
|
summary: 'Click a browser element by ref',
|
|
usage: 'orca click --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['fill'],
|
|
summary: 'Clear and fill a browser input by ref',
|
|
usage: 'orca fill --element <ref> --value <text> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'value', 'worktree']
|
|
},
|
|
{
|
|
path: ['type'],
|
|
summary: 'Type text at the current browser focus',
|
|
usage: 'orca type --input <text> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'input', 'worktree']
|
|
},
|
|
{
|
|
path: ['select'],
|
|
summary: 'Select a dropdown option by ref',
|
|
usage: 'orca select --element <ref> --value <value> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'value', 'worktree']
|
|
},
|
|
{
|
|
path: ['scroll'],
|
|
summary: 'Scroll the browser viewport',
|
|
usage: 'orca scroll --direction <up|down> [--amount <pixels>] [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'direction', 'amount', 'worktree']
|
|
},
|
|
{
|
|
path: ['goto'],
|
|
summary: 'Navigate the active browser tab to a URL',
|
|
usage: 'orca goto --url <url> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'url', 'worktree']
|
|
},
|
|
{
|
|
path: ['back'],
|
|
summary: 'Navigate back in browser history',
|
|
usage: 'orca back [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'worktree']
|
|
},
|
|
{
|
|
path: ['reload'],
|
|
summary: 'Reload the active browser tab',
|
|
usage: 'orca reload [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'worktree']
|
|
},
|
|
{
|
|
path: ['eval'],
|
|
summary: 'Evaluate JavaScript in the browser page context',
|
|
usage: 'orca eval --expression <js> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'expression', 'worktree']
|
|
},
|
|
{
|
|
path: ['wait'],
|
|
summary: 'Wait for element, text, URL, load state, JS condition, or timeout',
|
|
usage:
|
|
'orca wait [--selector <sel>] [--timeout <ms>] [--text <text>] [--url <pattern>] [--load <state>] [--fn <js>] [--state <hidden|visible>] [--worktree <selector>] [--json]',
|
|
allowedFlags: [
|
|
...GLOBAL_FLAGS,
|
|
'selector',
|
|
'timeout',
|
|
'text',
|
|
'url',
|
|
'load',
|
|
'fn',
|
|
'state',
|
|
'worktree'
|
|
],
|
|
notes: [
|
|
`With a condition, --timeout is how long to wait for it (default ${BROWSER_WAIT_DEFAULT_TIMEOUT_MS} ms). Without one, --timeout is a plain pause.`
|
|
]
|
|
},
|
|
{
|
|
path: ['check'],
|
|
summary: 'Check a checkbox/radio by ref',
|
|
usage: 'orca check --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['uncheck'],
|
|
summary: 'Uncheck a checkbox/radio by ref',
|
|
usage: 'orca uncheck --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['focus'],
|
|
summary: 'Focus a browser element by ref',
|
|
usage: 'orca focus --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['clear'],
|
|
summary: 'Clear an input element by ref',
|
|
usage: 'orca clear --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['select-all'],
|
|
summary: 'Select all text in an input by ref',
|
|
usage: 'orca select-all --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['keypress'],
|
|
summary: 'Press a key (Enter, Tab, Escape, ArrowDown, etc.)',
|
|
usage: 'orca keypress --key <name> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'key', 'worktree']
|
|
},
|
|
{
|
|
path: ['pdf'],
|
|
summary: 'Export the active browser tab as PDF',
|
|
usage: 'orca pdf [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'worktree']
|
|
},
|
|
{
|
|
path: ['full-screenshot'],
|
|
summary: 'Save a full-page screenshot (beyond viewport) and print its path',
|
|
usage: 'orca full-screenshot [--format <png|jpeg>] [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'format', 'worktree']
|
|
},
|
|
{
|
|
path: ['hover'],
|
|
summary: 'Hover over a browser element by ref',
|
|
usage: 'orca hover --element <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'worktree']
|
|
},
|
|
{
|
|
path: ['drag'],
|
|
summary: 'Drag from one element to another',
|
|
usage: 'orca drag --from <ref> --to <ref> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'from', 'to', 'worktree']
|
|
},
|
|
{
|
|
path: ['upload'],
|
|
summary: 'Upload files to a file input, or to the one a picker button opens',
|
|
usage: 'orca upload --element <ref> --files <path,...> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'element', 'files', 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'list'],
|
|
summary: 'List open browser tabs',
|
|
usage: 'orca tab list [--worktree <selector|all>] [--show-profile] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'worktree', 'show-profile']
|
|
},
|
|
{
|
|
path: ['tab', 'show'],
|
|
summary: 'Show one browser tab by page id',
|
|
usage: 'orca tab show --page <id> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'page', 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'current'],
|
|
summary: 'Show the current browser tab',
|
|
usage: 'orca tab current [--worktree <selector|all>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'switch'],
|
|
summary: 'Switch the active browser tab',
|
|
usage: 'orca tab switch (--index <n> | --page <id>) [--worktree <selector>] [--focus] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'index', 'page', 'worktree', 'focus']
|
|
},
|
|
{
|
|
path: ['tab', 'create'],
|
|
summary: 'Create a new browser tab in the current worktree',
|
|
usage:
|
|
'orca tab create [--url <url>] [--worktree <selector>] [--profile <id>] [--split <right|left|down|up>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'url', 'worktree', 'profile', 'split']
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'list'],
|
|
summary: 'List browser session profiles available to browser tabs',
|
|
usage: 'orca tab profile list [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS]
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'create'],
|
|
summary: 'Create a browser session profile for browser tabs',
|
|
usage: 'orca tab profile create --label <name> [--scope <isolated|imported>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'label', 'scope']
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'delete'],
|
|
destructive: true,
|
|
summary: 'Delete a browser session profile used by browser tabs',
|
|
usage: 'orca tab profile delete --profile <id> [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'profile']
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'set'],
|
|
summary: 'Switch a browser tab to a different browser profile',
|
|
usage: 'orca tab profile set (--page <id> | --worktree <selector>) --profile <id> [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'profile', 'page', 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'show'],
|
|
summary: 'Show the browser profile bound to a tab',
|
|
usage: 'orca tab profile show --page <id> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'page', 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'use-default'],
|
|
summary: 'Switch a browser tab back to the default browser profile',
|
|
usage: 'orca tab profile use-default --page <id> [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'page', 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'profile', 'clone'],
|
|
summary: 'Clone a browser tab into a different browser profile',
|
|
usage: 'orca tab profile clone --profile <id> [--page <id>] [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'profile', 'page', 'worktree']
|
|
},
|
|
{
|
|
path: ['tab', 'close'],
|
|
destructive: true,
|
|
summary: 'Close a browser tab',
|
|
usage: 'orca tab close [--index <n>] [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'index', 'worktree']
|
|
},
|
|
{
|
|
path: ['exec'],
|
|
summary: 'Run any agent-browser command against the active browser tab',
|
|
usage: 'orca exec --command "<agent-browser command>" [--worktree <selector>] [--json]',
|
|
allowedFlags: [...GLOBAL_FLAGS, 'command', 'worktree']
|
|
}
|
|
])
|