orca-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrca CLI
Orca CLI
Use this skill when the task should go through Orca's control plane rather than directly through , shell PTYs, or ad hoc filesystem access.
git当任务需要通过Orca的控制平面而非直接通过、shell PTY或临时文件系统访问时,请使用此技能。
gitWhen To Use
使用场景
Use for:
orca- worktree orchestration inside a running Orca app
- updating the current worktree comment with meaningful progress checkpoints
- reading Orca-managed terminals and sending input to non-agent terminals
- stopping or waiting on Orca-managed terminals
- accessing repos known to Orca
Do not use when plain shell tools are simpler and Orca state does not matter.
orca
Examples:
- creating one Orca worktree per GitHub issue
- updating the current worktree comment after a significant checkpoint, such as reproducing a bug, validating a fix, or handing off for review
- finding the Claude Code terminal for a worktree and reading its status
- checking which Orca worktrees have live terminal activity
在以下场景使用:
orca- 在运行中的Orca应用内编排工作树
- 更新当前工作树注释,记录重要的进度检查点
- 读取Orca管理的终端并向非代理终端发送输入
- 停止或等待Orca管理的终端
- 访问Orca已知的仓库
当普通shell工具更简单且不涉及Orca状态时,请勿使用。
orca
示例:
- 为每个GitHub Issue创建一个Orca工作树
- 在完成重要检查点后更新当前工作树注释,例如复现bug、验证修复或提交审核
- 查找工作树对应的Claude Code终端并读取其状态
- 检查哪些Orca工作树有活跃的终端活动
Preconditions
前置条件
- Prefer the public command first
orca - Orca editor/runtime should already be running, or the agent should start it with
orca open - Do not begin by inspecting Orca source files just to decide how to invoke the CLI. The first step is to check whether the installed command exists.
orca - Do not assume a generic shell environment variable proves the agent is "inside Orca". For normal agent flows, the public CLI is the supported surface, but avoid wasting a round trip on probe-only checks when a direct Orca action would answer the question.
First verify the public CLI is installed:
bash
command -v orcaThen use the public command:
bash
orca status --jsonIf the task is about Orca worktrees or Orca terminals, do this before any codebase exploration:
bash
command -v orca
orca status --jsonIf the agent truly needs to confirm that the current directory is inside an Orca-managed worktree, use:
bash
orca worktree current --jsonIf is not on PATH, say so explicitly and stop or ask the user to install/register the CLI before continuing.
orca- 优先使用公开的命令
orca - Orca编辑器/运行时应已启动,或代理应通过启动它
orca open - 不要为了决定如何调用CLI而先检查Orca源代码文件。第一步应检查已安装的命令是否存在。
orca - 不要假设通用shell环境变量能证明代理处于“Orca内部”。对于常规代理流程,公开CLI是受支持的操作界面,但当直接执行Orca操作即可解决问题时,避免浪费一次往返仅做探测性检查。
首先验证公开CLI是否已安装:
bash
command -v orca然后使用公开命令:
bash
orca status --json如果任务涉及Orca工作树或Orca终端,请在探索代码库前执行以下操作:
bash
command -v orca
orca status --json如果代理确实需要确认当前目录是否在Orca管理的工作树内,请使用:
bash
orca worktree current --json如果不在PATH中,请明确告知用户并停止操作,或要求用户先安装/注册CLI再继续。
orcaCore Workflow
核心工作流
- Confirm Orca runtime availability:
bash
orca status --jsonIf Orca is not running yet:
bash
orca open --json
orca status --json- Discover current Orca state:
bash
orca worktree ps --json
orca terminal list --json-
Resolve a target worktree or terminal handle.
-
Act through Orca:
worktree create/set/rmterminal read/send/wait/stop
- When the agent reaches a significant checkpoint in the current worktree, update the Orca worktree comment so the UI reflects the latest work-in-progress:
bash
orca worktree set --worktree active --comment "reproduced auth failure with aws sts; testing credential-chain fix" --jsonWhy: the worktree comment is Orca's lightweight, agent-writable status field. Keeping it current gives the user an at-a-glance summary of what the agent most recently proved, changed, or is waiting on.
- 确认Orca运行时可用:
bash
orca status --json如果Orca尚未运行:
bash
orca open --json
orca status --json- 发现当前Orca状态:
bash
orca worktree ps --json
orca terminal list --json-
解析目标工作树或终端句柄。
-
通过Orca执行操作:
worktree create/set/rmterminal read/send/wait/stop
- 当代理在当前工作树中到达重要检查点时,更新Orca工作树注释,使UI反映最新的工作进展:
bash
orca worktree set --worktree active --comment "reproduced auth failure with aws sts; testing credential-chain fix" --json原因:工作树注释是Orca的轻量级、代理可写入的状态字段。保持其更新能让用户快速了解代理最近验证、修改的内容,或正在等待的事项。
Command Surface
命令界面
Repo
仓库
bash
orca repo list --json
orca repo show --repo id:<repoId> --json
orca repo add --path /abs/repo --json
orca repo set-base-ref --repo id:<repoId> --ref origin/main --json
orca repo search-refs --repo id:<repoId> --query main --limit 10 --jsonbash
orca repo list --json
orca repo show --repo id:<repoId> --json
orca repo add --path /abs/repo --json
orca repo set-base-ref --repo id:<repoId> --ref origin/main --json
orca repo search-refs --repo id:<repoId> --query main --limit 10 --jsonWorktree
工作树
bash
orca worktree list --repo id:<repoId> --json
orca worktree ps --json
orca worktree current --json
orca worktree show --worktree id:<worktreeId> --json
orca worktree create --repo id:<repoId> --name my-task --issue 123 --comment "seed" --json
orca worktree set --worktree id:<worktreeId> --display-name "My Task" --json
orca worktree set --worktree active --comment "reproduced bug; collecting logs from staging" --json
orca worktree set --worktree active --comment "waiting on review" --json
orca worktree rm --worktree id:<worktreeId> --force --jsonWorktree selectors supported in focused v1:
id:<worktree-id>path:<absolute-path>branch:<branch-name>issue:<number>- /
activeto resolve the enclosing Orca-managed worktree from the shellcurrentcwd
bash
orca worktree list --repo id:<repoId> --json
orca worktree ps --json
orca worktree current --json
orca worktree show --worktree id:<worktreeId> --json
orca worktree create --repo id:<repoId> --name my-task --issue 123 --comment "seed" --json
orca worktree set --worktree id:<worktreeId> --display-name "My Task" --json
orca worktree set --worktree active --comment "reproduced bug; collecting logs from staging" --json
orca worktree set --worktree active --comment "waiting on review" --json
orca worktree rm --worktree id:<worktreeId> --force --json聚焦版v1支持的工作树选择器:
id:<worktree-id>path:<absolute-path>branch:<branch-name>issue:<number>- /
active通过shell的current解析当前Orca管理的工作树cwd
Terminal
终端
Use selectors to discover terminals, then use the returned handle for repeated live interaction.
bash
orca terminal list --worktree id:<worktreeId> --json
orca terminal show --terminal <handle> --json
orca terminal read --terminal <handle> --json
orca terminal send --terminal <handle> --text "continue" --enter --json
orca terminal wait --terminal <handle> --for exit --timeout-ms 5000 --json
orca terminal wait --terminal <handle> --for tui-idle --timeout-ms 30000 --json
orca terminal stop --worktree id:<worktreeId> --json
orca terminal create --json
orca terminal create --title "My Terminal" --json
orca terminal create --worktree path:/projects/myapp --command "npm test" --json
orca terminal split --terminal <handle> --direction vertical --json
orca terminal split --terminal <handle> --direction horizontal --command "npm run dev" --json
orca terminal rename --terminal <handle> --title "New Name" --json
orca terminal switch --terminal <handle> --json
orca terminal close --terminal <handle> --json
orca terminal send --text "echo hello" --enter --json
orca terminal read --jsonWhy: is optional for most commands. When omitted, Orca auto-resolves to the active terminal in the current worktree (same as browser commands target the active tab). Use explicit when operating on a specific pane.
--terminal--terminal <handle>Why: terminal handles are runtime-scoped and may go stale after reloads. If Orca returns , reacquire a fresh handle with .
terminal_handle_staleterminal listWhy: splits the pane left and right (new pane appears to the right). splits the pane top and bottom (new pane appears below). This matches VS Code's split convention. Default is horizontal.
--direction horizontal--direction vertical使用选择器发现终端,然后使用返回的句柄进行重复的实时交互。
bash
orca terminal list --worktree id:<worktreeId> --json
orca terminal show --terminal <handle> --json
orca terminal read --terminal <handle> --json
orca terminal send --terminal <handle> --text "continue" --enter --json
orca terminal wait --terminal <handle> --for exit --timeout-ms 5000 --json
orca terminal wait --terminal <handle> --for tui-idle --timeout-ms 30000 --json
orca terminal stop --worktree id:<worktreeId> --json
orca terminal create --json
orca terminal create --title "My Terminal" --json
orca terminal create --worktree path:/projects/myapp --command "npm test" --json
orca terminal split --terminal <handle> --direction vertical --json
orca terminal split --terminal <handle> --direction horizontal --command "npm run dev" --json
orca terminal rename --terminal <handle> --title "New Name" --json
orca terminal switch --terminal <handle> --json
orca terminal close --terminal <handle> --json
orca terminal send --text "echo hello" --enter --json
orca terminal read --json说明:大多数命令中是可选的。省略时,Orca会自动解析为当前工作树中的活跃终端(与浏览器命令目标为活跃标签页的逻辑相同)。操作特定面板时,请使用显式的。
--terminal--terminal <handle>说明:终端句柄是运行时作用域的,在重新加载后可能会失效。如果Orca返回,请通过重新获取新的句柄。
terminal_handle_staleterminal list说明:会水平拆分面板(新面板出现在右侧)。会垂直拆分面板(新面板出现在下方)。这与VS Code的拆分 convention一致。默认值为horizontal。
--direction horizontal--direction verticalAgent Guidance
代理指南
- If the user says to create/manage an Orca worktree, use , not raw
orca worktree ....git worktree ... - Treat Orca as the source of truth for Orca worktree and terminal tasks. Do not mix Orca-managed state with ad hoc git worktree commands unless Orca explicitly cannot perform the requested action.
- Prefer for all machine-driven use.
--json - Use as the first summary view when many worktrees may exist.
worktree ps - Use or
worktree currentwhen the agent is already running inside the target worktree.--worktree active - Treat as a default coding-agent behavior whenever the agent reaches a meaningful checkpoint in the current Orca-managed worktree; the user does not need to explicitly ask for each update.
orca worktree set --worktree active --comment ... --json - Update the worktree comment at significant checkpoints, not every trivial command. Good checkpoints include reproducing a bug, confirming a hypothesis, starting a risky migration, finishing a meaningful implementation slice, switching from investigation to fix, or blocking on external input.
- Write comments as short status snapshots of the current state, for example ,
debugging AWS CLI profile resolution, orconfirmed flaky test is caused by temp-dir race.fix implemented; running integration tests - Prefer optimistic execution over probe-first flows for checkpoint updates: if is on
orca, callPATHdirectly at the checkpoint instead of spending an extra cycle onorca worktree set --worktree active --comment ... --json.orca worktree current - If that direct update fails because Orca is unavailable or the shell is not inside an Orca-managed worktree, continue the main task and treat the comment update as best-effort unless the user explicitly made Orca state part of the task.
- Use only when the agent actually needs the worktree identity for later logic, not as a preflight before every comment update.
orca worktree current --json - Orca only injects -style variables for some setup-hook flows, so they are not a general detection contract for agents.
ORCA_WORKTREE_PATH - Use to reacquire handles after Orca reloads.
terminal list - Use before
terminal readunless the next input is obvious.terminal send - Use only when the task actually depends on process completion.
terminal wait --terminal <handle> --for exit - Use to wait for an agent CLI (Claude Code, Gemini, Codex, etc.) to finish its current task. This detects the working→idle OSC title transition. Always pass
terminal wait --terminal <handle> --for tui-idleas a safety net — unsupported CLIs will hang until timeout.--timeout-ms - Use to spin up new terminal tabs programmatically, optionally with a
terminal createfor startup (e.g.--commandto launch Claude Code) and--command "claude"for labeling. After creating a--titleterminal, use--commandto wait for the agent to boot before dispatching.terminal wait --for tui-idle - Use to create split panes within an existing terminal tab. Pass
terminal splitto run a command in the new pane.--command - Prefer Orca worktree selectors over hardcoded paths when Orca identity already exists.
- If the user asks for CLI UX feedback, test the public command first. Only inspect
orcaor usesrc/cliif the public command is missing or the task is explicitly about implementation internals.node out/cli/index.js - If a command fails, prefer retrying with the public command before concluding the CLI is broken, unless the failure already came from
orcaitself.orca
- 如果用户要求创建/管理Orca工作树,请使用,而非原生
orca worktree ...。git worktree ... - 将Orca视为Orca工作树和终端任务的事实来源。除非Orca明确无法执行请求的操作,否则不要混合使用Orca管理的状态与临时git worktree命令。
- 所有机器驱动的操作优先使用参数。
--json - 当可能存在多个工作树时,使用作为初始概览视图。
worktree ps - 当代理已在目标工作树内运行时,使用或
worktree current。--worktree active - 每当代理在当前Orca管理的工作树中到达重要检查点时,默认执行操作;用户无需明确要求每次更新。
orca worktree set --worktree active --comment ... --json - 在重要检查点更新工作树注释,而非每个琐碎命令之后。合适的检查点包括:复现bug、确认假设、启动风险迁移、完成有意义的实现片段、从调查切换到修复,或等待外部输入。
- 注释应作为当前状态的简短快照,例如、
debugging AWS CLI profile resolution或confirmed flaky test is caused by temp-dir race。fix implemented; running integration tests - 对于检查点更新,优先采用乐观执行而非先探测再执行的流程:如果在PATH中,直接在检查点调用
orca,无需额外执行orca worktree set --worktree active --comment ... --json。orca worktree current - 如果直接更新失败(因为Orca不可用或shell不在Orca管理的工作树内),继续执行主任务,将注释更新视为尽力而为的操作,除非用户明确将Orca状态作为任务的一部分。
- 仅当代理实际需要工作树标识用于后续逻辑时,才使用,不要在每次注释更新前都作为预检操作。
orca worktree current --json - Orca仅在某些设置钩子流程中注入类变量,因此它们不是代理的通用检测约定。
ORCA_WORKTREE_PATH - Orca重新加载后,使用重新获取句柄。
terminal list - 除非下一个输入非常明确,否则在前先使用
terminal send。terminal read - 仅当任务实际依赖进程完成时,才使用。
terminal wait --terminal <handle> --for exit - 使用等待代理CLI(Claude Code、Gemini、Codex等)完成当前任务。这会检测工作→空闲的OSC标题转换。始终传递
terminal wait --terminal <handle> --for tui-idle作为安全网——不支持的CLI会挂起直到超时。--timeout-ms - 使用以编程方式启动新的终端标签页,可选择使用
terminal create指定启动命令(例如--command启动Claude Code)和--command "claude"设置标签。创建--title终端后,使用--command等待代理启动后再发送任务。terminal wait --for tui-idle - 使用在现有终端标签页内创建拆分面板。传递
terminal split在新面板中运行命令。--command - 当Orca标识已存在时,优先使用Orca工作树选择器而非硬编码路径。
- 如果用户要求CLI UX反馈,请先测试公开的命令。仅当公开命令缺失或任务明确涉及实现内部时,才检查
orca或使用src/cli。node out/cli/index.js - 如果命令失败,优先重试公开的命令,再判断CLI是否损坏,除非失败本身来自
orca。orca
Browser Automation
浏览器自动化
The CLI also drives the built-in Orca browser. The core workflow is a snapshot-interact-re-snapshot loop:
orca- Snapshot the page to see interactive elements and their refs.
- Interact using refs (,
@e1, etc.) to click, fill, or select.@e3 - Re-snapshot after interactions to see the updated page state.
bash
orca goto --url https://example.com --json
orca snapshot --jsonorca- 快照页面以查看交互元素及其引用。
- 交互使用引用(、
@e1等)进行点击、填充或选择。@e3 - 重新快照交互后的页面以查看更新后的状态。
bash
orca goto --url https://example.com --json
orca snapshot --jsonRead the refs from the snapshot output
从快照输出中读取引用
orca click --element @e3 --json
orca snapshot --json
undefinedorca click --element @e3 --json
orca snapshot --json
undefinedElement Refs
元素引用
Refs like , are short identifiers assigned to interactive page elements during a snapshot. They are:
@e1@e5- Assigned by snapshot: Run to get current refs.
orca snapshot - Scoped to one tab: Refs from one tab are not valid in another.
- Invalidated by navigation: If the page navigates after a snapshot, refs become stale. Re-snapshot to get fresh refs.
- Invalidated by tab switch: Switching tabs with invalidates refs. Re-snapshot after switching.
orca tab switch
If a ref is stale, the command returns — re-snapshot and retry.
browser_stale_ref@e1@e5- 由快照分配:运行获取当前引用。
orca snapshot - 作用于单个标签页:一个标签页的引用在另一个标签页中无效。
- 导航后失效:如果快照后页面导航,引用会失效。重新快照以获取新引用。
- 切换标签页后失效:使用切换标签页会使引用失效。切换后重新快照。
orca tab switch
如果引用失效,命令会返回——重新快照并重试。
browser_stale_refWorktree Scoping
工作树作用域
Browser commands default to the current worktree — only tabs belonging to the agent's worktree are visible and targetable. Tab indices are relative to the filtered tab list.
bash
undefined浏览器命令默认作用于当前工作树——仅代理工作树所属的标签页可见且可定位。标签页索引相对于过滤后的标签页列表。
bash
undefinedDefault: operates on tabs in the current worktree
默认:操作当前工作树中的标签页
orca snapshot --json
orca snapshot --json
Explicitly target all worktrees (cross-worktree access)
明确目标所有工作树(跨工作树访问)
orca snapshot --worktree all --json
orca snapshot --worktree all --json
Tab indices are relative to the worktree-filtered list
标签页索引相对于工作树过滤后的列表
orca tab list --json # Shows tabs [0], [1], [2] for this worktree
orca tab switch --index 1 --json # Switches to tab [1] within this worktree
If no tabs are open in the current worktree, commands return `browser_no_tab`.orca tab list --json # 显示此工作树的标签页 [0], [1], [2]
orca tab switch --index 1 --json # 切换到此工作树中的标签页 [1]
如果当前工作树中没有打开的标签页,命令会返回`browser_no_tab`。Stable Page Targeting
稳定页面定位
For single-agent flows, bare browser commands are fine: Orca will target the active browser tab in the current worktree.
For concurrent or multi-process browser automation, prefer a stable page id instead of ambient active-tab state:
- Run .
orca tab list --json - Read from the result.
tabs[].browserPageId - Pass to follow-up commands like
--page <browserPageId>,snapshot,click,goto,screenshot, ortab switch.tab close
Why: active-tab state and tab indices can change while another Orca CLI process is working. pins the command to one concrete tab.
browserPageIdbash
orca tab list --json
orca snapshot --page page-123 --json
orca click --page page-123 --element @e3 --json
orca screenshot --page page-123 --json
orca tab switch --page page-123 --json
orca tab close --page page-123 --jsonIf you also pass , Orca treats it as extra scoping/validation for that page id. Without , commands still fall back to the current worktree's active tab.
--worktree--page对于单代理流程,直接使用浏览器命令即可:Orca会目标当前工作树中的活跃浏览器标签页。
对于并发或多进程浏览器自动化,优先使用稳定的页面ID而非环境活跃标签页状态:
- 运行。
orca tab list --json - 从结果中读取。
tabs[].browserPageId - 将传递给后续命令,如
--page <browserPageId>、snapshot、click、goto、screenshot或tab switch。tab close
原因:当另一个Orca CLI进程运行时,活跃标签页状态和标签页索引可能会变化。会将命令固定到一个具体的标签页。
browserPageIdbash
orca tab list --json
orca snapshot --page page-123 --json
orca click --page page-123 --element @e3 --json
orca screenshot --page page-123 --json
orca tab switch --page page-123 --json
orca tab close --page page-123 --json如果同时传递,Orca会将其视为该页面ID的额外作用域/验证。如果没有,命令仍会回退到当前工作树的活跃标签页。
--worktree--pageNavigation
导航
bash
orca goto --url <url> [--json] # Navigate to URL, waits for page load
orca back [--json] # Go back in browser history
orca forward [--json] # Go forward in browser history
orca reload [--json] # Reload the current pagebash
orca goto --url <url> [--json] # 导航到URL,等待页面加载
orca back [--json] # 返回浏览器历史记录
orca forward [--json] # 前进浏览器历史记录
orca reload [--json] # 重新加载当前页面Observation
观察
bash
orca snapshot [--page <browserPageId>] [--json] # Accessibility tree snapshot with element refs
orca screenshot [--page <browserPageId>] [--format <png|jpeg>] [--json] # Viewport screenshot (base64)
orca full-screenshot [--page <browserPageId>] [--format <png|jpeg>] [--json] # Full-page screenshot (base64)
orca pdf [--page <browserPageId>] [--json] # Export page as PDF (base64)bash
orca snapshot [--page <browserPageId>] [--json] # 包含元素引用的可访问性树快照
orca screenshot [--page <browserPageId>] [--format <png|jpeg>] [--json] # 视口截图(base64格式)
orca full-screenshot [--page <browserPageId>] [--format <png|jpeg>] [--json] # 全页截图(base64格式)
orca pdf [--page <browserPageId>] [--json] # 将页面导出为PDF(base64格式)Interaction
交互
bash
orca click --element <ref> [--page <browserPageId>] [--json] # Click an element by ref
orca dblclick --element <ref> [--page <browserPageId>] [--json] # Double-click an element
orca fill --element <ref> --value <text> [--page <browserPageId>] [--json] # Clear and fill an input
orca type --input <text> [--page <browserPageId>] [--json] # Type at current focus (no element targeting)
orca select --element <ref> --value <value> [--page <browserPageId>] [--json] # Select dropdown option
orca check --element <ref> [--page <browserPageId>] [--json] # Check a checkbox
orca uncheck --element <ref> [--page <browserPageId>] [--json] # Uncheck a checkbox
orca scroll --direction <up|down> [--amount <pixels>] [--page <browserPageId>] [--json] # Scroll viewport
orca scrollintoview --element <ref> [--page <browserPageId>] [--json] # Scroll element into view
orca hover --element <ref> [--page <browserPageId>] [--json] # Hover over an element
orca focus --element <ref> [--page <browserPageId>] [--json] # Focus an element
orca drag --from <ref> --to <ref> [--page <browserPageId>] [--json] # Drag from one element to another
orca clear --element <ref> [--page <browserPageId>] [--json] # Clear an input field
orca select-all --element <ref> [--page <browserPageId>] [--json] # Select all text in an element
orca keypress --key <key> [--page <browserPageId>] [--json] # Press a key (Enter, Tab, Escape, etc.)
orca upload --element <ref> --files <paths> [--page <browserPageId>] [--json] # Upload files to a file inputbash
orca click --element <ref> [--page <browserPageId>] [--json] # 通过引用点击元素
orca dblclick --element <ref> [--page <browserPageId>] [--json] # 双击元素
orca fill --element <ref> --value <text> [--page <browserPageId>] [--json] # 清空并填充输入框
orca type --input <text> [--page <browserPageId>] [--json] # 在当前焦点处输入文本(无需定位元素)
orca select --element <ref> --value <value> [--page <browserPageId>] [--json] # 选择下拉选项
orca check --element <ref> [--page <browserPageId>] [--json] # 勾选复选框
orca uncheck --element <ref> [--page <browserPageId>] [--json] # 取消勾选复选框
orca scroll --direction <up|down> [--amount <pixels>] [--page <browserPageId>] [--json] # 滚动视口
orca scrollintoview --element <ref> [--page <browserPageId>] [--json] # 滚动元素到可视区域
orca hover --element <ref> [--page <browserPageId>] [--json] # 悬停在元素上
orca focus --element <ref> [--page <browserPageId>] [--json] # 聚焦元素
orca drag --from <ref> --to <ref> [--page <browserPageId>] [--json] # 从一个元素拖动到另一个元素
orca clear --element <ref> [--page <browserPageId>] [--json] # 清空输入框
orca select-all --element <ref> [--page <browserPageId>] [--json] # 选择元素内的所有文本
orca keypress --key <key> [--page <browserPageId>] [--json] # 按下按键(Enter、Tab、Escape等)
orca upload --element <ref> --files <paths> [--page <browserPageId>] [--json] # 上传文件到文件输入框Tab Management
标签页管理
bash
orca tab list [--json] # List open browser tabs
orca tab switch (--index <n> | --page <browserPageId>) [--json] # Switch active tab (invalidates refs)
orca tab create [--url <url>] [--json] # Open a new browser tab
orca tab close [--index <n> | --page <browserPageId>] [--json] # Close a browser tabbash
orca tab list [--json] # 列出打开的浏览器标签页
orca tab switch (--index <n> | --page <browserPageId>) [--json] # 切换活跃标签页(会使引用失效)
orca tab create [--url <url>] [--json] # 打开新的浏览器标签页
orca tab close [--index <n> | --page <browserPageId>] [--json] # 关闭浏览器标签页Wait / Synchronization
等待/同步
bash
orca wait [--timeout <ms>] [--json] # Wait for timeout (default 1000ms)
orca wait --selector <css> [--state <visible|hidden>] [--timeout <ms>] [--json] # Wait for element
orca wait --text <string> [--timeout <ms>] [--json] # Wait for text to appear on page
orca wait --url <substring> [--timeout <ms>] [--json] # Wait for URL to contain substring
orca wait --load <networkidle|load|domcontentloaded> [--timeout <ms>] [--json] # Wait for load state
orca wait --fn <js-expression> [--timeout <ms>] [--json] # Wait for JS condition to be truthyAfter any page-changing action, pick one:
- Wait for specific content:
orca wait --text "Dashboard" --json - Wait for URL change:
orca wait --url "/dashboard" --json - Wait for network idle (catch-all for SPA navigation):
orca wait --load networkidle --json - Wait for an element:
orca wait --selector ".results" --json
Avoid bare except when debugging — it makes scripts slow and flaky.
orca wait --timeout 2000bash
orca wait [--timeout <ms>] [--json] # 等待超时(默认1000ms)
orca wait --selector <css> [--state <visible|hidden>] [--timeout <ms>] [--json] # 等待元素
orca wait --text <string> [--timeout <ms>] [--json] # 等待文本出现在页面上
orca wait --url <substring> [--timeout <ms>] [--json] # 等待URL包含子字符串
orca wait --load <networkidle|load|domcontentloaded> [--timeout <ms>] [--json] # 等待加载状态
orca wait --fn <js-expression> [--timeout <ms>] [--json] # 等待JS条件为真执行任何页面更改操作后,选择以下方式之一:
- 等待特定内容:
orca wait --text "Dashboard" --json - 等待URL更改:
orca wait --url "/dashboard" --json - 等待网络空闲(SPA导航的通用方式):
orca wait --load networkidle --json - 等待元素:
orca wait --selector ".results" --json
除调试外,避免使用裸——这会使脚本变慢且不稳定。
orca wait --timeout 2000Data Extraction
数据提取
bash
orca exec --command "get text @e1" [--json] # Get visible text of an element
orca exec --command "get html @e1" [--json] # Get innerHTML
orca exec --command "get value @e1" [--json] # Get input value
orca exec --command "get attr @e1 href" [--json] # Get element attribute
orca exec --command "get title" [--json] # Get page title
orca exec --command "get url" [--json] # Get current URL
orca exec --command "get count .item" [--json] # Count matching elementsbash
orca exec --command "get text @e1" [--json] # 获取元素的可见文本
orca exec --command "get html @e1" [--json] # 获取innerHTML
orca exec --command "get value @e1" [--json] # 获取输入框值
orca exec --command "get attr @e1 href" [--json] # 获取元素属性
orca exec --command "get title" [--json] # 获取页面标题
orca exec --command "get url" [--json] # 获取当前URL
orca exec --command "get count .item" [--json] # 统计匹配元素的数量State Checks
状态检查
bash
orca exec --command "is visible @e1" [--json] # Check if element is visible
orca exec --command "is enabled @e1" [--json] # Check if element is enabled
orca exec --command "is checked @e1" [--json] # Check if checkbox is checkedbash
orca exec --command "is visible @e1" [--json] # 检查元素是否可见
orca exec --command "is enabled @e1" [--json] # 检查元素是否可用
orca exec --command "is checked @e1" [--json] # 检查复选框是否勾选Page Inspection
页面检查
bash
orca eval --expression <js> [--json] # Evaluate JS in page contextbash
orca eval --expression <js> [--json] # 在页面上下文中执行JSCookie Management
Cookie管理
bash
orca cookie get [--url <url>] [--json] # List cookies
orca cookie set --name <n> --value <v> [--domain <d>] [--json] # Set a cookie
orca cookie delete --name <n> [--domain <d>] [--json] # Delete a cookiebash
orca cookie get [--url <url>] [--json] # 列出Cookie
orca cookie set --name <n> --value <v> [--domain <d>] [--json] # 设置Cookie
orca cookie delete --name <n> [--domain <d>] [--json] # 删除CookieEmulation
模拟
bash
orca viewport --width <w> --height <h> [--scale <n>] [--mobile] [--json]
orca geolocation --latitude <lat> --longitude <lng> [--accuracy <m>] [--json]bash
orca viewport --width <w> --height <h> [--scale <n>] [--mobile] [--json]
orca geolocation --latitude <lat> --longitude <lng> [--accuracy <m>] [--json]Request Interception
请求拦截
bash
orca intercept enable [--patterns <list>] [--json] # Start intercepting requests
orca intercept disable [--json] # Stop intercepting
orca intercept list [--json] # List paused requestsNote: Per-requestandintercept continueare not yet supported. They will be added once agent-browser supports per-request interception decisions.intercept block
bash
orca intercept enable [--patterns <list>] [--json] # 开始拦截请求
orca intercept disable [--json] # 停止拦截
orca intercept list [--json] # 列出暂停的请求注意: 暂不支持每个请求的和intercept continue。 一旦agent-browser支持每个请求的拦截决策,它们将被添加。intercept block
Console / Network Capture
控制台/网络捕获
bash
orca capture start [--json] # Start capturing console + network
orca capture stop [--json] # Stop capturing
orca console [--limit <n>] [--json] # Read captured console entries
orca network [--limit <n>] [--json] # Read captured network entriesbash
orca capture start [--json] # 开始捕获控制台+网络
orca capture stop [--json] # 停止捕获
orca console [--limit <n>] [--json] # 读取捕获的控制台条目
orca network [--limit <n>] [--json] # 读取捕获的网络条目Mouse Control
鼠标控制
bash
orca exec --command "mouse move 100 200" [--json] # Move mouse to coordinates
orca exec --command "mouse down left" [--json] # Press mouse button
orca exec --command "mouse up left" [--json] # Release mouse button
orca exec --command "mouse wheel 100" [--json] # Scroll wheelbash
orca exec --command "mouse move 100 200" [--json] # 将鼠标移动到坐标
orca exec --command "mouse down left" [--json] # 按下鼠标按钮
orca exec --command "mouse up left" [--json] # 释放鼠标按钮
orca exec --command "mouse wheel 100" [--json] # 滚动滚轮Keyboard
键盘
bash
orca exec --command "keyboard inserttext \"text\"" [--json] # Insert text bypassing key events
orca exec --command "keyboard type \"text\"" [--json] # Raw keystrokes
orca exec --command "keydown Shift" [--json] # Hold key down
orca exec --command "keyup Shift" [--json] # Release keybash
orca exec --command "keyboard inserttext \"text\"" [--json] # 插入文本,绕过按键事件
orca exec --command "keyboard type \"text\"" [--json] # 原始按键输入
orca exec --command "keydown Shift" [--json] # 按住按键
orca exec --command "keyup Shift" [--json] # 释放按键Frames (Iframes)
框架(Iframes)
Iframes are auto-inlined in snapshots — refs inside iframes work transparently. For scoped interaction:
bash
orca exec --command "frame @e3" [--json] # Switch to iframe by ref
orca exec --command "frame \"#iframe\"" [--json] # Switch to iframe by CSS selector
orca exec --command "frame main" [--json] # Return to main frame快照会自动内联Iframes——Iframe内的引用可透明使用。如需作用域交互:
bash
orca exec --command "frame @e3" [--json] # 通过引用切换到Iframe
orca exec --command "frame \"#iframe\"" [--json] # 通过CSS选择器切换到Iframe
orca exec --command "frame main" [--json] # 返回主框架Semantic Locators (alternative to refs)
语义定位器(替代引用)
When refs aren't available or you want to skip a snapshot:
bash
orca exec --command "find role button click --name \"Submit\"" [--json]
orca exec --command "find text \"Sign In\" click" [--json]
orca exec --command "find label \"Email\" fill \"user@test.com\"" [--json]
orca exec --command "find placeholder \"Search\" type \"query\"" [--json]
orca exec --command "find testid \"submit-btn\" click" [--json]当引用不可用或想跳过快照时:
bash
orca exec --command "find role button click --name \"Submit\"" [--json]
orca exec --command "find text \"Sign In\" click" [--json]
orca exec --command "find label \"Email\" fill \"user@test.com\"" [--json]
orca exec --command "find placeholder \"Search\" type \"query\"" [--json]
orca exec --command "find testid \"submit-btn\" click" [--json]Dialogs
对话框
alertbeforeunloadconfirmpromptbash
orca exec --command "dialog status" [--json] # Check for pending dialog
orca exec --command "dialog accept" [--json] # Accept
orca exec --command "dialog accept \"text\"" [--json] # Accept with prompt input
orca exec --command "dialog dismiss" [--json] # Dismiss/cancelalertbeforeunloadconfirmpromptbash
orca exec --command "dialog status" [--json] # 检查是否有挂起的对话框
orca exec --command "dialog accept" [--json] # 接受
orca exec --command "dialog accept \"text\"" [--json] # 接受并输入提示文本
orca exec --command "dialog dismiss" [--json] # 取消Extended Commands (Passthrough)
扩展命令(透传)
bash
orca exec --command "<agent-browser command>" [--json]The command provides access to agent-browser's full command surface. Useful for commands without typed Orca handlers:
execbash
orca exec --command "set device \"iPhone 14\"" --json # Emulate device
orca exec --command "set offline on" --json # Toggle offline mode
orca exec --command "set media dark" --json # Emulate color scheme
orca exec --command "network requests" --json # View tracked network requests
orca exec --command "help" --json # See all available commandsImportant: Do not use for tab management. Use instead — those operate at the Orca level and keep the UI synchronized.
orca exec --command "tab ..."orca tab list/create/close/switchbash
orca exec --command "<agent-browser command>" [--json]execbash
orca exec --command "set device \"iPhone 14\"" --json # 模拟设备
orca exec --command "set offline on" --json # 切换离线模式
orca exec --command "set media dark" --json # 模拟配色方案
orca exec --command "network requests" --json # 查看跟踪的网络请求
orca exec --command "help" --json # 查看所有可用命令重要提示: 不要使用进行标签页管理。请改用——这些操作在Orca层面执行,并保持UI同步。
orca exec --command "tab ..."orca tab list/create/close/switchfill
vs type
filltypefill
vs type
filltype- targets a specific element by ref, clears its value first, then enters text. Use for form fields.
fill - types at whatever currently has focus. Use for search boxes or after clicking into an input.
type
If neither works on a custom input component, try:
bash
orca focus --element @e1 --json
orca exec --command "keyboard inserttext \"text\"" --json # bypasses key events- 通过引用定位特定元素,先清空其值,再输入文本。适用于表单字段。
fill - 在当前焦点处输入文本。适用于搜索框或点击输入框后。
type
如果两者在自定义输入组件上都不起作用,请尝试:
bash
orca focus --element @e1 --json
orca exec --command "keyboard inserttext \"text\"" --json # 绕过按键事件Browser Error Codes
浏览器错误代码
| Error Code | Meaning | Recovery |
|---|---|---|
| No browser tab is open in this worktree | Open a tab, or use |
| Ref is invalid (page changed since snapshot) | Run |
| Tab index does not exist | Run |
| Error from the browser automation engine | Read the message for details; common causes: element not found, navigation timeout, JS error |
| 错误代码 | 含义 | 恢复方法 |
|---|---|---|
| 此工作树中没有打开的浏览器标签页 | 打开一个标签页,或使用 |
| 引用无效(快照后页面已更改) | 运行 |
| 标签页索引不存在 | 运行 |
| 浏览器自动化引擎错误 | 读取消息获取详细信息;常见原因:元素未找到、导航超时、JS错误 |
Browser Worked Example
浏览器示例
Agent fills a login form and verifies the dashboard loads:
bash
undefined代理填写登录表单并验证仪表板加载:
bash
undefinedNavigate to the login page
导航到登录页面
orca goto --url https://app.example.com/login --json
orca goto --url https://app.example.com/login --json
See what's on the page
查看页面内容
orca snapshot --json
orca snapshot --json
Output includes:
输出包括:
[@e1] text input "Email"
[@e1] 文本输入框 "Email"
[@e2] text input "Password"
[@e2] 文本输入框 "Password"
[@e3] button "Sign In"
[@e3] 按钮 "Sign In"
Fill the form
填写表单
orca fill --element @e1 --value "user@example.com" --json
orca fill --element @e2 --value "s3cret" --json
orca fill --element @e1 --value "user@example.com" --json
orca fill --element @e2 --value "s3cret" --json
Submit
提交
orca click --element @e3 --json
orca click --element @e3 --json
Verify the dashboard loaded
验证仪表板已加载
orca snapshot --json
orca snapshot --json
Output should show dashboard content, not the login form
输出应显示仪表板内容,而非登录表单
undefinedundefinedBrowser Troubleshooting
浏览器故障排除
"Ref not found" /
Page changed since the snapshot. Run again, then use the new refs.
browser_stale_reforca snapshot --jsonElement exists but not in snapshot
It may be off-screen or not yet rendered. Try:
bash
orca scroll --direction down --amount 1000 --json
orca snapshot --json"引用未找到" /
快照后页面已更改。再次运行,然后使用新引用。
browser_stale_reforca snapshot --json元素存在但未出现在快照中
它可能在屏幕外或尚未渲染。尝试:
bash
orca scroll --direction down --amount 1000 --json
orca snapshot --jsonor wait for it:
或等待它出现:
orca wait --text "..." --json
orca snapshot --json
**Click does nothing / overlay swallows the click**
Modals or cookie banners may be blocking. Snapshot, find the dismiss button, click it, then re-snapshot.
**Fill/type doesn't work on a custom input**
Some components intercept key events. Use `keyboard inserttext`:
```bash
orca focus --element @e1 --json
orca exec --command "keyboard inserttext \"text\"" --jsonbrowser_no_taborca tab create --url <url> --jsonorca wait --text "..." --json
orca snapshot --json
**点击无反应 / 覆盖层拦截点击**
模态框或Cookie横幅可能正在阻止。快照,找到关闭按钮,点击它,然后重新快照。
**Fill/type在自定义输入上不起作用**
某些组件会拦截按键事件。使用`keyboard inserttext`:
```bash
orca focus --element @e1 --json
orca exec --command "keyboard inserttext \"text\"" --jsonbrowser_no_taborca tab create --url <url> --jsonAuto-Switch Worktree
自动切换工作树
Browser commands automatically activate the target worktree in the Orca UI when needed. If the agent issues a browser command targeting a worktree that isn't currently active, Orca will switch to that worktree before executing the command.
当需要时,浏览器命令会自动在Orca UI中激活目标工作树。如果代理发出的浏览器命令目标是当前未激活的工作树,Orca会在执行命令前切换到该工作树。
Tab Create Auto-Activation
标签页创建自动激活
When opens a new tab, it is automatically set as the active tab for the worktree. Subsequent commands (, , etc.) will target the newly created tab without needing an explicit .
orca tab createsnapshotclicktab switch当打开新标签页时,它会自动设置为工作树的活跃标签页。后续命令(、等)会目标新创建的标签页,无需显式执行。
orca tab createsnapshotclicktab switchBrowser Agent Guidance
浏览器代理指南
- Always snapshot before interacting with elements.
- After navigation (,
goto,back, clicking a link), re-snapshot to get fresh refs.reload - After switching tabs, re-snapshot.
- If you get , re-snapshot and retry with the new refs.
browser_stale_ref - Use before
orca tab listto know which tabs exist.orca tab switch - For concurrent browser workflows, prefer and reuse
orca tab list --jsonwithtabs[].browserPageIdon later commands.--page - Use to synchronize after actions that trigger async updates (form submits, SPA navigation, modals) instead of arbitrary sleeps.
orca wait - Use as an escape hatch for interactions not covered by other commands.
orca eval - Use to discover extended commands.
orca exec --command "help" - Worktree scoping is automatic — you'll only see tabs from your worktree by default.
- Bare browser commands without still target the current worktree's active tab, which is convenient but less robust for multi-process automation.
--page - Tab creation auto-activates the new tab — no need for after
tab switch.tab create - Browser commands auto-switch the active worktree if needed — no manual worktree activation required.
- 交互元素前始终先快照。
- 导航(、
goto、back、点击链接)后,重新快照以获取新引用。reload - 切换标签页后,重新快照。
- 如果收到,重新快照并使用新引用重试。
browser_stale_ref - 切换标签页前使用了解存在哪些标签页。
orca tab list - 对于并发浏览器工作流,优先使用并在后续命令中复用
orca tab list --json和tabs[].browserPageId参数。--page - 执行触发异步更新的操作(表单提交、SPA导航、模态框)后,使用进行同步,而非任意等待。
orca wait - 使用作为其他命令未覆盖的交互的逃生舱。
orca eval - 使用发现扩展命令。
orca exec --command "help" - 工作树作用域是自动的——默认情况下,你只会看到自己工作树的标签页。
- 没有的裸浏览器命令仍会目标当前工作树的活跃标签页,这很方便但在多进程自动化中不够健壮。
--page - 标签页创建会自动激活新标签页——后无需执行
tab create。tab switch - 如果需要,浏览器命令会自动切换活跃工作树——无需手动激活工作树。
Important Constraints
重要约束
- Orca CLI only talks to a running Orca editor.
- Terminal handles are ephemeral and tied to the current Orca runtime. If Orca restarts, handles change.
- supports
terminal wait(wait for process exit) and--for exit(wait for a recognized agent CLI like Claude Code, Gemini, or Codex to finish its current task, detected via OSC title transitions).--for tui-idledefaults to a 5-minute timeout iftui-idleis not specified. Real coding tasks routinely take 15-60 minutes — always pass--timeout-msexplicitly.--timeout-ms - Orca is the source of truth for worktree/terminal state; do not duplicate that state with manual assumptions.
- The public command is the interface users experience. Agents should validate and use that surface, not repo-local implementation entrypoints.
orca - The 120-line terminal output buffer () is for status monitoring, not result extraction.
terminal read
- Orca CLI仅与运行中的Orca编辑器通信。
- 终端句柄是临时的,与当前Orca运行时绑定。如果Orca重启,句柄会更改。
- 支持
terminal wait(等待进程退出)和--for exit(等待识别的代理CLI如Claude Code、Gemini或Codex完成当前任务,通过OSC标题转换检测)。如果未指定--for tui-idle,--timeout-ms默认超时为5分钟。实际编码任务通常需要15-60分钟——请始终显式传递tui-idle。--timeout-ms - Orca是工作树/终端状态的事实来源;不要通过手动假设复制该状态。
- 公开的命令是用户体验的界面。代理应验证并使用此界面,而非仓库本地的实现入口点。
orca - 120行的终端输出缓冲区()用于状态监控,而非结果提取。
terminal read
References
参考资料
See these docs in this repo when behavior is unclear:
docs/orca-cli-focused-v1-status.mddocs/orca-cli-v1-spec.mddocs/orca-runtime-layer-design.md
当行为不明确时,请查看此仓库中的以下文档:
docs/orca-cli-focused-v1-status.mddocs/orca-cli-v1-spec.mddocs/orca-runtime-layer-design.md