{
    "swagger": "2.0",
    "info": {
        "title": "Memoh API",
        "contact": {},
        "version": "1.0.0"
    },
    "paths": {
        "/auth/login": {
            "post": {
                "description": "Validate user credentials and issue a JWT",
                "tags": [
                    "auth"
                ],
                "summary": "Login",
                "parameters": [
                    {
                        "description": "Login request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.LoginRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.LoginResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/auth/refresh": {
            "post": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Issue a new JWT using the existing claims with updated expiration",
                "tags": [
                    "auth"
                ],
                "summary": "Refresh Token",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.RefreshResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots": {
            "get": {
                "description": "List bots accessible to current user (admin can specify owner_id)",
                "tags": [
                    "bots"
                ],
                "summary": "List bots",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Owner user ID (admin only)",
                        "name": "owner_id",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/bots.ListBotsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a bot user owned by current user (or admin-specified owner)",
                "tags": [
                    "bots"
                ],
                "summary": "Create bot user",
                "parameters": [
                    {
                        "description": "Bot payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/bots.CreateBotRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/bots.Bot"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/access/channel_identities": {
            "get": {
                "description": "Search locally observed channel identity candidates for bot access control",
                "tags": [
                    "bots"
                ],
                "summary": "Search access channel identities",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Search query",
                        "name": "q",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "Max results",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.ChannelIdentityCandidateListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/access/channel_identities/{channel_identity_id}/conversations": {
            "get": {
                "description": "List previously observed conversation candidates for a channel identity under a bot",
                "tags": [
                    "bots"
                ],
                "summary": "List observed conversations for a channel identity",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel Identity ID",
                        "name": "channel_identity_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.ObservedConversationCandidateListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/access/users": {
            "get": {
                "description": "Search user candidates for bot access control",
                "tags": [
                    "bots"
                ],
                "summary": "Search access users",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Search query",
                        "name": "q",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "Max results",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.UserCandidateListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/blacklist": {
            "get": {
                "description": "List guest deny rules for chat trigger",
                "tags": [
                    "bots"
                ],
                "summary": "List bot blacklist",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.ListRulesResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Add a guest deny rule for chat trigger",
                "tags": [
                    "bots"
                ],
                "summary": "Upsert bot blacklist entry",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Blacklist payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/acl.UpsertRuleRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.Rule"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/blacklist/{rule_id}": {
            "delete": {
                "description": "Delete a guest deny rule by rule ID",
                "tags": [
                    "bots"
                ],
                "summary": "Delete bot blacklist entry",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Rule ID",
                        "name": "rule_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/cli/messages": {
            "post": {
                "description": "Post a user message (with optional attachments) through the local channel pipeline.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "local-channel"
                ],
                "summary": "Send a message to a local channel",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Message payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.LocalChannelMessageRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/cli/stream": {
            "get": {
                "description": "Open a persistent SSE connection to receive real-time stream events for the given bot.",
                "produces": [
                    "text/event-stream"
                ],
                "tags": [
                    "local-channel"
                ],
                "summary": "Subscribe to local channel events via SSE",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "SSE stream",
                        "schema": {
                            "type": "string"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/cli/ws": {
            "get": {
                "description": "Upgrade to WebSocket for bidirectional chat streaming with abort support.",
                "tags": [
                    "local-channel"
                ],
                "summary": "WebSocket chat endpoint",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "101": {
                        "description": "Switching Protocols",
                        "schema": {
                            "type": "string"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/compaction/logs": {
            "get": {
                "description": "List compaction logs for a bot",
                "tags": [
                    "compaction"
                ],
                "summary": "List compaction logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Before timestamp (RFC3339)",
                        "name": "before",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 50,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/compaction.ListLogsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete all compaction logs for a bot",
                "tags": [
                    "compaction"
                ],
                "summary": "Delete compaction logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container": {
            "get": {
                "tags": [
                    "containerd"
                ],
                "summary": "Get container info for bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.GetContainerResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Create and start MCP container for bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Create container payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.CreateContainerRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "SSE stream of container creation events",
                        "schema": {
                            "$ref": "#/definitions/handlers.CreateContainerResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "containerd"
                ],
                "summary": "Delete MCP container for bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "boolean",
                        "description": "Export /data before deletion",
                        "name": "preserve_data",
                        "in": "query"
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/data/export": {
            "post": {
                "produces": [
                    "application/gzip"
                ],
                "tags": [
                    "containerd"
                ],
                "summary": "Export container /data as a tar.gz archive",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "file"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/data/import": {
            "post": {
                "consumes": [
                    "multipart/form-data"
                ],
                "tags": [
                    "containerd"
                ],
                "summary": "Import a tar.gz archive into container /data",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "tar.gz archive",
                        "name": "file",
                        "in": "formData",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/data/restore": {
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Restore previously preserved data into container",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs": {
            "get": {
                "description": "Returns metadata about a file or directory at the given container path",
                "tags": [
                    "containerd"
                ],
                "summary": "Get file or directory info",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Container path",
                        "name": "path",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.FSFileInfo"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/delete": {
            "post": {
                "description": "Deletes a file or directory at the given container path",
                "tags": [
                    "containerd"
                ],
                "summary": "Delete a file or directory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Delete request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.FSDeleteRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.fsOpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/download": {
            "get": {
                "description": "Downloads a file from the container with appropriate Content-Type",
                "produces": [
                    "application/octet-stream"
                ],
                "tags": [
                    "containerd"
                ],
                "summary": "Download a file as binary stream",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Container file path",
                        "name": "path",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "file"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/list": {
            "get": {
                "description": "Lists files and directories at the given container path",
                "tags": [
                    "containerd"
                ],
                "summary": "List directory contents",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Container directory path",
                        "name": "path",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.FSListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/mkdir": {
            "post": {
                "description": "Creates a directory (and parents) at the given container path",
                "tags": [
                    "containerd"
                ],
                "summary": "Create a directory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Mkdir request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.FSMkdirRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.fsOpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/read": {
            "get": {
                "description": "Reads the content of a file and returns it as a JSON string",
                "tags": [
                    "containerd"
                ],
                "summary": "Read file content as text",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Container file path",
                        "name": "path",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.FSReadResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/rename": {
            "post": {
                "description": "Renames or moves a file/directory from oldPath to newPath",
                "tags": [
                    "containerd"
                ],
                "summary": "Rename or move a file/directory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Rename request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.FSRenameRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.fsOpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/upload": {
            "post": {
                "description": "Uploads a binary file to the given container path",
                "consumes": [
                    "multipart/form-data"
                ],
                "tags": [
                    "containerd"
                ],
                "summary": "Upload a file via multipart form",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Destination container path",
                        "name": "path",
                        "in": "formData",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "File to upload",
                        "name": "file",
                        "in": "formData",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.FSUploadResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/fs/write": {
            "post": {
                "description": "Creates or overwrites a file with the provided text content",
                "tags": [
                    "containerd"
                ],
                "summary": "Write text content to a file",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Write request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.FSWriteRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.fsOpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/skills": {
            "get": {
                "tags": [
                    "containerd"
                ],
                "summary": "List skills from data directory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.SkillsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Upload skills into data directory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Skills payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.SkillsUpsertRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.skillsOpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "containerd"
                ],
                "summary": "Delete skills from data directory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Delete skills payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.SkillsDeleteRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.skillsOpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/snapshots": {
            "get": {
                "tags": [
                    "containerd"
                ],
                "summary": "List snapshots",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Snapshotter name",
                        "name": "snapshotter",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.ListSnapshotsResponse"
                        }
                    },
                    "501": {
                        "description": "Snapshots currently not supported on this backend",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Create container snapshot for bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Create snapshot payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.CreateSnapshotRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.CreateSnapshotResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "501": {
                        "description": "Snapshots currently not supported on this backend",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/snapshots/rollback": {
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Rollback container to a previous snapshot version",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Rollback payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.RollbackRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/start": {
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Start container task for bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/stop": {
            "post": {
                "tags": [
                    "containerd"
                ],
                "summary": "Stop container task for bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/terminal": {
            "get": {
                "tags": [
                    "containerd"
                ],
                "summary": "Check terminal availability for bot container",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.terminalInfoResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/container/terminal/ws": {
            "get": {
                "tags": [
                    "containerd"
                ],
                "summary": "Interactive WebSocket terminal for bot container",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 80,
                        "description": "Initial terminal columns",
                        "name": "cols",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 24,
                        "description": "Initial terminal rows",
                        "name": "rows",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Auth token",
                        "name": "token",
                        "in": "query"
                    }
                ],
                "responses": {
                    "101": {
                        "description": "WebSocket upgrade"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/email-bindings": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-bindings"
                ],
                "summary": "List email bindings for a bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/email.BindingResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-bindings"
                ],
                "summary": "Bind an email provider to a bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Binding configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/email.CreateBindingRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/email.BindingResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/email-bindings/{id}": {
            "put": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-bindings"
                ],
                "summary": "Update an email binding",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Binding ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated binding",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/email.UpdateBindingRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/email.BindingResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "email-bindings"
                ],
                "summary": "Remove an email binding",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Binding ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/email-outbox": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-outbox"
                ],
                "summary": "List outbox emails for a bot (audit)",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 20,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 0,
                        "description": "Offset",
                        "name": "offset",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/email-outbox/{id}": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-outbox"
                ],
                "summary": "Get outbox email detail",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Email ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/email.OutboxItemResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/heartbeat/logs": {
            "get": {
                "description": "List heartbeat execution logs for a bot",
                "tags": [
                    "heartbeat"
                ],
                "summary": "List heartbeat logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Before timestamp (RFC3339)",
                        "name": "before",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 50,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/heartbeat.ListLogsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete all heartbeat execution logs for a bot",
                "tags": [
                    "heartbeat"
                ],
                "summary": "Delete heartbeat logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp": {
            "get": {
                "description": "List MCP connections for a bot",
                "tags": [
                    "mcp"
                ],
                "summary": "List MCP connections",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/mcp.ListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a MCP connection for a bot",
                "tags": [
                    "mcp"
                ],
                "summary": "Create MCP connection",
                "parameters": [
                    {
                        "description": "MCP payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mcp.UpsertRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/github_com_memohai_memoh_internal_mcp.Connection"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp-ops/batch-delete": {
            "post": {
                "description": "Delete multiple MCP connections by IDs.",
                "tags": [
                    "mcp"
                ],
                "summary": "Batch delete MCP connections",
                "parameters": [
                    {
                        "description": "IDs to delete",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.BatchDeleteRequest"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp-stdio": {
            "post": {
                "description": "Start a stdio MCP process in the bot container and expose it as MCP HTTP endpoint.",
                "tags": [
                    "containerd"
                ],
                "summary": "Create MCP stdio proxy",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Stdio MCP payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.MCPStdioRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.MCPStdioResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp-stdio/{connection_id}": {
            "post": {
                "description": "Proxies MCP JSON-RPC requests to a stdio MCP process in the container.",
                "tags": [
                    "containerd"
                ],
                "summary": "MCP stdio proxy (JSON-RPC)",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Connection ID",
                        "name": "connection_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "JSON-RPC request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "JSON-RPC response: {jsonrpc,id,result|error}",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/export": {
            "get": {
                "description": "Export all MCP connections for a bot in standard mcpServers format.",
                "tags": [
                    "mcp"
                ],
                "summary": "Export MCP connections",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/mcp.ExportResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/import": {
            "put": {
                "description": "Batch import MCP connections from standard mcpServers format. Existing connections (matched by name) get config updated with is_active preserved. New connections are created as active.",
                "tags": [
                    "mcp"
                ],
                "summary": "Import MCP connections",
                "parameters": [
                    {
                        "description": "mcpServers dict",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mcp.ImportRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/mcp.ListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}": {
            "get": {
                "description": "Get a MCP connection by ID",
                "tags": [
                    "mcp"
                ],
                "summary": "Get MCP connection",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/github_com_memohai_memoh_internal_mcp.Connection"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update a MCP connection by ID",
                "tags": [
                    "mcp"
                ],
                "summary": "Update MCP connection",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "MCP payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mcp.UpsertRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/github_com_memohai_memoh_internal_mcp.Connection"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete a MCP connection by ID",
                "tags": [
                    "mcp"
                ],
                "summary": "Delete MCP connection",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}/oauth/authorize": {
            "post": {
                "description": "Generate PKCE and return authorization URL for the user to authorize",
                "tags": [
                    "mcp"
                ],
                "summary": "Start OAuth authorization flow",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP connection ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Optional client_id",
                        "name": "payload",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/handlers.oauthAuthorizeRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/mcp.AuthorizeResult"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}/oauth/discover": {
            "post": {
                "description": "Probe MCP server URL for OAuth requirements and discover authorization server metadata",
                "tags": [
                    "mcp"
                ],
                "summary": "Discover OAuth configuration for MCP server",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP connection ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Optional URL override",
                        "name": "payload",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/handlers.oauthDiscoverRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/mcp.DiscoveryResult"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}/oauth/exchange": {
            "post": {
                "description": "Frontend callback page calls this to exchange the authorization code for access/refresh tokens",
                "tags": [
                    "mcp"
                ],
                "summary": "Exchange OAuth authorization code for tokens",
                "parameters": [
                    {
                        "description": "Authorization code and state",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.oauthExchangeRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "boolean"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}/oauth/status": {
            "get": {
                "description": "Returns the current OAuth status including whether tokens are available",
                "tags": [
                    "mcp"
                ],
                "summary": "Get OAuth status for MCP connection",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP connection ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/mcp.OAuthStatus"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}/oauth/token": {
            "delete": {
                "description": "Clears stored OAuth tokens",
                "tags": [
                    "mcp"
                ],
                "summary": "Revoke OAuth tokens for MCP connection",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP connection ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/mcp/{id}/probe": {
            "post": {
                "description": "Probe a MCP connection to discover tools and verify connectivity",
                "tags": [
                    "mcp"
                ],
                "summary": "Probe MCP connection",
                "parameters": [
                    {
                        "type": "string",
                        "description": "MCP connection ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.ProbeResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory": {
            "get": {
                "description": "List all memories in the bot-shared namespace",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Get all memories",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "boolean",
                        "description": "Skip optional stats in memory search response",
                        "name": "no_stats",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.SearchResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Add memory into the bot-shared namespace",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Add memory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Memory add payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.memoryAddPayload"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.SearchResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete specific memories by IDs, or delete all memories if no IDs are provided",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Delete memories",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Optional: specify memory_ids to delete; if omitted, deletes all",
                        "name": "payload",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/handlers.memoryDeletePayload"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.DeleteResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory/compact": {
            "post": {
                "description": "Consolidate memories by merging similar/redundant entries using LLM.\n\n**ratio** (required, range (0,1]):\n- 0.8 = light compression, mostly dedup, keep ~80% of entries\n- 0.5 = moderate compression, merge similar facts, keep ~50%\n- 0.3 = aggressive compression, heavily consolidate, keep ~30%\n\n**decay_days** (optional): enable time decay — memories older than N days are treated as low priority and more likely to be merged/dropped.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Compact memories",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "ratio (0,1] required; decay_days optional",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.memoryCompactPayload"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.CompactResult"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory/rebuild": {
            "post": {
                "description": "Read memory files from the container filesystem (source of truth) and restore missing entries to memory storage",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Rebuild memories from filesystem",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.RebuildResult"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory/search": {
            "post": {
                "description": "Search memory in the bot-shared namespace",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Search memory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Memory search payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.memorySearchPayload"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.SearchResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory/status": {
            "get": {
                "description": "Get the resolved memory runtime status for a bot, including index health and source counts",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Get memory runtime status",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.MemoryStatusResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory/usage": {
            "get": {
                "description": "Query the estimated storage usage of current memories",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Get memory usage",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.UsageResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/memory/{id}": {
            "delete": {
                "description": "Delete a single memory by its ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory"
                ],
                "summary": "Delete a single memory",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Memory ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.DeleteResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/messages": {
            "get": {
                "description": "List messages for a bot history with optional pagination",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "messages"
                ],
                "summary": "List bot history messages",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Before",
                        "name": "before",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/definitions/message.Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Clear all persisted bot-level history messages",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "messages"
                ],
                "summary": "Delete all bot history messages",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/schedule": {
            "get": {
                "description": "List schedules for current user",
                "tags": [
                    "schedule"
                ],
                "summary": "List schedules",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schedule.ListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a schedule for current user",
                "tags": [
                    "schedule"
                ],
                "summary": "Create schedule",
                "parameters": [
                    {
                        "description": "Schedule payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schedule.CreateRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/schedule.Schedule"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/schedule/logs": {
            "get": {
                "description": "List schedule execution logs for a bot",
                "tags": [
                    "schedule"
                ],
                "summary": "List schedule logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Before timestamp (RFC3339)",
                        "name": "before",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 50,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schedule.ListLogsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete all schedule execution logs for a bot",
                "tags": [
                    "schedule"
                ],
                "summary": "Delete schedule logs",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/schedule/{id}": {
            "get": {
                "description": "Get a schedule by ID",
                "tags": [
                    "schedule"
                ],
                "summary": "Get schedule",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Schedule ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schedule.Schedule"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update a schedule by ID",
                "tags": [
                    "schedule"
                ],
                "summary": "Update schedule",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Schedule ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Schedule payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schedule.UpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schedule.Schedule"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete a schedule by ID",
                "tags": [
                    "schedule"
                ],
                "summary": "Delete schedule",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Schedule ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/schedule/{id}/logs": {
            "get": {
                "description": "List execution logs for a specific schedule",
                "tags": [
                    "schedule"
                ],
                "summary": "List schedule logs by schedule",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Schedule ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Before timestamp (RFC3339)",
                        "name": "before",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 50,
                        "description": "Limit",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schedule.ListLogsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/sessions": {
            "get": {
                "tags": [
                    "sessions"
                ],
                "summary": "List bot sessions",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/definitions/session.Session"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "sessions"
                ],
                "summary": "Create a new chat session",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Session data",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.createSessionRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/session.Session"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/sessions/{session_id}": {
            "get": {
                "tags": [
                    "sessions"
                ],
                "summary": "Get a session by ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Session ID",
                        "name": "session_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/session.Session"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "sessions"
                ],
                "summary": "Soft-delete a session",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Session ID",
                        "name": "session_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "sessions"
                ],
                "summary": "Update a session",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Session ID",
                        "name": "session_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Fields to update",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.updateSessionRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/session.Session"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/settings": {
            "get": {
                "description": "Get agent settings for current user",
                "tags": [
                    "settings"
                ],
                "summary": "Get user settings",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/settings.Settings"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update or create agent settings for current user",
                "tags": [
                    "settings"
                ],
                "summary": "Update user settings",
                "parameters": [
                    {
                        "description": "Settings payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/settings.UpsertRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/settings.Settings"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Update or create agent settings for current user",
                "tags": [
                    "settings"
                ],
                "summary": "Update user settings",
                "parameters": [
                    {
                        "description": "Settings payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/settings.UpsertRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/settings.Settings"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Remove agent settings for current user",
                "tags": [
                    "settings"
                ],
                "summary": "Delete user settings",
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/token-usage": {
            "get": {
                "description": "Get daily aggregated token usage for a bot, split by chat, heartbeat, and schedule session types, with optional model filter and per-model breakdown",
                "tags": [
                    "token-usage"
                ],
                "summary": "Get token usage statistics",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Start date (YYYY-MM-DD)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End date exclusive (YYYY-MM-DD)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Optional model UUID to filter by",
                        "name": "model_id",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.TokenUsageResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/tools": {
            "post": {
                "description": "MCP endpoint for tool discovery and invocation.",
                "tags": [
                    "containerd"
                ],
                "summary": "Unified MCP tools gateway",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "JSON-RPC request",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "JSON-RPC response: {jsonrpc,id,result|error}",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/tts/synthesize": {
            "post": {
                "description": "Stream-synthesize text using the bot's configured TTS model, write to temp file",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "bots"
                ],
                "summary": "Synthesize speech for a bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Text to synthesize",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.synthesizeRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.synthesizeResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/web/messages": {
            "post": {
                "description": "Post a user message (with optional attachments) through the local channel pipeline.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "local-channel"
                ],
                "summary": "Send a message to a local channel",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Message payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.LocalChannelMessageRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/web/stream": {
            "get": {
                "description": "Open a persistent SSE connection to receive real-time stream events for the given bot.",
                "produces": [
                    "text/event-stream"
                ],
                "tags": [
                    "local-channel"
                ],
                "summary": "Subscribe to local channel events via SSE",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "SSE stream",
                        "schema": {
                            "type": "string"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/web/ws": {
            "get": {
                "description": "Upgrade to WebSocket for bidirectional chat streaming with abort support.",
                "tags": [
                    "local-channel"
                ],
                "summary": "WebSocket chat endpoint",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "101": {
                        "description": "Switching Protocols",
                        "schema": {
                            "type": "string"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/whitelist": {
            "get": {
                "description": "List guest allow rules for chat trigger",
                "tags": [
                    "bots"
                ],
                "summary": "List bot whitelist",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.ListRulesResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Add a guest allow rule for chat trigger",
                "tags": [
                    "bots"
                ],
                "summary": "Upsert bot whitelist entry",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Whitelist payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/acl.UpsertRuleRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/acl.Rule"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{bot_id}/whitelist/{rule_id}": {
            "delete": {
                "description": "Delete a guest allow rule by rule ID",
                "tags": [
                    "bots"
                ],
                "summary": "Delete bot whitelist entry",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "bot_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Rule ID",
                        "name": "rule_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}": {
            "get": {
                "description": "Get a bot by ID (owner/admin only)",
                "tags": [
                    "bots"
                ],
                "summary": "Get bot details",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/bots.Bot"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update bot profile (owner/admin only)",
                "tags": [
                    "bots"
                ],
                "summary": "Update bot details",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Bot update payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/bots.UpdateBotRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/bots.Bot"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete a bot user (owner/admin only)",
                "tags": [
                    "bots"
                ],
                "summary": "Delete bot",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}/channel/weixin/qr/poll": {
            "post": {
                "description": "Long-poll the QR code scan status. On confirmed, auto-saves credentials.",
                "tags": [
                    "bots"
                ],
                "summary": "Poll WeChat QR login status",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "QR code to poll",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/weixin.QRPollRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/weixin.QRPollResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "/bots/{id}/channel/weixin/qr/start": {
            "post": {
                "description": "Fetch a QR code from WeChat for scanning",
                "tags": [
                    "bots"
                ],
                "summary": "Start WeChat QR login",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Optional base URL override",
                        "name": "payload",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/weixin.QRStartRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/weixin.QRStartResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "/bots/{id}/channel/{platform}": {
            "get": {
                "description": "Get bot channel configuration",
                "tags": [
                    "bots"
                ],
                "summary": "Get bot channel config",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/channel.ChannelConfig"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update bot channel configuration",
                "tags": [
                    "bots"
                ],
                "summary": "Update bot channel config",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Channel config payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/channel.UpsertConfigRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/channel.ChannelConfig"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Remove bot channel configuration",
                "tags": [
                    "bots"
                ],
                "summary": "Delete bot channel config",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}/channel/{platform}/send": {
            "post": {
                "description": "Send a message using bot channel configuration",
                "tags": [
                    "bots"
                ],
                "summary": "Send message via bot channel",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Send payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/channel.SendRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}/channel/{platform}/send_chat": {
            "post": {
                "description": "Send a message using a session-scoped token (reply only)",
                "tags": [
                    "bots"
                ],
                "summary": "Send message via bot channel session token",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Send payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/channel.SendRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}/channel/{platform}/status": {
            "patch": {
                "description": "Update bot channel enabled/disabled status",
                "tags": [
                    "bots"
                ],
                "summary": "Update bot channel status",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Channel status payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/channel.UpdateChannelStatusRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/channel.ChannelConfig"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}/checks": {
            "get": {
                "description": "Evaluate bot attached resource checks in runtime",
                "tags": [
                    "bots"
                ],
                "summary": "List bot runtime checks",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/bots.ListChecksResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/bots/{id}/owner": {
            "put": {
                "description": "Transfer bot ownership to another human user",
                "tags": [
                    "bots"
                ],
                "summary": "Transfer bot owner (admin only)",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bot ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Transfer payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/bots.TransferBotRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/bots.Bot"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/browser-contexts": {
            "get": {
                "description": "List all browser context configurations",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "browser-contexts"
                ],
                "summary": "List browser contexts",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/browsercontexts.BrowserContext"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a browser context configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "browser-contexts"
                ],
                "summary": "Create a browser context",
                "parameters": [
                    {
                        "description": "Browser context configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/browsercontexts.CreateRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/browsercontexts.BrowserContext"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/browser-contexts/cores": {
            "get": {
                "description": "Get the list of browser cores available in the Browser Gateway container",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "browser-contexts"
                ],
                "summary": "Get available browser cores",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.BrowserCoresResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/browser-contexts/{id}": {
            "get": {
                "description": "Get browser context by ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "browser-contexts"
                ],
                "summary": "Get a browser context",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Browser Context ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/browsercontexts.BrowserContext"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update browser context by ID",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "browser-contexts"
                ],
                "summary": "Update a browser context",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Browser Context ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/browsercontexts.UpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/browsercontexts.BrowserContext"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete browser context by ID",
                "tags": [
                    "browser-contexts"
                ],
                "summary": "Delete a browser context",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Browser Context ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/channels": {
            "get": {
                "description": "List channel meta information including capabilities and schemas",
                "tags": [
                    "channel"
                ],
                "summary": "List channel capabilities and schemas",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/handlers.ChannelMeta"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/channels/{platform}": {
            "get": {
                "description": "Get channel meta information including capabilities and schemas",
                "tags": [
                    "channel"
                ],
                "summary": "Get channel capabilities and schemas",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.ChannelMeta"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email-providers": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-providers"
                ],
                "summary": "List email providers",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider type filter",
                        "name": "provider",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/email.ProviderResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-providers"
                ],
                "summary": "Create an email provider",
                "parameters": [
                    {
                        "description": "Email provider configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/email.CreateProviderRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/email.ProviderResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email-providers/meta": {
            "get": {
                "description": "List available email provider types and config schemas",
                "tags": [
                    "email-providers"
                ],
                "summary": "List email provider metadata",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/email.ProviderMeta"
                            }
                        }
                    }
                }
            }
        },
        "/email-providers/{id}": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-providers"
                ],
                "summary": "Get an email provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/email.ProviderResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "email-providers"
                ],
                "summary": "Update an email provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/email.UpdateProviderRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/email.ProviderResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "email-providers"
                ],
                "summary": "Delete an email provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email-providers/{id}/oauth/authorize": {
            "get": {
                "description": "Returns the authorization URL to redirect the user to",
                "tags": [
                    "email-oauth"
                ],
                "summary": "Start OAuth2 authorization for an email provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Email provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email-providers/{id}/oauth/status": {
            "get": {
                "tags": [
                    "email-oauth"
                ],
                "summary": "Get OAuth2 status for an email provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Email provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.emailOAuthStatusResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email-providers/{id}/oauth/token": {
            "delete": {
                "tags": [
                    "email-oauth"
                ],
                "summary": "Revoke stored OAuth2 tokens for an email provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Email provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email/mailgun/webhook/{config_id}": {
            "post": {
                "description": "Receives inbound emails from Mailgun",
                "tags": [
                    "email-webhook"
                ],
                "summary": "Mailgun inbound email webhook",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Email provider config ID",
                        "name": "config_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/email/oauth/callback": {
            "get": {
                "description": "Handles the OAuth2 callback, exchanges the code for tokens",
                "tags": [
                    "email-oauth"
                ],
                "summary": "OAuth2 callback for email providers",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Authorization code",
                        "name": "code",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "State parameter",
                        "name": "state",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/memory-providers": {
            "get": {
                "description": "List configured memory providers",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory-providers"
                ],
                "summary": "List memory providers",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/adapters.ProviderGetResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a memory provider configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory-providers"
                ],
                "summary": "Create a memory provider",
                "parameters": [
                    {
                        "description": "Memory provider configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/adapters.ProviderCreateRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/adapters.ProviderGetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/memory-providers/meta": {
            "get": {
                "description": "List available memory provider types and config schemas",
                "tags": [
                    "memory-providers"
                ],
                "summary": "List memory provider metadata",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/adapters.ProviderMeta"
                            }
                        }
                    }
                }
            }
        },
        "/memory-providers/{id}": {
            "get": {
                "description": "Get memory provider by ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory-providers"
                ],
                "summary": "Get a memory provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.ProviderGetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update memory provider by ID",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory-providers"
                ],
                "summary": "Update a memory provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/adapters.ProviderUpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.ProviderGetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete memory provider by ID",
                "tags": [
                    "memory-providers"
                ],
                "summary": "Delete a memory provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/memory-providers/{id}/status": {
            "get": {
                "description": "Get runtime status data for a memory provider",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "memory-providers"
                ],
                "summary": "Get memory provider status",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/adapters.ProviderStatusResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/models": {
            "get": {
                "description": "Get a list of all configured models, optionally filtered by type or provider client type",
                "tags": [
                    "models"
                ],
                "summary": "List all models",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model type (chat, embedding)",
                        "name": "type",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Provider client type (openai-responses, openai-completions, anthropic-messages, google-generative-ai)",
                        "name": "client_type",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.GetResponse"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a new model configuration",
                "tags": [
                    "models"
                ],
                "summary": "Create a new model",
                "parameters": [
                    {
                        "description": "Model configuration",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/models.AddRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/models.AddResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/models/count": {
            "get": {
                "description": "Get the total count of models, optionally filtered by type",
                "tags": [
                    "models"
                ],
                "summary": "Get model count",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model type (chat, embedding)",
                        "name": "type",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.CountResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/models/model/{modelId}": {
            "get": {
                "description": "Get a model configuration by its model_id field (e.g., gpt-4)",
                "tags": [
                    "models"
                ],
                "summary": "Get model by model ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID (e.g., gpt-4)",
                        "name": "modelId",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update a model configuration by its model_id field (e.g., gpt-4)",
                "tags": [
                    "models"
                ],
                "summary": "Update model by model ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID (e.g., gpt-4)",
                        "name": "modelId",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated model configuration",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/models.UpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete a model configuration by its model_id field (e.g., gpt-4)",
                "tags": [
                    "models"
                ],
                "summary": "Delete model by model ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID (e.g., gpt-4)",
                        "name": "modelId",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/models/{id}": {
            "get": {
                "description": "Get a model configuration by its internal UUID",
                "tags": [
                    "models"
                ],
                "summary": "Get model by internal ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model internal ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update a model configuration by its internal UUID",
                "tags": [
                    "models"
                ],
                "summary": "Update model by internal ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model internal ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated model configuration",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/models.UpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete a model configuration by its internal UUID",
                "tags": [
                    "models"
                ],
                "summary": "Delete model by internal ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model internal ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/models/{id}/test": {
            "post": {
                "description": "Probe a model's provider endpoint using the model's real model_id and client_type to verify configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "models"
                ],
                "summary": "Test model connectivity",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model internal ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/models.TestResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/ping": {
            "get": {
                "tags": [
                    "system"
                ],
                "summary": "Health check with server capabilities",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.PingResponse"
                        }
                    }
                }
            }
        },
        "/providers": {
            "get": {
                "description": "Get a list of all configured LLM providers",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "List all LLM providers",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/providers.GetResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a new LLM provider configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Create a new LLM provider",
                "parameters": [
                    {
                        "description": "Provider configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/providers.CreateRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/providers.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/providers/count": {
            "get": {
                "description": "Get the total count of providers",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Count providers",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/providers.CountResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/providers/name/{name}": {
            "get": {
                "description": "Get a provider configuration by its name",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Get provider by name",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider name",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/providers.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/providers/{id}": {
            "get": {
                "description": "Get a provider configuration by its ID",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Get provider by ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/providers.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update an existing provider configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Update provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated provider configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/providers.UpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/providers.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete a provider configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Delete provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/providers/{id}/import-models": {
            "post": {
                "description": "Fetch models from provider's /v1/models endpoint and import them",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Import models from provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/providers.ImportModelsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/providers/{id}/models": {
            "get": {
                "description": "Get models for a provider by id, optionally filtered by type",
                "tags": [
                    "providers"
                ],
                "summary": "List provider models",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Model type (chat, embedding)",
                        "name": "type",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/models.GetResponse"
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/providers/{id}/test": {
            "post": {
                "description": "Probe a provider's base URL to check reachability, supported client types, and embedding support",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "providers"
                ],
                "summary": "Test provider connectivity",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID (UUID)",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/providers.TestResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/search-providers": {
            "get": {
                "description": "List configured search providers",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "search-providers"
                ],
                "summary": "List search providers",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider filter (brave)",
                        "name": "provider",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/searchproviders.GetResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a search provider configuration",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "search-providers"
                ],
                "summary": "Create a search provider",
                "parameters": [
                    {
                        "description": "Search provider configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/searchproviders.CreateRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/searchproviders.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/search-providers/meta": {
            "get": {
                "description": "List available search provider types and config schemas",
                "tags": [
                    "search-providers"
                ],
                "summary": "List search provider metadata",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/searchproviders.ProviderMeta"
                            }
                        }
                    }
                }
            }
        },
        "/search-providers/{id}": {
            "get": {
                "description": "Get search provider by ID",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "search-providers"
                ],
                "summary": "Get a search provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/searchproviders.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update search provider by ID",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "search-providers"
                ],
                "summary": "Update a search provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/searchproviders.UpdateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/searchproviders.GetResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Delete search provider by ID",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "search-providers"
                ],
                "summary": "Delete a search provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-models": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-models"
                ],
                "summary": "List all TTS models",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/tts.ModelResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Manually create a TTS model under a specific provider",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-models"
                ],
                "summary": "Create a TTS model",
                "parameters": [
                    {
                        "description": "TTS model configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/tts.CreateModelRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/tts.ModelResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-models/{id}": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-models"
                ],
                "summary": "Get a TTS model",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/tts.ModelResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-models"
                ],
                "summary": "Update a TTS model",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/tts.UpdateModelRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/tts.ModelResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "tts-models"
                ],
                "summary": "Delete a TTS model",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-models/{id}/capabilities": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-models"
                ],
                "summary": "Get TTS model capabilities",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/tts.ModelCapabilities"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-models/{id}/test": {
            "post": {
                "description": "Synthesize text using a specific model's config and return audio",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/octet-stream"
                ],
                "tags": [
                    "tts-models"
                ],
                "summary": "Test TTS model synthesis",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Model ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Text to synthesize",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/tts.TestSynthesizeRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Audio data",
                        "schema": {
                            "type": "file"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-providers": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-providers"
                ],
                "summary": "List TTS providers",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider type filter",
                        "name": "provider",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/tts.ProviderResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a TTS provider and auto-import its available models",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-providers"
                ],
                "summary": "Create a TTS provider",
                "parameters": [
                    {
                        "description": "TTS provider configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/tts.CreateProviderRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/tts.ProviderResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-providers/meta": {
            "get": {
                "description": "List available TTS provider types with their models and capabilities",
                "tags": [
                    "tts-providers"
                ],
                "summary": "List TTS provider metadata",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/tts.ProviderMetaResponse"
                            }
                        }
                    }
                }
            }
        },
        "/tts-providers/{id}": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-providers"
                ],
                "summary": "Get a TTS provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/tts.ProviderResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-providers"
                ],
                "summary": "Update a TTS provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Updated configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/tts.UpdateProviderRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/tts.ProviderResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "tts-providers"
                ],
                "summary": "Delete a TTS provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-providers/{id}/import-models": {
            "post": {
                "description": "Discover and import available models from the TTS adapter",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-providers"
                ],
                "summary": "Import models for a TTS provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/tts.ModelResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tts-providers/{id}/models": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tts-providers"
                ],
                "summary": "List models for a TTS provider",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Provider ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/tts.ModelResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users": {
            "get": {
                "description": "List users",
                "tags": [
                    "users"
                ],
                "summary": "List users (admin only)",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/accounts.ListAccountsResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Create a new human user account",
                "tags": [
                    "users"
                ],
                "summary": "Create human user (admin only)",
                "parameters": [
                    {
                        "description": "User payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/accounts.CreateAccountRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/accounts.Account"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users/me": {
            "get": {
                "description": "Get current user profile",
                "tags": [
                    "users"
                ],
                "summary": "Get current user",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/accounts.Account"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update current user display name or avatar",
                "tags": [
                    "users"
                ],
                "summary": "Update current user profile",
                "parameters": [
                    {
                        "description": "Profile payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/accounts.UpdateProfileRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/accounts.Account"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users/me/channels/{platform}": {
            "get": {
                "description": "Get channel binding configuration for current user",
                "tags": [
                    "channel"
                ],
                "summary": "Get channel user config",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/channel.ChannelIdentityBinding"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update channel binding configuration for current user",
                "tags": [
                    "channel"
                ],
                "summary": "Update channel user config",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Channel platform",
                        "name": "platform",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Channel user config payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/channel.UpsertChannelIdentityConfigRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/channel.ChannelIdentityBinding"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users/me/identities": {
            "get": {
                "description": "List all channel identities linked to current user",
                "tags": [
                    "users"
                ],
                "summary": "List current user's channel identities",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.listMyIdentitiesResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users/me/password": {
            "put": {
                "description": "Update current user password with current password check",
                "tags": [
                    "users"
                ],
                "summary": "Update current user password",
                "parameters": [
                    {
                        "description": "Password payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/accounts.UpdatePasswordRequest"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users/{id}": {
            "get": {
                "description": "Get user details (self or admin only)",
                "tags": [
                    "users"
                ],
                "summary": "Get user by ID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/accounts.Account"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Update user profile and status",
                "tags": [
                    "users"
                ],
                "summary": "Update user (admin only)",
                "parameters": [
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "User update payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/accounts.UpdateAccountRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/accounts.Account"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/users/{id}/password": {
            "put": {
                "description": "Reset a user password",
                "tags": [
                    "users"
                ],
                "summary": "Reset user password (admin only)",
                "parameters": [
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Password payload",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/accounts.ResetPasswordRequest"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "accounts.Account": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "last_login_at": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            }
        },
        "accounts.CreateAccountRequest": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "password": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            }
        },
        "accounts.ListAccountsResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/accounts.Account"
                    }
                }
            }
        },
        "accounts.ResetPasswordRequest": {
            "type": "object",
            "properties": {
                "new_password": {
                    "type": "string"
                }
            }
        },
        "accounts.UpdateAccountRequest": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "role": {
                    "type": "string"
                }
            }
        },
        "accounts.UpdatePasswordRequest": {
            "type": "object",
            "properties": {
                "current_password": {
                    "type": "string"
                },
                "new_password": {
                    "type": "string"
                }
            }
        },
        "accounts.UpdateProfileRequest": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                }
            }
        },
        "acl.ChannelIdentityCandidate": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "channel": {
                    "type": "string"
                },
                "channel_subject_id": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "linked_avatar_url": {
                    "type": "string"
                },
                "linked_display_name": {
                    "type": "string"
                },
                "linked_username": {
                    "type": "string"
                },
                "user_id": {
                    "type": "string"
                }
            }
        },
        "acl.ChannelIdentityCandidateListResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/acl.ChannelIdentityCandidate"
                    }
                }
            }
        },
        "acl.ListRulesResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/acl.Rule"
                    }
                }
            }
        },
        "acl.ObservedConversationCandidate": {
            "type": "object",
            "properties": {
                "channel": {
                    "type": "string"
                },
                "conversation_id": {
                    "type": "string"
                },
                "conversation_name": {
                    "type": "string"
                },
                "conversation_type": {
                    "type": "string"
                },
                "last_observed_at": {
                    "type": "string"
                },
                "route_id": {
                    "type": "string"
                },
                "thread_id": {
                    "type": "string"
                }
            }
        },
        "acl.ObservedConversationCandidateListResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/acl.ObservedConversationCandidate"
                    }
                }
            }
        },
        "acl.Rule": {
            "type": "object",
            "properties": {
                "action": {
                    "type": "string"
                },
                "bot_id": {
                    "type": "string"
                },
                "channel_identity_avatar_url": {
                    "type": "string"
                },
                "channel_identity_display_name": {
                    "type": "string"
                },
                "channel_identity_id": {
                    "type": "string"
                },
                "channel_subject_id": {
                    "type": "string"
                },
                "channel_type": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "effect": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "linked_user_avatar_url": {
                    "type": "string"
                },
                "linked_user_display_name": {
                    "type": "string"
                },
                "linked_user_id": {
                    "type": "string"
                },
                "linked_user_username": {
                    "type": "string"
                },
                "source_scope": {
                    "$ref": "#/definitions/acl.SourceScope"
                },
                "subject_kind": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "user_avatar_url": {
                    "type": "string"
                },
                "user_display_name": {
                    "type": "string"
                },
                "user_id": {
                    "type": "string"
                },
                "user_username": {
                    "type": "string"
                }
            }
        },
        "acl.SourceScope": {
            "type": "object",
            "properties": {
                "channel": {
                    "type": "string"
                },
                "conversation_id": {
                    "type": "string"
                },
                "conversation_type": {
                    "type": "string"
                },
                "thread_id": {
                    "type": "string"
                }
            }
        },
        "acl.UpsertRuleRequest": {
            "type": "object",
            "properties": {
                "channel_identity_id": {
                    "type": "string"
                },
                "source_scope": {
                    "$ref": "#/definitions/acl.SourceScope"
                },
                "user_id": {
                    "type": "string"
                }
            }
        },
        "acl.UserCandidate": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            }
        },
        "acl.UserCandidateListResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/acl.UserCandidate"
                    }
                }
            }
        },
        "adapters.CDFPoint": {
            "type": "object",
            "properties": {
                "cumulative": {
                    "description": "cumulative weight fraction [0.0, 1.0]",
                    "type": "number"
                },
                "k": {
                    "description": "rank position (1-based, sorted by value desc)",
                    "type": "integer"
                }
            }
        },
        "adapters.CompactResult": {
            "type": "object",
            "properties": {
                "after_count": {
                    "type": "integer"
                },
                "before_count": {
                    "type": "integer"
                },
                "ratio": {
                    "type": "number"
                },
                "results": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/adapters.MemoryItem"
                    }
                }
            }
        },
        "adapters.DeleteResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        },
        "adapters.HealthStatus": {
            "type": "object",
            "properties": {
                "error": {
                    "type": "string"
                },
                "ok": {
                    "type": "boolean"
                }
            }
        },
        "adapters.MemoryItem": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "bot_id": {
                    "type": "string"
                },
                "cdf_curve": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/adapters.CDFPoint"
                    }
                },
                "created_at": {
                    "type": "string"
                },
                "hash": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "memory": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "run_id": {
                    "type": "string"
                },
                "score": {
                    "type": "number"
                },
                "top_k_buckets": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/adapters.TopKBucket"
                    }
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "adapters.MemoryStatusResponse": {
            "type": "object",
            "properties": {
                "can_manual_sync": {
                    "type": "boolean"
                },
                "encoder": {
                    "$ref": "#/definitions/adapters.HealthStatus"
                },
                "indexed_count": {
                    "type": "integer"
                },
                "markdown_file_count": {
                    "type": "integer"
                },
                "memory_mode": {
                    "type": "string"
                },
                "overview_path": {
                    "type": "string"
                },
                "provider_type": {
                    "type": "string"
                },
                "qdrant": {
                    "$ref": "#/definitions/adapters.HealthStatus"
                },
                "qdrant_collection": {
                    "type": "string"
                },
                "source_count": {
                    "type": "integer"
                },
                "source_dir": {
                    "type": "string"
                }
            }
        },
        "adapters.Message": {
            "type": "object",
            "properties": {
                "content": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                }
            }
        },
        "adapters.ProviderCollectionStatus": {
            "type": "object",
            "properties": {
                "exists": {
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                },
                "points": {
                    "type": "integer"
                },
                "qdrant": {
                    "$ref": "#/definitions/adapters.HealthStatus"
                }
            }
        },
        "adapters.ProviderConfigSchema": {
            "type": "object",
            "properties": {
                "fields": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/adapters.ProviderFieldSchema"
                    }
                }
            }
        },
        "adapters.ProviderCreateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "$ref": "#/definitions/adapters.ProviderType"
                }
            }
        },
        "adapters.ProviderFieldSchema": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "example": {},
                "required": {
                    "type": "boolean"
                },
                "secret": {
                    "type": "boolean"
                },
                "title": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "adapters.ProviderGetResponse": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_default": {
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "adapters.ProviderMeta": {
            "type": "object",
            "properties": {
                "config_schema": {
                    "$ref": "#/definitions/adapters.ProviderConfigSchema"
                },
                "display_name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "adapters.ProviderStatusResponse": {
            "type": "object",
            "properties": {
                "collections": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/adapters.ProviderCollectionStatus"
                    }
                },
                "embedding_model_id": {
                    "type": "string"
                },
                "memory_mode": {
                    "type": "string"
                },
                "provider_type": {
                    "type": "string"
                }
            }
        },
        "adapters.ProviderType": {
            "type": "string",
            "enum": [
                "builtin",
                "mem0",
                "openviking"
            ],
            "x-enum-varnames": [
                "ProviderBuiltin",
                "ProviderMem0",
                "ProviderOpenViking"
            ]
        },
        "adapters.ProviderUpdateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "adapters.RebuildResult": {
            "type": "object",
            "properties": {
                "fs_count": {
                    "type": "integer"
                },
                "missing_count": {
                    "type": "integer"
                },
                "restored_count": {
                    "type": "integer"
                },
                "storage_count": {
                    "type": "integer"
                }
            }
        },
        "adapters.SearchResponse": {
            "type": "object",
            "properties": {
                "relations": {
                    "type": "array",
                    "items": {}
                },
                "results": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/adapters.MemoryItem"
                    }
                }
            }
        },
        "adapters.TopKBucket": {
            "type": "object",
            "properties": {
                "index": {
                    "description": "sparse dimension index (term hash)",
                    "type": "integer"
                },
                "value": {
                    "description": "weight (term frequency)",
                    "type": "number"
                }
            }
        },
        "adapters.UsageResponse": {
            "type": "object",
            "properties": {
                "avg_text_bytes": {
                    "type": "integer"
                },
                "count": {
                    "type": "integer"
                },
                "estimated_storage_bytes": {
                    "type": "integer"
                },
                "total_text_bytes": {
                    "type": "integer"
                }
            }
        },
        "bots.Bot": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "check_issue_count": {
                    "type": "integer"
                },
                "check_state": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "owner_user_id": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "bots.BotCheck": {
            "type": "object",
            "properties": {
                "detail": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "status": {
                    "type": "string"
                },
                "subtitle": {
                    "type": "string"
                },
                "summary": {
                    "type": "string"
                },
                "title_key": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "bots.CreateBotRequest": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                }
            }
        },
        "bots.ListBotsResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/bots.Bot"
                    }
                }
            }
        },
        "bots.ListChecksResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/bots.BotCheck"
                    }
                }
            }
        },
        "bots.TransferBotRequest": {
            "type": "object",
            "properties": {
                "owner_user_id": {
                    "type": "string"
                }
            }
        },
        "bots.UpdateBotRequest": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                }
            }
        },
        "browsercontexts.BrowserContext": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "browsercontexts.CreateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "browsercontexts.UpdateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "channel.Action": {
            "type": "object",
            "properties": {
                "label": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                },
                "url": {
                    "type": "string"
                },
                "value": {
                    "type": "string"
                }
            }
        },
        "channel.Attachment": {
            "type": "object",
            "properties": {
                "base64": {
                    "description": "data URL for agent delivery",
                    "type": "string"
                },
                "caption": {
                    "type": "string"
                },
                "content_hash": {
                    "type": "string"
                },
                "duration_ms": {
                    "type": "integer"
                },
                "height": {
                    "type": "integer"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "mime": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "platform_key": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                },
                "source_platform": {
                    "type": "string"
                },
                "thumbnail_url": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/channel.AttachmentType"
                },
                "url": {
                    "type": "string"
                },
                "width": {
                    "type": "integer"
                }
            }
        },
        "channel.AttachmentType": {
            "type": "string",
            "enum": [
                "image",
                "audio",
                "video",
                "voice",
                "file",
                "gif"
            ],
            "x-enum-varnames": [
                "AttachmentImage",
                "AttachmentAudio",
                "AttachmentVideo",
                "AttachmentVoice",
                "AttachmentFile",
                "AttachmentGIF"
            ]
        },
        "channel.ChannelCapabilities": {
            "type": "object",
            "properties": {
                "attachments": {
                    "type": "boolean"
                },
                "block_streaming": {
                    "type": "boolean"
                },
                "buttons": {
                    "type": "boolean"
                },
                "chat_types": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "edit": {
                    "type": "boolean"
                },
                "markdown": {
                    "type": "boolean"
                },
                "media": {
                    "type": "boolean"
                },
                "native_commands": {
                    "type": "boolean"
                },
                "polls": {
                    "type": "boolean"
                },
                "reactions": {
                    "type": "boolean"
                },
                "reply": {
                    "type": "boolean"
                },
                "rich_text": {
                    "type": "boolean"
                },
                "streaming": {
                    "type": "boolean"
                },
                "text": {
                    "type": "boolean"
                },
                "threads": {
                    "type": "boolean"
                },
                "unsend": {
                    "type": "boolean"
                }
            }
        },
        "channel.ChannelConfig": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "channel_type": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "credentials": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "disabled": {
                    "type": "boolean"
                },
                "external_identity": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "routing": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "self_identity": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "updated_at": {
                    "type": "string"
                },
                "verified_at": {
                    "type": "string"
                }
            }
        },
        "channel.ChannelIdentityBinding": {
            "type": "object",
            "properties": {
                "channel_identity_id": {
                    "type": "string"
                },
                "channel_type": {
                    "type": "string"
                },
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "channel.ConfigSchema": {
            "type": "object",
            "properties": {
                "fields": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/channel.FieldSchema"
                    }
                },
                "version": {
                    "type": "integer"
                }
            }
        },
        "channel.FieldSchema": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "enum": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "example": {},
                "required": {
                    "type": "boolean"
                },
                "title": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/channel.FieldType"
                }
            }
        },
        "channel.FieldType": {
            "type": "string",
            "enum": [
                "string",
                "secret",
                "bool",
                "number",
                "enum"
            ],
            "x-enum-varnames": [
                "FieldString",
                "FieldSecret",
                "FieldBool",
                "FieldNumber",
                "FieldEnum"
            ]
        },
        "channel.Message": {
            "type": "object",
            "properties": {
                "actions": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/channel.Action"
                    }
                },
                "attachments": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/channel.Attachment"
                    }
                },
                "format": {
                    "$ref": "#/definitions/channel.MessageFormat"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "parts": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/channel.MessagePart"
                    }
                },
                "reply": {
                    "$ref": "#/definitions/channel.ReplyRef"
                },
                "text": {
                    "type": "string"
                },
                "thread": {
                    "$ref": "#/definitions/channel.ThreadRef"
                }
            }
        },
        "channel.MessageFormat": {
            "type": "string",
            "enum": [
                "plain",
                "markdown",
                "rich"
            ],
            "x-enum-varnames": [
                "MessageFormatPlain",
                "MessageFormatMarkdown",
                "MessageFormatRich"
            ]
        },
        "channel.MessagePart": {
            "type": "object",
            "properties": {
                "channel_identity_id": {
                    "type": "string"
                },
                "emoji": {
                    "type": "string"
                },
                "language": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "styles": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/channel.MessageTextStyle"
                    }
                },
                "text": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/channel.MessagePartType"
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "channel.MessagePartType": {
            "type": "string",
            "enum": [
                "text",
                "link",
                "code_block",
                "mention",
                "emoji"
            ],
            "x-enum-varnames": [
                "MessagePartText",
                "MessagePartLink",
                "MessagePartCodeBlock",
                "MessagePartMention",
                "MessagePartEmoji"
            ]
        },
        "channel.MessageTextStyle": {
            "type": "string",
            "enum": [
                "bold",
                "italic",
                "strikethrough",
                "code"
            ],
            "x-enum-varnames": [
                "MessageStyleBold",
                "MessageStyleItalic",
                "MessageStyleStrikethrough",
                "MessageStyleCode"
            ]
        },
        "channel.ReplyRef": {
            "type": "object",
            "properties": {
                "message_id": {
                    "type": "string"
                },
                "target": {
                    "type": "string"
                }
            }
        },
        "channel.SendRequest": {
            "type": "object",
            "properties": {
                "channel_identity_id": {
                    "type": "string"
                },
                "message": {
                    "$ref": "#/definitions/channel.Message"
                },
                "target": {
                    "type": "string"
                }
            }
        },
        "channel.TargetHint": {
            "type": "object",
            "properties": {
                "example": {
                    "type": "string"
                },
                "label": {
                    "type": "string"
                }
            }
        },
        "channel.TargetSpec": {
            "type": "object",
            "properties": {
                "format": {
                    "type": "string"
                },
                "hints": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/channel.TargetHint"
                    }
                }
            }
        },
        "channel.ThreadRef": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                }
            }
        },
        "channel.UpdateChannelStatusRequest": {
            "type": "object",
            "properties": {
                "disabled": {
                    "type": "boolean"
                }
            }
        },
        "channel.UpsertChannelIdentityConfigRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                }
            }
        },
        "channel.UpsertConfigRequest": {
            "type": "object",
            "properties": {
                "credentials": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "disabled": {
                    "type": "boolean"
                },
                "external_identity": {
                    "type": "string"
                },
                "routing": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "self_identity": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "verified_at": {
                    "type": "string"
                }
            }
        },
        "compaction.ListLogsResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/compaction.Log"
                    }
                }
            }
        },
        "compaction.Log": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "completed_at": {
                    "type": "string"
                },
                "error_message": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "message_count": {
                    "type": "integer"
                },
                "model_id": {
                    "type": "string"
                },
                "session_id": {
                    "type": "string"
                },
                "started_at": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "summary": {
                    "type": "string"
                },
                "usage": {}
            }
        },
        "email.BindingResponse": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "can_delete": {
                    "type": "boolean"
                },
                "can_read": {
                    "type": "boolean"
                },
                "can_write": {
                    "type": "boolean"
                },
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "email_address": {
                    "type": "string"
                },
                "email_provider_id": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "email.ConfigSchema": {
            "type": "object",
            "properties": {
                "fields": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/email.FieldSchema"
                    }
                }
            }
        },
        "email.CreateBindingRequest": {
            "type": "object",
            "properties": {
                "can_delete": {
                    "type": "boolean"
                },
                "can_read": {
                    "type": "boolean"
                },
                "can_write": {
                    "type": "boolean"
                },
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "email_address": {
                    "type": "string"
                },
                "email_provider_id": {
                    "type": "string"
                }
            }
        },
        "email.CreateProviderRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "email.FieldSchema": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "enum": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "example": {},
                "key": {
                    "type": "string"
                },
                "order": {
                    "type": "integer"
                },
                "required": {
                    "type": "boolean"
                },
                "title": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "email.OutboxItemResponse": {
            "type": "object",
            "properties": {
                "attachments": {
                    "type": "array",
                    "items": {}
                },
                "body_html": {
                    "type": "string"
                },
                "body_text": {
                    "type": "string"
                },
                "bot_id": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "error": {
                    "type": "string"
                },
                "from": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "message_id": {
                    "type": "string"
                },
                "provider_id": {
                    "type": "string"
                },
                "sent_at": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "subject": {
                    "type": "string"
                },
                "to": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "email.ProviderMeta": {
            "type": "object",
            "properties": {
                "config_schema": {
                    "$ref": "#/definitions/email.ConfigSchema"
                },
                "display_name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "email.ProviderResponse": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "email.UpdateBindingRequest": {
            "type": "object",
            "properties": {
                "can_delete": {
                    "type": "boolean"
                },
                "can_read": {
                    "type": "boolean"
                },
                "can_write": {
                    "type": "boolean"
                },
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "email_address": {
                    "type": "string"
                }
            }
        },
        "email.UpdateProviderRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "github_com_memohai_memoh_internal_mcp.Connection": {
            "type": "object",
            "properties": {
                "auth_type": {
                    "type": "string"
                },
                "bot_id": {
                    "type": "string"
                },
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "last_probed_at": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "status_message": {
                    "type": "string"
                },
                "tools_cache": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/mcp.ToolDescriptor"
                    }
                },
                "type": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "handlers.BatchDeleteRequest": {
            "type": "object",
            "properties": {
                "ids": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "handlers.BrowserCoresResponse": {
            "type": "object",
            "properties": {
                "cores": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "handlers.ChannelMeta": {
            "type": "object",
            "properties": {
                "capabilities": {
                    "$ref": "#/definitions/channel.ChannelCapabilities"
                },
                "config_schema": {
                    "$ref": "#/definitions/channel.ConfigSchema"
                },
                "configless": {
                    "type": "boolean"
                },
                "display_name": {
                    "type": "string"
                },
                "target_spec": {
                    "$ref": "#/definitions/channel.TargetSpec"
                },
                "type": {
                    "type": "string"
                },
                "user_config_schema": {
                    "$ref": "#/definitions/channel.ConfigSchema"
                }
            }
        },
        "handlers.CreateContainerRequest": {
            "type": "object",
            "properties": {
                "image": {
                    "type": "string"
                },
                "restore_data": {
                    "type": "boolean"
                },
                "snapshotter": {
                    "type": "string"
                }
            }
        },
        "handlers.CreateContainerResponse": {
            "type": "object",
            "properties": {
                "container_id": {
                    "type": "string"
                },
                "data_restored": {
                    "type": "boolean"
                },
                "has_preserved_data": {
                    "type": "boolean"
                },
                "image": {
                    "type": "string"
                },
                "snapshotter": {
                    "type": "string"
                },
                "started": {
                    "type": "boolean"
                }
            }
        },
        "handlers.CreateSnapshotRequest": {
            "type": "object",
            "properties": {
                "snapshot_name": {
                    "type": "string"
                }
            }
        },
        "handlers.CreateSnapshotResponse": {
            "type": "object",
            "properties": {
                "container_id": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "runtime_snapshot_name": {
                    "type": "string"
                },
                "snapshot_name": {
                    "type": "string"
                },
                "snapshotter": {
                    "type": "string"
                },
                "source": {
                    "type": "string"
                },
                "version": {
                    "type": "integer"
                }
            }
        },
        "handlers.DailyTokenUsage": {
            "type": "object",
            "properties": {
                "cache_read_tokens": {
                    "type": "integer"
                },
                "cache_write_tokens": {
                    "type": "integer"
                },
                "day": {
                    "type": "string"
                },
                "input_tokens": {
                    "type": "integer"
                },
                "output_tokens": {
                    "type": "integer"
                },
                "reasoning_tokens": {
                    "type": "integer"
                }
            }
        },
        "handlers.ErrorResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        },
        "handlers.FSDeleteRequest": {
            "type": "object",
            "properties": {
                "path": {
                    "type": "string"
                },
                "recursive": {
                    "type": "boolean"
                }
            }
        },
        "handlers.FSFileInfo": {
            "type": "object",
            "properties": {
                "isDir": {
                    "type": "boolean"
                },
                "modTime": {
                    "type": "string"
                },
                "mode": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                }
            }
        },
        "handlers.FSListResponse": {
            "type": "object",
            "properties": {
                "entries": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.FSFileInfo"
                    }
                },
                "path": {
                    "type": "string"
                }
            }
        },
        "handlers.FSMkdirRequest": {
            "type": "object",
            "properties": {
                "path": {
                    "type": "string"
                }
            }
        },
        "handlers.FSReadResponse": {
            "type": "object",
            "properties": {
                "content": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                }
            }
        },
        "handlers.FSRenameRequest": {
            "type": "object",
            "properties": {
                "newPath": {
                    "type": "string"
                },
                "oldPath": {
                    "type": "string"
                }
            }
        },
        "handlers.FSUploadResponse": {
            "type": "object",
            "properties": {
                "path": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                }
            }
        },
        "handlers.FSWriteRequest": {
            "type": "object",
            "properties": {
                "content": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                }
            }
        },
        "handlers.GetContainerResponse": {
            "type": "object",
            "properties": {
                "container_id": {
                    "type": "string"
                },
                "container_path": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "has_preserved_data": {
                    "type": "boolean"
                },
                "image": {
                    "type": "string"
                },
                "legacy": {
                    "type": "boolean"
                },
                "namespace": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "task_running": {
                    "type": "boolean"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "handlers.ListSnapshotsResponse": {
            "type": "object",
            "properties": {
                "snapshots": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.SnapshotInfo"
                    }
                },
                "snapshotter": {
                    "type": "string"
                }
            }
        },
        "handlers.LocalChannelMessageRequest": {
            "type": "object",
            "properties": {
                "message": {
                    "$ref": "#/definitions/channel.Message"
                }
            }
        },
        "handlers.LoginRequest": {
            "type": "object",
            "properties": {
                "password": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            }
        },
        "handlers.LoginResponse": {
            "type": "object",
            "properties": {
                "access_token": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "expires_at": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "token_type": {
                    "type": "string"
                },
                "user_id": {
                    "type": "string"
                },
                "username": {
                    "type": "string"
                }
            }
        },
        "handlers.MCPStdioRequest": {
            "type": "object",
            "properties": {
                "args": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "command": {
                    "type": "string"
                },
                "cwd": {
                    "type": "string"
                },
                "env": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "handlers.MCPStdioResponse": {
            "type": "object",
            "properties": {
                "connection_id": {
                    "type": "string"
                },
                "tools": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "handlers.ModelTokenUsage": {
            "type": "object",
            "properties": {
                "input_tokens": {
                    "type": "integer"
                },
                "model_id": {
                    "type": "string"
                },
                "model_name": {
                    "type": "string"
                },
                "model_slug": {
                    "type": "string"
                },
                "output_tokens": {
                    "type": "integer"
                },
                "provider_name": {
                    "type": "string"
                }
            }
        },
        "handlers.PingResponse": {
            "type": "object",
            "properties": {
                "container_backend": {
                    "type": "string"
                },
                "snapshot_supported": {
                    "type": "boolean"
                },
                "status": {
                    "type": "string"
                }
            }
        },
        "handlers.ProbeResponse": {
            "type": "object",
            "properties": {
                "auth_required": {
                    "type": "boolean"
                },
                "error": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "tools": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/mcp.ToolDescriptor"
                    }
                }
            }
        },
        "handlers.RefreshResponse": {
            "type": "object",
            "properties": {
                "access_token": {
                    "type": "string"
                },
                "expires_at": {
                    "type": "string"
                },
                "token_type": {
                    "type": "string"
                }
            }
        },
        "handlers.RollbackRequest": {
            "type": "object",
            "properties": {
                "version": {
                    "type": "integer"
                }
            }
        },
        "handlers.SkillItem": {
            "type": "object",
            "properties": {
                "content": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "raw": {
                    "type": "string"
                }
            }
        },
        "handlers.SkillsDeleteRequest": {
            "type": "object",
            "properties": {
                "names": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "handlers.SkillsResponse": {
            "type": "object",
            "properties": {
                "skills": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.SkillItem"
                    }
                }
            }
        },
        "handlers.SkillsUpsertRequest": {
            "type": "object",
            "properties": {
                "skills": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "handlers.SnapshotInfo": {
            "type": "object",
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "kind": {
                    "type": "string"
                },
                "labels": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "managed": {
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                },
                "parent": {
                    "type": "string"
                },
                "runtime_snapshot_name": {
                    "type": "string"
                },
                "snapshotter": {
                    "type": "string"
                },
                "source": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "version": {
                    "type": "integer"
                }
            }
        },
        "handlers.TokenUsageResponse": {
            "type": "object",
            "properties": {
                "by_model": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.ModelTokenUsage"
                    }
                },
                "chat": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.DailyTokenUsage"
                    }
                },
                "heartbeat": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.DailyTokenUsage"
                    }
                },
                "schedule": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.DailyTokenUsage"
                    }
                }
            }
        },
        "handlers.createSessionRequest": {
            "type": "object",
            "properties": {
                "channel_type": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "title": {
                    "type": "string"
                }
            }
        },
        "handlers.emailOAuthStatusResponse": {
            "type": "object",
            "properties": {
                "configured": {
                    "type": "boolean"
                },
                "email_address": {
                    "type": "string"
                },
                "expired": {
                    "type": "boolean"
                },
                "expires_at": {
                    "type": "string"
                },
                "has_token": {
                    "type": "boolean"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "handlers.fsOpResponse": {
            "type": "object",
            "properties": {
                "ok": {
                    "type": "boolean"
                }
            }
        },
        "handlers.listMyIdentitiesResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/identities.ChannelIdentity"
                    }
                },
                "user_id": {
                    "type": "string"
                }
            }
        },
        "handlers.memoryAddPayload": {
            "type": "object",
            "properties": {
                "embedding_enabled": {
                    "type": "boolean"
                },
                "filters": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "infer": {
                    "type": "boolean"
                },
                "message": {
                    "type": "string"
                },
                "messages": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/adapters.Message"
                    }
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "namespace": {
                    "type": "string"
                },
                "run_id": {
                    "type": "string"
                }
            }
        },
        "handlers.memoryCompactPayload": {
            "type": "object",
            "properties": {
                "decay_days": {
                    "type": "integer"
                },
                "ratio": {
                    "type": "number"
                }
            }
        },
        "handlers.memoryDeletePayload": {
            "type": "object",
            "properties": {
                "memory_ids": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "handlers.memorySearchPayload": {
            "type": "object",
            "properties": {
                "embedding_enabled": {
                    "type": "boolean"
                },
                "filters": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "limit": {
                    "type": "integer"
                },
                "no_stats": {
                    "type": "boolean"
                },
                "query": {
                    "type": "string"
                },
                "run_id": {
                    "type": "string"
                },
                "sources": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "handlers.oauthAuthorizeRequest": {
            "type": "object",
            "properties": {
                "callback_url": {
                    "type": "string"
                },
                "client_id": {
                    "type": "string"
                },
                "client_secret": {
                    "type": "string"
                }
            }
        },
        "handlers.oauthDiscoverRequest": {
            "type": "object",
            "properties": {
                "url": {
                    "type": "string"
                }
            }
        },
        "handlers.oauthExchangeRequest": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string"
                },
                "state": {
                    "type": "string"
                }
            }
        },
        "handlers.skillsOpResponse": {
            "type": "object",
            "properties": {
                "ok": {
                    "type": "boolean"
                }
            }
        },
        "handlers.synthesizeRequest": {
            "type": "object",
            "properties": {
                "text": {
                    "type": "string"
                }
            }
        },
        "handlers.synthesizeResponse": {
            "type": "object",
            "properties": {
                "content_type": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                },
                "temp_id": {
                    "type": "string"
                }
            }
        },
        "handlers.terminalInfoResponse": {
            "type": "object",
            "properties": {
                "available": {
                    "type": "boolean"
                },
                "shell": {
                    "type": "string"
                }
            }
        },
        "handlers.updateSessionRequest": {
            "type": "object",
            "properties": {
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "title": {
                    "type": "string"
                }
            }
        },
        "heartbeat.ListLogsResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/heartbeat.Log"
                    }
                }
            }
        },
        "heartbeat.Log": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "completed_at": {
                    "type": "string"
                },
                "error_message": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "result_text": {
                    "type": "string"
                },
                "session_id": {
                    "type": "string"
                },
                "started_at": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "usage": {}
            }
        },
        "identities.ChannelIdentity": {
            "type": "object",
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "channel": {
                    "type": "string"
                },
                "channel_subject_id": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "updated_at": {
                    "type": "string"
                },
                "user_id": {
                    "type": "string"
                }
            }
        },
        "mcp.AuthorizeResult": {
            "type": "object",
            "properties": {
                "authorization_url": {
                    "type": "string"
                }
            }
        },
        "mcp.DiscoveryResult": {
            "type": "object",
            "properties": {
                "authorization_endpoint": {
                    "type": "string"
                },
                "authorization_server_url": {
                    "type": "string"
                },
                "registration_endpoint": {
                    "type": "string"
                },
                "resource_metadata_url": {
                    "type": "string"
                },
                "resource_uri": {
                    "type": "string"
                },
                "scopes_supported": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "token_endpoint": {
                    "type": "string"
                }
            }
        },
        "mcp.ExportResponse": {
            "type": "object",
            "properties": {
                "mcpServers": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/mcp.MCPServerEntry"
                    }
                }
            }
        },
        "mcp.ImportRequest": {
            "type": "object",
            "properties": {
                "mcpServers": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/mcp.MCPServerEntry"
                    }
                }
            }
        },
        "mcp.ListResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/github_com_memohai_memoh_internal_mcp.Connection"
                    }
                }
            }
        },
        "mcp.MCPServerEntry": {
            "type": "object",
            "properties": {
                "args": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "command": {
                    "type": "string"
                },
                "cwd": {
                    "type": "string"
                },
                "env": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "headers": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "transport": {
                    "type": "string"
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "mcp.OAuthStatus": {
            "type": "object",
            "properties": {
                "auth_server": {
                    "type": "string"
                },
                "callback_url": {
                    "type": "string"
                },
                "configured": {
                    "type": "boolean"
                },
                "expired": {
                    "type": "boolean"
                },
                "expires_at": {
                    "type": "string"
                },
                "has_token": {
                    "type": "boolean"
                },
                "scopes": {
                    "type": "string"
                }
            }
        },
        "mcp.ToolDescriptor": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "inputSchema": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "mcp.UpsertRequest": {
            "type": "object",
            "properties": {
                "args": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "auth_type": {
                    "type": "string"
                },
                "command": {
                    "type": "string"
                },
                "cwd": {
                    "type": "string"
                },
                "env": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "headers": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "is_active": {
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                },
                "transport": {
                    "type": "string"
                },
                "url": {
                    "type": "string"
                }
            }
        },
        "message.Message": {
            "type": "object",
            "properties": {
                "assets": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/message.MessageAsset"
                    }
                },
                "bot_id": {
                    "type": "string"
                },
                "compact_id": {
                    "type": "string"
                },
                "content": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "created_at": {
                    "type": "string"
                },
                "external_message_id": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "platform": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "sender_avatar_url": {
                    "type": "string"
                },
                "sender_channel_identity_id": {
                    "type": "string"
                },
                "sender_display_name": {
                    "type": "string"
                },
                "sender_user_id": {
                    "type": "string"
                },
                "session_id": {
                    "type": "string"
                },
                "source_reply_to_message_id": {
                    "type": "string"
                },
                "usage": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                }
            }
        },
        "message.MessageAsset": {
            "type": "object",
            "properties": {
                "content_hash": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "mime": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "ordinal": {
                    "type": "integer"
                },
                "role": {
                    "type": "string"
                },
                "size_bytes": {
                    "type": "integer"
                },
                "storage_key": {
                    "type": "string"
                }
            }
        },
        "models.AddRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "$ref": "#/definitions/models.ModelConfig"
                },
                "llm_provider_id": {
                    "type": "string"
                },
                "model_id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/models.ModelType"
                }
            }
        },
        "models.AddResponse": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "model_id": {
                    "type": "string"
                }
            }
        },
        "models.CountResponse": {
            "type": "object",
            "properties": {
                "count": {
                    "type": "integer"
                }
            }
        },
        "models.GetResponse": {
            "type": "object",
            "properties": {
                "config": {
                    "$ref": "#/definitions/models.ModelConfig"
                },
                "id": {
                    "type": "string"
                },
                "llm_provider_id": {
                    "type": "string"
                },
                "model_id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/models.ModelType"
                }
            }
        },
        "models.ModelConfig": {
            "type": "object",
            "properties": {
                "compatibilities": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "context_window": {
                    "type": "integer"
                },
                "dimensions": {
                    "type": "integer"
                }
            }
        },
        "models.ModelType": {
            "type": "string",
            "enum": [
                "chat",
                "embedding"
            ],
            "x-enum-varnames": [
                "ModelTypeChat",
                "ModelTypeEmbedding"
            ]
        },
        "models.TestResponse": {
            "type": "object",
            "properties": {
                "latency_ms": {
                    "type": "integer"
                },
                "message": {
                    "type": "string"
                },
                "reachable": {
                    "type": "boolean"
                },
                "status": {
                    "$ref": "#/definitions/models.TestStatus"
                }
            }
        },
        "models.TestStatus": {
            "type": "string",
            "enum": [
                "ok",
                "auth_error",
                "model_not_supported",
                "error"
            ],
            "x-enum-varnames": [
                "TestStatusOK",
                "TestStatusAuthError",
                "TestStatusModelNotSupported",
                "TestStatusError"
            ]
        },
        "models.UpdateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "$ref": "#/definitions/models.ModelConfig"
                },
                "llm_provider_id": {
                    "type": "string"
                },
                "model_id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/models.ModelType"
                }
            }
        },
        "providers.CountResponse": {
            "type": "object",
            "properties": {
                "count": {
                    "type": "integer"
                }
            }
        },
        "providers.CreateRequest": {
            "type": "object",
            "required": [
                "base_url",
                "client_type",
                "name"
            ],
            "properties": {
                "api_key": {
                    "type": "string"
                },
                "base_url": {
                    "type": "string"
                },
                "client_type": {
                    "type": "string"
                },
                "icon": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "providers.GetResponse": {
            "type": "object",
            "properties": {
                "api_key": {
                    "type": "string"
                },
                "base_url": {
                    "type": "string"
                },
                "client_type": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "enable": {
                    "type": "boolean"
                },
                "icon": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "providers.ImportModelsResponse": {
            "type": "object",
            "properties": {
                "created": {
                    "type": "integer"
                },
                "models": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "skipped": {
                    "type": "integer"
                }
            }
        },
        "providers.TestResponse": {
            "type": "object",
            "properties": {
                "latency_ms": {
                    "type": "integer"
                },
                "message": {
                    "type": "string"
                },
                "reachable": {
                    "type": "boolean"
                }
            }
        },
        "providers.UpdateRequest": {
            "type": "object",
            "properties": {
                "api_key": {
                    "type": "string"
                },
                "base_url": {
                    "type": "string"
                },
                "client_type": {
                    "type": "string"
                },
                "enable": {
                    "type": "boolean"
                },
                "icon": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "schedule.CreateRequest": {
            "type": "object",
            "properties": {
                "command": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "enabled": {
                    "type": "boolean"
                },
                "max_calls": {
                    "$ref": "#/definitions/schedule.NullableInt"
                },
                "name": {
                    "type": "string"
                },
                "pattern": {
                    "type": "string"
                }
            }
        },
        "schedule.ListLogsResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/schedule.Log"
                    }
                }
            }
        },
        "schedule.ListResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/schedule.Schedule"
                    }
                }
            }
        },
        "schedule.Log": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "completed_at": {
                    "type": "string"
                },
                "error_message": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "result_text": {
                    "type": "string"
                },
                "schedule_id": {
                    "type": "string"
                },
                "session_id": {
                    "type": "string"
                },
                "started_at": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "usage": {}
            }
        },
        "schedule.NullableInt": {
            "type": "object",
            "properties": {
                "set": {
                    "type": "boolean"
                },
                "value": {
                    "type": "integer"
                }
            }
        },
        "schedule.Schedule": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "command": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "current_calls": {
                    "type": "integer"
                },
                "description": {
                    "type": "string"
                },
                "enabled": {
                    "type": "boolean"
                },
                "id": {
                    "type": "string"
                },
                "max_calls": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "pattern": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "schedule.UpdateRequest": {
            "type": "object",
            "properties": {
                "command": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "enabled": {
                    "type": "boolean"
                },
                "max_calls": {
                    "$ref": "#/definitions/schedule.NullableInt"
                },
                "name": {
                    "type": "string"
                },
                "pattern": {
                    "type": "string"
                }
            }
        },
        "searchproviders.CreateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "$ref": "#/definitions/searchproviders.ProviderName"
                }
            }
        },
        "searchproviders.GetResponse": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "searchproviders.ProviderConfigSchema": {
            "type": "object",
            "properties": {
                "fields": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/searchproviders.ProviderFieldSchema"
                    }
                }
            }
        },
        "searchproviders.ProviderFieldSchema": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "enum": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "example": {},
                "required": {
                    "type": "boolean"
                },
                "title": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "searchproviders.ProviderMeta": {
            "type": "object",
            "properties": {
                "config_schema": {
                    "$ref": "#/definitions/searchproviders.ProviderConfigSchema"
                },
                "display_name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "searchproviders.ProviderName": {
            "type": "string",
            "enum": [
                "brave",
                "bing",
                "google",
                "tavily",
                "sogou",
                "serper",
                "searxng",
                "jina",
                "exa",
                "bocha",
                "duckduckgo",
                "yandex"
            ],
            "x-enum-varnames": [
                "ProviderBrave",
                "ProviderBing",
                "ProviderGoogle",
                "ProviderTavily",
                "ProviderSogou",
                "ProviderSerper",
                "ProviderSearXNG",
                "ProviderJina",
                "ProviderExa",
                "ProviderBocha",
                "ProviderDuckDuckGo",
                "ProviderYandex"
            ]
        },
        "searchproviders.UpdateRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "$ref": "#/definitions/searchproviders.ProviderName"
                }
            }
        },
        "session.Session": {
            "type": "object",
            "properties": {
                "bot_id": {
                    "type": "string"
                },
                "channel_type": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "parent_session_id": {
                    "type": "string"
                },
                "route_conversation_type": {
                    "type": "string"
                },
                "route_id": {
                    "type": "string"
                },
                "route_metadata": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "title": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "settings.Settings": {
            "type": "object",
            "properties": {
                "allow_guest": {
                    "type": "boolean"
                },
                "browser_context_id": {
                    "type": "string"
                },
                "chat_model_id": {
                    "type": "string"
                },
                "compaction_enabled": {
                    "type": "boolean"
                },
                "compaction_model_id": {
                    "type": "string"
                },
                "compaction_threshold": {
                    "type": "integer"
                },
                "heartbeat_enabled": {
                    "type": "boolean"
                },
                "heartbeat_interval": {
                    "type": "integer"
                },
                "heartbeat_model_id": {
                    "type": "string"
                },
                "language": {
                    "type": "string"
                },
                "max_context_load_time": {
                    "type": "integer"
                },
                "max_context_tokens": {
                    "type": "integer"
                },
                "memory_provider_id": {
                    "type": "string"
                },
                "reasoning_effort": {
                    "type": "string"
                },
                "reasoning_enabled": {
                    "type": "boolean"
                },
                "search_provider_id": {
                    "type": "string"
                },
                "title_model_id": {
                    "type": "string"
                },
                "tts_model_id": {
                    "type": "string"
                }
            }
        },
        "settings.UpsertRequest": {
            "type": "object",
            "properties": {
                "allow_guest": {
                    "type": "boolean"
                },
                "browser_context_id": {
                    "type": "string"
                },
                "chat_model_id": {
                    "type": "string"
                },
                "compaction_enabled": {
                    "type": "boolean"
                },
                "compaction_model_id": {
                    "type": "string"
                },
                "compaction_threshold": {
                    "type": "integer"
                },
                "heartbeat_enabled": {
                    "type": "boolean"
                },
                "heartbeat_interval": {
                    "type": "integer"
                },
                "heartbeat_model_id": {
                    "type": "string"
                },
                "language": {
                    "type": "string"
                },
                "max_context_load_time": {
                    "type": "integer"
                },
                "max_context_tokens": {
                    "type": "integer"
                },
                "memory_provider_id": {
                    "type": "string"
                },
                "reasoning_effort": {
                    "type": "string"
                },
                "reasoning_enabled": {
                    "type": "boolean"
                },
                "search_provider_id": {
                    "type": "string"
                },
                "title_model_id": {
                    "type": "string"
                },
                "tts_model_id": {
                    "type": "string"
                }
            }
        },
        "tts.CreateModelRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "model_id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "tts_provider_id": {
                    "type": "string"
                }
            }
        },
        "tts.CreateProviderRequest": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "tts.ModelCapabilities": {
            "type": "object",
            "properties": {
                "formats": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "pitch": {
                    "$ref": "#/definitions/tts.ParamConstraint"
                },
                "speed": {
                    "$ref": "#/definitions/tts.ParamConstraint"
                },
                "voices": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/tts.VoiceInfo"
                    }
                }
            }
        },
        "tts.ModelInfo": {
            "type": "object",
            "properties": {
                "capabilities": {
                    "$ref": "#/definitions/tts.ModelCapabilities"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "tts.ModelResponse": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "model_id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "provider_type": {
                    "type": "string"
                },
                "tts_provider_id": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "tts.ParamConstraint": {
            "type": "object",
            "properties": {
                "default": {
                    "type": "number"
                },
                "max": {
                    "type": "number"
                },
                "min": {
                    "type": "number"
                },
                "options": {
                    "type": "array",
                    "items": {
                        "type": "number"
                    }
                }
            }
        },
        "tts.ProviderMetaResponse": {
            "type": "object",
            "properties": {
                "default_model": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "models": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/tts.ModelInfo"
                    }
                },
                "provider": {
                    "type": "string"
                }
            }
        },
        "tts.ProviderResponse": {
            "type": "object",
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "provider": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "tts.TestSynthesizeRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "text": {
                    "type": "string"
                }
            }
        },
        "tts.UpdateModelRequest": {
            "type": "object",
            "properties": {
                "config": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "tts.UpdateProviderRequest": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                }
            }
        },
        "tts.VoiceInfo": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "lang": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "weixin.QRPollRequest": {
            "type": "object",
            "properties": {
                "baseUrl": {
                    "type": "string"
                },
                "qr_code": {
                    "type": "string"
                },
                "routeTag": {
                    "type": "string"
                }
            }
        },
        "weixin.QRPollResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                },
                "status": {
                    "description": "wait, scaned, confirmed, expired",
                    "type": "string"
                }
            }
        },
        "weixin.QRStartRequest": {
            "type": "object",
            "properties": {
                "baseUrl": {
                    "type": "string"
                },
                "routeTag": {
                    "type": "string"
                }
            }
        },
        "weixin.QRStartResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                },
                "qr_code": {
                    "type": "string"
                },
                "qr_code_url": {
                    "type": "string"
                }
            }
        }
    }
}