Skip to content

feat: add OpenCode adapter as a native Codex Desktop harness - #19

Open
twodogegg wants to merge 1 commit into
BytePioneer-AI:mainfrom
twodogegg:feat/opencode-adapter
Open

feat: add OpenCode adapter as a native Codex Desktop harness#19
twodogegg wants to merge 1 commit into
BytePioneer-AI:mainfrom
twodogegg:feat/opencode-adapter

Conversation

@twodogegg

Copy link
Copy Markdown

改动说明

将 OpenCode 以一等 Harness 接入 Codex Desktop,复用 Grok 的 ACP CLI adapter 架构,实现 HarnessAdapter 契约。

新增:@codexhost/adapter-opencode

  • acp-transport.ts:通过 opencode acp 以 stdio JSON-RPC 通信;inspect()session/newconfigOptions 构建模型目录
  • opencode-models.ts:OpenCode 模型 id 可含 /,编解码为 transport-safe 的不透明 ref(/~2f
  • opencode-history.ts / opencode-storage.ts:从 ~/.local/share/opencode/opencode.db 恢复会话历史(session 表用 metadata 列)
  • opencode-usage.ts:usage 记账
  • opencode-adapter.ts:实现 HarnessAdapter(模型目录、thinking 选项、会话/turn 执行、历史恢复、usage)

接线

  • protocol-core:transport-model 编解码与 case "opencode" 路由分类
  • host-runtime:adapter 注册(CODEXHOST_OPENCODE_COMMAND 覆盖默认命令路径)、approval 服务名
  • desktop-control:production controller enabledAgents 加入 opencode
  • renderer-extension:agent 选择器、侧栏图标、binding probe、模型选择器新增 模型搜索框(OpenCode 模型较多时可按名称/ref 过滤)

文档 / 测试

  • README 支持矩阵新增 OpenCode 列
  • 同步更新受影响的 host-runtime / desktop-control 测试

本地实测

  • inspect() 返回 121 个模型 + thinking 选项(Low/High/Max)
  • 会话打开、turn 执行、流式输出正常
  • 模型搜索框在桌面端验证通过(点击输入框不会误关菜单)

Wire OpenCode through the ACP CLI adapter path, modeled after the Grok
integration, with the same HarnessAdapter contract:

- New @codexhost/adapter-opencode package with an ACP transport, model
  catalog built from configOptions, SQLite history recovery, and usage
  accounting
- Encode OpenCode model ids (which may contain '/') into transport-safe
  opaque refs and decode them back when selecting models
- Register the adapter in host-runtime adapter composition with
  CODEXHOST_OPENCODE_COMMAND override, classify transport-model routes in
  protocol-core, surface OpenCode in the production controller's
  enabled agents, and render it in the agent picker, sidebar icons, and
  binding probe
- Add a searchable model submenu so large model catalogs (e.g. OpenCode)
  stay navigable
- Update README support matrix and affected host-runtime/controller tests
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

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.

1 participant