@botiverse/oar-cli

中文文档
0.81.0发布于 2026/11/01Apache-2.0ES Module构建来源已验证

Command-line interface for controlling and observing agent runtimes with OAR

原始使用文档
文档目录4 节
  1. Commands
  2. oar run : the run-and-verify entrypoint
  3. The oar-voyage/3 format
  4. Native inventories

@botiverse/oar-cli

Command-line interface for @botiverse/oar. It installs the oar executable without adding CLI dependencies to applications that only use the library.

npx @botiverse/oar-cli list
oar installation codex
oar orient claude codex --depth account --json
oar usage claude
oar models claude
oar upgrade --check
oar login claude
oar logout claude
oar run claude "What does this repo do?"

Commands

The registered runtimes are OAR's defaultRuntimes, cursor, which the CLI adds itself on the @cursor/sdk 1.1.0 it depends on, and the community runtimes (Mister Morph) from @botiverse/oar/community (src/runtimes.ts). Commands that take an optional [runtime] cover every registered runtime when it is omitted (or all). A runtime whose probe or read fails (a timeout, a network error) reports its error in place of a result, the others still report, and the exit code is 1.

  • oar orient [runtime...]: one bounded snapshot, with --depth local (default), account, or models. Local skips unproven local auth readers; deeper reads can refresh credentials, run key commands and load trusted configuration. --json preserves complete evidence, --customization opts into native inventories in an empty directory, and --timeout <ms> bounds the whole read. Unlike per-runtime query commands, a partial snapshot exits 0; invalid arguments or a rejected call fail. See orientation.
  • oar list: registered runtimes and their capabilities.
  • oar installation [runtime] (alias detect): probe local installation and version, no account or usage I/O. shadowed lists the other copies of the command on PATH after the one found, which never run.
  • oar usage [runtime]: account usage for each available installation.
  • oar models [runtime]: models each available installation can run right now (login state, plan, and configured providers included). The first column after the runtime is the id to pass to oar run --model, (default) marks the model a session runs when none is set, * the default effort level and service tier, and (disabled: reason) a model the runtime lists but will not run as is. --cwd <dir> lists for the directory a session would run in (project configuration there can change the list; it starts the runtime there, so only use a directory you trust); --json prints the ListModelsResult per runtime, --timeout <ms> bounds each query.
  • oar run <runtime> <prompt>: run one turn in a fresh (or --resumed) session and show its progress; below.
  • oar upgrade [runtime]: upgrade each available installation with the runtime's own updater, one at a time; --check only reports the version the updater would install, --json prints the reports, --timeout <ms> bounds each runtime's check and its updater run. The exit code is 1 when an upgrade failed or left the version unchanged, or when a runtime could not be probed. See runtime updates.
  • oar login <runtime>: log a runtime in through its own login. It prints the sign-in URL or device code and reads a pasted code from stdin, without echoing it, when the runtime asks for one; Ctrl-C cancels. --status only reports whether each runtime (or the named one) is logged in, --json prints events, prompts and the result (or the status reports) as JSON, --timeout <ms> bounds the login (or each status query). The exit code is 0 when logged in, 130 when cancelled, 1 otherwise. See runtime login.
  • oar logout <runtime>: log a runtime out through its own logout. It prints logged out when the runtime's status then reads logged out (or, when the status cannot tell, the runtime reported success); an API key in the environment that the status still reads is still_logged_in. --json prints the result as JSON, --timeout <ms> bounds the logout. The exit code is 0 when logged out, 1 otherwise.
  • oar mcp: serve subagents over MCP on stdio, so an agent (claude, codex, any MCP client) can delegate tasks to other runtimes: run waits for a subagent's turn, spawn / send / wait work in parallel, and runtimes, list, interrupt and close complete the tool set. Flags: --runtimes <ids> (comma-separated; all by default), --max-running <n> (default 4), --max-depth <n> (default 1: subagents do not spawn), --cwd <dir> (for subagents that name none), --log-dir <dir> (each subagent's records as an oar-voyage log). run, wait and list return structured objects with output schemas, plus the same JSON as text (shapes). Subagents run with full permissions. A codex agent starts MCP servers with a reduced environment, so give its oar entry env_vars = ["OAR_SUBAGENT_DEPTH"] for the nesting limit to hold. See subagents.
  • oar skills|commands|mcps|tools [runtime]: native inventories, see below.

oar run: the run-and-verify entrypoint

By default run prints one opening line naming the session (the id --resume takes; [resumed <id> …] on a resumed run) and the model, service tier and effort the runtime reported while opening, when it did (the model() / serviceTier() / effort() folds, never the flags echoed). Then it prints readable progress from the session's events(): assistant text verbatim (coalesced into blocks via coalesceText), and other facts as bracketed meta lines ([compacting: threshold], [compacted] or [compaction failed] reason, [retry 2/3] reason, [waiting for app: type], [task shell started]). Turn starts, usage, model, service tier and effort reports, native user message echoes, queued, withdrawn and dropped inputs, task updates, tool input and progress deltas and oar's own answers to app requests print nothing (the full mapping is src/progress.ts):

[session 01a0e982-… · model gpt-6-luna · effort low]
[thinking] The user wants...
[Running command] cat package.json
[Ran command] (0.4s)
The repo is a pnpm workspace...
[turn completed]

The exit code is 0 only when the turn completed. The first Ctrl-C interrupts the turn and exits 130; a second one disposes the session at once. The process ends at most a second after the session is disposed, even when a runtime left a handle behind (@cursor/sdk 1.0.35 to 1.0.37 kept a 24 hour timer for each shell call they moved to the background; src/exit.ts).

Flags:

  • --model <model>: runtime-native model identifier.
  • --effort <level>: runtime-native reasoning-effort level, one of the model's levels in oar models (SessionOptions.effort). A runtime that would run another level, or has none, refuses the open, and run exits 1 with the runtime's word (claude applies effort medium … although bogus was requested).
  • --service-tier <tier>: native service-tier ID from oar models, or default to explicitly clear a tier. Applied and checked at open, including resume. Codex uses priority (not the fast alias) or flex; Claude lists fast only for supporting models. Other runtimes refuse the option.
  • --resume <sessionId>: resume the runtime-native session a previous run printed, with a fresh stream (SessionOptions.resume); pair it with a different --model / --effort to switch between turns.
  • --image <file...>: send image files with the prompt (png, jpeg, gif, webp) as the runtime's own image input (InputOptions.images); a runtime without image input rejects the prompt.
  • --json: print the session records (RawEvents) as JSON lines instead of progress (frames with their verbatim native payload and oar's events, plus the request/response records of the run), and a final {"outcome": ...} line.
  • --record <file>: also write the run as an oar-voyage/3 JSONL log (in both output modes; the log always carries every record).

A run without a record is an anecdote. When a run is meant to be evidence (verifying a doc claim, reproducing a bug, checking a runtime's live behavior), pass --record so the claim points at a log anyone can read:

  1. Run live, don't infer. A claim about runtime behavior is verified by running it, not by reading code or remembering last time.
  2. Record the evidence. Keep the voyage log and cite it in the conclusion, so "it works" is checkable later.
  3. Triage what you see. If reality differs from the docs, decide which moved: the runtime changed, so fix the doc; or oar regressed, so file the bug and pin it with a test (docs/development.md has the test layers).
  4. Report honest outcomes. A turn that failed or aborted is a finding, not something to retry until it looks clean: the exit code and the runtime's own turn_ended event in the log say what happened.

The oar-voyage/3 format

--record writes one JSON object per line, discriminated by kind. The format is defined and owned by @botiverse/oar, which exports the line builders and the openVoyage recorder; other tools (such as the oar-coxswain cockpit) may write or read it as consumers.

  • Line 1 is always the header: {"kind":"header","format":"oar-voyage/3","runtime","model?","effort?","serviceTier?","cwd","sessionId","startedAt","recorder"} (model, effort and serviceTier are omitted when none was requested; recorder names the writer, e.g. oar-cli/<version>).
  • {"kind":"record","record":{...}}: one RawEvent verbatim, no filtering or re-timestamping. Human inputs are already in the stream as request records, so there is no separate submission line; the seq on each record is the order.
  • {"kind":"end","at","reason"}: always the last line; a log without it is a truncated capture.

All timestamps are Unix epoch milliseconds on the same clock as each record's receivedAt. Lines are written synchronously in arrival order, so a crashed run still leaves a readable prefix.

Native inventories

oar skills codex --cwd /path/to/project
oar commands pi --cwd /path/to/project
oar mcps claude --cwd /path/to/project --timeout 15000
oar tools pi

Each command prints JSON. --cwd defaults to the current working directory; --timeout <ms> bounds each runtime. These are independent discovery queries: no existing agent is inspected and no model prompt is sent, though native startup can load extensions and connect configured MCP servers. Check kind, view and partial before displaying results: mcp-only excludes built-in tools, unsupported queries are not empty lists, and a pending or failed MCP connection can produce a partial catalog. See the inventory contract.

版本与发布记录

@botiverse/oar-cli 共发布 144 个版本,首次发布于 2026/08/26;过去 12 个月发布了 144 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.81.0latest2026/11/012 天前
0.80.22026/10/313 天前
0.80.12026/10/313 天前
0.80.02026/10/313 天前
0.79.02026/10/303 天前
0.78.02026/10/304 天前

关于 @botiverse/oar-cli 的常见问题

@botiverse/oar-cli 是什么?

用于使用ar控制和观察代理运行时的命令行接口

如何安装 @botiverse/oar-cli?

在项目目录运行 npm install @botiverse/oar-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 oar,可以用 npx oar 直接运行。

@botiverse/oar-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/botiverse__oar-cli 是否存在。

@botiverse/oar-cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@botiverse/oar-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@botiverse/oar-cli 可以商用吗?

@botiverse/oar-cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@botiverse/oar-cli 还在维护吗?

最新版本 0.81.0 发布于 2026/11/01(2 天前);至今共发布 144 个版本,其中过去 12 个月发布了 144 个;首次发布于 2026/08/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。