← 返回更新日志

OpenCode v2.2.1

2026-10-29 · GitHub 原文
### 亮点 - **持续朝目标推进**:在 TUI 或桌面端运行 `/goal <objective>`,让会话持续运行,直到审核者确认目标已达成。使用 `/goal pause`、`/goal resume` 或 `/goal clear` 进行控制。([#59437](https://github.com/anomalyco/opencode/pull/59437)) - **生成图像**:启用 `experimental.image_generate`,即可让代理使用新的 `image_generate` 工具创建或编辑图像。你也可以通过 `experimental.image_generate.model` 可选地设置其默认模型。([#59939](https://github.com/anomalyco/opencode/pull/59939),[#60096](https://github.com/anomalyco/opencode/pull/60096)) - **查看后台 Shell**:在桌面端的活动状态栏中点击正在运行的 Shell,即可查看其实时输出,并在不离开菜单的情况下停止它。([#59496](https://github.com/anomalyco/opencode/pull/59496)) - **全新的默认模型选择器**:在重新设计的模型选择器中搜索收藏模型、最近使用的模型、提供商和变体;该选择器现在是桌面端的默认选择器。([#59997](https://github.com/anomalyco/opencode/pull/59997)) ### 破坏性变更 #### `@opencode/ai` 提供商移除与重命名 这些变更会影响直接导入 `@opencode/ai` 的代码,但不会改变 CLI、桌面端或 HTTP API。 - 移除 fal、Black Forest Labs、Replicate 和 Stability 提供商,同时移除对应的 `./providers/fal`、`./providers/black-forest-labs`、`./providers/replicate` 和 `./providers/stability` 入口。([#59977](https://github.com/anomalyco/opencode/pull/59977)) - 移除五个旧版入口。请改为导入嵌套路径;2.2.0 已经导出了这些路径:`./providers/amazon-bedrock-mantle` → `./providers/amazon-bedrock/mantle`,以及 `./providers/google-vertex-chat`、`-interactions`、`-mistral` 和 `-responses` → `./providers/google-vertex/chat`、`/interactions`、`/mistral` 和 `/responses`。([#59506](https://github.com/anomalyco/opencode/pull/59506)) - 每个提供商的 `configure()` 输入类型现在统一命名为 `Config`,例如 `Groq.LanguageModelOptions` → `Groq.Config`;当 `model()` 的所有设置均为可选时,这些设置也可以省略。([#59765](https://github.com/anomalyco/opencode/pull/59765)) ### 核心 #### 改进 - 添加 `/goal <objective>`,支持暂停、恢复和清除控制,并在目标达成前自动检查进度。([#59437](https://github.com/anomalyco/opencode/pull/59437)) - 通过 `/schedule`、代理工具和 `experimental.schedules` 添加可选启用的定时提示。([#59401](https://github.com/anomalyco/opencode/pull/59401),[#59457](https://github.com/anomalyco/opencode/pull/59457)) - 添加可选启用的 `image_generate` 工具,用于在后台创建和编辑图像,并支持自动或配置模型选择。([#59939](https://github.com/anomalyco/opencode/pull/59939),[#60096](https://github.com/anomalyco/opencode/pull/60096)) - Codex 登录后提供 GPT Image 2,并添加对 MiniMax 和 Meta Muse 图像生成的支持。([#60085](https://github.com/anomalyco/opencode/pull/60085),[#59929](https://github.com/anomalyco/opencode/pull/59929),[#60081](https://github.com/anomalyco/opencode/pull/60081)) - 为 OpenRouter、DigitalOcean 和 Venice 添加 Responses API 支持,包括自由格式工具。([#59991](https://github.com/anomalyco/opencode/pull/59991),[#59963](https://github.com/anomalyco/opencode/pull/59963)) - 通过合并捕获操作并避免重复处理忽略文件,提升快照性能。([#59419](https://github.com/anomalyco/opencode/pull/59419)) #### Bug 修复 - 在将工具输出放入上下文窗口时,保留更多上下文余量。([#59934](https://github.com/anomalyco/opencode/pull/59934)) - 正确重试提供商限流,而不是将其报告为上下文溢出。([#59649](https://github.com/anomalyco/opencode/pull/59649)) - 按照 OpenRouter、Google 和 Vercel Grok 预期的格式发送图像编辑引用和图像尺寸。([#60067](https://github.com/anomalyco/opencode/pull/60067),[#59927](https://github.com/anomalyco/opencode/pull/59927)) - 不再将凭据元数据和提示缓存设置混入模型设置和变体中。([#60057](https://github.com/anomalyco/opencode/pull/60057),[#59500](https://github.com/anomalyco/opencode/pull/59500)) - 在使用拆分索引的仓库中保持 Git 快照正常工作。([#59417](https://github.com/anomalyco/opencode/pull/59417)) - 仅当工作区启用 Console 网页搜索时才提供该功能。([#59592](https://github.com/anomalyco/opencode/pull/59592)) - 改进 Code Mode 对解析错误、停滞的 await 以及类似 Promise 的搜索结果的诊断。([#59834](https://github.com/anomalyco/opencode/pull/59834),[#59749](https://github.com/anomalyco/opencode/pull/59749),[#59981](https://github.com/anomalyco/opencode/pull/59981)) ### TUI #### 改进 - 在提示符下方显示 `/goal` 状态,并提供用于暂停、恢复或清除目标的对话框。([#59437](https://github.com/anomalyco/opencode/pull/59437)) #### Bug 修复 - 显示首次模型步骤之前发生的执行失败。([#60079](https://github.com/anomalyco/opencode/pull/60079)) - 在持续运行的子代理执行期间保持活动加载指示器可见。([#59950](https://github.com/anomalyco/opencode/pull/59950)) - 连接到本地服务器时,正确发送粘贴的图像和 PDF 路径。([#59833](https://github.com/anomalyco/opencode/pull/59833)) - 改进空 `/usage` 对话框中的间距。感谢 [@Tarquinen](https://github.com/Tarquinen)。([#59918](https://github.com/anomalyco/opencode/pull/59918)) ### 桌面端 #### 改进 - 添加 `/reload`,无需重启即可重新加载配置。([#59887](https://github.com/anomalyco/opencode/pull/59887)) - 将重新设计的可搜索模型选择器设为默认选择器,并新增专门的“收藏”和“最近使用”区块,以及支持键盘操作的提供商控件。([#59997](https://github.com/anomalyco/opencode/pull/59997)) - 从活动状态栏中选择后台 Shell 时,显示实时输出和“停止”操作。([#59496](https://github.com/anomalyco/opencode/pull/59496)) - 在编辑器状态栏中显示 `/goal` 状态和相关操作。([#59437](https://github.com/anomalyco/opencode/pull/59437)) - 重新设计集成对话框,并始终在模型选择器中包含 OpenCode 免费模型。([#59976](https://github.com/anomalyco/opencode/pull/59976),[#60047](https://github.com/anomalyco/opencode/pull/60047)) - 在会话位置菜单中添加项目、工作树、在应用中打开以及终端操作。([#59607](https://github.com/anomalyco/opencode/pull/59607)) - 优化项目和工作树选择、命令搜索、提示历史焦点、编辑器模型标签以及工件预览控件。([#59397](https://github.com/anomalyco/opencode/pull/59397),[#59604](https://github.com/anomalyco/opencode/pull/59604),[#59626](https://github.com/anomalyco/opencode/pull/59626),[#59735](https://github.com/anomalyco/opencode/pull/59735),[#59657](https://github.com/anomalyco/opencode/pull/59657)) - 在你撰写时间线内容的第一条评论时,高亮显示引用的内容。([#59286](https://github.com/anomalyco/opencode/pull/59286)) - 使用实验性媒体 URI 时,将草稿附件字节保留在本地。([#59104](https://github.com/anomalyco/opencode/pull/59104)) #### Bug 修复 - 连接插件服务器的事件流时,遵循每个插件服务器配置的端点。([#60087](https://github.com/anomalyco/opencode/pull/60087)) - 启用桌面端缩放时,将可到达的滚动边界视为末尾。([#60034](https://github.com/anomalyco/opencode/pull/60034)) - 防止 Shell 文本透过复制按钮显示,并避免关闭侧边栏时重新设置会话记录样式。([#59901](https://github.com/anomalyco/opencode/pull/59901),[#59878](https://github.com/anomalyco/opencode/pull/59878)) - 即使工具元数据格式错误,也继续渲染,而不是导致时间线崩溃。([#59736](https://github.com/anomalyco/opencode/pull/59736)) - 让下拉菜单立即打开,并确保新会话位置快捷方式在与工具提示交互后仍能正常工作。([#59268](https://github.com/anomalyco/opencode/pull/59268),[#59680](https://github.com/anomalyco/opencode/pull/59680)) - 移除 macOS 应用图标边缘的光晕。([#59900](https://github.com/anomalyco/opencode/pull/59900)) ### SDK #### 改进 - 添加 `client.experimental.schedule.{create,list,get,pause,resume,delete}`,用于管理定时提示。([#59457](https://github.com/anomalyco/opencode/pull/59457)) - 将实验性生成客户端方法归入 `client.experimental`;原有位置在下一个次要版本发布前仍作为已弃用别名保留。([#59072](https://github.com/anomalyco/opencode/pull/59072)) - 通过 Promise AI 客户端提供压缩功能。([#59987](https://github.com/anomalyco/opencode/pull/59987)) - 为 OpenRouter、DigitalOcean 和 Venice 添加自由格式工具支持及 Responses 路由。([#59963](https://github.com/anomalyco/opencode/pull/59963),[#59991](https://github.com/anomalyco/opencode/pull/59991)) ### 扩展 #### 改进 - 添加实验性 `experimental.idle` Session 钩子,使插件能够在会话进入空闲状态前继续执行工作。([#59437](https://github.com/anomalyco/opencode/pull/59437)) - 允许 Code Mode 扩展全局对象返回 Effects,并声明所需服务。([#59948](https://github.com/anomalyco/opencode/pull/59948)) - 为 GUI 插件添加自定义编辑器状态栏弹出窗口。([#59437](https://github.com/anomalyco/opencode/pull/59437))