diff --git a/packages/console/app/public/config.json b/packages/console/app/public/config.json index 29540479a29..f1d03fda3d3 100644 --- a/packages/console/app/public/config.json +++ b/packages/console/app/public/config.json @@ -1,8 +1,2187 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$ref": "#/$defs/Config", + "$id": "https://opencode.ai/config.json", + "type": "object", + "properties": { + "$schema": { + "type": "string", + "description": "JSON schema reference for configuration validation" + }, + "shell": { + "type": "string", + "description": "Default shell to use for terminal and bash tool" + }, + "model": { + "anyOf": [ + { + "anyOf": [ + { + "type": "string", + "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$" + }, + { + "type": "object", + "properties": { + "providerID": { + "type": "string", + "pattern": "^[^/#]+$" + }, + "model": { + "type": "string", + "pattern": "^[^#]+$" + }, + "variant": { + "type": "string", + "pattern": "^[^#]+$" + } + }, + "required": [ + "providerID", + "model" + ], + "additionalProperties": false + } + ] + }, + { + "type": "string", + "description": "Model to use in the format of provider/model, eg anthropic/claude-2", + "$ref": "https://models.dev/model-schema.json#/$defs/Model" + } + ] + }, + "default_agent": { + "type": "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." + }, + "update": { + "type": "string", + "enum": [ + "disable", + "notify", + "auto" + ] + }, + "share": { + "type": "string", + "enum": [ + "manual", + "auto", + "disabled" + ], + "description": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing" + }, + "enterprise": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Enterprise URL" + } + }, + "additionalProperties": false + }, + "username": { + "type": "string", + "description": "Custom username to display in conversations instead of system username" + }, + "permissions": { + "$ref": "#/$defs/Permission.Ruleset" + }, + "agents": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.AgentEncoded" + } + }, + "snapshots": { + "type": "boolean" + }, + "watcher": { + "type": "object", + "properties": { + "ignore": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "formatter": { + "anyOf": [ + { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.Formatter.EntryEncoded" + } + } + ] + }, + { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "disabled": { + "type": "boolean" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + ], + "description": "Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides." + } + ] + }, + "lsp": { + "anyOf": [ + { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "enum": [ + true + ] + } + }, + "required": [ + "disabled" + ], + "additionalProperties": false + }, + { + "$ref": "#/$defs/Config.LSP.ServerEncoded" + } + ] + } + } + ] + }, + { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "enum": [ + true + ] + } + }, + "required": [ + "disabled" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + }, + "disabled": { + "type": "boolean" + }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "initialization": { + "type": "object" + } + }, + "required": [ + "command" + ], + "additionalProperties": false + } + ] + } + } + ], + "description": "Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides." + } + ] + }, + "media": { + "type": "object", + "properties": { + "image": { + "type": "object", + "properties": { + "auto_resize": { + "type": "boolean" + }, + "max_width": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "max_height": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "max_base64_bytes": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "tool_output": { + "anyOf": [ + { + "type": "object", + "properties": { + "max_lines": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "max_bytes": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "max_lines": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum lines of tool output before it is truncated and saved to disk (default: 2000)" + }, + "max_bytes": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)" + } + }, + "additionalProperties": false, + "description": "Thresholds for truncating tool output. When output exceeds either limit, the full text is written to the truncation directory and a preview is returned." + } + ] + }, + "mcp": { + "description": "MCP (Model Context Protocol) server configurations", + "type": "object", + "properties": { + "timeout": { + "anyOf": [ + { + "type": "object", + "properties": { + "startup": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "catalog": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "execution": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + }, + { + "anyOf": [ + { + "anyOf": [ + { + "$ref": "#/$defs/V1.McpLocalConfig" + }, + { + "$ref": "#/$defs/V1.McpRemoteConfig" + } + ] + }, + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + ] + } + ] + }, + "servers": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/Mcp.LocalConfigEncoded" + }, + { + "$ref": "#/$defs/Mcp.RemoteConfigEncoded" + } + ] + } + }, + { + "anyOf": [ + { + "anyOf": [ + { + "$ref": "#/$defs/V1.McpLocalConfig" + }, + { + "$ref": "#/$defs/V1.McpRemoteConfig" + } + ] + }, + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + ] + } + ] + } + }, + "additionalProperties": { + "anyOf": [ + { + "anyOf": [ + { + "$ref": "#/$defs/V1.McpLocalConfig" + }, + { + "$ref": "#/$defs/V1.McpRemoteConfig" + } + ] + }, + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + ] + } + }, + "compaction": { + "type": "object", + "properties": { + "auto": { + "type": "boolean", + "description": "Enable automatic compaction when context is full (default: true)" + }, + "keep": { + "type": "object", + "properties": { + "tokens": { + "type": "integer", + "minimum": 0 + } + }, + "additionalProperties": false + }, + "buffer": { + "type": "integer", + "minimum": 0 + }, + "prune": { + "type": "boolean", + "description": "Enable pruning of old tool outputs (default: false)", + "deprecated": true + }, + "tail_turns": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction. By default retention is limited only by the preserved token budget.", + "deprecated": true + }, + "preserve_recent_tokens": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum number of tokens from recent turns to preserve verbatim after compaction", + "deprecated": true + }, + "reserved": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction.", + "deprecated": true + } + }, + "additionalProperties": false + }, + "skills": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "properties": { + "paths": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Additional paths to skill folders" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + }, + "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)" + } + }, + "additionalProperties": false, + "description": "Additional skill folder paths" + } + ] + }, + "commands": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.CommandEncoded" + } + }, + "instructions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Additional instruction files or patterns to include" + }, + "references": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/Config.Reference.GitEncoded" + }, + { + "$ref": "#/$defs/Config.Reference.LocalEncoded" + } + ] + } + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/V1.ConfigV2.Reference.Git" + }, + { + "$ref": "#/$defs/V1.ConfigV2.Reference.Local" + } + ] + }, + "description": "Named git or local directory references" + } + ] + }, + "websearch": { + "anyOf": [ + { + "type": "boolean", + "enum": [ + false + ] + }, + { + "$ref": "#/$defs/ConfigWebSearch.InfoEncoded" + } + ] + }, + "plugins": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/Config.Plugin.EntryEncoded" + } + ] + } + }, + "worktree": { + "$ref": "#/$defs/Config.Worktree" + }, + "warming": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/$defs/Config.WarmingEncoded" + } + ] + }, + "providers": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.ProviderEncoded" + } + }, + "experimental": { + "type": "object", + "properties": { + "portable_shell_scanner": { + "type": "boolean" + }, + "subagent_depth": { + "type": "integer", + "minimum": 0 + }, + "policies": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": [ + "provider.use", + "tool.use", + "integration.use" + ] + }, + "resource": { + "type": "string" + }, + "effect": { + "type": "string", + "enum": [ + "allow", + "deny" + ] + } + }, + "required": [ + "action", + "resource", + "effect" + ], + "additionalProperties": false + } + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/V1.ConfigV2.Experimental.Policy" + }, + "description": "Policy statements applied to supported resources, such as provider access" + } + ] + }, + "disable_paste_summary": { + "type": "boolean", + "deprecated": true + }, + "batch_tool": { + "type": "boolean", + "description": "Enable the batch tool", + "deprecated": true + }, + "openTelemetry": { + "type": "boolean", + "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)", + "deprecated": true + }, + "primary_tools": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Tools that should only be available to primary agents.", + "deprecated": true + }, + "continue_loop_on_deny": { + "type": "boolean", + "description": "Continue the agent loop when a tool call is denied", + "deprecated": true + }, + "mcp_timeout": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Timeout in milliseconds for model context protocol (MCP) requests", + "deprecated": true + } + }, + "additionalProperties": false + }, + "logLevel": { + "$ref": "#/$defs/V1.LogLevel", + "description": "Log level", + "deprecated": true + }, + "server": { + "$ref": "#/$defs/V1.ServerConfig", + "description": "Server configuration for opencode serve and web commands", + "deprecated": true + }, + "command": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "template": { + "type": "string" + }, + "description": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "model": { + "type": "string", + "$ref": "https://models.dev/model-schema.json#/$defs/Model" + }, + "variant": { + "type": "string" + }, + "subtask": { + "type": "boolean" + } + }, + "required": [ + "template" + ], + "additionalProperties": false + }, + "description": "Command configuration, see https://opencode.ai/docs/commands", + "deprecated": true + }, + "reference": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/V1.ConfigV2.Reference.Git" + }, + { + "$ref": "#/$defs/V1.ConfigV2.Reference.Local" + } + ] + }, + "description": "@deprecated Use 'references' field instead. Named git or local directory references", + "deprecated": true + }, + "snapshot": { + "type": "boolean", + "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.", + "deprecated": true + }, + "plugin": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "prefixItems": [ + { + "type": "string" + }, + { + "type": "object" + } + ], + "maxItems": 2, + "minItems": 2 + } + ] + }, + "deprecated": true + }, + "autoshare": { + "type": "boolean", + "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically", + "deprecated": true + }, + "autoupdate": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": [ + "notify" + ] + } + ], + "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications", + "deprecated": true + }, + "disabled_providers": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Disable providers that are loaded automatically", + "deprecated": true + }, + "enabled_providers": { + "type": "array", + "items": { + "type": "string" + }, + "description": "When set, ONLY these providers will be enabled. All other providers will be ignored", + "deprecated": true + }, + "small_model": { + "type": "string", + "description": "Small model to use for tasks like title generation in the format of provider/model", + "$ref": "https://models.dev/model-schema.json#/$defs/Model", + "deprecated": true + }, + "subagent_depth": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum subagent nesting depth. Defaults to 1, which prevents subagents from launching subagents.", + "deprecated": true + }, + "mode": { + "type": "object", + "properties": { + "build": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "plan": { + "$ref": "#/$defs/V1.AgentConfig" + } + }, + "additionalProperties": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "description": "@deprecated Use `agent` field instead.", + "deprecated": true + }, + "agent": { + "type": "object", + "properties": { + "plan": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "build": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "general": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "explore": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "title": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "summary": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "compaction": { + "$ref": "#/$defs/V1.AgentConfig" + } + }, + "additionalProperties": { + "$ref": "#/$defs/V1.AgentConfig" + }, + "description": "Agent configuration, see https://opencode.ai/docs/agents", + "deprecated": true + }, + "provider": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/V1.ProviderConfig" + }, + "description": "Custom provider configurations and model overrides", + "deprecated": true + }, + "layout": { + "$ref": "#/$defs/V1.LayoutConfig", + "description": "@deprecated Always uses stretch layout.", + "deprecated": true + }, + "permission": { + "$ref": "#/$defs/V1.PermissionConfig", + "deprecated": true + }, + "tools": { + "type": "object", + "additionalProperties": { + "type": "boolean" + }, + "deprecated": true + }, + "attachment": { + "$ref": "#/$defs/V1.AttachmentConfig", + "description": "Attachment processing configuration, including image size limits and resizing behavior", + "deprecated": true + } + }, + "additionalProperties": false, "$defs": { - "LogLevel": { + "Permission.Effect": { + "type": "string", + "enum": [ + "allow", + "deny", + "ask" + ] + }, + "Permission.Rule": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "resource": { + "type": "string" + }, + "effect": { + "$ref": "#/$defs/Permission.Effect" + } + }, + "required": [ + "action", + "resource", + "effect" + ], + "additionalProperties": false + }, + "Permission.Ruleset": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission.Rule" + } + }, + "Config.AgentEncoded": { + "type": "object", + "properties": { + "model": { + "anyOf": [ + { + "type": "string", + "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$" + }, + { + "type": "object", + "properties": { + "providerID": { + "type": "string", + "pattern": "^[^/#]+$" + }, + "model": { + "type": "string", + "pattern": "^[^#]+$" + }, + "variant": { + "type": "string", + "pattern": "^[^#]+$" + } + }, + "required": [ + "providerID", + "model" + ], + "additionalProperties": false + } + ] + }, + "request": { + "type": "object", + "properties": { + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "body": { + "type": "object" + } + }, + "additionalProperties": false + }, + "system": { + "type": "string" + }, + "description": { + "type": "string" + }, + "mode": { + "type": "string", + "enum": [ + "subagent", + "primary", + "all" + ] + }, + "hidden": { + "type": "boolean" + }, + "color": { + "type": "string", + "pattern": "^#[0-9a-fA-F]{6}$" + }, + "steps": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "disabled": { + "type": "boolean" + }, + "permissions": { + "$ref": "#/$defs/Permission.Ruleset" + } + }, + "additionalProperties": false + }, + "Config.Formatter.EntryEncoded": { + "type": "object", + "properties": { + "disabled": { + "type": "boolean" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "Config.LSP.ServerEncoded": { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + }, + "disabled": { + "type": "boolean" + }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "initialization": { + "type": "object" + } + }, + "required": [ + "command" + ], + "additionalProperties": false + }, + "Mcp.Protocol": { + "type": "string", + "enum": [ + "legacy", + "auto", + "2026-07-28" + ], + "description": "MCP protocol negotiation. \"legacy\" (default) opens with the initialize handshake and speaks protocol revisions up to 2025-11-25. \"auto\" probes for the 2026-07-28 revision and falls back to legacy when the server does not support it. \"2026-07-28\" requires that revision and fails otherwise." + }, + "Mcp.LocalConfigEncoded": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "local" + ] + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "cwd": { + "type": "string" + }, + "environment": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "disabled": { + "type": "boolean" + }, + "codemode": { + "type": "boolean" + }, + "timeout": { + "type": "object", + "properties": { + "startup": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "catalog": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "execution": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + }, + "protocol": { + "$ref": "#/$defs/Mcp.Protocol" + } + }, + "required": [ + "type", + "command" + ], + "additionalProperties": false + }, + "Mcp.OAuthConfigEncoded": { + "type": "object", + "properties": { + "client_id": { + "type": "string" + }, + "client_secret": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "callback_port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "redirect_uri": { + "type": "string" + }, + "auth_server_metadata_url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Mcp.RemoteConfigEncoded": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "remote" + ] + }, + "url": { + "type": "string" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "oauth": { + "anyOf": [ + { + "$ref": "#/$defs/Mcp.OAuthConfigEncoded" + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ] + }, + "disabled": { + "type": "boolean" + }, + "codemode": { + "type": "boolean" + }, + "timeout": { + "type": "object", + "properties": { + "startup": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "catalog": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "execution": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + }, + "protocol": { + "$ref": "#/$defs/Mcp.Protocol" + } + }, + "required": [ + "type", + "url" + ], + "additionalProperties": false + }, + "Config.CommandEncoded": { + "type": "object", + "properties": { + "template": { + "type": "string" + }, + "description": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "model": { + "anyOf": [ + { + "type": "string", + "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$" + }, + { + "type": "object", + "properties": { + "providerID": { + "type": "string", + "pattern": "^[^/#]+$" + }, + "model": { + "type": "string", + "pattern": "^[^#]+$" + }, + "variant": { + "type": "string", + "pattern": "^[^#]+$" + } + }, + "required": [ + "providerID", + "model" + ], + "additionalProperties": false + } + ] + }, + "subagent": { + "type": "boolean" + }, + "subtask": { + "type": "boolean", + "description": "Deprecated alias for subagent." + } + }, + "required": [ + "template" + ], + "additionalProperties": false + }, + "Config.Reference.GitEncoded": { + "type": "object", + "properties": { + "repository": { + "type": "string" + }, + "branch": { + "type": "string" + }, + "description": { + "type": "string" + }, + "hidden": { + "type": "boolean" + } + }, + "required": [ + "repository" + ], + "additionalProperties": false + }, + "Config.Reference.LocalEncoded": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "description": { + "type": "string" + }, + "hidden": { + "type": "boolean" + } + }, + "required": [ + "path" + ], + "additionalProperties": false + }, + "WebSearch.ID": { + "type": "string" + }, + "ConfigWebSearch.InfoEncoded": { + "type": "object", + "properties": { + "provider": { + "anyOf": [ + { + "type": "string", + "enum": [ + "random" + ], + "description": "Reuse a randomly selected provider until it is rate limited, then switch to another available provider." + }, + { + "$ref": "#/$defs/WebSearch.ID" + } + ] + } + }, + "required": [ + "provider" + ], + "additionalProperties": false + }, + "Config.Plugin.EntryEncoded": { + "type": "object", + "properties": { + "package": { + "type": "string" + }, + "options": { + "type": "object" + } + }, + "required": [ + "package" + ], + "additionalProperties": false + }, + "Config.Worktree": { + "type": "object", + "properties": { + "directory": { + "type": "string" + } + }, + "required": [ + "directory" + ], + "additionalProperties": false + }, + "Config.WarmingEncoded": { + "type": "object", + "properties": { + "prompt": { + "type": "string" + }, + "interval": { + "type": "string" + }, + "duration": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Provider.ID": { + "type": "string" + }, + "Provider.Compaction": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "summary" + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "native" + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + } + ] + }, + "Provider.Transport": { + "type": "string", + "enum": [ + "http", + "websocket" + ] + }, + "Config.Provider.Settings": { + "type": "object", + "properties": { + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ] + }, + "headerTimeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ] + }, + "chunkTimeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ] + }, + "compaction": { + "$ref": "#/$defs/Provider.Compaction" + }, + "transport": { + "$ref": "#/$defs/Provider.Transport" + } + }, + "allOf": [ + { + "type": "object", + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + } + } + ] + }, + "Model.ReasoningField": { + "anyOf": [ + { + "type": "string", + "enum": [ + "reasoning", + "reasoning_content", + "reasoning_text" + ] + }, + { + "type": "string" + } + ] + }, + "Model.MaxTokensField": { + "type": "string", + "enum": [ + "max_completion_tokens", + "max_tokens" + ] + }, + "Model.Compatibility": { + "type": "object", + "properties": { + "reasoningField": { + "$ref": "#/$defs/Model.ReasoningField" + }, + "requireReasoning": { + "type": "boolean" + }, + "maxTokensField": { + "$ref": "#/$defs/Model.MaxTokensField" + }, + "requireFinishReason": { + "type": "boolean" + }, + "requireAssistantAfterTool": { + "type": "boolean" + }, + "supportsPromptCacheKey": { + "type": "boolean" + }, + "supportsThinkingBlockBinding": { + "type": "boolean" + }, + "supportsEffortUpdates": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "Config.Model.Settings": { + "type": "object", + "properties": { + "compaction": { + "$ref": "#/$defs/Provider.Compaction" + } + }, + "allOf": [ + { + "type": "object", + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + } + } + ] + }, + "Config.Model.Capabilities": { + "type": "object", + "properties": { + "tools": { + "type": "boolean" + }, + "input": { + "type": "array", + "items": { + "type": "string" + } + }, + "output": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "Money.USDPerMillionTokens": { + "type": "number" + }, + "Config.Model.CostEncoded": { + "type": "object", + "properties": { + "tier": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "context" + ] + }, + "size": { + "type": "integer" + } + }, + "required": [ + "type", + "size" + ], + "additionalProperties": false + }, + "input": { + "$ref": "#/$defs/Money.USDPerMillionTokens" + }, + "output": { + "$ref": "#/$defs/Money.USDPerMillionTokens" + }, + "cache": { + "type": "object", + "properties": { + "read": { + "$ref": "#/$defs/Money.USDPerMillionTokens" + }, + "write": { + "$ref": "#/$defs/Money.USDPerMillionTokens" + } + }, + "additionalProperties": false + } + }, + "required": [ + "input", + "output" + ], + "additionalProperties": false + }, + "Config.ModelEncoded": { + "type": "object", + "properties": { + "modelID": { + "type": "string" + }, + "family": { + "type": "string" + }, + "name": { + "type": "string" + }, + "compatibility": { + "$ref": "#/$defs/Model.Compatibility" + }, + "package": { + "type": "string" + }, + "settings": { + "$ref": "#/$defs/Config.Model.Settings" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "body": { + "type": "object" + }, + "capabilities": { + "$ref": "#/$defs/Config.Model.Capabilities" + }, + "variants": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "settings": { + "$ref": "#/$defs/Config.Model.Settings" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "body": { + "type": "object" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "cost": { + "anyOf": [ + { + "$ref": "#/$defs/Config.Model.CostEncoded" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/Config.Model.CostEncoded" + } + } + ] + }, + "disabled": { + "type": "boolean" + }, + "limit": { + "type": "object", + "properties": { + "context": { + "type": "integer" + }, + "input": { + "type": "integer" + }, + "output": { + "type": "integer" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "Config.ProviderEncoded": { + "type": "object", + "properties": { + "canonical": { + "$ref": "#/$defs/Provider.ID" + }, + "name": { + "type": "string" + }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, + "package": { + "type": "string" + }, + "settings": { + "$ref": "#/$defs/Config.Provider.Settings" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "body": { + "type": "object" + }, + "models": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.ModelEncoded" + } + } + }, + "additionalProperties": false + }, + "Config.InfoEncoded": { + "type": "object", + "properties": { + "$schema": { + "type": "string" + }, + "shell": { + "type": "string" + }, + "model": { + "anyOf": [ + { + "type": "string", + "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$" + }, + { + "type": "object", + "properties": { + "providerID": { + "type": "string", + "pattern": "^[^/#]+$" + }, + "model": { + "type": "string", + "pattern": "^[^#]+$" + }, + "variant": { + "type": "string", + "pattern": "^[^#]+$" + } + }, + "required": [ + "providerID", + "model" + ], + "additionalProperties": false + } + ] + }, + "default_agent": { + "type": "string" + }, + "update": { + "type": "string", + "enum": [ + "disable", + "notify", + "auto" + ] + }, + "share": { + "type": "string", + "enum": [ + "manual", + "auto", + "disabled" + ] + }, + "enterprise": { + "type": "object", + "properties": { + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "username": { + "type": "string" + }, + "permissions": { + "$ref": "#/$defs/Permission.Ruleset" + }, + "agents": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.AgentEncoded" + } + }, + "snapshots": { + "type": "boolean" + }, + "watcher": { + "type": "object", + "properties": { + "ignore": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "formatter": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.Formatter.EntryEncoded" + } + } + ] + }, + "lsp": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "enum": [ + true + ] + } + }, + "required": [ + "disabled" + ], + "additionalProperties": false + }, + { + "$ref": "#/$defs/Config.LSP.ServerEncoded" + } + ] + } + } + ] + }, + "media": { + "type": "object", + "properties": { + "image": { + "type": "object", + "properties": { + "auto_resize": { + "type": "boolean" + }, + "max_width": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "max_height": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "max_base64_bytes": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "tool_output": { + "type": "object", + "properties": { + "max_lines": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "max_bytes": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + }, + "mcp": { + "type": "object", + "properties": { + "timeout": { + "type": "object", + "properties": { + "startup": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "catalog": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "execution": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "additionalProperties": false + }, + "servers": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/Mcp.LocalConfigEncoded" + }, + { + "$ref": "#/$defs/Mcp.RemoteConfigEncoded" + } + ] + } + } + }, + "additionalProperties": false + }, + "compaction": { + "type": "object", + "properties": { + "auto": { + "type": "boolean" + }, + "keep": { + "type": "object", + "properties": { + "tokens": { + "type": "integer", + "minimum": 0 + } + }, + "additionalProperties": false + }, + "buffer": { + "type": "integer", + "minimum": 0 + } + }, + "additionalProperties": false + }, + "skills": { + "type": "array", + "items": { + "type": "string" + } + }, + "commands": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.CommandEncoded" + } + }, + "instructions": { + "type": "array", + "items": { + "type": "string" + } + }, + "references": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/Config.Reference.GitEncoded" + }, + { + "$ref": "#/$defs/Config.Reference.LocalEncoded" + } + ] + } + }, + "websearch": { + "anyOf": [ + { + "type": "boolean", + "enum": [ + false + ] + }, + { + "$ref": "#/$defs/ConfigWebSearch.InfoEncoded" + } + ] + }, + "plugins": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/Config.Plugin.EntryEncoded" + } + ] + } + }, + "worktree": { + "$ref": "#/$defs/Config.Worktree" + }, + "warming": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/$defs/Config.WarmingEncoded" + } + ] + }, + "providers": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/Config.ProviderEncoded" + } + }, + "experimental": { + "type": "object", + "properties": { + "portable_shell_scanner": { + "type": "boolean" + }, + "subagent_depth": { + "type": "integer", + "minimum": 0 + }, + "policies": { + "type": "array", + "items": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": [ + "provider.use", + "tool.use", + "integration.use" + ] + }, + "resource": { + "type": "string" + }, + "effect": { + "type": "string", + "enum": [ + "allow", + "deny" + ] + } + }, + "required": [ + "action", + "resource", + "effect" + ], + "additionalProperties": false + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "V1.LogLevel": { "type": "string", "enum": [ "DEBUG", @@ -12,7 +2191,7 @@ ], "description": "Log level" }, - "ServerConfig": { + "V1.ServerConfig": { "type": "object", "properties": { "port": { @@ -43,7 +2222,7 @@ }, "additionalProperties": false }, - "ConfigV2.Reference.Git": { + "V1.ConfigV2.Reference.Git": { "type": "object", "properties": { "repository": { @@ -64,7 +2243,7 @@ ], "additionalProperties": false }, - "ConfigV2.Reference.Local": { + "V1.ConfigV2.Reference.Local": { "type": "object", "properties": { "path": { @@ -82,7 +2261,7 @@ ], "additionalProperties": false }, - "PermissionActionConfig": { + "V1.PermissionActionConfig": { "type": "string", "enum": [ "ask", @@ -90,83 +2269,83 @@ "deny" ] }, - "PermissionObjectConfig": { + "V1.PermissionObjectConfig": { "type": "object", "additionalProperties": { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" } }, - "PermissionRuleConfig": { + "V1.PermissionRuleConfig": { "anyOf": [ { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, { - "$ref": "#/$defs/PermissionObjectConfig" + "$ref": "#/$defs/V1.PermissionObjectConfig" } ] }, - "PermissionConfig": { + "V1.PermissionConfig": { "anyOf": [ { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, { "type": "object", "properties": { "read": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "edit": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "glob": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "grep": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "list": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "bash": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "task": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "external_directory": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "todowrite": { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, "question": { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, "webfetch": { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, "websearch": { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, "lsp": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" }, "doom_loop": { - "$ref": "#/$defs/PermissionActionConfig" + "$ref": "#/$defs/V1.PermissionActionConfig" }, "skill": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" } }, "additionalProperties": { - "$ref": "#/$defs/PermissionRuleConfig" + "$ref": "#/$defs/V1.PermissionRuleConfig" } } ] }, - "AgentConfig": { + "V1.AgentConfig": { "type": "object", "properties": { "model": { @@ -249,11 +2428,11 @@ "description": "@deprecated Use 'steps' field instead." }, "permission": { - "$ref": "#/$defs/PermissionConfig" + "$ref": "#/$defs/V1.PermissionConfig" } } }, - "ProviderConfig": { + "V1.ProviderConfig": { "type": "object", "properties": { "api": { @@ -576,7 +2755,7 @@ }, "additionalProperties": false }, - "McpLocalConfig": { + "V1.McpLocalConfig": { "type": "object", "properties": { "type": { @@ -621,7 +2800,7 @@ ], "additionalProperties": false }, - "McpOAuthConfig": { + "V1.McpOAuthConfig": { "type": "object", "properties": { "clientId": { @@ -649,7 +2828,7 @@ }, "additionalProperties": false }, - "McpRemoteConfig": { + "V1.McpRemoteConfig": { "type": "object", "properties": { "type": { @@ -677,7 +2856,7 @@ "oauth": { "anyOf": [ { - "$ref": "#/$defs/McpOAuthConfig" + "$ref": "#/$defs/V1.McpOAuthConfig" }, { "type": "boolean", @@ -701,14 +2880,14 @@ ], "additionalProperties": false }, - "LayoutConfig": { + "V1.LayoutConfig": { "type": "string", "enum": [ "auto", "stretch" ] }, - "ImageAttachmentConfig": { + "V1.ImageAttachmentConfig": { "type": "object", "properties": { "auto_resize": { @@ -736,24 +2915,24 @@ }, "additionalProperties": false }, - "AttachmentConfig": { + "V1.AttachmentConfig": { "type": "object", "properties": { "image": { - "$ref": "#/$defs/ImageAttachmentConfig", + "$ref": "#/$defs/V1.ImageAttachmentConfig", "description": "Image attachment configuration" } }, "additionalProperties": false }, - "Policy.Effect": { + "V1.Policy.Effect": { "type": "string", "enum": [ "allow", "deny" ] }, - "ConfigV2.Experimental.Policy": { + "V1.ConfigV2.Experimental.Policy": { "type": "object", "properties": { "action": { @@ -771,7 +2950,7 @@ ] }, "effect": { - "$ref": "#/$defs/Policy.Effect" + "$ref": "#/$defs/V1.Policy.Effect" }, "resource": { "type": "string" @@ -783,530 +2962,8 @@ "resource" ], "additionalProperties": false - }, - "Config": { - "type": "object", - "properties": { - "$schema": { - "type": "string", - "description": "JSON schema reference for configuration validation" - }, - "shell": { - "type": "string", - "description": "Default shell to use for terminal and bash tool" - }, - "logLevel": { - "$ref": "#/$defs/LogLevel", - "description": "Log level" - }, - "server": { - "$ref": "#/$defs/ServerConfig", - "description": "Server configuration for opencode serve and web commands" - }, - "command": { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": { - "template": { - "type": "string" - }, - "description": { - "type": "string" - }, - "agent": { - "type": "string" - }, - "model": { - "type": "string", - "$ref": "https://models.dev/model-schema.json#/$defs/Model" - }, - "variant": { - "type": "string" - }, - "subtask": { - "type": "boolean" - } - }, - "required": [ - "template" - ], - "additionalProperties": false - }, - "description": "Command configuration, see https://opencode.ai/docs/commands" - }, - "skills": { - "type": "object", - "properties": { - "paths": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Additional paths to skill folders" - }, - "urls": { - "type": "array", - "items": { - "type": "string" - }, - "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)" - } - }, - "additionalProperties": false, - "description": "Additional skill folder paths" - }, - "references": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/$defs/ConfigV2.Reference.Git" - }, - { - "$ref": "#/$defs/ConfigV2.Reference.Local" - } - ] - }, - "description": "Named git or local directory references" - }, - "reference": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/$defs/ConfigV2.Reference.Git" - }, - { - "$ref": "#/$defs/ConfigV2.Reference.Local" - } - ] - }, - "description": "@deprecated Use 'references' field instead. Named git or local directory references" - }, - "watcher": { - "type": "object", - "properties": { - "ignore": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, - "snapshot": { - "type": "boolean", - "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." - }, - "plugin": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "prefixItems": [ - { - "type": "string" - }, - { - "type": "object" - } - ], - "maxItems": 2, - "minItems": 2 - } - ] - } - }, - "share": { - "type": "string", - "enum": [ - "manual", - "auto", - "disabled" - ], - "description": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing" - }, - "autoshare": { - "type": "boolean", - "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically" - }, - "autoupdate": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string", - "enum": [ - "notify" - ] - } - ], - "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications" - }, - "disabled_providers": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Disable providers that are loaded automatically" - }, - "enabled_providers": { - "type": "array", - "items": { - "type": "string" - }, - "description": "When set, ONLY these providers will be enabled. All other providers will be ignored" - }, - "model": { - "type": "string", - "description": "Model to use in the format of provider/model, eg anthropic/claude-2", - "$ref": "https://models.dev/model-schema.json#/$defs/Model" - }, - "small_model": { - "type": "string", - "description": "Small model to use for tasks like title generation in the format of provider/model", - "$ref": "https://models.dev/model-schema.json#/$defs/Model" - }, - "default_agent": { - "type": "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." - }, - "subagent_depth": { - "minimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Maximum subagent nesting depth. Defaults to 1, which prevents subagents from launching subagents." - }, - "username": { - "type": "string", - "description": "Custom username to display in conversations instead of system username" - }, - "mode": { - "type": "object", - "properties": { - "build": { - "$ref": "#/$defs/AgentConfig" - }, - "plan": { - "$ref": "#/$defs/AgentConfig" - } - }, - "additionalProperties": { - "$ref": "#/$defs/AgentConfig" - }, - "description": "@deprecated Use `agent` field instead." - }, - "agent": { - "type": "object", - "properties": { - "plan": { - "$ref": "#/$defs/AgentConfig" - }, - "build": { - "$ref": "#/$defs/AgentConfig" - }, - "general": { - "$ref": "#/$defs/AgentConfig" - }, - "explore": { - "$ref": "#/$defs/AgentConfig" - }, - "title": { - "$ref": "#/$defs/AgentConfig" - }, - "summary": { - "$ref": "#/$defs/AgentConfig" - }, - "compaction": { - "$ref": "#/$defs/AgentConfig" - } - }, - "additionalProperties": { - "$ref": "#/$defs/AgentConfig" - }, - "description": "Agent configuration, see https://opencode.ai/docs/agents" - }, - "provider": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/ProviderConfig" - }, - "description": "Custom provider configurations and model overrides" - }, - "mcp": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "anyOf": [ - { - "$ref": "#/$defs/McpLocalConfig" - }, - { - "$ref": "#/$defs/McpRemoteConfig" - } - ] - }, - { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - } - }, - "required": [ - "enabled" - ], - "additionalProperties": false - } - ] - }, - "description": "MCP (Model Context Protocol) server configurations" - }, - "formatter": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": { - "disabled": { - "type": "boolean" - }, - "command": { - "type": "array", - "items": { - "type": "string" - } - }, - "environment": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "extensions": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - } - } - ], - "description": "Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides." - }, - "lsp": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "type": "object", - "properties": { - "disabled": { - "type": "boolean", - "enum": [ - true - ] - } - }, - "required": [ - "disabled" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "command": { - "type": "array", - "items": { - "type": "string" - } - }, - "extensions": { - "type": "array", - "items": { - "type": "string" - } - }, - "disabled": { - "type": "boolean" - }, - "env": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "initialization": { - "type": "object" - } - }, - "required": [ - "command" - ], - "additionalProperties": false - } - ] - } - } - ], - "description": "Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides." - }, - "instructions": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Additional instruction files or patterns to include" - }, - "layout": { - "$ref": "#/$defs/LayoutConfig", - "description": "@deprecated Always uses stretch layout." - }, - "permission": { - "$ref": "#/$defs/PermissionConfig" - }, - "tools": { - "type": "object", - "additionalProperties": { - "type": "boolean" - } - }, - "attachment": { - "$ref": "#/$defs/AttachmentConfig", - "description": "Attachment processing configuration, including image size limits and resizing behavior" - }, - "enterprise": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "Enterprise URL" - } - }, - "additionalProperties": false - }, - "tool_output": { - "type": "object", - "properties": { - "max_lines": { - "exclusiveMinimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Maximum lines of tool output before it is truncated and saved to disk (default: 2000)" - }, - "max_bytes": { - "exclusiveMinimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)" - } - }, - "additionalProperties": false, - "description": "Thresholds for truncating tool output. When output exceeds either limit, the full text is written to the truncation directory and a preview is returned." - }, - "compaction": { - "type": "object", - "properties": { - "auto": { - "type": "boolean", - "description": "Enable automatic compaction when context is full (default: true)" - }, - "prune": { - "type": "boolean", - "description": "Enable pruning of old tool outputs (default: false)" - }, - "tail_turns": { - "minimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Maximum number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction. By default retention is limited only by the preserved token budget." - }, - "preserve_recent_tokens": { - "minimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Maximum number of tokens from recent turns to preserve verbatim after compaction" - }, - "reserved": { - "minimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction." - } - }, - "additionalProperties": false - }, - "experimental": { - "type": "object", - "properties": { - "disable_paste_summary": { - "type": "boolean" - }, - "batch_tool": { - "type": "boolean", - "description": "Enable the batch tool" - }, - "openTelemetry": { - "type": "boolean", - "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)" - }, - "primary_tools": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Tools that should only be available to primary agents." - }, - "continue_loop_on_deny": { - "type": "boolean", - "description": "Continue the agent loop when a tool call is denied" - }, - "mcp_timeout": { - "exclusiveMinimum": 0, - "type": "integer", - "maximum": 9007199254740991, - "description": "Timeout in milliseconds for model context protocol (MCP) requests" - }, - "policies": { - "type": "array", - "items": { - "$ref": "#/$defs/ConfigV2.Experimental.Policy" - }, - "description": "Policy statements applied to supported resources, such as provider access" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false } }, "allowComments": true, "allowTrailingCommas": true -} \ No newline at end of file +} diff --git a/packages/core/src/plugin/skill/opencode.md b/packages/core/src/plugin/skill/opencode.md index 50bcd2c09d4..01cba471e4f 100644 --- a/packages/core/src/plugin/skill/opencode.md +++ b/packages/core/src/plugin/skill/opencode.md @@ -22,11 +22,12 @@ legacy OpenCode, or migrating from V1. Use only documentation as the source of truth for V2. Do not use , which documents V1, and do not use general web search to resolve a V2 documentation question when the V2 docs or -linked pages cover it. The schema served from - may describe V1 even though V2 configuration -files include that URL for editor integration. Never use it to infer V2 field -names or shapes. If V2 documentation is missing or contradictory, state the -uncertainty or ask for clarification instead of falling back to V1. +linked pages cover it. The native V2 schema is +. The schema at + also accepts V1 fields for compatibility, so +do not use it to infer V2 field names or shapes. If V2 documentation is missing +or contradictory, state the uncertainty or ask for clarification instead of +falling back to V1. V1 documentation and syntax may be consulted only when the user explicitly asks about V1 or when needed as migration input. Outputs and recommendations @@ -74,7 +75,7 @@ autocomplete: ```jsonc { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", } ``` @@ -101,8 +102,9 @@ preferences, especially themes and keybindings. Do not guess field names or shapes. Fetch the V2 configuration guide and its linked topic guide as the source of truth, and preserve unrelated settings when -editing an existing file. Keep the published `$schema` URL in configuration -examples, but do not fetch it to determine the V2 configuration shape. +editing an existing file. Use the V2 `$schema` URL for native V2 examples; +leave `https://opencode.ai/config.json` in existing files that still use V1 +syntax. See the [full configuration guide](https://opencode.ai/v2/docs/config) for every field, examples, config locations, and links to dedicated feature guides. @@ -145,8 +147,9 @@ V1 config files and `.opencode/` definitions are intended to remain compatible. The only intentional breaking changes are the server API and plugin API. Native V2 config uses more ergonomic shapes, but conversion is optional. When the user requests conversion, inspect the complete configuration, preserve behavior and -unrelated settings, and apply only the relevant migrations from the guide. For -plugin migrations, fetch and follow both the migration guide and the full +unrelated settings, and apply only the relevant migrations from the guide. Update +`$schema` to `https://opencode.ai/v2/config.json` when a file is fully converted. +For plugin migrations, fetch and follow both the migration guide and the full [plugins guide](https://opencode.ai/v2/docs/build/plugins). If non-API V1 functionality fails in V2, use the `report` skill to file it as a compatibility bug. diff --git a/packages/schema/script/config-schema.ts b/packages/schema/script/config-schema.ts new file mode 100644 index 00000000000..6bbfd3a9c84 --- /dev/null +++ b/packages/schema/script/config-schema.ts @@ -0,0 +1,139 @@ +import { isDeepStrictEqual, parseArgs } from "node:util" +import { Schema } from "effect" +import { Config } from "../src/config.js" + +// Generates the JSON schemas for `opencode.json`: +// - `--v2`: the strict schema generated from `Config.Info`, served at https://opencode.ai/v2/config.json. +// - `--compat`: the schema served at https://opencode.ai/config.json. Core still loads V1 configs and configs that +// mix V1 and V2 keys, so this schema accepts both. V1 keys come from `config-v1.json`, a frozen snapshot of the +// last V1 schema, and keys only V1 accepts are marked deprecated. +const args = parseArgs({ + options: { v2: { type: "string" }, compat: { type: "string" }, check: { type: "boolean" } }, +}).values +if (!args.v2 && !args.compat) throw new Error("Pass --v2 and/or --compat output paths") + +type Json = { [key: string]: unknown } +interface ObjectSchema { + description?: string + properties?: Record + required?: string[] + additionalProperties?: boolean | Json +} + +// Core merges V1 and V2 members inside these objects; every other value must be entirely V1 or entirely V2. +// See `packages/core/src/config/normalize.ts` and the "Migrate from V1" guide. +const mixedObjects = new Set(["mcp", "compaction", "experimental"]) + +const generated = Schema.toJsonSchemaDocument(Config.Info, { onExcessProperty: "error" }) +const v1: { $defs: Record } = await Bun.file(new URL("./config-v1.json", import.meta.url)).json() + +const v2 = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://opencode.ai/v2/config.json", + ...generated.schema, + $defs: generated.definitions, + allowComments: true, + allowTrailingCommas: true, +} + +const compat = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://opencode.ai/config.json", + ...mergeObjects( + generated.definitions[definitionName(String(generated.schema.$ref))] as ObjectSchema, + prefixV1Refs(v1.$defs.Config) as ObjectSchema, + (key) => mixedObjects.has(key), + ), + $defs: { + ...generated.definitions, + ...Object.fromEntries( + Object.entries(v1.$defs) + .filter(([name]) => name !== "Config") + .map(([name, schema]) => [v1Definition(name), prefixV1Refs(schema)]), + ), + }, + allowComments: true, + allowTrailingCommas: true, +} + +const outputs = [ + ...(args.v2 ? [{ path: args.v2, document: v2 }] : []), + ...(args.compat ? [{ path: args.compat, document: compat }] : []), +].map((output) => ({ path: output.path, content: `${JSON.stringify(output.document, null, 2)}\n` })) + +if (args.check) { + const stale = await Promise.all( + outputs.map(async (output) => (await Bun.file(output.path).text()) !== output.content), + ) + if (stale.some(Boolean)) { + console.error("Generated config schemas are stale. Run `bun run generate` from services/www.") + process.exit(1) + } + process.exit(0) +} + +await Promise.all(outputs.map((output) => Bun.write(output.path, output.content))) + +// Merges a V2 object schema with its V1 counterpart. A member declared by only one version is checked against the +// other version's `additionalProperties` schema as well, so V1 records such as `mcp` still accept their entries. +// Members only V1 accepts are marked deprecated; members whose shapes differ accept either shape. +function mergeObjects(current: ObjectSchema, legacy: ObjectSchema, mixed: (key: string) => boolean): ObjectSchema { + const currentExtra = extraProperties(current) + const legacyExtra = extraProperties(legacy) + const keys = new Set([...Object.keys(current.properties ?? {}), ...Object.keys(legacy.properties ?? {})]) + const required = (current.required ?? []).filter((key) => legacy.required?.includes(key)) + return { + ...(legacy.description ? { description: legacy.description } : {}), + type: "object", + properties: Object.fromEntries( + [...keys].map((key) => { + const next = current.properties?.[key] ?? currentExtra + const prev = legacy.properties?.[key] ?? legacyExtra + if (!next) return [key, { ...prev, deprecated: true }] + if (!prev) return [key, next] + // Prefer the V1 copy of an identical shape because it carries descriptions. + if (isDeepStrictEqual(withoutDescriptions(prev), withoutDescriptions(next))) return [key, prev] + if (mixed(key)) return [key, mergeObjects(next, prev, () => false)] + return [key, { anyOf: [next, prev] }] + }), + ), + ...(required.length ? { required } : {}), + additionalProperties: + currentExtra && legacyExtra ? { anyOf: [currentExtra, legacyExtra] } : (currentExtra ?? legacyExtra ?? false), + } as ObjectSchema +} + +function extraProperties(schema: ObjectSchema) { + return typeof schema.additionalProperties === "object" ? schema.additionalProperties : undefined +} + +function definitionName(ref: string) { + return ref.slice("#/$defs/".length) +} + +// V1 definitions are namespaced so they cannot collide with V2 definitions. +function v1Definition(name: string) { + return `V1.${name}` +} + +function prefixV1Refs(value: unknown): unknown { + if (Array.isArray(value)) return value.map(prefixV1Refs) + if (!value || typeof value !== "object") return value + return Object.fromEntries( + Object.entries(value).map(([key, item]) => + key === "$ref" && typeof item === "string" && item.startsWith("#/$defs/") + ? [key, `#/$defs/${v1Definition(definitionName(item))}`] + : [key, prefixV1Refs(item)], + ), + ) +} + +function withoutDescriptions(value: unknown): unknown { + if (Array.isArray(value)) return value.map(withoutDescriptions) + if (!value || typeof value !== "object") return value + return Object.fromEntries( + Object.entries(value) + .filter(([key]) => key !== "description") + .map(([key, item]) => [key, withoutDescriptions(item)]), + ) +} diff --git a/packages/schema/script/config-v1.json b/packages/schema/script/config-v1.json new file mode 100644 index 00000000000..29540479a29 --- /dev/null +++ b/packages/schema/script/config-v1.json @@ -0,0 +1,1312 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/Config", + "$defs": { + "LogLevel": { + "type": "string", + "enum": [ + "DEBUG", + "INFO", + "WARN", + "ERROR" + ], + "description": "Log level" + }, + "ServerConfig": { + "type": "object", + "properties": { + "port": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Port to listen on" + }, + "hostname": { + "type": "string", + "description": "Hostname to listen on" + }, + "mdns": { + "type": "boolean", + "description": "Enable mDNS service discovery" + }, + "mdnsDomain": { + "type": "string", + "description": "Custom domain name for mDNS service (default: opencode.local)" + }, + "cors": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Additional domains to allow for CORS" + } + }, + "additionalProperties": false + }, + "ConfigV2.Reference.Git": { + "type": "object", + "properties": { + "repository": { + "type": "string" + }, + "branch": { + "type": "string" + }, + "description": { + "type": "string" + }, + "hidden": { + "type": "boolean" + } + }, + "required": [ + "repository" + ], + "additionalProperties": false + }, + "ConfigV2.Reference.Local": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "description": { + "type": "string" + }, + "hidden": { + "type": "boolean" + } + }, + "required": [ + "path" + ], + "additionalProperties": false + }, + "PermissionActionConfig": { + "type": "string", + "enum": [ + "ask", + "allow", + "deny" + ] + }, + "PermissionObjectConfig": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/PermissionActionConfig" + } + }, + "PermissionRuleConfig": { + "anyOf": [ + { + "$ref": "#/$defs/PermissionActionConfig" + }, + { + "$ref": "#/$defs/PermissionObjectConfig" + } + ] + }, + "PermissionConfig": { + "anyOf": [ + { + "$ref": "#/$defs/PermissionActionConfig" + }, + { + "type": "object", + "properties": { + "read": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "edit": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "glob": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "grep": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "list": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "bash": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "task": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "external_directory": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "todowrite": { + "$ref": "#/$defs/PermissionActionConfig" + }, + "question": { + "$ref": "#/$defs/PermissionActionConfig" + }, + "webfetch": { + "$ref": "#/$defs/PermissionActionConfig" + }, + "websearch": { + "$ref": "#/$defs/PermissionActionConfig" + }, + "lsp": { + "$ref": "#/$defs/PermissionRuleConfig" + }, + "doom_loop": { + "$ref": "#/$defs/PermissionActionConfig" + }, + "skill": { + "$ref": "#/$defs/PermissionRuleConfig" + } + }, + "additionalProperties": { + "$ref": "#/$defs/PermissionRuleConfig" + } + } + ] + }, + "AgentConfig": { + "type": "object", + "properties": { + "model": { + "type": "string", + "$ref": "https://models.dev/model-schema.json#/$defs/Model" + }, + "variant": { + "type": "string", + "description": "Default model variant for this agent (applies only when using the agent's configured model)." + }, + "temperature": { + "type": "number" + }, + "top_p": { + "type": "number" + }, + "prompt": { + "type": "string" + }, + "tools": { + "type": "object", + "additionalProperties": { + "type": "boolean" + }, + "description": "@deprecated Use 'permission' field instead" + }, + "disable": { + "type": "boolean" + }, + "description": { + "type": "string", + "description": "Description of when to use the agent" + }, + "mode": { + "type": "string", + "enum": [ + "subagent", + "primary", + "all" + ] + }, + "hidden": { + "type": "boolean", + "description": "Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)" + }, + "options": { + "type": "object" + }, + "color": { + "anyOf": [ + { + "pattern": "^#[0-9a-fA-F]{6}$", + "type": "string" + }, + { + "type": "string", + "enum": [ + "primary", + "secondary", + "accent", + "success", + "warning", + "error", + "info" + ] + } + ], + "description": "Hex color code (e.g., #FF5733) or theme color (e.g., primary)" + }, + "steps": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum number of agentic iterations before forcing text-only response" + }, + "maxSteps": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "@deprecated Use 'steps' field instead." + }, + "permission": { + "$ref": "#/$defs/PermissionConfig" + } + } + }, + "ProviderConfig": { + "type": "object", + "properties": { + "api": { + "type": "string" + }, + "name": { + "type": "string" + }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "npm": { + "type": "string" + }, + "whitelist": { + "type": "array", + "items": { + "type": "string" + } + }, + "blacklist": { + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "baseURL": { + "type": "string" + }, + "enterpriseUrl": { + "type": "string", + "description": "GitHub Enterprise URL for copilot authentication" + }, + "setCacheKey": { + "type": "boolean", + "description": "Enable promptCacheKey for this provider (default false)" + }, + "timeout": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991 + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ], + "description": "Timeout in milliseconds for full requests to this provider. Set to false to disable timeout." + }, + "headerTimeout": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991 + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ], + "description": "Timeout in milliseconds to wait for response headers (default: 300000). Set to false to disable timeout." + }, + "chunkTimeout": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991 + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ], + "description": "Timeout in milliseconds between streamed SSE chunks for this provider (default: 300000). If no chunk arrives within this window, the request is aborted. Set to false to disable timeout." + } + } + }, + "models": { + "type": "object", + "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" + }, + { + "anyOf": [ + { + "type": "string", + "enum": [ + "reasoning", + "reasoning_content", + "reasoning_text" + ] + }, + { + "type": "string" + } + ] + }, + { + "type": "object", + "properties": { + "field": { + "anyOf": [ + { + "type": "string", + "enum": [ + "reasoning", + "reasoning_content", + "reasoning_text" + ] + }, + { + "type": "string" + } + ] + } + }, + "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" + ], + "additionalProperties": false + } + }, + "required": [ + "input", + "output" + ], + "additionalProperties": false + }, + "limit": { + "type": "object", + "properties": { + "context": { + "type": "number" + }, + "input": { + "type": "number" + }, + "output": { + "type": "number" + } + }, + "required": [ + "context", + "output" + ], + "additionalProperties": false + }, + "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" + ] + } + } + }, + "additionalProperties": false + }, + "experimental": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "alpha", + "beta", + "deprecated", + "active" + ] + }, + "provider": { + "type": "object", + "properties": { + "npm": { + "type": "string" + }, + "api": { + "type": "string" + } + }, + "additionalProperties": false + }, + "options": { + "type": "object" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "variants": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "description": "Disable this variant for the model" + } + } + }, + "description": "Variant-specific configuration" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "McpLocalConfig": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "local" + ], + "description": "Type of MCP server connection" + }, + "command": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Command and arguments to run the MCP server" + }, + "cwd": { + "type": "string", + "description": "Working directory for the MCP server process. Relative paths resolve from the workspace directory." + }, + "environment": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Environment variables to set when running the MCP server" + }, + "enabled": { + "type": "boolean", + "description": "Enable or disable the MCP server on startup" + }, + "timeout": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified." + } + }, + "required": [ + "type", + "command" + ], + "additionalProperties": false + }, + "McpOAuthConfig": { + "type": "object", + "properties": { + "clientId": { + "type": "string", + "description": "OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted." + }, + "clientSecret": { + "type": "string", + "description": "OAuth client secret (if required by the authorization server)" + }, + "scope": { + "type": "string", + "description": "OAuth scopes to request during authorization" + }, + "callbackPort": { + "minimum": 1, + "maximum": 65535, + "type": "integer", + "description": "Port for the local OAuth callback server (default: 19876). Shorthand for redirectUri when only the port needs changing. Ignored if redirectUri is set." + }, + "redirectUri": { + "type": "string", + "description": "OAuth redirect URI (default: http://127.0.0.1:19876/mcp/oauth/callback)." + } + }, + "additionalProperties": false + }, + "McpRemoteConfig": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "remote" + ], + "description": "Type of MCP server connection" + }, + "url": { + "type": "string", + "description": "URL of the remote MCP server" + }, + "enabled": { + "type": "boolean", + "description": "Enable or disable the MCP server on startup" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Headers to send with the request" + }, + "oauth": { + "anyOf": [ + { + "$ref": "#/$defs/McpOAuthConfig" + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ], + "description": "OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection." + }, + "timeout": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified." + } + }, + "required": [ + "type", + "url" + ], + "additionalProperties": false + }, + "LayoutConfig": { + "type": "string", + "enum": [ + "auto", + "stretch" + ] + }, + "ImageAttachmentConfig": { + "type": "object", + "properties": { + "auto_resize": { + "type": "boolean", + "description": "Resize images before sending them to the model when they exceed configured limits (default: true)" + }, + "max_width": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum image width before resizing or rejecting the attachment (default: 2000)" + }, + "max_height": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum image height before resizing or rejecting the attachment (default: 2000)" + }, + "max_base64_bytes": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum base64 payload bytes for an image attachment (default: 5242880)" + } + }, + "additionalProperties": false + }, + "AttachmentConfig": { + "type": "object", + "properties": { + "image": { + "$ref": "#/$defs/ImageAttachmentConfig", + "description": "Image attachment configuration" + } + }, + "additionalProperties": false + }, + "Policy.Effect": { + "type": "string", + "enum": [ + "allow", + "deny" + ] + }, + "ConfigV2.Experimental.Policy": { + "type": "object", + "properties": { + "action": { + "anyOf": [ + { + "anyOf": [ + { + "type": "string", + "enum": [ + "provider.use" + ] + } + ] + } + ] + }, + "effect": { + "$ref": "#/$defs/Policy.Effect" + }, + "resource": { + "type": "string" + } + }, + "required": [ + "action", + "effect", + "resource" + ], + "additionalProperties": false + }, + "Config": { + "type": "object", + "properties": { + "$schema": { + "type": "string", + "description": "JSON schema reference for configuration validation" + }, + "shell": { + "type": "string", + "description": "Default shell to use for terminal and bash tool" + }, + "logLevel": { + "$ref": "#/$defs/LogLevel", + "description": "Log level" + }, + "server": { + "$ref": "#/$defs/ServerConfig", + "description": "Server configuration for opencode serve and web commands" + }, + "command": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "template": { + "type": "string" + }, + "description": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "model": { + "type": "string", + "$ref": "https://models.dev/model-schema.json#/$defs/Model" + }, + "variant": { + "type": "string" + }, + "subtask": { + "type": "boolean" + } + }, + "required": [ + "template" + ], + "additionalProperties": false + }, + "description": "Command configuration, see https://opencode.ai/docs/commands" + }, + "skills": { + "type": "object", + "properties": { + "paths": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Additional paths to skill folders" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + }, + "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)" + } + }, + "additionalProperties": false, + "description": "Additional skill folder paths" + }, + "references": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/ConfigV2.Reference.Git" + }, + { + "$ref": "#/$defs/ConfigV2.Reference.Local" + } + ] + }, + "description": "Named git or local directory references" + }, + "reference": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/ConfigV2.Reference.Git" + }, + { + "$ref": "#/$defs/ConfigV2.Reference.Local" + } + ] + }, + "description": "@deprecated Use 'references' field instead. Named git or local directory references" + }, + "watcher": { + "type": "object", + "properties": { + "ignore": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "snapshot": { + "type": "boolean", + "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." + }, + "plugin": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "prefixItems": [ + { + "type": "string" + }, + { + "type": "object" + } + ], + "maxItems": 2, + "minItems": 2 + } + ] + } + }, + "share": { + "type": "string", + "enum": [ + "manual", + "auto", + "disabled" + ], + "description": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing" + }, + "autoshare": { + "type": "boolean", + "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically" + }, + "autoupdate": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": [ + "notify" + ] + } + ], + "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications" + }, + "disabled_providers": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Disable providers that are loaded automatically" + }, + "enabled_providers": { + "type": "array", + "items": { + "type": "string" + }, + "description": "When set, ONLY these providers will be enabled. All other providers will be ignored" + }, + "model": { + "type": "string", + "description": "Model to use in the format of provider/model, eg anthropic/claude-2", + "$ref": "https://models.dev/model-schema.json#/$defs/Model" + }, + "small_model": { + "type": "string", + "description": "Small model to use for tasks like title generation in the format of provider/model", + "$ref": "https://models.dev/model-schema.json#/$defs/Model" + }, + "default_agent": { + "type": "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." + }, + "subagent_depth": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum subagent nesting depth. Defaults to 1, which prevents subagents from launching subagents." + }, + "username": { + "type": "string", + "description": "Custom username to display in conversations instead of system username" + }, + "mode": { + "type": "object", + "properties": { + "build": { + "$ref": "#/$defs/AgentConfig" + }, + "plan": { + "$ref": "#/$defs/AgentConfig" + } + }, + "additionalProperties": { + "$ref": "#/$defs/AgentConfig" + }, + "description": "@deprecated Use `agent` field instead." + }, + "agent": { + "type": "object", + "properties": { + "plan": { + "$ref": "#/$defs/AgentConfig" + }, + "build": { + "$ref": "#/$defs/AgentConfig" + }, + "general": { + "$ref": "#/$defs/AgentConfig" + }, + "explore": { + "$ref": "#/$defs/AgentConfig" + }, + "title": { + "$ref": "#/$defs/AgentConfig" + }, + "summary": { + "$ref": "#/$defs/AgentConfig" + }, + "compaction": { + "$ref": "#/$defs/AgentConfig" + } + }, + "additionalProperties": { + "$ref": "#/$defs/AgentConfig" + }, + "description": "Agent configuration, see https://opencode.ai/docs/agents" + }, + "provider": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ProviderConfig" + }, + "description": "Custom provider configurations and model overrides" + }, + "mcp": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "anyOf": [ + { + "$ref": "#/$defs/McpLocalConfig" + }, + { + "$ref": "#/$defs/McpRemoteConfig" + } + ] + }, + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + ] + }, + "description": "MCP (Model Context Protocol) server configurations" + }, + "formatter": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "disabled": { + "type": "boolean" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + ], + "description": "Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides." + }, + "lsp": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "enum": [ + true + ] + } + }, + "required": [ + "disabled" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + } + }, + "disabled": { + "type": "boolean" + }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "initialization": { + "type": "object" + } + }, + "required": [ + "command" + ], + "additionalProperties": false + } + ] + } + } + ], + "description": "Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides." + }, + "instructions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Additional instruction files or patterns to include" + }, + "layout": { + "$ref": "#/$defs/LayoutConfig", + "description": "@deprecated Always uses stretch layout." + }, + "permission": { + "$ref": "#/$defs/PermissionConfig" + }, + "tools": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + }, + "attachment": { + "$ref": "#/$defs/AttachmentConfig", + "description": "Attachment processing configuration, including image size limits and resizing behavior" + }, + "enterprise": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Enterprise URL" + } + }, + "additionalProperties": false + }, + "tool_output": { + "type": "object", + "properties": { + "max_lines": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum lines of tool output before it is truncated and saved to disk (default: 2000)" + }, + "max_bytes": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)" + } + }, + "additionalProperties": false, + "description": "Thresholds for truncating tool output. When output exceeds either limit, the full text is written to the truncation directory and a preview is returned." + }, + "compaction": { + "type": "object", + "properties": { + "auto": { + "type": "boolean", + "description": "Enable automatic compaction when context is full (default: true)" + }, + "prune": { + "type": "boolean", + "description": "Enable pruning of old tool outputs (default: false)" + }, + "tail_turns": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction. By default retention is limited only by the preserved token budget." + }, + "preserve_recent_tokens": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Maximum number of tokens from recent turns to preserve verbatim after compaction" + }, + "reserved": { + "minimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction." + } + }, + "additionalProperties": false + }, + "experimental": { + "type": "object", + "properties": { + "disable_paste_summary": { + "type": "boolean" + }, + "batch_tool": { + "type": "boolean", + "description": "Enable the batch tool" + }, + "openTelemetry": { + "type": "boolean", + "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)" + }, + "primary_tools": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Tools that should only be available to primary agents." + }, + "continue_loop_on_deny": { + "type": "boolean", + "description": "Continue the agent loop when a tool call is denied" + }, + "mcp_timeout": { + "exclusiveMinimum": 0, + "type": "integer", + "maximum": 9007199254740991, + "description": "Timeout in milliseconds for model context protocol (MCP) requests" + }, + "policies": { + "type": "array", + "items": { + "$ref": "#/$defs/ConfigV2.Experimental.Policy" + }, + "description": "Policy statements applied to supported resources, such as provider access" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "allowComments": true, + "allowTrailingCommas": true +} \ No newline at end of file diff --git a/services/www/.gitignore b/services/www/.gitignore index def4162d773..d1bd56ffb0f 100644 --- a/services/www/.gitignore +++ b/services/www/.gitignore @@ -3,3 +3,4 @@ dist/ node_modules/ public/cli.json +public/config.json diff --git a/services/www/README.md b/services/www/README.md index 556d958013f..718eb1027c5 100644 --- a/services/www/README.md +++ b/services/www/README.md @@ -6,6 +6,7 @@ The standard Astro website for OpenCode. The only deployment-specific path is th - `src/docs/` is the self-contained documentation feature rendered under `/docs`. - `/install` proxies the current installer. - `/openapi.json` serves the generated OpenAPI specification. +- `/config.json` serves the strict V2 `opencode.json` schema. `bun run generate` also regenerates the V1-compatible schema that the console app serves at the root `https://opencode.ai/config.json`. The deployment currently sets `base: "/v2"`. The `v2.opencode.ai` alias is handled by a Cloudflare Redirect Rule outside this project. diff --git a/services/www/package.json b/services/www/package.json index 5b6f857a394..95ea3b4bcc0 100644 --- a/services/www/package.json +++ b/services/www/package.json @@ -7,8 +7,8 @@ "dev": "bun run generate && astro dev --host --port 3000", "build": "bun run generate && astro build && bun script/pagefind.ts && bun run validate && bun script/prepare-cloudflare.ts", "deploy": "wrangler deploy --config dist/server/wrangler.json", - "generate": "bun script/generate-openapi.ts && bun --cwd ../../packages/cli script/schema.ts ../../services/www/public/cli.json", - "check:generated": "bun script/generate-openapi.ts --check", + "generate": "bun script/generate-openapi.ts && bun --cwd ../../packages/cli script/schema.ts ../../services/www/public/cli.json && bun --cwd ../../packages/schema script/config-schema.ts --v2 ../../services/www/public/config.json --compat ../../packages/console/app/public/config.json", + "check:generated": "bun script/generate-openapi.ts --check && bun --cwd ../../packages/schema script/config-schema.ts --compat ../../packages/console/app/public/config.json --check", "validate": "bun script/validate-links.ts", "typecheck": "astro check" }, diff --git a/services/www/src/docs/content/agents.mdx b/services/www/src/docs/content/agents.mdx index 1507f5b30e9..fc897ad8680 100644 --- a/services/www/src/docs/content/agents.mdx +++ b/services/www/src/docs/content/agents.mdx @@ -65,7 +65,7 @@ Define agents under `agents` in any [OpenCode configuration file](/config): ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "agents": { "reviewer": { "description": "Reviews current changes", @@ -85,7 +85,7 @@ Set the primary agent used when a session has not selected one: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "default_agent": "writer", "agents": { "writer": { "mode": "primary" }, diff --git a/services/www/src/docs/content/attachments.mdx b/services/www/src/docs/content/attachments.mdx index 36caace2e88..731be4c68dc 100644 --- a/services/www/src/docs/content/attachments.mdx +++ b/services/www/src/docs/content/attachments.mdx @@ -79,7 +79,7 @@ Configure image normalization in `opencode.json` or `opencode.jsonc`: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "media": { "image": { "auto_resize": true, diff --git a/services/www/src/docs/content/build/plugins/effect.mdx b/services/www/src/docs/content/build/plugins/effect.mdx index b8fd93823c0..0dd27f21a0b 100644 --- a/services/www/src/docs/content/build/plugins/effect.mdx +++ b/services/www/src/docs/content/build/plugins/effect.mdx @@ -34,7 +34,7 @@ plugins. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "plugins": [ "opencode-acme-effect-plugin", "opencode-acme-effect-plugin@1.2.0", diff --git a/services/www/src/docs/content/build/plugins/index.mdx b/services/www/src/docs/content/build/plugins/index.mdx index 4d30eb234f5..d923009a37d 100644 --- a/services/www/src/docs/content/build/plugins/index.mdx +++ b/services/www/src/docs/content/build/plugins/index.mdx @@ -23,7 +23,7 @@ or plugin directories from other locations, add them to `plugins` in `opencode.j ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "plugins": [ "opencode-acme-plugin", "opencode-acme-plugin@1.2.0", diff --git a/services/www/src/docs/content/commands.mdx b/services/www/src/docs/content/commands.mdx index a20d04f6fb3..4dd40e08309 100644 --- a/services/www/src/docs/content/commands.mdx +++ b/services/www/src/docs/content/commands.mdx @@ -53,7 +53,7 @@ Define commands under `commands` in any OpenCode JSON or JSONC [configuration fi ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "commands": { "review": { "description": "Review code for correctness", diff --git a/services/www/src/docs/content/compaction.mdx b/services/www/src/docs/content/compaction.mdx index a22c87e5080..8cd293ee7a7 100644 --- a/services/www/src/docs/content/compaction.mdx +++ b/services/www/src/docs/content/compaction.mdx @@ -26,7 +26,7 @@ Automatic compaction is on by default: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "compaction": { "auto": true, "keep": { "tokens": 15000 }, @@ -69,7 +69,7 @@ Add `compaction` to any [OpenCode configuration file](/config): ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "compaction": { "auto": false, "keep": { "tokens": 24000 }, @@ -94,7 +94,7 @@ provider or model with `settings.compaction`: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "openai": { "settings": { "compaction": { "type": "native" } }, diff --git a/services/www/src/docs/content/config.mdx b/services/www/src/docs/content/config.mdx index adcacb53dcc..73fea5894f8 100644 --- a/services/www/src/docs/content/config.mdx +++ b/services/www/src/docs/content/config.mdx @@ -6,7 +6,7 @@ Create `opencode.jsonc` in your project to configure OpenCode. Add the schema fo ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "anthropic/claude-sonnet-4-5", } ``` @@ -19,7 +19,7 @@ OpenCode supports JSON and JSONC. Use JSONC when you want comments or trailing c ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", // Use this model by default. "model": "anthropic/claude-sonnet-4-5", } @@ -71,20 +71,24 @@ which overrides the global config. Settings that do not conflict are preserved. ## Schema The complete OpenCode configuration schema is available at -[opencode.ai/config.json](https://opencode.ai/config.json). +[opencode.ai/v2/config.json](https://opencode.ai/v2/config.json). Add the `$schema` field to your configuration file to enable validation and autocomplete in editors that support JSON Schema: ```json title="opencode.json" { - "$schema": "https://opencode.ai/config.json" + "$schema": "https://opencode.ai/v2/config.json" } ``` Use the schema as the source of truth for available fields, accepted values, and nested configuration shapes. +Files that still use V1 syntax can keep `https://opencode.ai/config.json`. That +schema accepts V1, native V2, and mixed configuration files, and marks V1-only +fields as deprecated. + ### Shell Set the shell used by the terminal and shell tools. diff --git a/services/www/src/docs/content/console/go.mdx b/services/www/src/docs/content/console/go.mdx index 85d0bfc984a..77cf4e33303 100644 --- a/services/www/src/docs/content/console/go.mdx +++ b/services/www/src/docs/content/console/go.mdx @@ -418,7 +418,7 @@ the [model](/models) using the format `opencode-go/`: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "opencode-go/kimi-k3", } ``` diff --git a/services/www/src/docs/content/console/models.mdx b/services/www/src/docs/content/console/models.mdx index 312aff3b488..15203aa98ba 100644 --- a/services/www/src/docs/content/console/models.mdx +++ b/services/www/src/docs/content/console/models.mdx @@ -130,7 +130,7 @@ use the format `opencode/`: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "opencode/gpt-5.5", } ``` diff --git a/services/www/src/docs/content/formatters.mdx b/services/www/src/docs/content/formatters.mdx index e78821e0f6e..ffc8bc1c1b7 100644 --- a/services/www/src/docs/content/formatters.mdx +++ b/services/www/src/docs/content/formatters.mdx @@ -7,7 +7,7 @@ them. Formatters are disabled by default, so enable them in your configuration: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "formatter": true, } ``` @@ -20,7 +20,7 @@ available. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "formatter": true, } ``` @@ -31,7 +31,7 @@ resets them to the built-ins. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "formatter": {}, } ``` @@ -86,7 +86,7 @@ formatter needs both `command` and `extensions` to run. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "formatter": { "prettier": { "environment": { @@ -183,7 +183,7 @@ formatting that a lower-priority file enabled, set it to `false`. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "formatter": false, } ``` diff --git a/services/www/src/docs/content/instructions.mdx b/services/www/src/docs/content/instructions.mdx index d7d43422a6a..f77d825e71b 100644 --- a/services/www/src/docs/content/instructions.mdx +++ b/services/www/src/docs/content/instructions.mdx @@ -104,7 +104,7 @@ The V2 config schema accepts an `instructions` array, but V2 does not currently ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "instructions": ["CONTRIBUTING.md", "docs/guidelines/*.md", "https://example.com/instructions.md"], } ``` diff --git a/services/www/src/docs/content/mcp-servers.mdx b/services/www/src/docs/content/mcp-servers.mdx index 4951db4ff3b..46398f2c164 100644 --- a/services/www/src/docs/content/mcp-servers.mdx +++ b/services/www/src/docs/content/mcp-servers.mdx @@ -31,7 +31,7 @@ To configure a server by hand, give it a unique name under `mcp.servers`. V2 doe ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "servers": { "my-server": { @@ -86,7 +86,7 @@ Use configuration for process options such as a working directory or environment ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "servers": { "everything": { @@ -136,7 +136,7 @@ Use configuration when the server needs headers or other options. Store secrets ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "servers": { "context7": { @@ -182,7 +182,7 @@ For dynamic registration, configure only the server URL: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "servers": { "sentry": { @@ -204,7 +204,7 @@ When a provider gives you client credentials, use V2's snake_case OAuth fields: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "servers": { "company-tools": { @@ -244,7 +244,7 @@ Timeouts are positive integer milliseconds. Set defaults under `mcp.timeout`; a ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "timeout": { "startup": 45000, @@ -276,7 +276,7 @@ OpenCode opens every server with the classic MCP `initialize` handshake by defau ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "mcp": { "servers": { "modern": { diff --git a/services/www/src/docs/content/migrate-v1.mdx b/services/www/src/docs/content/migrate-v1.mdx index 760bfc691da..5b799ff8227 100644 --- a/services/www/src/docs/content/migrate-v1.mdx +++ b/services/www/src/docs/content/migrate-v1.mdx @@ -69,13 +69,24 @@ The recommended migration path is to ask OpenCode to update the configuration fo ```text Migrate my OpenCode configuration, including file-based definitions, from the V1 format to the native V2 format. -Preserve its behavior and all unrelated settings. +Preserve its behavior and all unrelated settings. When a config file is fully converted, update its $schema to +https://opencode.ai/v2/config.json. ``` OpenCode can inspect the complete file, apply the relevant changes below, and avoid rewriting settings that do not need to change. Conversion does not need to happen all at once: supported V1 and native V2 fields may coexist at the top level. When both forms set the same canonical value, a valid native V2 value takes precedence regardless of JSON key order. +The schema at `https://opencode.ai/config.json` accepts V1, native V2, and mixed files, and marks V1-only fields as +deprecated. Once a file is fully converted, switch to the strict native V2 schema: + +```jsonc title="opencode.jsonc" +{ + "$schema": "https://opencode.ai/v2/config.json", + "permissions": [{ "action": "shell", "resource": "git push *", "effect": "ask" }], +} +``` + Nested mixing is intentionally bounded. OpenCode recognizes mixed V1 and V2 members within `mcp`, `compaction`, and `experimental`, but it does not recursively infer formats inside individual agents, providers, commands, or models. Keep each of those nested entries entirely in one format. Supported V1 syntax remains quiet by itself; malformed values, diff --git a/services/www/src/docs/content/models.mdx b/services/www/src/docs/content/models.mdx index 003ef6df1b2..40ae75306d6 100644 --- a/services/www/src/docs/content/models.mdx +++ b/services/www/src/docs/content/models.mdx @@ -43,7 +43,7 @@ Set `model` in `opencode.json` or `opencode.jsonc` to choose the default for new ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "anthropic/claude-sonnet-4-5", } ``` @@ -73,7 +73,7 @@ Define new variants, or replace catalog variants with the same ID, in the model' ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "openai": { "models": { @@ -153,7 +153,7 @@ Use `modelID` to give an API model a friendlier catalog ID: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "openai/coding-default", "providers": { "openai": { @@ -243,7 +243,7 @@ With Ollama listening at `http://127.0.0.1:11434`, select a discovered model wit ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "ollama/gemma3:4b", } ``` @@ -277,7 +277,7 @@ provider ID: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "lmstudio/google/gemma-4-26b-a4b", } ``` @@ -309,7 +309,7 @@ With vLLM listening at `http://127.0.0.1:8000`, select a discovered model with t ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "vllm/Qwen/Qwen3-Coder-30B-A3B-Instruct", } ``` @@ -346,7 +346,7 @@ For another OpenAI-compatible server, define its provider package, endpoint, and ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "local/coder", "providers": { "local": { diff --git a/services/www/src/docs/content/permissions.mdx b/services/www/src/docs/content/permissions.mdx index a8e540213c3..cba32c8abdc 100644 --- a/services/www/src/docs/content/permissions.mdx +++ b/services/www/src/docs/content/permissions.mdx @@ -11,7 +11,7 @@ inspection, and always block pushes. Add these ordered rules to `opencode.jsonc` ```jsonc { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "permissions": [ { "action": "shell", "resource": "*", "effect": "ask" }, { "action": "shell", "resource": "git status *", "effect": "allow" }, @@ -142,7 +142,7 @@ A path outside both the active Location and its non-root project worktree needs ```jsonc { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "permissions": [ { "action": "external_directory", "resource": "~/projects/reference/*", "effect": "allow" }, { "action": "read", "resource": "~/projects/reference/*", "effect": "allow" }, @@ -179,7 +179,7 @@ Enable the experimental portable shell scanner with: ```jsonc { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "experimental": { "portable_shell_scanner": true, }, @@ -232,7 +232,7 @@ Put shared rules at the top level and narrower rules under ```jsonc { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "permissions": [ { "action": "shell", "resource": "*", "effect": "ask" }, { "action": "shell", "resource": "git status *", "effect": "allow" }, diff --git a/services/www/src/docs/content/plugins.mdx b/services/www/src/docs/content/plugins.mdx index 4901d3d17c4..93e1420c8d9 100644 --- a/services/www/src/docs/content/plugins.mdx +++ b/services/www/src/docs/content/plugins.mdx @@ -8,7 +8,7 @@ Add published packages, versioned packages, scoped packages, or local plugin dir ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "plugins": [ "opencode-acme-plugin", "opencode-acme-plugin@1.2.0", diff --git a/services/www/src/docs/content/policies.mdx b/services/www/src/docs/content/policies.mdx index ea021b7ccb1..004662acff8 100644 --- a/services/www/src/docs/content/policies.mdx +++ b/services/www/src/docs/content/policies.mdx @@ -17,7 +17,7 @@ Deny one provider everywhere by adding a statement to `opencode.jsonc`: ```jsonc { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "experimental": { "policies": [{ "action": "provider.use", "resource": "openai", "effect": "deny" }], }, diff --git a/services/www/src/docs/content/providers.mdx b/services/www/src/docs/content/providers.mdx index ed6797b3438..ee0a6e3df5e 100644 --- a/services/www/src/docs/content/providers.mdx +++ b/services/www/src/docs/content/providers.mdx @@ -34,7 +34,7 @@ runtime package, endpoint, and first model together. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "acme": { "name": "Acme", @@ -73,7 +73,7 @@ models, and connection still apply. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "anthropic": { "settings": { @@ -92,7 +92,7 @@ Use `headers` for additional HTTP headers and `body` for JSON fields that should ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "openai": { "headers": { @@ -112,7 +112,7 @@ Both fields can also be set on a model or variant when only part of a provider's ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "openai": { "models": { @@ -141,7 +141,7 @@ WebSocket transport, `chunkTimeout` bounds the gap between frames instead and de ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "anthropic": { "settings": { @@ -163,7 +163,7 @@ implement the OpenAI request format. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "acme": { "package": "@opencode/ai/providers/openai-compatible", @@ -207,7 +207,7 @@ You can also use an npm package such as `@acme/opencode-provider` or an absolute ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "acme": { "package": "@acme/opencode-provider", @@ -224,7 +224,7 @@ ID sent to the provider. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "openai/coding", "providers": { "openai": { @@ -265,7 +265,7 @@ once, then connect an API key or use the Microsoft Entra ID session from the Azu ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "azure": { "settings": { @@ -336,7 +336,7 @@ kept. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "azure": { "models": { @@ -375,7 +375,7 @@ identity token file, or container credential URI activates the provider; a regio ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "amazon-bedrock": { "settings": { @@ -392,7 +392,7 @@ VPC endpoint, set `baseURL` while keeping the same profile and region. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "amazon-bedrock": { "settings": { @@ -419,7 +419,7 @@ gcloud auth application-default login ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "google-vertex": { "settings": { @@ -489,7 +489,7 @@ model requests. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "ollama": { "settings": { @@ -511,7 +511,7 @@ LM Studio and vLLM also have built-in local discovery. Their default endpoints a ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "lmstudio": { "settings": { "baseURL": "http://gpu-host:1234/v1" }, @@ -534,7 +534,7 @@ OpenRouter account, then refer to models with the full OpenRouter model ID after ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "openrouter/anthropic/claude-sonnet-4", } ``` @@ -544,7 +544,7 @@ This preserves OpenRouter request and reasoning behavior. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "openrouter": { "settings": { @@ -563,7 +563,7 @@ The configuration key becomes the provider prefix and each `models` key becomes ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "model": "company/coder", "providers": { "company": { @@ -607,7 +607,7 @@ sessions. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "providers": { "openai": { "settings": { "transport": "http" }, diff --git a/services/www/src/docs/content/references.mdx b/services/www/src/docs/content/references.mdx index 947616ff775..7025fde4d62 100644 --- a/services/www/src/docs/content/references.mdx +++ b/services/www/src/docs/content/references.mdx @@ -8,7 +8,7 @@ your client when you need it. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "references": { "docs": { "path": "../product-docs", diff --git a/services/www/src/docs/content/skills.mdx b/services/www/src/docs/content/skills.mdx index 2301c68629c..471ed7ab9a9 100644 --- a/services/www/src/docs/content/skills.mdx +++ b/services/www/src/docs/content/skills.mdx @@ -67,7 +67,7 @@ Add more local directories or HTTP catalogs with the `skills` array in any `open ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "skills": [ "./team-skills", "~/shared/opencode-skills", diff --git a/services/www/src/docs/content/snapshots.mdx b/services/www/src/docs/content/snapshots.mdx index 88bca613bcb..a915a42f934 100644 --- a/services/www/src/docs/content/snapshots.mdx +++ b/services/www/src/docs/content/snapshots.mdx @@ -103,7 +103,7 @@ filesystem capture. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "snapshots": false, } ``` diff --git a/services/www/src/docs/content/warming.mdx b/services/www/src/docs/content/warming.mdx index bd281fa99f3..5f30ae4556f 100644 --- a/services/www/src/docs/content/warming.mdx +++ b/services/www/src/docs/content/warming.mdx @@ -10,7 +10,7 @@ Enable warming in any [OpenCode configuration file](/config): ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "warming": true, } ``` @@ -26,7 +26,7 @@ window: ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "warming": { "prompt": "Do not perform any work. Reply with exactly: OK", "interval": "5 minutes", diff --git a/services/www/src/docs/content/websearch.mdx b/services/www/src/docs/content/websearch.mdx index 8409cabfd2c..b65da14b5e5 100644 --- a/services/www/src/docs/content/websearch.mdx +++ b/services/www/src/docs/content/websearch.mdx @@ -34,7 +34,7 @@ Set a provider in `opencode.jsonc` to skip the selection prompt. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "websearch": { "provider": "tavily", }, @@ -45,7 +45,7 @@ Use `"random"` to choose an available provider automatically. Each session keeps ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "websearch": { "provider": "random", }, @@ -70,7 +70,7 @@ Web searches use the `websearch` permission action and the search query as the r ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "permissions": [ { "action": "websearch", @@ -89,7 +89,7 @@ Set `websearch` to `false` to remove the web search tool from model requests. ```jsonc title="opencode.jsonc" { - "$schema": "https://opencode.ai/config.json", + "$schema": "https://opencode.ai/v2/config.json", "websearch": false, } ```