feat: opencode2 (V2) 适配壳 —— 共享核心 + 双入口架构 - #26
Open
Hotakus wants to merge 14 commits into
Open
Conversation
- 10 个斜杠命令完整移植 V1 行为(currency/rate/section/config/lang/balance/balance-key/debug-skills/session/session-back),V2 Promise 对话框形态
- 4 语言 i18n 共用 src/i18n.ts;part adapter 替代 V2 缺失的 state.part
- 补余额轮询 pollBalance(手动 key + OpenCode 自动复用 + 缓存 + 超时 + 防竞态)
- 修 router 会话判断(Route = {type: session, sessionID})
- 底部栏 i18n + 余额真实数据 + unsupported 隐藏余额段;颜色经共享 mapTheme 与侧边栏同源
- 主题 primary → hue.interactive[300](v1-migrate 官方映射 + 亮端 step)
- 侧边栏 slot prepend(排在官方信息之前)
- part():tool 输出从 state.content[] 拼接为 V1 state.output;user 顶层 text 构造 text part - provider:V2 模型列表组装 V1 形状(modelID/完整引用/短名多 key 注册),单价与累计节省恢复 - 回合:按 V2 官方 terminal 规则(finish 非 tool-calls/unknown 或 error)划分, 同回合 assistant 消息注入合成 parentID,本回合调用次数/末次成本逻辑成立 - step-finish:有 cost 的 assistant 消息合成(V1 每条消息 1 个) - CACHE_TUI_LANG 环境变量 + auto-clear override(切换主会话清子代理视图)
- 对齐官方 dialog-model 用法:data.location.model.list(location.ref)(无参数返回空) - provider 改响应式 getter:每次访问实时组装,location 数据同步后面板自动重算
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能
为 opencode2(V2 TUI)提供适配壳,采用「共享核心 + 双入口」架构,V1 行为保持不变:
src/core/):纯逻辑抽取(格式化 / 颜色 / token 估算 / 货币),V1/V2 复用src/panel/):TokenCachePanel 单一组件 + PanelApi 契约tui/index.js双格式:{id, tui, setup})——同一包、同一 package.json 服务两端:tui字段(V1 面板)setup字段(V2 面板)——exports["./tui"]指向该入口,V2 的 npm 包名方式可直接加载src/v2/):context → PanelApi 适配、{id, setup}入口、完整面板/底部栏/10 命令/余额/分布/技能/单价/主题自适应验证
tsc --noEmit通过、npm run build通过TODO(全部已实现)
发布策略