Skip to content

feat(acp): add Oh My Pi (omp) as a built-in ACP agent#963

Merged
GCWing merged 1 commit into
GCWing:mainfrom
harryfan1985:feat/omp-acp-runtime
May 30, 2026
Merged

feat(acp): add Oh My Pi (omp) as a built-in ACP agent#963
GCWing merged 1 commit into
GCWing:mainfrom
harryfan1985:feat/omp-acp-runtime

Conversation

@harryfan1985
Copy link
Copy Markdown
Contributor

概要

Oh My Pi (omp) 作为内置 ACP agent 接入 FlowChat —— 复用 BitFun 已有的 ACP client 子系统,而不是为它新造一套运行时。

OMP 原生支持 omp acp(Agent Client Protocol over JSON-RPC),因此可以直接走现有 ACP 通道,免费获得:子进程拉起、JSON-RPC、工具路由(bash→terminal/createread→fs/read_text_file、edit→session/request_permission 走 BitFun 权限)、会话持久化、模型选择、PATH 探测等全部能力。

背景:这是 #931(multi-runtime support)的替代方案。#931 试图为 OMP/Claude 新写自定义子进程适配器,但 BitFun 早已有成熟的 ACP 集成(opencode / claude-code / codex),且 OMP/Claude 都会说 ACP——详见我在 #931 的分析。本 PR 用约 1/60 的改动量达成同样目标。

改动

  • builtin_clients.rs:新增 preset { id:"omp", command:"omp", args:["acp"] }。Native ACP、无 adapter(同 opencode)。per-workspace 的 ACP 会话菜单是动态从 get_acp_clients 读的,所以 OMP 会自动出现。
  • 用户自管安装:OMP 面向 bun 运行时、通过自身安装器分发(bun install -g @oh-my-pi/pi-coding-agentcurl -fsSL https://omp.sh/install | sh),BitFun 的 npm 安装器无法提供。因此把 install_package 改为 Option 并对 omp 设 None(其余 preset 保持 Some(...));BitFun 只检测 PATH 上的 omp 并启动它。
  • AcpAgentsConfig.tsx:设置目录新增 OMP;按 native ACP 处理(NATIVE_ACP_PRESET_IDS,无 adapter),并标为自管安装(SELF_MANAGED_INSTALL_PRESET_IDS),隐藏"一键安装 CLI"按钮——该行仅反映 PATH 检测到的安装状态。

前置条件

用户需自行安装 omp(bun install -g @oh-my-pi/pi-coding-agentcurl -fsSL https://omp.sh/install | sh),使其在 PATH 上可用。BitFun 只提供接入,不负责安装。

测试

  • cargo test -p bitfun-acp —— 45 passed(含新增 omp_is_a_native_acp_preset,断言无 adapter、无 installer)。
  • vitest AcpAgentsConfig + workspaceAcpMenuClients —— 10 passed。
  • tsc --noEmit —— clean。

🤖 Generated with Claude Code

Integrate OMP via BitFun's existing ACP client subsystem instead of a bespoke
runtime — OMP speaks the Agent Client Protocol natively through `omp acp`, so it
reuses the entire battle-tested ACP path (subprocess spawn, JSON-RPC, tool
routing, permissions, session persistence, model selection, PATH probing).

- builtin_clients.rs: new preset { id: "omp", command: "omp", args: ["acp"] }.
  Native ACP, no adapter (like opencode). Makes OMP appear automatically in the
  per-workspace ACP session menu (which lists clients dynamically).
- OMP is user-managed: it targets the bun runtime and ships via its own
  installer (`bun install -g @oh-my-pi/pi-coding-agent` or
  `curl -fsSL https://omp.sh/install | sh`), which BitFun's npm-based installer
  cannot provide. So `install_package` becomes Option and is None for omp;
  BitFun only detects `omp` on PATH and launches it. The other presets keep
  their npm installers (now Some(...)).
- AcpAgentsConfig.tsx: add OMP to the settings catalog; treat it as native ACP
  (NATIVE_ACP_PRESET_IDS, no adapter) and as self-managed
  (SELF_MANAGED_INSTALL_PRESET_IDS) so the one-click "Install CLI" action is
  hidden — the row just reflects PATH-detected install state.

Verified: cargo test -p bitfun-acp (45 passed, incl. omp_is_a_native_acp_preset
asserting no adapter + no installer); vitest AcpAgentsConfig +
workspaceAcpMenuClients (10 passed); tsc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@GCWing GCWing requested a review from wgqqqqq May 30, 2026 09:06
@GCWing GCWing merged commit c553976 into GCWing:main May 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants