{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "SDD provider configuration",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "providers": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "default": { "type": "string" },
        "model": { "type": "string" },
        "effort": { "type": "string" },
        "offline": { "type": "boolean" },
        "registry": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "kind": { "type": "string" },
              "base_url": { "type": ["string", "null"] },
              "auth_env": { "type": ["string", "null"] },
              "auth_methods": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": { "type": "string" },
                    "label": { "type": "string" },
                    "kind": { "type": "string" },
                    "env": { "type": ["string", "null"] },
                    "command": { "type": ["string", "null"] },
                    "check_command": { "type": ["string", "null"] },
                    "check_success_text": { "type": ["string", "null"] },
                    "check_success_regex": { "type": ["string", "null"] },
                    "login_command": { "type": ["string", "null"] }
                  },
                  "required": ["id", "label", "kind"]
                }
              },
              "model": { "type": ["string", "null"] },
              "models": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": { "type": "string" },
                    "label": { "type": "string" },
                    "context_window_tokens": { "type": ["integer", "null"], "minimum": 1 },
                    "pricing": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "currency": { "type": ["string", "null"] },
                        "input_per_million": { "type": ["number", "null"], "minimum": 0 },
                        "cached_input_per_million": { "type": ["number", "null"], "minimum": 0 },
                        "output_per_million": { "type": ["number", "null"], "minimum": 0 }
                      }
                    }
                  },
                  "required": ["id", "label"]
                }
              },
              "effort": { "type": ["string", "null"] },
              "efforts": {
                "type": "array",
                "items": { "type": "string" }
              },
              "stage_models": {
                "type": "object",
                "additionalProperties": { "type": "string" }
              },
              "stage_efforts": {
                "type": "object",
                "additionalProperties": { "type": "string" }
              },
              "capabilities": {
                "type": "array",
                "items": { "type": "string" }
              },
              "timeouts": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "request_ms": { "type": "integer", "minimum": 1 }
                }
              },
              "retries": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "max_attempts": { "type": "integer", "minimum": 0 }
                }
              },
              "token_budget": { "type": ["integer", "null"], "minimum": 1 },
              "usage_limits": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "window": { "type": "string" },
                    "limit": { "type": ["number", "null"], "minimum": 0 },
                    "remaining": { "type": ["number", "null"], "minimum": 0 },
                    "unit": { "type": "string" },
                    "resets_at": { "type": ["string", "null"] },
                    "source": { "type": ["string", "null"] }
                  },
                  "required": ["window", "unit"]
                }
              },
              "enabled": { "type": "boolean" }
            },
            "required": ["kind"]
          }
        }
      }
    },
    "runtime": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "node_effect_bridge": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": { "type": "boolean" },
            "command": { "type": ["string", "null"] }
          }
        }
      }
    },
    "memory": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "learning_enabled": { "type": "boolean" },
        "index_path": { "type": "string" },
        "redact_secrets": { "type": "boolean" }
      }
    },
    "optimization": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": { "type": "boolean" },
        "codegraph": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "mode": { "type": "string" },
            "command": { "type": "string" },
            "index_marker": { "type": "string" },
            "auto_index": { "type": "boolean" }
          }
        },
        "rtk": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": { "type": "string" },
            "command": { "type": "string" }
          }
        },
        "caveman": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": { "type": "string" },
            "command": { "type": "string" },
            "apply_to": {
              "type": "array",
              "items": { "type": "string" }
            }
          }
        },
        "ignored_paths": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    }
  }
}
