chore: generate

This commit is contained in:
opencode-agent[bot]
2026-02-09 17:35:30 +00:00
parent dc53086c1e
commit d578f80f00
222 changed files with 6797 additions and 6590 deletions

View File

@@ -18,13 +18,13 @@ opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]
#### 選項
|旗幟|描述 |默認 |
| --------------- | ----------------------------------- | ---------------- |
| `--port` |監聽端口 | `4096` |
| `--hostname` |監聽的主機名 | `127.0.0.1` |
| `--mdns` |啟用 mDNS 發現 | `false` |
| 旗幟 | 描述 | 默認 |
| --------------- | --------------------- | ---------------- |
| `--port` | 監聽端口 | `4096` |
| `--hostname` | 監聽的主機名 | `127.0.0.1` |
| `--mdns` | 啟用 mDNS 發現 | `false` |
| `--mdns-domain` | mDNS 服務的自定義域名 | `opencode.local` |
| `--cors` |允許的其他瀏覽器來源 | `[]` |
| `--cors` | 允許的其他瀏覽器來源 | `[]` |
`--cors` 可以多次傳遞:
@@ -89,116 +89,116 @@ opencode 服務器公開以下 API。
### 全球的
|方法|路徑|描述 |回應 |
| ------ | ---------------- | ------------------------------ | ------------------------------------ |
| `GET` | `/global/health` |獲取服務器運行狀況和版本 | `{ healthy: true, version: string }` |
| `GET` | `/global/event` |獲取全局事件SSE 流)|事件流 |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ---------------- | ------------------------ | ------------------------------------ |
| `GET` | `/global/health` | 獲取服務器運行狀況和版本 | `{ healthy: true, version: string }` |
| `GET` | `/global/event` | 獲取全局事件SSE 流) | 事件流 |
---
### 專案
|方法|路徑|描述 |回應 |
| ------ | ------------------ | ----------------------- | --------------------------------------------- |
| `GET` | `/project` |列出所有項目 | <a href={typesUrl}><code>項目[]</code></a> |
| `GET` | `/project/current` |獲取當前項目 | <a href={typesUrl}><code>項目</code></a> |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ------------------ | ------------ | ------------------------------------------ |
| `GET` | `/project` | 列出所有項目 | <a href={typesUrl}><code>項目[]</code></a> |
| `GET` | `/project/current` | 獲取當前項目 | <a href={typesUrl}><code>項目</code></a> |
---
### 路徑和VCS
|方法|路徑|描述 |回應 |
| ------ | ------- | ------------------------------------ | ------------------------------------------- |
| `GET` | `/path` |獲取當前路徑| <a href={typesUrl}><code>路徑</code></a> |
| `GET` | `/vcs` |獲取當前項目的 VCS 信息 | <a href={typesUrl}><code>VcsInfo</code></a> |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ------- | ----------------------- | ------------------------------------------- |
| `GET` | `/path` | 獲取當前路徑 | <a href={typesUrl}><code>路徑</code></a> |
| `GET` | `/vcs` | 獲取當前項目的 VCS 信息 | <a href={typesUrl}><code>VcsInfo</code></a> |
---
### 實例
|方法|路徑|描述 |回應 |
| ------ | ------------------- | ---------------------------- | --------- |
| `POST` | `/instance/dispose` |處置當前實例 | `boolean` |
| 方法 | 路徑 | 描述 | 回應 |
| ------ | ------------------- | ------------ | --------- |
| `POST` | `/instance/dispose` | 處置當前實例 | `boolean` |
---
### 配置
|方法|路徑|描述 |回應 |
| ------- | ------------------- | --------------------------------- | ---------------------------------------------------------------------------------------- |
| `GET` | `/config` |獲取配置信息 | <a href={typesUrl}><code>配置</code></a> |
| `PATCH` | `/config` |更新配置| <a href={typesUrl}><code>配置</code></a> |
| `GET` | `/config/providers` |列出提供商和默認模型 | `{ providers: `<a href={typesUrl}>提供商[]</a>`, default: { [key: string]: string } }` |
| 方法 | 路徑 | 描述 | 回應 |
| ------- | ------------------- | -------------------- | -------------------------------------------------------------------------------------- |
| `GET` | `/config` | 獲取配置信息 | <a href={typesUrl}><code>配置</code></a> |
| `PATCH` | `/config` | 更新配置 | <a href={typesUrl}><code>配置</code></a> |
| `GET` | `/config/providers` | 列出提供商和默認模型 | `{ providers: `<a href={typesUrl}>提供商[]</a>`, default: { [key: string]: string } }` |
---
### 提供者
|方法|路徑|描述 |回應 |
| ------ | -------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------- |
| `GET` | `/provider` |列出所有提供商 | `{ all: `<a href={typesUrl}>提供商[]</a>`, default: {...}, connected: string[] }` |
| `GET` | `/provider/auth` |獲取提供商身份驗證方法 | `{ [providerID: string]: `<a href={typesUrl}>ProviderAuthMethod[]</a>` }` |
| `POST` | `/provider/{id}/oauth/authorize` |使用 OAuth 授權提供商 | <a href={typesUrl}><code>ProviderAuthAuthorization</code></a> |
| `POST` | `/provider/{id}/oauth/callback` |處理提供商的 OAuth 回調 | `boolean` |
| 方法 | 路徑 | 描述 | 回應 |
| ------ | -------------------------------- | ----------------------- | --------------------------------------------------------------------------------- |
| `GET` | `/provider` | 列出所有提供商 | `{ all: `<a href={typesUrl}>提供商[]</a>`, default: {...}, connected: string[] }` |
| `GET` | `/provider/auth` | 獲取提供商身份驗證方法 | `{ [providerID: string]: `<a href={typesUrl}>ProviderAuthMethod[]</a>` }` |
| `POST` | `/provider/{id}/oauth/authorize` | 使用 OAuth 授權提供商 | <a href={typesUrl}><code>ProviderAuthAuthorization</code></a> |
| `POST` | `/provider/{id}/oauth/callback` | 處理提供商的 OAuth 回調 | `boolean` |
---
### 會議
|方法|路徑|描述 |筆記|
| -------- | ---------------------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------- |
| `GET` | `/session` |列出所有會話 |返回 <a href={typesUrl}><code>Session[]</code></a> |
| `POST` | `/session` |創建新會話 |正文:`{ parentID?, title? }`,返回 <a href={typesUrl}><code>Session</code></a> |
| `GET` | `/session/status` |獲取所有會話的會話狀態 |返回 `{ [sessionID: string]: `<a href={typesUrl}>SessionStatus</a>` }` |
| `GET` | `/session/:id` |獲取會話詳細信息 |返回 <a href={typesUrl}><code>Session</code></a> |
| `DELETE` | `/session/:id` |刪除會話及其所有數據 |返回 `boolean` |
| `PATCH` | `/session/:id` |更新會話屬性 |正文:`{ title? }`,返回 <a href={typesUrl}><code>Session</code></a> |
| `GET` | `/session/:id/children` |獲取會話的子會話 |返回 <a href={typesUrl}><code>Session[]</code></a> |
| `GET` | `/session/:id/todo` |獲取會話的待辦事項列表 |返回 <a href={typesUrl}><code>Todo[]</code></a> |
| `POST` | `/session/:id/init` |分析應用程序並創建`AGENTS.md` |主體:`{ messageID, providerID, modelID }`,返回`boolean` |
| `POST` | `/session/:id/fork` |在消息中分叉現有會話 |正文:`{ messageID? }`,返回 <a href={typesUrl}><code>Session</code></a> |
| `POST` | `/session/:id/abort` |中止正在運行的會話 |返回 `boolean` |
| `POST` | `/session/:id/share` |分享會議 |返回 <a href={typesUrl}><code>Session</code></a> |
| `DELETE` | `/session/:id/share` |取消共享會話 |返回 <a href={typesUrl}><code>Session</code></a> |
| `GET` | `/session/:id/diff` |獲取本次會話的差異 |查詢:`messageID?`,返回 <a href={typesUrl}><code>FileDiff[]</code></a> |
| `POST` | `/session/:id/summarize` |會議總結 |主體:`{ providerID, modelID }`,返回`boolean` |
| `POST` | `/session/:id/revert` |回复消息 |主體:`{ messageID, partID? }`,返回`boolean` |
| `POST` | `/session/:id/unrevert` |恢復所有已恢復的消息 |返回 `boolean` |
| `POST` | `/session/:id/permissions/:permissionID` |回復權限請求 |主體:`{ response, remember? }`,返回`boolean` |
| 方法 | 路徑 | 描述 | 筆記 |
| -------- | ---------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------- |
| `GET` | `/session` | 列出所有會話 | 返回 <a href={typesUrl}><code>Session[]</code></a> |
| `POST` | `/session` | 創建新會話 | 正文:`{ parentID?, title? }`,返回 <a href={typesUrl}><code>Session</code></a> |
| `GET` | `/session/status` | 獲取所有會話的會話狀態 | 返回 `{ [sessionID: string]: `<a href={typesUrl}>SessionStatus</a>` }` |
| `GET` | `/session/:id` | 獲取會話詳細信息 | 返回 <a href={typesUrl}><code>Session</code></a> |
| `DELETE` | `/session/:id` | 刪除會話及其所有數據 | 返回 `boolean` |
| `PATCH` | `/session/:id` | 更新會話屬性 | 正文:`{ title? }`,返回 <a href={typesUrl}><code>Session</code></a> |
| `GET` | `/session/:id/children` | 獲取會話的子會話 | 返回 <a href={typesUrl}><code>Session[]</code></a> |
| `GET` | `/session/:id/todo` | 獲取會話的待辦事項列表 | 返回 <a href={typesUrl}><code>Todo[]</code></a> |
| `POST` | `/session/:id/init` | 分析應用程序並創建`AGENTS.md` | 主體:`{ messageID, providerID, modelID }`,返回`boolean` |
| `POST` | `/session/:id/fork` | 在消息中分叉現有會話 | 正文:`{ messageID? }`,返回 <a href={typesUrl}><code>Session</code></a> |
| `POST` | `/session/:id/abort` | 中止正在運行的會話 | 返回 `boolean` |
| `POST` | `/session/:id/share` | 分享會議 | 返回 <a href={typesUrl}><code>Session</code></a> |
| `DELETE` | `/session/:id/share` | 取消共享會話 | 返回 <a href={typesUrl}><code>Session</code></a> |
| `GET` | `/session/:id/diff` | 獲取本次會話的差異 | 查詢:`messageID?`,返回 <a href={typesUrl}><code>FileDiff[]</code></a> |
| `POST` | `/session/:id/summarize` | 會議總結 | 主體:`{ providerID, modelID }`,返回`boolean` |
| `POST` | `/session/:id/revert` | 回复消息 | 主體:`{ messageID, partID? }`,返回`boolean` |
| `POST` | `/session/:id/unrevert` | 恢復所有已恢復的消息 | 返回 `boolean` |
| `POST` | `/session/:id/permissions/:permissionID` | 回復權限請求 | 主體:`{ response, remember? }`,返回`boolean` |
---
### 留言
|方法|路徑|描述 |筆記|
| ------ | --------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET` | `/session/:id/message` |列出會話中的消息 |查詢:`limit?`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>Part[]</a>`}[]` |
| `POST` | `/session/:id/message` |發送消息並等待回复 |主體:`{ messageID?, model?, agent?, noReply?, system?, tools?, parts }`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| `GET` | `/session/:id/message/:messageID` |獲取消息詳情 |返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| `POST` | `/session/:id/prompt_async` |異步發送消息(無需等待)| body與`/session/:id/message`相同,返回`204 No Content` |
| `POST` | `/session/:id/command` |執行斜杠命令|主體:`{ messageID?, agent?, model?, command, arguments }`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| `POST` | `/session/:id/shell` |運行 shell 命令 |主體:`{ agent, model?, command }`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| 方法 | 路徑 | 描述 | 筆記 |
| ------ | --------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET` | `/session/:id/message` | 列出會話中的消息 | 查詢:`limit?`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>Part[]</a>`}[]` |
| `POST` | `/session/:id/message` | 發送消息並等待回复 | 主體:`{ messageID?, model?, agent?, noReply?, system?, tools?, parts }`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| `GET` | `/session/:id/message/:messageID` | 獲取消息詳情 | 返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| `POST` | `/session/:id/prompt_async` | 異步發送消息(無需等待) | body與`/session/:id/message`相同,返回`204 No Content` |
| `POST` | `/session/:id/command` | 執行斜杠命令 | 主體:`{ messageID?, agent?, model?, command, arguments }`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
| `POST` | `/session/:id/shell` | 運行 shell 命令 | 主體:`{ agent, model?, command }`,返回`{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` |
---
### 命令
|方法|路徑|描述 |回應 |
| ------ | ---------- | ----------------- | --------------------------------------------- |
| `GET` | `/command` |列出所有命令 | <a href={typesUrl}><code>命令[]</code></a> |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ---------- | ------------ | ------------------------------------------ |
| `GET` | `/command` | 列出所有命令 | <a href={typesUrl}><code>命令[]</code></a> |
---
### 文件
|方法|路徑|描述 |回應 |
| ------ | ------------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------- |
| `GET` | `/find?pattern=<pat>` |搜索文件中的文本 |具有 `path`、`lines`、`line_number`、`absolute_offset`、`submatches` | 的匹配對像數組 |
| `GET` | `/find/file?query=<q>` |按名稱查找文件和目錄 | `string[]`(路徑)|
| `GET` | `/find/symbol?query=<q>` |查找工作區符號 | <a href={typesUrl}><code>符號[]</code></a> |
| `GET` | `/file?path=<path>` |列出文件和目錄 | <a href={typesUrl}><code>FileNode[]</code></a> |
| `GET` | `/file/content?path=<p>` |讀取文件 | <a href={typesUrl}><code>FileContent</code></a> |
| `GET` | `/file/status` |獲取跟踪文件的狀態 | <a href={typesUrl}><code>文件[]</code></a> |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ------------------------ | -------------------- | -------------------------------------------------------------------- | -------------- |
| `GET` | `/find?pattern=<pat>` | 搜索文件中的文本 | 具有 `path`、`lines`、`line_number`、`absolute_offset`、`submatches` | 的匹配對像數組 |
| `GET` | `/find/file?query=<q>` | 按名稱查找文件和目錄 | `string[]`(路徑) |
| `GET` | `/find/symbol?query=<q>` | 查找工作區符號 | <a href={typesUrl}><code>符號[]</code></a> |
| `GET` | `/file?path=<path>` | 列出文件和目錄 | <a href={typesUrl}><code>FileNode[]</code></a> |
| `GET` | `/file/content?path=<p>` | 讀取文件 | <a href={typesUrl}><code>FileContent</code></a> |
| `GET` | `/file/status` | 獲取跟踪文件的狀態 | <a href={typesUrl}><code>文件[]</code></a> |
#### `/find/file`查詢參數
@@ -212,76 +212,76 @@ opencode 服務器公開以下 API。
### 工具(實驗)
|方法|路徑|描述 |回應 |
| ------ | ------------------------------------------- | ---------------------------------------- | -------------------------------------------- |
| `GET` | `/experimental/tool/ids` |列出所有工具 ID | <a href={typesUrl}><code>ToolID</code></a> |
| `GET` | `/experimental/tool?provider=<p>&model=<m>` |列出具有模型 JSON 架構的工具 | <a href={typesUrl}><code>工具列表</code></a> |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ------------------------------------------- | ---------------------------- | -------------------------------------------- |
| `GET` | `/experimental/tool/ids` | 列出所有工具 ID | <a href={typesUrl}><code>ToolID</code></a> |
| `GET` | `/experimental/tool?provider=<p>&model=<m>` | 列出具有模型 JSON 架構的工具 | <a href={typesUrl}><code>工具列表</code></a> |
---
### LSP、格式化程序和 MCP
|方法|路徑|描述 |回應 |
| ------ | ------------ | -------------------------- | -------------------------------------------------------- |
| `GET` | `/lsp` |獲取LSP服務器狀態| <a href={typesUrl}><code>LSPStatus[]</code></a> |
| `GET` | `/formatter` |獲取格式化程序狀態 | <a href={typesUrl}><code>FormatterStatus[]</code></a> |
| `GET` | `/mcp` |獲取 MCP 服務器狀態 | `{ [name: string]: `<a href={typesUrl}>MCPStatus</a>` }` |
| `POST` | `/mcp` |動態添加MCP服務器| body: `{ name, config }`, 返回 MCP 狀態對象 |
| 方法 | 路徑 | 描述 | 回應 |
| ------ | ------------ | ------------------- | -------------------------------------------------------- |
| `GET` | `/lsp` | 獲取LSP服務器狀態 | <a href={typesUrl}><code>LSPStatus[]</code></a> |
| `GET` | `/formatter` | 獲取格式化程序狀態 | <a href={typesUrl}><code>FormatterStatus[]</code></a> |
| `GET` | `/mcp` | 獲取 MCP 服務器狀態 | `{ [name: string]: `<a href={typesUrl}>MCPStatus</a>` }` |
| `POST` | `/mcp` | 動態添加MCP服務器 | body: `{ name, config }`, 返回 MCP 狀態對象 |
---
### 代理商
|方法|路徑|描述 |回應 |
| ------ | -------- | ------------------------- | ------------------------------------------- |
| `GET` | `/agent` |列出所有可用的代理 | <a href={typesUrl}><code>代理[]</code></a> |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | -------- | ------------------ | ------------------------------------------ |
| `GET` | `/agent` | 列出所有可用的代理 | <a href={typesUrl}><code>代理[]</code></a> |
---
### 記錄
|方法|路徑|描述 |回應 |
| ------ | ------ | ------------------------------------------------------------ | --------- |
| `POST` | `/log` |寫入日誌條目。正文:`{ service, level, message, extra? }` | `boolean` |
| 方法 | 路徑 | 描述 | 回應 |
| ------ | ------ | --------------------------------------------------------- | --------- |
| `POST` | `/log` | 寫入日誌條目。正文:`{ service, level, message, extra? }` | `boolean` |
---
### TUI
|方法|路徑|描述 |回應 |
| ------ | ----------------------- | ------------------------------------------- | ---------------------- |
| `POST` | `/tui/append-prompt` |將文本附加到提示 | `boolean` |
| `POST` | `/tui/open-help` |打開幫助對話框 | `boolean` |
| `POST` | `/tui/open-sessions` |打開會話選擇器 | `boolean` |
| `POST` | `/tui/open-themes` |打開主題選擇器 | `boolean` |
| `POST` | `/tui/open-models` |打開模型選擇器 | `boolean` |
| `POST` | `/tui/submit-prompt` |提交當前提示| `boolean` |
| `POST` | `/tui/clear-prompt` |清除提示| `boolean` |
| `POST` | `/tui/execute-command` |執行命令(`{ command }`) | `boolean` |
| `POST` | `/tui/show-toast` |顯示祝酒 (`{ title?, message, variant }`) | `boolean` |
| `GET` | `/tui/control/next` |等待下一個控制請求 |控制請求對象|
| `POST` | `/tui/control/response` |響應控制請求 (`{ body }`) | `boolean` |
| 方法 | 路徑 | 描述 | 回應 |
| ------ | ----------------------- | ----------------------------------------- | ------------ |
| `POST` | `/tui/append-prompt` | 將文本附加到提示 | `boolean` |
| `POST` | `/tui/open-help` | 打開幫助對話框 | `boolean` |
| `POST` | `/tui/open-sessions` | 打開會話選擇器 | `boolean` |
| `POST` | `/tui/open-themes` | 打開主題選擇器 | `boolean` |
| `POST` | `/tui/open-models` | 打開模型選擇器 | `boolean` |
| `POST` | `/tui/submit-prompt` | 提交當前提示 | `boolean` |
| `POST` | `/tui/clear-prompt` | 清除提示 | `boolean` |
| `POST` | `/tui/execute-command` | 執行命令(`{ command }`) | `boolean` |
| `POST` | `/tui/show-toast` | 顯示祝酒 (`{ title?, message, variant }`) | `boolean` |
| `GET` | `/tui/control/next` | 等待下一個控制請求 | 控制請求對象 |
| `POST` | `/tui/control/response` | 響應控制請求 (`{ body }`) | `boolean` |
---
### 授權
|方法|路徑|描述 |回應 |
| ------ | ----------- | --------------------------------------------------------------- | --------- |
| `PUT` | `/auth/:id` |設置身份驗證憑據。正文必須與提供者架構匹配 | `boolean` |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ----------- | ------------------------------------------ | --------- |
| `PUT` | `/auth/:id` | 設置身份驗證憑據。正文必須與提供者架構匹配 | `boolean` |
---
### 活動
|方法|路徑|描述 |回應 |
| ------ | -------- | ----------------------------------------------------------------------------- | ------------------------- |
| `GET` | `/event` |服務器發送的事件流。第一個活動是`server.connected`,然後是巴士活動 |服務器發送的事件流 |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | -------- | ------------------------------------------------------------------ | ------------------ |
| `GET` | `/event` | 服務器發送的事件流。第一個活動是`server.connected`,然後是巴士活動 | 服務器發送的事件流 |
---
### 文件
|方法|路徑|描述 |回應 |
| ------ | ------ | ------------------------- | --------------------------- |
| `GET` | `/doc` | OpenAPI 3.1 規範 |具有 OpenAPI 規範的 HTML 頁面 |
| 方法 | 路徑 | 描述 | 回應 |
| ----- | ------ | ---------------- | ----------------------------- |
| `GET` | `/doc` | OpenAPI 3.1 規範 | 具有 OpenAPI 規範的 HTML 頁面 |