{"openapi":"3.1.1","info":{"title":"opencode","description":"opencode api","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/sync-event":{"get":{"operationId":"global.sync-event.subscribe","summary":"Subscribe to global sync events","description":"Get global sync events","responses":{"200":{"description":"Event stream","content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/SyncEvent"}}}}}}},"/global/config":{"get":{"operationId":"global.config.get","summary":"Get global configuration","description":"Retrieve the current global OpenCode configuration settings and preferences.","responses":{"200":{"description":"Get global config info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Config"}}}}}},"patch":{"operationId":"global.config.update","summary":"Update global configuration","description":"Update global OpenCode configuration settings and preferences.","responses":{"200":{"description":"Successfully updated global config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Config"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Config"}}}}}},"/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"}}}}}}},"/global/upgrade":{"post":{"operationId":"global.upgrade","summary":"Upgrade opencode","description":"Upgrade opencode to the specified version or latest if not specified.","responses":{"200":{"description":"Upgrade result","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"success":{"type":"boolean","const":true},"version":{"type":"string"}},"required":["success","version"]},{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"string"}},"required":["success","error"]}]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"string"}}}}}}}},"/auth/{providerID}":{"put":{"operationId":"auth.set","summary":"Set auth credentials","description":"Set authentication credentials","responses":{"200":{"description":"Successfully set authentication credentials","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}}},"parameters":[{"in":"path","name":"providerID","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Auth"}}}}},"delete":{"operationId":"auth.remove","summary":"Remove auth credentials","description":"Remove authentication credentials","responses":{"200":{"description":"Successfully removed authentication credentials","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}}},"parameters":[{"in":"path","name":"providerID","schema":{"type":"string"},"required":true}]}},"/log":{"post":{"operationId":"app.log","parameters":[{"in":"query","name":"directory","schema":{"type":"string"}},{"in":"query","name":"workspace","schema":{"type":"string"}}],"summary":"Write log","description":"Write a log entry to the server logs with specified level and metadata.","responses":{"200":{"description":"Log entry written 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":{"service":{"description":"Service name for the log entry","type":"string"},"level":{"description":"Log level","type":"string","enum":["debug","info","error","warn"]},"message":{"description":"Log message","type":"string"},"extra":{"description":"Additional metadata for the log entry","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["service","level","message"]}}}}}}},"components":{"schemas":{"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.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.line.up","session.line.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"]},"Project":{"type":"object","properties":{"id":{"type":"string"},"worktree":{"type":"string"},"vcs":{"type":"string","const":"git"},"name":{"type":"string"},"icon":{"type":"object","properties":{"url":{"type":"string"},"override":{"type":"string"},"color":{"type":"string"}}},"commands":{"type":"object","properties":{"start":{"description":"Startup script to run when creating a new workspace (worktree)","type":"string"}}},"time":{"type":"object","properties":{"created":{"type":"number"},"updated":{"type":"number"},"initialized":{"type":"number"}},"required":["created","updated"]},"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.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"]},"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","pattern":"^msg.*"},"callID":{"type":"string"}},"required":["messageID","callID"]}},"required":["id","sessionID","permission","patterns","metadata","always"]},"Event.permission.asked":{"type":"object","properties":{"type":{"type":"string","const":"permission.asked"},"properties":{"$ref":"#/components/schemas/PermissionRequest"}},"required":["type","properties"]},"Event.permission.replied":{"type":"object","properties":{"type":{"type":"string","const":"permission.replied"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"requestID":{"type":"string","pattern":"^per.*"},"reply":{"type":"string","enum":["once","always","reject"]}},"required":["sessionID","requestID","reply"]}},"required":["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","pattern":"^ses.*"},"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","pattern":"^ses.*"}},"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 30 chars)","type":"string"},"options":{"description":"Available choices","type":"array","items":{"$ref":"#/components/schemas/QuestionOption"}},"multiple":{"description":"Allow selecting multiple choices","type":"boolean"},"custom":{"description":"Allow typing a custom answer (default: true)","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","pattern":"^msg.*"},"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","pattern":"^ses.*"},"requestID":{"type":"string","pattern":"^que.*"},"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","pattern":"^ses.*"},"requestID":{"type":"string","pattern":"^que.*"}},"required":["sessionID","requestID"]}},"required":["type","properties"]},"Todo":{"type":"object","properties":{"content":{"description":"Brief description of the task","type":"string"},"status":{"description":"Current status of the task: pending, in_progress, completed, cancelled","type":"string"},"priority":{"description":"Priority level of the task: high, medium, low","type":"string"}},"required":["content","status","priority"]},"Event.todo.updated":{"type":"object","properties":{"type":{"type":"string","const":"todo.updated"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"todos":{"type":"array","items":{"$ref":"#/components/schemas/Todo"}}},"required":["sessionID","todos"]}},"required":["type","properties"]},"Event.lsp.updated":{"type":"object","properties":{"type":{"type":"string","const":"lsp.updated"},"properties":{"type":"object","properties":{}}},"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.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.mcp.browser.open.failed":{"type":"object","properties":{"type":{"type":"string","const":"mcp.browser.open.failed"},"properties":{"type":"object","properties":{"mcpName":{"type":"string"},"url":{"type":"string"}},"required":["mcpName","url"]}},"required":["type","properties"]},"Event.message.part.delta":{"type":"object","properties":{"type":{"type":"string","const":"message.part.delta"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"partID":{"type":"string","pattern":"^prt.*"},"field":{"type":"string"},"delta":{"type":"string"}},"required":["sessionID","messageID","partID","field","delta"]}},"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"]},"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.compacted":{"type":"object","properties":{"type":{"type":"string","const":"session.compacted"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"}},"required":["sessionID"]}},"required":["type","properties"]},"SnapshotFileDiff":{"type":"object","properties":{"file":{"type":"string"},"patch":{"type":"string"},"additions":{"type":"number"},"deletions":{"type":"number"},"status":{"type":"string","enum":["added","deleted","modified"]}},"required":["file","patch","additions","deletions"]},"Event.session.diff":{"type":"object","properties":{"type":{"type":"string","const":"session.diff"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"diff":{"type":"array","items":{"$ref":"#/components/schemas/SnapshotFileDiff"}}},"required":["sessionID","diff"]}},"required":["type","properties"]},"ProviderAuthError":{"type":"object","properties":{"name":{"type":"string","const":"ProviderAuthError"},"data":{"type":"object","properties":{"providerID":{"type":"string"},"message":{"type":"string"}},"required":["providerID","message"]}},"required":["name","data"]},"UnknownError":{"type":"object","properties":{"name":{"type":"string","const":"UnknownError"},"data":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}},"required":["name","data"]},"MessageOutputLengthError":{"type":"object","properties":{"name":{"type":"string","const":"MessageOutputLengthError"},"data":{"type":"object","properties":{}}},"required":["name","data"]},"MessageAbortedError":{"type":"object","properties":{"name":{"type":"string","const":"MessageAbortedError"},"data":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}},"required":["name","data"]},"StructuredOutputError":{"type":"object","properties":{"name":{"type":"string","const":"StructuredOutputError"},"data":{"type":"object","properties":{"message":{"type":"string"},"retries":{"type":"number"}},"required":["message","retries"]}},"required":["name","data"]},"ContextOverflowError":{"type":"object","properties":{"name":{"type":"string","const":"ContextOverflowError"},"data":{"type":"object","properties":{"message":{"type":"string"},"responseBody":{"type":"string"}},"required":["message"]}},"required":["name","data"]},"APIError":{"type":"object","properties":{"name":{"type":"string","const":"APIError"},"data":{"type":"object","properties":{"message":{"type":"string"},"statusCode":{"type":"number"},"isRetryable":{"type":"boolean"},"responseHeaders":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"responseBody":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["message","isRetryable"]}},"required":["name","data"]},"Event.session.error":{"type":"object","properties":{"type":{"type":"string","const":"session.error"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"error":{"anyOf":[{"$ref":"#/components/schemas/ProviderAuthError"},{"$ref":"#/components/schemas/UnknownError"},{"$ref":"#/components/schemas/MessageOutputLengthError"},{"$ref":"#/components/schemas/MessageAbortedError"},{"$ref":"#/components/schemas/StructuredOutputError"},{"$ref":"#/components/schemas/ContextOverflowError"},{"$ref":"#/components/schemas/APIError"}]}}}},"required":["type","properties"]},"Event.workspace.ready":{"type":"object","properties":{"type":{"type":"string","const":"workspace.ready"},"properties":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["type","properties"]},"Event.workspace.failed":{"type":"object","properties":{"type":{"type":"string","const":"workspace.failed"},"properties":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}},"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.worktree.ready":{"type":"object","properties":{"type":{"type":"string","const":"worktree.ready"},"properties":{"type":"object","properties":{"name":{"type":"string"},"branch":{"type":"string"}},"required":["name","branch"]}},"required":["type","properties"]},"Event.worktree.failed":{"type":"object","properties":{"type":{"type":"string","const":"worktree.failed"},"properties":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}},"required":["type","properties"]},"OutputFormatText":{"type":"object","properties":{"type":{"type":"string","const":"text"}},"required":["type"]},"JSONSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"OutputFormatJsonSchema":{"type":"object","properties":{"type":{"type":"string","const":"json_schema"},"schema":{"$ref":"#/components/schemas/JSONSchema"},"retryCount":{"default":2,"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type","schema"]},"OutputFormat":{"anyOf":[{"$ref":"#/components/schemas/OutputFormatText"},{"$ref":"#/components/schemas/OutputFormatJsonSchema"}]},"UserMessage":{"type":"object","properties":{"id":{"type":"string","pattern":"^msg.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"role":{"type":"string","const":"user"},"time":{"type":"object","properties":{"created":{"type":"number"}},"required":["created"]},"format":{"$ref":"#/components/schemas/OutputFormat"},"summary":{"type":"object","properties":{"title":{"type":"string"},"body":{"type":"string"},"diffs":{"type":"array","items":{"$ref":"#/components/schemas/SnapshotFileDiff"}}},"required":["diffs"]},"agent":{"type":"string"},"model":{"type":"object","properties":{"providerID":{"type":"string"},"modelID":{"type":"string"},"variant":{"type":"string"}},"required":["providerID","modelID"]},"system":{"type":"string"},"tools":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}}},"required":["id","sessionID","role","time","agent","model"]},"AssistantMessage":{"type":"object","properties":{"id":{"type":"string","pattern":"^msg.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"role":{"type":"string","const":"assistant"},"time":{"type":"object","properties":{"created":{"type":"number"},"completed":{"type":"number"}},"required":["created"]},"error":{"anyOf":[{"$ref":"#/components/schemas/ProviderAuthError"},{"$ref":"#/components/schemas/UnknownError"},{"$ref":"#/components/schemas/MessageOutputLengthError"},{"$ref":"#/components/schemas/MessageAbortedError"},{"$ref":"#/components/schemas/StructuredOutputError"},{"$ref":"#/components/schemas/ContextOverflowError"},{"$ref":"#/components/schemas/APIError"}]},"parentID":{"type":"string","pattern":"^msg.*"},"modelID":{"type":"string"},"providerID":{"type":"string"},"mode":{"type":"string"},"agent":{"type":"string"},"path":{"type":"object","properties":{"cwd":{"type":"string"},"root":{"type":"string"}},"required":["cwd","root"]},"summary":{"type":"boolean"},"cost":{"type":"number"},"tokens":{"type":"object","properties":{"total":{"type":"number"},"input":{"type":"number"},"output":{"type":"number"},"reasoning":{"type":"number"},"cache":{"type":"object","properties":{"read":{"type":"number"},"write":{"type":"number"}},"required":["read","write"]}},"required":["input","output","reasoning","cache"]},"structured":{},"variant":{"type":"string"},"finish":{"type":"string"}},"required":["id","sessionID","role","time","parentID","modelID","providerID","mode","agent","path","cost","tokens"]},"Message":{"anyOf":[{"$ref":"#/components/schemas/UserMessage"},{"$ref":"#/components/schemas/AssistantMessage"}]},"Event.message.updated":{"type":"object","properties":{"type":{"type":"string","const":"message.updated"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Message"}},"required":["sessionID","info"]}},"required":["type","properties"]},"Event.message.removed":{"type":"object","properties":{"type":{"type":"string","const":"message.removed"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"}},"required":["sessionID","messageID"]}},"required":["type","properties"]},"TextPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"text"},"text":{"type":"string"},"synthetic":{"type":"boolean"},"ignored":{"type":"boolean"},"time":{"type":"object","properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start"]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","sessionID","messageID","type","text"]},"SubtaskPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"subtask"},"prompt":{"type":"string"},"description":{"type":"string"},"agent":{"type":"string"},"model":{"type":"object","properties":{"providerID":{"type":"string"},"modelID":{"type":"string"}},"required":["providerID","modelID"]},"command":{"type":"string"}},"required":["id","sessionID","messageID","type","prompt","description","agent"]},"ReasoningPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"time":{"type":"object","properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start"]}},"required":["id","sessionID","messageID","type","text","time"]},"FilePartSourceText":{"type":"object","properties":{"value":{"type":"string"},"start":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"end":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["value","start","end"]},"FileSource":{"type":"object","properties":{"text":{"$ref":"#/components/schemas/FilePartSourceText"},"type":{"type":"string","const":"file"},"path":{"type":"string"}},"required":["text","type","path"]},"Range":{"type":"object","properties":{"start":{"type":"object","properties":{"line":{"type":"number"},"character":{"type":"number"}},"required":["line","character"]},"end":{"type":"object","properties":{"line":{"type":"number"},"character":{"type":"number"}},"required":["line","character"]}},"required":["start","end"]},"SymbolSource":{"type":"object","properties":{"text":{"$ref":"#/components/schemas/FilePartSourceText"},"type":{"type":"string","const":"symbol"},"path":{"type":"string"},"range":{"$ref":"#/components/schemas/Range"},"name":{"type":"string"},"kind":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["text","type","path","range","name","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":[{"$ref":"#/components/schemas/FileSource"},{"$ref":"#/components/schemas/SymbolSource"},{"$ref":"#/components/schemas/ResourceSource"}]},"FilePart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"file"},"mime":{"type":"string"},"filename":{"type":"string"},"url":{"type":"string"},"source":{"$ref":"#/components/schemas/FilePartSource"}},"required":["id","sessionID","messageID","type","mime","url"]},"ToolStatePending":{"type":"object","properties":{"status":{"type":"string","const":"pending"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"raw":{"type":"string"}},"required":["status","input","raw"]},"ToolStateRunning":{"type":"object","properties":{"status":{"type":"string","const":"running"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"title":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"time":{"type":"object","properties":{"start":{"type":"number"}},"required":["start"]}},"required":["status","input","time"]},"ToolStateCompleted":{"type":"object","properties":{"status":{"type":"string","const":"completed"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"output":{"type":"string"},"title":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"time":{"type":"object","properties":{"start":{"type":"number"},"end":{"type":"number"},"compacted":{"type":"number"}},"required":["start","end"]},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/FilePart"}}},"required":["status","input","output","title","metadata","time"]},"ToolStateError":{"type":"object","properties":{"status":{"type":"string","const":"error"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"error":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"time":{"type":"object","properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start","end"]}},"required":["status","input","error","time"]},"ToolState":{"anyOf":[{"$ref":"#/components/schemas/ToolStatePending"},{"$ref":"#/components/schemas/ToolStateRunning"},{"$ref":"#/components/schemas/ToolStateCompleted"},{"$ref":"#/components/schemas/ToolStateError"}]},"ToolPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"tool"},"callID":{"type":"string"},"tool":{"type":"string"},"state":{"$ref":"#/components/schemas/ToolState"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","sessionID","messageID","type","callID","tool","state"]},"StepStartPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"step-start"},"snapshot":{"type":"string"}},"required":["id","sessionID","messageID","type"]},"StepFinishPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"step-finish"},"reason":{"type":"string"},"snapshot":{"type":"string"},"cost":{"type":"number"},"tokens":{"type":"object","properties":{"total":{"type":"number"},"input":{"type":"number"},"output":{"type":"number"},"reasoning":{"type":"number"},"cache":{"type":"object","properties":{"read":{"type":"number"},"write":{"type":"number"}},"required":["read","write"]}},"required":["input","output","reasoning","cache"]}},"required":["id","sessionID","messageID","type","reason","cost","tokens"]},"SnapshotPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"snapshot"},"snapshot":{"type":"string"}},"required":["id","sessionID","messageID","type","snapshot"]},"PatchPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"patch"},"hash":{"type":"string"},"files":{"type":"array","items":{"type":"string"}}},"required":["id","sessionID","messageID","type","hash","files"]},"AgentPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"agent"},"name":{"type":"string"},"source":{"type":"object","properties":{"value":{"type":"string"},"start":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"end":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["value","start","end"]}},"required":["id","sessionID","messageID","type","name"]},"RetryPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"retry"},"attempt":{"type":"number"},"error":{"$ref":"#/components/schemas/APIError"},"time":{"type":"object","properties":{"created":{"type":"number"}},"required":["created"]}},"required":["id","sessionID","messageID","type","attempt","error","time"]},"CompactionPart":{"type":"object","properties":{"id":{"type":"string","pattern":"^prt.*"},"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"type":{"type":"string","const":"compaction"},"auto":{"type":"boolean"},"overflow":{"type":"boolean"}},"required":["id","sessionID","messageID","type","auto"]},"Part":{"anyOf":[{"$ref":"#/components/schemas/TextPart"},{"$ref":"#/components/schemas/SubtaskPart"},{"$ref":"#/components/schemas/ReasoningPart"},{"$ref":"#/components/schemas/FilePart"},{"$ref":"#/components/schemas/ToolPart"},{"$ref":"#/components/schemas/StepStartPart"},{"$ref":"#/components/schemas/StepFinishPart"},{"$ref":"#/components/schemas/SnapshotPart"},{"$ref":"#/components/schemas/PatchPart"},{"$ref":"#/components/schemas/AgentPart"},{"$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":{"sessionID":{"type":"string","pattern":"^ses.*"},"part":{"$ref":"#/components/schemas/Part"},"time":{"type":"number"}},"required":["sessionID","part","time"]}},"required":["type","properties"]},"Event.message.part.removed":{"type":"object","properties":{"type":{"type":"string","const":"message.part.removed"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"partID":{"type":"string","pattern":"^prt.*"}},"required":["sessionID","messageID","partID"]}},"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.*"},"slug":{"type":"string"},"projectID":{"type":"string"},"workspaceID":{"type":"string","pattern":"^wrk.*"},"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/SnapshotFileDiff"}}},"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","pattern":"^msg.*"},"partID":{"type":"string","pattern":"^prt.*"},"snapshot":{"type":"string"},"diff":{"type":"string"}},"required":["messageID"]}},"required":["id","slug","projectID","directory","title","version","time"]},"Event.session.created":{"type":"object","properties":{"type":{"type":"string","const":"session.created"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Session"}},"required":["sessionID","info"]}},"required":["type","properties"]},"Event.session.updated":{"type":"object","properties":{"type":{"type":"string","const":"session.updated"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Session"}},"required":["sessionID","info"]}},"required":["type","properties"]},"Event.session.deleted":{"type":"object","properties":{"type":{"type":"string","const":"session.deleted"},"properties":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Session"}},"required":["sessionID","info"]}},"required":["type","properties"]},"Event":{"anyOf":[{"$ref":"#/components/schemas/Event.server.connected"},{"$ref":"#/components/schemas/Event.global.disposed"},{"$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.project.updated"},{"$ref":"#/components/schemas/Event.installation.updated"},{"$ref":"#/components/schemas/Event.installation.update-available"},{"$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.lsp.updated"},{"$ref":"#/components/schemas/Event.file.watcher.updated"},{"$ref":"#/components/schemas/Event.mcp.tools.changed"},{"$ref":"#/components/schemas/Event.mcp.browser.open.failed"},{"$ref":"#/components/schemas/Event.message.part.delta"},{"$ref":"#/components/schemas/Event.vcs.branch.updated"},{"$ref":"#/components/schemas/Event.command.executed"},{"$ref":"#/components/schemas/Event.session.compacted"},{"$ref":"#/components/schemas/Event.session.diff"},{"$ref":"#/components/schemas/Event.session.error"},{"$ref":"#/components/schemas/Event.workspace.ready"},{"$ref":"#/components/schemas/Event.workspace.failed"},{"$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.worktree.ready"},{"$ref":"#/components/schemas/Event.worktree.failed"},{"$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.created"},{"$ref":"#/components/schemas/Event.session.updated"},{"$ref":"#/components/schemas/Event.session.deleted"}]},"GlobalEvent":{"type":"object","properties":{"directory":{"type":"string"},"payload":{"$ref":"#/components/schemas/Event"}},"required":["directory","payload"]},"SyncEvent.message.updated":{"type":"object","properties":{"type":{"type":"string","const":"message.updated.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Message"}},"required":["sessionID","info"]}},"required":["type","aggregate","data"]},"SyncEvent.message.removed":{"type":"object","properties":{"type":{"type":"string","const":"message.removed.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"}},"required":["sessionID","messageID"]}},"required":["type","aggregate","data"]},"SyncEvent.message.part.updated":{"type":"object","properties":{"type":{"type":"string","const":"message.part.updated.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"part":{"$ref":"#/components/schemas/Part"},"time":{"type":"number"}},"required":["sessionID","part","time"]}},"required":["type","aggregate","data"]},"SyncEvent.message.part.removed":{"type":"object","properties":{"type":{"type":"string","const":"message.part.removed.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"messageID":{"type":"string","pattern":"^msg.*"},"partID":{"type":"string","pattern":"^prt.*"}},"required":["sessionID","messageID","partID"]}},"required":["type","aggregate","data"]},"SyncEvent.session.created":{"type":"object","properties":{"type":{"type":"string","const":"session.created.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Session"}},"required":["sessionID","info"]}},"required":["type","aggregate","data"]},"SyncEvent.session.updated":{"type":"object","properties":{"type":{"type":"string","const":"session.updated.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"type":"object","properties":{"id":{"anyOf":[{"type":"string","pattern":"^ses.*"},{"type":"null"}]},"slug":{"anyOf":[{"type":"string"},{"type":"null"}]},"projectID":{"anyOf":[{"type":"string"},{"type":"null"}]},"workspaceID":{"anyOf":[{"type":"string","pattern":"^wrk.*"},{"type":"null"}]},"directory":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentID":{"anyOf":[{"type":"string","pattern":"^ses.*"},{"type":"null"}]},"summary":{"anyOf":[{"type":"object","properties":{"additions":{"type":"number"},"deletions":{"type":"number"},"files":{"type":"number"},"diffs":{"type":"array","items":{"$ref":"#/components/schemas/SnapshotFileDiff"}}},"required":["additions","deletions","files"]},{"type":"null"}]},"share":{"type":"object","properties":{"url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["url"]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"anyOf":[{"type":"string"},{"type":"null"}]},"time":{"type":"object","properties":{"created":{"anyOf":[{"type":"number"},{"type":"null"}]},"updated":{"anyOf":[{"type":"number"},{"type":"null"}]},"compacting":{"anyOf":[{"type":"number"},{"type":"null"}]},"archived":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["created","updated","compacting","archived"]},"permission":{"anyOf":[{"$ref":"#/components/schemas/PermissionRuleset"},{"type":"null"}]},"revert":{"anyOf":[{"type":"object","properties":{"messageID":{"type":"string","pattern":"^msg.*"},"partID":{"type":"string","pattern":"^prt.*"},"snapshot":{"type":"string"},"diff":{"type":"string"}},"required":["messageID"]},{"type":"null"}]}},"required":["id","slug","projectID","workspaceID","directory","parentID","summary","title","version","permission","revert"]}},"required":["sessionID","info"]}},"required":["type","aggregate","data"]},"SyncEvent.session.deleted":{"type":"object","properties":{"type":{"type":"string","const":"session.deleted.1"},"aggregate":{"type":"string","const":"sessionID"},"data":{"type":"object","properties":{"sessionID":{"type":"string","pattern":"^ses.*"},"info":{"$ref":"#/components/schemas/Session"}},"required":["sessionID","info"]}},"required":["type","aggregate","data"]},"SyncEvent":{"type":"object","properties":{"payload":{"$ref":"#/components/schemas/SyncEvent"}},"required":["payload"]},"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"},"mdnsDomain":{"description":"Custom domain name for mDNS service (default: opencode.local)","type":"string"},"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"},"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"},"skill":{"$ref":"#/components/schemas/PermissionRuleConfig"}},"additionalProperties":{"$ref":"#/components/schemas/PermissionRuleConfig"}},{"$ref":"#/components/schemas/PermissionActionConfig"}]},"AgentConfig":{"type":"object","properties":{"model":{"type":"string"},"variant":{"description":"Default model variant for this agent (applies only when using the agent's configured 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 (e.g., #FF5733) or theme color (e.g., primary)","anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"string","enum":["primary","secondary","accent","success","warning","error","info"]}]},"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"},"input":{"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"},"api":{"type":"string"}}},"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}]},"chunkTimeout":{"description":"Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"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 MCP server requests. 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 MCP server requests. 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"},"logLevel":{"$ref":"#/components/schemas/LogLevel"},"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"]}},"skills":{"description":"Additional skill folder paths","type":"object","properties":{"paths":{"description":"Additional paths to skill folders","type":"array","items":{"type":"string"}},"urls":{"description":"URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)","type":"array","items":{"type":"string"}}}},"watcher":{"type":"object","properties":{"ignore":{"type":"array","items":{"type":"string"}}}},"snapshot":{"description":"Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true.","type":"boolean"},"plugin":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"array","prefixItems":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}]}},"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/agents","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"},"reserved":{"description":"Token buffer for compaction. Leaves enough window to avoid overflow during compaction.","type":"integer","minimum":0,"maximum":9007199254740991}}},"experimental":{"type":"object","properties":{"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},"BadRequestError":{"type":"object","properties":{"data":{},"errors":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"success":{"type":"boolean","const":false}},"required":["data","errors","success"]},"OAuth":{"type":"object","properties":{"type":{"type":"string","const":"oauth"},"refresh":{"type":"string"},"access":{"type":"string"},"expires":{"type":"number"},"accountId":{"type":"string"},"enterpriseUrl":{"type":"string"}},"required":["type","refresh","access","expires"]},"ApiAuth":{"type":"object","properties":{"type":{"type":"string","const":"api"},"key":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["type","key"]},"WellKnownAuth":{"type":"object","properties":{"type":{"type":"string","const":"wellknown"},"key":{"type":"string"},"token":{"type":"string"}},"required":["type","key","token"]},"Auth":{"anyOf":[{"$ref":"#/components/schemas/OAuth"},{"$ref":"#/components/schemas/ApiAuth"},{"$ref":"#/components/schemas/WellKnownAuth"}]}}}}