OpenCode 2.2.1 發布,最值得注意的是新增 /goal 命令:在 TUI 或 Desktop 輸入 /goal <objective>,會話會持續推進直到審查者確認目標達成,並可用 pause、resume、clear 控制。同時加入需手動開啟的 image_generate 工具,可建立或編輯圖片並指定預設模型;Desktop 預設啟用可搜尋的新模型選擇器,活動欄能直接檢視並停止後臺 shell 輸出。
其中 /goal 讓 agent 推進到目標達成才停,改變了會話的執行方式;配合影像生成、可搜尋模型選擇器與 provider 入口重整,對日常用 OpenCode 寫程式碼的人影響最直接。
亮點
持續朝著目標推進:在 TUI 或 Desktop 中執行 /goal <objective>,讓會話持續進行,直到審查者確認目標已達成。使用 /goal pause 、 /goal resume 或 /goal clear 來控制它。(#59437)
生成影像:啟用 experimental.image_generate,讓智慧體使用新的 image_generate 工具建立或編輯影像。你可以選擇通過 experimental.image_generate.model 設定其預設模型。(#59939,#60096)
檢查後臺 Shell:在 Desktop 的活動膠囊中點選正在執行的 shell,即可檢視其即時輸出並在不離開選單的情況下停止它。(#59496)
新的預設模型選擇器:從重新設計的模型選擇器中搜尋收藏項、最近使用的模型、提供商和變體,該選擇器現已成為 Desktop 中的預設選擇器。(#59997)
破壞性變更
@opencode/ai 提供商移除與重新命名
這些變更影響直接匯入 @opencode/ai 的程式碼。它們不會改變 CLI、Desktop 或 HTTP API。
fal、Black Forest Labs、Replicate 和 Stability 提供商已被移除,連同它們的 ./providers/fal 、 ./providers/black-forest-labs 、 ./providers/replicate 和 ./providers/stability 入口點也一併移除。(#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)
每個提供商的 configure() 輸入型別現在命名為 Config,例如 Groq.LanguageModelOptions → Groq.Config,並且當每個設定都是可選的時候,model() 設定也是可選的。(#59765)
核心
改進
新增 /goal <objective>,帶有暫停、恢復和清除控制,並自動進行進度審查,直到目標達成。(#59437)
通過 /schedule、智慧體工具和 experimental.schedules 新增可選的定時提示。(#59401,#59457)
新增可選的 image_generate 工具,用於後臺影像建立和編輯,支援自動或配置的模型選擇。(#59939,#60096)
在 Codex 登入後提供 GPT Image 2,並新增 MiniMax 和 Meta Muse 影像生成支援。(#60085,#59929,#60081)
為 OpenRouter、DigitalOcean 和 Venice 新增 Responses API 支援,包括自由形式工具。(#59991,#59963)
通過合併捕獲和避免重複的忽略檔案工作來提升快照效能。(#59419)
缺陷修復
在將工具輸出適配到上下文視窗時,保留更多上下文餘量。(#59934)
正確重試提供商限流,而不是將其報告為上下文溢位。(#59649)
以 OpenRouter、Google 和 Vercel Grok 所期望的格式傳送影像編輯引用和影像尺寸。(#60067,#59927)
將憑據後設資料和提示快取設定排除在模型設定和變體之外。(#60057,#59500)
在使用拆分索引的倉庫中保持 Git 快照正常工作。(#59417)
僅在工作區啟用時公開 Console 網頁搜尋。(#59592)
改進 Code Mode 對解析錯誤、停滯的 await 和類 Promise 搜尋結果的診斷。(#59834,#59749,#59981)
TUI
改進
在提示符下方顯示 /goal 狀態,並提供用於暫停、恢復或清除它的對話方塊。(#59437)
錯誤修復
顯示在第一個模型步驟之前發生的執行失敗。(#60079)
在繼續執行的子代理執行期間保持活動指示器可見。(#59950)
連線到本地伺服器時,正確傳送貼上的影像和 PDF 路徑。(#59833)
改進空的 /usage 對話方塊中的間距。感謝 @Tarquinen。(#59918)
Desktop
改進
新增 /reload 以在不重啟的情況下重新載入配置。(#59887)
將重新設計的可搜尋模型選擇器設為預設,包含專門的“收藏”和“最近”部分,以及可通過鍵盤訪問的提供商控制元件。(#59997)
當你從活動膠囊中選擇後臺 shell 時,顯示即時輸出和停止操作。(#59496)
在編輯器膠囊中顯示 /goal 狀態和操作。(#59437)
重新設計整合對話方塊,並始終在模型選擇器中包含 OpenCode 免費模型。(#59976,#60047)
向會話位置選單新增專案、工作樹、在應用中開啟和終端操作。(#59607)
最佳化專案和 worktree 選擇、命令搜尋、提示歷史焦點、composer 模型標籤和產物預覽控制元件。(#59397,#59604,#59626,#59735,#59657)
在你撰寫第一條評論時高亮引用的時間線內容。(#59286)
使用實驗性媒體 URI 時,將草稿附件位元組保留在本地。(#59104)
錯誤修復
連線到每個外掛伺服器的事件流時,遵循其配置的端點。(#60087)
當 Desktop 縮放處於活動狀態時,將可達的滾動邊界視為末尾。(#60034)
防止 shell 文字透過複製按鈕顯示,並避免在關閉側面板時重新設定轉錄樣式。(#59901,#59878)
修復工具後設資料格式錯誤時導致時間線崩潰的問題。(#59736)
使下拉選單立即開啟,並確保在工具提示互動後新建會話位置快捷鍵仍能正常工作。(#59268,#59680)
移除 macOS 應用程式圖示的邊緣光暈。(#59900)
SDK
改進
新增 `client.experimental.schedule.{create,list,get,pause,resume,delete}` 用於管理定時提示詞。(#59457)
將實驗性生成的客戶端方法歸組到 `client.experimental` 下;之前的位置保留為已棄用的別名,直到下一個次要版本發布。(#59072)
通過 Promise AI 客戶端暴露壓縮功能。(#59987)
為 OpenRouter、DigitalOcean 和 Venice 新增自由形式工具支援和 Responses 路由。(#59963,#59991)
擴充套件
改進
新增實驗性的 `experimental.idle` Session 鉤子,使外掛可以在會話進入空閒狀態之前繼續工作。(#59437)
允許 Code Mode 擴充套件全域性變數返回 Effects 並宣告所需服務。(#59948)
為 GUI 外掛新增自訂 composer-pill 彈出框。(#59437)
原文
Highlights
Keep Working Toward a Goal : Run /goal <objective> in the TUI or Desktop to let the session continue until a reviewer confirms the objective is met. Use /goal pause , /goal resume , or /goal clear to control it. ( #59437 )
Generate Images : Enable experimental.image_generate to let agents create or edit images with the new image_generate tool. You can optionally set its default model with experimental.image_generate.model . ( #59939 , #60096 )
Inspect Background Shells : Click a running shell in the Desktop activity pill to see its live output and stop it without leaving the menu. ( #59496 )
New Default Model Picker : Search favorites, recent models, providers, and variants from the redesigned model picker, which is now the default in Desktop. ( #59997 )
Breaking changes
@opencode/ai provider removals and renames
These changes affect code that imports @opencode/ai directly. They don't change the CLI, Desktop, or the HTTP API.
The fal, Black Forest Labs, Replicate, and Stability providers are removed, along with their ./providers/fal , ./providers/black-forest-labs , ./providers/replicate , and ./providers/stability entry points. ( #59977 )
Five legacy entry points are removed. Import the nested paths instead, which 2.2.0 already exports: ./providers/amazon-bedrock-mantle → ./providers/amazon-bedrock/mantle , and ./providers/google-vertex-chat , -interactions , -mistral , and -responses → ./providers/google-vertex/chat , /interactions , /mistral , and /responses . ( #59506 )
Each provider's configure() input type is now named Config , for example Groq.LanguageModelOptions → Groq.Config , and model() settings are optional when every setting is optional. ( #59765 )
Core
Improvements
Add /goal <objective> with pause, resume, and clear controls, plus automatic progress review until the objective is met. ( #59437 )
Add opt-in scheduled prompts through /schedule , agent tools, and experimental.schedules . ( #59401 , #59457 )
Add the opt-in image_generate tool for background image creation and editing, with automatic or configured model selection. ( #59939 , #60096 )
Offer GPT Image 2 after Codex sign-in and add MiniMax and Meta Muse image generation support. ( #60085 , #59929 , #60081 )
Add Responses API support for OpenRouter, DigitalOcean, and Venice, including freeform tools. ( #59991 , #59963 )
Improve snapshot performance by coalescing captures and avoiding repeated ignore-file work. ( #59419 )
Bug fixes
Preserve more context headroom when fitting tool output into the context window. ( #59934 )
Retry provider throttling correctly instead of reporting it as context overflow. ( #59649 )
Send image-edit references and image sizes in the formats expected by OpenRouter, Google, and Vercel Grok. ( #60067 , #59927 )
Keep credential metadata and prompt-cache settings out of model settings and variants. ( #60057 , #59500 )
Keep Git snapshots working in repositories that use a split index. ( #59417 )
Expose Console web search only when the workspace enables it. ( #59592 )
Improve Code Mode diagnostics for parse errors, stalled awaits, and promise-like search results. ( #59834 , #59749 , #59981 )
TUI
Improvements
Show /goal status below the prompt and provide a dialog for pausing, resuming, or clearing it. ( #59437 )
Bug fixes
Show execution failures that occur before the first model step. ( #60079 )
Keep the activity spinner visible while a continued subagent runs. ( #59950 )
Send pasted image and PDF paths correctly when connected to a local server. ( #59833 )
Improve spacing in an empty /usage dialog. Thanks @Tarquinen . ( #59918 )
Desktop
Improvements
Add /reload to reload configuration without restarting. ( #59887 )
Make the redesigned searchable model picker the default, with dedicated Favorites and Recent sections and keyboard-accessible provider controls. ( #59997 )
Show live output and a Stop action when you select a background shell from the activity pill. ( #59496 )
Show /goal state and actions in a composer pill. ( #59437 )
Redesign the integrations dialog and always include OpenCode free models in the model picker. ( #59976 , #60047 )
Add project, worktree, open-in-app, and terminal actions to the session location menu. ( #59607 )
Refine project and worktree selection, command search, prompt-history focus, composer model labels, and artifact preview controls. ( #59397 , #59604 , #59626 , #59735 , #59657 )
Highlight quoted timeline content while you write its first comment. ( #59286 )
Keep draft attachment bytes local when using experimental media URIs. ( #59104 )
Bug fixes
Follow each plugin server’s configured endpoint when connecting to its event stream. ( #60087 )
Treat the reachable scroll boundary as the end when Desktop zoom is active. ( #60034 )
Prevent shell text from showing through copy buttons and avoid restyling the transcript when closing a side panel. ( #59901 , #59878 )
Keep rendering malformed tool metadata instead of crashing the timeline. ( #59736 )
Make dropdowns open immediately and keep the new-session location shortcut working after tooltip interactions. ( #59268 , #59680 )
Remove edge halos from macOS application icons. ( #59900 )
SDK
Improvements
Add client.experimental.schedule.{create,list,get,pause,resume,delete} for managing scheduled prompts. ( #59457 )
Group experimental generated-client methods under client.experimental ; previous locations remain as deprecated aliases until the next minor release. ( #59072 )
Expose compaction through the Promise AI client. ( #59987 )
Add freeform tool support and Responses routes for OpenRouter, DigitalOcean, and Venice. ( #59963 , #59991 )
Extensions
Improvements
Add the experimental experimental.idle Session hook so plugins can continue work before a session goes idle. ( #59437 )
Let Code Mode extension globals return Effects and declare required services. ( #59948 )
Add custom composer-pill popovers for GUI plugins. ( #59437 )