diff --git a/frontend/src/api/opencode-spec.json b/frontend/src/api/opencode-spec.json index d37ab48a..e6c39b59 100644 --- a/frontend/src/api/opencode-spec.json +++ b/frontend/src/api/opencode-spec.json @@ -6,6 +6,76 @@ "version": "0.0.3" }, "paths": { + "/global/health": { + "get": { + "operationId": "global.health", + "summary": "Get health", + "description": "Get health information about the OpenCode server.", + "responses": { + "200": { + "description": "Health information", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "healthy": { + "type": "boolean", + "const": true + }, + "version": { + "type": "string" + } + }, + "required": [ + "healthy", + "version" + ] + } + } + } + } + } + } + }, + "/global/event": { + "get": { + "operationId": "global.event", + "summary": "Get global events", + "description": "Subscribe to global events from the OpenCode system using server-sent events.", + "responses": { + "200": { + "description": "Event stream", + "content": { + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/GlobalEvent" + } + } + } + } + } + } + }, + "/global/dispose": { + "post": { + "operationId": "global.dispose", + "summary": "Dispose instance", + "description": "Clean up and dispose all OpenCode instances, releasing all resources.", + "responses": { + "200": { + "description": "Global disposed", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + } + } + }, "/project": { "get": { "operationId": "project.list", @@ -18,7 +88,8 @@ } } ], - "description": "List all projects", + "summary": "List all projects", + "description": "Get a list of projects that have been opened with OpenCode.", "responses": { "200": { "description": "List of projects", @@ -48,10 +119,11 @@ } } ], - "description": "Get the current project", + "summary": "Get current project", + "description": "Retrieve the currently active project that OpenCode is working with.", "responses": { "200": { - "description": "Current project", + "description": "Current project information", "content": { "application/json": { "schema": { @@ -63,6 +135,398 @@ } } }, + "/project/{projectID}": { + "patch": { + "operationId": "project.update", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "projectID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Update project", + "description": "Update project properties such as name, icon and color.", + "responses": { + "200": { + "description": "Updated project information", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "icon": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "color": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "/pty": { + "get": { + "operationId": "pty.list", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "List PTY sessions", + "description": "Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.", + "responses": { + "200": { + "description": "List of sessions", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pty" + } + } + } + } + } + } + }, + "post": { + "operationId": "pty.create", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Create PTY session", + "description": "Create a new pseudo-terminal (PTY) session for running shell commands and processes.", + "responses": { + "200": { + "description": "Created session", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pty" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "command": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "cwd": { + "type": "string" + }, + "title": { + "type": "string" + }, + "env": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/pty/{ptyID}": { + "get": { + "operationId": "pty.get", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Get PTY session", + "description": "Retrieve detailed information about a specific pseudo-terminal (PTY) session.", + "responses": { + "200": { + "description": "Session info", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pty" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + }, + "put": { + "operationId": "pty.update", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Update PTY session", + "description": "Update properties of an existing pseudo-terminal (PTY) session.", + "responses": { + "200": { + "description": "Updated session", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pty" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "size": { + "type": "object", + "properties": { + "rows": { + "type": "number" + }, + "cols": { + "type": "number" + } + }, + "required": [ + "rows", + "cols" + ] + } + } + } + } + } + } + }, + "delete": { + "operationId": "pty.remove", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Remove PTY session", + "description": "Remove and terminate a specific pseudo-terminal (PTY) session.", + "responses": { + "200": { + "description": "Session removed", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + } + }, + "/pty/{ptyID}/connect": { + "get": { + "operationId": "pty.connect", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Connect to PTY session", + "description": "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.", + "responses": { + "200": { + "description": "Connected session", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + } + }, "/config": { "get": { "operationId": "config.get", @@ -75,7 +539,8 @@ } } ], - "description": "Get config info", + "summary": "Get configuration", + "description": "Retrieve the current OpenCode configuration settings and preferences.", "responses": { "200": { "description": "Get config info", @@ -92,13 +557,6 @@ "patch": { "operationId": "config.update", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -107,7 +565,8 @@ } } ], - "description": "Update config", + "summary": "Update configuration", + "description": "Update OpenCode configuration settings and preferences.", "responses": { "200": { "description": "Successfully updated config", @@ -153,7 +612,8 @@ } } ], - "description": "List all tool IDs (including built-in and dynamically registered)", + "summary": "List tool IDs", + "description": "Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.", "responses": { "200": { "description": "Tool IDs", @@ -189,13 +649,6 @@ "type": "string" } }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "provider", @@ -213,7 +666,8 @@ "required": true } ], - "description": "List tools with JSON schema parameters for a provider/model", + "summary": "List tools", + "description": "Get a list of available tools with their JSON schema parameters for a specific provider and model combination.", "responses": { "200": { "description": "Tools", @@ -238,6 +692,34 @@ } } }, + "/instance/dispose": { + "post": { + "operationId": "instance.dispose", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Dispose instance", + "description": "Clean up and dispose the current OpenCode instance, releasing all resources.", + "responses": { + "200": { + "description": "Instance disposed", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + } + } + }, "/path": { "get": { "operationId": "path.get", @@ -250,7 +732,8 @@ } } ], - "description": "Get the current path", + "summary": "Get paths", + "description": "Retrieve the current working directory and related path information for the OpenCode instance.", "responses": { "200": { "description": "Path", @@ -265,6 +748,110 @@ } } }, + "/experimental/worktree": { + "post": { + "operationId": "worktree.create", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Create worktree", + "description": "Create a new git worktree for the current project.", + "responses": { + "200": { + "description": "Worktree created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Worktree" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorktreeCreateInput" + } + } + } + } + }, + "get": { + "operationId": "worktree.list", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "List worktrees", + "description": "List all sandbox worktrees for the current project.", + "responses": { + "200": { + "description": "List of worktree directories", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/vcs": { + "get": { + "operationId": "vcs.get", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Get VCS info", + "description": "Retrieve version control system (VCS) information for the current project, such as git branch.", + "responses": { + "200": { + "description": "VCS info", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VcsInfo" + } + } + } + } + } + } + }, "/session": { "get": { "operationId": "session.list", @@ -275,9 +862,34 @@ "schema": { "type": "string" } + }, + { + "in": "query", + "name": "start", + "schema": { + "type": "number" + }, + "description": "Filter sessions updated on or after this timestamp (milliseconds since epoch)" + }, + { + "in": "query", + "name": "search", + "schema": { + "type": "string" + }, + "description": "Filter sessions by title (case-insensitive)" + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "number" + }, + "description": "Maximum number of sessions to return" } ], - "description": "List all sessions", + "summary": "List sessions", + "description": "Get a list of all OpenCode sessions, sorted by most recently updated.", "responses": { "200": { "description": "List of sessions", @@ -297,13 +909,6 @@ "post": { "operationId": "session.create", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -312,7 +917,8 @@ } } ], - "description": "Create a new session", + "summary": "Create session", + "description": "Create a new OpenCode session for interacting with AI assistants and managing conversations.", "responses": { "200": { "description": "Successfully created session", @@ -347,6 +953,9 @@ }, "title": { "type": "string" + }, + "permission": { + "$ref": "#/components/schemas/PermissionRuleset" } } } @@ -355,17 +964,54 @@ } } }, - "/session/{id}": { + "/session/status": { + "get": { + "operationId": "session.status", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Get session status", + "description": "Retrieve the current status of all sessions, including active, idle, and completed states.", + "responses": { + "200": { + "description": "Get session status", + "content": { + "application/json": { + "schema": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "$ref": "#/components/schemas/SessionStatus" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + } + } + }, + "/session/{sessionID}": { "get": { "operationId": "session.get", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -375,7 +1021,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string", "pattern": "^ses.*" @@ -383,7 +1029,11 @@ "required": true } ], - "description": "Get session", + "summary": "Get session", + "description": "Retrieve detailed information about a specific OpenCode session.", + "tags": [ + "Session" + ], "responses": { "200": { "description": "Get session", @@ -420,13 +1070,6 @@ "delete": { "operationId": "session.delete", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -436,7 +1079,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string", "pattern": "^ses.*" @@ -444,7 +1087,8 @@ "required": true } ], - "description": "Delete a session and all its data", + "summary": "Delete session", + "description": "Delete a session and permanently remove all associated data, including messages and history.", "responses": { "200": { "description": "Successfully deleted session", @@ -481,20 +1125,6 @@ "patch": { "operationId": "session.update", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -504,14 +1134,15 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, "required": true } ], - "description": "Update session properties", + "summary": "Update session", + "description": "Update properties of an existing session, such as title or other metadata.", "responses": { "200": { "description": "Successfully updated session", @@ -552,6 +1183,14 @@ "properties": { "title": { "type": "string" + }, + "time": { + "type": "object", + "properties": { + "archived": { + "type": "number" + } + } } } } @@ -560,17 +1199,10 @@ } } }, - "/session/{id}/children": { + "/session/{sessionID}/children": { "get": { "operationId": "session.children", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -580,7 +1212,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string", "pattern": "^ses.*" @@ -588,7 +1220,11 @@ "required": true } ], - "description": "Get a session's children", + "summary": "Get session children", + "tags": [ + "Session" + ], + "description": "Retrieve all child sessions that were forked from the specified parent session.", "responses": { "200": { "description": "List of children", @@ -626,17 +1262,10 @@ } } }, - "/session/{id}/todo": { + "/session/{sessionID}/todo": { "get": { "operationId": "session.todo", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -646,7 +1275,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -654,7 +1283,8 @@ "description": "Session ID" } ], - "description": "Get the todo list for a session", + "summary": "Get session todos", + "description": "Retrieve the todo list associated with a specific session, showing tasks and action items.", "responses": { "200": { "description": "Todo list", @@ -692,24 +1322,10 @@ } } }, - "/session/{id}/init": { + "/session/{sessionID}/init": { "post": { "operationId": "session.init", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -719,7 +1335,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -727,7 +1343,8 @@ "description": "Session ID" } ], - "description": "Analyze the app and create an AGENTS.md file", + "summary": "Initialize session", + "description": "Analyze the current application and create an AGENTS.md file with project-specific agent configurations.", "responses": { "200": { "description": "200", @@ -788,24 +1405,10 @@ } } }, - "/session/{id}/fork": { + "/session/{sessionID}/fork": { "post": { "operationId": "session.fork", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -815,7 +1418,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string", "pattern": "^ses.*" @@ -823,7 +1426,8 @@ "required": true } ], - "description": "Fork an existing session at a specific message", + "summary": "Fork session", + "description": "Create a new session by forking an existing session at a specific message point.", "responses": { "200": { "description": "200", @@ -853,17 +1457,10 @@ } } }, - "/session/{id}/abort": { + "/session/{sessionID}/abort": { "post": { "operationId": "session.abort", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -873,14 +1470,15 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, "required": true } ], - "description": "Abort a session", + "summary": "Abort session", + "description": "Abort an active session and stop any ongoing AI processing or command execution.", "responses": { "200": { "description": "Aborted session", @@ -915,17 +1513,10 @@ } } }, - "/session/{id}/share": { + "/session/{sessionID}/share": { "post": { "operationId": "session.share", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -935,14 +1526,15 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, "required": true } ], - "description": "Share a session", + "summary": "Share session", + "description": "Create a shareable link for a session, allowing others to view the conversation.", "responses": { "200": { "description": "Successfully shared session", @@ -979,13 +1571,6 @@ "delete": { "operationId": "session.unshare", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -995,7 +1580,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string", "pattern": "^ses.*" @@ -1003,7 +1588,8 @@ "required": true } ], - "description": "Unshare the session", + "summary": "Unshare session", + "description": "Remove the shareable link for a session, making it private again.", "responses": { "200": { "description": "Successfully unshared session", @@ -1038,24 +1624,10 @@ } } }, - "/session/{id}/diff": { + "/session/{sessionID}/diff": { "get": { "operationId": "session.diff", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1065,12 +1637,12 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { - "type": "string", - "pattern": "^ses.*" + "type": "string" }, - "required": true + "required": true, + "description": "Session ID" }, { "in": "query", @@ -1081,10 +1653,11 @@ } } ], - "description": "Get the diff that resulted from this user message", + "summary": "Get session diff", + "description": "Get all file changes (diffs) made during this session.", "responses": { "200": { - "description": "Successfully retrieved diff", + "description": "List of diffs", "content": { "application/json": { "schema": { @@ -1095,28 +1668,34 @@ } } } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } } } } }, - "/session/{id}/summarize": { + "/session/{sessionID}/summarize": { "post": { "operationId": "session.summarize", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1126,7 +1705,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -1134,7 +1713,8 @@ "description": "Session ID" } ], - "description": "Summarize the session", + "summary": "Summarize session", + "description": "Generate a concise summary of the session using AI compaction to preserve key information.", "responses": { "200": { "description": "Summarized session", @@ -1178,6 +1758,10 @@ }, "modelID": { "type": "string" + }, + "auto": { + "default": false, + "type": "boolean" } }, "required": [ @@ -1190,17 +1774,10 @@ } } }, - "/session/{id}/message": { + "/session/{sessionID}/message": { "get": { "operationId": "session.messages", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1210,15 +1787,23 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, "required": true, "description": "Session ID" + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "number" + } } ], - "description": "List messages for a session", + "summary": "Get session messages", + "description": "Retrieve all messages in a session, including user prompts and AI responses.", "responses": { "200": { "description": "List of messages", @@ -1273,20 +1858,6 @@ "post": { "operationId": "session.prompt", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1296,7 +1867,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -1304,7 +1875,8 @@ "description": "Session ID" } ], - "description": "Create and send a new message to a session", + "summary": "Send message", + "description": "Create and send a new message to a session, streaming the AI response.", "responses": { "200": { "description": "Created message", @@ -1383,10 +1955,8 @@ "noReply": { "type": "boolean" }, - "system": { - "type": "string" - }, "tools": { + "description": "@deprecated tools and permissions have been merged, you can set permissions on the session itself now", "type": "object", "propertyNames": { "type": "string" @@ -1395,6 +1965,12 @@ "type": "boolean" } }, + "system": { + "type": "string" + }, + "variant": { + "type": "string" + }, "parts": { "type": "array", "items": { @@ -1407,6 +1983,9 @@ }, { "$ref": "#/components/schemas/AgentPartInput" + }, + { + "$ref": "#/components/schemas/SubtaskPartInput" } ] } @@ -1421,17 +2000,10 @@ } } }, - "/session/{id}/message/{messageID}": { + "/session/{sessionID}/message/{messageID}": { "get": { "operationId": "session.message", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1441,7 +2013,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -1458,7 +2030,8 @@ "description": "Message ID" } ], - "description": "Get a message from a session", + "summary": "Get message", + "description": "Retrieve a specific message from a session by its message ID.", "responses": { "200": { "description": "Message", @@ -1508,24 +2081,289 @@ } } }, - "/session/{id}/command": { + "/session/{sessionID}/message/{messageID}/part/{partID}": { + "delete": { + "operationId": "part.delete", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "sessionID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Session ID" + }, + { + "in": "path", + "name": "messageID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Message ID" + }, + { + "in": "path", + "name": "partID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Part ID" + } + ], + "description": "Delete a part from a message", + "responses": { + "200": { + "description": "Successfully deleted part", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + }, + "patch": { + "operationId": "part.update", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "sessionID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Session ID" + }, + { + "in": "path", + "name": "messageID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Message ID" + }, + { + "in": "path", + "name": "partID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Part ID" + } + ], + "description": "Update a part in a message", + "responses": { + "200": { + "description": "Successfully updated part", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Part" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Part" + } + } + } + } + } + }, + "/session/{sessionID}/prompt_async": { + "post": { + "operationId": "session.prompt_async", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "sessionID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Session ID" + } + ], + "summary": "Send async message", + "description": "Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.", + "responses": { + "204": { + "description": "Prompt accepted" + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "messageID": { + "type": "string", + "pattern": "^msg.*" + }, + "model": { + "type": "object", + "properties": { + "providerID": { + "type": "string" + }, + "modelID": { + "type": "string" + } + }, + "required": [ + "providerID", + "modelID" + ] + }, + "agent": { + "type": "string" + }, + "noReply": { + "type": "boolean" + }, + "tools": { + "description": "@deprecated tools and permissions have been merged, you can set permissions on the session itself now", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "system": { + "type": "string" + }, + "variant": { + "type": "string" + }, + "parts": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/TextPartInput" + }, + { + "$ref": "#/components/schemas/FilePartInput" + }, + { + "$ref": "#/components/schemas/AgentPartInput" + }, + { + "$ref": "#/components/schemas/SubtaskPartInput" + } + ] + } + } + }, + "required": [ + "parts" + ] + } + } + } + } + } + }, + "/session/{sessionID}/command": { "post": { "operationId": "session.command", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1535,7 +2373,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -1543,7 +2381,8 @@ "description": "Session ID" } ], - "description": "Send a new command to a session", + "summary": "Send command", + "description": "Send a new command to a session for execution by the AI assistant.", "responses": { "200": { "description": "Created message", @@ -1612,6 +2451,45 @@ }, "command": { "type": "string" + }, + "variant": { + "type": "string" + }, + "parts": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "const": "file" + }, + "mime": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "url": { + "type": "string" + }, + "source": { + "$ref": "#/components/schemas/FilePartSource" + } + }, + "required": [ + "type", + "mime", + "url" + ] + } + ] + } } }, "required": [ @@ -1624,24 +2502,10 @@ } } }, - "/session/{id}/shell": { + "/session/{sessionID}/shell": { "post": { "operationId": "session.shell", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1651,7 +2515,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -1659,7 +2523,8 @@ "description": "Session ID" } ], - "description": "Run a shell command", + "summary": "Run shell command", + "description": "Execute a shell command within the session context and return the AI's response.", "responses": { "200": { "description": "Created message", @@ -1701,6 +2566,21 @@ "agent": { "type": "string" }, + "model": { + "type": "object", + "properties": { + "providerID": { + "type": "string" + }, + "modelID": { + "type": "string" + } + }, + "required": [ + "providerID", + "modelID" + ] + }, "command": { "type": "string" } @@ -1715,24 +2595,10 @@ } } }, - "/session/{id}/revert": { + "/session/{sessionID}/revert": { "post": { "operationId": "session.revert", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1742,14 +2608,15 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, "required": true } ], - "description": "Revert a message", + "summary": "Revert message", + "description": "Revert a specific message in a session, undoing its effects and restoring the previous state.", "responses": { "200": { "description": "Updated session", @@ -1806,17 +2673,10 @@ } } }, - "/session/{id}/unrevert": { + "/session/{sessionID}/unrevert": { "post": { "operationId": "session.unrevert", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1826,14 +2686,15 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, "required": true } ], - "description": "Restore all reverted messages", + "summary": "Restore reverted messages", + "description": "Restore all previously reverted messages in a session.", "responses": { "200": { "description": "Updated session", @@ -1868,24 +2729,10 @@ } } }, - "/session/{id}/permissions/{permissionID}": { + "/session/{sessionID}/permissions/{permissionID}": { "post": { - "operationId": "postSession:idPermissions:permissionID", + "operationId": "permission.respond", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -1895,7 +2742,7 @@ }, { "in": "path", - "name": "id", + "name": "sessionID", "schema": { "type": "string" }, @@ -1910,7 +2757,9 @@ "required": true } ], - "description": "Respond to a permission request", + "summary": "Respond to permission", + "deprecated": true, + "description": "Approve or deny a permission request from the AI assistant.", "responses": { "200": { "description": "Permission processed successfully", @@ -1967,6 +2816,282 @@ } } }, + "/permission/{requestID}/reply": { + "post": { + "operationId": "permission.reply", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "requestID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Respond to permission request", + "description": "Approve or deny a permission request from the AI assistant.", + "responses": { + "200": { + "description": "Permission processed successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "reply": { + "type": "string", + "enum": [ + "once", + "always", + "reject" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "reply" + ] + } + } + } + } + } + }, + "/permission": { + "get": { + "operationId": "permission.list", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "List pending permissions", + "description": "Get all pending permission requests across all sessions.", + "responses": { + "200": { + "description": "List of pending permissions", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionRequest" + } + } + } + } + } + } + } + }, + "/question": { + "get": { + "operationId": "question.list", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "List pending questions", + "description": "Get all pending question requests across all sessions.", + "responses": { + "200": { + "description": "List of pending questions", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/QuestionRequest" + } + } + } + } + } + } + } + }, + "/question/{requestID}/reply": { + "post": { + "operationId": "question.reply", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "requestID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Reply to question request", + "description": "Provide answers to a question request from the AI assistant.", + "responses": { + "200": { + "description": "Question answered successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "answers": { + "description": "User answers in order of questions (each answer is an array of selected labels)", + "type": "array", + "items": { + "$ref": "#/components/schemas/QuestionAnswer" + } + } + }, + "required": [ + "answers" + ] + } + } + } + } + } + }, + "/question/{requestID}/reject": { + "post": { + "operationId": "question.reject", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "requestID", + "schema": { + "type": "string" + }, + "required": true + } + ], + "summary": "Reject question request", + "description": "Reject a question request from the AI assistant.", + "responses": { + "200": { + "description": "Question rejected successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + } + }, "/command": { "get": { "operationId": "command.list", @@ -1979,7 +3104,8 @@ } } ], - "description": "List all commands", + "summary": "List commands", + "description": "Get a list of all available commands in the OpenCode system.", "responses": { "200": { "description": "List of commands", @@ -2009,7 +3135,8 @@ } } ], - "description": "List all providers", + "summary": "List config providers", + "description": "Get a list of all configured AI providers and their default models.", "responses": { "200": { "description": "List of providers", @@ -2045,9 +3172,341 @@ } } }, - "/find": { + "/provider": { "get": { - "operationId": "find.text", + "operationId": "provider.list", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "List providers", + "description": "Get a list of all available AI providers, including both available and connected ones.", + "responses": { + "200": { + "description": "List of providers", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "all": { + "type": "array", + "items": { + "type": "object", + "properties": { + "api": { + "type": "string" + }, + "name": { + "type": "string" + }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "npm": { + "type": "string" + }, + "models": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "family": { + "type": "string" + }, + "release_date": { + "type": "string" + }, + "attachment": { + "type": "boolean" + }, + "reasoning": { + "type": "boolean" + }, + "temperature": { + "type": "boolean" + }, + "tool_call": { + "type": "boolean" + }, + "interleaved": { + "anyOf": [ + { + "type": "boolean", + "const": true + }, + { + "type": "object", + "properties": { + "field": { + "type": "string", + "enum": [ + "reasoning_content", + "reasoning_details" + ] + } + }, + "required": [ + "field" + ], + "additionalProperties": false + } + ] + }, + "cost": { + "type": "object", + "properties": { + "input": { + "type": "number" + }, + "output": { + "type": "number" + }, + "cache_read": { + "type": "number" + }, + "cache_write": { + "type": "number" + }, + "context_over_200k": { + "type": "object", + "properties": { + "input": { + "type": "number" + }, + "output": { + "type": "number" + }, + "cache_read": { + "type": "number" + }, + "cache_write": { + "type": "number" + } + }, + "required": [ + "input", + "output" + ] + } + }, + "required": [ + "input", + "output" + ] + }, + "limit": { + "type": "object", + "properties": { + "context": { + "type": "number" + }, + "output": { + "type": "number" + } + }, + "required": [ + "context", + "output" + ] + }, + "modalities": { + "type": "object", + "properties": { + "input": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] + } + }, + "output": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] + } + } + }, + "required": [ + "input", + "output" + ] + }, + "experimental": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "alpha", + "beta", + "deprecated" + ] + }, + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "headers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "provider": { + "type": "object", + "properties": { + "npm": { + "type": "string" + } + }, + "required": [ + "npm" + ] + }, + "variants": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + } + }, + "required": [ + "id", + "name", + "release_date", + "attachment", + "reasoning", + "temperature", + "tool_call", + "limit", + "options" + ] + } + } + }, + "required": [ + "name", + "env", + "id", + "models" + ] + } + }, + "default": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "connected": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "all", + "default", + "connected" + ] + } + } + } + } + } + } + }, + "/provider/auth": { + "get": { + "operationId": "provider.auth", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Get provider auth methods", + "description": "Retrieve available authentication methods for all AI providers.", + "responses": { + "200": { + "description": "Provider auth methods", + "content": { + "application/json": { + "schema": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProviderAuthMethod" + } + } + } + } + } + } + } + } + }, + "/provider/{providerID}/oauth/authorize": { + "post": { + "operationId": "provider.oauth.authorize", "parameters": [ { "in": "query", @@ -2056,6 +3515,133 @@ "type": "string" } }, + { + "in": "path", + "name": "providerID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Provider ID" + } + ], + "summary": "OAuth authorize", + "description": "Initiate OAuth authorization for a specific AI provider to get an authorization URL.", + "responses": { + "200": { + "description": "Authorization URL and method", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProviderAuthAuthorization" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "method": { + "description": "Auth method index", + "type": "number" + } + }, + "required": [ + "method" + ] + } + } + } + } + } + }, + "/provider/{providerID}/oauth/callback": { + "post": { + "operationId": "provider.oauth.callback", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "providerID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Provider ID" + } + ], + "summary": "OAuth callback", + "description": "Handle the OAuth callback from a provider after user authorization.", + "responses": { + "200": { + "description": "OAuth callback processed successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "method": { + "description": "Auth method index", + "type": "number" + }, + "code": { + "description": "OAuth authorization code", + "type": "string" + } + }, + "required": [ + "method" + ] + } + } + } + } + } + }, + "/find": { + "get": { + "operationId": "find.text", + "parameters": [ { "in": "query", "name": "directory", @@ -2072,7 +3658,8 @@ "required": true } ], - "description": "Find text in files", + "summary": "Find text", + "description": "Search for text patterns across files in the project using ripgrep.", "responses": { "200": { "description": "Matches", @@ -2168,13 +3755,6 @@ "type": "string" } }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "query", @@ -2182,9 +3762,41 @@ "type": "string" }, "required": true + }, + { + "in": "query", + "name": "dirs", + "schema": { + "type": "string", + "enum": [ + "true", + "false" + ] + } + }, + { + "in": "query", + "name": "type", + "schema": { + "type": "string", + "enum": [ + "file", + "directory" + ] + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 200 + } } ], - "description": "Find files", + "summary": "Find files", + "description": "Search for files or directories by name or pattern in the project directory.", "responses": { "200": { "description": "File paths", @@ -2213,13 +3825,6 @@ "type": "string" } }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "query", @@ -2229,7 +3834,8 @@ "required": true } ], - "description": "Find workspace symbols", + "summary": "Find symbols", + "description": "Search for workspace symbols like functions, classes, and variables using LSP.", "responses": { "200": { "description": "Symbols", @@ -2258,13 +3864,6 @@ "type": "string" } }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "path", @@ -2274,7 +3873,8 @@ "required": true } ], - "description": "List files and directories", + "summary": "List files", + "description": "List files and directories in a specified path.", "responses": { "200": { "description": "Files and directories", @@ -2303,13 +3903,6 @@ "type": "string" } }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "path", @@ -2319,7 +3912,8 @@ "required": true } ], - "description": "Read a file", + "summary": "Read file", + "description": "Read the content of a specified file.", "responses": { "200": { "description": "File content", @@ -2346,7 +3940,8 @@ } } ], - "description": "Get file status", + "summary": "Get file status", + "description": "Get the git status of all files in the project.", "responses": { "200": { "description": "File status", @@ -2368,13 +3963,6 @@ "post": { "operationId": "app.log", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -2383,7 +3971,8 @@ } } ], - "description": "Write a log entry to the server logs", + "summary": "Write log", + "description": "Write a log entry to the server logs with specified level and metadata.", "responses": { "200": { "description": "Log entry written successfully", @@ -2462,7 +4051,8 @@ } } ], - "description": "List all agents", + "summary": "List agents", + "description": "Get a list of all available AI agents in the OpenCode system.", "responses": { "200": { "description": "List of agents", @@ -2492,7 +4082,8 @@ } } ], - "description": "Get MCP server status", + "summary": "Get MCP status", + "description": "Get the status of all Model Context Protocol (MCP) servers.", "responses": { "200": { "description": "MCP server status", @@ -2511,6 +4102,428 @@ } } } + }, + "post": { + "operationId": "mcp.add", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Add MCP server", + "description": "Dynamically add a new Model Context Protocol (MCP) server to the system.", + "responses": { + "200": { + "description": "MCP server added successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "$ref": "#/components/schemas/MCPStatus" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "config": { + "anyOf": [ + { + "$ref": "#/components/schemas/McpLocalConfig" + }, + { + "$ref": "#/components/schemas/McpRemoteConfig" + } + ] + } + }, + "required": [ + "name", + "config" + ] + } + } + } + } + } + }, + "/mcp/{name}/auth": { + "post": { + "operationId": "mcp.auth.start", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "name", + "required": true + } + ], + "summary": "Start MCP OAuth", + "description": "Start OAuth authentication flow for a Model Context Protocol (MCP) server.", + "responses": { + "200": { + "description": "OAuth flow started", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "authorizationUrl": { + "description": "URL to open in browser for authorization", + "type": "string" + } + }, + "required": [ + "authorizationUrl" + ] + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + }, + "delete": { + "operationId": "mcp.auth.remove", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "name", + "required": true + } + ], + "summary": "Remove MCP OAuth", + "description": "Remove OAuth credentials for an MCP server", + "responses": { + "200": { + "description": "OAuth credentials removed", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "const": true + } + }, + "required": [ + "success" + ] + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + } + }, + "/mcp/{name}/auth/callback": { + "post": { + "operationId": "mcp.auth.callback", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "name", + "required": true + } + ], + "summary": "Complete MCP OAuth", + "description": "Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.", + "responses": { + "200": { + "description": "OAuth authentication completed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPStatus" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "description": "Authorization code from OAuth callback", + "type": "string" + } + }, + "required": [ + "code" + ] + } + } + } + } + } + }, + "/mcp/{name}/auth/authenticate": { + "post": { + "operationId": "mcp.auth.authenticate", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "name", + "required": true + } + ], + "summary": "Authenticate MCP OAuth", + "description": "Start OAuth flow and wait for callback (opens browser)", + "responses": { + "200": { + "description": "OAuth authentication completed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPStatus" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + } + } + }, + "/mcp/{name}/connect": { + "post": { + "operationId": "mcp.connect", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "name", + "schema": { + "type": "string" + }, + "required": true + } + ], + "description": "Connect an MCP server", + "responses": { + "200": { + "description": "MCP server connected successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + } + } + }, + "/mcp/{name}/disconnect": { + "post": { + "operationId": "mcp.disconnect", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "name", + "schema": { + "type": "string" + }, + "required": true + } + ], + "description": "Disconnect an MCP server", + "responses": { + "200": { + "description": "MCP server disconnected successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + } + } + }, + "/experimental/resource": { + "get": { + "operationId": "experimental.resource.list", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Get MCP resources", + "description": "Get all available MCP resources from connected servers. Optionally filter by name.", + "responses": { + "200": { + "description": "MCP resources", + "content": { + "application/json": { + "schema": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "$ref": "#/components/schemas/McpResource" + } + } + } + } + } + } } }, "/lsp": { @@ -2525,6 +4538,7 @@ } } ], + "summary": "Get LSP status", "description": "Get LSP server status", "responses": { "200": { @@ -2555,6 +4569,7 @@ } } ], + "summary": "Get formatter status", "description": "Get formatter status", "responses": { "200": { @@ -2577,13 +4592,6 @@ "post": { "operationId": "tui.appendPrompt", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -2592,6 +4600,7 @@ } } ], + "summary": "Append TUI prompt", "description": "Append prompt to the TUI", "responses": { "200": { @@ -2646,7 +4655,8 @@ } } ], - "description": "Open the help dialog", + "summary": "Open help dialog", + "description": "Open the help dialog in the TUI to display user assistance information.", "responses": { "200": { "description": "Help dialog opened successfully", @@ -2673,6 +4683,7 @@ } } ], + "summary": "Open sessions dialog", "description": "Open the session dialog", "responses": { "200": { @@ -2700,6 +4711,7 @@ } } ], + "summary": "Open themes dialog", "description": "Open the theme dialog", "responses": { "200": { @@ -2727,6 +4739,7 @@ } } ], + "summary": "Open models dialog", "description": "Open the model dialog", "responses": { "200": { @@ -2754,6 +4767,7 @@ } } ], + "summary": "Submit TUI prompt", "description": "Submit the prompt", "responses": { "200": { @@ -2781,6 +4795,7 @@ } } ], + "summary": "Clear TUI prompt", "description": "Clear the prompt", "responses": { "200": { @@ -2800,13 +4815,6 @@ "post": { "operationId": "tui.executeCommand", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -2815,6 +4823,7 @@ } } ], + "summary": "Execute TUI command", "description": "Execute a TUI command (e.g. agent_cycle)", "responses": { "200": { @@ -2861,13 +4870,6 @@ "post": { "operationId": "tui.showToast", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -2876,6 +4878,7 @@ } } ], + "summary": "Show TUI toast", "description": "Show a toast notification in the TUI", "responses": { "200": { @@ -2930,13 +4933,6 @@ "post": { "operationId": "tui.publish", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -2945,6 +4941,7 @@ } } ], + "summary": "Publish TUI event", "description": "Publish a TUI event", "responses": { "200": { @@ -2981,6 +4978,9 @@ }, { "$ref": "#/components/schemas/Event.tui.toast.show" + }, + { + "$ref": "#/components/schemas/Event.tui.session.select" } ] } @@ -2989,6 +4989,73 @@ } } }, + "/tui/select-session": { + "post": { + "operationId": "tui.selectSession", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + } + ], + "summary": "Select session", + "description": "Navigate the TUI to display the specified session.", + "responses": { + "200": { + "description": "Session selected successfully", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "sessionID": { + "description": "Session ID to navigate to", + "type": "string", + "pattern": "^ses" + } + }, + "required": [ + "sessionID" + ] + } + } + } + } + } + }, "/tui/control/next": { "get": { "operationId": "tui.control.next", @@ -3001,7 +5068,8 @@ } } ], - "description": "Get the next TUI request from the queue", + "summary": "Get next TUI request", + "description": "Retrieve the next TUI (Terminal User Interface) request from the queue for processing.", "responses": { "200": { "description": "Next TUI request", @@ -3030,13 +5098,6 @@ "post": { "operationId": "tui.control.response", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -3045,7 +5106,8 @@ } } ], - "description": "Submit a response to the TUI request queue", + "summary": "Submit TUI response", + "description": "Submit a response to the TUI request queue to complete a pending request.", "responses": { "200": { "description": "Response submitted successfully", @@ -3067,24 +5129,10 @@ } } }, - "/auth/{id}": { + "/auth/{providerID}": { "put": { "operationId": "auth.set", "parameters": [ - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "directory", - "schema": { - "type": "string" - } - }, { "in": "query", "name": "directory", @@ -3094,13 +5142,14 @@ }, { "in": "path", - "name": "id", + "name": "providerID", "schema": { "type": "string" }, "required": true } ], + "summary": "Set auth credentials", "description": "Set authentication credentials", "responses": { "200": { @@ -3147,6 +5196,7 @@ } } ], + "summary": "Subscribe to events", "description": "Get events", "responses": { "200": { @@ -3165,6 +5215,193 @@ }, "components": { "schemas": { + "Event.tui.prompt.append": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tui.prompt.append" + }, + "properties": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "required": [ + "text" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.tui.command.execute": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tui.command.execute" + }, + "properties": { + "type": "object", + "properties": { + "command": { + "anyOf": [ + { + "type": "string", + "enum": [ + "session.list", + "session.new", + "session.share", + "session.interrupt", + "session.compact", + "session.page.up", + "session.page.down", + "session.half.page.up", + "session.half.page.down", + "session.first", + "session.last", + "prompt.clear", + "prompt.submit", + "agent.cycle" + ] + }, + { + "type": "string" + } + ] + } + }, + "required": [ + "command" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.tui.toast.show": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tui.toast.show" + }, + "properties": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "message": { + "type": "string" + }, + "variant": { + "type": "string", + "enum": [ + "info", + "success", + "warning", + "error" + ] + }, + "duration": { + "description": "Duration in milliseconds", + "default": 5000, + "type": "number" + } + }, + "required": [ + "message", + "variant" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.tui.session.select": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tui.session.select" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "description": "Session ID to navigate to", + "type": "string", + "pattern": "^ses" + } + }, + "required": [ + "sessionID" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.installation.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "installation.updated" + }, + "properties": { + "type": "object", + "properties": { + "version": { + "type": "string" + } + }, + "required": [ + "version" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.installation.update-available": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "installation.update-available" + }, + "properties": { + "type": "object", + "properties": { + "version": { + "type": "string" + } + }, + "required": [ + "version" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, "Project": { "type": "object", "properties": { @@ -3178,1234 +5415,19 @@ "type": "string", "const": "git" }, - "time": { - "type": "object", - "properties": { - "created": { - "type": "number" - }, - "initialized": { - "type": "number" - } - }, - "required": [ - "created" - ] - } - }, - "required": [ - "id", - "worktree", - "time" - ] - }, - "KeybindsConfig": { - "description": "Custom keybind configurations", - "type": "object", - "properties": { - "leader": { - "description": "Leader key for keybind combinations", - "default": "ctrl+x", + "name": { "type": "string" }, - "app_exit": { - "description": "Exit the application", - "default": "ctrl+c,ctrl+d,q", - "type": "string" - }, - "editor_open": { - "description": "Open external editor", - "default": "e", - "type": "string" - }, - "theme_list": { - "description": "List available themes", - "default": "t", - "type": "string" - }, - "sidebar_toggle": { - "description": "Toggle sidebar", - "default": "b", - "type": "string" - }, - "status_view": { - "description": "View status", - "default": "s", - "type": "string" - }, - "session_export": { - "description": "Export session to editor", - "default": "x", - "type": "string" - }, - "session_new": { - "description": "Create a new session", - "default": "n", - "type": "string" - }, - "session_list": { - "description": "List all sessions", - "default": "l", - "type": "string" - }, - "session_timeline": { - "description": "Show session timeline", - "default": "g", - "type": "string" - }, - "session_share": { - "description": "Share current session", - "default": "none", - "type": "string" - }, - "session_unshare": { - "description": "Unshare current session", - "default": "none", - "type": "string" - }, - "session_interrupt": { - "description": "Interrupt current session", - "default": "escape", - "type": "string" - }, - "session_compact": { - "description": "Compact the session", - "default": "c", - "type": "string" - }, - "messages_page_up": { - "description": "Scroll messages up by one page", - "default": "pageup", - "type": "string" - }, - "messages_page_down": { - "description": "Scroll messages down by one page", - "default": "pagedown", - "type": "string" - }, - "messages_half_page_up": { - "description": "Scroll messages up by half page", - "default": "ctrl+alt+u", - "type": "string" - }, - "messages_half_page_down": { - "description": "Scroll messages down by half page", - "default": "ctrl+alt+d", - "type": "string" - }, - "messages_first": { - "description": "Navigate to first message", - "default": "ctrl+g,home", - "type": "string" - }, - "messages_last": { - "description": "Navigate to last message", - "default": "ctrl+alt+g,end", - "type": "string" - }, - "messages_copy": { - "description": "Copy message", - "default": "y", - "type": "string" - }, - "messages_undo": { - "description": "Undo message", - "default": "u", - "type": "string" - }, - "messages_redo": { - "description": "Redo message", - "default": "r", - "type": "string" - }, - "messages_toggle_conceal": { - "description": "Toggle code block concealment in messages", - "default": "h", - "type": "string" - }, - "model_list": { - "description": "List available models", - "default": "m", - "type": "string" - }, - "model_cycle_recent": { - "description": "Next recently used model", - "default": "f2", - "type": "string" - }, - "model_cycle_recent_reverse": { - "description": "Previous recently used model", - "default": "shift+f2", - "type": "string" - }, - "command_list": { - "description": "List available commands", - "default": "ctrl+p", - "type": "string" - }, - "agent_list": { - "description": "List agents", - "default": "a", - "type": "string" - }, - "agent_cycle": { - "description": "Next agent", - "default": "tab", - "type": "string" - }, - "agent_cycle_reverse": { - "description": "Previous agent", - "default": "shift+tab", - "type": "string" - }, - "input_clear": { - "description": "Clear input field", - "default": "ctrl+c", - "type": "string" - }, - "input_forward_delete": { - "description": "Forward delete", - "default": "ctrl+d", - "type": "string" - }, - "input_paste": { - "description": "Paste from clipboard", - "default": "ctrl+v", - "type": "string" - }, - "input_submit": { - "description": "Submit input", - "default": "enter", - "type": "string" - }, - "input_newline": { - "description": "Insert newline in input", - "default": "shift+enter,ctrl+j", - "type": "string" - }, - "history_previous": { - "description": "Previous history item", - "default": "up", - "type": "string" - }, - "history_next": { - "description": "Previous history item", - "default": "down", - "type": "string" - } - }, - "additionalProperties": false - }, - "AgentConfig": { - "type": "object", - "properties": { - "model": { - "type": "string" - }, - "temperature": { - "type": "number" - }, - "top_p": { - "type": "number" - }, - "prompt": { - "type": "string" - }, - "tools": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "boolean" - } - }, - "disable": { - "type": "boolean" - }, - "description": { - "description": "Description of when to use the agent", - "type": "string" - }, - "mode": { - "anyOf": [ - { - "type": "string", - "const": "subagent" - }, - { - "type": "string", - "const": "primary" - }, - { - "type": "string", - "const": "all" - } - ] - }, - "permission": { - "type": "object", - "properties": { - "edit": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - }, - "bash": { - "anyOf": [ - { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - }, - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - } - } - ] - }, - "webfetch": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - } - } - } - }, - "additionalProperties": {} - }, - "McpLocalConfig": { - "type": "object", - "properties": { - "type": { - "description": "Type of MCP server connection", - "type": "string", - "const": "local" - }, - "command": { - "description": "Command and arguments to run the MCP server", - "type": "array", - "items": { - "type": "string" - } - }, - "environment": { - "description": "Environment variables to set when running the MCP server", - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - }, - "enabled": { - "description": "Enable or disable the MCP server on startup", - "type": "boolean" - }, - "timeout": { - "description": "Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.", - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 9007199254740991 - } - }, - "required": [ - "type", - "command" - ], - "additionalProperties": false - }, - "McpRemoteConfig": { - "type": "object", - "properties": { - "type": { - "description": "Type of MCP server connection", - "type": "string", - "const": "remote" - }, - "url": { - "description": "URL of the remote MCP server", - "type": "string" - }, - "enabled": { - "description": "Enable or disable the MCP server on startup", - "type": "boolean" - }, - "headers": { - "description": "Headers to send with the request", - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - }, - "timeout": { - "description": "Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.", - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 9007199254740991 - } - }, - "required": [ - "type", - "url" - ], - "additionalProperties": false - }, - "LayoutConfig": { - "description": "@deprecated Always uses stretch layout.", - "type": "string", - "enum": [ - "auto", - "stretch" - ] - }, - "Config": { - "type": "object", - "properties": { - "$schema": { - "description": "JSON schema reference for configuration validation", - "type": "string" - }, - "theme": { - "description": "Theme name to use for the interface", - "type": "string" - }, - "keybinds": { - "$ref": "#/components/schemas/KeybindsConfig" - }, - "tui": { - "description": "TUI specific settings", - "type": "object", - "properties": { - "scroll_speed": { - "description": "TUI scroll speed", - "default": 2, - "type": "number", - "minimum": 1 - } - } - }, - "command": { - "description": "Command configuration, see https://opencode.ai/docs/commands", - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "object", - "properties": { - "template": { - "type": "string" - }, - "description": { - "type": "string" - }, - "agent": { - "type": "string" - }, - "model": { - "type": "string" - }, - "subtask": { - "type": "boolean" - } - }, - "required": [ - "template" - ] - } - }, - "watcher": { - "type": "object", - "properties": { - "ignore": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "plugin": { - "type": "array", - "items": { - "type": "string" - } - }, - "snapshot": { - "type": "boolean" - }, - "share": { - "description": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing", - "type": "string", - "enum": [ - "manual", - "auto", - "disabled" - ] - }, - "autoshare": { - "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically", - "type": "boolean" - }, - "autoupdate": { - "description": "Automatically update to the latest version", - "type": "boolean" - }, - "disabled_providers": { - "description": "Disable providers that are loaded automatically", - "type": "array", - "items": { - "type": "string" - } - }, - "model": { - "description": "Model to use in the format of provider/model, eg anthropic/claude-2", - "type": "string" - }, - "small_model": { - "description": "Small model to use for tasks like title generation in the format of provider/model", - "type": "string" - }, - "username": { - "description": "Custom username to display in conversations instead of system username", - "type": "string" - }, - "mode": { - "description": "@deprecated Use `agent` field instead.", - "type": "object", - "properties": { - "build": { - "$ref": "#/components/schemas/AgentConfig" - }, - "plan": { - "$ref": "#/components/schemas/AgentConfig" - } - }, - "additionalProperties": { - "$ref": "#/components/schemas/AgentConfig" - } - }, - "agent": { - "description": "Agent configuration, see https://opencode.ai/docs/agent", - "type": "object", - "properties": { - "plan": { - "$ref": "#/components/schemas/AgentConfig" - }, - "build": { - "$ref": "#/components/schemas/AgentConfig" - }, - "general": { - "$ref": "#/components/schemas/AgentConfig" - } - }, - "additionalProperties": { - "$ref": "#/components/schemas/AgentConfig" - } - }, - "provider": { - "description": "Custom provider configurations and model overrides", - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "object", - "properties": { - "api": { - "type": "string" - }, - "name": { - "type": "string" - }, - "env": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string" - }, - "npm": { - "type": "string" - }, - "models": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "release_date": { - "type": "string" - }, - "attachment": { - "type": "boolean" - }, - "reasoning": { - "type": "boolean" - }, - "temperature": { - "type": "boolean" - }, - "tool_call": { - "type": "boolean" - }, - "cost": { - "type": "object", - "properties": { - "input": { - "type": "number" - }, - "output": { - "type": "number" - }, - "cache_read": { - "type": "number" - }, - "cache_write": { - "type": "number" - } - }, - "required": [ - "input", - "output" - ] - }, - "limit": { - "type": "object", - "properties": { - "context": { - "type": "number" - }, - "output": { - "type": "number" - } - }, - "required": [ - "context", - "output" - ] - }, - "modalities": { - "type": "object", - "properties": { - "input": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "text", - "audio", - "image", - "video", - "pdf" - ] - } - }, - "output": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "text", - "audio", - "image", - "video", - "pdf" - ] - } - } - }, - "required": [ - "input", - "output" - ] - }, - "experimental": { - "type": "boolean" - }, - "status": { - "type": "string", - "enum": [ - "alpha", - "beta", - "deprecated" - ] - }, - "options": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - "headers": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - }, - "provider": { - "type": "object", - "properties": { - "npm": { - "type": "string" - } - }, - "required": [ - "npm" - ] - } - } - } - }, - "options": { - "type": "object", - "properties": { - "apiKey": { - "type": "string" - }, - "baseURL": { - "type": "string" - }, - "timeout": { - "description": "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.", - "anyOf": [ - { - "description": "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.", - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 9007199254740991 - }, - { - "description": "Disable timeout for this provider entirely.", - "type": "boolean", - "const": false - } - ] - } - }, - "additionalProperties": {} - } - }, - "additionalProperties": false - } - }, - "mcp": { - "description": "MCP (Model Context Protocol) server configurations", - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/components/schemas/McpLocalConfig" - }, - { - "$ref": "#/components/schemas/McpRemoteConfig" - } - ] - } - }, - "formatter": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "object", - "properties": { - "disabled": { - "type": "boolean" - }, - "command": { - "type": "array", - "items": { - "type": "string" - } - }, - "environment": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - }, - "extensions": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "lsp": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "anyOf": [ - { - "type": "object", - "properties": { - "disabled": { - "type": "boolean", - "const": true - } - }, - "required": [ - "disabled" - ] - }, - { - "type": "object", - "properties": { - "command": { - "type": "array", - "items": { - "type": "string" - } - }, - "extensions": { - "type": "array", - "items": { - "type": "string" - } - }, - "disabled": { - "type": "boolean" - }, - "env": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - }, - "initialization": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - } - }, - "required": [ - "command" - ] - } - ] - } - }, - "instructions": { - "description": "Additional instruction files or patterns to include", - "type": "array", - "items": { - "type": "string" - } - }, - "layout": { - "$ref": "#/components/schemas/LayoutConfig" - }, - "permission": { - "type": "object", - "properties": { - "edit": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - }, - "bash": { - "anyOf": [ - { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - }, - { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - } - } - ] - }, - "webfetch": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - } - } - }, - "tools": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "boolean" - } - }, - "experimental": { - "type": "object", - "properties": { - "hook": { - "type": "object", - "properties": { - "file_edited": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "array", - "items": { - "type": "object", - "properties": { - "command": { - "type": "array", - "items": { - "type": "string" - } - }, - "environment": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "command" - ] - } - } - }, - "session_completed": { - "type": "array", - "items": { - "type": "object", - "properties": { - "command": { - "type": "array", - "items": { - "type": "string" - } - }, - "environment": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "command" - ] - } - } - } - }, - "chatMaxRetries": { - "description": "Number of retries for chat completions on failure", - "type": "number" - }, - "disable_paste_summary": { - "type": "boolean" - } - } - } - }, - "additionalProperties": false - }, - "BadRequestError": { - "type": "object", - "properties": { - "data": { - "anyOf": [ - {}, - { - "type": "null" - } - ] - }, - "errors": { - "type": "array", - "items": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - } - }, - "success": { - "type": "boolean", - "const": false - } - }, - "required": [ - "data", - "errors", - "success" - ] - }, - "ToolIDs": { - "type": "array", - "items": { - "type": "string" - } - }, - "ToolListItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "description": { - "type": "string" - }, - "parameters": {} - }, - "required": [ - "id", - "description", - "parameters" - ] - }, - "ToolList": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ToolListItem" - } - }, - "Path": { - "type": "object", - "properties": { - "state": { - "type": "string" - }, - "config": { - "type": "string" - }, - "worktree": { - "type": "string" - }, - "directory": { - "type": "string" - } - }, - "required": [ - "state", - "config", - "worktree", - "directory" - ] - }, - "FileDiff": { - "type": "object", - "properties": { - "file": { - "type": "string" - }, - "before": { - "type": "string" - }, - "after": { - "type": "string" - }, - "additions": { - "type": "number" - }, - "deletions": { - "type": "number" - } - }, - "required": [ - "file", - "before", - "after", - "additions", - "deletions" - ] - }, - "Session": { - "type": "object", - "properties": { - "id": { - "type": "string", - "pattern": "^ses.*" - }, - "projectID": { - "type": "string" - }, - "directory": { - "type": "string" - }, - "parentID": { - "type": "string", - "pattern": "^ses.*" - }, - "summary": { - "type": "object", - "properties": { - "diffs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FileDiff" - } - } - }, - "required": [ - "diffs" - ] - }, - "share": { + "icon": { "type": "object", "properties": { "url": { "type": "string" + }, + "color": { + "type": "string" } - }, - "required": [ - "url" - ] - }, - "title": { - "type": "string" - }, - "version": { - "type": "string" + } }, "time": { "type": "object", @@ -4416,7 +5438,7 @@ "updated": { "type": "number" }, - "compacting": { + "initialized": { "type": "number" } }, @@ -4425,58 +5447,497 @@ "updated" ] }, - "revert": { + "sandboxes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "worktree", + "time", + "sandboxes" + ] + }, + "Event.project.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "project.updated" + }, + "properties": { + "$ref": "#/components/schemas/Project" + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.server.instance.disposed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "server.instance.disposed" + }, + "properties": { + "type": "object", + "properties": { + "directory": { + "type": "string" + } + }, + "required": [ + "directory" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.file.edited": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file.edited" + }, + "properties": { + "type": "object", + "properties": { + "file": { + "type": "string" + } + }, + "required": [ + "file" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.lsp.client.diagnostics": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "lsp.client.diagnostics" + }, + "properties": { + "type": "object", + "properties": { + "serverID": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "required": [ + "serverID", + "path" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "PermissionRequest": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^per.*" + }, + "sessionID": { + "type": "string", + "pattern": "^ses.*" + }, + "permission": { + "type": "string" + }, + "patterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "always": { + "type": "array", + "items": { + "type": "string" + } + }, + "tool": { "type": "object", "properties": { "messageID": { "type": "string" }, - "partID": { - "type": "string" - }, - "snapshot": { - "type": "string" - }, - "diff": { + "callID": { "type": "string" } }, "required": [ - "messageID" + "messageID", + "callID" ] } }, "required": [ "id", - "projectID", - "directory", - "title", - "version", - "time" + "sessionID", + "permission", + "patterns", + "metadata", + "always" ] }, - "NotFoundError": { + "Event.permission.asked": { "type": "object", "properties": { - "name": { + "type": { "type": "string", - "const": "NotFoundError" + "const": "permission.asked" }, - "data": { + "properties": { + "$ref": "#/components/schemas/PermissionRequest" + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.permission.replied": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "permission.replied" + }, + "properties": { "type": "object", "properties": { - "message": { + "sessionID": { "type": "string" + }, + "requestID": { + "type": "string" + }, + "reply": { + "type": "string", + "enum": [ + "once", + "always", + "reject" + ] } }, "required": [ - "message" + "sessionID", + "requestID", + "reply" ] } }, "required": [ - "name", - "data" + "type", + "properties" + ] + }, + "SessionStatus": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "idle" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "retry" + }, + "attempt": { + "type": "number" + }, + "message": { + "type": "string" + }, + "next": { + "type": "number" + } + }, + "required": [ + "type", + "attempt", + "message", + "next" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "busy" + } + }, + "required": [ + "type" + ] + } + ] + }, + "Event.session.status": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.status" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/SessionStatus" + } + }, + "required": [ + "sessionID", + "status" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.idle": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.idle" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + } + }, + "required": [ + "sessionID" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "QuestionOption": { + "type": "object", + "properties": { + "label": { + "description": "Display text (1-5 words, concise)", + "type": "string" + }, + "description": { + "description": "Explanation of choice", + "type": "string" + } + }, + "required": [ + "label", + "description" + ] + }, + "QuestionInfo": { + "type": "object", + "properties": { + "question": { + "description": "Complete question", + "type": "string" + }, + "header": { + "description": "Very short label (max 12 chars)", + "type": "string", + "maxLength": 12 + }, + "options": { + "description": "Available choices", + "type": "array", + "items": { + "$ref": "#/components/schemas/QuestionOption" + } + }, + "multiple": { + "description": "Allow selecting multiple choices", + "type": "boolean" + } + }, + "required": [ + "question", + "header", + "options" + ] + }, + "QuestionRequest": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^que.*" + }, + "sessionID": { + "type": "string", + "pattern": "^ses.*" + }, + "questions": { + "description": "Questions to ask", + "type": "array", + "items": { + "$ref": "#/components/schemas/QuestionInfo" + } + }, + "tool": { + "type": "object", + "properties": { + "messageID": { + "type": "string" + }, + "callID": { + "type": "string" + } + }, + "required": [ + "messageID", + "callID" + ] + } + }, + "required": [ + "id", + "sessionID", + "questions" + ] + }, + "Event.question.asked": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "question.asked" + }, + "properties": { + "$ref": "#/components/schemas/QuestionRequest" + } + }, + "required": [ + "type", + "properties" + ] + }, + "QuestionAnswer": { + "type": "array", + "items": { + "type": "string" + } + }, + "Event.question.replied": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "question.replied" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "requestID": { + "type": "string" + }, + "answers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/QuestionAnswer" + } + } + }, + "required": [ + "sessionID", + "requestID", + "answers" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.question.rejected": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "question.rejected" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "requestID": { + "type": "string" + } + }, + "required": [ + "sessionID", + "requestID" + ] + } + }, + "required": [ + "type", + "properties" ] }, "Todo": { @@ -4506,6 +5967,350 @@ "id" ] }, + "Event.todo.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "todo.updated" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "todos": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Todo" + } + } + }, + "required": [ + "sessionID", + "todos" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Pty": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^pty.*" + }, + "title": { + "type": "string" + }, + "command": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "cwd": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "running", + "exited" + ] + }, + "pid": { + "type": "number" + } + }, + "required": [ + "id", + "title", + "command", + "args", + "cwd", + "status", + "pid" + ] + }, + "Event.pty.created": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "pty.created" + }, + "properties": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Pty" + } + }, + "required": [ + "info" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.pty.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "pty.updated" + }, + "properties": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Pty" + } + }, + "required": [ + "info" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.pty.exited": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "pty.exited" + }, + "properties": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^pty.*" + }, + "exitCode": { + "type": "number" + } + }, + "required": [ + "id", + "exitCode" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.pty.deleted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "pty.deleted" + }, + "properties": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^pty.*" + } + }, + "required": [ + "id" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.mcp.tools.changed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "mcp.tools.changed" + }, + "properties": { + "type": "object", + "properties": { + "server": { + "type": "string" + } + }, + "required": [ + "server" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.file.watcher.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file.watcher.updated" + }, + "properties": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "event": { + "anyOf": [ + { + "type": "string", + "const": "add" + }, + { + "type": "string", + "const": "change" + }, + { + "type": "string", + "const": "unlink" + } + ] + } + }, + "required": [ + "file", + "event" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.lsp.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "lsp.updated" + }, + "properties": { + "type": "object", + "properties": {} + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.command.executed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "command.executed" + }, + "properties": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "sessionID": { + "type": "string", + "pattern": "^ses.*" + }, + "arguments": { + "type": "string" + }, + "messageID": { + "type": "string", + "pattern": "^msg.*" + } + }, + "required": [ + "name", + "sessionID", + "arguments", + "messageID" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.vcs.branch.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "vcs.branch.updated" + }, + "properties": { + "type": "object", + "properties": { + "branch": { + "type": "string" + } + } + } + }, + "required": [ + "type", + "properties" + ] + }, + "FileDiff": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "before": { + "type": "string" + }, + "after": { + "type": "string" + }, + "additions": { + "type": "number" + }, + "deletions": { + "type": "number" + } + }, + "required": [ + "file", + "before", + "after", + "additions", + "deletions" + ] + }, "UserMessage": { "type": "object", "properties": { @@ -4549,13 +6354,48 @@ "required": [ "diffs" ] + }, + "agent": { + "type": "string" + }, + "model": { + "type": "object", + "properties": { + "providerID": { + "type": "string" + }, + "modelID": { + "type": "string" + } + }, + "required": [ + "providerID", + "modelID" + ] + }, + "system": { + "type": "string" + }, + "tools": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "variant": { + "type": "string" } }, "required": [ "id", "sessionID", "role", - "time" + "time", + "agent", + "model" ] }, "ProviderAuthError": { @@ -4681,6 +6521,15 @@ }, "responseBody": { "type": "string" + }, + "metadata": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } } }, "required": [ @@ -4740,12 +6589,6 @@ } ] }, - "system": { - "type": "array", - "items": { - "type": "string" - } - }, "parentID": { "type": "string" }, @@ -4758,6 +6601,9 @@ "mode": { "type": "string" }, + "agent": { + "type": "string" + }, "path": { "type": "object", "properties": { @@ -4813,6 +6659,9 @@ "reasoning", "cache" ] + }, + "finish": { + "type": "string" } }, "required": [ @@ -4820,11 +6669,11 @@ "sessionID", "role", "time", - "system", "parentID", "modelID", "providerID", "mode", + "agent", "path", "cost", "tokens" @@ -4840,6 +6689,58 @@ } ] }, + "Event.message.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "message.updated" + }, + "properties": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Message" + } + }, + "required": [ + "info" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.message.removed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "message.removed" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageID": { + "type": "string" + } + }, + "required": [ + "sessionID", + "messageID" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, "TextPart": { "type": "object", "properties": { @@ -4862,6 +6763,9 @@ "synthetic": { "type": "boolean" }, + "ignored": { + "type": "boolean" + }, "time": { "type": "object", "properties": { @@ -5058,6 +6962,30 @@ "kind" ] }, + "ResourceSource": { + "type": "object", + "properties": { + "text": { + "$ref": "#/components/schemas/FilePartSourceText" + }, + "type": { + "type": "string", + "const": "resource" + }, + "clientName": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "required": [ + "text", + "type", + "clientName", + "uri" + ] + }, "FilePartSource": { "anyOf": [ { @@ -5065,6 +6993,9 @@ }, { "$ref": "#/components/schemas/SymbolSource" + }, + { + "$ref": "#/components/schemas/ResourceSource" } ] }, @@ -5595,11 +7526,78 @@ "time" ] }, + "CompactionPart": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "sessionID": { + "type": "string" + }, + "messageID": { + "type": "string" + }, + "type": { + "type": "string", + "const": "compaction" + }, + "auto": { + "type": "boolean" + } + }, + "required": [ + "id", + "sessionID", + "messageID", + "type", + "auto" + ] + }, "Part": { "anyOf": [ { "$ref": "#/components/schemas/TextPart" }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "sessionID": { + "type": "string" + }, + "messageID": { + "type": "string" + }, + "type": { + "type": "string", + "const": "subtask" + }, + "prompt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "command": { + "type": "string" + } + }, + "required": [ + "id", + "sessionID", + "messageID", + "type", + "prompt", + "description", + "agent" + ] + }, { "$ref": "#/components/schemas/ReasoningPart" }, @@ -5626,9 +7624,2251 @@ }, { "$ref": "#/components/schemas/RetryPart" + }, + { + "$ref": "#/components/schemas/CompactionPart" } ] }, + "Event.message.part.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "message.part.updated" + }, + "properties": { + "type": "object", + "properties": { + "part": { + "$ref": "#/components/schemas/Part" + }, + "delta": { + "type": "string" + } + }, + "required": [ + "part" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.message.part.removed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "message.part.removed" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageID": { + "type": "string" + }, + "partID": { + "type": "string" + } + }, + "required": [ + "sessionID", + "messageID", + "partID" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.compacted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.compacted" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + } + }, + "required": [ + "sessionID" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "PermissionAction": { + "type": "string", + "enum": [ + "allow", + "deny", + "ask" + ] + }, + "PermissionRule": { + "type": "object", + "properties": { + "permission": { + "type": "string" + }, + "pattern": { + "type": "string" + }, + "action": { + "$ref": "#/components/schemas/PermissionAction" + } + }, + "required": [ + "permission", + "pattern", + "action" + ] + }, + "PermissionRuleset": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionRule" + } + }, + "Session": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^ses.*" + }, + "projectID": { + "type": "string" + }, + "directory": { + "type": "string" + }, + "parentID": { + "type": "string", + "pattern": "^ses.*" + }, + "summary": { + "type": "object", + "properties": { + "additions": { + "type": "number" + }, + "deletions": { + "type": "number" + }, + "files": { + "type": "number" + }, + "diffs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FileDiff" + } + } + }, + "required": [ + "additions", + "deletions", + "files" + ] + }, + "share": { + "type": "object", + "properties": { + "url": { + "type": "string" + } + }, + "required": [ + "url" + ] + }, + "title": { + "type": "string" + }, + "version": { + "type": "string" + }, + "time": { + "type": "object", + "properties": { + "created": { + "type": "number" + }, + "updated": { + "type": "number" + }, + "compacting": { + "type": "number" + }, + "archived": { + "type": "number" + } + }, + "required": [ + "created", + "updated" + ] + }, + "permission": { + "$ref": "#/components/schemas/PermissionRuleset" + }, + "revert": { + "type": "object", + "properties": { + "messageID": { + "type": "string" + }, + "partID": { + "type": "string" + }, + "snapshot": { + "type": "string" + }, + "diff": { + "type": "string" + } + }, + "required": [ + "messageID" + ] + } + }, + "required": [ + "id", + "projectID", + "directory", + "title", + "version", + "time" + ] + }, + "Event.session.created": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.created" + }, + "properties": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Session" + } + }, + "required": [ + "info" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.updated": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.updated" + }, + "properties": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Session" + } + }, + "required": [ + "info" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.deleted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.deleted" + }, + "properties": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Session" + } + }, + "required": [ + "info" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.diff": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.diff" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "diff": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FileDiff" + } + } + }, + "required": [ + "sessionID", + "diff" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.error": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.error" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/ProviderAuthError" + }, + { + "$ref": "#/components/schemas/UnknownError" + }, + { + "$ref": "#/components/schemas/MessageOutputLengthError" + }, + { + "$ref": "#/components/schemas/MessageAbortedError" + }, + { + "$ref": "#/components/schemas/APIError" + } + ] + } + } + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.server.connected": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "server.connected" + }, + "properties": { + "type": "object", + "properties": {} + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.global.disposed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "global.disposed" + }, + "properties": { + "type": "object", + "properties": {} + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event": { + "anyOf": [ + { + "$ref": "#/components/schemas/Event.tui.prompt.append" + }, + { + "$ref": "#/components/schemas/Event.tui.command.execute" + }, + { + "$ref": "#/components/schemas/Event.tui.toast.show" + }, + { + "$ref": "#/components/schemas/Event.tui.session.select" + }, + { + "$ref": "#/components/schemas/Event.installation.updated" + }, + { + "$ref": "#/components/schemas/Event.installation.update-available" + }, + { + "$ref": "#/components/schemas/Event.project.updated" + }, + { + "$ref": "#/components/schemas/Event.server.instance.disposed" + }, + { + "$ref": "#/components/schemas/Event.file.edited" + }, + { + "$ref": "#/components/schemas/Event.lsp.client.diagnostics" + }, + { + "$ref": "#/components/schemas/Event.permission.asked" + }, + { + "$ref": "#/components/schemas/Event.permission.replied" + }, + { + "$ref": "#/components/schemas/Event.session.status" + }, + { + "$ref": "#/components/schemas/Event.session.idle" + }, + { + "$ref": "#/components/schemas/Event.question.asked" + }, + { + "$ref": "#/components/schemas/Event.question.replied" + }, + { + "$ref": "#/components/schemas/Event.question.rejected" + }, + { + "$ref": "#/components/schemas/Event.todo.updated" + }, + { + "$ref": "#/components/schemas/Event.pty.created" + }, + { + "$ref": "#/components/schemas/Event.pty.updated" + }, + { + "$ref": "#/components/schemas/Event.pty.exited" + }, + { + "$ref": "#/components/schemas/Event.pty.deleted" + }, + { + "$ref": "#/components/schemas/Event.mcp.tools.changed" + }, + { + "$ref": "#/components/schemas/Event.file.watcher.updated" + }, + { + "$ref": "#/components/schemas/Event.lsp.updated" + }, + { + "$ref": "#/components/schemas/Event.command.executed" + }, + { + "$ref": "#/components/schemas/Event.vcs.branch.updated" + }, + { + "$ref": "#/components/schemas/Event.message.updated" + }, + { + "$ref": "#/components/schemas/Event.message.removed" + }, + { + "$ref": "#/components/schemas/Event.message.part.updated" + }, + { + "$ref": "#/components/schemas/Event.message.part.removed" + }, + { + "$ref": "#/components/schemas/Event.session.compacted" + }, + { + "$ref": "#/components/schemas/Event.session.created" + }, + { + "$ref": "#/components/schemas/Event.session.updated" + }, + { + "$ref": "#/components/schemas/Event.session.deleted" + }, + { + "$ref": "#/components/schemas/Event.session.diff" + }, + { + "$ref": "#/components/schemas/Event.session.error" + }, + { + "$ref": "#/components/schemas/Event.server.connected" + }, + { + "$ref": "#/components/schemas/Event.global.disposed" + } + ] + }, + "GlobalEvent": { + "type": "object", + "properties": { + "directory": { + "type": "string" + }, + "payload": { + "$ref": "#/components/schemas/Event" + } + }, + "required": [ + "directory", + "payload" + ] + }, + "BadRequestError": { + "type": "object", + "properties": { + "data": {}, + "errors": { + "type": "array", + "items": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "success": { + "type": "boolean", + "const": false + } + }, + "required": [ + "data", + "errors", + "success" + ] + }, + "NotFoundError": { + "type": "object", + "properties": { + "name": { + "type": "string", + "const": "NotFoundError" + }, + "data": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + }, + "required": [ + "name", + "data" + ] + }, + "KeybindsConfig": { + "description": "Custom keybind configurations", + "type": "object", + "properties": { + "leader": { + "description": "Leader key for keybind combinations", + "default": "ctrl+x", + "type": "string" + }, + "app_exit": { + "description": "Exit the application", + "default": "ctrl+c,ctrl+d,q", + "type": "string" + }, + "editor_open": { + "description": "Open external editor", + "default": "e", + "type": "string" + }, + "theme_list": { + "description": "List available themes", + "default": "t", + "type": "string" + }, + "sidebar_toggle": { + "description": "Toggle sidebar", + "default": "b", + "type": "string" + }, + "scrollbar_toggle": { + "description": "Toggle session scrollbar", + "default": "none", + "type": "string" + }, + "username_toggle": { + "description": "Toggle username visibility", + "default": "none", + "type": "string" + }, + "status_view": { + "description": "View status", + "default": "s", + "type": "string" + }, + "session_export": { + "description": "Export session to editor", + "default": "x", + "type": "string" + }, + "session_new": { + "description": "Create a new session", + "default": "n", + "type": "string" + }, + "session_list": { + "description": "List all sessions", + "default": "l", + "type": "string" + }, + "session_timeline": { + "description": "Show session timeline", + "default": "g", + "type": "string" + }, + "session_fork": { + "description": "Fork session from message", + "default": "none", + "type": "string" + }, + "session_rename": { + "description": "Rename session", + "default": "none", + "type": "string" + }, + "session_share": { + "description": "Share current session", + "default": "none", + "type": "string" + }, + "session_unshare": { + "description": "Unshare current session", + "default": "none", + "type": "string" + }, + "session_interrupt": { + "description": "Interrupt current session", + "default": "escape", + "type": "string" + }, + "session_compact": { + "description": "Compact the session", + "default": "c", + "type": "string" + }, + "messages_page_up": { + "description": "Scroll messages up by one page", + "default": "pageup", + "type": "string" + }, + "messages_page_down": { + "description": "Scroll messages down by one page", + "default": "pagedown", + "type": "string" + }, + "messages_half_page_up": { + "description": "Scroll messages up by half page", + "default": "ctrl+alt+u", + "type": "string" + }, + "messages_half_page_down": { + "description": "Scroll messages down by half page", + "default": "ctrl+alt+d", + "type": "string" + }, + "messages_first": { + "description": "Navigate to first message", + "default": "ctrl+g,home", + "type": "string" + }, + "messages_last": { + "description": "Navigate to last message", + "default": "ctrl+alt+g,end", + "type": "string" + }, + "messages_next": { + "description": "Navigate to next message", + "default": "none", + "type": "string" + }, + "messages_previous": { + "description": "Navigate to previous message", + "default": "none", + "type": "string" + }, + "messages_last_user": { + "description": "Navigate to last user message", + "default": "none", + "type": "string" + }, + "messages_copy": { + "description": "Copy message", + "default": "y", + "type": "string" + }, + "messages_undo": { + "description": "Undo message", + "default": "u", + "type": "string" + }, + "messages_redo": { + "description": "Redo message", + "default": "r", + "type": "string" + }, + "messages_toggle_conceal": { + "description": "Toggle code block concealment in messages", + "default": "h", + "type": "string" + }, + "tool_details": { + "description": "Toggle tool details visibility", + "default": "none", + "type": "string" + }, + "model_list": { + "description": "List available models", + "default": "m", + "type": "string" + }, + "model_cycle_recent": { + "description": "Next recently used model", + "default": "f2", + "type": "string" + }, + "model_cycle_recent_reverse": { + "description": "Previous recently used model", + "default": "shift+f2", + "type": "string" + }, + "model_cycle_favorite": { + "description": "Next favorite model", + "default": "none", + "type": "string" + }, + "model_cycle_favorite_reverse": { + "description": "Previous favorite model", + "default": "none", + "type": "string" + }, + "command_list": { + "description": "List available commands", + "default": "ctrl+p", + "type": "string" + }, + "agent_list": { + "description": "List agents", + "default": "a", + "type": "string" + }, + "agent_cycle": { + "description": "Next agent", + "default": "tab", + "type": "string" + }, + "agent_cycle_reverse": { + "description": "Previous agent", + "default": "shift+tab", + "type": "string" + }, + "variant_cycle": { + "description": "Cycle model variants", + "default": "ctrl+t", + "type": "string" + }, + "input_clear": { + "description": "Clear input field", + "default": "ctrl+c", + "type": "string" + }, + "input_paste": { + "description": "Paste from clipboard", + "default": "ctrl+v", + "type": "string" + }, + "input_submit": { + "description": "Submit input", + "default": "return", + "type": "string" + }, + "input_newline": { + "description": "Insert newline in input", + "default": "shift+return,ctrl+return,alt+return,ctrl+j", + "type": "string" + }, + "input_move_left": { + "description": "Move cursor left in input", + "default": "left,ctrl+b", + "type": "string" + }, + "input_move_right": { + "description": "Move cursor right in input", + "default": "right,ctrl+f", + "type": "string" + }, + "input_move_up": { + "description": "Move cursor up in input", + "default": "up", + "type": "string" + }, + "input_move_down": { + "description": "Move cursor down in input", + "default": "down", + "type": "string" + }, + "input_select_left": { + "description": "Select left in input", + "default": "shift+left", + "type": "string" + }, + "input_select_right": { + "description": "Select right in input", + "default": "shift+right", + "type": "string" + }, + "input_select_up": { + "description": "Select up in input", + "default": "shift+up", + "type": "string" + }, + "input_select_down": { + "description": "Select down in input", + "default": "shift+down", + "type": "string" + }, + "input_line_home": { + "description": "Move to start of line in input", + "default": "ctrl+a", + "type": "string" + }, + "input_line_end": { + "description": "Move to end of line in input", + "default": "ctrl+e", + "type": "string" + }, + "input_select_line_home": { + "description": "Select to start of line in input", + "default": "ctrl+shift+a", + "type": "string" + }, + "input_select_line_end": { + "description": "Select to end of line in input", + "default": "ctrl+shift+e", + "type": "string" + }, + "input_visual_line_home": { + "description": "Move to start of visual line in input", + "default": "alt+a", + "type": "string" + }, + "input_visual_line_end": { + "description": "Move to end of visual line in input", + "default": "alt+e", + "type": "string" + }, + "input_select_visual_line_home": { + "description": "Select to start of visual line in input", + "default": "alt+shift+a", + "type": "string" + }, + "input_select_visual_line_end": { + "description": "Select to end of visual line in input", + "default": "alt+shift+e", + "type": "string" + }, + "input_buffer_home": { + "description": "Move to start of buffer in input", + "default": "home", + "type": "string" + }, + "input_buffer_end": { + "description": "Move to end of buffer in input", + "default": "end", + "type": "string" + }, + "input_select_buffer_home": { + "description": "Select to start of buffer in input", + "default": "shift+home", + "type": "string" + }, + "input_select_buffer_end": { + "description": "Select to end of buffer in input", + "default": "shift+end", + "type": "string" + }, + "input_delete_line": { + "description": "Delete line in input", + "default": "ctrl+shift+d", + "type": "string" + }, + "input_delete_to_line_end": { + "description": "Delete to end of line in input", + "default": "ctrl+k", + "type": "string" + }, + "input_delete_to_line_start": { + "description": "Delete to start of line in input", + "default": "ctrl+u", + "type": "string" + }, + "input_backspace": { + "description": "Backspace in input", + "default": "backspace,shift+backspace", + "type": "string" + }, + "input_delete": { + "description": "Delete character in input", + "default": "ctrl+d,delete,shift+delete", + "type": "string" + }, + "input_undo": { + "description": "Undo in input", + "default": "ctrl+-,super+z", + "type": "string" + }, + "input_redo": { + "description": "Redo in input", + "default": "ctrl+.,super+shift+z", + "type": "string" + }, + "input_word_forward": { + "description": "Move word forward in input", + "default": "alt+f,alt+right,ctrl+right", + "type": "string" + }, + "input_word_backward": { + "description": "Move word backward in input", + "default": "alt+b,alt+left,ctrl+left", + "type": "string" + }, + "input_select_word_forward": { + "description": "Select word forward in input", + "default": "alt+shift+f,alt+shift+right", + "type": "string" + }, + "input_select_word_backward": { + "description": "Select word backward in input", + "default": "alt+shift+b,alt+shift+left", + "type": "string" + }, + "input_delete_word_forward": { + "description": "Delete word forward in input", + "default": "alt+d,alt+delete,ctrl+delete", + "type": "string" + }, + "input_delete_word_backward": { + "description": "Delete word backward in input", + "default": "ctrl+w,ctrl+backspace,alt+backspace", + "type": "string" + }, + "history_previous": { + "description": "Previous history item", + "default": "up", + "type": "string" + }, + "history_next": { + "description": "Next history item", + "default": "down", + "type": "string" + }, + "session_child_cycle": { + "description": "Next child session", + "default": "right", + "type": "string" + }, + "session_child_cycle_reverse": { + "description": "Previous child session", + "default": "left", + "type": "string" + }, + "session_parent": { + "description": "Go to parent session", + "default": "up", + "type": "string" + }, + "terminal_suspend": { + "description": "Suspend terminal", + "default": "ctrl+z", + "type": "string" + }, + "terminal_title_toggle": { + "description": "Toggle terminal title", + "default": "none", + "type": "string" + }, + "tips_toggle": { + "description": "Toggle tips on home screen", + "default": "h", + "type": "string" + } + }, + "additionalProperties": false + }, + "LogLevel": { + "description": "Log level", + "type": "string", + "enum": [ + "DEBUG", + "INFO", + "WARN", + "ERROR" + ] + }, + "ServerConfig": { + "description": "Server configuration for opencode serve and web commands", + "type": "object", + "properties": { + "port": { + "description": "Port to listen on", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "hostname": { + "description": "Hostname to listen on", + "type": "string" + }, + "mdns": { + "description": "Enable mDNS service discovery", + "type": "boolean" + }, + "cors": { + "description": "Additional domains to allow for CORS", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "PermissionActionConfig": { + "type": "string", + "enum": [ + "ask", + "allow", + "deny" + ] + }, + "PermissionObjectConfig": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "$ref": "#/components/schemas/PermissionActionConfig" + } + }, + "PermissionRuleConfig": { + "anyOf": [ + { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + { + "$ref": "#/components/schemas/PermissionObjectConfig" + } + ] + }, + "PermissionConfig": { + "anyOf": [ + { + "type": "object", + "properties": { + "__originalKeys": { + "type": "array", + "items": { + "type": "string" + } + }, + "read": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "edit": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "glob": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "grep": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "list": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "bash": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "task": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "external_directory": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "todowrite": { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + "todoread": { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + "question": { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + "webfetch": { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + "websearch": { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + "codesearch": { + "$ref": "#/components/schemas/PermissionActionConfig" + }, + "lsp": { + "$ref": "#/components/schemas/PermissionRuleConfig" + }, + "doom_loop": { + "$ref": "#/components/schemas/PermissionActionConfig" + } + }, + "additionalProperties": { + "$ref": "#/components/schemas/PermissionRuleConfig" + } + }, + { + "$ref": "#/components/schemas/PermissionActionConfig" + } + ] + }, + "AgentConfig": { + "type": "object", + "properties": { + "model": { + "type": "string" + }, + "temperature": { + "type": "number" + }, + "top_p": { + "type": "number" + }, + "prompt": { + "type": "string" + }, + "tools": { + "description": "@deprecated Use 'permission' field instead", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "disable": { + "type": "boolean" + }, + "description": { + "description": "Description of when to use the agent", + "type": "string" + }, + "mode": { + "type": "string", + "enum": [ + "subagent", + "primary", + "all" + ] + }, + "hidden": { + "description": "Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)", + "type": "boolean" + }, + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "color": { + "description": "Hex color code for the agent (e.g., #FF5733)", + "type": "string", + "pattern": "^#[0-9a-fA-F]{6}$" + }, + "steps": { + "description": "Maximum number of agentic iterations before forcing text-only response", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "maxSteps": { + "description": "@deprecated Use 'steps' field instead.", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "permission": { + "$ref": "#/components/schemas/PermissionConfig" + } + }, + "additionalProperties": {} + }, + "ProviderConfig": { + "type": "object", + "properties": { + "api": { + "type": "string" + }, + "name": { + "type": "string" + }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "npm": { + "type": "string" + }, + "models": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "family": { + "type": "string" + }, + "release_date": { + "type": "string" + }, + "attachment": { + "type": "boolean" + }, + "reasoning": { + "type": "boolean" + }, + "temperature": { + "type": "boolean" + }, + "tool_call": { + "type": "boolean" + }, + "interleaved": { + "anyOf": [ + { + "type": "boolean", + "const": true + }, + { + "type": "object", + "properties": { + "field": { + "type": "string", + "enum": [ + "reasoning_content", + "reasoning_details" + ] + } + }, + "required": [ + "field" + ], + "additionalProperties": false + } + ] + }, + "cost": { + "type": "object", + "properties": { + "input": { + "type": "number" + }, + "output": { + "type": "number" + }, + "cache_read": { + "type": "number" + }, + "cache_write": { + "type": "number" + }, + "context_over_200k": { + "type": "object", + "properties": { + "input": { + "type": "number" + }, + "output": { + "type": "number" + }, + "cache_read": { + "type": "number" + }, + "cache_write": { + "type": "number" + } + }, + "required": [ + "input", + "output" + ] + } + }, + "required": [ + "input", + "output" + ] + }, + "limit": { + "type": "object", + "properties": { + "context": { + "type": "number" + }, + "output": { + "type": "number" + } + }, + "required": [ + "context", + "output" + ] + }, + "modalities": { + "type": "object", + "properties": { + "input": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] + } + }, + "output": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] + } + } + }, + "required": [ + "input", + "output" + ] + }, + "experimental": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "alpha", + "beta", + "deprecated" + ] + }, + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "headers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "provider": { + "type": "object", + "properties": { + "npm": { + "type": "string" + } + }, + "required": [ + "npm" + ] + }, + "variants": { + "description": "Variant-specific configuration", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "disabled": { + "description": "Disable this variant for the model", + "type": "boolean" + } + }, + "additionalProperties": {} + } + } + } + } + }, + "whitelist": { + "type": "array", + "items": { + "type": "string" + } + }, + "blacklist": { + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "baseURL": { + "type": "string" + }, + "enterpriseUrl": { + "description": "GitHub Enterprise URL for copilot authentication", + "type": "string" + }, + "setCacheKey": { + "description": "Enable promptCacheKey for this provider (default false)", + "type": "boolean" + }, + "timeout": { + "description": "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.", + "anyOf": [ + { + "description": "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + { + "description": "Disable timeout for this provider entirely.", + "type": "boolean", + "const": false + } + ] + } + }, + "additionalProperties": {} + } + }, + "additionalProperties": false + }, + "McpLocalConfig": { + "type": "object", + "properties": { + "type": { + "description": "Type of MCP server connection", + "type": "string", + "const": "local" + }, + "command": { + "description": "Command and arguments to run the MCP server", + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "description": "Environment variables to set when running the MCP server", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "enabled": { + "description": "Enable or disable the MCP server on startup", + "type": "boolean" + }, + "timeout": { + "description": "Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": [ + "type", + "command" + ], + "additionalProperties": false + }, + "McpOAuthConfig": { + "type": "object", + "properties": { + "clientId": { + "description": "OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted.", + "type": "string" + }, + "clientSecret": { + "description": "OAuth client secret (if required by the authorization server)", + "type": "string" + }, + "scope": { + "description": "OAuth scopes to request during authorization", + "type": "string" + } + }, + "additionalProperties": false + }, + "McpRemoteConfig": { + "type": "object", + "properties": { + "type": { + "description": "Type of MCP server connection", + "type": "string", + "const": "remote" + }, + "url": { + "description": "URL of the remote MCP server", + "type": "string" + }, + "enabled": { + "description": "Enable or disable the MCP server on startup", + "type": "boolean" + }, + "headers": { + "description": "Headers to send with the request", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "oauth": { + "description": "OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.", + "anyOf": [ + { + "$ref": "#/components/schemas/McpOAuthConfig" + }, + { + "type": "boolean", + "const": false + } + ] + }, + "timeout": { + "description": "Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": [ + "type", + "url" + ], + "additionalProperties": false + }, + "LayoutConfig": { + "description": "@deprecated Always uses stretch layout.", + "type": "string", + "enum": [ + "auto", + "stretch" + ] + }, + "Config": { + "type": "object", + "properties": { + "$schema": { + "description": "JSON schema reference for configuration validation", + "type": "string" + }, + "theme": { + "description": "Theme name to use for the interface", + "type": "string" + }, + "keybinds": { + "$ref": "#/components/schemas/KeybindsConfig" + }, + "logLevel": { + "$ref": "#/components/schemas/LogLevel" + }, + "tui": { + "description": "TUI specific settings", + "type": "object", + "properties": { + "scroll_speed": { + "description": "TUI scroll speed", + "type": "number", + "minimum": 0.001 + }, + "scroll_acceleration": { + "description": "Scroll acceleration settings", + "type": "object", + "properties": { + "enabled": { + "description": "Enable scroll acceleration", + "type": "boolean" + } + }, + "required": [ + "enabled" + ] + }, + "diff_style": { + "description": "Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column", + "type": "string", + "enum": [ + "auto", + "stacked" + ] + } + } + }, + "server": { + "$ref": "#/components/schemas/ServerConfig" + }, + "command": { + "description": "Command configuration, see https://opencode.ai/docs/commands", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "template": { + "type": "string" + }, + "description": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "model": { + "type": "string" + }, + "subtask": { + "type": "boolean" + } + }, + "required": [ + "template" + ] + } + }, + "watcher": { + "type": "object", + "properties": { + "ignore": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "plugin": { + "type": "array", + "items": { + "type": "string" + } + }, + "snapshot": { + "type": "boolean" + }, + "share": { + "description": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing", + "type": "string", + "enum": [ + "manual", + "auto", + "disabled" + ] + }, + "autoshare": { + "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically", + "type": "boolean" + }, + "autoupdate": { + "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "const": "notify" + } + ] + }, + "disabled_providers": { + "description": "Disable providers that are loaded automatically", + "type": "array", + "items": { + "type": "string" + } + }, + "enabled_providers": { + "description": "When set, ONLY these providers will be enabled. All other providers will be ignored", + "type": "array", + "items": { + "type": "string" + } + }, + "model": { + "description": "Model to use in the format of provider/model, eg anthropic/claude-2", + "type": "string" + }, + "small_model": { + "description": "Small model to use for tasks like title generation in the format of provider/model", + "type": "string" + }, + "default_agent": { + "description": "Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid.", + "type": "string" + }, + "username": { + "description": "Custom username to display in conversations instead of system username", + "type": "string" + }, + "mode": { + "description": "@deprecated Use `agent` field instead.", + "type": "object", + "properties": { + "build": { + "$ref": "#/components/schemas/AgentConfig" + }, + "plan": { + "$ref": "#/components/schemas/AgentConfig" + } + }, + "additionalProperties": { + "$ref": "#/components/schemas/AgentConfig" + } + }, + "agent": { + "description": "Agent configuration, see https://opencode.ai/docs/agent", + "type": "object", + "properties": { + "plan": { + "$ref": "#/components/schemas/AgentConfig" + }, + "build": { + "$ref": "#/components/schemas/AgentConfig" + }, + "general": { + "$ref": "#/components/schemas/AgentConfig" + }, + "explore": { + "$ref": "#/components/schemas/AgentConfig" + }, + "title": { + "$ref": "#/components/schemas/AgentConfig" + }, + "summary": { + "$ref": "#/components/schemas/AgentConfig" + }, + "compaction": { + "$ref": "#/components/schemas/AgentConfig" + } + }, + "additionalProperties": { + "$ref": "#/components/schemas/AgentConfig" + } + }, + "provider": { + "description": "Custom provider configurations and model overrides", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "$ref": "#/components/schemas/ProviderConfig" + } + }, + "mcp": { + "description": "MCP (Model Context Protocol) server configurations", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "anyOf": [ + { + "anyOf": [ + { + "$ref": "#/components/schemas/McpLocalConfig" + }, + { + "$ref": "#/components/schemas/McpRemoteConfig" + } + ] + }, + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + ] + } + }, + "formatter": { + "anyOf": [ + { + "type": "boolean", + "const": false + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "disabled": { + "type": "boolean" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + ] + }, + "lsp": { + "anyOf": [ + { + "type": "boolean", + "const": false + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "const": true + } + }, + "required": [ + "disabled" + ] + }, + { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + }, + "disabled": { + "type": "boolean" + }, + "env": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "initialization": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": [ + "command" + ] + } + ] + } + } + ] + }, + "instructions": { + "description": "Additional instruction files or patterns to include", + "type": "array", + "items": { + "type": "string" + } + }, + "layout": { + "$ref": "#/components/schemas/LayoutConfig" + }, + "permission": { + "$ref": "#/components/schemas/PermissionConfig" + }, + "tools": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "enterprise": { + "type": "object", + "properties": { + "url": { + "description": "Enterprise URL", + "type": "string" + } + } + }, + "compaction": { + "type": "object", + "properties": { + "auto": { + "description": "Enable automatic compaction when context is full (default: true)", + "type": "boolean" + }, + "prune": { + "description": "Enable pruning of old tool outputs (default: true)", + "type": "boolean" + } + } + }, + "experimental": { + "type": "object", + "properties": { + "hook": { + "type": "object", + "properties": { + "file_edited": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "array", + "items": { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "command" + ] + } + } + }, + "session_completed": { + "type": "array", + "items": { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "command" + ] + } + } + } + }, + "chatMaxRetries": { + "description": "Number of retries for chat completions on failure", + "type": "number" + }, + "disable_paste_summary": { + "type": "boolean" + }, + "batch_tool": { + "description": "Enable the batch tool", + "type": "boolean" + }, + "openTelemetry": { + "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)", + "type": "boolean" + }, + "primary_tools": { + "description": "Tools that should only be available to primary agents.", + "type": "array", + "items": { + "type": "string" + } + }, + "continue_loop_on_deny": { + "description": "Continue the agent loop when a tool call is denied", + "type": "boolean" + }, + "mcp_timeout": { + "description": "Timeout in milliseconds for model context protocol (MCP) requests", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + } + } + }, + "additionalProperties": false + }, + "ToolIDs": { + "type": "array", + "items": { + "type": "string" + } + }, + "ToolListItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": {} + }, + "required": [ + "id", + "description", + "parameters" + ] + }, + "ToolList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ToolListItem" + } + }, + "Path": { + "type": "object", + "properties": { + "home": { + "type": "string" + }, + "state": { + "type": "string" + }, + "config": { + "type": "string" + }, + "worktree": { + "type": "string" + }, + "directory": { + "type": "string" + } + }, + "required": [ + "home", + "state", + "config", + "worktree", + "directory" + ] + }, + "Worktree": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "branch": { + "type": "string" + }, + "directory": { + "type": "string" + } + }, + "required": [ + "name", + "branch", + "directory" + ] + }, + "WorktreeCreateInput": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "startCommand": { + "type": "string" + } + } + }, + "VcsInfo": { + "type": "object", + "properties": { + "branch": { + "type": "string" + } + }, + "required": [ + "branch" + ] + }, "TextPartInput": { "type": "object", "properties": { @@ -5645,6 +9885,9 @@ "synthetic": { "type": "boolean" }, + "ignored": { + "type": "boolean" + }, "time": { "type": "object", "properties": { @@ -5743,6 +9986,36 @@ "name" ] }, + "SubtaskPartInput": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "const": "subtask" + }, + "prompt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "command": { + "type": "string" + } + }, + "required": [ + "type", + "prompt", + "description", + "agent" + ] + }, "Command": { "type": "object", "properties": { @@ -5758,16 +10031,33 @@ "model": { "type": "string" }, + "mcp": { + "type": "boolean" + }, "template": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "type": "string" + } + ] }, "subtask": { "type": "boolean" + }, + "hints": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ "name", - "template" + "template", + "hints" ] }, "Model": { @@ -5776,23 +10066,135 @@ "id": { "type": "string" }, + "providerID": { + "type": "string" + }, + "api": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "url": { + "type": "string" + }, + "npm": { + "type": "string" + } + }, + "required": [ + "id", + "url", + "npm" + ] + }, "name": { "type": "string" }, - "release_date": { + "family": { "type": "string" }, - "attachment": { - "type": "boolean" - }, - "reasoning": { - "type": "boolean" - }, - "temperature": { - "type": "boolean" - }, - "tool_call": { - "type": "boolean" + "capabilities": { + "type": "object", + "properties": { + "temperature": { + "type": "boolean" + }, + "reasoning": { + "type": "boolean" + }, + "attachment": { + "type": "boolean" + }, + "toolcall": { + "type": "boolean" + }, + "input": { + "type": "object", + "properties": { + "text": { + "type": "boolean" + }, + "audio": { + "type": "boolean" + }, + "image": { + "type": "boolean" + }, + "video": { + "type": "boolean" + }, + "pdf": { + "type": "boolean" + } + }, + "required": [ + "text", + "audio", + "image", + "video", + "pdf" + ] + }, + "output": { + "type": "object", + "properties": { + "text": { + "type": "boolean" + }, + "audio": { + "type": "boolean" + }, + "image": { + "type": "boolean" + }, + "video": { + "type": "boolean" + }, + "pdf": { + "type": "boolean" + } + }, + "required": [ + "text", + "audio", + "image", + "video", + "pdf" + ] + }, + "interleaved": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "field": { + "type": "string", + "enum": [ + "reasoning_content", + "reasoning_details" + ] + } + }, + "required": [ + "field" + ] + } + ] + } + }, + "required": [ + "temperature", + "reasoning", + "attachment", + "toolcall", + "input", + "output", + "interleaved" + ] }, "cost": { "type": "object", @@ -5803,16 +10205,57 @@ "output": { "type": "number" }, - "cache_read": { - "type": "number" + "cache": { + "type": "object", + "properties": { + "read": { + "type": "number" + }, + "write": { + "type": "number" + } + }, + "required": [ + "read", + "write" + ] }, - "cache_write": { - "type": "number" + "experimentalOver200K": { + "type": "object", + "properties": { + "input": { + "type": "number" + }, + "output": { + "type": "number" + }, + "cache": { + "type": "object", + "properties": { + "read": { + "type": "number" + }, + "write": { + "type": "number" + } + }, + "required": [ + "read", + "write" + ] + } + }, + "required": [ + "input", + "output", + "cache" + ] } }, "required": [ "input", - "output" + "output", + "cache" ] }, "limit": { @@ -5830,50 +10273,13 @@ "output" ] }, - "modalities": { - "type": "object", - "properties": { - "input": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "text", - "audio", - "image", - "video", - "pdf" - ] - } - }, - "output": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "text", - "audio", - "image", - "video", - "pdf" - ] - } - } - }, - "required": [ - "input", - "output" - ] - }, - "experimental": { - "type": "boolean" - }, "status": { "type": "string", "enum": [ "alpha", "beta", - "deprecated" + "deprecated", + "active" ] }, "options": { @@ -5892,51 +10298,70 @@ "type": "string" } }, - "provider": { + "release_date": { + "type": "string" + }, + "variants": { "type": "object", - "properties": { - "npm": { - "type": "string" - } + "propertyNames": { + "type": "string" }, - "required": [ - "npm" - ] + "additionalProperties": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } } }, "required": [ "id", + "providerID", + "api", "name", - "release_date", - "attachment", - "reasoning", - "temperature", - "tool_call", + "capabilities", "cost", "limit", - "options" + "status", + "options", + "headers", + "release_date" ] }, "Provider": { "type": "object", "properties": { - "api": { + "id": { "type": "string" }, "name": { "type": "string" }, + "source": { + "type": "string", + "enum": [ + "env", + "config", + "custom", + "api" + ] + }, "env": { "type": "array", "items": { "type": "string" } }, - "id": { + "key": { "type": "string" }, - "npm": { - "type": "string" + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} }, "models": { "type": "object", @@ -5949,12 +10374,66 @@ } }, "required": [ - "name", - "env", "id", + "name", + "source", + "env", + "options", "models" ] }, + "ProviderAuthMethod": { + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "oauth" + }, + { + "type": "string", + "const": "api" + } + ] + }, + "label": { + "type": "string" + } + }, + "required": [ + "type", + "label" + ] + }, + "ProviderAuthAuthorization": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "method": { + "anyOf": [ + { + "type": "string", + "const": "auto" + }, + { + "type": "string", + "const": "code" + } + ] + }, + "instructions": { + "type": "string" + } + }, + "required": [ + "url", + "method", + "instructions" + ] + }, "Symbol": { "type": "object", "properties": { @@ -6143,22 +10622,17 @@ "type": "string" }, "mode": { - "anyOf": [ - { - "type": "string", - "const": "subagent" - }, - { - "type": "string", - "const": "primary" - }, - { - "type": "string", - "const": "all" - } + "type": "string", + "enum": [ + "subagent", + "primary", + "all" ] }, - "builtIn": { + "native": { + "type": "boolean" + }, + "hidden": { "type": "boolean" }, "topP": { @@ -6167,68 +10641,11 @@ "temperature": { "type": "number" }, + "color": { + "type": "string" + }, "permission": { - "type": "object", - "properties": { - "edit": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - }, - "bash": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - } - }, - "webfetch": { - "anyOf": [ - { - "type": "string", - "const": "ask" - }, - { - "type": "string", - "const": "allow" - }, - { - "type": "string", - "const": "deny" - } - ] - } - }, - "required": [ - "edit", - "bash" - ] + "$ref": "#/components/schemas/PermissionRuleset" }, "model": { "type": "object", @@ -6248,29 +10665,23 @@ "prompt": { "type": "string" }, - "tools": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "boolean" - } - }, "options": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} + }, + "steps": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 } }, "required": [ "name", "mode", - "builtIn", "permission", - "tools", "options" ] }, @@ -6314,6 +10725,34 @@ "error" ] }, + "MCPStatusNeedsAuth": { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "needs_auth" + } + }, + "required": [ + "status" + ] + }, + "MCPStatusNeedsClientRegistration": { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "needs_client_registration" + }, + "error": { + "type": "string" + } + }, + "required": [ + "status", + "error" + ] + }, "MCPStatus": { "anyOf": [ { @@ -6324,9 +10763,40 @@ }, { "$ref": "#/components/schemas/MCPStatusFailed" + }, + { + "$ref": "#/components/schemas/MCPStatusNeedsAuth" + }, + { + "$ref": "#/components/schemas/MCPStatusNeedsClientRegistration" } ] }, + "McpResource": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "description": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "client": { + "type": "string" + } + }, + "required": [ + "name", + "uri", + "client" + ] + }, "LSPStatus": { "type": "object", "properties": { @@ -6381,119 +10851,6 @@ "enabled" ] }, - "Event.tui.prompt.append": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tui.prompt.append" - }, - "properties": { - "type": "object", - "properties": { - "text": { - "type": "string" - } - }, - "required": [ - "text" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.tui.command.execute": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tui.command.execute" - }, - "properties": { - "type": "object", - "properties": { - "command": { - "anyOf": [ - { - "type": "string", - "enum": [ - "session.list", - "session.new", - "session.share", - "session.interrupt", - "session.compact", - "session.page.up", - "session.page.down", - "session.half.page.up", - "session.half.page.down", - "session.first", - "session.last", - "prompt.clear", - "prompt.submit", - "agent.cycle" - ] - }, - { - "type": "string" - } - ] - } - }, - "required": [ - "command" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.tui.toast.show": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tui.toast.show" - }, - "properties": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "message": { - "type": "string" - }, - "variant": { - "type": "string", - "enum": [ - "info", - "success", - "warning", - "error" - ] - }, - "duration": { - "description": "Duration in milliseconds", - "default": 5000, - "type": "number" - } - }, - "required": [ - "message", - "variant" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, "OAuth": { "type": "object", "properties": { @@ -6509,6 +10866,12 @@ }, "expires": { "type": "number" + }, + "accountId": { + "type": "string" + }, + "enterpriseUrl": { + "type": "string" } }, "required": [ @@ -6566,681 +10929,6 @@ "$ref": "#/components/schemas/WellKnownAuth" } ] - }, - "Event.installation.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "installation.updated" - }, - "properties": { - "type": "object", - "properties": { - "version": { - "type": "string" - } - }, - "required": [ - "version" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.lsp.client.diagnostics": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "lsp.client.diagnostics" - }, - "properties": { - "type": "object", - "properties": { - "serverID": { - "type": "string" - }, - "path": { - "type": "string" - } - }, - "required": [ - "serverID", - "path" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.lsp.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "lsp.updated" - }, - "properties": { - "type": "object", - "properties": {} - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.message.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.updated" - }, - "properties": { - "type": "object", - "properties": { - "info": { - "$ref": "#/components/schemas/Message" - } - }, - "required": [ - "info" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.message.removed": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.removed" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - }, - "messageID": { - "type": "string" - } - }, - "required": [ - "sessionID", - "messageID" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.message.part.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.part.updated" - }, - "properties": { - "type": "object", - "properties": { - "part": { - "$ref": "#/components/schemas/Part" - }, - "delta": { - "type": "string" - } - }, - "required": [ - "part" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.message.part.removed": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.part.removed" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - }, - "messageID": { - "type": "string" - }, - "partID": { - "type": "string" - } - }, - "required": [ - "sessionID", - "messageID", - "partID" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.session.compacted": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.compacted" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - } - }, - "required": [ - "sessionID" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Permission": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "pattern": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "sessionID": { - "type": "string" - }, - "messageID": { - "type": "string" - }, - "callID": { - "type": "string" - }, - "title": { - "type": "string" - }, - "metadata": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - "time": { - "type": "object", - "properties": { - "created": { - "type": "number" - } - }, - "required": [ - "created" - ] - } - }, - "required": [ - "id", - "type", - "sessionID", - "messageID", - "title", - "metadata", - "time" - ] - }, - "Event.permission.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "permission.updated" - }, - "properties": { - "$ref": "#/components/schemas/Permission" - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.permission.replied": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "permission.replied" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - }, - "permissionID": { - "type": "string" - }, - "response": { - "type": "string" - } - }, - "required": [ - "sessionID", - "permissionID", - "response" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.file.edited": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "file.edited" - }, - "properties": { - "type": "object", - "properties": { - "file": { - "type": "string" - } - }, - "required": [ - "file" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.file.watcher.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "file.watcher.updated" - }, - "properties": { - "type": "object", - "properties": { - "file": { - "type": "string" - }, - "event": { - "anyOf": [ - { - "type": "string", - "const": "add" - }, - { - "type": "string", - "const": "change" - }, - { - "type": "string", - "const": "unlink" - } - ] - } - }, - "required": [ - "file", - "event" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.todo.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "todo.updated" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - }, - "todos": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Todo" - } - } - }, - "required": [ - "sessionID", - "todos" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.command.executed": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "command.executed" - }, - "properties": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "sessionID": { - "type": "string", - "pattern": "^ses.*" - }, - "arguments": { - "type": "string" - }, - "messageID": { - "type": "string", - "pattern": "^msg.*" - } - }, - "required": [ - "name", - "sessionID", - "arguments", - "messageID" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.session.idle": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.idle" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - } - }, - "required": [ - "sessionID" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.session.created": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.created" - }, - "properties": { - "type": "object", - "properties": { - "info": { - "$ref": "#/components/schemas/Session" - } - }, - "required": [ - "info" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.session.updated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.updated" - }, - "properties": { - "type": "object", - "properties": { - "info": { - "$ref": "#/components/schemas/Session" - } - }, - "required": [ - "info" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.session.deleted": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.deleted" - }, - "properties": { - "type": "object", - "properties": { - "info": { - "$ref": "#/components/schemas/Session" - } - }, - "required": [ - "info" - ] - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.session.error": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.error" - }, - "properties": { - "type": "object", - "properties": { - "sessionID": { - "type": "string" - }, - "error": { - "anyOf": [ - { - "$ref": "#/components/schemas/ProviderAuthError" - }, - { - "$ref": "#/components/schemas/UnknownError" - }, - { - "$ref": "#/components/schemas/MessageOutputLengthError" - }, - { - "$ref": "#/components/schemas/MessageAbortedError" - }, - { - "$ref": "#/components/schemas/APIError" - } - ] - } - } - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event.server.connected": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "server.connected" - }, - "properties": { - "type": "object", - "properties": {} - } - }, - "required": [ - "type", - "properties" - ] - }, - "Event": { - "anyOf": [ - { - "$ref": "#/components/schemas/Event.installation.updated" - }, - { - "$ref": "#/components/schemas/Event.lsp.client.diagnostics" - }, - { - "$ref": "#/components/schemas/Event.lsp.updated" - }, - { - "$ref": "#/components/schemas/Event.message.updated" - }, - { - "$ref": "#/components/schemas/Event.message.removed" - }, - { - "$ref": "#/components/schemas/Event.message.part.updated" - }, - { - "$ref": "#/components/schemas/Event.message.part.removed" - }, - { - "$ref": "#/components/schemas/Event.session.compacted" - }, - { - "$ref": "#/components/schemas/Event.permission.updated" - }, - { - "$ref": "#/components/schemas/Event.permission.replied" - }, - { - "$ref": "#/components/schemas/Event.file.edited" - }, - { - "$ref": "#/components/schemas/Event.file.watcher.updated" - }, - { - "$ref": "#/components/schemas/Event.todo.updated" - }, - { - "$ref": "#/components/schemas/Event.command.executed" - }, - { - "$ref": "#/components/schemas/Event.session.idle" - }, - { - "$ref": "#/components/schemas/Event.session.created" - }, - { - "$ref": "#/components/schemas/Event.session.updated" - }, - { - "$ref": "#/components/schemas/Event.session.deleted" - }, - { - "$ref": "#/components/schemas/Event.session.error" - }, - { - "$ref": "#/components/schemas/Event.tui.prompt.append" - }, - { - "$ref": "#/components/schemas/Event.tui.command.execute" - }, - { - "$ref": "#/components/schemas/Event.tui.toast.show" - }, - { - "$ref": "#/components/schemas/Event.server.connected" - } - ] } } } diff --git a/frontend/src/api/opencode-types.ts b/frontend/src/api/opencode-types.ts index 3a2717a8..40884796 100644 --- a/frontend/src/api/opencode-types.ts +++ b/frontend/src/api/opencode-types.ts @@ -4,6 +4,66 @@ */ export interface paths { + "/global/health": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get health + * @description Get health information about the OpenCode server. + */ + get: operations["global.health"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/global/event": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get global events + * @description Subscribe to global events from the OpenCode system using server-sent events. + */ + get: operations["global.event"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/global/dispose": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Dispose instance + * @description Clean up and dispose all OpenCode instances, releasing all resources. + */ + post: operations["global.dispose"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/project": { parameters: { query?: never; @@ -11,7 +71,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List all projects */ + /** + * List all projects + * @description Get a list of projects that have been opened with OpenCode. + */ get: operations["project.list"]; put?: never; post?: never; @@ -28,7 +91,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get the current project */ + /** + * Get current project + * @description Retrieve the currently active project that OpenCode is working with. + */ get: operations["project.current"]; put?: never; post?: never; @@ -38,6 +104,98 @@ export interface paths { patch?: never; trace?: never; }; + "/project/{projectID}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** + * Update project + * @description Update project properties such as name, icon and color. + */ + patch: operations["project.update"]; + trace?: never; + }; + "/pty": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List PTY sessions + * @description Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + */ + get: operations["pty.list"]; + put?: never; + /** + * Create PTY session + * @description Create a new pseudo-terminal (PTY) session for running shell commands and processes. + */ + post: operations["pty.create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/pty/{ptyID}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get PTY session + * @description Retrieve detailed information about a specific pseudo-terminal (PTY) session. + */ + get: operations["pty.get"]; + /** + * Update PTY session + * @description Update properties of an existing pseudo-terminal (PTY) session. + */ + put: operations["pty.update"]; + post?: never; + /** + * Remove PTY session + * @description Remove and terminate a specific pseudo-terminal (PTY) session. + */ + delete: operations["pty.remove"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/pty/{ptyID}/connect": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Connect to PTY session + * @description Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + */ + get: operations["pty.connect"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/config": { parameters: { query?: never; @@ -45,14 +203,20 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get config info */ + /** + * Get configuration + * @description Retrieve the current OpenCode configuration settings and preferences. + */ get: operations["config.get"]; put?: never; post?: never; delete?: never; options?: never; head?: never; - /** @description Update config */ + /** + * Update configuration + * @description Update OpenCode configuration settings and preferences. + */ patch: operations["config.update"]; trace?: never; }; @@ -63,7 +227,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List all tool IDs (including built-in and dynamically registered) */ + /** + * List tool IDs + * @description Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. + */ get: operations["tool.ids"]; put?: never; post?: never; @@ -80,7 +247,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List tools with JSON schema parameters for a provider/model */ + /** + * List tools + * @description Get a list of available tools with their JSON schema parameters for a specific provider and model combination. + */ get: operations["tool.list"]; put?: never; post?: never; @@ -90,6 +260,26 @@ export interface paths { patch?: never; trace?: never; }; + "/instance/dispose": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Dispose instance + * @description Clean up and dispose the current OpenCode instance, releasing all resources. + */ + post: operations["instance.dispose"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/path": { parameters: { query?: never; @@ -97,7 +287,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get the current path */ + /** + * Get paths + * @description Retrieve the current working directory and related path information for the OpenCode instance. + */ get: operations["path.get"]; put?: never; post?: never; @@ -107,6 +300,50 @@ export interface paths { patch?: never; trace?: never; }; + "/experimental/worktree": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List worktrees + * @description List all sandbox worktrees for the current project. + */ + get: operations["worktree.list"]; + put?: never; + /** + * Create worktree + * @description Create a new git worktree for the current project. + */ + post: operations["worktree.create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/vcs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get VCS info + * @description Retrieve version control system (VCS) information for the current project, such as git branch. + */ + get: operations["vcs.get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/session": { parameters: { query?: never; @@ -114,10 +351,16 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List all sessions */ + /** + * List sessions + * @description Get a list of all OpenCode sessions, sorted by most recently updated. + */ get: operations["session.list"]; put?: never; - /** @description Create a new session */ + /** + * Create session + * @description Create a new OpenCode session for interacting with AI assistants and managing conversations. + */ post: operations["session.create"]; delete?: never; options?: never; @@ -125,33 +368,65 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}": { + "/session/status": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** @description Get session */ + /** + * Get session status + * @description Retrieve the current status of all sessions, including active, idle, and completed states. + */ + get: operations["session.status"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/session/{sessionID}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get session + * @description Retrieve detailed information about a specific OpenCode session. + */ get: operations["session.get"]; put?: never; post?: never; - /** @description Delete a session and all its data */ + /** + * Delete session + * @description Delete a session and permanently remove all associated data, including messages and history. + */ delete: operations["session.delete"]; options?: never; head?: never; - /** @description Update session properties */ + /** + * Update session + * @description Update properties of an existing session, such as title or other metadata. + */ patch: operations["session.update"]; trace?: never; }; - "/session/{id}/children": { + "/session/{sessionID}/children": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** @description Get a session's children */ + /** + * Get session children + * @description Retrieve all child sessions that were forked from the specified parent session. + */ get: operations["session.children"]; put?: never; post?: never; @@ -161,14 +436,17 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/todo": { + "/session/{sessionID}/todo": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** @description Get the todo list for a session */ + /** + * Get session todos + * @description Retrieve the todo list associated with a specific session, showing tasks and action items. + */ get: operations["session.todo"]; put?: never; post?: never; @@ -178,7 +456,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/init": { + "/session/{sessionID}/init": { parameters: { query?: never; header?: never; @@ -187,7 +465,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Analyze the app and create an AGENTS.md file */ + /** + * Initialize session + * @description Analyze the current application and create an AGENTS.md file with project-specific agent configurations. + */ post: operations["session.init"]; delete?: never; options?: never; @@ -195,7 +476,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/fork": { + "/session/{sessionID}/fork": { parameters: { query?: never; header?: never; @@ -204,7 +485,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Fork an existing session at a specific message */ + /** + * Fork session + * @description Create a new session by forking an existing session at a specific message point. + */ post: operations["session.fork"]; delete?: never; options?: never; @@ -212,7 +496,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/abort": { + "/session/{sessionID}/abort": { parameters: { query?: never; header?: never; @@ -221,7 +505,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Abort a session */ + /** + * Abort session + * @description Abort an active session and stop any ongoing AI processing or command execution. + */ post: operations["session.abort"]; delete?: never; options?: never; @@ -229,7 +516,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/share": { + "/session/{sessionID}/share": { parameters: { query?: never; header?: never; @@ -238,23 +525,32 @@ export interface paths { }; get?: never; put?: never; - /** @description Share a session */ + /** + * Share session + * @description Create a shareable link for a session, allowing others to view the conversation. + */ post: operations["session.share"]; - /** @description Unshare the session */ + /** + * Unshare session + * @description Remove the shareable link for a session, making it private again. + */ delete: operations["session.unshare"]; options?: never; head?: never; patch?: never; trace?: never; }; - "/session/{id}/diff": { + "/session/{sessionID}/diff": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** @description Get the diff that resulted from this user message */ + /** + * Get session diff + * @description Get all file changes (diffs) made during this session. + */ get: operations["session.diff"]; put?: never; post?: never; @@ -264,7 +560,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/summarize": { + "/session/{sessionID}/summarize": { parameters: { query?: never; header?: never; @@ -273,7 +569,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Summarize the session */ + /** + * Summarize session + * @description Generate a concise summary of the session using AI compaction to preserve key information. + */ post: operations["session.summarize"]; delete?: never; options?: never; @@ -281,17 +580,23 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/message": { + "/session/{sessionID}/message": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** @description List messages for a session */ + /** + * Get session messages + * @description Retrieve all messages in a session, including user prompts and AI responses. + */ get: operations["session.messages"]; put?: never; - /** @description Create and send a new message to a session */ + /** + * Send message + * @description Create and send a new message to a session, streaming the AI response. + */ post: operations["session.prompt"]; delete?: never; options?: never; @@ -299,14 +604,17 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/message/{messageID}": { + "/session/{sessionID}/message/{messageID}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** @description Get a message from a session */ + /** + * Get message + * @description Retrieve a specific message from a session by its message ID. + */ get: operations["session.message"]; put?: never; post?: never; @@ -316,7 +624,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/command": { + "/session/{sessionID}/message/{messageID}/part/{partID}": { parameters: { query?: never; header?: never; @@ -325,7 +633,48 @@ export interface paths { }; get?: never; put?: never; - /** @description Send a new command to a session */ + post?: never; + /** @description Delete a part from a message */ + delete: operations["part.delete"]; + options?: never; + head?: never; + /** @description Update a part in a message */ + patch: operations["part.update"]; + trace?: never; + }; + "/session/{sessionID}/prompt_async": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Send async message + * @description Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. + */ + post: operations["session.prompt_async"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/session/{sessionID}/command": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Send command + * @description Send a new command to a session for execution by the AI assistant. + */ post: operations["session.command"]; delete?: never; options?: never; @@ -333,7 +682,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/shell": { + "/session/{sessionID}/shell": { parameters: { query?: never; header?: never; @@ -342,7 +691,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Run a shell command */ + /** + * Run shell command + * @description Execute a shell command within the session context and return the AI's response. + */ post: operations["session.shell"]; delete?: never; options?: never; @@ -350,7 +702,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/revert": { + "/session/{sessionID}/revert": { parameters: { query?: never; header?: never; @@ -359,7 +711,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Revert a message */ + /** + * Revert message + * @description Revert a specific message in a session, undoing its effects and restoring the previous state. + */ post: operations["session.revert"]; delete?: never; options?: never; @@ -367,7 +722,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/unrevert": { + "/session/{sessionID}/unrevert": { parameters: { query?: never; header?: never; @@ -376,7 +731,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Restore all reverted messages */ + /** + * Restore reverted messages + * @description Restore all previously reverted messages in a session. + */ post: operations["session.unrevert"]; delete?: never; options?: never; @@ -384,7 +742,7 @@ export interface paths { patch?: never; trace?: never; }; - "/session/{id}/permissions/{permissionID}": { + "/session/{sessionID}/permissions/{permissionID}": { parameters: { query?: never; header?: never; @@ -393,8 +751,112 @@ export interface paths { }; get?: never; put?: never; - /** @description Respond to a permission request */ - post: operations["postSession:idPermissions:permissionID"]; + /** + * Respond to permission + * @deprecated + * @description Approve or deny a permission request from the AI assistant. + */ + post: operations["permission.respond"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/permission/{requestID}/reply": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Respond to permission request + * @description Approve or deny a permission request from the AI assistant. + */ + post: operations["permission.reply"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/permission": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List pending permissions + * @description Get all pending permission requests across all sessions. + */ + get: operations["permission.list"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/question": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List pending questions + * @description Get all pending question requests across all sessions. + */ + get: operations["question.list"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/question/{requestID}/reply": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Reply to question request + * @description Provide answers to a question request from the AI assistant. + */ + post: operations["question.reply"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/question/{requestID}/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Reject question request + * @description Reject a question request from the AI assistant. + */ + post: operations["question.reject"]; delete?: never; options?: never; head?: never; @@ -408,7 +870,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List all commands */ + /** + * List commands + * @description Get a list of all available commands in the OpenCode system. + */ get: operations["command.list"]; put?: never; post?: never; @@ -425,7 +890,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List all providers */ + /** + * List config providers + * @description Get a list of all configured AI providers and their default models. + */ get: operations["config.providers"]; put?: never; post?: never; @@ -435,6 +903,86 @@ export interface paths { patch?: never; trace?: never; }; + "/provider": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List providers + * @description Get a list of all available AI providers, including both available and connected ones. + */ + get: operations["provider.list"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/provider/auth": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get provider auth methods + * @description Retrieve available authentication methods for all AI providers. + */ + get: operations["provider.auth"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/provider/{providerID}/oauth/authorize": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * OAuth authorize + * @description Initiate OAuth authorization for a specific AI provider to get an authorization URL. + */ + post: operations["provider.oauth.authorize"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/provider/{providerID}/oauth/callback": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * OAuth callback + * @description Handle the OAuth callback from a provider after user authorization. + */ + post: operations["provider.oauth.callback"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/find": { parameters: { query?: never; @@ -442,7 +990,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Find text in files */ + /** + * Find text + * @description Search for text patterns across files in the project using ripgrep. + */ get: operations["find.text"]; put?: never; post?: never; @@ -459,7 +1010,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Find files */ + /** + * Find files + * @description Search for files or directories by name or pattern in the project directory. + */ get: operations["find.files"]; put?: never; post?: never; @@ -476,7 +1030,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Find workspace symbols */ + /** + * Find symbols + * @description Search for workspace symbols like functions, classes, and variables using LSP. + */ get: operations["find.symbols"]; put?: never; post?: never; @@ -493,7 +1050,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List files and directories */ + /** + * List files + * @description List files and directories in a specified path. + */ get: operations["file.list"]; put?: never; post?: never; @@ -510,7 +1070,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Read a file */ + /** + * Read file + * @description Read the content of a specified file. + */ get: operations["file.read"]; put?: never; post?: never; @@ -527,7 +1090,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get file status */ + /** + * Get file status + * @description Get the git status of all files in the project. + */ get: operations["file.status"]; put?: never; post?: never; @@ -546,7 +1112,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Write a log entry to the server logs */ + /** + * Write log + * @description Write a log entry to the server logs with specified level and metadata. + */ post: operations["app.log"]; delete?: never; options?: never; @@ -561,7 +1130,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description List all agents */ + /** + * List agents + * @description Get a list of all available AI agents in the OpenCode system. + */ get: operations["app.agents"]; put?: never; post?: never; @@ -578,9 +1150,134 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get MCP server status */ + /** + * Get MCP status + * @description Get the status of all Model Context Protocol (MCP) servers. + */ get: operations["mcp.status"]; put?: never; + /** + * Add MCP server + * @description Dynamically add a new Model Context Protocol (MCP) server to the system. + */ + post: operations["mcp.add"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/mcp/{name}/auth": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Start MCP OAuth + * @description Start OAuth authentication flow for a Model Context Protocol (MCP) server. + */ + post: operations["mcp.auth.start"]; + /** + * Remove MCP OAuth + * @description Remove OAuth credentials for an MCP server + */ + delete: operations["mcp.auth.remove"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/mcp/{name}/auth/callback": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Complete MCP OAuth + * @description Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. + */ + post: operations["mcp.auth.callback"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/mcp/{name}/auth/authenticate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Authenticate MCP OAuth + * @description Start OAuth flow and wait for callback (opens browser) + */ + post: operations["mcp.auth.authenticate"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/mcp/{name}/connect": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Connect an MCP server */ + post: operations["mcp.connect"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/mcp/{name}/disconnect": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Disconnect an MCP server */ + post: operations["mcp.disconnect"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/experimental/resource": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get MCP resources + * @description Get all available MCP resources from connected servers. Optionally filter by name. + */ + get: operations["experimental.resource.list"]; + put?: never; post?: never; delete?: never; options?: never; @@ -595,7 +1292,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get LSP server status */ + /** + * Get LSP status + * @description Get LSP server status + */ get: operations["lsp.status"]; put?: never; post?: never; @@ -612,7 +1312,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get formatter status */ + /** + * Get formatter status + * @description Get formatter status + */ get: operations["formatter.status"]; put?: never; post?: never; @@ -631,7 +1334,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Append prompt to the TUI */ + /** + * Append TUI prompt + * @description Append prompt to the TUI + */ post: operations["tui.appendPrompt"]; delete?: never; options?: never; @@ -648,7 +1354,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Open the help dialog */ + /** + * Open help dialog + * @description Open the help dialog in the TUI to display user assistance information. + */ post: operations["tui.openHelp"]; delete?: never; options?: never; @@ -665,7 +1374,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Open the session dialog */ + /** + * Open sessions dialog + * @description Open the session dialog + */ post: operations["tui.openSessions"]; delete?: never; options?: never; @@ -682,7 +1394,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Open the theme dialog */ + /** + * Open themes dialog + * @description Open the theme dialog + */ post: operations["tui.openThemes"]; delete?: never; options?: never; @@ -699,7 +1414,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Open the model dialog */ + /** + * Open models dialog + * @description Open the model dialog + */ post: operations["tui.openModels"]; delete?: never; options?: never; @@ -716,7 +1434,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Submit the prompt */ + /** + * Submit TUI prompt + * @description Submit the prompt + */ post: operations["tui.submitPrompt"]; delete?: never; options?: never; @@ -733,7 +1454,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Clear the prompt */ + /** + * Clear TUI prompt + * @description Clear the prompt + */ post: operations["tui.clearPrompt"]; delete?: never; options?: never; @@ -750,7 +1474,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Execute a TUI command (e.g. agent_cycle) */ + /** + * Execute TUI command + * @description Execute a TUI command (e.g. agent_cycle) + */ post: operations["tui.executeCommand"]; delete?: never; options?: never; @@ -767,7 +1494,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Show a toast notification in the TUI */ + /** + * Show TUI toast + * @description Show a toast notification in the TUI + */ post: operations["tui.showToast"]; delete?: never; options?: never; @@ -784,7 +1514,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Publish a TUI event */ + /** + * Publish TUI event + * @description Publish a TUI event + */ post: operations["tui.publish"]; delete?: never; options?: never; @@ -792,6 +1525,26 @@ export interface paths { patch?: never; trace?: never; }; + "/tui/select-session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Select session + * @description Navigate the TUI to display the specified session. + */ + post: operations["tui.selectSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/tui/control/next": { parameters: { query?: never; @@ -799,7 +1552,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get the next TUI request from the queue */ + /** + * Get next TUI request + * @description Retrieve the next TUI (Terminal User Interface) request from the queue for processing. + */ get: operations["tui.control.next"]; put?: never; post?: never; @@ -818,7 +1574,10 @@ export interface paths { }; get?: never; put?: never; - /** @description Submit a response to the TUI request queue */ + /** + * Submit TUI response + * @description Submit a response to the TUI request queue to complete a pending request. + */ post: operations["tui.control.response"]; delete?: never; options?: never; @@ -826,7 +1585,7 @@ export interface paths { patch?: never; trace?: never; }; - "/auth/{id}": { + "/auth/{providerID}": { parameters: { query?: never; header?: never; @@ -834,7 +1593,10 @@ export interface paths { cookie?: never; }; get?: never; - /** @description Set authentication credentials */ + /** + * Set auth credentials + * @description Set authentication credentials + */ put: operations["auth.set"]; post?: never; delete?: never; @@ -850,7 +1612,10 @@ export interface paths { path?: never; cookie?: never; }; - /** @description Get events */ + /** + * Subscribe to events + * @description Get events + */ get: operations["event.subscribe"]; put?: never; post?: never; @@ -864,509 +1629,205 @@ export interface paths { export type webhooks = Record; export interface components { schemas: { + "Event.tui.prompt.append": { + /** @constant */ + type: "tui.prompt.append"; + properties: { + text: string; + }; + }; + "Event.tui.command.execute": { + /** @constant */ + type: "tui.command.execute"; + properties: { + command: ("session.list" | "session.new" | "session.share" | "session.interrupt" | "session.compact" | "session.page.up" | "session.page.down" | "session.half.page.up" | "session.half.page.down" | "session.first" | "session.last" | "prompt.clear" | "prompt.submit" | "agent.cycle") | string; + }; + }; + "Event.tui.toast.show": { + /** @constant */ + type: "tui.toast.show"; + properties: { + title?: string; + message: string; + /** @enum {string} */ + variant: "info" | "success" | "warning" | "error"; + /** + * @description Duration in milliseconds + * @default 5000 + */ + duration: number; + }; + }; + "Event.tui.session.select": { + /** @constant */ + type: "tui.session.select"; + properties: { + /** @description Session ID to navigate to */ + sessionID: string; + }; + }; + "Event.installation.updated": { + /** @constant */ + type: "installation.updated"; + properties: { + version: string; + }; + }; + "Event.installation.update-available": { + /** @constant */ + type: "installation.update-available"; + properties: { + version: string; + }; + }; Project: { id: string; worktree: string; /** @constant */ vcs?: "git"; - time: { - created: number; - initialized?: number; + name?: string; + icon?: { + url?: string; + color?: string; }; - }; - /** @description Custom keybind configurations */ - KeybindsConfig: { - /** - * @description Leader key for keybind combinations - * @default ctrl+x - */ - leader: string; - /** - * @description Exit the application - * @default ctrl+c,ctrl+d,q - */ - app_exit: string; - /** - * @description Open external editor - * @default e - */ - editor_open: string; - /** - * @description List available themes - * @default t - */ - theme_list: string; - /** - * @description Toggle sidebar - * @default b - */ - sidebar_toggle: string; - /** - * @description View status - * @default s - */ - status_view: string; - /** - * @description Export session to editor - * @default x - */ - session_export: string; - /** - * @description Create a new session - * @default n - */ - session_new: string; - /** - * @description List all sessions - * @default l - */ - session_list: string; - /** - * @description Show session timeline - * @default g - */ - session_timeline: string; - /** - * @description Share current session - * @default none - */ - session_share: string; - /** - * @description Unshare current session - * @default none - */ - session_unshare: string; - /** - * @description Interrupt current session - * @default escape - */ - session_interrupt: string; - /** - * @description Compact the session - * @default c - */ - session_compact: string; - /** - * @description Scroll messages up by one page - * @default pageup - */ - messages_page_up: string; - /** - * @description Scroll messages down by one page - * @default pagedown - */ - messages_page_down: string; - /** - * @description Scroll messages up by half page - * @default ctrl+alt+u - */ - messages_half_page_up: string; - /** - * @description Scroll messages down by half page - * @default ctrl+alt+d - */ - messages_half_page_down: string; - /** - * @description Navigate to first message - * @default ctrl+g,home - */ - messages_first: string; - /** - * @description Navigate to last message - * @default ctrl+alt+g,end - */ - messages_last: string; - /** - * @description Copy message - * @default y - */ - messages_copy: string; - /** - * @description Undo message - * @default u - */ - messages_undo: string; - /** - * @description Redo message - * @default r - */ - messages_redo: string; - /** - * @description Toggle code block concealment in messages - * @default h - */ - messages_toggle_conceal: string; - /** - * @description List available models - * @default m - */ - model_list: string; - /** - * @description Next recently used model - * @default f2 - */ - model_cycle_recent: string; - /** - * @description Previous recently used model - * @default shift+f2 - */ - model_cycle_recent_reverse: string; - /** - * @description List available commands - * @default ctrl+p - */ - command_list: string; - /** - * @description List agents - * @default a - */ - agent_list: string; - /** - * @description Next agent - * @default tab - */ - agent_cycle: string; - /** - * @description Previous agent - * @default shift+tab - */ - agent_cycle_reverse: string; - /** - * @description Clear input field - * @default ctrl+c - */ - input_clear: string; - /** - * @description Forward delete - * @default ctrl+d - */ - input_forward_delete: string; - /** - * @description Paste from clipboard - * @default ctrl+v - */ - input_paste: string; - /** - * @description Submit input - * @default enter - */ - input_submit: string; - /** - * @description Insert newline in input - * @default shift+enter,ctrl+j - */ - input_newline: string; - /** - * @description Previous history item - * @default up - */ - history_previous: string; - /** - * @description Previous history item - * @default down - */ - history_next: string; - }; - AgentConfig: { - model?: string; - temperature?: number; - top_p?: number; - prompt?: string; - tools?: { - [key: string]: boolean; - }; - disable?: boolean; - /** @description Description of when to use the agent */ - description?: string; - mode?: "subagent" | "primary" | "all"; - permission?: { - edit?: "ask" | "allow" | "deny"; - bash?: ("ask" | "allow" | "deny") | { - [key: string]: "ask" | "allow" | "deny"; - }; - webfetch?: "ask" | "allow" | "deny"; - }; - } & { - [key: string]: unknown; - }; - McpLocalConfig: { - /** - * @description Type of MCP server connection - * @constant - */ - type: "local"; - /** @description Command and arguments to run the MCP server */ - command: string[]; - /** @description Environment variables to set when running the MCP server */ - environment?: { - [key: string]: string; - }; - /** @description Enable or disable the MCP server on startup */ - enabled?: boolean; - /** @description Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. */ - timeout?: number; - }; - McpRemoteConfig: { - /** - * @description Type of MCP server connection - * @constant - */ - type: "remote"; - /** @description URL of the remote MCP server */ - url: string; - /** @description Enable or disable the MCP server on startup */ - enabled?: boolean; - /** @description Headers to send with the request */ - headers?: { - [key: string]: string; - }; - /** @description Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. */ - timeout?: number; - }; - /** - * @description @deprecated Always uses stretch layout. - * @enum {string} - */ - LayoutConfig: "auto" | "stretch"; - Config: { - /** @description JSON schema reference for configuration validation */ - $schema?: string; - /** @description Theme name to use for the interface */ - theme?: string; - keybinds?: components["schemas"]["KeybindsConfig"]; - /** @description TUI specific settings */ - tui?: { - /** - * @description TUI scroll speed - * @default 2 - */ - scroll_speed: number; - }; - /** @description Command configuration, see https://opencode.ai/docs/commands */ - command?: { - [key: string]: { - template: string; - description?: string; - agent?: string; - model?: string; - subtask?: boolean; - }; - }; - watcher?: { - ignore?: string[]; - }; - plugin?: string[]; - snapshot?: boolean; - /** - * @description Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing - * @enum {string} - */ - share?: "manual" | "auto" | "disabled"; - /** @description @deprecated Use 'share' field instead. Share newly created sessions automatically */ - autoshare?: boolean; - /** @description Automatically update to the latest version */ - autoupdate?: boolean; - /** @description Disable providers that are loaded automatically */ - disabled_providers?: string[]; - /** @description Model to use in the format of provider/model, eg anthropic/claude-2 */ - model?: string; - /** @description Small model to use for tasks like title generation in the format of provider/model */ - small_model?: string; - /** @description Custom username to display in conversations instead of system username */ - username?: string; - /** @description @deprecated Use `agent` field instead. */ - mode?: { - build?: components["schemas"]["AgentConfig"]; - plan?: components["schemas"]["AgentConfig"]; - } & { - [key: string]: components["schemas"]["AgentConfig"]; - }; - /** @description Agent configuration, see https://opencode.ai/docs/agent */ - agent?: { - plan?: components["schemas"]["AgentConfig"]; - build?: components["schemas"]["AgentConfig"]; - general?: components["schemas"]["AgentConfig"]; - } & { - [key: string]: components["schemas"]["AgentConfig"]; - }; - /** @description Custom provider configurations and model overrides */ - provider?: { - [key: string]: { - api?: string; - name?: string; - env?: string[]; - id?: string; - npm?: string; - models?: { - [key: string]: { - id?: string; - name?: string; - release_date?: string; - attachment?: boolean; - reasoning?: boolean; - temperature?: boolean; - tool_call?: boolean; - cost?: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit?: { - context: number; - output: number; - }; - modalities?: { - input: ("text" | "audio" | "image" | "video" | "pdf")[]; - output: ("text" | "audio" | "image" | "video" | "pdf")[]; - }; - experimental?: boolean; - /** @enum {string} */ - status?: "alpha" | "beta" | "deprecated"; - options?: { - [key: string]: unknown; - }; - headers?: { - [key: string]: string; - }; - provider?: { - npm: string; - }; - }; - }; - options?: { - apiKey?: string; - baseURL?: string; - /** @description Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. */ - timeout?: number | false; - } & { - [key: string]: unknown; - }; - }; - }; - /** @description MCP (Model Context Protocol) server configurations */ - mcp?: { - [key: string]: components["schemas"]["McpLocalConfig"] | components["schemas"]["McpRemoteConfig"]; - }; - formatter?: { - [key: string]: { - disabled?: boolean; - command?: string[]; - environment?: { - [key: string]: string; - }; - extensions?: string[]; - }; - }; - lsp?: { - [key: string]: { - /** @constant */ - disabled: true; - } | { - command: string[]; - extensions?: string[]; - disabled?: boolean; - env?: { - [key: string]: string; - }; - initialization?: { - [key: string]: unknown; - }; - }; - }; - /** @description Additional instruction files or patterns to include */ - instructions?: string[]; - layout?: components["schemas"]["LayoutConfig"]; - permission?: { - edit?: "ask" | "allow" | "deny"; - bash?: ("ask" | "allow" | "deny") | { - [key: string]: "ask" | "allow" | "deny"; - }; - webfetch?: "ask" | "allow" | "deny"; - }; - tools?: { - [key: string]: boolean; - }; - experimental?: { - hook?: { - file_edited?: { - [key: string]: { - command: string[]; - environment?: { - [key: string]: string; - }; - }[]; - }; - session_completed?: { - command: string[]; - environment?: { - [key: string]: string; - }; - }[]; - }; - /** @description Number of retries for chat completions on failure */ - chatMaxRetries?: number; - disable_paste_summary?: boolean; - }; - }; - BadRequestError: { - data: unknown | null; - errors: { - [key: string]: unknown; - }[]; - /** @constant */ - success: false; - }; - ToolIDs: string[]; - ToolListItem: { - id: string; - description: string; - parameters: unknown; - }; - ToolList: components["schemas"]["ToolListItem"][]; - Path: { - state: string; - config: string; - worktree: string; - directory: string; - }; - FileDiff: { - file: string; - before: string; - after: string; - additions: number; - deletions: number; - }; - Session: { - id: string; - projectID: string; - directory: string; - parentID?: string; - summary?: { - diffs: components["schemas"]["FileDiff"][]; - }; - share?: { - url: string; - }; - title: string; - version: string; time: { created: number; updated: number; - compacting?: number; + initialized?: number; }; - revert?: { - messageID: string; - partID?: string; - snapshot?: string; - diff?: string; + sandboxes: string[]; + }; + "Event.project.updated": { + /** @constant */ + type: "project.updated"; + properties: components["schemas"]["Project"]; + }; + "Event.server.instance.disposed": { + /** @constant */ + type: "server.instance.disposed"; + properties: { + directory: string; }; }; - NotFoundError: { + "Event.file.edited": { /** @constant */ - name: "NotFoundError"; - data: { - message: string; + type: "file.edited"; + properties: { + file: string; + }; + }; + "Event.lsp.client.diagnostics": { + /** @constant */ + type: "lsp.client.diagnostics"; + properties: { + serverID: string; + path: string; + }; + }; + PermissionRequest: { + id: string; + sessionID: string; + permission: string; + patterns: string[]; + metadata: { + [key: string]: unknown; + }; + always: string[]; + tool?: { + messageID: string; + callID: string; + }; + }; + "Event.permission.asked": { + /** @constant */ + type: "permission.asked"; + properties: components["schemas"]["PermissionRequest"]; + }; + "Event.permission.replied": { + /** @constant */ + type: "permission.replied"; + properties: { + sessionID: string; + requestID: string; + /** @enum {string} */ + reply: "once" | "always" | "reject"; + }; + }; + SessionStatus: { + /** @constant */ + type: "idle"; + } | { + /** @constant */ + type: "retry"; + attempt: number; + message: string; + next: number; + } | { + /** @constant */ + type: "busy"; + }; + "Event.session.status": { + /** @constant */ + type: "session.status"; + properties: { + sessionID: string; + status: components["schemas"]["SessionStatus"]; + }; + }; + "Event.session.idle": { + /** @constant */ + type: "session.idle"; + properties: { + sessionID: string; + }; + }; + QuestionOption: { + /** @description Display text (1-5 words, concise) */ + label: string; + /** @description Explanation of choice */ + description: string; + }; + QuestionInfo: { + /** @description Complete question */ + question: string; + /** @description Very short label (max 12 chars) */ + header: string; + /** @description Available choices */ + options: components["schemas"]["QuestionOption"][]; + /** @description Allow selecting multiple choices */ + multiple?: boolean; + }; + QuestionRequest: { + id: string; + sessionID: string; + /** @description Questions to ask */ + questions: components["schemas"]["QuestionInfo"][]; + tool?: { + messageID: string; + callID: string; + }; + }; + "Event.question.asked": { + /** @constant */ + type: "question.asked"; + properties: components["schemas"]["QuestionRequest"]; + }; + QuestionAnswer: string[]; + "Event.question.replied": { + /** @constant */ + type: "question.replied"; + properties: { + sessionID: string; + requestID: string; + answers: components["schemas"]["QuestionAnswer"][]; + }; + }; + "Event.question.rejected": { + /** @constant */ + type: "question.rejected"; + properties: { + sessionID: string; + requestID: string; }; }; Todo: { @@ -1379,6 +1840,97 @@ export interface components { /** @description Unique identifier for the todo item */ id: string; }; + "Event.todo.updated": { + /** @constant */ + type: "todo.updated"; + properties: { + sessionID: string; + todos: components["schemas"]["Todo"][]; + }; + }; + Pty: { + id: string; + title: string; + command: string; + args: string[]; + cwd: string; + /** @enum {string} */ + status: "running" | "exited"; + pid: number; + }; + "Event.pty.created": { + /** @constant */ + type: "pty.created"; + properties: { + info: components["schemas"]["Pty"]; + }; + }; + "Event.pty.updated": { + /** @constant */ + type: "pty.updated"; + properties: { + info: components["schemas"]["Pty"]; + }; + }; + "Event.pty.exited": { + /** @constant */ + type: "pty.exited"; + properties: { + id: string; + exitCode: number; + }; + }; + "Event.pty.deleted": { + /** @constant */ + type: "pty.deleted"; + properties: { + id: string; + }; + }; + "Event.mcp.tools.changed": { + /** @constant */ + type: "mcp.tools.changed"; + properties: { + server: string; + }; + }; + "Event.file.watcher.updated": { + /** @constant */ + type: "file.watcher.updated"; + properties: { + file: string; + event: "add" | "change" | "unlink"; + }; + }; + "Event.lsp.updated": { + /** @constant */ + type: "lsp.updated"; + properties: Record; + }; + "Event.command.executed": { + /** @constant */ + type: "command.executed"; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; + }; + "Event.vcs.branch.updated": { + /** @constant */ + type: "vcs.branch.updated"; + properties: { + branch?: string; + }; + }; + FileDiff: { + file: string; + before: string; + after: string; + additions: number; + deletions: number; + }; UserMessage: { id: string; sessionID: string; @@ -1392,6 +1944,16 @@ export interface components { body?: string; diffs: components["schemas"]["FileDiff"][]; }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; ProviderAuthError: { /** @constant */ @@ -1431,6 +1993,9 @@ export interface components { [key: string]: string; }; responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; AssistantMessage: { @@ -1443,11 +2008,11 @@ export interface components { completed?: number; }; error?: components["schemas"]["ProviderAuthError"] | components["schemas"]["UnknownError"] | components["schemas"]["MessageOutputLengthError"] | components["schemas"]["MessageAbortedError"] | components["schemas"]["APIError"]; - system: string[]; parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -1463,8 +2028,24 @@ export interface components { write: number; }; }; + finish?: string; }; Message: components["schemas"]["UserMessage"] | components["schemas"]["AssistantMessage"]; + "Event.message.updated": { + /** @constant */ + type: "message.updated"; + properties: { + info: components["schemas"]["Message"]; + }; + }; + "Event.message.removed": { + /** @constant */ + type: "message.removed"; + properties: { + sessionID: string; + messageID: string; + }; + }; TextPart: { id: string; sessionID: string; @@ -1473,6 +2054,7 @@ export interface components { type: "text"; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; @@ -1526,7 +2108,14 @@ export interface components { name: string; kind: number; }; - FilePartSource: components["schemas"]["FileSource"] | components["schemas"]["SymbolSource"]; + ResourceSource: { + text: components["schemas"]["FilePartSourceText"]; + /** @constant */ + type: "resource"; + clientName: string; + uri: string; + }; + FilePartSource: components["schemas"]["FileSource"] | components["schemas"]["SymbolSource"] | components["schemas"]["ResourceSource"]; FilePart: { id: string; sessionID: string; @@ -1676,13 +2265,987 @@ export interface components { created: number; }; }; - Part: components["schemas"]["TextPart"] | components["schemas"]["ReasoningPart"] | components["schemas"]["FilePart"] | components["schemas"]["ToolPart"] | components["schemas"]["StepStartPart"] | components["schemas"]["StepFinishPart"] | components["schemas"]["SnapshotPart"] | components["schemas"]["PatchPart"] | components["schemas"]["AgentPart"] | components["schemas"]["RetryPart"]; + CompactionPart: { + id: string; + sessionID: string; + messageID: string; + /** @constant */ + type: "compaction"; + auto: boolean; + }; + Part: components["schemas"]["TextPart"] | { + id: string; + sessionID: string; + messageID: string; + /** @constant */ + type: "subtask"; + prompt: string; + description: string; + agent: string; + command?: string; + } | components["schemas"]["ReasoningPart"] | components["schemas"]["FilePart"] | components["schemas"]["ToolPart"] | components["schemas"]["StepStartPart"] | components["schemas"]["StepFinishPart"] | components["schemas"]["SnapshotPart"] | components["schemas"]["PatchPart"] | components["schemas"]["AgentPart"] | components["schemas"]["RetryPart"] | components["schemas"]["CompactionPart"]; + "Event.message.part.updated": { + /** @constant */ + type: "message.part.updated"; + properties: { + part: components["schemas"]["Part"]; + delta?: string; + }; + }; + "Event.message.part.removed": { + /** @constant */ + type: "message.part.removed"; + properties: { + sessionID: string; + messageID: string; + partID: string; + }; + }; + "Event.session.compacted": { + /** @constant */ + type: "session.compacted"; + properties: { + sessionID: string; + }; + }; + /** @enum {string} */ + PermissionAction: "allow" | "deny" | "ask"; + PermissionRule: { + permission: string; + pattern: string; + action: components["schemas"]["PermissionAction"]; + }; + PermissionRuleset: components["schemas"]["PermissionRule"][]; + Session: { + id: string; + projectID: string; + directory: string; + parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: components["schemas"]["FileDiff"][]; + }; + share?: { + url: string; + }; + title: string; + version: string; + time: { + created: number; + updated: number; + compacting?: number; + archived?: number; + }; + permission?: components["schemas"]["PermissionRuleset"]; + revert?: { + messageID: string; + partID?: string; + snapshot?: string; + diff?: string; + }; + }; + "Event.session.created": { + /** @constant */ + type: "session.created"; + properties: { + info: components["schemas"]["Session"]; + }; + }; + "Event.session.updated": { + /** @constant */ + type: "session.updated"; + properties: { + info: components["schemas"]["Session"]; + }; + }; + "Event.session.deleted": { + /** @constant */ + type: "session.deleted"; + properties: { + info: components["schemas"]["Session"]; + }; + }; + "Event.session.diff": { + /** @constant */ + type: "session.diff"; + properties: { + sessionID: string; + diff: components["schemas"]["FileDiff"][]; + }; + }; + "Event.session.error": { + /** @constant */ + type: "session.error"; + properties: { + sessionID?: string; + error?: components["schemas"]["ProviderAuthError"] | components["schemas"]["UnknownError"] | components["schemas"]["MessageOutputLengthError"] | components["schemas"]["MessageAbortedError"] | components["schemas"]["APIError"]; + }; + }; + "Event.server.connected": { + /** @constant */ + type: "server.connected"; + properties: Record; + }; + "Event.global.disposed": { + /** @constant */ + type: "global.disposed"; + properties: Record; + }; + Event: components["schemas"]["Event.tui.prompt.append"] | components["schemas"]["Event.tui.command.execute"] | components["schemas"]["Event.tui.toast.show"] | components["schemas"]["Event.tui.session.select"] | components["schemas"]["Event.installation.updated"] | components["schemas"]["Event.installation.update-available"] | components["schemas"]["Event.project.updated"] | components["schemas"]["Event.server.instance.disposed"] | components["schemas"]["Event.file.edited"] | components["schemas"]["Event.lsp.client.diagnostics"] | components["schemas"]["Event.permission.asked"] | components["schemas"]["Event.permission.replied"] | components["schemas"]["Event.session.status"] | components["schemas"]["Event.session.idle"] | components["schemas"]["Event.question.asked"] | components["schemas"]["Event.question.replied"] | components["schemas"]["Event.question.rejected"] | components["schemas"]["Event.todo.updated"] | components["schemas"]["Event.pty.created"] | components["schemas"]["Event.pty.updated"] | components["schemas"]["Event.pty.exited"] | components["schemas"]["Event.pty.deleted"] | components["schemas"]["Event.mcp.tools.changed"] | components["schemas"]["Event.file.watcher.updated"] | components["schemas"]["Event.lsp.updated"] | components["schemas"]["Event.command.executed"] | components["schemas"]["Event.vcs.branch.updated"] | components["schemas"]["Event.message.updated"] | components["schemas"]["Event.message.removed"] | components["schemas"]["Event.message.part.updated"] | components["schemas"]["Event.message.part.removed"] | components["schemas"]["Event.session.compacted"] | components["schemas"]["Event.session.created"] | components["schemas"]["Event.session.updated"] | components["schemas"]["Event.session.deleted"] | components["schemas"]["Event.session.diff"] | components["schemas"]["Event.session.error"] | components["schemas"]["Event.server.connected"] | components["schemas"]["Event.global.disposed"]; + GlobalEvent: { + directory: string; + payload: components["schemas"]["Event"]; + }; + BadRequestError: { + data: unknown; + errors: { + [key: string]: unknown; + }[]; + /** @constant */ + success: false; + }; + NotFoundError: { + /** @constant */ + name: "NotFoundError"; + data: { + message: string; + }; + }; + /** @description Custom keybind configurations */ + KeybindsConfig: { + /** + * @description Leader key for keybind combinations + * @default ctrl+x + */ + leader: string; + /** + * @description Exit the application + * @default ctrl+c,ctrl+d,q + */ + app_exit: string; + /** + * @description Open external editor + * @default e + */ + editor_open: string; + /** + * @description List available themes + * @default t + */ + theme_list: string; + /** + * @description Toggle sidebar + * @default b + */ + sidebar_toggle: string; + /** + * @description Toggle session scrollbar + * @default none + */ + scrollbar_toggle: string; + /** + * @description Toggle username visibility + * @default none + */ + username_toggle: string; + /** + * @description View status + * @default s + */ + status_view: string; + /** + * @description Export session to editor + * @default x + */ + session_export: string; + /** + * @description Create a new session + * @default n + */ + session_new: string; + /** + * @description List all sessions + * @default l + */ + session_list: string; + /** + * @description Show session timeline + * @default g + */ + session_timeline: string; + /** + * @description Fork session from message + * @default none + */ + session_fork: string; + /** + * @description Rename session + * @default none + */ + session_rename: string; + /** + * @description Share current session + * @default none + */ + session_share: string; + /** + * @description Unshare current session + * @default none + */ + session_unshare: string; + /** + * @description Interrupt current session + * @default escape + */ + session_interrupt: string; + /** + * @description Compact the session + * @default c + */ + session_compact: string; + /** + * @description Scroll messages up by one page + * @default pageup + */ + messages_page_up: string; + /** + * @description Scroll messages down by one page + * @default pagedown + */ + messages_page_down: string; + /** + * @description Scroll messages up by half page + * @default ctrl+alt+u + */ + messages_half_page_up: string; + /** + * @description Scroll messages down by half page + * @default ctrl+alt+d + */ + messages_half_page_down: string; + /** + * @description Navigate to first message + * @default ctrl+g,home + */ + messages_first: string; + /** + * @description Navigate to last message + * @default ctrl+alt+g,end + */ + messages_last: string; + /** + * @description Navigate to next message + * @default none + */ + messages_next: string; + /** + * @description Navigate to previous message + * @default none + */ + messages_previous: string; + /** + * @description Navigate to last user message + * @default none + */ + messages_last_user: string; + /** + * @description Copy message + * @default y + */ + messages_copy: string; + /** + * @description Undo message + * @default u + */ + messages_undo: string; + /** + * @description Redo message + * @default r + */ + messages_redo: string; + /** + * @description Toggle code block concealment in messages + * @default h + */ + messages_toggle_conceal: string; + /** + * @description Toggle tool details visibility + * @default none + */ + tool_details: string; + /** + * @description List available models + * @default m + */ + model_list: string; + /** + * @description Next recently used model + * @default f2 + */ + model_cycle_recent: string; + /** + * @description Previous recently used model + * @default shift+f2 + */ + model_cycle_recent_reverse: string; + /** + * @description Next favorite model + * @default none + */ + model_cycle_favorite: string; + /** + * @description Previous favorite model + * @default none + */ + model_cycle_favorite_reverse: string; + /** + * @description List available commands + * @default ctrl+p + */ + command_list: string; + /** + * @description List agents + * @default a + */ + agent_list: string; + /** + * @description Next agent + * @default tab + */ + agent_cycle: string; + /** + * @description Previous agent + * @default shift+tab + */ + agent_cycle_reverse: string; + /** + * @description Cycle model variants + * @default ctrl+t + */ + variant_cycle: string; + /** + * @description Clear input field + * @default ctrl+c + */ + input_clear: string; + /** + * @description Paste from clipboard + * @default ctrl+v + */ + input_paste: string; + /** + * @description Submit input + * @default return + */ + input_submit: string; + /** + * @description Insert newline in input + * @default shift+return,ctrl+return,alt+return,ctrl+j + */ + input_newline: string; + /** + * @description Move cursor left in input + * @default left,ctrl+b + */ + input_move_left: string; + /** + * @description Move cursor right in input + * @default right,ctrl+f + */ + input_move_right: string; + /** + * @description Move cursor up in input + * @default up + */ + input_move_up: string; + /** + * @description Move cursor down in input + * @default down + */ + input_move_down: string; + /** + * @description Select left in input + * @default shift+left + */ + input_select_left: string; + /** + * @description Select right in input + * @default shift+right + */ + input_select_right: string; + /** + * @description Select up in input + * @default shift+up + */ + input_select_up: string; + /** + * @description Select down in input + * @default shift+down + */ + input_select_down: string; + /** + * @description Move to start of line in input + * @default ctrl+a + */ + input_line_home: string; + /** + * @description Move to end of line in input + * @default ctrl+e + */ + input_line_end: string; + /** + * @description Select to start of line in input + * @default ctrl+shift+a + */ + input_select_line_home: string; + /** + * @description Select to end of line in input + * @default ctrl+shift+e + */ + input_select_line_end: string; + /** + * @description Move to start of visual line in input + * @default alt+a + */ + input_visual_line_home: string; + /** + * @description Move to end of visual line in input + * @default alt+e + */ + input_visual_line_end: string; + /** + * @description Select to start of visual line in input + * @default alt+shift+a + */ + input_select_visual_line_home: string; + /** + * @description Select to end of visual line in input + * @default alt+shift+e + */ + input_select_visual_line_end: string; + /** + * @description Move to start of buffer in input + * @default home + */ + input_buffer_home: string; + /** + * @description Move to end of buffer in input + * @default end + */ + input_buffer_end: string; + /** + * @description Select to start of buffer in input + * @default shift+home + */ + input_select_buffer_home: string; + /** + * @description Select to end of buffer in input + * @default shift+end + */ + input_select_buffer_end: string; + /** + * @description Delete line in input + * @default ctrl+shift+d + */ + input_delete_line: string; + /** + * @description Delete to end of line in input + * @default ctrl+k + */ + input_delete_to_line_end: string; + /** + * @description Delete to start of line in input + * @default ctrl+u + */ + input_delete_to_line_start: string; + /** + * @description Backspace in input + * @default backspace,shift+backspace + */ + input_backspace: string; + /** + * @description Delete character in input + * @default ctrl+d,delete,shift+delete + */ + input_delete: string; + /** + * @description Undo in input + * @default ctrl+-,super+z + */ + input_undo: string; + /** + * @description Redo in input + * @default ctrl+.,super+shift+z + */ + input_redo: string; + /** + * @description Move word forward in input + * @default alt+f,alt+right,ctrl+right + */ + input_word_forward: string; + /** + * @description Move word backward in input + * @default alt+b,alt+left,ctrl+left + */ + input_word_backward: string; + /** + * @description Select word forward in input + * @default alt+shift+f,alt+shift+right + */ + input_select_word_forward: string; + /** + * @description Select word backward in input + * @default alt+shift+b,alt+shift+left + */ + input_select_word_backward: string; + /** + * @description Delete word forward in input + * @default alt+d,alt+delete,ctrl+delete + */ + input_delete_word_forward: string; + /** + * @description Delete word backward in input + * @default ctrl+w,ctrl+backspace,alt+backspace + */ + input_delete_word_backward: string; + /** + * @description Previous history item + * @default up + */ + history_previous: string; + /** + * @description Next history item + * @default down + */ + history_next: string; + /** + * @description Next child session + * @default right + */ + session_child_cycle: string; + /** + * @description Previous child session + * @default left + */ + session_child_cycle_reverse: string; + /** + * @description Go to parent session + * @default up + */ + session_parent: string; + /** + * @description Suspend terminal + * @default ctrl+z + */ + terminal_suspend: string; + /** + * @description Toggle terminal title + * @default none + */ + terminal_title_toggle: string; + /** + * @description Toggle tips on home screen + * @default h + */ + tips_toggle: string; + }; + /** + * @description Log level + * @enum {string} + */ + LogLevel: "DEBUG" | "INFO" | "WARN" | "ERROR"; + /** @description Server configuration for opencode serve and web commands */ + ServerConfig: { + /** @description Port to listen on */ + port?: number; + /** @description Hostname to listen on */ + hostname?: string; + /** @description Enable mDNS service discovery */ + mdns?: boolean; + /** @description Additional domains to allow for CORS */ + cors?: string[]; + }; + /** @enum {string} */ + PermissionActionConfig: "ask" | "allow" | "deny"; + PermissionObjectConfig: { + [key: string]: components["schemas"]["PermissionActionConfig"]; + }; + PermissionRuleConfig: components["schemas"]["PermissionActionConfig"] | components["schemas"]["PermissionObjectConfig"]; + PermissionConfig: ({ + __originalKeys?: string[]; + read?: components["schemas"]["PermissionRuleConfig"]; + edit?: components["schemas"]["PermissionRuleConfig"]; + glob?: components["schemas"]["PermissionRuleConfig"]; + grep?: components["schemas"]["PermissionRuleConfig"]; + list?: components["schemas"]["PermissionRuleConfig"]; + bash?: components["schemas"]["PermissionRuleConfig"]; + task?: components["schemas"]["PermissionRuleConfig"]; + external_directory?: components["schemas"]["PermissionRuleConfig"]; + todowrite?: components["schemas"]["PermissionActionConfig"]; + todoread?: components["schemas"]["PermissionActionConfig"]; + question?: components["schemas"]["PermissionActionConfig"]; + webfetch?: components["schemas"]["PermissionActionConfig"]; + websearch?: components["schemas"]["PermissionActionConfig"]; + codesearch?: components["schemas"]["PermissionActionConfig"]; + lsp?: components["schemas"]["PermissionRuleConfig"]; + doom_loop?: components["schemas"]["PermissionActionConfig"]; + } & { + [key: string]: components["schemas"]["PermissionRuleConfig"]; + }) | components["schemas"]["PermissionActionConfig"]; + AgentConfig: { + model?: string; + temperature?: number; + top_p?: number; + prompt?: string; + /** @description @deprecated Use 'permission' field instead */ + tools?: { + [key: string]: boolean; + }; + disable?: boolean; + /** @description Description of when to use the agent */ + description?: string; + /** @enum {string} */ + mode?: "subagent" | "primary" | "all"; + /** @description Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent) */ + hidden?: boolean; + options?: { + [key: string]: unknown; + }; + /** @description Hex color code for the agent (e.g., #FF5733) */ + color?: string; + /** @description Maximum number of agentic iterations before forcing text-only response */ + steps?: number; + /** @description @deprecated Use 'steps' field instead. */ + maxSteps?: number; + permission?: components["schemas"]["PermissionConfig"]; + } & { + [key: string]: unknown; + }; + ProviderConfig: { + api?: string; + name?: string; + env?: string[]; + id?: string; + npm?: string; + models?: { + [key: string]: { + id?: string; + name?: string; + family?: string; + release_date?: string; + attachment?: boolean; + reasoning?: boolean; + temperature?: boolean; + tool_call?: boolean; + interleaved?: true | { + /** @enum {string} */ + field: "reasoning_content" | "reasoning_details"; + }; + cost?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + context_over_200k?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + }; + }; + limit?: { + context: number; + output: number; + }; + modalities?: { + input: ("text" | "audio" | "image" | "video" | "pdf")[]; + output: ("text" | "audio" | "image" | "video" | "pdf")[]; + }; + experimental?: boolean; + /** @enum {string} */ + status?: "alpha" | "beta" | "deprecated"; + options?: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + /** @description Variant-specific configuration */ + variants?: { + [key: string]: { + /** @description Disable this variant for the model */ + disabled?: boolean; + } & { + [key: string]: unknown; + }; + }; + }; + }; + whitelist?: string[]; + blacklist?: string[]; + options?: { + apiKey?: string; + baseURL?: string; + /** @description GitHub Enterprise URL for copilot authentication */ + enterpriseUrl?: string; + /** @description Enable promptCacheKey for this provider (default false) */ + setCacheKey?: boolean; + /** @description Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. */ + timeout?: number | false; + } & { + [key: string]: unknown; + }; + }; + McpLocalConfig: { + /** + * @description Type of MCP server connection + * @constant + */ + type: "local"; + /** @description Command and arguments to run the MCP server */ + command: string[]; + /** @description Environment variables to set when running the MCP server */ + environment?: { + [key: string]: string; + }; + /** @description Enable or disable the MCP server on startup */ + enabled?: boolean; + /** @description Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. */ + timeout?: number; + }; + McpOAuthConfig: { + /** @description OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. */ + clientId?: string; + /** @description OAuth client secret (if required by the authorization server) */ + clientSecret?: string; + /** @description OAuth scopes to request during authorization */ + scope?: string; + }; + McpRemoteConfig: { + /** + * @description Type of MCP server connection + * @constant + */ + type: "remote"; + /** @description URL of the remote MCP server */ + url: string; + /** @description Enable or disable the MCP server on startup */ + enabled?: boolean; + /** @description Headers to send with the request */ + headers?: { + [key: string]: string; + }; + /** @description OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. */ + oauth?: components["schemas"]["McpOAuthConfig"] | false; + /** @description Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. */ + timeout?: number; + }; + /** + * @description @deprecated Always uses stretch layout. + * @enum {string} + */ + LayoutConfig: "auto" | "stretch"; + Config: { + /** @description JSON schema reference for configuration validation */ + $schema?: string; + /** @description Theme name to use for the interface */ + theme?: string; + keybinds?: components["schemas"]["KeybindsConfig"]; + logLevel?: components["schemas"]["LogLevel"]; + /** @description TUI specific settings */ + tui?: { + /** @description TUI scroll speed */ + scroll_speed?: number; + /** @description Scroll acceleration settings */ + scroll_acceleration?: { + /** @description Enable scroll acceleration */ + enabled: boolean; + }; + /** + * @description Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column + * @enum {string} + */ + diff_style?: "auto" | "stacked"; + }; + server?: components["schemas"]["ServerConfig"]; + /** @description Command configuration, see https://opencode.ai/docs/commands */ + command?: { + [key: string]: { + template: string; + description?: string; + agent?: string; + model?: string; + subtask?: boolean; + }; + }; + watcher?: { + ignore?: string[]; + }; + plugin?: string[]; + snapshot?: boolean; + /** + * @description Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + * @enum {string} + */ + share?: "manual" | "auto" | "disabled"; + /** @description @deprecated Use 'share' field instead. Share newly created sessions automatically */ + autoshare?: boolean; + /** @description Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications */ + autoupdate?: boolean | "notify"; + /** @description Disable providers that are loaded automatically */ + disabled_providers?: string[]; + /** @description When set, ONLY these providers will be enabled. All other providers will be ignored */ + enabled_providers?: string[]; + /** @description Model to use in the format of provider/model, eg anthropic/claude-2 */ + model?: string; + /** @description Small model to use for tasks like title generation in the format of provider/model */ + small_model?: string; + /** @description Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid. */ + default_agent?: string; + /** @description Custom username to display in conversations instead of system username */ + username?: string; + /** @description @deprecated Use `agent` field instead. */ + mode?: { + build?: components["schemas"]["AgentConfig"]; + plan?: components["schemas"]["AgentConfig"]; + } & { + [key: string]: components["schemas"]["AgentConfig"]; + }; + /** @description Agent configuration, see https://opencode.ai/docs/agent */ + agent?: { + plan?: components["schemas"]["AgentConfig"]; + build?: components["schemas"]["AgentConfig"]; + general?: components["schemas"]["AgentConfig"]; + explore?: components["schemas"]["AgentConfig"]; + title?: components["schemas"]["AgentConfig"]; + summary?: components["schemas"]["AgentConfig"]; + compaction?: components["schemas"]["AgentConfig"]; + } & { + [key: string]: components["schemas"]["AgentConfig"]; + }; + /** @description Custom provider configurations and model overrides */ + provider?: { + [key: string]: components["schemas"]["ProviderConfig"]; + }; + /** @description MCP (Model Context Protocol) server configurations */ + mcp?: { + [key: string]: (components["schemas"]["McpLocalConfig"] | components["schemas"]["McpRemoteConfig"]) | { + enabled: boolean; + }; + }; + formatter?: false | { + [key: string]: { + disabled?: boolean; + command?: string[]; + environment?: { + [key: string]: string; + }; + extensions?: string[]; + }; + }; + lsp?: false | { + [key: string]: { + /** @constant */ + disabled: true; + } | { + command: string[]; + extensions?: string[]; + disabled?: boolean; + env?: { + [key: string]: string; + }; + initialization?: { + [key: string]: unknown; + }; + }; + }; + /** @description Additional instruction files or patterns to include */ + instructions?: string[]; + layout?: components["schemas"]["LayoutConfig"]; + permission?: components["schemas"]["PermissionConfig"]; + tools?: { + [key: string]: boolean; + }; + enterprise?: { + /** @description Enterprise URL */ + url?: string; + }; + compaction?: { + /** @description Enable automatic compaction when context is full (default: true) */ + auto?: boolean; + /** @description Enable pruning of old tool outputs (default: true) */ + prune?: boolean; + }; + experimental?: { + hook?: { + file_edited?: { + [key: string]: { + command: string[]; + environment?: { + [key: string]: string; + }; + }[]; + }; + session_completed?: { + command: string[]; + environment?: { + [key: string]: string; + }; + }[]; + }; + /** @description Number of retries for chat completions on failure */ + chatMaxRetries?: number; + disable_paste_summary?: boolean; + /** @description Enable the batch tool */ + batch_tool?: boolean; + /** @description Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) */ + openTelemetry?: boolean; + /** @description Tools that should only be available to primary agents. */ + primary_tools?: string[]; + /** @description Continue the agent loop when a tool call is denied */ + continue_loop_on_deny?: boolean; + /** @description Timeout in milliseconds for model context protocol (MCP) requests */ + mcp_timeout?: number; + }; + }; + ToolIDs: string[]; + ToolListItem: { + id: string; + description: string; + parameters: unknown; + }; + ToolList: components["schemas"]["ToolListItem"][]; + Path: { + home: string; + state: string; + config: string; + worktree: string; + directory: string; + }; + Worktree: { + name: string; + branch: string; + directory: string; + }; + WorktreeCreateInput: { + name?: string; + startCommand?: string; + }; + VcsInfo: { + branch: string; + }; TextPartInput: { id?: string; /** @constant */ type: "text"; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; @@ -1711,59 +3274,117 @@ export interface components { end: number; }; }; + SubtaskPartInput: { + id?: string; + /** @constant */ + type: "subtask"; + prompt: string; + description: string; + agent: string; + command?: string; + }; Command: { name: string; description?: string; agent?: string; model?: string; + mcp?: boolean; template: string; subtask?: boolean; + hints: string[]; }; Model: { id: string; + providerID: string; + api: { + id: string; + url: string; + npm: string; + }; name: string; - release_date: string; - attachment: boolean; - reasoning: boolean; - temperature: boolean; - tool_call: boolean; + family?: string; + capabilities: { + temperature: boolean; + reasoning: boolean; + attachment: boolean; + toolcall: boolean; + input: { + text: boolean; + audio: boolean; + image: boolean; + video: boolean; + pdf: boolean; + }; + output: { + text: boolean; + audio: boolean; + image: boolean; + video: boolean; + pdf: boolean; + }; + interleaved: boolean | { + /** @enum {string} */ + field: "reasoning_content" | "reasoning_details"; + }; + }; cost: { input: number; output: number; - cache_read?: number; - cache_write?: number; + cache: { + read: number; + write: number; + }; + experimentalOver200K?: { + input: number; + output: number; + cache: { + read: number; + write: number; + }; + }; }; limit: { context: number; output: number; }; - modalities?: { - input: ("text" | "audio" | "image" | "video" | "pdf")[]; - output: ("text" | "audio" | "image" | "video" | "pdf")[]; - }; - experimental?: boolean; /** @enum {string} */ - status?: "alpha" | "beta" | "deprecated"; + status: "alpha" | "beta" | "deprecated" | "active"; options: { [key: string]: unknown; }; - headers?: { + headers: { [key: string]: string; }; - provider?: { - npm: string; + release_date: string; + variants?: { + [key: string]: { + [key: string]: unknown; + }; }; }; Provider: { - api?: string; - name: string; - env: string[]; id: string; - npm?: string; + name: string; + /** @enum {string} */ + source: "env" | "config" | "custom" | "api"; + env: string[]; + key?: string; + options: { + [key: string]: unknown; + }; models: { [key: string]: components["schemas"]["Model"]; }; }; + ProviderAuthMethod: { + type: "oauth" | "api"; + label: string; + }; + ProviderAuthAuthorization: { + url: string; + method: "auto" | "code"; + instructions: string; + }; Symbol: { name: string; kind: number; @@ -1813,28 +3434,23 @@ export interface components { Agent: { name: string; description?: string; + /** @enum {string} */ mode: "subagent" | "primary" | "all"; - builtIn: boolean; + native?: boolean; + hidden?: boolean; topP?: number; temperature?: number; - permission: { - edit: "ask" | "allow" | "deny"; - bash: { - [key: string]: "ask" | "allow" | "deny"; - }; - webfetch?: "ask" | "allow" | "deny"; - }; + color?: string; + permission: components["schemas"]["PermissionRuleset"]; model?: { modelID: string; providerID: string; }; prompt?: string; - tools: { - [key: string]: boolean; - }; options: { [key: string]: unknown; }; + steps?: number; }; MCPStatusConnected: { /** @constant */ @@ -1849,7 +3465,23 @@ export interface components { status: "failed"; error: string; }; - MCPStatus: components["schemas"]["MCPStatusConnected"] | components["schemas"]["MCPStatusDisabled"] | components["schemas"]["MCPStatusFailed"]; + MCPStatusNeedsAuth: { + /** @constant */ + status: "needs_auth"; + }; + MCPStatusNeedsClientRegistration: { + /** @constant */ + status: "needs_client_registration"; + error: string; + }; + MCPStatus: components["schemas"]["MCPStatusConnected"] | components["schemas"]["MCPStatusDisabled"] | components["schemas"]["MCPStatusFailed"] | components["schemas"]["MCPStatusNeedsAuth"] | components["schemas"]["MCPStatusNeedsClientRegistration"]; + McpResource: { + name: string; + uri: string; + description?: string; + mimeType?: string; + client: string; + }; LSPStatus: { id: string; name: string; @@ -1861,41 +3493,14 @@ export interface components { extensions: string[]; enabled: boolean; }; - "Event.tui.prompt.append": { - /** @constant */ - type: "tui.prompt.append"; - properties: { - text: string; - }; - }; - "Event.tui.command.execute": { - /** @constant */ - type: "tui.command.execute"; - properties: { - command: ("session.list" | "session.new" | "session.share" | "session.interrupt" | "session.compact" | "session.page.up" | "session.page.down" | "session.half.page.up" | "session.half.page.down" | "session.first" | "session.last" | "prompt.clear" | "prompt.submit" | "agent.cycle") | string; - }; - }; - "Event.tui.toast.show": { - /** @constant */ - type: "tui.toast.show"; - properties: { - title?: string; - message: string; - /** @enum {string} */ - variant: "info" | "success" | "warning" | "error"; - /** - * @description Duration in milliseconds - * @default 5000 - */ - duration: number; - }; - }; OAuth: { /** @constant */ type: "oauth"; refresh: string; access: string; expires: number; + accountId?: string; + enterpriseUrl?: string; }; ApiAuth: { /** @constant */ @@ -1909,169 +3514,6 @@ export interface components { token: string; }; Auth: components["schemas"]["OAuth"] | components["schemas"]["ApiAuth"] | components["schemas"]["WellKnownAuth"]; - "Event.installation.updated": { - /** @constant */ - type: "installation.updated"; - properties: { - version: string; - }; - }; - "Event.lsp.client.diagnostics": { - /** @constant */ - type: "lsp.client.diagnostics"; - properties: { - serverID: string; - path: string; - }; - }; - "Event.lsp.updated": { - /** @constant */ - type: "lsp.updated"; - properties: Record; - }; - "Event.message.updated": { - /** @constant */ - type: "message.updated"; - properties: { - info: components["schemas"]["Message"]; - }; - }; - "Event.message.removed": { - /** @constant */ - type: "message.removed"; - properties: { - sessionID: string; - messageID: string; - }; - }; - "Event.message.part.updated": { - /** @constant */ - type: "message.part.updated"; - properties: { - part: components["schemas"]["Part"]; - delta?: string; - }; - }; - "Event.message.part.removed": { - /** @constant */ - type: "message.part.removed"; - properties: { - sessionID: string; - messageID: string; - partID: string; - }; - }; - "Event.session.compacted": { - /** @constant */ - type: "session.compacted"; - properties: { - sessionID: string; - }; - }; - Permission: { - id: string; - type: string; - pattern?: string | string[]; - sessionID: string; - messageID: string; - callID?: string; - title: string; - metadata: { - [key: string]: unknown; - }; - time: { - created: number; - }; - }; - "Event.permission.updated": { - /** @constant */ - type: "permission.updated"; - properties: components["schemas"]["Permission"]; - }; - "Event.permission.replied": { - /** @constant */ - type: "permission.replied"; - properties: { - sessionID: string; - permissionID: string; - response: string; - }; - }; - "Event.file.edited": { - /** @constant */ - type: "file.edited"; - properties: { - file: string; - }; - }; - "Event.file.watcher.updated": { - /** @constant */ - type: "file.watcher.updated"; - properties: { - file: string; - event: "add" | "change" | "unlink"; - }; - }; - "Event.todo.updated": { - /** @constant */ - type: "todo.updated"; - properties: { - sessionID: string; - todos: components["schemas"]["Todo"][]; - }; - }; - "Event.command.executed": { - /** @constant */ - type: "command.executed"; - properties: { - name: string; - sessionID: string; - arguments: string; - messageID: string; - }; - }; - "Event.session.idle": { - /** @constant */ - type: "session.idle"; - properties: { - sessionID: string; - }; - }; - "Event.session.created": { - /** @constant */ - type: "session.created"; - properties: { - info: components["schemas"]["Session"]; - }; - }; - "Event.session.updated": { - /** @constant */ - type: "session.updated"; - properties: { - info: components["schemas"]["Session"]; - }; - }; - "Event.session.deleted": { - /** @constant */ - type: "session.deleted"; - properties: { - info: components["schemas"]["Session"]; - }; - }; - "Event.session.error": { - /** @constant */ - type: "session.error"; - properties: { - sessionID?: string; - error?: components["schemas"]["ProviderAuthError"] | components["schemas"]["UnknownError"] | components["schemas"]["MessageOutputLengthError"] | components["schemas"]["MessageAbortedError"] | components["schemas"]["APIError"]; - }; - }; - "Event.server.connected": { - /** @constant */ - type: "server.connected"; - properties: Record; - }; - Event: components["schemas"]["Event.installation.updated"] | components["schemas"]["Event.lsp.client.diagnostics"] | components["schemas"]["Event.lsp.updated"] | components["schemas"]["Event.message.updated"] | components["schemas"]["Event.message.removed"] | components["schemas"]["Event.message.part.updated"] | components["schemas"]["Event.message.part.removed"] | components["schemas"]["Event.session.compacted"] | components["schemas"]["Event.permission.updated"] | components["schemas"]["Event.permission.replied"] | components["schemas"]["Event.file.edited"] | components["schemas"]["Event.file.watcher.updated"] | components["schemas"]["Event.todo.updated"] | components["schemas"]["Event.command.executed"] | components["schemas"]["Event.session.idle"] | components["schemas"]["Event.session.created"] | components["schemas"]["Event.session.updated"] | components["schemas"]["Event.session.deleted"] | components["schemas"]["Event.session.error"] | components["schemas"]["Event.tui.prompt.append"] | components["schemas"]["Event.tui.command.execute"] | components["schemas"]["Event.tui.toast.show"] | components["schemas"]["Event.server.connected"]; }; responses: never; parameters: never; @@ -2081,6 +3523,70 @@ export interface components { } export type $defs = Record; export interface operations { + "global.health": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Health information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @constant */ + healthy: true; + version: string; + }; + }; + }; + }; + }; + "global.event": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Event stream */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "text/event-stream": components["schemas"]["GlobalEvent"]; + }; + }; + }; + }; + "global.dispose": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Global disposed */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + }; + }; "project.list": { parameters: { query?: { @@ -2114,7 +3620,7 @@ export interface operations { }; requestBody?: never; responses: { - /** @description Current project */ + /** @description Current project information */ 200: { headers: { [name: string]: unknown; @@ -2125,6 +3631,265 @@ export interface operations { }; }; }; + "project.update": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + projectID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + name?: string; + icon?: { + url?: string; + color?: string; + }; + }; + }; + }; + responses: { + /** @description Updated project information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Project"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "pty.list": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of sessions */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Pty"][]; + }; + }; + }; + }; + "pty.create": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + command?: string; + args?: string[]; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; + }; + }; + }; + responses: { + /** @description Created session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Pty"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; + "pty.get": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + ptyID: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Session info */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Pty"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "pty.update": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + ptyID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + title?: string; + size?: { + rows: number; + cols: number; + }; + }; + }; + }; + responses: { + /** @description Updated session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Pty"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; + "pty.remove": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + ptyID: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Session removed */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "pty.connect": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + ptyID: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Connected session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; "config.get": { parameters: { query?: { @@ -2246,6 +4011,28 @@ export interface operations { }; }; }; + "instance.dispose": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Instance disposed */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + }; + }; "path.get": { parameters: { query?: { @@ -2268,10 +4055,95 @@ export interface operations { }; }; }; + "worktree.list": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of worktree directories */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": string[]; + }; + }; + }; + }; + "worktree.create": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["WorktreeCreateInput"]; + }; + }; + responses: { + /** @description Worktree created */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Worktree"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; + "vcs.get": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description VCS info */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VcsInfo"]; + }; + }; + }; + }; "session.list": { parameters: { query?: { directory?: string; + /** @description Filter sessions updated on or after this timestamp (milliseconds since epoch) */ + start?: number; + /** @description Filter sessions by title (case-insensitive) */ + search?: string; + /** @description Maximum number of sessions to return */ + limit?: number; }; header?: never; path?: never; @@ -2304,6 +4176,7 @@ export interface operations { "application/json": { parentID?: string; title?: string; + permission?: components["schemas"]["PermissionRuleset"]; }; }; }; @@ -2328,6 +4201,39 @@ export interface operations { }; }; }; + "session.status": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get session status */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + [key: string]: components["schemas"]["SessionStatus"]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; "session.get": { parameters: { query?: { @@ -2335,7 +4241,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2377,7 +4283,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2419,7 +4325,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2427,6 +4333,9 @@ export interface operations { content: { "application/json": { title?: string; + time?: { + archived?: number; + }; }; }; }; @@ -2467,7 +4376,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2510,7 +4419,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -2553,7 +4462,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -2603,7 +4512,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2633,7 +4542,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2675,7 +4584,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2717,7 +4626,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -2760,13 +4669,14 @@ export interface operations { }; header?: never; path: { - id: string; + /** @description Session ID */ + sessionID: string; }; cookie?: never; }; requestBody?: never; responses: { - /** @description Successfully retrieved diff */ + /** @description List of diffs */ 200: { headers: { [name: string]: unknown; @@ -2775,6 +4685,24 @@ export interface operations { "application/json": components["schemas"]["FileDiff"][]; }; }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; }; }; "session.summarize": { @@ -2785,7 +4713,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -2794,6 +4722,8 @@ export interface operations { "application/json": { providerID: string; modelID: string; + /** @default false */ + auto?: boolean; }; }; }; @@ -2831,11 +4761,12 @@ export interface operations { parameters: { query?: { directory?: string; + limit?: number; }; header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -2881,7 +4812,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -2895,11 +4826,13 @@ export interface operations { }; agent?: string; noReply?: boolean; - system?: string; + /** @description @deprecated tools and permissions have been merged, you can set permissions on the session itself now */ tools?: { [key: string]: boolean; }; - parts: (components["schemas"]["TextPartInput"] | components["schemas"]["FilePartInput"] | components["schemas"]["AgentPartInput"])[]; + system?: string; + variant?: string; + parts: (components["schemas"]["TextPartInput"] | components["schemas"]["FilePartInput"] | components["schemas"]["AgentPartInput"] | components["schemas"]["SubtaskPartInput"])[]; }; }; }; @@ -2944,7 +4877,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; /** @description Message ID */ messageID: string; }; @@ -2984,6 +4917,164 @@ export interface operations { }; }; }; + "part.delete": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + /** @description Session ID */ + sessionID: string; + /** @description Message ID */ + messageID: string; + /** @description Part ID */ + partID: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully deleted part */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "part.update": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + /** @description Session ID */ + sessionID: string; + /** @description Message ID */ + messageID: string; + /** @description Part ID */ + partID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["Part"]; + }; + }; + responses: { + /** @description Successfully updated part */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Part"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "session.prompt_async": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + /** @description Session ID */ + sessionID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** @description @deprecated tools and permissions have been merged, you can set permissions on the session itself now */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: (components["schemas"]["TextPartInput"] | components["schemas"]["FilePartInput"] | components["schemas"]["AgentPartInput"] | components["schemas"]["SubtaskPartInput"])[]; + }; + }; + }; + responses: { + /** @description Prompt accepted */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; "session.command": { parameters: { query?: { @@ -2992,7 +5083,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -3004,6 +5095,16 @@ export interface operations { model?: string; arguments: string; command: string; + variant?: string; + parts?: { + id?: string; + /** @constant */ + type: "file"; + mime: string; + filename?: string; + url: string; + source?: components["schemas"]["FilePartSource"]; + }[]; }; }; }; @@ -3048,7 +5149,7 @@ export interface operations { header?: never; path: { /** @description Session ID */ - id: string; + sessionID: string; }; cookie?: never; }; @@ -3056,6 +5157,10 @@ export interface operations { content: { "application/json": { agent: string; + model?: { + providerID: string; + modelID: string; + }; command: string; }; }; @@ -3097,7 +5202,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -3146,7 +5251,7 @@ export interface operations { }; header?: never; path: { - id: string; + sessionID: string; }; cookie?: never; }; @@ -3181,14 +5286,14 @@ export interface operations { }; }; }; - "postSession:idPermissions:permissionID": { + "permission.respond": { parameters: { query?: { directory?: string; }; header?: never; path: { - id: string; + sessionID: string; permissionID: string; }; cookie?: never; @@ -3231,6 +5336,191 @@ export interface operations { }; }; }; + "permission.reply": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + requestID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @enum {string} */ + reply: "once" | "always" | "reject"; + message?: string; + }; + }; + }; + responses: { + /** @description Permission processed successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "permission.list": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of pending permissions */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["PermissionRequest"][]; + }; + }; + }; + }; + "question.list": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of pending questions */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["QuestionRequest"][]; + }; + }; + }; + }; + "question.reply": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + requestID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description User answers in order of questions (each answer is an array of selected labels) */ + answers: components["schemas"]["QuestionAnswer"][]; + }; + }; + }; + responses: { + /** @description Question answered successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "question.reject": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + requestID: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Question rejected successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; "command.list": { parameters: { query?: { @@ -3280,6 +5570,201 @@ export interface operations { }; }; }; + "provider.list": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of providers */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + all: { + api?: string; + name: string; + env: string[]; + id: string; + npm?: string; + models: { + [key: string]: { + id: string; + name: string; + family?: string; + release_date: string; + attachment: boolean; + reasoning: boolean; + temperature: boolean; + tool_call: boolean; + interleaved?: true | { + /** @enum {string} */ + field: "reasoning_content" | "reasoning_details"; + }; + cost?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + context_over_200k?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + }; + }; + limit: { + context: number; + output: number; + }; + modalities?: { + input: ("text" | "audio" | "image" | "video" | "pdf")[]; + output: ("text" | "audio" | "image" | "video" | "pdf")[]; + }; + experimental?: boolean; + /** @enum {string} */ + status?: "alpha" | "beta" | "deprecated"; + options: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + variants?: { + [key: string]: { + [key: string]: unknown; + }; + }; + }; + }; + }[]; + default: { + [key: string]: string; + }; + connected: string[]; + }; + }; + }; + }; + }; + "provider.auth": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Provider auth methods */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + [key: string]: components["schemas"]["ProviderAuthMethod"][]; + }; + }; + }; + }; + }; + "provider.oauth.authorize": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + /** @description Provider ID */ + providerID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description Auth method index */ + method: number; + }; + }; + }; + responses: { + /** @description Authorization URL and method */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ProviderAuthAuthorization"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; + "provider.oauth.callback": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + /** @description Provider ID */ + providerID: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description Auth method index */ + method: number; + /** @description OAuth authorization code */ + code?: string; + }; + }; + }; + responses: { + /** @description OAuth callback processed successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; "find.text": { parameters: { query: { @@ -3324,6 +5809,9 @@ export interface operations { query: { directory?: string; query: string; + dirs?: "true" | "false"; + type?: "file" | "directory"; + limit?: number; }; header?: never; path?: never; @@ -3528,6 +6016,290 @@ export interface operations { }; }; }; + "mcp.add": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + name: string; + config: components["schemas"]["McpLocalConfig"] | components["schemas"]["McpRemoteConfig"]; + }; + }; + }; + responses: { + /** @description MCP server added successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + [key: string]: components["schemas"]["MCPStatus"]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + }; + }; + "mcp.auth.start": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth flow started */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @description URL to open in browser for authorization */ + authorizationUrl: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "mcp.auth.remove": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth credentials removed */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @constant */ + success: true; + }; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "mcp.auth.callback": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description Authorization code from OAuth callback */ + code: string; + }; + }; + }; + responses: { + /** @description OAuth authentication completed */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MCPStatus"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "mcp.auth.authenticate": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth authentication completed */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MCPStatus"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; + "mcp.connect": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description MCP server connected successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + }; + }; + "mcp.disconnect": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description MCP server disconnected successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + }; + }; + "experimental.resource.list": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description MCP resources */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + [key: string]: components["schemas"]["McpResource"]; + }; + }; + }; + }; + }; "lsp.status": { parameters: { query?: { @@ -3825,7 +6597,7 @@ export interface operations { }; requestBody?: { content: { - "application/json": components["schemas"]["Event.tui.prompt.append"] | components["schemas"]["Event.tui.command.execute"] | components["schemas"]["Event.tui.toast.show"]; + "application/json": components["schemas"]["Event.tui.prompt.append"] | components["schemas"]["Event.tui.command.execute"] | components["schemas"]["Event.tui.toast.show"] | components["schemas"]["Event.tui.session.select"]; }; }; responses: { @@ -3849,6 +6621,53 @@ export interface operations { }; }; }; + "tui.selectSession": { + parameters: { + query?: { + directory?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description Session ID to navigate to */ + sessionID: string; + }; + }; + }; + responses: { + /** @description Session selected successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": boolean; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestError"]; + }; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NotFoundError"]; + }; + }; + }; + }; "tui.control.next": { parameters: { query?: { @@ -3907,7 +6726,7 @@ export interface operations { }; header?: never; path: { - id: string; + providerID: string; }; cookie?: never; }; diff --git a/frontend/src/api/opencode.ts b/frontend/src/api/opencode.ts index dd6f5e10..1444993e 100644 --- a/frontend/src/api/opencode.ts +++ b/frontend/src/api/opencode.ts @@ -2,14 +2,14 @@ import axios, { type AxiosInstance } from 'axios' import type { paths } from './opencode-types' type SessionListResponse = paths['/session']['get']['responses']['200']['content']['application/json'] -type SessionResponse = paths['/session/{id}']['get']['responses']['200']['content']['application/json'] +type SessionResponse = paths['/session/{sessionID}']['get']['responses']['200']['content']['application/json'] type CreateSessionRequest = NonNullable['content']['application/json'] -type MessageListResponse = paths['/session/{id}/message']['get']['responses']['200']['content']['application/json'] -type SendPromptRequest = NonNullable['content']['application/json'] +type MessageListResponse = paths['/session/{sessionID}/message']['get']['responses']['200']['content']['application/json'] +type SendPromptRequest = NonNullable['content']['application/json'] type ConfigResponse = paths['/config']['get']['responses']['200']['content']['application/json'] type CommandListResponse = paths['/command']['get']['responses']['200']['content']['application/json'] -type CommandRequest = NonNullable['content']['application/json'] -type ShellRequest = NonNullable['content']['application/json'] +type CommandRequest = NonNullable['content']['application/json'] +type ShellRequest = NonNullable['content']['application/json'] type AgentListResponse = paths['/agent']['get']['responses']['200']['content']['application/json'] export class OpenCodeClient { diff --git a/frontend/src/api/providers.ts b/frontend/src/api/providers.ts index af529498..f9bd0183 100644 --- a/frontend/src/api/providers.ts +++ b/frontend/src/api/providers.ts @@ -48,6 +48,7 @@ export interface OpenCodeModel { pdf: boolean; }; }; + variants?: Record>; } export interface OpenCodeProvider { @@ -87,6 +88,7 @@ export interface Model { provider?: { npm: string; }; + variants?: Record>; } export interface Provider { @@ -187,6 +189,7 @@ async function getProvidersFromOpenCodeServer(): Promise<{ providers: Provider[] provider: { npm: openCodeModel.api.npm, }, + variants: openCodeModel.variants, }; }); diff --git a/frontend/src/components/message/PromptInput.tsx b/frontend/src/components/message/PromptInput.tsx index cb7d227d..e43d5c87 100644 --- a/frontend/src/components/message/PromptInput.tsx +++ b/frontend/src/components/message/PromptInput.tsx @@ -5,6 +5,7 @@ import { useCommands } from '@/hooks/useCommands' import { useCommandHandler } from '@/hooks/useCommandHandler' import { useFileSearch } from '@/hooks/useFileSearch' import { useModelSelection } from '@/hooks/useModelSelection' +import { useVariants } from '@/hooks/useVariants' import { useUserBash } from '@/stores/userBashStore' import { useMobile } from '@/hooks/useMobile' @@ -16,6 +17,7 @@ import { CommandSuggestions } from '@/components/command/CommandSuggestions' import { SquareFill } from '@/components/ui/square-fill' import { MentionSuggestions, type MentionItem } from './MentionSuggestions' import { SessionStatusIndicator } from '@/components/ui/session-status-indicator' +import { ModelQuickSelect } from '@/components/model/ModelQuickSelect' import { detectMentionTrigger, parsePromptToParts, getFilename, filterAgentsByQuery } from '@/lib/promptParser' @@ -86,6 +88,7 @@ export const PromptInput = forwardRef(funct const [selectedMentionIndex, setSelectedMentionIndex] = useState(0) const [selectedCommandIndex, setSelectedCommandIndex] = useState(0) const [selectedAgent, setSelectedAgent] = useState(null) + const [isFocused, setIsFocused] = useState(false) const textareaRef = useRef(null) const fileInputRef = useRef(null) @@ -176,7 +179,8 @@ export const PromptInput = forwardRef(funct sessionID, parts, model: currentModel, - agent: selectedAgent || currentMode + agent: selectedAgent || currentMode, + variant: currentVariant }) setPrompt('') setAttachedFiles(new Map()) @@ -228,7 +232,8 @@ export const PromptInput = forwardRef(funct sessionID, parts, model: currentModel, - agent: selectedAgent || currentMode + agent: selectedAgent || currentMode, + variant: currentVariant }) setPrompt('') @@ -596,6 +601,11 @@ export const PromptInput = forwardRef(funct if (textareaRef.current) { textareaRef.current.style.height = 'auto' } + } else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 't') { + e.preventDefault() + if (hasVariants) { + cycleVariant() + } } } @@ -666,12 +676,13 @@ export const PromptInput = forwardRef(funct const modeBg = currentMode === 'plan' ? 'bg-yellow-500/20 border-yellow-400 hover:bg-yellow-500/30 hover:border-yellow-300' : 'bg-green-500/20 border-green-400 hover:bg-green-500/30 hover:border-green-300' const modeShadow = currentMode === 'plan' ? 'shadow-yellow-500/20 hover:shadow-yellow-500/30' : 'shadow-green-500/20 hover:shadow-green-500/30' - const { model, modelString } = useModelSelection(opcodeUrl, directory) +const { model, modelString } = useModelSelection(opcodeUrl, directory) const currentModel = modelString || '' const displayModelName = model?.modelID || currentModel const isMobile = useMobile() const { setShowDialog, hasPermissionsForSession } = usePermissionContext() const hasPendingPermissionForSession = hasPermissionsForSession(sessionID) + const { hasVariants, currentVariant, cycleVariant } = useVariants(opcodeUrl, directory) const sessionStatus = useSessionStatusForSession(sessionID) const isSessionActive = sessionStatus.type === 'busy' || sessionStatus.type === 'retry' const hasActiveStream = hasIncompleteMessages && isSessionActive @@ -694,7 +705,7 @@ export const PromptInput = forwardRef(funct return (
- {showStopButton && ( + {showStopButton && !(isFocused && prompt.trim().length > 0) && (
) : ( !hideSecondaryButtons && ( - - ) - )} + + + ) + )}
diff --git a/frontend/src/components/model/ModelQuickSelect.tsx b/frontend/src/components/model/ModelQuickSelect.tsx new file mode 100644 index 00000000..81c29b49 --- /dev/null +++ b/frontend/src/components/model/ModelQuickSelect.tsx @@ -0,0 +1,148 @@ +import { useMemo } from 'react' +import { Check, ChevronRight, Clock, Sparkles } from 'lucide-react' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from '@/components/ui/dropdown-menu' +import { useModelSelection } from '@/hooks/useModelSelection' +import { useVariants } from '@/hooks/useVariants' +import { formatModelName } from '@/api/providers' +import { useQuery } from '@tanstack/react-query' +import { useOpenCodeClient } from '@/hooks/useOpenCode' + +interface ModelQuickSelectProps { + opcodeUrl: string | null | undefined + directory?: string + onOpenFullDialog: () => void + disabled?: boolean + children: React.ReactNode +} + +export function ModelQuickSelect({ + opcodeUrl, + directory, + onOpenFullDialog, + disabled, + children, +}: ModelQuickSelectProps) { + const { modelString, recentModels, setModel } = useModelSelection(opcodeUrl, directory) + const { availableVariants, currentVariant, setVariant, clearVariant, hasVariants } = useVariants(opcodeUrl, directory) + const client = useOpenCodeClient(opcodeUrl, directory) + + const { data: providersData } = useQuery({ + queryKey: ['opencode', 'providers', opcodeUrl, directory], + queryFn: () => client!.getProviders(), + enabled: !!client, + staleTime: 30000, + }) + + const recentModelsWithNames = useMemo(() => { + if (!providersData?.all || recentModels.length === 0) return [] + + return recentModels + .filter(recent => { + const key = `${recent.providerID}/${recent.modelID}` + return key !== modelString + }) + .slice(0, 5) + .map(recent => { + let displayName = recent.modelID + for (const provider of providersData.all) { + if (provider.id === recent.providerID && provider.models) { + const modelData = provider.models[recent.modelID] + if (modelData) { + displayName = formatModelName(modelData) + break + } + } + } + return { + ...recent, + displayName, + key: `${recent.providerID}/${recent.modelID}`, + } + }) + }, [recentModels, providersData, modelString]) + + const handleVariantSelect = (variant: string | undefined) => { + if (variant === undefined) { + clearVariant() + } else { + setVariant(variant) + } + } + + const handleModelSelect = (providerID: string, modelID: string) => { + setModel({ providerID, modelID }) + } + + const hasRecents = recentModelsWithNames.length > 0 + + return ( + + + {children} + + + {hasVariants && ( + <> + + + Thinking Effort + + handleVariantSelect(undefined)} + className="flex items-center justify-between" + > + Default + {!currentVariant && } + + {availableVariants.map((variant) => ( + handleVariantSelect(variant)} + className="flex items-center justify-between" + > + {variant} + {currentVariant === variant && } + + ))} + {hasRecents && } + + )} + + {hasRecents && ( + <> + + + Recent Models + + {recentModelsWithNames.map((recent) => ( + handleModelSelect(recent.providerID, recent.modelID)} + className="flex items-center justify-between" + > + {recent.displayName} + {modelString === recent.key && } + + ))} + + + )} + + + All Models... + + + + + ) +} diff --git a/frontend/src/hooks/useOpenCode.ts b/frontend/src/hooks/useOpenCode.ts index 780770e7..23f4895e 100644 --- a/frontend/src/hooks/useOpenCode.ts +++ b/frontend/src/hooks/useOpenCode.ts @@ -252,12 +252,14 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?: parts, model, agent, + variant, }: { sessionID: string; prompt?: string; parts?: ContentPart[]; model?: string; agent?: string; + variant?: string; }) => { if (!client) throw new Error("No client available"); @@ -312,6 +314,10 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?: requestData.agent = agent; } + if (variant) { + requestData.variant = variant; + } + const response = await client.sendPrompt(sessionID, requestData); return { optimisticUserID, response, userPromptText }; diff --git a/frontend/src/hooks/useVariants.ts b/frontend/src/hooks/useVariants.ts new file mode 100644 index 00000000..6a15e0df --- /dev/null +++ b/frontend/src/hooks/useVariants.ts @@ -0,0 +1,94 @@ +import { useMemo } from 'react' +import { useModelSelection } from './useModelSelection' +import { useModelStore } from '@/stores/modelStore' +import { useOpenCodeClient } from './useOpenCode' +import { useQuery } from '@tanstack/react-query' + +export interface UseVariantsResult { + availableVariants: string[] + currentVariant: string | undefined + setVariant: (variant: string | undefined) => void + cycleVariant: () => void + clearVariant: () => void + hasVariants: boolean +} + +export function useVariants( + opcodeUrl: string | null | undefined, + directory?: string +): UseVariantsResult { + const { model } = useModelSelection(opcodeUrl, directory) + const { setVariant: setStoreVariant, clearVariant: clearStoreVariant } = useModelStore() + const client = useOpenCodeClient(opcodeUrl, directory) + + const { data: providersData, isLoading } = useQuery({ + queryKey: ['opencode', 'providers', opcodeUrl, directory], + queryFn: () => client!.getProviders(), + enabled: !!client && !!model, + staleTime: 30000, + }) + + const currentModel = useMemo(() => { + if (!model || isLoading || !providersData?.all) return null + for (const provider of providersData.all) { + if (provider.id === model.providerID && provider.models) { + const modelData = provider.models[model.modelID] + if (modelData) { + return modelData + } + } + } + return null + }, [model, providersData, isLoading]) + + const availableVariants = useMemo(() => { + if (!currentModel?.variants) return [] + return Object.keys(currentModel.variants) + }, [currentModel]) + + const currentVariant = useModelStore((state) => + model ? state.variants[`${model.providerID}/${model.modelID}`] : undefined + ) + + const setVariant = useMemo( + () => (variant: string | undefined) => { + if (!model) return + setStoreVariant(model, variant) + }, + [model, setStoreVariant], + ) + + const cycleVariant = useMemo(() => { + return () => { + if (!model || availableVariants.length === 0) return + + if (!currentVariant) { + setStoreVariant(model, availableVariants[0]) + } else { + const currentIndex = availableVariants.indexOf(currentVariant) + if (currentIndex === availableVariants.length - 1) { + clearStoreVariant(model) + } else { + setStoreVariant(model, availableVariants[currentIndex + 1]) + } + } + } + }, [model, availableVariants, currentVariant, setStoreVariant, clearStoreVariant]) + + const clearVariant = useMemo( + () => () => { + if (!model) return + clearStoreVariant(model) + }, + [model, clearStoreVariant], + ) + + return { + availableVariants, + currentVariant, + setVariant, + cycleVariant, + clearVariant, + hasVariants: availableVariants.length > 0, + } +} \ No newline at end of file diff --git a/frontend/src/stores/modelStore.ts b/frontend/src/stores/modelStore.ts index bb2647b5..437cd456 100644 --- a/frontend/src/stores/modelStore.ts +++ b/frontend/src/stores/modelStore.ts @@ -9,11 +9,15 @@ export interface ModelSelection { interface ModelStore { model: ModelSelection | null recentModels: ModelSelection[] + variants: Record isInitialized: boolean - + setModel: (model: ModelSelection) => void initializeFromConfig: (configModel: string | undefined) => void getModelString: () => string | null + setVariant: (model: ModelSelection, variant: string | undefined) => void + getVariant: (model: ModelSelection) => string | undefined + clearVariant: (model: ModelSelection) => void } const MAX_RECENT_MODELS = 10 @@ -30,6 +34,7 @@ export const useModelStore = create()( (set, get) => ({ model: null, recentModels: [], + variants: {}, isInitialized: false, setModel: (model: ModelSelection) => { @@ -67,13 +72,43 @@ export const useModelStore = create()( if (!model) return null return `${model.providerID}/${model.modelID}` }, + + setVariant: (model: ModelSelection, variant: string | undefined) => { + set((state) => { + const key = `${model.providerID}/${model.modelID}` + return { + variants: { + ...state.variants, + [key]: variant, + }, + } + }) + }, + + getVariant: (model: ModelSelection) => { + const state = get() + const key = `${model.providerID}/${model.modelID}` + return state.variants[key] + }, + + clearVariant: (model: ModelSelection) => { + set((state) => { + const key = `${model.providerID}/${model.modelID}` + const newVariants = { ...state.variants } + delete newVariants[key] + return { + variants: newVariants, + } + }) + }, }), { name: 'opencode-model-selection', partialize: (state) => ({ model: state.model, recentModels: state.recentModels, + variants: state.variants, }), } ) -) +) \ No newline at end of file diff --git a/frontend/src/stores/sessionStatusStore.ts b/frontend/src/stores/sessionStatusStore.ts index caa78128..f2ad9f1d 100644 --- a/frontend/src/stores/sessionStatusStore.ts +++ b/frontend/src/stores/sessionStatusStore.ts @@ -61,8 +61,7 @@ export const useSessionStatus = create((set, get) => ({ })) export const useSessionStatusForSession = (sessionID: string | undefined): SessionStatusType => { - const status = useSessionStatus((state) => - sessionID ? state.statuses.get(sessionID) : undefined + return useSessionStatus((state) => + sessionID ? (state.statuses.get(sessionID) ?? DEFAULT_STATUS) : DEFAULT_STATUS ) - return status || DEFAULT_STATUS } diff --git a/scripts/generate-openapi.ts b/scripts/generate-openapi.ts index d21c32c7..33d0d0b9 100644 --- a/scripts/generate-openapi.ts +++ b/scripts/generate-openapi.ts @@ -3,12 +3,11 @@ import { writeFile } from 'fs/promises' import { join, dirname } from 'path' import { fileURLToPath } from 'url' -import {ENV} from '../backend/src/config' - const __dirname = dirname(fileURLToPath(import.meta.url)) -const OPENCODE_URL = ENV.VITE_API_URL + '/api/opencode' +const API_URL = process.env.VITE_API_URL || 'http://localhost:8001' +const OPENCODE_URL = API_URL + '/api/opencode' async function generateOpenAPISpec() { console.log(`📥 Fetching OpenAPI spec from ${OPENCODE_URL}/doc`) diff --git a/shared/src/schemas/settings.ts b/shared/src/schemas/settings.ts index 883cfea2..9e768224 100644 --- a/shared/src/schemas/settings.ts +++ b/shared/src/schemas/settings.ts @@ -60,6 +60,7 @@ export const DEFAULT_KEYBOARD_SHORTCUTS: Record = { closeSession: 'W', toggleSidebar: 'B', selectModel: 'M', + variantCycle: `${CMD_KEY}+T`, }; export const GitCredentialSchema = z.object({