|
|
@@ -18,8 +18,8 @@ opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]
|
|
|
|
|
|
#### Параметры
|
|
|
|
|
|
-| Флаг | Описание | По умолчанию |
|
|
|
-| ----- | ---------------------------------------------- | ------------ |
|
|
|
+| Флаг | Описание | По умолчанию |
|
|
|
+| --------------- | ----------------------------------- | ---------------- |
|
|
|
| `--port` | Port to listen on | `4096` |
|
|
|
| `--hostname` | Hostname to listen on | `127.0.0.1` |
|
|
|
| `--mdns` | Enable mDNS discovery | `false` |
|
|
|
@@ -89,43 +89,43 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Глобальный
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ------------------------------------------------ | ------------------ |
|
|
|
-| `GET` | `/global/health` | Get server health and version | `{ healthy: true, version: string }` |
|
|
|
-| `GET` | `/global/event` | Get global events (SSE stream) | Event stream |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ---------------- | ------------------------------ | ------------------------------------ |
|
|
|
+| `GET` | `/global/health` | Get server health and version | `{ healthy: true, version: string }` |
|
|
|
+| `GET` | `/global/event` | Get global events (SSE stream) | Event stream |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Проект
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ----------------------- | -------------------------------------------- |
|
|
|
-| `GET` | `/project` | List all projects | <a href={typesUrl}><code>Project[]</code></a> |
|
|
|
-| `GET` | `/project/current` | Get the current project | <a href={typesUrl}><code>Project</code></a> |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ------------------ | ----------------------- | --------------------------------------------- |
|
|
|
+| `GET` | `/project` | List all projects | <a href={typesUrl}><code>Project[]</code></a> |
|
|
|
+| `GET` | `/project/current` | Get the current project | <a href={typesUrl}><code>Project</code></a> |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Путь и система контроля версий
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | -------------------------------------------- | ------------------------------------------- |
|
|
|
-| `GET` | `/path` | Get the current path | <a href={typesUrl}><code>Path</code></a> |
|
|
|
-| `GET` | `/vcs` | Get VCS info for the current project | <a href={typesUrl}><code>VcsInfo</code></a> |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ------- | ------------------------------------ | ------------------------------------------- |
|
|
|
+| `GET` | `/path` | Get the current path | <a href={typesUrl}><code>Path</code></a> |
|
|
|
+| `GET` | `/vcs` | Get VCS info for the current project | <a href={typesUrl}><code>VcsInfo</code></a> |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Пример
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ------------------------- | ----- |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ------ | ------------------- | ---------------------------- | --------- |
|
|
|
| `POST` | `/instance/dispose` | Dispose the current instance | `boolean` |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Конфигурация
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ----------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ------- | ------------------- | --------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
|
| `GET` | `/config` | Get config info | <a href={typesUrl}><code>Config</code></a> |
|
|
|
| `PATCH` | `/config` | Update config | <a href={typesUrl}><code>Config</code></a> |
|
|
|
| `GET` | `/config/providers` | List providers and default models | `{ providers: `<a href={typesUrl}>Provider[]</a>`, default: { [key: string]: string } }` |
|
|
|
@@ -134,8 +134,8 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Поставщик
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ----------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ------ | -------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------- |
|
|
|
| `GET` | `/provider` | List all providers | `{ all: `<a href={typesUrl}>Provider[]</a>`, default: {...}, connected: string[] }` |
|
|
|
| `GET` | `/provider/auth` | Get provider authentication methods | `{ [providerID: string]: `<a href={typesUrl}>ProviderAuthMethod[]</a>` }` |
|
|
|
| `POST` | `/provider/{id}/oauth/authorize` | Authorize a provider using OAuth | <a href={typesUrl}><code>ProviderAuthAuthorization</code></a> |
|
|
|
@@ -145,8 +145,8 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Сессии
|
|
|
|
|
|
-| Метод | Путь | Описание | Примечания |
|
|
|
-| ----- | ----- | -------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
|
+| Метод | Путь | Описание | Примечания |
|
|
|
+| -------- | ---------------------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
|
| `GET` | `/session` | List all sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
|
|
| `POST` | `/session` | Create a new session | body: `{ parentID?, title? }`, returns <a href={typesUrl}><code>Session</code></a> |
|
|
|
| `GET` | `/session/status` | Get session status for all sessions | Returns `{ [sessionID: string]: `<a href={typesUrl}>SessionStatus</a>` }` |
|
|
|
@@ -170,8 +170,8 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Сообщения
|
|
|
|
|
|
-| Метод | Путь | Описание | Примечания |
|
|
|
-| ----- | ----- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
|
+| Метод | Путь | Описание | Примечания |
|
|
|
+| ------ | --------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
| `GET` | `/session/:id/message` | List messages in a session | query: `limit?`, returns `{ info: `<a href={typesUrl}>Message</a>`, parts: `<a href={typesUrl}>Part[]</a>`}[]` |
|
|
|
| `POST` | `/session/:id/message` | Send a message and wait for response | body: `{ messageID?, model?, agent?, noReply?, system?, tools?, parts }`, returns `{ info: `<a href={typesUrl}>Message</a>`, parts: `<a href={typesUrl}>Part[]</a>`}` |
|
|
|
| `GET` | `/session/:id/message/:messageID` | Get message details | Returns `{ info: `<a href={typesUrl}>Message</a>`, parts: `<a href={typesUrl}>Part[]</a>`}` |
|
|
|
@@ -183,22 +183,22 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Команды
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ------------------ | --------------------------------------------- |
|
|
|
-| `GET` | `/command` | List all commands | <a href={typesUrl}><code>Command[]</code></a> |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ---------- | ----------------- | --------------------------------------------- |
|
|
|
+| `GET` | `/command` | List all commands | <a href={typesUrl}><code>Command[]</code></a> |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Файлы
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ------------------------------------ | --------------------------------------------------------------------------------------------- |
|
|
|
-| `GET` | `/find?pattern=<pat>` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` |
|
|
|
-| `GET` | `/find/file?query=<q>` | Find files and directories by name | `string[]` (paths) |
|
|
|
-| `GET` | `/find/symbol?query=<q>` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> |
|
|
|
-| `GET` | `/file?path=<path>` | List files and directories | <a href={typesUrl}><code>FileNode[]</code></a> |
|
|
|
-| `GET` | `/file/content?path=<p>` | Read a file | <a href={typesUrl}><code>FileContent</code></a> |
|
|
|
-| `GET` | `/file/status` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ------------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
|
+| `GET` | `/find?pattern=<pat>` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` |
|
|
|
+| `GET` | `/find/file?query=<q>` | Find files and directories by name | `string[]` (paths) |
|
|
|
+| `GET` | `/find/symbol?query=<q>` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> |
|
|
|
+| `GET` | `/file?path=<path>` | List files and directories | <a href={typesUrl}><code>FileNode[]</code></a> |
|
|
|
+| `GET` | `/file/content?path=<p>` | Read a file | <a href={typesUrl}><code>FileContent</code></a> |
|
|
|
+| `GET` | `/file/status` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> |
|
|
|
|
|
|
#### `/find/file` параметры запроса
|
|
|
|
|
|
@@ -212,17 +212,17 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Инструменты (Экспериментальные)
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ---------------------------------------------- | -------------------------------------------- |
|
|
|
-| `GET` | `/experimental/tool/ids` | List all tool IDs | <a href={typesUrl}><code>ToolIDs</code></a> |
|
|
|
-| `GET` | `/experimental/tool?provider=<p>&model=<m>` | List tools with JSON schemas for a model | <a href={typesUrl}><code>ToolList</code></a> |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ------------------------------------------- | ---------------------------------------- | -------------------------------------------- |
|
|
|
+| `GET` | `/experimental/tool/ids` | List all tool IDs | <a href={typesUrl}><code>ToolIDs</code></a> |
|
|
|
+| `GET` | `/experimental/tool?provider=<p>&model=<m>` | List tools with JSON schemas for a model | <a href={typesUrl}><code>ToolList</code></a> |
|
|
|
|
|
|
---
|
|
|
|
|
|
### LSP, форматтеры и MCP
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ----------------------------------- | --------------------------------------------------------- |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ------ | ------------ | -------------------------- | -------------------------------------------------------- |
|
|
|
| `GET` | `/lsp` | Get LSP server status | <a href={typesUrl}><code>LSPStatus[]</code></a> |
|
|
|
| `GET` | `/formatter` | Get formatter status | <a href={typesUrl}><code>FormatterStatus[]</code></a> |
|
|
|
| `GET` | `/mcp` | Get MCP server status | `{ [name: string]: `<a href={typesUrl}>MCPStatus</a>` }` |
|
|
|
@@ -232,24 +232,24 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Агенты
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ----------------------------- | ------------------------------------------- |
|
|
|
-| `GET` | `/agent` | List all available agents | <a href={typesUrl}><code>Agent[]</code></a> |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | -------- | ------------------------- | ------------------------------------------- |
|
|
|
+| `GET` | `/agent` | List all available agents | <a href={typesUrl}><code>Agent[]</code></a> |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Ведение журнала
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ---------------------------------------------------------------------- | ----- |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ------ | ------ | ------------------------------------------------------------ | --------- |
|
|
|
| `POST` | `/log` | Write log entry. Body: `{ service, level, message, extra? }` | `boolean` |
|
|
|
|
|
|
---
|
|
|
|
|
|
### ТУИ
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ---------------------------------------------- | ------------------------- |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ------ | ----------------------- | ------------------------------------------- | ---------------------- |
|
|
|
| `POST` | `/tui/append-prompt` | Append text to the prompt | `boolean` |
|
|
|
| `POST` | `/tui/open-help` | Open the help dialog | `boolean` |
|
|
|
| `POST` | `/tui/open-sessions` | Open the session selector | `boolean` |
|
|
|
@@ -266,22 +266,22 @@ For example, `http://localhost:4096/doc`. Use the spec to generate clients or in
|
|
|
|
|
|
### Авторизация
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ------------------------------------------------------------------------------------------- | ----- |
|
|
|
-| `PUT` | `/auth/:id` | Set authentication credentials. Body must match provider schema | `boolean` |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ----------- | --------------------------------------------------------------- | --------- |
|
|
|
+| `PUT` | `/auth/:id` | Set authentication credentials. Body must match provider schema | `boolean` |
|
|
|
|
|
|
---
|
|
|
|
|
|
### События
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ---------------------------------------------------------------------------------------------- | ------------------------------------ |
|
|
|
-| `GET` | `/event` | Server-sent events stream. First event is `server.connected`, then bus events | Server-sent events stream |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | -------- | ----------------------------------------------------------------------------- | ------------------------- |
|
|
|
+| `GET` | `/event` | Server-sent events stream. First event is `server.connected`, then bus events | Server-sent events stream |
|
|
|
|
|
|
---
|
|
|
|
|
|
### Документы
|
|
|
|
|
|
-| Метод | Путь | Описание | Ответ |
|
|
|
-| ----- | ----- | ------------------------ | -------------------------------------- |
|
|
|
-| `GET` | `/doc` | OpenAPI 3.1 specification | HTML page with OpenAPI spec |
|
|
|
+| Метод | Путь | Описание | Ответ |
|
|
|
+| ----- | ------ | ------------------------- | --------------------------- |
|
|
|
+| `GET` | `/doc` | OpenAPI 3.1 specification | HTML page with OpenAPI spec |
|