{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ustcode.enthusjast.cc/config.json",
  "title": "ustcode configuration",
  "$ref": "#/$defs/Config",
  "$defs": {
    "LogLevel": {
      "type": "string",
      "enum": [
        "DEBUG",
        "INFO",
        "WARN",
        "ERROR"
      ],
      "description": "Log level"
    },
    "ServerConfig": {
      "type": "object",
      "properties": {
        "port": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Port to listen on"
        },
        "hostname": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Hostname to listen on"
        },
        "mdns": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Enable mDNS service discovery"
        },
        "mdnsDomain": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Custom domain name for mDNS service (default: ustcode.local)"
        },
        "cors": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Additional domains to allow for CORS"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Reference.Git": {
      "type": "object",
      "properties": {
        "repository": {
          "type": "string"
        },
        "branch": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "hidden": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "repository"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Reference.Local": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "hidden": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "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": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "edit": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "glob": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "grep": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "list": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "bash": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "task": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "external_directory": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "todowrite": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionActionConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "question": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionActionConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "webfetch": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionActionConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "websearch": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionActionConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "lsp": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "doom_loop": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionActionConfig"
                },
                {
                  "type": "null"
                }
              ]
            },
            "skill": {
              "anyOf": [
                {
                  "$ref": "#/$defs/PermissionRuleConfig"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": {
            "$ref": "#/$defs/PermissionRuleConfig"
          }
        }
      ]
    },
    "AgentConfig": {
      "type": "object",
      "properties": {
        "model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "variant": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default model variant for this agent (applies only when using the agent's configured model)."
        },
        "temperature": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "top_p": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "prompt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "tools": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "boolean"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "@deprecated Use 'permission' field instead"
        },
        "disable": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Description of when to use the agent"
        },
        "mode": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "subagent",
                "primary",
                "all"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "hidden": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)"
        },
        "options": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "color": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "string",
                  "allOf": [
                    {
                      "pattern": "^#[0-9a-fA-F]{6}$"
                    }
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "primary",
                    "secondary",
                    "accent",
                    "success",
                    "warning",
                    "error",
                    "info"
                  ]
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Hex color code (e.g., #FF5733) or theme color (e.g., primary)"
        },
        "steps": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Maximum number of agentic iterations before forcing text-only response"
        },
        "maxSteps": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "@deprecated Use 'steps' field instead."
        },
        "permission": {
          "anyOf": [
            {
              "$ref": "#/$defs/PermissionConfig"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "ProviderConfig": {
      "type": "object",
      "properties": {
        "api": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "env": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "npm": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "whitelist": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "blacklist": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "options": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "apiKey": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "baseURL": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "enterpriseUrl": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "GitHub Enterprise URL for copilot authentication"
                },
                "setCacheKey": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Enable promptCacheKey for this provider (default false)"
                },
                "timeout": {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "type": "integer",
                          "allOf": [
                            {
                              "exclusiveMinimum": 0
                            }
                          ]
                        },
                        {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        }
                      ],
                      "description": "Timeout in milliseconds for full requests to this provider. Set to false to disable timeout."
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Timeout in milliseconds for full requests to this provider. Set to false to disable timeout."
                },
                "headerTimeout": {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "type": "integer",
                          "allOf": [
                            {
                              "exclusiveMinimum": 0
                            }
                          ]
                        },
                        {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        }
                      ],
                      "description": "Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout."
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout."
                },
                "chunkTimeout": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "exclusiveMinimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted."
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "models": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "family": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "release_date": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "attachment": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reasoning": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "temperature": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tool_call": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interleaved": {
                    "anyOf": [
                      {
                        "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
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cost": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "input": {
                            "type": "number"
                          },
                          "output": {
                            "type": "number"
                          },
                          "cache_read": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cache_write": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "context_over_200k": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "input": {
                                    "type": "number"
                                  },
                                  "output": {
                                    "type": "number"
                                  },
                                  "cache_read": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "cache_write": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "input",
                                  "output"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "input",
                          "output"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "limit": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "context": {
                            "type": "number"
                          },
                          "input": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "output": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "context",
                          "output"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "modalities": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "input": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "text",
                                    "audio",
                                    "image",
                                    "video",
                                    "pdf"
                                  ]
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "output": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "text",
                                    "audio",
                                    "image",
                                    "video",
                                    "pdf"
                                  ]
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "experimental": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "alpha",
                          "beta",
                          "deprecated",
                          "active"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "provider": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "npm": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "api": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "options": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "headers": {
                    "anyOf": [
                      {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "variants": {
                    "anyOf": [
                      {
                        "type": "object",
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "disabled": {
                              "anyOf": [
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Disable this variant for the model"
                            }
                          }
                        },
                        "description": "Variant-specific configuration"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "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": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Working directory for the MCP server process. Relative paths resolve from the workspace directory."
        },
        "environment": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Environment variables to set when running the MCP server"
        },
        "enabled": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Enable or disable the MCP server on startup"
        },
        "timeout": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted."
        },
        "clientSecret": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "OAuth client secret (if required by the authorization server)"
        },
        "scope": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "OAuth scopes to request during authorization"
        },
        "callbackPort": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "minimum": 1,
                  "maximum": 65535
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Enable or disable the MCP server on startup"
        },
        "headers": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Headers to send with the request"
        },
        "oauth": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "$ref": "#/$defs/McpOAuthConfig"
                },
                {
                  "type": "boolean",
                  "enum": [
                    false
                  ]
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection."
        },
        "timeout": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Resize images before sending them to the model when they exceed configured limits (default: true)"
        },
        "max_width": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Maximum image width before resizing or rejecting the attachment (default: 2000)"
        },
        "max_height": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Maximum image height before resizing or rejecting the attachment (default: 2000)"
        },
        "max_base64_bytes": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "exclusiveMinimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Maximum base64 payload bytes for an image attachment (default: 5242880)"
        }
      },
      "additionalProperties": false
    },
    "AttachmentConfig": {
      "type": "object",
      "properties": {
        "image": {
          "anyOf": [
            {
              "$ref": "#/$defs/ImageAttachmentConfig"
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "JSON schema reference for configuration validation"
        },
        "shell": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default shell to use for terminal and bash tool"
        },
        "logLevel": {
          "anyOf": [
            {
              "$ref": "#/$defs/LogLevel"
            },
            {
              "type": "null"
            }
          ],
          "description": "Log level"
        },
        "server": {
          "anyOf": [
            {
              "$ref": "#/$defs/ServerConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Server configuration for ustcode serve and web commands"
        },
        "command": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "template": {
                    "type": "string"
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "agent": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "variant": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subtask": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "template"
                ],
                "additionalProperties": false
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Command configuration, see https://ustcode.enthusjast.cc/docs/commands"
        },
        "skills": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "paths": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Additional paths to skill folders"
                },
                "urls": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "description": "Additional skill folder paths"
        },
        "references": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/$defs/ConfigV2.Reference.Git"
                  },
                  {
                    "$ref": "#/$defs/ConfigV2.Reference.Local"
                  }
                ]
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Named git or local directory references"
        },
        "reference": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/$defs/ConfigV2.Reference.Git"
                  },
                  {
                    "$ref": "#/$defs/ConfigV2.Reference.Local"
                  }
                ]
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "@deprecated Use 'references' field instead. Named git or local directory references"
        },
        "watcher": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "ignore": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "snapshot": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object"
                      }
                    ],
                    "maxItems": 2,
                    "minItems": 2
                  }
                ]
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "autoupdate": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string",
                  "enum": [
                    "notify"
                  ]
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications"
        },
        "disabled_providers": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Disable providers that are loaded automatically"
        },
        "enabled_providers": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "When set, ONLY these providers will be enabled. All other providers will be ignored"
        },
        "model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Model to use in the format of provider/model, eg anthropic/claude-2"
        },
        "small_model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Small model to use for tasks like title generation in the format of provider/model"
        },
        "default_agent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "integer",
              "allOf": [
                {
                  "minimum": 0
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Maximum subagent nesting depth. Defaults to 1, which prevents subagents from launching subagents."
        },
        "username": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Custom username to display in conversations instead of system username"
        },
        "mode": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "build": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "plan": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": {
                "$ref": "#/$defs/AgentConfig"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "@deprecated Use `agent` field instead."
        },
        "agent": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "plan": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "build": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "general": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "explore": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "summary": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "compaction": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/AgentConfig"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": {
                "$ref": "#/$defs/AgentConfig"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Agent configuration, see https://ustcode.enthusjast.cc/docs/agents"
        },
        "provider": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/ProviderConfig"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Custom provider configurations and model overrides"
        },
        "mcp": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "$ref": "#/$defs/McpLocalConfig"
                      },
                      {
                        "$ref": "#/$defs/McpRemoteConfig"
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "enabled"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "MCP (Model Context Protocol) server configurations"
        },
        "formatter": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "disabled": {
                        "anyOf": [
                          {
                            "type": "boolean"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "command": {
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "environment": {
                        "anyOf": [
                          {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "extensions": {
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "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
                      },
                      {
                        "type": "object",
                        "properties": {
                          "command": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "extensions": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "disabled": {
                            "anyOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "env": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "initialization": {
                            "anyOf": [
                              {
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "command"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Additional instruction files or patterns to include"
        },
        "layout": {
          "anyOf": [
            {
              "$ref": "#/$defs/LayoutConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "@deprecated Always uses stretch layout."
        },
        "permission": {
          "anyOf": [
            {
              "$ref": "#/$defs/PermissionConfig"
            },
            {
              "type": "null"
            }
          ]
        },
        "tools": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "boolean"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "attachment": {
          "anyOf": [
            {
              "$ref": "#/$defs/AttachmentConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Attachment processing configuration, including image size limits and resizing behavior"
        },
        "tool_output": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "max_lines": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "exclusiveMinimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Maximum lines of tool output before it is truncated and saved to disk (default: 2000)"
                },
                "max_bytes": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "exclusiveMinimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "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": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "auto": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Enable automatic compaction when context is full (default: true)"
                },
                "prune": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Enable pruning of old tool outputs (default: false)"
                },
                "tail_turns": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction (default: 2)"
                },
                "preserve_recent_tokens": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Maximum number of tokens from recent turns to preserve verbatim after compaction"
                },
                "reserved": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction."
                }
              },
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "experimental": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "disable_paste_summary": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "batch_tool": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Enable the batch tool"
                },
                "openTelemetry": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)"
                },
                "primary_tools": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Tools that should only be available to primary agents."
                },
                "continue_loop_on_deny": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Continue the agent loop when a tool call is denied"
                },
                "mcp_timeout": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "allOf": [
                        {
                          "exclusiveMinimum": 0
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Timeout in milliseconds for model context protocol (MCP) requests"
                },
                "policies": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/ConfigV2.Experimental.Policy"
                      }
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Policy statements applied to supported resources, such as provider access"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    }
  }
}
