{
  "openapi": "3.1.0",
  "info": {
    "title": "turnstone Console API",
    "version": "0.6.2",
    "description": "Cluster-wide visibility and control across all turnstone nodes."
  },
  "paths": {
    "/v1/api/cluster/overview": {
      "get": {
        "summary": "Cluster state summary",
        "operationId": "v1_api_cluster_overview_get",
        "tags": [
          "Cluster"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClusterOverviewResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/cluster/nodes": {
      "get": {
        "summary": "Paginated node list",
        "operationId": "v1_api_cluster_nodes_get",
        "tags": [
          "Cluster"
        ],
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "activity",
              "enum": [
                "activity",
                "tokens",
                "name"
              ]
            },
            "description": "Sort field"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            },
            "description": "Page size"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Pagination offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClusterNodesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/cluster/workstreams": {
      "get": {
        "summary": "Filtered workstream list",
        "operationId": "v1_api_cluster_workstreams_get",
        "tags": [
          "Cluster"
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "thinking",
                "attention",
                "idle",
                "error"
              ]
            },
            "description": "Filter by state"
          },
          {
            "name": "node",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by node_id"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Search in name/title/node"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "state",
              "enum": [
                "state",
                "tokens",
                "name"
              ]
            },
            "description": "Sort field"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            },
            "description": "Page number"
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50
            },
            "description": "Items per page (max 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClusterWorkstreamsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/cluster/node/{node_id}": {
      "get": {
        "summary": "Single node detail",
        "operationId": "v1_api_cluster_node_{node_id}_get",
        "tags": [
          "Cluster"
        ],
        "parameters": [
          {
            "name": "node_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeDetailResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/cluster/workstreams/new": {
      "post": {
        "summary": "Create workstream via MQ dispatch",
        "operationId": "v1_api_cluster_workstreams_new_post",
        "tags": [
          "Cluster"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsoleCreateWsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsoleCreateWsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error 503",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/cluster/snapshot": {
      "get": {
        "summary": "Full cluster state snapshot",
        "operationId": "v1_api_cluster_snapshot_get",
        "tags": [
          "Cluster"
        ],
        "description": "Returns the complete cluster state: all nodes with their workstreams and overview aggregates. Used for initial load and reconnection.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClusterSnapshotResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/cluster/events": {
      "get": {
        "summary": "Cluster SSE event stream",
        "operationId": "v1_api_cluster_events_get",
        "tags": [
          "Streaming"
        ],
        "description": "Server-Sent Events stream for real-time cluster updates. First event is a 'snapshot' with full cluster state, followed by node_joined, node_lost, cluster_state, ws_created, ws_closed, ws_rename events.",
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/v1/api/auth/login": {
      "post": {
        "summary": "Authenticate with a token",
        "operationId": "v1_api_auth_login_post",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthLoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthLoginResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/auth/setup": {
      "post": {
        "summary": "Create first admin user",
        "operationId": "v1_api_auth_setup_post",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthSetupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthSetupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error 409",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error 503",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/auth/status": {
      "get": {
        "summary": "Return auth state",
        "operationId": "v1_api_auth_status_get",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthStatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/auth/logout": {
      "post": {
        "summary": "Clear auth cookie",
        "operationId": "v1_api_auth_logout_post",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/auth/oidc/authorize": {
      "get": {
        "summary": "Redirect to OIDC provider for SSO login",
        "operationId": "v1_api_auth_oidc_authorize_get",
        "tags": [
          "Auth"
        ],
        "responses": {
          "302": {
            "description": "Success"
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error 503",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/auth/oidc/callback": {
      "get": {
        "summary": "OIDC callback \u2014 validates code, provisions user, sets JWT cookie, redirects to app",
        "operationId": "v1_api_auth_oidc_callback_get",
        "tags": [
          "Auth"
        ],
        "responses": {
          "302": {
            "description": "Success"
          }
        }
      }
    },
    "/v1/api/auth/whoami": {
      "get": {
        "summary": "Return authenticated user info and permissions",
        "operationId": "v1_api_auth_whoami_get",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthWhoamiResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error 401",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/users": {
      "get": {
        "summary": "List all users",
        "operationId": "v1_api_admin_users_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListUsersResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a user",
        "operationId": "v1_api_admin_users_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserInfo"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/users/{user_id}": {
      "delete": {
        "summary": "Delete a user and their tokens",
        "operationId": "v1_api_admin_users_{user_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/users/{user_id}/tokens": {
      "get": {
        "summary": "List tokens for a user",
        "operationId": "v1_api_admin_users_{user_id}_tokens_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTokensResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create an API token (raw token shown once)",
        "operationId": "v1_api_admin_users_{user_id}_tokens_post",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/tokens/{token_id}": {
      "delete": {
        "summary": "Revoke an API token",
        "operationId": "v1_api_admin_tokens_{token_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "token_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/users/{user_id}/channels": {
      "get": {
        "summary": "List channel links for a user",
        "operationId": "v1_api_admin_users_{user_id}_channels_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListChannelUsersResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Link a channel account to a user",
        "operationId": "v1_api_admin_users_{user_id}_channels_post",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChannelUserRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelUserInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error 409",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/channels/{channel_type}/{channel_user_id}": {
      "delete": {
        "summary": "Unlink a channel account",
        "operationId": "v1_api_admin_channels_{channel_type}_{channel_user_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "channel_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel_user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/schedules": {
      "get": {
        "summary": "List all scheduled tasks",
        "operationId": "v1_api_admin_schedules_get",
        "tags": [
          "Schedules"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSchedulesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a scheduled task",
        "operationId": "v1_api_admin_schedules_post",
        "tags": [
          "Schedules"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/schedules/{task_id}": {
      "get": {
        "summary": "Get a scheduled task",
        "operationId": "v1_api_admin_schedules_{task_id}_get",
        "tags": [
          "Schedules"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update a scheduled task",
        "operationId": "v1_api_admin_schedules_{task_id}_put",
        "tags": [
          "Schedules"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateScheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a scheduled task",
        "operationId": "v1_api_admin_schedules_{task_id}_delete",
        "tags": [
          "Schedules"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/schedules/{task_id}/runs": {
      "get": {
        "summary": "List run history for a scheduled task",
        "operationId": "v1_api_admin_schedules_{task_id}_runs_get",
        "tags": [
          "Schedules"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50
            },
            "description": "Max results (default 50, max 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListScheduleRunsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/roles": {
      "get": {
        "summary": "List all roles",
        "operationId": "v1_api_admin_roles_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListRolesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a custom role",
        "operationId": "v1_api_admin_roles_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRoleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/roles/{role_id}": {
      "put": {
        "summary": "Update a role",
        "operationId": "v1_api_admin_roles_{role_id}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "role_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRoleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a custom role",
        "operationId": "v1_api_admin_roles_{role_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "role_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/users/{user_id}/roles": {
      "get": {
        "summary": "List roles assigned to a user",
        "operationId": "v1_api_admin_users_{user_id}_roles_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListUserRolesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Assign a role to a user",
        "operationId": "v1_api_admin_users_{user_id}_roles_post",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignRoleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/users/{user_id}/roles/{role_id}": {
      "delete": {
        "summary": "Unassign a role from a user",
        "operationId": "v1_api_admin_users_{user_id}_roles_{role_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "role_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/orgs": {
      "get": {
        "summary": "List organizations",
        "operationId": "v1_api_admin_orgs_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOrgsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/orgs/{org_id}": {
      "get": {
        "summary": "Get organization details",
        "operationId": "v1_api_admin_orgs_{org_id}_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update organization settings",
        "operationId": "v1_api_admin_orgs_{org_id}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrgRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/policies": {
      "get": {
        "summary": "List tool policies",
        "operationId": "v1_api_admin_policies_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListToolPoliciesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a tool policy",
        "operationId": "v1_api_admin_policies_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateToolPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolPolicyInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/policies/{policy_id}": {
      "put": {
        "summary": "Update a tool policy",
        "operationId": "v1_api_admin_policies_{policy_id}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateToolPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolPolicyInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a tool policy",
        "operationId": "v1_api_admin_policies_{policy_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/templates": {
      "get": {
        "summary": "List prompt templates",
        "operationId": "v1_api_admin_templates_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPromptTemplatesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a prompt template",
        "operationId": "v1_api_admin_templates_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePromptTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptTemplateInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/templates/{template_id}": {
      "put": {
        "summary": "Update a prompt template",
        "operationId": "v1_api_admin_templates_{template_id}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePromptTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptTemplateInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a prompt template",
        "operationId": "v1_api_admin_templates_{template_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/ws-templates": {
      "get": {
        "summary": "List workstream templates",
        "operationId": "v1_api_admin_ws-templates_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWsTemplatesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a workstream template",
        "operationId": "v1_api_admin_ws-templates_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWsTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WsTemplateInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error 409",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/ws-templates/{ws_template_id}": {
      "get": {
        "summary": "Get a workstream template",
        "operationId": "v1_api_admin_ws-templates_{ws_template_id}_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "ws_template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WsTemplateInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update a workstream template",
        "operationId": "v1_api_admin_ws-templates_{ws_template_id}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "ws_template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWsTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WsTemplateInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error 409",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a workstream template",
        "operationId": "v1_api_admin_ws-templates_{ws_template_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "ws_template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/ws-templates/{ws_template_id}/versions": {
      "get": {
        "summary": "List workstream template version history",
        "operationId": "v1_api_admin_ws-templates_{ws_template_id}_versions_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "ws_template_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWsTemplateVersionsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/ws-templates": {
      "get": {
        "summary": "List enabled workstream templates (summary)",
        "operationId": "v1_api_ws-templates_get",
        "tags": [
          "Workstreams"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWsTemplateSummaryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/templates": {
      "get": {
        "summary": "List available prompt templates (summary)",
        "operationId": "v1_api_templates_get",
        "tags": [
          "Templates"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPromptTemplateSummaryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/usage": {
      "get": {
        "summary": "Aggregated usage data",
        "operationId": "v1_api_admin_usage_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Start timestamp (ISO8601, defaults to last 7 days)"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "End timestamp (ISO8601)"
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by user"
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by model"
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "hour",
                "model",
                "user"
              ]
            },
            "description": "Group results"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/audit": {
      "get": {
        "summary": "Paginated audit events",
        "operationId": "v1_api_admin_audit_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by action type"
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by user"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Start timestamp (ISO8601)"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "End timestamp (ISO8601)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50
            },
            "description": "Page size"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Pagination offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAuditEventsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/verdicts": {
      "get": {
        "summary": "Paginated intent verdicts",
        "operationId": "v1_api_admin_verdicts_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "ws_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by workstream"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Start timestamp (ISO8601)"
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "End timestamp (ISO8601)"
          },
          {
            "name": "risk_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high",
                "critical"
              ]
            },
            "description": "Filter by risk level"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            },
            "description": "Page size (max 500)"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Pagination offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListVerdictsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/memories": {
      "get": {
        "summary": "List structured memories",
        "operationId": "v1_api_admin_memories_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by memory type"
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by scope"
          },
          {
            "name": "scope_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by scope identifier"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            },
            "description": "Page size (max 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAdminMemoriesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/memories/search": {
      "get": {
        "summary": "Search memories by query",
        "operationId": "v1_api_admin_memories_search_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by memory type"
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by scope"
          },
          {
            "name": "scope_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by scope identifier"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20
            },
            "description": "Max results"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAdminMemoriesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/memories/{memory_id}": {
      "get": {
        "summary": "Get a single memory by ID",
        "operationId": "v1_api_admin_memories_{memory_id}_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "memory_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminMemoryInfo"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a memory by ID",
        "operationId": "v1_api_admin_memories_{memory_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "memory_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/settings": {
      "get": {
        "summary": "List all settings with effective values",
        "operationId": "v1_api_admin_settings_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "reveal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Show secret values in plaintext"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSettingsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/settings/schema": {
      "get": {
        "summary": "Return the full settings registry schema",
        "operationId": "v1_api_admin_settings_schema_get",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSettingSchemaResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/settings/{key}": {
      "put": {
        "summary": "Set a configuration setting value",
        "operationId": "v1_api_admin_settings_{key}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingInfo"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Reset a setting to its default value",
        "operationId": "v1_api_admin_settings_{key}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "node_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Node ID for node-scoped settings"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/mcp-servers": {
      "get": {
        "summary": "List MCP server definitions with live status",
        "operationId": "v1_api_admin_mcp-servers_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "reveal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Show secret env/header values"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListMcpServersResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create an MCP server definition",
        "operationId": "v1_api_admin_mcp-servers_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMcpServerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error 409",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/mcp-servers/{server_id}": {
      "get": {
        "summary": "Get a single MCP server with status",
        "operationId": "v1_api_admin_mcp-servers_{server_id}_get",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "server_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerDetail"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update an MCP server definition",
        "operationId": "v1_api_admin_mcp-servers_{server_id}_put",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "server_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMcpServerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error 409",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete an MCP server definition",
        "operationId": "v1_api_admin_mcp-servers_{server_id}_delete",
        "tags": [
          "Admin"
        ],
        "parameters": [
          {
            "name": "server_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/mcp-servers/reload": {
      "post": {
        "summary": "Tell all nodes to re-read MCP server config from DB and reconcile",
        "operationId": "v1_api_admin_mcp-servers_reload_post",
        "tags": [
          "Admin"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpReloadResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/mcp-servers/import": {
      "post": {
        "summary": "Import MCP servers from a JSON config file",
        "operationId": "v1_api_admin_mcp-servers_import_post",
        "tags": [
          "Admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportMcpConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportMcpConfigResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Console health check",
        "operationId": "health_get",
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsoleHealthResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponse": {
        "description": "Standard error response body.",
        "properties": {
          "error": {
            "description": "Error message",
            "title": "Error",
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "title": "ErrorResponse",
        "type": "object"
      },
      "StatusResponse": {
        "description": "Generic success response.",
        "properties": {
          "status": {
            "default": "ok",
            "examples": [
              "ok"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "title": "StatusResponse",
        "type": "object"
      },
      "AuthLoginRequest": {
        "description": "POST /v1/api/auth/login request body.\n\nEither username+password or token must be provided.",
        "properties": {
          "username": {
            "default": "",
            "description": "Login username",
            "title": "Username",
            "type": "string"
          },
          "password": {
            "default": "",
            "description": "Login password",
            "title": "Password",
            "type": "string"
          },
          "token": {
            "default": "",
            "description": "Legacy: bearer token to authenticate",
            "title": "Token",
            "type": "string"
          }
        },
        "title": "AuthLoginRequest",
        "type": "object"
      },
      "AuthLoginResponse": {
        "description": "POST /v1/api/auth/login success response.",
        "properties": {
          "status": {
            "default": "ok",
            "title": "Status",
            "type": "string"
          },
          "user_id": {
            "default": "",
            "description": "Authenticated user ID",
            "title": "User Id",
            "type": "string"
          },
          "role": {
            "description": "Legacy role",
            "examples": [
              "full",
              "read"
            ],
            "title": "Role",
            "type": "string"
          },
          "scopes": {
            "default": "",
            "description": "Comma-separated scopes",
            "examples": [
              "read,write,approve"
            ],
            "title": "Scopes",
            "type": "string"
          },
          "jwt": {
            "default": "",
            "description": "JWT session token (if JWT auth is configured)",
            "title": "Jwt",
            "type": "string"
          }
        },
        "required": [
          "role"
        ],
        "title": "AuthLoginResponse",
        "type": "object"
      },
      "AuthSetupRequest": {
        "description": "POST /v1/api/auth/setup request body.",
        "properties": {
          "username": {
            "description": "Login username (1-64 ASCII characters)",
            "title": "Username",
            "type": "string"
          },
          "display_name": {
            "description": "Display name",
            "title": "Display Name",
            "type": "string"
          },
          "password": {
            "description": "Password (minimum 8 characters)",
            "title": "Password",
            "type": "string"
          }
        },
        "required": [
          "username",
          "display_name",
          "password"
        ],
        "title": "AuthSetupRequest",
        "type": "object"
      },
      "AuthSetupResponse": {
        "description": "POST /v1/api/auth/setup success response.",
        "properties": {
          "status": {
            "default": "ok",
            "title": "Status",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "username": {
            "title": "Username",
            "type": "string"
          },
          "role": {
            "default": "full",
            "title": "Role",
            "type": "string"
          },
          "scopes": {
            "default": "approve,read,write",
            "title": "Scopes",
            "type": "string"
          },
          "jwt": {
            "default": "",
            "description": "JWT session token",
            "title": "Jwt",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "username"
        ],
        "title": "AuthSetupResponse",
        "type": "object"
      },
      "AuthStatusResponse": {
        "description": "GET /v1/api/auth/status response.",
        "properties": {
          "auth_enabled": {
            "title": "Auth Enabled",
            "type": "boolean"
          },
          "has_users": {
            "title": "Has Users",
            "type": "boolean"
          },
          "setup_required": {
            "title": "Setup Required",
            "type": "boolean"
          },
          "oidc_enabled": {
            "default": false,
            "title": "Oidc Enabled",
            "type": "boolean"
          },
          "oidc_provider_name": {
            "default": "",
            "title": "Oidc Provider Name",
            "type": "string"
          },
          "password_enabled": {
            "default": true,
            "title": "Password Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "auth_enabled",
          "has_users",
          "setup_required"
        ],
        "title": "AuthStatusResponse",
        "type": "object"
      },
      "CreateUserRequest": {
        "description": "POST /v1/api/admin/users request body.",
        "properties": {
          "username": {
            "description": "Login username (unique)",
            "title": "Username",
            "type": "string"
          },
          "display_name": {
            "description": "Human-readable display name",
            "title": "Display Name",
            "type": "string"
          },
          "password": {
            "description": "Initial password",
            "title": "Password",
            "type": "string"
          }
        },
        "required": [
          "username",
          "display_name",
          "password"
        ],
        "title": "CreateUserRequest",
        "type": "object"
      },
      "UserInfo": {
        "description": "User record (no password_hash).",
        "properties": {
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "username": {
            "title": "Username",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "username",
          "display_name",
          "created"
        ],
        "title": "UserInfo",
        "type": "object"
      },
      "ListUsersResponse": {
        "description": "GET /v1/api/admin/users response.",
        "properties": {
          "users": {
            "items": {
              "$ref": "#/components/schemas/UserInfo"
            },
            "title": "Users",
            "type": "array"
          }
        },
        "required": [
          "users"
        ],
        "title": "ListUsersResponse",
        "type": "object"
      },
      "CreateTokenRequest": {
        "description": "POST /v1/api/admin/users/{user_id}/tokens request body.",
        "properties": {
          "name": {
            "default": "",
            "description": "Human label for the token",
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "default": "read,write,approve",
            "description": "Comma-separated scopes: read, write, approve",
            "title": "Scopes",
            "type": "string"
          },
          "expires_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Days until expiry (null = no expiry)",
            "title": "Expires Days"
          }
        },
        "title": "CreateTokenRequest",
        "type": "object"
      },
      "CreateTokenResponse": {
        "description": "POST /v1/api/admin/users/{user_id}/tokens response (raw token shown once).",
        "properties": {
          "token": {
            "description": "Raw API token \u2014 save this, it cannot be retrieved again",
            "title": "Token",
            "type": "string"
          },
          "token_id": {
            "title": "Token Id",
            "type": "string"
          },
          "token_prefix": {
            "title": "Token Prefix",
            "type": "string"
          },
          "scopes": {
            "title": "Scopes",
            "type": "string"
          }
        },
        "required": [
          "token",
          "token_id",
          "token_prefix",
          "scopes"
        ],
        "title": "CreateTokenResponse",
        "type": "object"
      },
      "ListTokensResponse": {
        "description": "GET /v1/api/admin/users/{user_id}/tokens response.",
        "properties": {
          "tokens": {
            "items": {
              "$ref": "#/components/schemas/TokenInfo"
            },
            "title": "Tokens",
            "type": "array"
          }
        },
        "required": [
          "tokens"
        ],
        "title": "ListTokensResponse",
        "type": "object"
      },
      "TokenInfo": {
        "description": "Token metadata (never includes the hash or raw token).",
        "properties": {
          "token_id": {
            "title": "Token Id",
            "type": "string"
          },
          "token_prefix": {
            "title": "Token Prefix",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "title": "Scopes",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "expires": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Expires"
          }
        },
        "required": [
          "token_id",
          "token_prefix",
          "name",
          "scopes",
          "created"
        ],
        "title": "TokenInfo",
        "type": "object"
      },
      "ChannelUserInfo": {
        "properties": {
          "channel_type": {
            "title": "Channel Type",
            "type": "string"
          },
          "channel_user_id": {
            "title": "Channel User Id",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          }
        },
        "required": [
          "channel_type",
          "channel_user_id",
          "user_id",
          "created"
        ],
        "title": "ChannelUserInfo",
        "type": "object"
      },
      "CreateChannelUserRequest": {
        "properties": {
          "channel_type": {
            "description": "Channel type (e.g. discord, slack)",
            "title": "Channel Type",
            "type": "string"
          },
          "channel_user_id": {
            "description": "External channel user identifier",
            "title": "Channel User Id",
            "type": "string"
          }
        },
        "required": [
          "channel_type",
          "channel_user_id"
        ],
        "title": "CreateChannelUserRequest",
        "type": "object"
      },
      "ListChannelUsersResponse": {
        "properties": {
          "channels": {
            "items": {
              "$ref": "#/components/schemas/ChannelUserInfo"
            },
            "title": "Channels",
            "type": "array"
          }
        },
        "required": [
          "channels"
        ],
        "title": "ListChannelUsersResponse",
        "type": "object"
      },
      "ClusterOverviewResponse": {
        "properties": {
          "nodes": {
            "default": 0,
            "title": "Nodes",
            "type": "integer"
          },
          "workstreams": {
            "default": 0,
            "title": "Workstreams",
            "type": "integer"
          },
          "states": {
            "$ref": "#/components/schemas/StateCounts",
            "default": {
              "running": 0,
              "thinking": 0,
              "attention": 0,
              "idle": 0,
              "error": 0
            }
          },
          "aggregate": {
            "$ref": "#/components/schemas/ClusterAggregate",
            "default": {
              "total_tokens": 0,
              "total_tool_calls": 0
            }
          },
          "version_drift": {
            "default": false,
            "title": "Version Drift",
            "type": "boolean"
          },
          "versions": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Versions",
            "type": "array"
          }
        },
        "title": "ClusterOverviewResponse",
        "type": "object"
      },
      "ClusterAggregate": {
        "properties": {
          "total_tokens": {
            "default": 0,
            "title": "Total Tokens",
            "type": "integer"
          },
          "total_tool_calls": {
            "default": 0,
            "title": "Total Tool Calls",
            "type": "integer"
          }
        },
        "title": "ClusterAggregate",
        "type": "object"
      },
      "StateCounts": {
        "properties": {
          "running": {
            "default": 0,
            "title": "Running",
            "type": "integer"
          },
          "thinking": {
            "default": 0,
            "title": "Thinking",
            "type": "integer"
          },
          "attention": {
            "default": 0,
            "title": "Attention",
            "type": "integer"
          },
          "idle": {
            "default": 0,
            "title": "Idle",
            "type": "integer"
          },
          "error": {
            "default": 0,
            "title": "Error",
            "type": "integer"
          }
        },
        "title": "StateCounts",
        "type": "object"
      },
      "ClusterNodesResponse": {
        "properties": {
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/ClusterNodeInfo"
            },
            "title": "Nodes",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "nodes"
        ],
        "title": "ClusterNodesResponse",
        "type": "object"
      },
      "ClusterNodeInfo": {
        "properties": {
          "node_id": {
            "title": "Node Id",
            "type": "string"
          },
          "server_url": {
            "default": "",
            "title": "Server Url",
            "type": "string"
          },
          "ws_total": {
            "default": 0,
            "title": "Ws Total",
            "type": "integer"
          },
          "ws_running": {
            "default": 0,
            "title": "Ws Running",
            "type": "integer"
          },
          "ws_thinking": {
            "default": 0,
            "title": "Ws Thinking",
            "type": "integer"
          },
          "ws_attention": {
            "default": 0,
            "title": "Ws Attention",
            "type": "integer"
          },
          "ws_idle": {
            "default": 0,
            "title": "Ws Idle",
            "type": "integer"
          },
          "ws_error": {
            "default": 0,
            "title": "Ws Error",
            "type": "integer"
          },
          "total_tokens": {
            "default": 0,
            "title": "Total Tokens",
            "type": "integer"
          },
          "started": {
            "default": 0.0,
            "title": "Started",
            "type": "number"
          },
          "reachable": {
            "default": true,
            "title": "Reachable",
            "type": "boolean"
          },
          "health": {
            "additionalProperties": true,
            "title": "Health",
            "type": "object"
          },
          "version": {
            "default": "",
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "node_id"
        ],
        "title": "ClusterNodeInfo",
        "type": "object"
      },
      "ClusterWorkstreamsResponse": {
        "properties": {
          "workstreams": {
            "items": {
              "$ref": "#/components/schemas/ClusterWorkstreamInfo"
            },
            "title": "Workstreams",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          },
          "page": {
            "default": 1,
            "title": "Page",
            "type": "integer"
          },
          "per_page": {
            "default": 50,
            "title": "Per Page",
            "type": "integer"
          },
          "pages": {
            "default": 1,
            "title": "Pages",
            "type": "integer"
          }
        },
        "required": [
          "workstreams"
        ],
        "title": "ClusterWorkstreamsResponse",
        "type": "object"
      },
      "ClusterWorkstreamInfo": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "default": "",
            "title": "Name",
            "type": "string"
          },
          "state": {
            "default": "",
            "title": "State",
            "type": "string"
          },
          "node": {
            "default": "",
            "title": "Node",
            "type": "string"
          },
          "title": {
            "default": "",
            "title": "Title",
            "type": "string"
          },
          "tokens": {
            "default": 0,
            "title": "Tokens",
            "type": "integer"
          },
          "context_ratio": {
            "default": 0.0,
            "title": "Context Ratio",
            "type": "number"
          },
          "activity": {
            "default": "",
            "title": "Activity",
            "type": "string"
          },
          "activity_state": {
            "default": "",
            "title": "Activity State",
            "type": "string"
          },
          "tool_calls": {
            "default": 0,
            "title": "Tool Calls",
            "type": "integer"
          }
        },
        "required": [
          "id"
        ],
        "title": "ClusterWorkstreamInfo",
        "type": "object"
      },
      "NodeDetailResponse": {
        "properties": {
          "node_id": {
            "title": "Node Id",
            "type": "string"
          },
          "server_url": {
            "default": "",
            "title": "Server Url",
            "type": "string"
          },
          "health": {
            "additionalProperties": true,
            "title": "Health",
            "type": "object"
          },
          "workstreams": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/ClusterWorkstreamInfo"
            },
            "title": "Workstreams",
            "type": "array"
          },
          "aggregate": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Aggregate",
            "type": "object"
          },
          "reachable": {
            "default": true,
            "title": "Reachable",
            "type": "boolean"
          }
        },
        "required": [
          "node_id"
        ],
        "title": "NodeDetailResponse",
        "type": "object"
      },
      "ClusterSnapshotResponse": {
        "properties": {
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/ClusterSnapshotNode"
            },
            "title": "Nodes",
            "type": "array"
          },
          "overview": {
            "$ref": "#/components/schemas/ClusterOverviewResponse"
          },
          "timestamp": {
            "default": 0.0,
            "title": "Timestamp",
            "type": "number"
          }
        },
        "required": [
          "nodes",
          "overview"
        ],
        "title": "ClusterSnapshotResponse",
        "type": "object"
      },
      "ClusterSnapshotNode": {
        "properties": {
          "node_id": {
            "title": "Node Id",
            "type": "string"
          },
          "server_url": {
            "default": "",
            "title": "Server Url",
            "type": "string"
          },
          "max_ws": {
            "default": 10,
            "title": "Max Ws",
            "type": "integer"
          },
          "reachable": {
            "default": true,
            "title": "Reachable",
            "type": "boolean"
          },
          "version": {
            "default": "",
            "title": "Version",
            "type": "string"
          },
          "health": {
            "additionalProperties": true,
            "title": "Health",
            "type": "object"
          },
          "aggregate": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Aggregate",
            "type": "object"
          },
          "workstreams": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/ClusterWorkstreamInfo"
            },
            "title": "Workstreams",
            "type": "array"
          }
        },
        "required": [
          "node_id"
        ],
        "title": "ClusterSnapshotNode",
        "type": "object"
      },
      "ConsoleCreateWsRequest": {
        "properties": {
          "node_id": {
            "default": "",
            "description": "Target node: specific ID, 'auto', 'pool', or empty for auto",
            "title": "Node Id",
            "type": "string"
          },
          "name": {
            "default": "",
            "description": "Workstream name (auto-generated if empty)",
            "title": "Name",
            "type": "string"
          },
          "model": {
            "default": "",
            "description": "Model alias from node registry",
            "title": "Model",
            "type": "string"
          },
          "initial_message": {
            "default": "",
            "description": "Optional first message sent after creation",
            "title": "Initial Message",
            "type": "string"
          },
          "template": {
            "default": "",
            "description": "Prompt template name (replaces default templates)",
            "title": "Template",
            "type": "string"
          },
          "ws_template": {
            "default": "",
            "description": "Workstream template name (behavioral profile)",
            "title": "Ws Template",
            "type": "string"
          }
        },
        "title": "ConsoleCreateWsRequest",
        "type": "object"
      },
      "ConsoleCreateWsResponse": {
        "properties": {
          "status": {
            "default": "ok",
            "title": "Status",
            "type": "string"
          },
          "correlation_id": {
            "default": "",
            "title": "Correlation Id",
            "type": "string"
          },
          "target_node": {
            "default": "",
            "title": "Target Node",
            "type": "string"
          }
        },
        "title": "ConsoleCreateWsResponse",
        "type": "object"
      },
      "ConsoleHealthResponse": {
        "properties": {
          "status": {
            "default": "ok",
            "examples": [
              "ok"
            ],
            "title": "Status",
            "type": "string"
          },
          "service": {
            "default": "turnstone-console",
            "title": "Service",
            "type": "string"
          },
          "nodes": {
            "default": 0,
            "title": "Nodes",
            "type": "integer"
          },
          "workstreams": {
            "default": 0,
            "title": "Workstreams",
            "type": "integer"
          },
          "version_drift": {
            "default": false,
            "title": "Version Drift",
            "type": "boolean"
          },
          "versions": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Versions",
            "type": "array"
          }
        },
        "title": "ConsoleHealthResponse",
        "type": "object"
      },
      "CreateScheduleRequest": {
        "description": "POST /v1/api/admin/schedules request body.",
        "properties": {
          "name": {
            "description": "Human-readable schedule name",
            "title": "Name",
            "type": "string"
          },
          "description": {
            "default": "",
            "description": "Optional description",
            "title": "Description",
            "type": "string"
          },
          "schedule_type": {
            "description": "'cron' or 'at'",
            "title": "Schedule Type",
            "type": "string"
          },
          "cron_expr": {
            "default": "",
            "description": "Cron expression (when schedule_type='cron')",
            "title": "Cron Expr",
            "type": "string"
          },
          "at_time": {
            "default": "",
            "description": "ISO8601 timestamp (when schedule_type='at')",
            "title": "At Time",
            "type": "string"
          },
          "target_mode": {
            "default": "auto",
            "description": "auto, pool, all, or specific node_id",
            "title": "Target Mode",
            "type": "string"
          },
          "model": {
            "default": "",
            "description": "Model alias for the workstream",
            "title": "Model",
            "type": "string"
          },
          "initial_message": {
            "description": "Message sent to the new workstream",
            "title": "Initial Message",
            "type": "string"
          },
          "auto_approve": {
            "default": false,
            "title": "Auto Approve",
            "type": "boolean"
          },
          "auto_approve_tools": {
            "items": {
              "type": "string"
            },
            "title": "Auto Approve Tools",
            "type": "array"
          },
          "template": {
            "default": "",
            "description": "Prompt template name",
            "title": "Template",
            "type": "string"
          },
          "ws_template": {
            "default": "",
            "description": "Workstream template name",
            "title": "Ws Template",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "schedule_type",
          "initial_message"
        ],
        "title": "CreateScheduleRequest",
        "type": "object"
      },
      "UpdateScheduleRequest": {
        "description": "PUT /v1/api/admin/schedules/{task_id} request body (partial update).",
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Description"
          },
          "schedule_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Schedule Type"
          },
          "cron_expr": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Cron Expr"
          },
          "at_time": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "At Time"
          },
          "target_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Target Mode"
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Model"
          },
          "initial_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Initial Message"
          },
          "auto_approve": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Auto Approve"
          },
          "auto_approve_tools": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Auto Approve Tools"
          },
          "template": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Template"
          },
          "ws_template": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Ws Template"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Enabled"
          }
        },
        "title": "UpdateScheduleRequest",
        "type": "object"
      },
      "ScheduleInfo": {
        "description": "Scheduled task details.",
        "properties": {
          "task_id": {
            "title": "Task Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "description": {
            "default": "",
            "title": "Description",
            "type": "string"
          },
          "schedule_type": {
            "title": "Schedule Type",
            "type": "string"
          },
          "cron_expr": {
            "default": "",
            "title": "Cron Expr",
            "type": "string"
          },
          "at_time": {
            "default": "",
            "title": "At Time",
            "type": "string"
          },
          "target_mode": {
            "default": "auto",
            "title": "Target Mode",
            "type": "string"
          },
          "model": {
            "default": "",
            "title": "Model",
            "type": "string"
          },
          "initial_message": {
            "title": "Initial Message",
            "type": "string"
          },
          "auto_approve": {
            "default": false,
            "title": "Auto Approve",
            "type": "boolean"
          },
          "auto_approve_tools": {
            "items": {
              "type": "string"
            },
            "title": "Auto Approve Tools",
            "type": "array"
          },
          "template": {
            "default": "",
            "title": "Template",
            "type": "string"
          },
          "ws_template": {
            "default": "",
            "title": "Ws Template",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "created_by": {
            "default": "",
            "title": "Created By",
            "type": "string"
          },
          "last_run": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Last Run"
          },
          "next_run": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Next Run"
          },
          "created": {
            "default": "",
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "default": "",
            "title": "Updated",
            "type": "string"
          }
        },
        "required": [
          "task_id",
          "name",
          "schedule_type",
          "initial_message"
        ],
        "title": "ScheduleInfo",
        "type": "object"
      },
      "ListSchedulesResponse": {
        "description": "GET /v1/api/admin/schedules response.",
        "properties": {
          "schedules": {
            "items": {
              "$ref": "#/components/schemas/ScheduleInfo"
            },
            "title": "Schedules",
            "type": "array"
          }
        },
        "required": [
          "schedules"
        ],
        "title": "ListSchedulesResponse",
        "type": "object"
      },
      "ListScheduleRunsResponse": {
        "description": "GET /v1/api/admin/schedules/{task_id}/runs response.",
        "properties": {
          "runs": {
            "items": {
              "$ref": "#/components/schemas/ScheduleRunInfo"
            },
            "title": "Runs",
            "type": "array"
          }
        },
        "required": [
          "runs"
        ],
        "title": "ListScheduleRunsResponse",
        "type": "object"
      },
      "ScheduleRunInfo": {
        "description": "Single execution record for a scheduled task.",
        "properties": {
          "run_id": {
            "title": "Run Id",
            "type": "string"
          },
          "task_id": {
            "title": "Task Id",
            "type": "string"
          },
          "node_id": {
            "default": "",
            "title": "Node Id",
            "type": "string"
          },
          "ws_id": {
            "default": "",
            "title": "Ws Id",
            "type": "string"
          },
          "correlation_id": {
            "default": "",
            "title": "Correlation Id",
            "type": "string"
          },
          "started": {
            "title": "Started",
            "type": "string"
          },
          "status": {
            "default": "dispatched",
            "title": "Status",
            "type": "string"
          },
          "error": {
            "default": "",
            "title": "Error",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "task_id",
          "started"
        ],
        "title": "ScheduleRunInfo",
        "type": "object"
      },
      "RoleInfo": {
        "properties": {
          "role_id": {
            "title": "Role Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "permissions": {
            "title": "Permissions",
            "type": "string"
          },
          "builtin": {
            "title": "Builtin",
            "type": "boolean"
          },
          "org_id": {
            "title": "Org Id",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          }
        },
        "required": [
          "role_id",
          "name",
          "display_name",
          "permissions",
          "builtin",
          "org_id",
          "created",
          "updated"
        ],
        "title": "RoleInfo",
        "type": "object"
      },
      "CreateRoleRequest": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "display_name": {
            "default": "",
            "title": "Display Name",
            "type": "string"
          },
          "permissions": {
            "default": "read",
            "title": "Permissions",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "CreateRoleRequest",
        "type": "object"
      },
      "UpdateRoleRequest": {
        "properties": {
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Display Name"
          },
          "permissions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Permissions"
          }
        },
        "title": "UpdateRoleRequest",
        "type": "object"
      },
      "ListRolesResponse": {
        "properties": {
          "roles": {
            "items": {
              "$ref": "#/components/schemas/RoleInfo"
            },
            "title": "Roles",
            "type": "array"
          }
        },
        "required": [
          "roles"
        ],
        "title": "ListRolesResponse",
        "type": "object"
      },
      "AssignRoleRequest": {
        "properties": {
          "role_id": {
            "title": "Role Id",
            "type": "string"
          }
        },
        "required": [
          "role_id"
        ],
        "title": "AssignRoleRequest",
        "type": "object"
      },
      "UserRoleInfo": {
        "properties": {
          "role_id": {
            "title": "Role Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "permissions": {
            "title": "Permissions",
            "type": "string"
          },
          "builtin": {
            "title": "Builtin",
            "type": "boolean"
          },
          "org_id": {
            "title": "Org Id",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          },
          "assigned_by": {
            "title": "Assigned By",
            "type": "string"
          },
          "assignment_created": {
            "title": "Assignment Created",
            "type": "string"
          }
        },
        "required": [
          "role_id",
          "name",
          "display_name",
          "permissions",
          "builtin",
          "org_id",
          "created",
          "updated",
          "assigned_by",
          "assignment_created"
        ],
        "title": "UserRoleInfo",
        "type": "object"
      },
      "ListUserRolesResponse": {
        "properties": {
          "roles": {
            "items": {
              "$ref": "#/components/schemas/UserRoleInfo"
            },
            "title": "Roles",
            "type": "array"
          }
        },
        "required": [
          "roles"
        ],
        "title": "ListUserRolesResponse",
        "type": "object"
      },
      "OrgInfo": {
        "properties": {
          "org_id": {
            "title": "Org Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "settings": {
            "title": "Settings",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          }
        },
        "required": [
          "org_id",
          "name",
          "display_name",
          "settings",
          "created",
          "updated"
        ],
        "title": "OrgInfo",
        "type": "object"
      },
      "UpdateOrgRequest": {
        "properties": {
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Display Name"
          },
          "settings": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Settings"
          }
        },
        "title": "UpdateOrgRequest",
        "type": "object"
      },
      "ListOrgsResponse": {
        "properties": {
          "orgs": {
            "items": {
              "$ref": "#/components/schemas/OrgInfo"
            },
            "title": "Orgs",
            "type": "array"
          }
        },
        "required": [
          "orgs"
        ],
        "title": "ListOrgsResponse",
        "type": "object"
      },
      "ToolPolicyInfo": {
        "properties": {
          "policy_id": {
            "title": "Policy Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tool_pattern": {
            "title": "Tool Pattern",
            "type": "string"
          },
          "action": {
            "title": "Action",
            "type": "string"
          },
          "priority": {
            "title": "Priority",
            "type": "integer"
          },
          "org_id": {
            "title": "Org Id",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "created_by": {
            "title": "Created By",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          }
        },
        "required": [
          "policy_id",
          "name",
          "tool_pattern",
          "action",
          "priority",
          "org_id",
          "enabled",
          "created_by",
          "created",
          "updated"
        ],
        "title": "ToolPolicyInfo",
        "type": "object"
      },
      "CreateToolPolicyRequest": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tool_pattern": {
            "title": "Tool Pattern",
            "type": "string"
          },
          "action": {
            "title": "Action",
            "type": "string"
          },
          "priority": {
            "default": 0,
            "title": "Priority",
            "type": "integer"
          },
          "org_id": {
            "default": "",
            "title": "Org Id",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "tool_pattern",
          "action"
        ],
        "title": "CreateToolPolicyRequest",
        "type": "object"
      },
      "UpdateToolPolicyRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Name"
          },
          "tool_pattern": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Tool Pattern"
          },
          "action": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Action"
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Priority"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Enabled"
          }
        },
        "title": "UpdateToolPolicyRequest",
        "type": "object"
      },
      "ListToolPoliciesResponse": {
        "properties": {
          "policies": {
            "items": {
              "$ref": "#/components/schemas/ToolPolicyInfo"
            },
            "title": "Policies",
            "type": "array"
          }
        },
        "required": [
          "policies"
        ],
        "title": "ListToolPoliciesResponse",
        "type": "object"
      },
      "PromptTemplateInfo": {
        "properties": {
          "template_id": {
            "title": "Template Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "category": {
            "title": "Category",
            "type": "string"
          },
          "content": {
            "title": "Content",
            "type": "string"
          },
          "variables": {
            "title": "Variables",
            "type": "string"
          },
          "is_default": {
            "title": "Is Default",
            "type": "boolean"
          },
          "org_id": {
            "title": "Org Id",
            "type": "string"
          },
          "created_by": {
            "title": "Created By",
            "type": "string"
          },
          "origin": {
            "default": "manual",
            "title": "Origin",
            "type": "string"
          },
          "mcp_server": {
            "default": "",
            "title": "Mcp Server",
            "type": "string"
          },
          "readonly": {
            "default": false,
            "title": "Readonly",
            "type": "boolean"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          }
        },
        "required": [
          "template_id",
          "name",
          "category",
          "content",
          "variables",
          "is_default",
          "org_id",
          "created_by",
          "created",
          "updated"
        ],
        "title": "PromptTemplateInfo",
        "type": "object"
      },
      "CreatePromptTemplateRequest": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "content": {
            "title": "Content",
            "type": "string"
          },
          "category": {
            "default": "general",
            "title": "Category",
            "type": "string"
          },
          "variables": {
            "default": "[]",
            "title": "Variables",
            "type": "string"
          },
          "is_default": {
            "default": false,
            "title": "Is Default",
            "type": "boolean"
          },
          "org_id": {
            "default": "",
            "title": "Org Id",
            "type": "string"
          }
        },
        "required": [
          "name",
          "content"
        ],
        "title": "CreatePromptTemplateRequest",
        "type": "object"
      },
      "UpdatePromptTemplateRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Name"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Content"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Category"
          },
          "variables": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Variables"
          },
          "is_default": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Is Default"
          }
        },
        "title": "UpdatePromptTemplateRequest",
        "type": "object"
      },
      "ListPromptTemplatesResponse": {
        "properties": {
          "templates": {
            "items": {
              "$ref": "#/components/schemas/PromptTemplateInfo"
            },
            "title": "Templates",
            "type": "array"
          }
        },
        "required": [
          "templates"
        ],
        "title": "ListPromptTemplatesResponse",
        "type": "object"
      },
      "UsageBreakdownItem": {
        "properties": {
          "key": {
            "default": "",
            "title": "Key",
            "type": "string"
          },
          "prompt_tokens": {
            "default": 0,
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "completion_tokens": {
            "default": 0,
            "title": "Completion Tokens",
            "type": "integer"
          },
          "tool_calls_count": {
            "default": 0,
            "title": "Tool Calls Count",
            "type": "integer"
          }
        },
        "title": "UsageBreakdownItem",
        "type": "object"
      },
      "UsageResponse": {
        "properties": {
          "summary": {
            "items": {
              "$ref": "#/components/schemas/UsageBreakdownItem"
            },
            "title": "Summary",
            "type": "array"
          },
          "breakdown": {
            "items": {
              "$ref": "#/components/schemas/UsageBreakdownItem"
            },
            "title": "Breakdown",
            "type": "array"
          }
        },
        "required": [
          "summary",
          "breakdown"
        ],
        "title": "UsageResponse",
        "type": "object"
      },
      "AuditEventInfo": {
        "properties": {
          "event_id": {
            "title": "Event Id",
            "type": "string"
          },
          "timestamp": {
            "title": "Timestamp",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "action": {
            "title": "Action",
            "type": "string"
          },
          "resource_type": {
            "title": "Resource Type",
            "type": "string"
          },
          "resource_id": {
            "title": "Resource Id",
            "type": "string"
          },
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "ip_address": {
            "title": "Ip Address",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          }
        },
        "required": [
          "event_id",
          "timestamp",
          "user_id",
          "action",
          "resource_type",
          "resource_id",
          "detail",
          "ip_address",
          "created"
        ],
        "title": "AuditEventInfo",
        "type": "object"
      },
      "ListAuditEventsResponse": {
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/AuditEventInfo"
            },
            "title": "Events",
            "type": "array"
          }
        },
        "required": [
          "events"
        ],
        "title": "ListAuditEventsResponse",
        "type": "object"
      },
      "VerdictInfo": {
        "description": "Intent validation verdict.",
        "properties": {
          "verdict_id": {
            "title": "Verdict Id",
            "type": "string"
          },
          "ws_id": {
            "title": "Ws Id",
            "type": "string"
          },
          "call_id": {
            "title": "Call Id",
            "type": "string"
          },
          "func_name": {
            "title": "Func Name",
            "type": "string"
          },
          "func_args": {
            "default": "",
            "title": "Func Args",
            "type": "string"
          },
          "intent_summary": {
            "title": "Intent Summary",
            "type": "string"
          },
          "risk_level": {
            "title": "Risk Level",
            "type": "string"
          },
          "confidence": {
            "title": "Confidence",
            "type": "number"
          },
          "recommendation": {
            "title": "Recommendation",
            "type": "string"
          },
          "reasoning": {
            "title": "Reasoning",
            "type": "string"
          },
          "evidence": {
            "default": "[]",
            "title": "Evidence",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          },
          "judge_model": {
            "default": "",
            "title": "Judge Model",
            "type": "string"
          },
          "user_decision": {
            "default": "",
            "title": "User Decision",
            "type": "string"
          },
          "latency_ms": {
            "default": 0,
            "title": "Latency Ms",
            "type": "integer"
          },
          "created": {
            "title": "Created",
            "type": "string"
          }
        },
        "required": [
          "verdict_id",
          "ws_id",
          "call_id",
          "func_name",
          "intent_summary",
          "risk_level",
          "confidence",
          "recommendation",
          "reasoning",
          "tier",
          "created"
        ],
        "title": "VerdictInfo",
        "type": "object"
      },
      "ListVerdictsResponse": {
        "description": "Response for verdict listing.",
        "properties": {
          "verdicts": {
            "items": {
              "$ref": "#/components/schemas/VerdictInfo"
            },
            "title": "Verdicts",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "verdicts",
          "total"
        ],
        "title": "ListVerdictsResponse",
        "type": "object"
      },
      "AdminMemoryInfo": {
        "properties": {
          "memory_id": {
            "title": "Memory Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "description": {
            "default": "",
            "title": "Description",
            "type": "string"
          },
          "type": {
            "title": "Type",
            "type": "string"
          },
          "scope": {
            "title": "Scope",
            "type": "string"
          },
          "scope_id": {
            "default": "",
            "title": "Scope Id",
            "type": "string"
          },
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          },
          "last_accessed": {
            "default": "",
            "title": "Last Accessed",
            "type": "string"
          },
          "access_count": {
            "default": 0,
            "title": "Access Count",
            "type": "integer"
          }
        },
        "required": [
          "memory_id",
          "name",
          "type",
          "scope",
          "content",
          "created",
          "updated"
        ],
        "title": "AdminMemoryInfo",
        "type": "object"
      },
      "ListAdminMemoriesResponse": {
        "properties": {
          "memories": {
            "items": {
              "$ref": "#/components/schemas/AdminMemoryInfo"
            },
            "title": "Memories",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "memories"
        ],
        "title": "ListAdminMemoriesResponse",
        "type": "object"
      },
      "SettingInfo": {
        "properties": {
          "key": {
            "title": "Key",
            "type": "string"
          },
          "value": {
            "default": null,
            "title": "Value"
          },
          "source": {
            "default": "default",
            "title": "Source",
            "type": "string"
          },
          "type": {
            "default": "str",
            "title": "Type",
            "type": "string"
          },
          "description": {
            "default": "",
            "title": "Description",
            "type": "string"
          },
          "section": {
            "default": "",
            "title": "Section",
            "type": "string"
          },
          "is_secret": {
            "default": false,
            "title": "Is Secret",
            "type": "boolean"
          },
          "node_id": {
            "default": "",
            "title": "Node Id",
            "type": "string"
          },
          "changed_by": {
            "default": "",
            "title": "Changed By",
            "type": "string"
          },
          "updated": {
            "default": "",
            "title": "Updated",
            "type": "string"
          },
          "restart_required": {
            "default": false,
            "title": "Restart Required",
            "type": "boolean"
          }
        },
        "required": [
          "key"
        ],
        "title": "SettingInfo",
        "type": "object"
      },
      "ListSettingsResponse": {
        "properties": {
          "settings": {
            "items": {
              "$ref": "#/components/schemas/SettingInfo"
            },
            "title": "Settings",
            "type": "array"
          }
        },
        "required": [
          "settings"
        ],
        "title": "ListSettingsResponse",
        "type": "object"
      },
      "SettingSchemaInfo": {
        "properties": {
          "key": {
            "title": "Key",
            "type": "string"
          },
          "type": {
            "title": "Type",
            "type": "string"
          },
          "default": {
            "default": null,
            "title": "Default"
          },
          "description": {
            "default": "",
            "title": "Description",
            "type": "string"
          },
          "section": {
            "default": "",
            "title": "Section",
            "type": "string"
          },
          "is_secret": {
            "default": false,
            "title": "Is Secret",
            "type": "boolean"
          },
          "min_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Min Value"
          },
          "max_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Max Value"
          },
          "choices": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Choices"
          },
          "restart_required": {
            "default": false,
            "title": "Restart Required",
            "type": "boolean"
          }
        },
        "required": [
          "key",
          "type"
        ],
        "title": "SettingSchemaInfo",
        "type": "object"
      },
      "ListSettingSchemaResponse": {
        "properties": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/SettingSchemaInfo"
            },
            "title": "Schema",
            "type": "array"
          }
        },
        "required": [
          "schema"
        ],
        "title": "ListSettingSchemaResponse",
        "type": "object"
      },
      "UpdateSettingRequest": {
        "properties": {
          "value": {
            "title": "Value"
          },
          "node_id": {
            "default": "",
            "title": "Node Id",
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "title": "UpdateSettingRequest",
        "type": "object"
      },
      "McpServerDetail": {
        "properties": {
          "server_id": {
            "title": "Server Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "transport": {
            "title": "Transport",
            "type": "string"
          },
          "command": {
            "default": "",
            "title": "Command",
            "type": "string"
          },
          "args": {
            "default": "[]",
            "title": "Args",
            "type": "string"
          },
          "url": {
            "default": "",
            "title": "Url",
            "type": "string"
          },
          "headers": {
            "default": "{}",
            "title": "Headers",
            "type": "string"
          },
          "env": {
            "default": "{}",
            "title": "Env",
            "type": "string"
          },
          "auto_approve": {
            "default": false,
            "title": "Auto Approve",
            "type": "boolean"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "created_by": {
            "default": "",
            "title": "Created By",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "string"
          },
          "status": {
            "additionalProperties": {
              "$ref": "#/components/schemas/McpServerStatus"
            },
            "title": "Status",
            "type": "object"
          },
          "source": {
            "default": "",
            "title": "Source",
            "type": "string"
          }
        },
        "required": [
          "server_id",
          "name",
          "transport",
          "created",
          "updated"
        ],
        "title": "McpServerDetail",
        "type": "object"
      },
      "McpServerStatus": {
        "properties": {
          "connected": {
            "default": false,
            "title": "Connected",
            "type": "boolean"
          },
          "tools": {
            "default": 0,
            "title": "Tools",
            "type": "integer"
          },
          "resources": {
            "default": 0,
            "title": "Resources",
            "type": "integer"
          },
          "prompts": {
            "default": 0,
            "title": "Prompts",
            "type": "integer"
          },
          "error": {
            "default": "",
            "title": "Error",
            "type": "string"
          },
          "transport": {
            "default": "",
            "title": "Transport",
            "type": "string"
          },
          "command": {
            "default": "",
            "title": "Command",
            "type": "string"
          },
          "url": {
            "default": "",
            "title": "Url",
            "type": "string"
          }
        },
        "title": "McpServerStatus",
        "type": "object"
      },
      "CreateMcpServerRequest": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "transport": {
            "title": "Transport",
            "type": "string"
          },
          "command": {
            "default": "",
            "title": "Command",
            "type": "string"
          },
          "args": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Args",
            "type": "array"
          },
          "url": {
            "default": "",
            "title": "Url",
            "type": "string"
          },
          "headers": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Headers",
            "type": "object"
          },
          "env": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Env",
            "type": "object"
          },
          "auto_approve": {
            "default": false,
            "title": "Auto Approve",
            "type": "boolean"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "transport"
        ],
        "title": "CreateMcpServerRequest",
        "type": "object"
      },
      "UpdateMcpServerRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Name"
          },
          "transport": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Transport"
          },
          "command": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Command"
          },
          "args": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Args"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Url"
          },
          "headers": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Headers"
          },
          "env": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Env"
          },
          "auto_approve": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Auto Approve"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Enabled"
          }
        },
        "title": "UpdateMcpServerRequest",
        "type": "object"
      },
      "ListMcpServersResponse": {
        "properties": {
          "servers": {
            "items": {
              "$ref": "#/components/schemas/McpServerDetail"
            },
            "title": "Servers",
            "type": "array"
          }
        },
        "required": [
          "servers"
        ],
        "title": "ListMcpServersResponse",
        "type": "object"
      },
      "ImportMcpConfigRequest": {
        "properties": {
          "config": {
            "additionalProperties": true,
            "description": "JSON config object with mcpServers key",
            "title": "Config",
            "type": "object"
          }
        },
        "required": [
          "config"
        ],
        "title": "ImportMcpConfigRequest",
        "type": "object"
      },
      "ImportMcpConfigResponse": {
        "properties": {
          "imported": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Imported",
            "type": "array"
          },
          "skipped": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Skipped",
            "type": "array"
          },
          "errors": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Errors",
            "type": "array"
          }
        },
        "title": "ImportMcpConfigResponse",
        "type": "object"
      },
      "McpReloadResponse": {
        "properties": {
          "status": {
            "default": "ok",
            "title": "Status",
            "type": "string"
          },
          "results": {
            "additionalProperties": true,
            "title": "Results",
            "type": "object"
          }
        },
        "title": "McpReloadResponse",
        "type": "object"
      },
      "PromptTemplateSummary": {
        "properties": {
          "name": {
            "description": "Template name",
            "title": "Name",
            "type": "string"
          },
          "category": {
            "default": "",
            "description": "Template category",
            "title": "Category",
            "type": "string"
          },
          "is_default": {
            "default": false,
            "description": "Whether this template is applied by default",
            "title": "Is Default",
            "type": "boolean"
          },
          "origin": {
            "default": "manual",
            "description": "Template origin: manual or mcp",
            "title": "Origin",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "PromptTemplateSummary",
        "type": "object"
      },
      "ListPromptTemplateSummaryResponse": {
        "properties": {
          "templates": {
            "items": {
              "$ref": "#/components/schemas/PromptTemplateSummary"
            },
            "title": "Templates",
            "type": "array"
          }
        },
        "required": [
          "templates"
        ],
        "title": "ListPromptTemplateSummaryResponse",
        "type": "object"
      }
    }
  }
}
