Skip to content

feat(v2): V2 适配壳 + V1/V2 统一入口(双格式) - #17

Merged
Hotakus merged 18 commits into
masterfrom
feat/v2-port
Sep 21, 2026
Merged

Hotakus merged 18 commits into
masterfrom
feat/v2-port

Conversation

@Hotakus

@Hotakus Hotakus commented Aug 17, 2026

Copy link
Copy Markdown
Owner

功能

为 opencode2(V2 TUI)提供适配壳,采用「共享核心 + 双入口」架构,V1 行为保持不变:

  1. 共享核心(src/core/):纯逻辑抽取(类型/格式化/颜色/KV/usage 读取/状态机)
  2. 共享面板组件(src/panel/):SubAgentPanel + PanelApi 契约(V1/V2 复用)
  3. V1/V2 统一入口(tui/index.js 双格式:{id, tui, setup})——同一包、同一 package.json 服务两端:
    • V1(opencode)读 tui 字段(V1 面板)
    • V2(opencode2)读 setup 字段(V2 面板)——exports["./tui"] 指向该入口
  4. V2 适配壳(src/v2/):context → PanelApi(tool 事件归一化 / execution 事件映射 / client.interrupt 真实取消)
  5. 构建双入口:dist/tui.js(V1)+ dist/v2.js(V2,external 宿主依赖)

验证

  • tsc --noEmit 通过、npm run build 通过
  • V1:重构后无回归(面板/命令/取消/轮询/KV)
  • V2:面板实时显示/真实取消(→cancelled)/进入会话/会话 ID 复制/9 命令/TTL/重启持久化/Token 计数/清除标记——全部实测通过

平台差异

  • todo 进度:V2 无 todo 数据源(UI 的 todo 行自动隐藏——平台数据缺失,非缺陷)

发布策略

  • 统一版本 beta 通道发布(@beta——V1/V2 双格式)
  • 待 opencode2 正式上线后合并本 PR 并发布正式版

@Hotakus Hotakus mentioned this pull request Aug 17, 2026
@Hotakus Hotakus linked an issue Aug 17, 2026 that may be closed by this pull request
@Hotakus
Hotakus merged commit c469856 into master Sep 21, 2026
2 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.

V2(opencode2)支持

2 participants