{
  "type": "object",
  "required": [
    "version",
    "data_dir",
    "timezone",
    "providers",
    "retention",
    "paths",
    "admin"
  ],
  "properties": {
    "version": {
      "type": "number",
      "const": 1
    },
    "data_dir": {
      "type": "string",
      "minLength": 1
    },
    "timezone": {
      "type": "string",
      "minLength": 1
    },
    "telegram": {
      "type": "object",
      "required": [
        "process_bot_messages",
        "bucket_window_seconds",
        "chats"
      ],
      "properties": {
        "token": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "jar"
              ],
              "properties": {
                "jar": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,64}$"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "env"
              ],
              "properties": {
                "env": {
                  "type": "string",
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "command"
              ],
              "properties": {
                "command": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "minItems": 1
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "process_bot_messages": {
          "type": "boolean"
        },
        "sticker_trigger_enabled": {
          "type": "boolean"
        },
        "mention_typing_enabled": {
          "type": "boolean"
        },
        "bucket_window_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 300
        },
        "bucket_max_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 300
        },
        "bucket_bump_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 300
        },
        "participation": {
          "type": "object",
          "properties": {
            "ask_only": {
              "type": "boolean"
            },
            "active_windows": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "start",
                  "end"
                ],
                "properties": {
                  "start": {
                    "type": "string",
                    "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                  },
                  "end": {
                    "type": "string",
                    "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$"
                  },
                  "days": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 7
                    },
                    "minItems": 1,
                    "uniqueItems": true
                  }
                },
                "additionalProperties": false
              }
            },
            "trigger_keywords": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "attention_window_seconds": {
              "type": "integer",
              "minimum": 1,
              "maximum": 86400
            }
          },
          "additionalProperties": false
        },
        "proactive_reply": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "base_probability": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "increment": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "hard_pity": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          "additionalProperties": false
        },
        "decision_gate": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "description": "Ask the decision model before the batch reaches the main model; off by default."
            },
            "mode": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "shadow"
                },
                {
                  "type": "string",
                  "const": "enforce"
                }
              ],
              "description": "shadow records the decision without changing scheduling; enforce withholds a rejected batch from the main model."
            },
            "threshold": {
              "type": "number",
              "minimum": 0,
              "maximum": 1,
              "description": "The probability at or above which the batch is handed to the main model. Tied to model and instructions: changing either invalidates the default, which is 0.57."
            },
            "history_messages": {
              "type": "integer",
              "minimum": 0,
              "maximum": 50,
              "description": "How many earlier visible messages of the Conversation are sent as history; 0 sends none."
            },
            "pending_messages": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "description": "How many of the newest messages in the batch are sent as pending."
            },
            "instructions": {
              "type": "string",
              "minLength": 1,
              "description": "The question asked about the batch, replacing the default text. It must stay a yes/no question whose \"yes\" answer means the batch should be handed to the main model. Changing it invalidates the default threshold, so observe the gate in shadow mode again first. Supports {{ bot.name }} and {{ bot.username }}."
            },
            "model": {
              "type": "string",
              "minLength": 1,
              "description": "The decision model id sent in the request; the default is typesafe/jev-1.14."
            },
            "base_url": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048,
              "description": "The HTTPS API prefix the client appends /decisions to; https://openrouter.ai/api/alpha by default. Credentials, query and fragment are rejected."
            },
            "api_key": {
              "anyOf": [
                {
                  "type": "object",
                  "required": [
                    "jar"
                  ],
                  "properties": {
                    "jar": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "required": [
                    "env"
                  ],
                  "properties": {
                    "env": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "required": [
                    "command"
                  ],
                  "properties": {
                    "command": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "minItems": 1
                    }
                  },
                  "additionalProperties": false
                }
              ]
            },
            "timeout_ms": {
              "type": "integer",
              "minimum": 500,
              "maximum": 10000,
              "description": "The budget shared by credential resolution and the HTTP request; 3000 by default. A decision that exceeds it admits the batch."
            }
          },
          "additionalProperties": false
        },
        "chats": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "topic_ids": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1
                },
                "minItems": 1,
                "uniqueItems": true
              },
              "ignored_user_ids": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1
                },
                "uniqueItems": true
              },
              "timezone": {
                "type": "string",
                "minLength": 1
              },
              "instructions_file": {
                "type": "string",
                "minLength": 1
              },
              "group_memory": {
                "type": "object",
                "required": [
                  "enabled"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "idle_minutes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1440
                  },
                  "thirty_hour_clock": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "off"
                      },
                      {
                        "type": "string",
                        "const": "non_overlapping"
                      },
                      {
                        "type": "string",
                        "const": "overlapping"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "participation": {
                "type": "object",
                "properties": {
                  "ask_only": {
                    "type": "boolean"
                  },
                  "active_windows": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "start",
                        "end"
                      ],
                      "properties": {
                        "start": {
                          "type": "string",
                          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                        },
                        "end": {
                          "type": "string",
                          "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$"
                        },
                        "days": {
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7
                          },
                          "minItems": 1,
                          "uniqueItems": true
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "trigger_keywords": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "uniqueItems": true
                  },
                  "attention_window_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400
                  }
                },
                "additionalProperties": false
              },
              "proactive_reply": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "base_probability": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "increment": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "hard_pity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                },
                "additionalProperties": false
              },
              "decision_gate": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "Ask the decision model before the batch reaches the main model; off by default."
                  },
                  "mode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "shadow"
                      },
                      {
                        "type": "string",
                        "const": "enforce"
                      }
                    ],
                    "description": "shadow records the decision without changing scheduling; enforce withholds a rejected batch from the main model."
                  },
                  "threshold": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "The probability at or above which the batch is handed to the main model. Tied to model and instructions: changing either invalidates the default, which is 0.57."
                  },
                  "history_messages": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 50,
                    "description": "How many earlier visible messages of the Conversation are sent as history; 0 sends none."
                  },
                  "pending_messages": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "description": "How many of the newest messages in the batch are sent as pending."
                  },
                  "instructions": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The question asked about the batch, replacing the default text. It must stay a yes/no question whose \"yes\" answer means the batch should be handed to the main model. Changing it invalidates the default threshold, so observe the gate in shadow mode again first. Supports {{ bot.name }} and {{ bot.username }}."
                  }
                },
                "additionalProperties": false
              },
              "dictionary_injection_mode": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "off"
                  },
                  {
                    "type": "string",
                    "const": "on_demand"
                  },
                  {
                    "type": "string",
                    "const": "aggressive"
                  }
                ]
              },
              "mcp": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "server"
                  ],
                  "properties": {
                    "server": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
                    },
                    "tools": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "*"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "uniqueItems": true
                        }
                      ]
                    },
                    "tool_policies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "name",
                          "read_only",
                          "timeout_seconds"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "read_only": {
                            "type": "boolean"
                          },
                          "timeout_seconds": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              },
              "provider": {
                "type": "string",
                "minLength": 1
              },
              "model": {
                "type": "string",
                "minLength": 1
              },
              "thinking_level": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "off"
                  },
                  {
                    "type": "string",
                    "const": "minimal"
                  },
                  {
                    "type": "string",
                    "const": "low"
                  },
                  {
                    "type": "string",
                    "const": "medium"
                  },
                  {
                    "type": "string",
                    "const": "high"
                  },
                  {
                    "type": "string",
                    "const": "xhigh"
                  },
                  {
                    "type": "string",
                    "const": "max"
                  }
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "admins": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "uniqueItems": true
        },
        "sticker_sets": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "alias",
              "name"
            ],
            "properties": {
              "alias": {
                "type": "string",
                "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "note": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "providers": {
      "type": "object",
      "patternProperties": {
        "^.*$": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "kind",
                "provider",
                "api_key",
                "models"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "builtin"
                },
                "provider": {
                  "type": "string",
                  "minLength": 1
                },
                "api_key": {
                  "anyOf": [
                    {
                      "type": "object",
                      "required": [
                        "jar"
                      ],
                      "properties": {
                        "jar": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "env"
                      ],
                      "properties": {
                        "env": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "command"
                      ],
                      "properties": {
                        "command": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "minItems": 1
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "models": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "reasoning",
                      "input",
                      "context_window",
                      "max_tokens",
                      "cost"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "nickname": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "reasoning": {
                        "type": "boolean"
                      },
                      "thinking_levels": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "off"
                            },
                            {
                              "type": "string",
                              "const": "minimal"
                            },
                            {
                              "type": "string",
                              "const": "low"
                            },
                            {
                              "type": "string",
                              "const": "medium"
                            },
                            {
                              "type": "string",
                              "const": "high"
                            },
                            {
                              "type": "string",
                              "const": "xhigh"
                            },
                            {
                              "type": "string",
                              "const": "max"
                            }
                          ]
                        },
                        "minItems": 1,
                        "uniqueItems": true
                      },
                      "compat": {
                        "type": "object",
                        "properties": {
                          "supports_developer_role": {
                            "type": "boolean"
                          },
                          "thinking_format": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "openai"
                              },
                              {
                                "type": "string",
                                "const": "openrouter"
                              },
                              {
                                "type": "string",
                                "const": "deepseek"
                              },
                              {
                                "type": "string",
                                "const": "together"
                              },
                              {
                                "type": "string",
                                "const": "zai"
                              },
                              {
                                "type": "string",
                                "const": "qwen"
                              },
                              {
                                "type": "string",
                                "const": "string-thinking"
                              }
                            ]
                          },
                          "max_tokens_field": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "max_completion_tokens"
                              },
                              {
                                "type": "string",
                                "const": "max_tokens"
                              }
                            ]
                          },
                          "requires_reasoning_content": {
                            "type": "boolean"
                          },
                          "cache_control_format": {
                            "type": "string",
                            "const": "anthropic"
                          }
                        },
                        "additionalProperties": false
                      },
                      "tool_schema_keywords": {
                        "type": "string",
                        "const": "minimal"
                      },
                      "input": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "text"
                            },
                            {
                              "type": "string",
                              "const": "image"
                            }
                          ]
                        },
                        "minItems": 1,
                        "uniqueItems": true
                      },
                      "context_window": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "max_tokens": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "cost": {
                        "type": "object",
                        "required": [
                          "input",
                          "output",
                          "cache_read",
                          "cache_write"
                        ],
                        "properties": {
                          "input": {
                            "type": "number",
                            "minimum": 0
                          },
                          "output": {
                            "type": "number",
                            "minimum": 0
                          },
                          "cache_read": {
                            "type": "number",
                            "minimum": 0
                          },
                          "cache_write": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  }
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "kind",
                "base_url",
                "api",
                "api_key",
                "models"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "custom"
                },
                "base_url": {
                  "type": "string",
                  "minLength": 1
                },
                "api": {
                  "anyOf": [
                    {
                      "type": "string",
                      "const": "openai-responses"
                    },
                    {
                      "type": "string",
                      "const": "openai-completions"
                    },
                    {
                      "type": "string",
                      "const": "anthropic-messages"
                    },
                    {
                      "type": "string",
                      "const": "google-generative-ai"
                    }
                  ]
                },
                "api_key": {
                  "anyOf": [
                    {
                      "type": "object",
                      "required": [
                        "jar"
                      ],
                      "properties": {
                        "jar": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "env"
                      ],
                      "properties": {
                        "env": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "command"
                      ],
                      "properties": {
                        "command": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "minItems": 1
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "headers": {
                  "type": "object",
                  "patternProperties": {
                    "^.*$": {
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "jar"
                          ],
                          "properties": {
                            "jar": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "required": [
                            "env"
                          ],
                          "properties": {
                            "env": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "required": [
                            "command"
                          ],
                          "properties": {
                            "command": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            }
                          },
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "models": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "reasoning",
                      "input",
                      "context_window",
                      "max_tokens",
                      "cost"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "nickname": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "reasoning": {
                        "type": "boolean"
                      },
                      "thinking_levels": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "off"
                            },
                            {
                              "type": "string",
                              "const": "minimal"
                            },
                            {
                              "type": "string",
                              "const": "low"
                            },
                            {
                              "type": "string",
                              "const": "medium"
                            },
                            {
                              "type": "string",
                              "const": "high"
                            },
                            {
                              "type": "string",
                              "const": "xhigh"
                            },
                            {
                              "type": "string",
                              "const": "max"
                            }
                          ]
                        },
                        "minItems": 1,
                        "uniqueItems": true
                      },
                      "compat": {
                        "type": "object",
                        "properties": {
                          "supports_developer_role": {
                            "type": "boolean"
                          },
                          "thinking_format": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "openai"
                              },
                              {
                                "type": "string",
                                "const": "openrouter"
                              },
                              {
                                "type": "string",
                                "const": "deepseek"
                              },
                              {
                                "type": "string",
                                "const": "together"
                              },
                              {
                                "type": "string",
                                "const": "zai"
                              },
                              {
                                "type": "string",
                                "const": "qwen"
                              },
                              {
                                "type": "string",
                                "const": "string-thinking"
                              }
                            ]
                          },
                          "max_tokens_field": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "max_completion_tokens"
                              },
                              {
                                "type": "string",
                                "const": "max_tokens"
                              }
                            ]
                          },
                          "requires_reasoning_content": {
                            "type": "boolean"
                          },
                          "cache_control_format": {
                            "type": "string",
                            "const": "anthropic"
                          }
                        },
                        "additionalProperties": false
                      },
                      "tool_schema_keywords": {
                        "type": "string",
                        "const": "minimal"
                      },
                      "input": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "text"
                            },
                            {
                              "type": "string",
                              "const": "image"
                            }
                          ]
                        },
                        "minItems": 1,
                        "uniqueItems": true
                      },
                      "context_window": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "max_tokens": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "cost": {
                        "type": "object",
                        "required": [
                          "input",
                          "output",
                          "cache_read",
                          "cache_write"
                        ],
                        "properties": {
                          "input": {
                            "type": "number",
                            "minimum": 0
                          },
                          "output": {
                            "type": "number",
                            "minimum": 0
                          },
                          "cache_read": {
                            "type": "number",
                            "minimum": 0
                          },
                          "cache_write": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  }
                }
              },
              "additionalProperties": false
            }
          ]
        }
      }
    },
    "agent": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "provider": {
              "type": "string",
              "minLength": 1
            },
            "model": {
              "type": "string",
              "minLength": 1
            },
            "daily_budget": {
              "type": "object",
              "properties": {
                "max_tokens": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "additionalProperties": false
            },
            "thinking_level": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "off"
                },
                {
                  "type": "string",
                  "const": "minimal"
                },
                {
                  "type": "string",
                  "const": "low"
                },
                {
                  "type": "string",
                  "const": "medium"
                },
                {
                  "type": "string",
                  "const": "high"
                },
                {
                  "type": "string",
                  "const": "xhigh"
                },
                {
                  "type": "string",
                  "const": "max"
                }
              ]
            },
            "system_prompt_file": {
              "type": "string",
              "minLength": 1
            },
            "send_max_text_length": {
              "type": "integer",
              "minimum": 1,
              "maximum": 4096
            },
            "send_disallow_blank_lines": {
              "type": "boolean"
            },
            "max_concurrency": {
              "type": "integer",
              "minimum": 1
            },
            "context_stop_ratio": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 0.8
            },
            "history_messages": {
              "type": "integer",
              "minimum": 1
            },
            "memory_ttl_warning_days": {
              "type": "integer",
              "minimum": 1,
              "deprecated": true,
              "description": "Deprecated: still accepted but has no effect; remove the field."
            },
            "send_nudge_enabled": {
              "type": "boolean"
            },
            "send_barrier_enabled": {
              "type": "boolean"
            },
            "allow_reply_message_multiple_times": {
              "type": "boolean",
              "default": false
            },
            "send_duplicate_guard_enabled": {
              "type": "boolean",
              "default": true
            },
            "send_empty_text_strategy": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "reject"
                },
                {
                  "type": "string",
                  "const": "silent_success"
                },
                {
                  "type": "string",
                  "const": "random_text"
                }
              ]
            },
            "send_empty_text_fallback_enabled": {
              "type": "boolean",
              "default": false,
              "deprecated": true,
              "description": "Deprecated: has no effect; set send_empty_text_strategy to \"random_text\" for the old fallback behaviour."
            },
            "send_empty_text_fallback_texts": {
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 4096,
                "pattern": "^[^\\r\\n]*\\S[^\\r\\n]*$"
              },
              "minItems": 1
            },
            "context": {
              "type": "object",
              "properties": {
                "retained_sends_target": {
                  "type": "integer",
                  "minimum": 1
                },
                "retained_sends_max": {
                  "type": "integer",
                  "minimum": 2
                },
                "hard_token_ratio": {
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 0.8
                },
                "ref_ttl_hours": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 720
                },
                "idle_grace_seconds": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3600
                },
                "max_wall_clock_seconds": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 86400
                },
                "agent_cache_size": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 1024
                }
              },
              "additionalProperties": false
            },
            "rate_limits": {
              "type": "object",
              "properties": {
                "sends_per_window": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "window_seconds": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 86400
                },
                "turns_per_injection": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "vision": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "provider": {
              "type": "string",
              "minLength": 1
            },
            "model": {
              "type": "string",
              "minLength": 1
            },
            "thinking_level": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "off"
                },
                {
                  "type": "string",
                  "const": "minimal"
                },
                {
                  "type": "string",
                  "const": "low"
                },
                {
                  "type": "string",
                  "const": "medium"
                },
                {
                  "type": "string",
                  "const": "high"
                },
                {
                  "type": "string",
                  "const": "xhigh"
                },
                {
                  "type": "string",
                  "const": "max"
                }
              ]
            },
            "max_output_tokens": {
              "type": "integer",
              "minimum": 1
            },
            "max_concurrency": {
              "type": "integer",
              "minimum": 1
            },
            "background_sticker_concurrency": {
              "type": "number",
              "const": 1,
              "deprecated": true,
              "description": "Deprecated: still accepted but has no effect; remove the field."
            },
            "prompt_version": {
              "type": "integer",
              "minimum": 1
            },
            "daily_budget": {
              "type": "object",
              "properties": {
                "max_tokens": {
                  "type": "integer",
                  "minimum": 1
                },
                "max_images": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "image": {
      "type": "object",
      "required": [
        "credentials",
        "models"
      ],
      "properties": {
        "credentials": {
          "type": "object",
          "patternProperties": {
            "^[a-zA-Z0-9_-]{1,80}$": {
              "anyOf": [
                {
                  "type": "object",
                  "required": [
                    "jar"
                  ],
                  "properties": {
                    "jar": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "required": [
                    "env"
                  ],
                  "properties": {
                    "env": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "required": [
                    "command"
                  ],
                  "properties": {
                    "command": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "minItems": 1
                    }
                  },
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "models": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "name",
              "provider",
              "upstreamModel",
              "credentialRef",
              "providerTag",
              "capabilities"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,80}$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "description": {
                "type": "string",
                "maxLength": 1000
              },
              "provider": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "upstreamModel": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+$"
              },
              "credentialRef": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,80}$"
              },
              "providerTag": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{1,80}(?:\\/[a-zA-Z0-9_-]{1,80})?$"
              },
              "capabilities": {
                "type": "object",
                "required": [
                  "imageInput",
                  "maxInputImages",
                  "maxOutputs",
                  "aspectRatios",
                  "resolutionClasses"
                ],
                "properties": {
                  "imageInput": {
                    "type": "boolean"
                  },
                  "maxInputImages": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 16
                  },
                  "maxOutputs": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "aspectRatios": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  },
                  "resolutionClasses": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "maxItems": 64
        }
      },
      "additionalProperties": false
    },
    "dictionary": {
      "type": "object",
      "properties": {
        "injection_mode": {
          "anyOf": [
            {
              "type": "string",
              "const": "off"
            },
            {
              "type": "string",
              "const": "on_demand"
            },
            {
              "type": "string",
              "const": "aggressive"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "web_search": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "engines": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "provider"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]{0,31}$"
              },
              "provider": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]{0,63}$"
              },
              "enabled": {
                "type": "boolean"
              },
              "endpoint": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048
              },
              "api_key": {
                "anyOf": [
                  {
                    "type": "object",
                    "required": [
                      "jar"
                    ],
                    "properties": {
                      "jar": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$"
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "required": [
                      "env"
                    ],
                    "properties": {
                      "env": {
                        "type": "string",
                        "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "required": [
                      "command"
                    ],
                    "properties": {
                      "command": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "minItems": 1
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "results": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10
              },
              "timeout_seconds": {
                "type": "integer",
                "minimum": 5,
                "maximum": 30
              },
              "note": {
                "type": "string",
                "maxLength": 1000
              }
            },
            "additionalProperties": false
          },
          "maxItems": 32
        },
        "url_filters": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "maxItems": 50
        }
      },
      "additionalProperties": false
    },
    "tool_model": {
      "type": "object",
      "required": [
        "provider",
        "model",
        "thinking_level"
      ],
      "properties": {
        "provider": {
          "type": "string",
          "minLength": 1
        },
        "model": {
          "type": "string",
          "minLength": 1
        },
        "thinking_level": {
          "anyOf": [
            {
              "type": "string",
              "const": "off"
            },
            {
              "type": "string",
              "const": "minimal"
            },
            {
              "type": "string",
              "const": "low"
            },
            {
              "type": "string",
              "const": "medium"
            },
            {
              "type": "string",
              "const": "high"
            },
            {
              "type": "string",
              "const": "xhigh"
            },
            {
              "type": "string",
              "const": "max"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "retention": {
      "type": "object",
      "required": [
        "online_days",
        "backup_copies"
      ],
      "properties": {
        "online_days": {
          "type": "integer",
          "minimum": 1
        },
        "backup_copies": {
          "type": "integer",
          "minimum": 1
        },
        "warning_read_days": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "paths": {
      "type": "object",
      "required": [
        "database",
        "media_cache",
        "backups"
      ],
      "properties": {
        "database": {
          "type": "string",
          "minLength": 1
        },
        "media_cache": {
          "type": "string",
          "minLength": 1
        },
        "backups": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "mcp": {
      "type": "object",
      "required": [
        "servers"
      ],
      "properties": {
        "servers": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "alias",
                  "transport",
                  "command",
                  "tools",
                  "payload_max_bytes",
                  "result_max_bytes"
                ],
                "properties": {
                  "alias": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
                  },
                  "transport": {
                    "type": "string",
                    "const": "stdio"
                  },
                  "command": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "tools": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "*"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      }
                    ]
                  },
                  "payload_max_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1048576
                  },
                  "result_max_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 32768
                  },
                  "env": {
                    "type": "object",
                    "patternProperties": {
                      "^.*$": {
                        "anyOf": [
                          {
                            "type": "object",
                            "required": [
                              "jar"
                            ],
                            "properties": {
                              "jar": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "env"
                            ],
                            "properties": {
                              "env": {
                                "type": "string",
                                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "command"
                            ],
                            "properties": {
                              "command": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "minItems": 1
                              }
                            },
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "tool_policies": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "name",
                        "read_only",
                        "timeout_seconds"
                      ],
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "read_only": {
                          "type": "boolean"
                        },
                        "timeout_seconds": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "default_tool_policy": {
                    "type": "object",
                    "required": [
                      "read_only",
                      "timeout_seconds"
                    ],
                    "properties": {
                      "read_only": {
                        "type": "boolean"
                      },
                      "timeout_seconds": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      }
                    },
                    "additionalProperties": false
                  },
                  "exposure": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "direct"
                      },
                      {
                        "type": "string",
                        "const": "progressive"
                      }
                    ]
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "skills": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "alias",
                  "transport",
                  "url",
                  "follow_redirects",
                  "tools",
                  "payload_max_bytes",
                  "result_max_bytes"
                ],
                "properties": {
                  "alias": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$"
                  },
                  "transport": {
                    "type": "string",
                    "const": "streamable_http"
                  },
                  "url": {
                    "type": "string",
                    "minLength": 1
                  },
                  "follow_redirects": {
                    "type": "boolean",
                    "const": false
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "tools": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "*"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uniqueItems": true
                      }
                    ]
                  },
                  "payload_max_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1048576
                  },
                  "result_max_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 32768
                  },
                  "headers": {
                    "type": "object",
                    "patternProperties": {
                      "^.*$": {
                        "anyOf": [
                          {
                            "type": "object",
                            "required": [
                              "jar"
                            ],
                            "properties": {
                              "jar": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "env"
                            ],
                            "properties": {
                              "env": {
                                "type": "string",
                                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "command"
                            ],
                            "properties": {
                              "command": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "minItems": 1
                              }
                            },
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "tool_policies": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "name",
                        "read_only",
                        "timeout_seconds"
                      ],
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "read_only": {
                          "type": "boolean"
                        },
                        "timeout_seconds": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "default_tool_policy": {
                    "type": "object",
                    "required": [
                      "read_only",
                      "timeout_seconds"
                    ],
                    "properties": {
                      "read_only": {
                        "type": "boolean"
                      },
                      "timeout_seconds": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      }
                    },
                    "additionalProperties": false
                  },
                  "exposure": {
                    "anyOf": [
                      {
                        "type": "string",
                        "const": "direct"
                      },
                      {
                        "type": "string",
                        "const": "progressive"
                      }
                    ]
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "skills": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            ]
          }
        }
      },
      "additionalProperties": false
    },
    "admin": {
      "type": "object",
      "required": [
        "host",
        "port",
        "session_ttl_hours"
      ],
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "host": {
          "type": "string",
          "minLength": 1
        },
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535
        },
        "session_ttl_hours": {
          "type": "integer",
          "minimum": 1,
          "maximum": 720
        },
        "static_dir": {
          "type": "string",
          "minLength": 1
        },
        "public_url": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        }
      },
      "additionalProperties": false
    },
    "developer": {
      "type": "object",
      "properties": {
        "record_model_payloads": {
          "type": "boolean",
          "default": false
        },
        "record_agent_thinking": {
          "type": "boolean",
          "default": false
        }
      },
      "additionalProperties": false
    },
    "models_dev": {
      "type": "object",
      "properties": {
        "api_url": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        }
      },
      "additionalProperties": false
    },
    "web_fetch": {
      "type": "object",
      "properties": {
        "allow_proxy_synthetic_addresses": {
          "type": "boolean"
        },
        "dangerously_allow_all_ip_addresses": {
          "type": "boolean"
        },
        "accept_markdown": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
