{
  "components": {
    "schemas": {
      "ActiveSubtasksResponse": {
        "description": "Response for `GET .../sessions/{session_id}/subtasks/active` (#3124).",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "subtasks": {
            "items": {
              "$ref": "#/components/schemas/SubtaskSummary"
            },
            "title": "Subtasks",
            "type": "array"
          }
        },
        "required": [
          "subtasks",
          "count"
        ],
        "title": "ActiveSubtasksResponse",
        "type": "object"
      },
      "AdminMailHealRequest": {
        "description": "Body for ``POST /admin/mail/heal``.\n\n``service`` selects which mailbox kind to reconcile: ``internal`` (the\ndefault, for backward compatibility with the existing Internal-tab button)\nprovisions an internal mailbox for every agent that lacks one; ``external``\nconverges external mailboxes onto the tenant + per-agent enablement flags\n(see docs/content/mail.md \"External mailbox enablement\").",
        "properties": {
          "service": {
            "enum": [
              "internal",
              "external"
            ],
            "title": "Service",
            "type": "string"
          }
        },
        "title": "AdminMailHealRequest",
        "type": "object"
      },
      "AdminMailHealResult": {
        "description": "Result of a mailbox heal (backfill) run.",
        "properties": {
          "provisioned": {
            "title": "Provisioned",
            "type": "integer"
          },
          "provisioning_enabled": {
            "default": true,
            "title": "Provisioning Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "provisioned"
        ],
        "title": "AdminMailHealResult",
        "type": "object"
      },
      "AdminMailboxRow": {
        "description": "One mailbox row in the SuperAdmin cluster-wide roster.\n\n`is_paused` is the documented field name in `docs/content/mail.md`. The\nunderlying column today is `mailbox.is_active` (default true); the read\nsurface inverts it so paused == not active. Pause/resume mutation\nendpoints have their own tracking issue.",
        "properties": {
          "address": {
            "title": "Address",
            "type": "string"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_paused": {
            "title": "Is Paused",
            "type": "boolean"
          },
          "last_message_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Message At"
          },
          "message_count": {
            "title": "Message Count",
            "type": "integer"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "tenant_name": {
            "title": "Tenant Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "address",
          "tenant_id",
          "tenant_name",
          "agent_name",
          "message_count",
          "last_message_at",
          "is_paused"
        ],
        "title": "AdminMailboxRow",
        "type": "object"
      },
      "AdminModelUpdate": {
        "description": "SuperAdmin-only patch: allows setting `is_free`, `failover_chain`, and\n`available_to_all_tenants` (the \"available to every tenant\" switch).",
        "properties": {
          "available_to_all_tenants": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Available To All Tenants"
          },
          "config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "failover_chain": {
            "anyOf": [
              {
                "items": {
                  "maxLength": 25,
                  "minLength": 25,
                  "pattern": "^c[a-z0-9]{24}$",
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failover Chain"
          },
          "is_free": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Free"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "pricing": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pricing"
          },
          "status": {
            "anyOf": [
              {
                "enum": [
                  "active",
                  "disabled",
                  "experimental",
                  "deprecated"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          }
        },
        "title": "AdminModelUpdate",
        "type": "object"
      },
      "AdminTenantDetailRead": {
        "description": "Full per-tenant detail for SuperAdmin: includes plan, 30-day aggregates.",
        "properties": {
          "abandoned_warning_sent_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Abandoned Warning Sent At"
          },
          "agent_count": {
            "title": "Agent Count",
            "type": "integer"
          },
          "allow_superadmin_access": {
            "default": true,
            "title": "Allow Superadmin Access",
            "type": "boolean"
          },
          "billing_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Email"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "default_skill_visibility_scope": {
            "enum": [
              "private_only",
              "tenant_allowed"
            ],
            "title": "Default Skill Visibility Scope",
            "type": "string"
          },
          "external_mail_enabled": {
            "default": false,
            "title": "External Mail Enabled",
            "type": "boolean"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_suspended": {
            "default": false,
            "title": "Is Suspended",
            "type": "boolean"
          },
          "last_active_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Active At"
          },
          "member_count": {
            "title": "Member Count",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "paid": {
            "default": false,
            "title": "Paid",
            "type": "boolean"
          },
          "plan": {
            "$ref": "#/components/schemas/PlanRead"
          },
          "plan_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Plan Id",
            "type": "string"
          },
          "plan_status": {
            "enum": [
              "trialing",
              "active",
              "past_due",
              "canceled"
            ],
            "title": "Plan Status",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/TenantStatus",
            "default": "active"
          },
          "task_summary_30d": {
            "$ref": "#/components/schemas/TaskSummary30d"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "usage_summary_30d": {
            "$ref": "#/components/schemas/UsageSummary30d"
          },
          "voicebox_enabled": {
            "default": false,
            "title": "Voicebox Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "plan_id",
          "billing_email",
          "created_at",
          "updated_at",
          "member_count",
          "agent_count",
          "plan",
          "plan_status",
          "usage_summary_30d",
          "task_summary_30d",
          "last_active_at"
        ],
        "title": "AdminTenantDetailRead",
        "type": "object"
      },
      "AdminTenantRead": {
        "description": "TenantRead with computed counts for the super-admin listing.",
        "properties": {
          "abandoned_warning_sent_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Abandoned Warning Sent At"
          },
          "agent_count": {
            "title": "Agent Count",
            "type": "integer"
          },
          "allow_superadmin_access": {
            "default": true,
            "title": "Allow Superadmin Access",
            "type": "boolean"
          },
          "billing_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Email"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "default_skill_visibility_scope": {
            "enum": [
              "private_only",
              "tenant_allowed"
            ],
            "title": "Default Skill Visibility Scope",
            "type": "string"
          },
          "external_mail_enabled": {
            "default": false,
            "title": "External Mail Enabled",
            "type": "boolean"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_suspended": {
            "default": false,
            "title": "Is Suspended",
            "type": "boolean"
          },
          "member_count": {
            "title": "Member Count",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "paid": {
            "default": false,
            "title": "Paid",
            "type": "boolean"
          },
          "plan_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Plan Id",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/TenantStatus",
            "default": "active"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "voicebox_enabled": {
            "default": false,
            "title": "Voicebox Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "plan_id",
          "billing_email",
          "created_at",
          "updated_at",
          "member_count",
          "agent_count"
        ],
        "title": "AdminTenantRead",
        "type": "object"
      },
      "AdminUserPrimaryTenant": {
        "description": "Lightweight tenant reference for the SuperAdmin users listing.",
        "properties": {
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "role"
        ],
        "title": "AdminUserPrimaryTenant",
        "type": "object"
      },
      "AdminUserRow": {
        "description": "One row in the SuperAdmin \"Users\" listing (``GET /api/v1/admin/users``).",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_super_admin": {
            "title": "Is Super Admin",
            "type": "boolean"
          },
          "is_suspended": {
            "title": "Is Suspended",
            "type": "boolean"
          },
          "last_login_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Login At"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "primary_tenant": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AdminUserPrimaryTenant"
              },
              {
                "type": "null"
              }
            ]
          },
          "tenant_count": {
            "title": "Tenant Count",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "is_super_admin",
          "is_suspended",
          "tenant_count",
          "primary_tenant",
          "created_at",
          "last_login_at"
        ],
        "title": "AdminUserRow",
        "type": "object"
      },
      "AgentAttachmentRow": {
        "description": "Attachment metadata returned by the list/get endpoints.",
        "properties": {
          "content_type": {
            "title": "Content Type",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "message_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Message Id",
            "type": "string"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "message_id",
          "filename",
          "content_type",
          "size_bytes",
          "created_at"
        ],
        "title": "AgentAttachmentRow",
        "type": "object"
      },
      "AgentAvatarRead": {
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "avatar_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "sha256 of the stored 192x192 PNG; cache-busting token.",
            "title": "Avatar Sha256"
          },
          "avatar_size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Size Bytes"
          },
          "avatar_updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Updated At"
          },
          "gitlab_synced": {
            "description": "Whether the agent's GitLab user shows this avatar. False after a failed or pending push (retried by the tenant reconcile) and after removal, which leaves the last-synced GitLab avatar in place.",
            "title": "Gitlab Synced",
            "type": "boolean"
          },
          "has_avatar": {
            "title": "Has Avatar",
            "type": "boolean"
          }
        },
        "required": [
          "agent_id",
          "has_avatar",
          "gitlab_synced"
        ],
        "title": "AgentAvatarRead",
        "type": "object"
      },
      "AgentBudgetRead": {
        "properties": {
          "hourly_limit_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hourly Limit Usd"
          }
        },
        "required": [
          "hourly_limit_usd"
        ],
        "title": "AgentBudgetRead",
        "type": "object"
      },
      "AgentBudgetUpdate": {
        "properties": {
          "hourly_limit_usd": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hourly Limit Usd"
          }
        },
        "title": "AgentBudgetUpdate",
        "type": "object"
      },
      "AgentCanAuthorSkillsUpdate": {
        "description": "Toggle the agent-level ``can_author_skills`` flag.\n\nField name matches the underlying column (``agent.can_author_skills``)\nand the read-side schema (``AgentRead.can_author_skills``), so operators\nnever see a second name for the same boolean.",
        "properties": {
          "can_author_skills": {
            "title": "Can Author Skills",
            "type": "boolean"
          }
        },
        "required": [
          "can_author_skills"
        ],
        "title": "AgentCanAuthorSkillsUpdate",
        "type": "object"
      },
      "AgentCatalogModel": {
        "description": "One tenant-reachable chat model, annotated with the agent's grant.",
        "properties": {
          "access": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Effective access of the direct grant: full | read_only.",
            "title": "Access"
          },
          "callable": {
            "description": "Reconciled truth of the broker invoke gate (``check_model_access``) for this agent driven by the viewing user. Pickers gate selection on this.",
            "title": "Callable",
            "type": "boolean"
          },
          "callable_via_router": {
            "description": "OpenRouter model callable through the agent's Auto Router grant (#3095).",
            "title": "Callable Via Router",
            "type": "boolean"
          },
          "completion_price_usd_per_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completion Price Usd Per Token"
          },
          "context_window": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context Window"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "enabled": {
            "description": "A direct ``agent_model`` grant exists (the toggle).",
            "title": "Enabled",
            "type": "boolean"
          },
          "is_free": {
            "title": "Is Free",
            "type": "boolean"
          },
          "kind": {
            "description": "Model kind: openrouter, ifm, local, anthropic, bedrock, \u2026",
            "title": "Kind",
            "type": "string"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Position of the direct grant in the agent's chain.",
            "title": "Priority"
          },
          "prompt_price_usd_per_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Price Usd Per Token"
          },
          "slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Provider slug (``openrouter_slug`` / ``model_slug``).",
            "title": "Slug"
          },
          "status": {
            "description": "Global model status (active or experimental).",
            "title": "Status",
            "type": "string"
          },
          "supports_tools": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Supports Tools"
          },
          "supports_vision": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Supports Vision"
          },
          "uncallable_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Uncallable Reason"
          },
          "user_granted": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Non-OpenRouter kinds only: whether the *viewing* user holds the ``user_model`` grant the broker requires when a user drives the agent. ``null`` when the layer doesn't apply.",
            "title": "User Granted"
          }
        },
        "required": [
          "model_id",
          "name",
          "kind",
          "status",
          "is_free",
          "enabled",
          "callable_via_router",
          "callable"
        ],
        "title": "AgentCatalogModel",
        "type": "object"
      },
      "AgentCatalogToggle": {
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          }
        },
        "required": [
          "model_id",
          "agent_id",
          "enabled"
        ],
        "title": "AgentCatalogToggle",
        "type": "object"
      },
      "AgentClone": {
        "description": "Request body for ``POST /agents/{source_id}/clone``.",
        "properties": {
          "name": {
            "maxLength": 255,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9 -]+$",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "AgentClone",
        "type": "object"
      },
      "AgentCodeRefUpdate": {
        "description": "PATCH body for pinning ``agent.code_ref``.\n\nThe value is validated server-side against the project's real branch +\ntag set; an unknown ref returns 422. Length matches the DB column\n(``agent.code_ref VARCHAR(128)``).",
        "properties": {
          "code_ref": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Code Ref",
            "type": "string"
          }
        },
        "required": [
          "code_ref"
        ],
        "title": "AgentCodeRefUpdate",
        "type": "object"
      },
      "AgentCostRow": {
        "description": "One row in the per-agent cost breakdown table.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "title": "Agent Name",
            "type": "string"
          },
          "anomaly": {
            "default": false,
            "title": "Anomaly",
            "type": "boolean"
          },
          "byok_cost_usd": {
            "default": 0.0,
            "title": "Byok Cost Usd",
            "type": "number"
          },
          "cache_hit_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cache Hit Rate"
          },
          "cache_read_tokens": {
            "default": 0,
            "title": "Cache Read Tokens",
            "type": "integer"
          },
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "cost_usd": {
            "title": "Cost Usd",
            "type": "number"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "models": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/AgentModelCostRow"
            },
            "title": "Models",
            "type": "array"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "provider_cost_usd": {
            "default": 0.0,
            "title": "Provider Cost Usd",
            "type": "number"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          },
          "top_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Model"
          }
        },
        "required": [
          "agent_id",
          "agent_name",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_usd"
        ],
        "title": "AgentCostRow",
        "type": "object"
      },
      "AgentCostsResponse": {
        "description": "Full response for ``GET /tenant/{tenant_id}/billing/agent-costs``.",
        "properties": {
          "agents": {
            "items": {
              "$ref": "#/components/schemas/AgentCostRow"
            },
            "title": "Agents",
            "type": "array"
          },
          "period": {
            "$ref": "#/components/schemas/CostPeriod"
          },
          "total_byok_cost_usd": {
            "default": 0.0,
            "title": "Total Byok Cost Usd",
            "type": "number"
          },
          "total_cost_usd": {
            "title": "Total Cost Usd",
            "type": "number"
          },
          "total_provider_cost_usd": {
            "default": 0.0,
            "title": "Total Provider Cost Usd",
            "type": "number"
          }
        },
        "required": [
          "period",
          "agents",
          "total_cost_usd"
        ],
        "title": "AgentCostsResponse",
        "type": "object"
      },
      "AgentCreate": {
        "properties": {
          "can_author_skills": {
            "default": false,
            "title": "Can Author Skills",
            "type": "boolean"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "description_prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description Prompt"
          },
          "environment_mode": {
            "enum": [
              "shared",
              "isolated"
            ],
            "title": "Environment Mode",
            "type": "string"
          },
          "hidden": {
            "default": false,
            "title": "Hidden",
            "type": "boolean"
          },
          "image_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image Ref"
          },
          "initial_greeting": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Greeting"
          },
          "is_admin_only": {
            "default": false,
            "title": "Is Admin Only",
            "type": "boolean"
          },
          "iteration_warn_threshold": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iteration Warn Threshold"
          },
          "kind": {
            "enum": [
              "user",
              "coding",
              "analyst",
              "dba",
              "schroeder"
            ],
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "maxLength": 255,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9 -]+$",
            "title": "Name",
            "type": "string"
          },
          "resource_class": {
            "default": "small",
            "title": "Resource Class",
            "type": "string"
          },
          "slug": {
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
            "title": "Slug",
            "type": "string"
          },
          "voice": {
            "anyOf": [
              {
                "maxLength": 128,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          }
        },
        "required": [
          "name",
          "slug"
        ],
        "title": "AgentCreate",
        "type": "object"
      },
      "AgentDefaultRoleRead": {
        "description": "Whether the per-agent tenant defaults (``AGENT_DEFAULT`` + ``AGENT_DEFAULT_GUEST``)\nare enabled.\n\n``enabled`` True means every tenant MEMBER reaches this agent's member baseline via\nmatcher branch 5 and every tenant GUEST reaches the narrower GUEST baseline via branch\n6 (the two edges are toggled together, #479); False means the agent is *tightened* \u2014\nonly named per-agent roles (or OWNER/ADMIN/SuperAdmin) reach it (issue #476).",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "agent_id",
          "enabled"
        ],
        "title": "AgentDefaultRoleRead",
        "type": "object"
      },
      "AgentDefaultRoleUpdate": {
        "description": "Enable or tighten the per-agent tenant default on an agent.",
        "properties": {
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ],
        "title": "AgentDefaultRoleUpdate",
        "type": "object"
      },
      "AgentFavoriteRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "agent_id"
        ],
        "title": "AgentFavoriteRead",
        "type": "object"
      },
      "AgentGrantRequest": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "role": {
            "anyOf": [
              {
                "enum": [
                  "VIEWER",
                  "EDITOR"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "agent_id"
        ],
        "title": "AgentGrantRequest",
        "type": "object"
      },
      "AgentImageRepoRead": {
        "description": "Result of scaffolding an agent's custom-image GitLab repo (GitLab #49).\n\nThe repo lives at ``good-place/tenants/<slug>/agent-images/<agent_slug>``\n(the 4th per-tenant subgroup, decision #9) and is seeded with a deps-only\n``Dockerfile`` extending the platform base image, plus ``requirements.txt``,\n``.dockerignore``, and a build+push ``.gitlab-ci.yml``. ``repo_url`` is the\nHTTP clone URL; the tenant admin fills in the deps and the pipeline pushes\nthe built image to the tenant's own GCR namespace.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "agent_slug": {
            "title": "Agent Slug",
            "type": "string"
          },
          "repo_url": {
            "title": "Repo Url",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "agent_slug",
          "repo_url"
        ],
        "title": "AgentImageRepoRead",
        "type": "object"
      },
      "AgentImportFromGcsRequest": {
        "description": "JSON body for the service-to-service import path.\n\n``gcs_uri`` must point inside the calling tenant's own workspace bucket;\nthe route enforces that, so this path can't be used to pull bytes from\nelsewhere in GCS (same rule the memory import applies).",
        "properties": {
          "gcs_uri": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Gcs Uri",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Override the agent name from the bundle's manifest.",
            "title": "Name"
          }
        },
        "required": [
          "gcs_uri"
        ],
        "title": "AgentImportFromGcsRequest",
        "type": "object"
      },
      "AgentImportResult": {
        "description": "What an import actually produced.\n\nDeliberately reports observed counts rather than a bare success flag: an\nimport is all-or-nothing up to the point the agent exists and best-effort\nper row after that, so the operator needs to see what landed. ``warnings``\nis the list to surface in the UI \u2014 a model that fell back to the tenant\ndefault, tools this deployment doesn't have, budget caps that didn't carry\nover.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "title": "Agent Name",
            "type": "string"
          },
          "agent_slug": {
            "title": "Agent Slug",
            "type": "string"
          },
          "idempotent_reuse": {
            "default": false,
            "description": "True when this call resolved to an agent a previous import already created (a retry, e.g. after a gateway 502): no new agent was made and the per-row counts are zero. The UI should treat this as success and show the existing agent, not an error.",
            "title": "Idempotent Reuse",
            "type": "boolean"
          },
          "memories_failed": {
            "default": 0,
            "title": "Memories Failed",
            "type": "integer"
          },
          "memories_imported": {
            "default": 0,
            "title": "Memories Imported",
            "type": "integer"
          },
          "messages_imported": {
            "default": 0,
            "title": "Messages Imported",
            "type": "integer"
          },
          "model_fallback_used": {
            "default": false,
            "description": "True when no exported slug was available and the tenant default was used.",
            "title": "Model Fallback Used",
            "type": "boolean"
          },
          "model_slug_requested": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The model slug recorded in the bundle.",
            "title": "Model Slug Requested"
          },
          "model_slug_resolved": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The slug actually matched here; null when the fallback was used.",
            "title": "Model Slug Resolved"
          },
          "model_warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Warning"
          },
          "sessions_imported": {
            "default": 0,
            "title": "Sessions Imported",
            "type": "integer"
          },
          "skills_failed": {
            "default": 0,
            "title": "Skills Failed",
            "type": "integer"
          },
          "skills_imported": {
            "default": 0,
            "title": "Skills Imported",
            "type": "integer"
          },
          "source_platform": {
            "description": "Platform the bundle was exported from, per its manifest.",
            "title": "Source Platform",
            "type": "string"
          },
          "tools_attached": {
            "items": {
              "type": "string"
            },
            "title": "Tools Attached",
            "type": "array"
          },
          "tools_unmatched": {
            "items": {
              "type": "string"
            },
            "title": "Tools Unmatched",
            "type": "array"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "title": "Warnings",
            "type": "array"
          }
        },
        "required": [
          "agent_id",
          "agent_slug",
          "agent_name",
          "source_platform"
        ],
        "title": "AgentImportResult",
        "type": "object"
      },
      "AgentIntegrationRead": {
        "description": "Public projection of a per-agent integration.",
        "properties": {
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "label",
          "connected"
        ],
        "title": "AgentIntegrationRead",
        "type": "object"
      },
      "AgentListRead": {
        "properties": {
          "can_author_skills": {
            "title": "Can Author Skills",
            "type": "boolean"
          },
          "code_ref": {
            "title": "Code Ref",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Agent Id"
          },
          "created_by_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Id"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "editor_enabled": {
            "default": false,
            "title": "Editor Enabled",
            "type": "boolean"
          },
          "hidden": {
            "default": false,
            "title": "Hidden",
            "type": "boolean"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "image_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image Ref"
          },
          "initial_greeting": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Greeting"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "is_admin_only": {
            "title": "Is Admin Only",
            "type": "boolean"
          },
          "is_favorite": {
            "default": false,
            "title": "Is Favorite",
            "type": "boolean"
          },
          "is_seed": {
            "title": "Is Seed",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "plan_read_only": {
            "default": false,
            "title": "Plan Read Only",
            "type": "boolean"
          },
          "repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Url"
          },
          "resource_class": {
            "title": "Resource Class",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "voice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          },
          "zoom_managed": {
            "default": false,
            "title": "Zoom Managed",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "slug",
          "description",
          "initial_greeting",
          "is_active",
          "is_admin_only",
          "is_seed",
          "can_author_skills",
          "image_ref",
          "resource_class",
          "repo_url",
          "code_ref",
          "created_at",
          "updated_at"
        ],
        "title": "AgentListRead",
        "type": "object"
      },
      "AgentMailboxRow": {
        "description": "One mailbox belonging to an agent.",
        "properties": {
          "address": {
            "title": "Address",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "kind": {
            "enum": [
              "internal",
              "external"
            ],
            "title": "Kind",
            "type": "string"
          }
        },
        "required": [
          "id",
          "address",
          "kind",
          "is_active",
          "created_at"
        ],
        "title": "AgentMailboxRow",
        "type": "object"
      },
      "AgentModelChainUpdate": {
        "description": "PUT body for setting the ordered model chain on an agent (#614).\n\n``model_ids`` is the ordered list of model CUIDs. The first element is\npriority 0 (primary), the second priority 1, etc. Minimum 1, maximum\n``MAX_AGENT_MODEL_CHAIN_LEN``.",
        "properties": {
          "model_ids": {
            "items": {
              "maxLength": 25,
              "minLength": 25,
              "pattern": "^c[a-z0-9]{24}$",
              "type": "string"
            },
            "maxItems": 5,
            "minItems": 1,
            "title": "Model Ids",
            "type": "array"
          }
        },
        "required": [
          "model_ids"
        ],
        "title": "AgentModelChainUpdate",
        "type": "object"
      },
      "AgentModelCostRow": {
        "description": "One model an agent's spend went to (issue #347).",
        "properties": {
          "cache_read_tokens": {
            "default": 0,
            "title": "Cache Read Tokens",
            "type": "integer"
          },
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "cost_usd": {
            "title": "Cost Usd",
            "type": "number"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          }
        },
        "required": [
          "model_id",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_usd"
        ],
        "title": "AgentModelCostRow",
        "type": "object"
      },
      "AgentModelGrant": {
        "properties": {
          "access": {
            "enum": [
              "full",
              "read_only"
            ],
            "title": "Access",
            "type": "string"
          },
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "priority": {
            "default": 0,
            "maximum": 4.0,
            "minimum": 0.0,
            "title": "Priority",
            "type": "integer"
          }
        },
        "required": [
          "agent_id"
        ],
        "title": "AgentModelGrant",
        "type": "object"
      },
      "AgentModelRead": {
        "properties": {
          "access": {
            "title": "Access",
            "type": "string"
          },
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          },
          "priority": {
            "default": 0,
            "title": "Priority",
            "type": "integer"
          }
        },
        "required": [
          "agent_id",
          "model_id",
          "access",
          "created_at"
        ],
        "title": "AgentModelRead",
        "type": "object"
      },
      "AgentOwnershipTransfer": {
        "properties": {
          "new_owner_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "New Owner Id",
            "type": "string"
          }
        },
        "required": [
          "new_owner_id"
        ],
        "title": "AgentOwnershipTransfer",
        "type": "object"
      },
      "AgentPromptCommitRead": {
        "description": "One commit that touched a prompt file, as GitLab reports it.\n\nMetadata only \u2014 no diff and no file body. ``author_name`` / ``author_email``\nare real identities because agents commit as their own Keycloak user\n(decision #39), which is what makes this history worth reading.\n\n``web_url`` is GitLab's own link to the commit and is therefore off-origin:\nthe UI must render it through ``<ExternalLink>``.",
        "properties": {
          "author_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author Email"
          },
          "author_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author Name"
          },
          "committed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Committed At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "short_id": {
            "title": "Short Id",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "web_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Web Url"
          }
        },
        "required": [
          "id",
          "short_id",
          "title"
        ],
        "title": "AgentPromptCommitRead",
        "type": "object"
      },
      "AgentPromptFileProvenanceRead": {
        "description": "Repo state for one prompt file and the live column it projects onto.\n\n``diverged`` is the \"this differs from the repository\" signal: the live\ncolumn is not equal to the projection of the file currently on ``main``,\ni.e. somebody has overridden the prompt through the API or the panel and the\nconvergence sweep will never take it back. It is ``False`` when the file\ncould not be read at all \u2014 absence of evidence, and the enclosing\n``available`` flag says so.\n\n``pending_projection`` is the other not-equal case, and it is *not* an\noverride: the live column is still unprojected (empty, or the pre-#291 seed\ninput), so the convergence sweep will replace it with this file on its next\npass. The two are never both ``True``. It is a boolean for the same reason\n``diverged`` is \u2014 the comparison against the seed happens server-side. (When\nit is ``True`` on a non-empty column, the live value *is* the seed input, so\nan admin who can already read the live prompt learns nothing new that arms\nanything: in that state the reconciler is armed already, which is the point\nof the flag.)",
        "properties": {
          "commits": {
            "items": {
              "$ref": "#/components/schemas/AgentPromptCommitRead"
            },
            "title": "Commits",
            "type": "array"
          },
          "diverged": {
            "title": "Diverged",
            "type": "boolean"
          },
          "field": {
            "title": "Field",
            "type": "string"
          },
          "file": {
            "title": "File",
            "type": "string"
          },
          "pending_projection": {
            "default": false,
            "title": "Pending Projection",
            "type": "boolean"
          },
          "repo_present": {
            "title": "Repo Present",
            "type": "boolean"
          }
        },
        "required": [
          "file",
          "field",
          "repo_present",
          "diverged",
          "commits"
        ],
        "title": "AgentPromptFileProvenanceRead",
        "type": "object"
      },
      "AgentPromptProvenanceRead": {
        "description": "Provenance for both prompt files, or an honest \"GitLab didn't answer\".\n\n``available=False`` is a **200**, not a 5xx: a GitLab outage must degrade the\nsettings panel to \"history unavailable\" rather than break the page.\n``unavailable_reason`` is operator-facing copy, not an exception string.",
        "properties": {
          "available": {
            "title": "Available",
            "type": "boolean"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/AgentPromptFileProvenanceRead"
            },
            "title": "Files",
            "type": "array"
          },
          "repo_web_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Web Url"
          },
          "unavailable_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Unavailable Reason"
          }
        },
        "required": [
          "available",
          "files"
        ],
        "title": "AgentPromptProvenanceRead",
        "type": "object"
      },
      "AgentRead": {
        "properties": {
          "avatar_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Sha256"
          },
          "bootstrap_instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bootstrap Instructions"
          },
          "can_author_skills": {
            "title": "Can Author Skills",
            "type": "boolean"
          },
          "code_ref": {
            "title": "Code Ref",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Agent Id"
          },
          "created_by_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Id"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "description_prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description Prompt"
          },
          "editor_enabled": {
            "default": false,
            "title": "Editor Enabled",
            "type": "boolean"
          },
          "environment_mode": {
            "enum": [
              "shared",
              "isolated"
            ],
            "title": "Environment Mode",
            "type": "string"
          },
          "external_mail_enabled": {
            "default": true,
            "title": "External Mail Enabled",
            "type": "boolean"
          },
          "hidden": {
            "default": false,
            "title": "Hidden",
            "type": "boolean"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "image_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image Ref"
          },
          "initial_greeting": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Greeting"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "is_admin_only": {
            "title": "Is Admin Only",
            "type": "boolean"
          },
          "is_seed": {
            "title": "Is Seed",
            "type": "boolean"
          },
          "iteration_warn_threshold": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iteration Warn Threshold"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "plan_read_only": {
            "default": false,
            "title": "Plan Read Only",
            "type": "boolean"
          },
          "repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Url"
          },
          "resource_class": {
            "title": "Resource Class",
            "type": "string"
          },
          "skill_visibility_scope": {
            "enum": [
              "private_only",
              "tenant_allowed"
            ],
            "title": "Skill Visibility Scope",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "ssh_public_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ssh Public Key"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "voice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          },
          "zoom_managed": {
            "default": false,
            "title": "Zoom Managed",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "slug",
          "description",
          "initial_greeting",
          "is_active",
          "is_admin_only",
          "is_seed",
          "can_author_skills",
          "image_ref",
          "resource_class",
          "repo_url",
          "code_ref",
          "created_at",
          "updated_at"
        ],
        "title": "AgentRead",
        "type": "object"
      },
      "AgentRepoRefs": {
        "description": "Branches + tags on the agent's GitLab project.\n\nFeeds the code-tab ``code_ref`` typeahead so the operator can only pin\n``agent.code_ref`` to a ref that actually exists. See issue #1835.\n\nBoth lists may be empty when GitLab is unreachable or the project is\nmissing \u2014 the front-end falls back to a free-form input with a clear\n\"couldn't load refs\" banner in that case.\n\n``complete`` is ``True`` only when both branch and tag listings finished\nwithout error and without hitting their hard-cap walk. When ``False``,\nthe cached set is partial; the front-end treats it as \"refs unavailable\"\nfor typeahead-strict purposes, and the PATCH ``code_ref`` route falls\nback to a direct single-ref GitLab lookup rather than 422-rejecting a\nvalid ref that was simply truncated.",
        "properties": {
          "branches": {
            "items": {
              "type": "string"
            },
            "title": "Branches",
            "type": "array"
          },
          "complete": {
            "default": false,
            "title": "Complete",
            "type": "boolean"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          }
        },
        "required": [
          "branches",
          "tags"
        ],
        "title": "AgentRepoRefs",
        "type": "object"
      },
      "AgentRoleAssignmentCreate": {
        "description": "Set a user's role for a specific agent.",
        "properties": {
          "role": {
            "enum": [
              "VIEWER",
              "MANAGER",
              "OWNER"
            ],
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role"
        ],
        "title": "AgentRoleAssignmentCreate",
        "type": "object"
      },
      "AgentRoleAssignmentRead": {
        "description": "Response for a role assignment.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "role": {
            "enum": [
              "VIEWER",
              "MANAGER",
              "OWNER"
            ],
            "title": "Role",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          }
        },
        "required": [
          "agent_id",
          "user_id",
          "tenant_id",
          "role",
          "created_at",
          "updated_at"
        ],
        "title": "AgentRoleAssignmentRead",
        "type": "object"
      },
      "AgentRoleGroupGrantCreate": {
        "description": "Grant a tenant group a per-agent role (VIEWER/MANAGER/OWNER).\n\n``role`` is an ``AgentRole`` only \u2014 a tenant role (OWNER/ADMIN/MEMBER/GUEST) is\nnot group-grantable (owner decision), so anything else 422s here.",
        "properties": {
          "role": {
            "enum": [
              "VIEWER",
              "MANAGER",
              "OWNER"
            ],
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role"
        ],
        "title": "AgentRoleGroupGrantCreate",
        "type": "object"
      },
      "AgentRoleGroupGrantRead": {
        "description": "Response for a group's per-agent role grant.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "group_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Group Id",
            "type": "string"
          },
          "group_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group Name"
          },
          "role": {
            "enum": [
              "VIEWER",
              "MANAGER",
              "OWNER"
            ],
            "title": "Role",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "group_id",
          "tenant_id",
          "role",
          "created_at",
          "updated_at"
        ],
        "title": "AgentRoleGroupGrantRead",
        "type": "object"
      },
      "AgentRolePermissionGrid": {
        "description": "The full permissions grid for the frontend.",
        "properties": {
          "roles": {
            "additionalProperties": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "default": {
              "MANAGER": [
                "View",
                "Chat (read-only)",
                "Assign work",
                "Edit settings",
                "Edit skills",
                "Edit tools"
              ],
              "OWNER": [
                "View",
                "Chat (read-only)",
                "Assign work",
                "Edit settings",
                "Edit skills",
                "Edit tools",
                "Transfer ownership",
                "Delete agent",
                "Manage roles"
              ],
              "VIEWER": [
                "View",
                "Chat (read-only)"
              ]
            },
            "title": "Roles",
            "type": "object"
          }
        },
        "title": "AgentRolePermissionGrid",
        "type": "object"
      },
      "AgentSkillConfigRead": {
        "description": "Decrypted config readback. Issued under the same write RBAC gate\n(``agent:skills:write``) since the blob may contain sensitive settings.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "skill_id"
        ],
        "title": "AgentSkillConfigRead",
        "type": "object"
      },
      "AgentSkillConfigUpdate": {
        "description": "PATCH body for ``/skills/{skill_id}/config`` \u2014 replaces the whole blob.\n\nA ``None`` (or absent) ``config`` clears the column. Any JSON-serialisable\ndict is accepted; the route encrypts before writing.",
        "properties": {
          "config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          }
        },
        "title": "AgentSkillConfigUpdate",
        "type": "object"
      },
      "AgentSkillGrant": {
        "properties": {
          "is_enabled": {
            "default": true,
            "title": "Is Enabled",
            "type": "boolean"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          }
        },
        "required": [
          "skill_id"
        ],
        "title": "AgentSkillGrant",
        "type": "object"
      },
      "AgentSkillPermissionEntry": {
        "description": "One skill+action permission row.\n\n``action`` is ``\"use\"`` \u2014 the only currently supported per-skill action.\n``create`` would be semantically incoherent on a row keyed by\n``skill_id``, so authoring stays gated on ``agent.can_author_skills``.",
        "properties": {
          "action": {
            "default": "use",
            "title": "Action",
            "type": "string"
          },
          "allowed": {
            "default": true,
            "title": "Allowed",
            "type": "boolean"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          }
        },
        "required": [
          "skill_id"
        ],
        "title": "AgentSkillPermissionEntry",
        "type": "object"
      },
      "AgentSkillPermissionRead": {
        "properties": {
          "action": {
            "title": "Action",
            "type": "string"
          },
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "allowed": {
            "title": "Allowed",
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "skill_id",
          "action",
          "allowed",
          "created_at"
        ],
        "title": "AgentSkillPermissionRead",
        "type": "object"
      },
      "AgentSkillPermissionUpdate": {
        "description": "Bulk-replace the skill permission allowlist for an agent.\n\nThe ``permissions`` list is a complete replacement: any existing rows not\nin the list are removed. This keeps the API surface simple and avoids\npartial-update ambiguity.",
        "properties": {
          "permissions": {
            "items": {
              "$ref": "#/components/schemas/AgentSkillPermissionEntry"
            },
            "title": "Permissions",
            "type": "array"
          }
        },
        "required": [
          "permissions"
        ],
        "title": "AgentSkillPermissionUpdate",
        "type": "object"
      },
      "AgentSkillRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "has_config": {
            "default": false,
            "title": "Has Config",
            "type": "boolean"
          },
          "is_enabled": {
            "title": "Is Enabled",
            "type": "boolean"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "skill_id",
          "is_enabled",
          "created_at"
        ],
        "title": "AgentSkillRead",
        "type": "object"
      },
      "AgentSkillVisibilityScopeUpdate": {
        "description": "PUT body for ``/tenant/{id}/agents/{id}/skill-visibility-scope``.\n\n``private_only`` \u2014 agent may only author ``visibility='private'`` skills.\n``tenant_allowed`` \u2014 agent may also author ``visibility='public'`` skills.\nSee issue #550 and SkillVisibilityScope in models/agent.py.",
        "properties": {
          "skill_visibility_scope": {
            "enum": [
              "private_only",
              "tenant_allowed"
            ],
            "title": "Skill Visibility Scope",
            "type": "string"
          }
        },
        "required": [
          "skill_visibility_scope"
        ],
        "title": "AgentSkillVisibilityScopeUpdate",
        "type": "object"
      },
      "AgentSlackConfigRead": {
        "properties": {
          "slack_rph_limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Slack Rph Limit"
          },
          "slack_rpm_limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Slack Rpm Limit"
          },
          "working_hours_days": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "Mon",
                    "Tue",
                    "Wed",
                    "Thu",
                    "Fri",
                    "Sat",
                    "Sun"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Days"
          },
          "working_hours_enabled": {
            "default": false,
            "title": "Working Hours Enabled",
            "type": "boolean"
          },
          "working_hours_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours End"
          },
          "working_hours_start": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Start"
          },
          "working_hours_tz": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Tz"
          }
        },
        "title": "AgentSlackConfigRead",
        "type": "object"
      },
      "AgentSlackConfigUpdate": {
        "description": "Partial update body for `PUT /slack-config`.\n\nFields are forwarded only when the client included them in the request\nbody (see the route handler's use of ``model_fields_set``). Sending a\nfield as ``null`` clears the corresponding column; omitting a field\nleaves the column untouched. ``working_hours_days`` is constrained to\n3-letter English weekday codes (Mon\u2013Sun); ``working_hours_end`` must be\nstrictly after ``working_hours_start`` because the schedule gate does\nnot support overnight windows.",
        "properties": {
          "slack_rph_limit": {
            "anyOf": [
              {
                "maximum": 86400.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Slack Rph Limit"
          },
          "slack_rpm_limit": {
            "anyOf": [
              {
                "maximum": 3600.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Slack Rpm Limit"
          },
          "working_hours_days": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "Mon",
                    "Tue",
                    "Wed",
                    "Thu",
                    "Fri",
                    "Sat",
                    "Sun"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Days"
          },
          "working_hours_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Enabled"
          },
          "working_hours_end": {
            "anyOf": [
              {
                "pattern": "^\\d{2}:\\d{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours End"
          },
          "working_hours_start": {
            "anyOf": [
              {
                "pattern": "^\\d{2}:\\d{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Start"
          },
          "working_hours_tz": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Working Hours Tz"
          }
        },
        "title": "AgentSlackConfigUpdate",
        "type": "object"
      },
      "AgentToolBundleGrantCreate": {
        "description": "Body for ``POST /tenant/{tenant_id}/agents/{agent_id}/tool-bundles``.\n\nOnly the bundle. The agent and the tenant come from the path (already\nCasbin-checked) and the acting user from the request context.",
        "properties": {
          "bundle_id": {
            "description": "Id of the bundle to grant to this agent.",
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Bundle Id",
            "type": "string"
          }
        },
        "required": [
          "bundle_id"
        ],
        "title": "AgentToolBundleGrantCreate",
        "type": "object"
      },
      "AgentToolBundleRead": {
        "description": "One bundle an agent holds, with the grant's provenance.",
        "properties": {
          "bundle": {
            "$ref": "#/components/schemas/ToolBundleRead"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "granted_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Granted By User Id"
          }
        },
        "required": [
          "bundle",
          "granted_by_user_id",
          "created_at"
        ],
        "title": "AgentToolBundleRead",
        "type": "object"
      },
      "AgentToolGrant": {
        "properties": {
          "configuration": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Configuration"
          },
          "is_enabled": {
            "default": true,
            "title": "Is Enabled",
            "type": "boolean"
          },
          "tool_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tool Id",
            "type": "string"
          }
        },
        "required": [
          "tool_id"
        ],
        "title": "AgentToolGrant",
        "type": "object"
      },
      "AgentToolRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "configuration": {
            "title": "Configuration",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "is_enabled": {
            "title": "Is Enabled",
            "type": "boolean"
          },
          "tool_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tool Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "tool_id",
          "configuration",
          "is_enabled",
          "created_at",
          "updated_at"
        ],
        "title": "AgentToolRead",
        "type": "object"
      },
      "AgentUpdate": {
        "properties": {
          "bootstrap_instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bootstrap Instructions"
          },
          "can_author_skills": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Author Skills"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "description_prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description Prompt"
          },
          "editor_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Editor Enabled"
          },
          "environment_mode": {
            "anyOf": [
              {
                "enum": [
                  "shared",
                  "isolated"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Environment Mode"
          },
          "external_mail_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Mail Enabled"
          },
          "hidden": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hidden"
          },
          "image_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image Ref"
          },
          "initial_greeting": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Greeting"
          },
          "is_active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Active"
          },
          "is_admin_only": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Admin Only"
          },
          "iteration_warn_threshold": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iteration Warn Threshold"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 255,
                "minLength": 1,
                "pattern": "^[A-Za-z0-9 -]+$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "resource_class": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Class"
          },
          "ssh_public_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ssh Public Key"
          },
          "voice": {
            "anyOf": [
              {
                "maxLength": 128,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          }
        },
        "title": "AgentUpdate",
        "type": "object"
      },
      "AgentUserGrant": {
        "properties": {
          "role": {
            "default": "VIEWER",
            "title": "Role",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id"
        ],
        "title": "AgentUserGrant",
        "type": "object"
      },
      "AgentUserGrantRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "user_id",
          "role",
          "created_at"
        ],
        "title": "AgentUserGrantRead",
        "type": "object"
      },
      "AllowedAccountCreate": {
        "properties": {
          "email": {
            "format": "email",
            "maxLength": 253,
            "minLength": 3,
            "title": "Email",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "title": "AllowedAccountCreate",
        "type": "object"
      },
      "AllowedAccountRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "created_at"
        ],
        "title": "AllowedAccountRead",
        "type": "object"
      },
      "ApiKeyCreate": {
        "properties": {
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "name"
        ],
        "title": "ApiKeyCreate",
        "type": "object"
      },
      "ApiKeyCreated": {
        "description": "Returned once, on creation. `key` is the one chance to copy it.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "created_at",
          "last_used_at",
          "expires_at",
          "key"
        ],
        "title": "ApiKeyCreated",
        "type": "object"
      },
      "ApiKeyRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "created_at",
          "last_used_at",
          "expires_at"
        ],
        "title": "ApiKeyRead",
        "type": "object"
      },
      "ApprovalDecision": {
        "properties": {
          "approved": {
            "title": "Approved",
            "type": "boolean"
          }
        },
        "required": [
          "approved"
        ],
        "title": "ApprovalDecision",
        "type": "object"
      },
      "AssistantList": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/AssistantObject"
            },
            "title": "Data",
            "type": "array"
          },
          "first_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Id"
          },
          "has_more": {
            "default": false,
            "title": "Has More",
            "type": "boolean"
          },
          "last_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Id"
          },
          "object": {
            "const": "list",
            "title": "Object",
            "type": "string"
          }
        },
        "required": [
          "data"
        ],
        "title": "AssistantList",
        "type": "object"
      },
      "AssistantObject": {
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "integer"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instructions"
          },
          "metadata": {
            "title": "Metadata",
            "type": "object"
          },
          "model": {
            "default": "good-place-agent",
            "title": "Model",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "object": {
            "const": "assistant",
            "title": "Object",
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at"
        ],
        "title": "AssistantObject",
        "type": "object"
      },
      "AtdGrantCreate": {
        "description": "Body for ``POST /tenant/{tenant_id}/agents/{agent_id}/atd-grants``.",
        "properties": {
          "repo_name": {
            "anyOf": [
              {
                "maxLength": 512,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "atd repository name to narrow this grant to. Omit (or null) to grant the whole organization bound to this tenant.",
            "title": "Repo Name"
          }
        },
        "title": "AtdGrantCreate",
        "type": "object"
      },
      "AtdGrantRead": {
        "description": "One grant row as returned to an admin.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "granted_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Granted By User Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "repo_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Name"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "repo_name",
          "granted_by_user_id",
          "revoked_at",
          "created_at"
        ],
        "title": "AtdGrantRead",
        "type": "object"
      },
      "AtdRepositoryListResponse": {
        "description": "Response shape \u2014 a wrapped list so we can add pagination/filter fields\nlater without a breaking change.",
        "properties": {
          "repositories": {
            "items": {
              "$ref": "#/components/schemas/AtdRepositoryOption"
            },
            "title": "Repositories",
            "type": "array"
          }
        },
        "required": [
          "repositories"
        ],
        "title": "AtdRepositoryListResponse",
        "type": "object"
      },
      "AtdRepositoryOption": {
        "description": "One row rendered by the typeahead.\n\nDeliberately narrow: everything the picker needs to render an option and\nsubmit an identifier, and nothing else. Wider data lives on the ATD-native\n``get_repository`` MCP tool behind the same gate.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "scanned_branch": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scanned Branch"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "title": "AtdRepositoryOption",
        "type": "object"
      },
      "AuditLogRead": {
        "properties": {
          "action": {
            "title": "Action",
            "type": "string"
          },
          "agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "ip": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip"
          },
          "meta": {
            "title": "Meta",
            "type": "object"
          },
          "resource_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Id"
          },
          "resource_type": {
            "title": "Resource Type",
            "type": "string"
          },
          "tenant_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tenant Id"
          },
          "user_agent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Agent"
          },
          "user_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "user_id",
          "agent_id",
          "action",
          "resource_type",
          "resource_id",
          "ip",
          "user_agent",
          "meta",
          "created_at"
        ],
        "title": "AuditLogRead",
        "type": "object"
      },
      "AuditSessionDetailResponse": {
        "description": "Full debug data for a single session (issue #513).\n\nWraps the existing ``TaskSessionDebugRead`` fields plus ``user_name``\nso the admin view can render without a second lookup.",
        "properties": {
          "completion_tokens": {
            "default": 0,
            "title": "Completion Tokens",
            "type": "integer"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/TaskMessageRead"
            },
            "title": "Messages",
            "type": "array"
          },
          "prompt_tokens": {
            "default": 0,
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "session": {
            "$ref": "#/components/schemas/TaskSessionRead"
          },
          "total_cost_cents": {
            "default": 0,
            "title": "Total Cost Cents",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          }
        },
        "required": [
          "session",
          "messages",
          "total_tokens"
        ],
        "title": "AuditSessionDetailResponse",
        "type": "object"
      },
      "AuditSessionListItem": {
        "description": "One row in the paginated session audit list.\n\nCarries the agent name and user name so the audit table can render them\nwithout N+1 lookups. ``message_count`` is the total message count in the\nsession \u2014 useful for at-a-glance triaging.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Id"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "message_count": {
            "default": 0,
            "title": "Message Count",
            "type": "integer"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "status",
          "created_at"
        ],
        "title": "AuditSessionListItem",
        "type": "object"
      },
      "AuditSessionListResponse": {
        "description": "Paginated response for ``GET /v1/tenants/{tenant_id}/sessions``.",
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/AuditSessionListItem"
            },
            "title": "Items",
            "type": "array"
          },
          "page": {
            "title": "Page",
            "type": "integer"
          },
          "per_page": {
            "title": "Per Page",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "per_page"
        ],
        "title": "AuditSessionListResponse",
        "type": "object"
      },
      "AutocompleteItem": {
        "description": "A single autocomplete suggestion returned by the mention search endpoints.",
        "properties": {
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/MentionType"
          }
        },
        "required": [
          "id",
          "label",
          "type"
        ],
        "title": "AutocompleteItem",
        "type": "object"
      },
      "BenchmarkCreate": {
        "properties": {
          "dataset_uri": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Dataset Uri",
            "type": "string"
          },
          "default_harness": {
            "$ref": "#/components/schemas/BenchmarkHarness",
            "default": "claude_code"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "display_name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Display Name",
            "type": "string"
          },
          "evaluator_config": {
            "title": "Evaluator Config",
            "type": "object"
          },
          "evaluator_strategy": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Evaluator Strategy",
            "type": "string"
          },
          "is_active": {
            "default": true,
            "title": "Is Active",
            "type": "boolean"
          },
          "read_only": {
            "default": false,
            "title": "Read Only",
            "type": "boolean"
          },
          "slug": {
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[a-z0-9-]+$",
            "title": "Slug",
            "type": "string"
          },
          "trajectory_builder": {
            "$ref": "#/components/schemas/TrajectoryBuilder",
            "default": "prefix_merging"
          }
        },
        "required": [
          "slug",
          "display_name",
          "dataset_uri",
          "evaluator_strategy"
        ],
        "title": "BenchmarkCreate",
        "type": "object"
      },
      "BenchmarkHarness": {
        "description": "Polar's built-in agent harnesses. See ``src/polar/agent/factory.py`` upstream.",
        "enum": [
          "claude_code",
          "codex",
          "qwen_code",
          "opencode",
          "pi",
          "gemini_cli",
          "openhands_sdk",
          "shell"
        ],
        "title": "BenchmarkHarness",
        "type": "string"
      },
      "BenchmarkRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "dataset_uri": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Dataset Uri",
            "type": "string"
          },
          "default_harness": {
            "$ref": "#/components/schemas/BenchmarkHarness",
            "default": "claude_code"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "display_name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Display Name",
            "type": "string"
          },
          "evaluator_config": {
            "title": "Evaluator Config",
            "type": "object"
          },
          "evaluator_strategy": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Evaluator Strategy",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "default": true,
            "title": "Is Active",
            "type": "boolean"
          },
          "read_only": {
            "default": false,
            "title": "Read Only",
            "type": "boolean"
          },
          "slug": {
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[a-z0-9-]+$",
            "title": "Slug",
            "type": "string"
          },
          "trajectory_builder": {
            "$ref": "#/components/schemas/TrajectoryBuilder",
            "default": "prefix_merging"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "slug",
          "display_name",
          "dataset_uri",
          "evaluator_strategy",
          "id",
          "created_at",
          "updated_at"
        ],
        "title": "BenchmarkRead",
        "type": "object"
      },
      "BenchmarkUpdate": {
        "properties": {
          "dataset_uri": {
            "anyOf": [
              {
                "maxLength": 512,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dataset Uri"
          },
          "default_harness": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BenchmarkHarness"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "display_name": {
            "anyOf": [
              {
                "maxLength": 128,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "evaluator_config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Evaluator Config"
          },
          "evaluator_strategy": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Evaluator Strategy"
          },
          "is_active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Active"
          },
          "read_only": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Read Only"
          },
          "trajectory_builder": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TrajectoryBuilder"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "BenchmarkUpdate",
        "type": "object"
      },
      "BillingPortalRedirect": {
        "description": "Stripe Billing Portal Session URL \u2014 front-end redirects to ``url``.",
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "BillingPortalRedirect",
        "type": "object"
      },
      "Body_MCP_OAuth_revoke": {
        "properties": {
          "token": {
            "title": "Token",
            "type": "string"
          },
          "token_type_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Type Hint"
          }
        },
        "required": [
          "token"
        ],
        "title": "Body_MCP OAuth_revoke",
        "type": "object"
      },
      "Body_MCP_OAuth_token": {
        "properties": {
          "client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id"
          },
          "client_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Secret"
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code"
          },
          "code_verifier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code Verifier"
          },
          "grant_type": {
            "title": "Grant Type",
            "type": "string"
          },
          "redirect_uri": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Redirect Uri"
          },
          "refresh_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Refresh Token"
          },
          "scope": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scope"
          }
        },
        "required": [
          "grant_type"
        ],
        "title": "Body_MCP OAuth_token",
        "type": "object"
      },
      "Body_admin_upload_platform_favicon": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_admin_upload_platform_favicon",
        "type": "object"
      },
      "Body_admin_upload_use_case_icon": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_admin_upload_use_case_icon",
        "type": "object"
      },
      "Body_agent_import_import_agent": {
        "properties": {
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_agent_import_import_agent",
        "type": "object"
      },
      "Body_agents_upload_avatar": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_agents_upload_avatar",
        "type": "object"
      },
      "Body_documents_upload_tenant_file": {
        "properties": {
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          }
        },
        "required": [
          "project_id",
          "file"
        ],
        "title": "Body_documents_upload_tenant_file",
        "type": "object"
      },
      "Body_files_scan_upload": {
        "properties": {
          "resource_type": {
            "default": "file",
            "title": "Resource Type",
            "type": "string"
          },
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_files_scan_upload",
        "type": "object"
      },
      "Body_mail_upload_attachment": {
        "properties": {
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_mail_upload_attachment",
        "type": "object"
      },
      "Body_marketplace_publish_version": {
        "properties": {
          "bundle": {
            "contentMediaType": "application/octet-stream",
            "title": "Bundle",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "bundle",
          "version"
        ],
        "title": "Body_marketplace_publish_version",
        "type": "object"
      },
      "Body_memory_export_import_import_memory": {
        "properties": {
          "file": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File"
          },
          "gcs_uri": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gcs Uri"
          }
        },
        "title": "Body_memory_export_import_import_memory",
        "type": "object"
      },
      "Body_skills_import_skill": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_skills_import_skill",
        "type": "object"
      },
      "Body_tasks_upload_session_attachment": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_tasks_upload_session_attachment",
        "type": "object"
      },
      "Body_tenant_brand_upload_favicon": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_tenant_brand_upload_favicon",
        "type": "object"
      },
      "Body_tenant_brand_upload_logo": {
        "properties": {
          "upload": {
            "contentMediaType": "application/octet-stream",
            "title": "Upload",
            "type": "string"
          }
        },
        "required": [
          "upload"
        ],
        "title": "Body_tenant_brand_upload_logo",
        "type": "object"
      },
      "BriefingToday": {
        "description": "The calling user's NewsBot thread for their local *today* (issue #500).\n\nNewsBot has one briefing thread per user per local day; opening the page\nresolves (creating + briefing if needed) that thread and shows it. ``date``\nis the user's local calendar date the thread belongs to (ISO ``YYYY-MM-DD``).",
        "properties": {
          "date": {
            "title": "Date",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "date"
        ],
        "title": "BriefingToday",
        "type": "object"
      },
      "BuiltInDefaults": {
        "description": "Built-in detector toggle defaults.",
        "properties": {
          "max_bytes": {
            "default": 1048576,
            "minimum": 0.0,
            "title": "Max Bytes",
            "type": "integer"
          },
          "pii_scrub": {
            "default": true,
            "title": "Pii Scrub",
            "type": "boolean"
          },
          "secret_scrub": {
            "default": true,
            "title": "Secret Scrub",
            "type": "boolean"
          }
        },
        "title": "BuiltInDefaults",
        "type": "object"
      },
      "BuiltInDetectorConfigRead": {
        "description": "Nested read schema for built-in detector toggles.",
        "properties": {
          "max_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Bytes"
          },
          "pii_scrub": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pii Scrub"
          },
          "secret_scrub": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secret Scrub"
          }
        },
        "title": "BuiltInDetectorConfigRead",
        "type": "object"
      },
      "CategoryCostRow": {
        "description": "Spend attributed to one Julia-1 session category in the window.",
        "properties": {
          "byok_cost_usd": {
            "default": 0.0,
            "title": "Byok Cost Usd",
            "type": "number"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "cost_usd": {
            "title": "Cost Usd",
            "type": "number"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "provider_cost_usd": {
            "default": 0.0,
            "title": "Provider Cost Usd",
            "type": "number"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          },
          "sessions": {
            "title": "Sessions",
            "type": "integer"
          }
        },
        "required": [
          "sessions",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_usd"
        ],
        "title": "CategoryCostRow",
        "type": "object"
      },
      "CategoryCostsResponse": {
        "description": "Response for ``GET /tenant/{tenant_id}/billing/category-costs`` (issue #458).\n\nEnriches usage attribution with the Julia-1 session tag: spend grouped by the\nkind of work each session was, so billing can be reported by category. Rows\nwith ``category=None`` are sessions not yet tagged by the background pass.",
        "properties": {
          "categories": {
            "items": {
              "$ref": "#/components/schemas/CategoryCostRow"
            },
            "title": "Categories",
            "type": "array"
          },
          "period": {
            "$ref": "#/components/schemas/CostPeriod"
          },
          "total_byok_cost_usd": {
            "default": 0.0,
            "title": "Total Byok Cost Usd",
            "type": "number"
          },
          "total_cost_usd": {
            "title": "Total Cost Usd",
            "type": "number"
          },
          "total_provider_cost_usd": {
            "default": 0.0,
            "title": "Total Provider Cost Usd",
            "type": "number"
          }
        },
        "required": [
          "period",
          "categories",
          "total_cost_usd"
        ],
        "title": "CategoryCostsResponse",
        "type": "object"
      },
      "Changeset": {
        "description": "The reviewable proposal for one session, across both lanes.",
        "properties": {
          "can_fast_forward": {
            "default": true,
            "description": "True iff no staged path's live file diverged \u2014 a `select` would succeed",
            "title": "Can Fast Forward",
            "type": "boolean"
          },
          "fork_basis_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the run's fork basis was captured (ISO-8601)",
            "title": "Fork Basis At"
          },
          "read_only": {
            "description": "Whether this session refuses settlement (decision #32)",
            "title": "Read Only",
            "type": "boolean"
          },
          "repo_revisions": {
            "items": {
              "$ref": "#/components/schemas/RepoRevision"
            },
            "title": "Repo Revisions",
            "type": "array"
          },
          "retained_mode": {
            "description": "Whether this session captures writes as proposals",
            "title": "Retained Mode",
            "type": "boolean"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "statuses": {
            "items": {
              "$ref": "#/components/schemas/SettlementStatus"
            },
            "title": "Statuses",
            "type": "array"
          },
          "workspace_files": {
            "items": {
              "$ref": "#/components/schemas/ChangesetFile"
            },
            "title": "Workspace Files",
            "type": "array"
          }
        },
        "required": [
          "session_id",
          "retained_mode",
          "read_only"
        ],
        "title": "Changeset",
        "type": "object"
      },
      "ChangesetFile": {
        "description": "One staged file in a retained-output changeset (workspace lane).",
        "properties": {
          "diff": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unified diff (live\u2192staged) for small text files; None for binary/large",
            "title": "Diff"
          },
          "live_diverged": {
            "description": "True when the *live* file at this path changed since the run's fork basis \u2014 a `select` (fast-forward) is refused while any path diverges; `apply` is refused only when a diverged path overlaps the staged set",
            "title": "Live Diverged",
            "type": "boolean"
          },
          "op": {
            "description": "added = no live file at the run's fork basis; modified = there was one",
            "enum": [
              "added",
              "modified"
            ],
            "title": "Op",
            "type": "string"
          },
          "path": {
            "description": "Path relative to the workspace root",
            "title": "Path",
            "type": "string"
          },
          "staged_size": {
            "description": "Size of the staged (proposed) content in bytes",
            "title": "Staged Size",
            "type": "integer"
          }
        },
        "required": [
          "path",
          "op",
          "staged_size",
          "live_diverged"
        ],
        "title": "ChangesetFile",
        "type": "object"
      },
      "CheckoutSessionRedirect": {
        "description": "Stripe Checkout Session URL \u2014 front-end issues a 303 to ``url``.",
        "properties": {
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "session_id"
        ],
        "title": "CheckoutSessionRedirect",
        "type": "object"
      },
      "CodeFindingRead": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "commit_sha": {
            "title": "Commit Sha",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "file_path": {
            "title": "File Path",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "line": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Line"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "repo_url": {
            "title": "Repo Url",
            "type": "string"
          },
          "rule_id": {
            "title": "Rule Id",
            "type": "string"
          },
          "sarif_blob_uri": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sarif Blob Uri"
          },
          "scanner": {
            "title": "Scanner",
            "type": "string"
          },
          "severity": {
            "title": "Severity",
            "type": "string"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "suppressed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suppressed At"
          },
          "suppressed_by_user_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suppressed By User Id"
          },
          "suppressed_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suppressed Reason"
          },
          "tenant_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tenant Id"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "source",
          "repo_url",
          "commit_sha",
          "file_path",
          "line",
          "scanner",
          "rule_id",
          "severity",
          "message",
          "sarif_blob_uri",
          "suppressed_at",
          "suppressed_by_user_id",
          "suppressed_reason",
          "created_at"
        ],
        "title": "CodeFindingRead",
        "type": "object"
      },
      "CodeFindingSuppressRequest": {
        "properties": {
          "reason": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "CodeFindingSuppressRequest",
        "type": "object"
      },
      "CodeSearchHit": {
        "properties": {
          "end_line": {
            "title": "End Line",
            "type": "integer"
          },
          "path": {
            "title": "Path",
            "type": "string"
          },
          "score": {
            "title": "Score",
            "type": "number"
          },
          "snippet": {
            "title": "Snippet",
            "type": "string"
          },
          "start_line": {
            "title": "Start Line",
            "type": "integer"
          },
          "symbol": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Symbol"
          }
        },
        "required": [
          "path",
          "start_line",
          "end_line",
          "snippet",
          "score"
        ],
        "title": "CodeSearchHit",
        "type": "object"
      },
      "CodeSearchRequest": {
        "properties": {
          "mode": {
            "default": "hybrid",
            "pattern": "^(semantic|hybrid)$",
            "title": "Mode",
            "type": "string"
          },
          "path": {
            "anyOf": [
              {
                "maxLength": 1024,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Path"
          },
          "query": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Query",
            "type": "string"
          },
          "top_k": {
            "default": 10,
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Top K",
            "type": "integer"
          }
        },
        "required": [
          "query"
        ],
        "title": "CodeSearchRequest",
        "type": "object"
      },
      "CodeSearchResponse": {
        "properties": {
          "hits": {
            "items": {
              "$ref": "#/components/schemas/CodeSearchHit"
            },
            "title": "Hits",
            "type": "array"
          },
          "ingested_sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ingested Sha"
          },
          "truncated": {
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "hits",
          "truncated",
          "ingested_sha"
        ],
        "title": "CodeSearchResponse",
        "type": "object"
      },
      "ConnectAgentIntegrationResponse": {
        "description": "Returned by ``connect``/``rotate``; ``url`` is what the browser redirects to.",
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "ConnectAgentIntegrationResponse",
        "type": "object"
      },
      "ConnectIntegrationResponse": {
        "description": "Returned by ``connect``/``rotate``. ``url`` is what the front-end's\nsubmit handler redirects the browser to.",
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "ConnectIntegrationResponse",
        "type": "object"
      },
      "ConnectOnboardingLink": {
        "description": "One-shot Stripe onboarding URL \u2014 opaque, expires per Stripe's TTL.",
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "ConnectOnboardingLink",
        "type": "object"
      },
      "ConnectStatusRead": {
        "description": "Marketplace seller Connect Express status for the calling user.",
        "properties": {
          "charges_enabled": {
            "title": "Charges Enabled",
            "type": "boolean"
          },
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "payouts_enabled": {
            "title": "Payouts Enabled",
            "type": "boolean"
          },
          "stripe_account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Account Id"
          }
        },
        "required": [
          "connected",
          "stripe_account_id",
          "charges_enabled",
          "payouts_enabled"
        ],
        "title": "ConnectStatusRead",
        "type": "object"
      },
      "ConnectorToolSync": {
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "description_long": {
            "title": "Description Long",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "display_name",
          "description",
          "description_long"
        ],
        "title": "ConnectorToolSync",
        "type": "object"
      },
      "CostPeriod": {
        "description": "Inclusive start, exclusive end.  UTC.",
        "properties": {
          "end": {
            "format": "date-time",
            "title": "End",
            "type": "string"
          },
          "start": {
            "format": "date-time",
            "title": "Start",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end"
        ],
        "title": "CostPeriod",
        "type": "object"
      },
      "CredentialSubmit": {
        "description": "Body the browser sends to store the credential value.\n\nSubmitted directly to the skill-config encryption endpoint. The value\nMUST NOT be written to ``session_message`` or conversation history.",
        "properties": {
          "config_key": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Config Key",
            "type": "string"
          },
          "request_id": {
            "minLength": 1,
            "title": "Request Id",
            "type": "string"
          },
          "skill_id": {
            "minLength": 1,
            "title": "Skill Id",
            "type": "string"
          },
          "value": {
            "description": "The raw credential value. Encrypted immediately; never persisted in cleartext.",
            "minLength": 1,
            "title": "Value",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "skill_id",
          "config_key",
          "value"
        ],
        "title": "CredentialSubmit",
        "type": "object"
      },
      "CronBlackoutCreate": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "end_date": {
            "format": "date",
            "title": "End Date",
            "type": "string"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "maxLength": 1024,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "recurring_yearly": {
            "default": false,
            "title": "Recurring Yearly",
            "type": "boolean"
          },
          "start_date": {
            "format": "date",
            "title": "Start Date",
            "type": "string"
          },
          "timezone": {
            "default": "UTC",
            "maxLength": 64,
            "title": "Timezone",
            "type": "string"
          }
        },
        "required": [
          "name",
          "start_date",
          "end_date"
        ],
        "title": "CronBlackoutCreate",
        "type": "object"
      },
      "CronBlackoutRead": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "end_date": {
            "format": "date",
            "title": "End Date",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "recurring_yearly": {
            "title": "Recurring Yearly",
            "type": "boolean"
          },
          "start_date": {
            "format": "date",
            "title": "Start Date",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "timezone": {
            "title": "Timezone",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "name",
          "reason",
          "start_date",
          "end_date",
          "timezone",
          "recurring_yearly",
          "created_by_user_id",
          "created_at",
          "updated_at"
        ],
        "title": "CronBlackoutRead",
        "type": "object"
      },
      "CronBlackoutUpdate": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "end_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "reason": {
            "anyOf": [
              {
                "maxLength": 1024,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "recurring_yearly": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recurring Yearly"
          },
          "start_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date"
          },
          "timezone": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          }
        },
        "title": "CronBlackoutUpdate",
        "type": "object"
      },
      "CronJobCreate": {
        "properties": {
          "body_bytes": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body Bytes"
          },
          "cron_expr": {
            "anyOf": [
              {
                "maxLength": 128,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cron Expr"
          },
          "fire_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fire At"
          },
          "headers": {
            "title": "Headers",
            "type": "object"
          },
          "interval_minutes": {
            "anyOf": [
              {
                "maximum": 525960.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interval Minutes"
          },
          "kind": {
            "pattern": "^(one_shot|recurring)$",
            "title": "Kind",
            "type": "string"
          },
          "max_retries": {
            "default": 3,
            "maximum": 10.0,
            "minimum": 0.0,
            "title": "Max Retries",
            "type": "integer"
          },
          "method": {
            "default": "POST",
            "pattern": "^(GET|POST|PUT|DELETE|PATCH)$",
            "title": "Method",
            "type": "string"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "retry_backoff": {
            "default": "exponential",
            "maxLength": 32,
            "title": "Retry Backoff",
            "type": "string"
          },
          "schedule_type": {
            "default": "interval",
            "pattern": "^(interval|daily)$",
            "title": "Schedule Type",
            "type": "string"
          },
          "start_time": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Time"
          },
          "target": {
            "minLength": 1,
            "title": "Target",
            "type": "string"
          },
          "target_kind": {
            "pattern": "^(internal_agent|external_url)$",
            "title": "Target Kind",
            "type": "string"
          },
          "timezone": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          }
        },
        "required": [
          "name",
          "kind",
          "target_kind",
          "target"
        ],
        "title": "CronJobCreate",
        "type": "object"
      },
      "CronJobDetail": {
        "description": "``CronJobRead`` plus the request body, for the detail view (#216).\n\nThe body is stored in GCS, not on the row, so it is fetched from the cron\nservice on demand (``?include_body=true``) rather than being returned by\nevery list call. For a ``target_kind=internal_agent`` routine this **is the\nprompt the agent will be handed**, which is why the tab needs it \u2014 a\nschedule with an invisible payload isn't reviewable.\n\n``body`` is None when the routine has no body, and also when the cron\nservice could not be reached: the schedule is still worth rendering when\nthe body fetch fails, so the failure is reported as absence plus\n``body_available=False`` rather than by failing the whole request.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "body_available": {
            "default": true,
            "title": "Body Available",
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "cron_expr": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cron Expr"
          },
          "fire_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fire At"
          },
          "headers": {
            "title": "Headers",
            "type": "object"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "last_fired_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Fired At"
          },
          "last_status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Status Code"
          },
          "max_retries": {
            "title": "Max Retries",
            "type": "integer"
          },
          "method": {
            "title": "Method",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "next_fire_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Fire At"
          },
          "retry_backoff": {
            "title": "Retry Backoff",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "target": {
            "title": "Target",
            "type": "string"
          },
          "target_kind": {
            "title": "Target Kind",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "created_by_user_id",
          "name",
          "kind",
          "fire_at",
          "cron_expr",
          "timezone",
          "next_fire_at",
          "method",
          "target_kind",
          "target",
          "headers",
          "max_retries",
          "retry_backoff",
          "status",
          "last_fired_at",
          "last_status_code",
          "created_at",
          "updated_at"
        ],
        "title": "CronJobDetail",
        "type": "object"
      },
      "CronJobRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "cron_expr": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cron Expr"
          },
          "fire_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fire At"
          },
          "headers": {
            "title": "Headers",
            "type": "object"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "last_fired_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Fired At"
          },
          "last_status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Status Code"
          },
          "max_retries": {
            "title": "Max Retries",
            "type": "integer"
          },
          "method": {
            "title": "Method",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "next_fire_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Fire At"
          },
          "retry_backoff": {
            "title": "Retry Backoff",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "target": {
            "title": "Target",
            "type": "string"
          },
          "target_kind": {
            "title": "Target Kind",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "created_by_user_id",
          "name",
          "kind",
          "fire_at",
          "cron_expr",
          "timezone",
          "next_fire_at",
          "method",
          "target_kind",
          "target",
          "headers",
          "max_retries",
          "retry_backoff",
          "status",
          "last_fired_at",
          "last_status_code",
          "created_at",
          "updated_at"
        ],
        "title": "CronJobRead",
        "type": "object"
      },
      "CronJobUpdate": {
        "properties": {
          "body_bytes": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body Bytes"
          },
          "cron_expr": {
            "anyOf": [
              {
                "maxLength": 128,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cron Expr"
          },
          "headers": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Headers"
          },
          "interval_minutes": {
            "anyOf": [
              {
                "maximum": 525960.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interval Minutes"
          },
          "max_retries": {
            "anyOf": [
              {
                "maximum": 10.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Retries"
          },
          "method": {
            "anyOf": [
              {
                "pattern": "^(GET|POST|PUT|DELETE|PATCH)$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Method"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "retry_backoff": {
            "anyOf": [
              {
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Retry Backoff"
          },
          "schedule_type": {
            "anyOf": [
              {
                "pattern": "^(interval|daily)$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schedule Type"
          },
          "start_time": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Time"
          },
          "target": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target"
          },
          "timezone": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          }
        },
        "title": "CronJobUpdate",
        "type": "object"
      },
      "CronRunNowRequest": {
        "description": "Body of the public run-now route (#216).\n\n``override_blackout`` is refused for an own-scoped caller (a MEMBER holding\nonly ``cron:own:write``); overriding a tenant-wide control is an admin act.",
        "properties": {
          "override_blackout": {
            "default": false,
            "title": "Override Blackout",
            "type": "boolean"
          }
        },
        "title": "CronRunNowRequest",
        "type": "object"
      },
      "CronRunRead": {
        "description": "One fire attempt (#216). Rows are written by the cron service after every\nattempt, retries included, so a routine that has been failing all week shows\nas a run of non-2xx ``status_code`` values rather than a single stale\n``last_status_code`` on the job.",
        "properties": {
          "attempt": {
            "title": "Attempt",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "fired_at": {
            "format": "date-time",
            "title": "Fired At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "job_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Job Id",
            "type": "string"
          },
          "status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Code"
          }
        },
        "required": [
          "id",
          "job_id",
          "attempt",
          "status_code",
          "error",
          "fired_at",
          "created_at"
        ],
        "title": "CronRunRead",
        "type": "object"
      },
      "CustomHttpModelCreate": {
        "description": "Body for ``POST /tenant/{tenant_id}/models/custom-http`` (BYOM, #507).\n\nDeliberately narrow: ``kind`` is forced to ``custom_http`` server-side and\nthe tenant/owner come from the path + auth context, so a caller cannot\nsmuggle ``tenant_id`` / ``owner_user_id`` / ``kind`` / ``status`` /\n``is_super_admin`` (mass-assignment defense). ``auth_token`` is the secret\nbearer token; it is stored encrypted via BYOK and never echoed back.",
        "properties": {
          "auth_token": {
            "maxLength": 4096,
            "minLength": 1,
            "title": "Auth Token",
            "type": "string"
          },
          "base_url": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Base Url",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "extra_headers": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Headers"
          },
          "model_slug": {
            "maxLength": 256,
            "minLength": 1,
            "title": "Model Slug",
            "type": "string"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "pricing": {
            "title": "Pricing",
            "type": "object"
          }
        },
        "required": [
          "name",
          "base_url",
          "model_slug",
          "auth_token"
        ],
        "title": "CustomHttpModelCreate",
        "type": "object"
      },
      "CustomRedactionPattern": {
        "description": "A tenant-supplied regex pattern + replacement tag.",
        "properties": {
          "pattern": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "Pattern",
            "type": "string"
          },
          "tag": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Tag",
            "type": "string"
          }
        },
        "required": [
          "pattern",
          "tag"
        ],
        "title": "CustomRedactionPattern",
        "type": "object"
      },
      "DatabaseCredentialAdd": {
        "description": "Request body for adding or rotating a PostgreSQL database credential.\n\nThe password is encrypted immediately and never returned via the API.\nProvider is stored as ``db:postgres:<host>`` so each target host has a\ndistinct linked_identity row.",
        "properties": {
          "database": {
            "description": "Database name to connect to. Colons are not allowed.",
            "maxLength": 63,
            "minLength": 1,
            "pattern": "^[^:]+$",
            "title": "Database",
            "type": "string"
          },
          "host": {
            "description": "Hostname or IP address of the database server. Only letters, digits, dots, hyphens, and underscores are allowed \u2014 must match what the `db_query` connector accepts.",
            "maxLength": 52,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9._-]+$",
            "title": "Host",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Human-readable label (defaults to username@host:port/database)",
            "title": "Label"
          },
          "password": {
            "description": "Database password. Encrypted at rest; never returned.",
            "minLength": 1,
            "title": "Password",
            "type": "string"
          },
          "port": {
            "default": 5432,
            "description": "PostgreSQL port (default 5432)",
            "maximum": 65535.0,
            "minimum": 1.0,
            "title": "Port",
            "type": "integer"
          },
          "ssl_mode": {
            "description": "SSL mode: 'require' (SSL mandatory), 'prefer' (try SSL, fall back to plaintext), or 'disable' (plaintext). Default: 'prefer'.",
            "enum": [
              "require",
              "prefer",
              "disable"
            ],
            "title": "Ssl Mode",
            "type": "string"
          },
          "username": {
            "description": "Database username.",
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9._@-]+$",
            "title": "Username",
            "type": "string"
          }
        },
        "required": [
          "host",
          "username",
          "database",
          "password"
        ],
        "title": "DatabaseCredentialAdd",
        "type": "object"
      },
      "DecisionLogEntry": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "decision": {
            "title": "Decision",
            "type": "string"
          },
          "detector": {
            "title": "Detector",
            "type": "string"
          },
          "direction": {
            "title": "Direction",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "meta": {
            "title": "Meta",
            "type": "object"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "direction",
          "detector",
          "decision",
          "reason",
          "created_at"
        ],
        "title": "DecisionLogEntry",
        "type": "object"
      },
      "DecisionLogResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/DecisionLogEntry"
            },
            "title": "Items",
            "type": "array"
          },
          "next_page_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Page Token"
          }
        },
        "required": [
          "items"
        ],
        "title": "DecisionLogResponse",
        "type": "object"
      },
      "DefaultPermissionsRead": {
        "description": "Tenant-wide default permissions.",
        "properties": {
          "can_create_agents": {
            "default": true,
            "title": "Can Create Agents",
            "type": "boolean"
          },
          "can_create_skills": {
            "default": true,
            "title": "Can Create Skills",
            "type": "boolean"
          },
          "can_invite_users": {
            "default": false,
            "title": "Can Invite Users",
            "type": "boolean"
          },
          "can_manage_settings": {
            "default": false,
            "title": "Can Manage Settings",
            "type": "boolean"
          },
          "can_view_billing": {
            "default": false,
            "title": "Can View Billing",
            "type": "boolean"
          }
        },
        "title": "DefaultPermissionsRead",
        "type": "object"
      },
      "DefaultPermissionsUpdate": {
        "description": "Update body for tenant default permissions.",
        "properties": {
          "can_create_agents": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Create Agents"
          },
          "can_create_skills": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Create Skills"
          },
          "can_invite_users": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Invite Users"
          },
          "can_manage_settings": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Manage Settings"
          },
          "can_view_billing": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can View Billing"
          }
        },
        "title": "DefaultPermissionsUpdate",
        "type": "object"
      },
      "DelegationCreate": {
        "description": "Request body for granting an agent read-only delegation.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 1,
            "title": "Agent Id",
            "type": "string"
          },
          "channels": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional channel/folder filter. E.g. {'channels': ['#general', '#eng']} for Slack, or {'folders': ['INBOX']} for email.",
            "title": "Channels"
          },
          "provider": {
            "description": "Provider slug matching the user's linked_identity (e.g. 'slack', 'email:google').",
            "maxLength": 64,
            "minLength": 1,
            "title": "Provider",
            "type": "string"
          },
          "scope": {
            "const": "read",
            "description": "Delegation scope. Only 'read' is supported in this release.",
            "title": "Scope",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "provider"
        ],
        "title": "DelegationCreate",
        "type": "object"
      },
      "DelegationRead": {
        "description": "Public projection of a delegation (linked_identity with delegated_agent_id set).",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "delegated_agent_id": {
            "title": "Delegated Agent Id",
            "type": "string"
          },
          "delegated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delegated At"
          },
          "delegation_channels": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delegation Channels"
          },
          "delegation_scope": {
            "title": "Delegation Scope",
            "type": "string"
          },
          "display_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Label"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "provider",
          "delegated_agent_id",
          "delegation_scope",
          "delegation_channels",
          "delegated_at",
          "display_label",
          "scopes",
          "created_at"
        ],
        "title": "DelegationRead",
        "type": "object"
      },
      "DesktopClientConfig": {
        "description": "How a desktop client (the VS Code extension) signs in with Keycloak.",
        "properties": {
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "issuer": {
            "title": "Issuer",
            "type": "string"
          }
        },
        "required": [
          "issuer",
          "client_id"
        ],
        "title": "DesktopClientConfig",
        "type": "object"
      },
      "DevEnvCreateResponse": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "ssh_enabled": {
            "default": false,
            "title": "Ssh Enabled",
            "type": "boolean"
          },
          "ssh_username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ssh Username"
          },
          "status": {
            "default": "created",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "DevEnvCreateResponse",
        "type": "object"
      },
      "DevEnvExtraSshKeyCreate": {
        "properties": {
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "public_key": {
            "minLength": 1,
            "title": "Public Key",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          },
          "username": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Username",
            "type": "string"
          }
        },
        "required": [
          "username",
          "public_key"
        ],
        "title": "DevEnvExtraSshKeyCreate",
        "type": "object"
      },
      "DevEnvExtraSshKeyRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "granted_by_user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Granted By User Id",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "public_key": {
            "title": "Public Key",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          },
          "username": {
            "title": "Username",
            "type": "string"
          }
        },
        "required": [
          "id",
          "agent_id",
          "username",
          "public_key",
          "granted_by_user_id",
          "created_at"
        ],
        "title": "DevEnvExtraSshKeyRead",
        "type": "object"
      },
      "DevEnvGroupIdeGrantCreate": {
        "description": "Grant web-IDE access to a tenant group's user members (#424).\n\nNo key material \u2014 unlike an extra SSH key this only opens the browser editor\n(which runs as the shared uid), so a group member needs no Linux key on the\npod. ``expires_at`` optionally time-boxes the grant.",
        "properties": {
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "group_id": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Group Id",
            "type": "string"
          }
        },
        "required": [
          "group_id"
        ],
        "title": "DevEnvGroupIdeGrantCreate",
        "type": "object"
      },
      "DevEnvGroupIdeGrantRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "granted_by_user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Granted By User Id",
            "type": "string"
          },
          "group_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Group Id",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "agent_id",
          "group_id",
          "granted_by_user_id",
          "created_at"
        ],
        "title": "DevEnvGroupIdeGrantRead",
        "type": "object"
      },
      "DevEnvStartRequest": {
        "description": "Body of the tenant-scoped start route (GitLab #313) \u2014 deliberately empty.\n\nThe internal route lets its caller name an image; a browser must not, so\nthis model carries no fields and forbids extras. Anything smuggled in\n(``image``, ``tenant_id``, ``is_super_admin``, ``agent_id``) is a 422 rather\nthan a field that might one day be read.",
        "properties": {},
        "title": "DevEnvStartRequest",
        "type": "object"
      },
      "DevEnvStatusResponse": {
        "properties": {
          "exists": {
            "title": "Exists",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "ready": {
            "title": "Ready",
            "type": "boolean"
          },
          "ready_replicas": {
            "default": 0,
            "title": "Ready Replicas",
            "type": "integer"
          },
          "replicas": {
            "default": 0,
            "title": "Replicas",
            "type": "integer"
          },
          "ssh_enabled": {
            "default": false,
            "title": "Ssh Enabled",
            "type": "boolean"
          },
          "ssh_host": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ssh Host"
          },
          "ssh_port": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ssh Port"
          },
          "ssh_username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ssh Username"
          }
        },
        "required": [
          "exists",
          "ready",
          "name"
        ],
        "title": "DevEnvStatusResponse",
        "type": "object"
      },
      "DigestRead": {
        "description": "The latest structured digest for a session, or ``null`` if none exists.",
        "properties": {
          "generated_at": {
            "format": "date-time",
            "title": "Generated At",
            "type": "string"
          },
          "lead_summary": {
            "title": "Lead Summary",
            "type": "string"
          },
          "stories": {
            "items": {
              "$ref": "#/components/schemas/DigestStoryRead"
            },
            "title": "Stories",
            "type": "array"
          }
        },
        "required": [
          "lead_summary",
          "generated_at",
          "stories"
        ],
        "title": "DigestRead",
        "type": "object"
      },
      "DigestStoryRead": {
        "description": "One story tile in the feed.",
        "properties": {
          "image_status": {
            "enum": [
              "pending",
              "resolved",
              "failed"
            ],
            "title": "Image Status",
            "type": "string"
          },
          "og_image_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Og Image Url"
          },
          "position": {
            "title": "Position",
            "type": "integer"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "position",
          "title",
          "summary",
          "url",
          "source",
          "og_image_url",
          "image_status"
        ],
        "title": "DigestStoryRead",
        "type": "object"
      },
      "DocumentFile": {
        "description": "One uploaded file.\n\n``page_count`` is always ``None`` today: DocWorker's ``file`` row has no\npage count and its extractors discard the page structure after pulling\ntext (``services/ingest.py::_extract_pdf``). The key is kept in the\ncontract rather than dropped so populating it later is additive.\n\n``scan_status`` is the ClamAV verdict for this file, read from the\nplatform's own ``file_scan`` table (decision #24) \u2014 not from DocWorker.\n``None`` means no scan row references this file id yet.",
        "properties": {
          "content_type": {
            "title": "Content Type",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "page_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Page Count"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "scan_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scan Status"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "filename",
          "content_type",
          "size_bytes",
          "project_id",
          "status",
          "created_at"
        ],
        "title": "DocumentFile",
        "type": "object"
      },
      "DocumentFileBatchDeleteRequest": {
        "description": "Delete several files in one call \u2014 the \"Manage files\" bulk action.\n\n``file_ids`` carries only ids the caller selected; there is no\ntenant/owner field to smuggle (mass-assignment). The list is capped so a\nsingle request cannot fan out into an unbounded number of DocWorker\ndeletes, and the route de-duplicates before acting.",
        "properties": {
          "file_ids": {
            "items": {
              "type": "string"
            },
            "maxItems": 100,
            "minItems": 1,
            "title": "File Ids",
            "type": "array"
          }
        },
        "required": [
          "file_ids"
        ],
        "title": "DocumentFileBatchDeleteRequest",
        "type": "object"
      },
      "DocumentFileBatchDeleteResponse": {
        "description": "Partial-success result: what went, and what didn't and why.\n\nA single bad id does not sink the batch \u2014 the good ones are deleted and\nreported in ``deleted``; the rest land in ``failed`` so the UI can tell\nthe operator exactly what remains.",
        "properties": {
          "deleted": {
            "items": {
              "type": "string"
            },
            "title": "Deleted",
            "type": "array"
          },
          "failed": {
            "items": {
              "$ref": "#/components/schemas/DocumentFileDeleteFailure"
            },
            "title": "Failed",
            "type": "array"
          }
        },
        "required": [
          "deleted",
          "failed"
        ],
        "title": "DocumentFileBatchDeleteResponse",
        "type": "object"
      },
      "DocumentFileDeleteFailure": {
        "description": "One file the batch could not delete, with a non-leaky reason.\n\n``reason`` is deliberately coarse (\"not found\") \u2014 a foreign or mistyped\nid must be indistinguishable, so the response never confirms whether an\nid exists in another tenant (IDOR/BOLA).",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "id",
          "reason"
        ],
        "title": "DocumentFileDeleteFailure",
        "type": "object"
      },
      "DocumentFileListResponse": {
        "properties": {
          "files": {
            "items": {
              "$ref": "#/components/schemas/DocumentFile"
            },
            "title": "Files",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "files",
          "total"
        ],
        "title": "DocumentFileListResponse",
        "type": "object"
      },
      "DocumentImportStatus": {
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "files_imported": {
            "default": 0,
            "title": "Files Imported",
            "type": "integer"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status",
          "started_at"
        ],
        "title": "DocumentImportStatus",
        "type": "object"
      },
      "DocumentImportTriggered": {
        "properties": {
          "import_run_id": {
            "title": "Import Run Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "import_run_id",
          "status"
        ],
        "title": "DocumentImportTriggered",
        "type": "object"
      },
      "DocumentProject": {
        "description": "One knowledge-base project. ``file_count`` is computed by DocWorker.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "file_count": {
            "default": 0,
            "title": "File Count",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "created_at",
          "updated_at"
        ],
        "title": "DocumentProject",
        "type": "object"
      },
      "DocumentProjectCreate": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "DocumentProjectCreate",
        "type": "object"
      },
      "DocumentProjectListResponse": {
        "properties": {
          "projects": {
            "items": {
              "$ref": "#/components/schemas/DocumentProject"
            },
            "title": "Projects",
            "type": "array"
          }
        },
        "required": [
          "projects"
        ],
        "title": "DocumentProjectListResponse",
        "type": "object"
      },
      "DocumentProjectUpdate": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "title": "DocumentProjectUpdate",
        "type": "object"
      },
      "DocumentSearchHit": {
        "properties": {
          "chunk_id": {
            "title": "Chunk Id",
            "type": "string"
          },
          "content": {
            "title": "Content",
            "type": "string"
          },
          "end_char": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Char"
          },
          "file_id": {
            "title": "File Id",
            "type": "string"
          },
          "mode": {
            "enum": [
              "semantic",
              "keyword"
            ],
            "title": "Mode",
            "type": "string"
          },
          "ordinal": {
            "title": "Ordinal",
            "type": "integer"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "score": {
            "title": "Score",
            "type": "number"
          },
          "start_char": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Char"
          }
        },
        "required": [
          "chunk_id",
          "file_id",
          "project_id",
          "ordinal",
          "content",
          "score",
          "mode"
        ],
        "title": "DocumentSearchHit",
        "type": "object"
      },
      "DocumentSearchRequest": {
        "properties": {
          "limit": {
            "default": 10,
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Limit",
            "type": "integer"
          },
          "mode": {
            "enum": [
              "semantic",
              "keyword"
            ],
            "title": "Mode",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "query": {
            "minLength": 1,
            "title": "Query",
            "type": "string"
          }
        },
        "required": [
          "query"
        ],
        "title": "DocumentSearchRequest",
        "type": "object"
      },
      "DocumentSearchResponse": {
        "properties": {
          "hits": {
            "items": {
              "$ref": "#/components/schemas/DocumentSearchHit"
            },
            "title": "Hits",
            "type": "array"
          }
        },
        "required": [
          "hits"
        ],
        "title": "DocumentSearchResponse",
        "type": "object"
      },
      "DocumentSource": {
        "properties": {
          "folder_ids": {
            "items": {
              "type": "string"
            },
            "title": "Folder Ids",
            "type": "array"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "last_import_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Import At"
          },
          "last_import_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Import Status"
          },
          "linked_at": {
            "format": "date-time",
            "title": "Linked At",
            "type": "string"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "folder_ids",
          "linked_at"
        ],
        "title": "DocumentSource",
        "type": "object"
      },
      "DocumentSourceCreate": {
        "description": "Link a merge.dev file-storage account's folders as a document source.",
        "properties": {
          "folder_ids": {
            "items": {
              "type": "string"
            },
            "maxItems": 200,
            "minItems": 1,
            "title": "Folder Ids",
            "type": "array"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "provider": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "folder_ids"
        ],
        "title": "DocumentSourceCreate",
        "type": "object"
      },
      "DocumentSourceFolder": {
        "description": "One folder in the linked account's tree.\n\n``parent_id`` is ``None`` for a top-level folder. ``has_children`` is\nderived from the account's own folder set, so an empty folder is never\noffered as expandable.",
        "properties": {
          "has_children": {
            "default": false,
            "title": "Has Children",
            "type": "boolean"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Id"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "title": "DocumentSourceFolder",
        "type": "object"
      },
      "DocumentSourceFolderListResponse": {
        "properties": {
          "folders": {
            "items": {
              "$ref": "#/components/schemas/DocumentSourceFolder"
            },
            "title": "Folders",
            "type": "array"
          }
        },
        "required": [
          "folders"
        ],
        "title": "DocumentSourceFolderListResponse",
        "type": "object"
      },
      "DocumentSourceListResponse": {
        "properties": {
          "sources": {
            "items": {
              "$ref": "#/components/schemas/DocumentSource"
            },
            "title": "Sources",
            "type": "array"
          }
        },
        "required": [
          "sources"
        ],
        "title": "DocumentSourceListResponse",
        "type": "object"
      },
      "DocumentSourceProvider": {
        "description": "One selectable file-storage provider.\n\n``connected`` is whether the tenant already holds a usable merge.dev\nfile-storage link for it (decision #20 \u2014 the token lives in\n``tenant_identity``). The UI disables the rest until it is true, so a\nprovider is never offered as a destination the server cannot reach.",
        "properties": {
          "connected": {
            "default": false,
            "title": "Connected",
            "type": "boolean"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          }
        },
        "required": [
          "id",
          "label"
        ],
        "title": "DocumentSourceProvider",
        "type": "object"
      },
      "DocumentSourceProviderListResponse": {
        "properties": {
          "providers": {
            "items": {
              "$ref": "#/components/schemas/DocumentSourceProvider"
            },
            "title": "Providers",
            "type": "array"
          }
        },
        "required": [
          "providers"
        ],
        "title": "DocumentSourceProviderListResponse",
        "type": "object"
      },
      "EditorToolResult": {
        "description": "An editor answering one tool call.\n\n``result`` is shaped like any tool result \u2014 ``{\"success\": bool, ...}`` \u2014\nand goes to the model verbatim, so the editor truncates large output first.",
        "properties": {
          "call_id": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Call Id",
            "type": "string"
          },
          "result": {
            "title": "Result",
            "type": "object"
          }
        },
        "required": [
          "call_id",
          "result"
        ],
        "title": "EditorToolResult",
        "type": "object"
      },
      "EditorTurn": {
        "description": "Optional ``editor`` block on ``POST \u2026/sessions/{s}/messages``.\n\nNames the workspace tools the calling editor will answer itself for the turn\nthis message starts. Only an agent with ``editor_enabled`` accepts it;\nunknown names are ignored, and a read-only session is offered only the\nread tools.",
        "properties": {
          "tools": {
            "items": {
              "type": "string"
            },
            "maxItems": 32,
            "title": "Tools",
            "type": "array"
          },
          "workspace": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EditorWorkspace"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "EditorTurn",
        "type": "object"
      },
      "EditorWorkspace": {
        "description": "What the connected editor has open, for the agent's prompt.\n\nDeliberately tiny and length-capped: every field is client-supplied and is\nrendered into the prompt of the turn it rides on.",
        "properties": {
          "git_branch": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Git Branch"
          },
          "git_remote": {
            "anyOf": [
              {
                "maxLength": 400,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Credentials are stripped server-side.",
            "title": "Git Remote"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Workspace folder name.",
            "title": "Name"
          },
          "platform": {
            "anyOf": [
              {
                "maxLength": 50,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Editor host OS, e.g. darwin, linux, win32.",
            "title": "Platform"
          }
        },
        "title": "EditorWorkspace",
        "type": "object"
      },
      "EffectiveTerms": {
        "description": "What a tenant actually runs under: its plan with overrides applied.",
        "properties": {
          "allow_byo_models": {
            "title": "Allow Byo Models",
            "type": "boolean"
          },
          "allowed_merge_categories": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Merge Categories"
          },
          "apps": {
            "additionalProperties": {
              "type": "boolean"
            },
            "title": "Apps",
            "type": "object"
          },
          "budgets": {
            "additionalProperties": {
              "additionalProperties": {
                "type": "number"
              },
              "type": "object"
            },
            "title": "Budgets",
            "type": "object"
          },
          "free_tier_model_kinds": {
            "items": {
              "type": "string"
            },
            "title": "Free Tier Model Kinds",
            "type": "array"
          },
          "ide_free_minutes_per_month": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Free Minutes Per Month"
          },
          "ide_price_cents_per_user_hour": {
            "title": "Ide Price Cents Per User Hour",
            "type": "integer"
          },
          "max_agents": {
            "title": "Max Agents",
            "type": "integer"
          },
          "max_concurrent_sessions": {
            "title": "Max Concurrent Sessions",
            "type": "integer"
          },
          "max_connections_per_agent": {
            "title": "Max Connections Per Agent",
            "type": "integer"
          },
          "max_mailboxes_per_agent": {
            "title": "Max Mailboxes Per Agent",
            "type": "integer"
          },
          "max_messages_per_mailbox": {
            "title": "Max Messages Per Mailbox",
            "type": "integer"
          },
          "max_storage_gb": {
            "title": "Max Storage Gb",
            "type": "integer"
          },
          "max_tasks_per_day": {
            "title": "Max Tasks Per Day",
            "type": "integer"
          },
          "overridden": {
            "items": {
              "type": "string"
            },
            "title": "Overridden",
            "type": "array"
          },
          "paid_tier": {
            "default": false,
            "title": "Paid Tier",
            "type": "boolean"
          },
          "plan_code": {
            "title": "Plan Code",
            "type": "string"
          },
          "plan_id": {
            "title": "Plan Id",
            "type": "string"
          },
          "price_cents": {
            "title": "Price Cents",
            "type": "integer"
          },
          "seat_price_cents": {
            "title": "Seat Price Cents",
            "type": "integer"
          },
          "token_markup_bps": {
            "title": "Token Markup Bps",
            "type": "integer"
          },
          "zero_cost_model_kinds": {
            "items": {
              "type": "string"
            },
            "title": "Zero Cost Model Kinds",
            "type": "array"
          }
        },
        "required": [
          "plan_id",
          "plan_code",
          "max_agents",
          "max_tasks_per_day",
          "max_concurrent_sessions",
          "max_storage_gb",
          "max_mailboxes_per_agent",
          "max_messages_per_mailbox",
          "max_connections_per_agent",
          "price_cents",
          "seat_price_cents",
          "token_markup_bps",
          "ide_price_cents_per_user_hour",
          "ide_free_minutes_per_month",
          "allow_byo_models",
          "allowed_merge_categories",
          "budgets",
          "apps"
        ],
        "title": "EffectiveTerms",
        "type": "object"
      },
      "EmailVerificationResult": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "detail"
        ],
        "title": "EmailVerificationResult",
        "type": "object"
      },
      "EmailVerificationStatus": {
        "properties": {
          "email": {
            "title": "Email",
            "type": "string"
          },
          "email_verified": {
            "title": "Email Verified",
            "type": "boolean"
          },
          "email_verified_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email Verified At"
          }
        },
        "required": [
          "email",
          "email_verified",
          "email_verified_at"
        ],
        "title": "EmailVerificationStatus",
        "type": "object"
      },
      "EnableWritesResponse": {
        "properties": {
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "expires_at": {
            "title": "Expires At",
            "type": "string"
          },
          "grant_id": {
            "title": "Grant Id",
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "grant_id",
          "expires_at"
        ],
        "title": "EnableWritesResponse",
        "type": "object"
      },
      "ExpensiveTaskRow": {
        "description": "One of the Top-N most expensive task sessions in the window.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "title": "Agent Name",
            "type": "string"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "cost_usd": {
            "title": "Cost Usd",
            "type": "number"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "duration_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Duration Seconds"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "top_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Model"
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          }
        },
        "required": [
          "session_id",
          "status",
          "agent_id",
          "agent_name",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_usd",
          "created_at"
        ],
        "title": "ExpensiveTaskRow",
        "type": "object"
      },
      "FineTuneJobCreate": {
        "properties": {
          "base_model_id": {
            "maxLength": 25,
            "minLength": 25,
            "title": "Base Model Id",
            "type": "string"
          },
          "benchmark_id": {
            "maxLength": 25,
            "minLength": 25,
            "title": "Benchmark Id",
            "type": "string"
          },
          "harness": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Harness"
          },
          "hparams": {
            "title": "Hparams",
            "type": "object"
          },
          "trainer": {
            "default": "slime",
            "title": "Trainer",
            "type": "string"
          }
        },
        "required": [
          "benchmark_id",
          "base_model_id"
        ],
        "title": "FineTuneJobCreate",
        "type": "object"
      },
      "FineTuneJobPromoteRequest": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "FineTuneJobPromoteRequest",
        "type": "object"
      },
      "FineTuneJobRead": {
        "properties": {
          "base_model_id": {
            "title": "Base Model Id",
            "type": "string"
          },
          "benchmark_id": {
            "title": "Benchmark Id",
            "type": "string"
          },
          "checkpoint_uri": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checkpoint Uri"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "harness": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Harness"
          },
          "hparams": {
            "title": "Hparams",
            "type": "object"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "k8s_job_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "K8S Job Name"
          },
          "k8s_namespace": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "K8S Namespace"
          },
          "progress_pct": {
            "title": "Progress Pct",
            "type": "integer"
          },
          "promoted_model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Promoted Model Id"
          },
          "reward_mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reward Mean"
          },
          "status": {
            "$ref": "#/components/schemas/FineTuneJobStatus"
          },
          "step": {
            "title": "Step",
            "type": "integer"
          },
          "trainer": {
            "title": "Trainer",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "benchmark_id",
          "base_model_id",
          "harness",
          "trainer",
          "hparams",
          "status",
          "step",
          "progress_pct",
          "reward_mean",
          "checkpoint_uri",
          "promoted_model_id",
          "error",
          "k8s_job_name",
          "k8s_namespace",
          "created_by",
          "created_at",
          "updated_at"
        ],
        "title": "FineTuneJobRead",
        "type": "object"
      },
      "FineTuneJobStatus": {
        "enum": [
          "queued",
          "running",
          "succeeded",
          "failed",
          "promoted"
        ],
        "title": "FineTuneJobStatus",
        "type": "string"
      },
      "FlowisePromoteRequest": {
        "description": "Request body for ``POST .../flowise/chatflows/{chatflow_id}/promote``.",
        "properties": {
          "agent_name": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Display name for the promoted agent. Defaults to the chatflow name.",
            "title": "Agent Name"
          },
          "agent_slug": {
            "anyOf": [
              {
                "maxLength": 60,
                "pattern": "^[a-z0-9][a-z0-9-]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "URL-safe slug. Defaults to a slugified version of the chatflow name.",
            "title": "Agent Slug"
          },
          "overwrite": {
            "default": true,
            "description": "If True (the default), overwrite the agent repo's seed Agent.md / Soul.md / main.py with the translated chatflow output. Set False to keep any pre-existing files in place \u2014 useful when re-running promotion against an agent whose source has already been edited.",
            "title": "Overwrite",
            "type": "boolean"
          }
        },
        "title": "FlowisePromoteRequest",
        "type": "object"
      },
      "FlowisePromoteResponse": {
        "description": "Response from a successful chatflow promotion.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "agent_slug": {
            "title": "Agent Slug",
            "type": "string"
          },
          "files_written": {
            "items": {
              "type": "string"
            },
            "title": "Files Written",
            "type": "array"
          },
          "repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Url"
          }
        },
        "required": [
          "agent_id",
          "agent_slug",
          "repo_url",
          "files_written"
        ],
        "title": "FlowisePromoteResponse",
        "type": "object"
      },
      "ForkSessionCreate": {
        "description": "Body for `POST /tenant/{t}/agent/{a}/sessions/{s}/fork`.\n\nBranches a **new** session from a historical message of the parent session\n``{s}`` (issue #8). The new fork references the parent's transcript up to\nand including ``fork_message_id`` (the \"cut\"), then is append-only from its\nown birth \u2014 the parent is never touched (decision #37). ``title`` is\noptional; when omitted the fork is titled after its parent. The fork\ninherits the parent's ``read_only`` flag; forking a read-only *caller*\nsession is refused (decision #32).",
        "properties": {
          "fork_message_id": {
            "description": "Message in the parent session to branch from (the transcript cut).",
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Fork Message Id",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "required": [
          "fork_message_id"
        ],
        "title": "ForkSessionCreate",
        "type": "object"
      },
      "GitHubAppInstallRequest": {
        "description": "Tenant admin supplies the GitHub App installation_id after completing the\nGitHub App install flow in the browser. The API stores it on\n``tenant_identity`` (provider ``github:app``); access tokens are minted\non-demand later from the App's private key and this installation id.",
        "properties": {
          "installation_id": {
            "description": "GitHub App installation ID from the install callback.",
            "title": "Installation Id",
            "type": "integer"
          }
        },
        "required": [
          "installation_id"
        ],
        "title": "GitHubAppInstallRequest",
        "type": "object"
      },
      "GitHubAppInstallResponse": {
        "description": "Confirmation that the GitHub App installation token was stored.",
        "properties": {
          "installation_id": {
            "title": "Installation Id",
            "type": "integer"
          },
          "provider": {
            "default": "github:app",
            "title": "Provider",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "installation_id"
        ],
        "title": "GitHubAppInstallResponse",
        "type": "object"
      },
      "GitHubRepoWebhookCreate": {
        "description": "Wire a specific GitHub repo to an agent via a webhook route.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "auto_start": {
            "default": true,
            "title": "Auto Start",
            "type": "boolean"
          },
          "branches": {
            "description": "Branch filter for push events. Empty means all branches.",
            "items": {
              "type": "string"
            },
            "title": "Branches",
            "type": "array"
          },
          "event_types": {
            "description": "GitHub event types to subscribe to.",
            "items": {
              "type": "string"
            },
            "title": "Event Types",
            "type": "array"
          },
          "repo_full_name": {
            "description": "GitHub repo in owner/repo format.",
            "examples": [
              "octocat/Hello-World"
            ],
            "title": "Repo Full Name",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "repo_full_name"
        ],
        "title": "GitHubRepoWebhookCreate",
        "type": "object"
      },
      "GitHubRepoWebhookRead": {
        "description": "Webhook route enriched with GitHub-specific filter data.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "auto_start": {
            "title": "Auto Start",
            "type": "boolean"
          },
          "branches": {
            "items": {
              "type": "string"
            },
            "title": "Branches",
            "type": "array"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "event_types": {
            "items": {
              "type": "string"
            },
            "title": "Event Types",
            "type": "array"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "path_token": {
            "title": "Path Token",
            "type": "string"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "repo_full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Full Name"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "provider",
          "path_token",
          "is_active",
          "auto_start",
          "created_at",
          "updated_at"
        ],
        "title": "GitHubRepoWebhookRead",
        "type": "object"
      },
      "GitHubWebhookEventRead": {
        "description": "Read-only view of a GitHub webhook delivery (dedup table row).",
        "properties": {
          "action": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Action"
          },
          "delivery_id": {
            "title": "Delivery Id",
            "type": "string"
          },
          "event_type": {
            "title": "Event Type",
            "type": "string"
          },
          "processed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Processed At"
          },
          "received_at": {
            "format": "date-time",
            "title": "Received At",
            "type": "string"
          },
          "ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ref"
          },
          "repo_full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Full Name"
          },
          "route_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Route Id",
            "type": "string"
          }
        },
        "required": [
          "delivery_id",
          "route_id",
          "event_type",
          "received_at"
        ],
        "title": "GitHubWebhookEventRead",
        "type": "object"
      },
      "GoalCreate": {
        "description": "Body for ``PUT /tenant/{t}/sessions/{s}/goal`` (decision #16, issue #616).\n\nOnly a USER sets a goal. Every field here is user intent; **nothing\nbudget- or counter-shaped that the server computes is accepted**. In\nparticular ``goal_continuations`` / ``goal_status`` / ``tokens_used`` are not\nfields on this model, so a client that smuggles them in the body is ignored\n(``extra`` defaults to ignore) \u2014 the server owns the counters. See\ndocs/content/goals-and-planning.md \u00a7 7.",
        "properties": {
          "deadline_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deadline At"
          },
          "max_continuations": {
            "maximum": 1000.0,
            "minimum": 1.0,
            "title": "Max Continuations",
            "type": "integer"
          },
          "objective": {
            "maxLength": 4000,
            "minLength": 1,
            "title": "Objective",
            "type": "string"
          },
          "token_budget": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Budget"
          }
        },
        "required": [
          "objective",
          "max_continuations"
        ],
        "title": "GoalCreate",
        "type": "object"
      },
      "GoalRead": {
        "description": "The server-authoritative goal state for a session (issue #616).\n\n``tokens_used`` is always computed server-side from ``model_usage`` \u2014 the\nfigure a client sees is the one the continuation budget gate enforces.",
        "properties": {
          "continuations": {
            "title": "Continuations",
            "type": "integer"
          },
          "deadline_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deadline At"
          },
          "ended_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ended At"
          },
          "max_continuations": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Continuations"
          },
          "objective": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Objective"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "token_budget": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Budget"
          },
          "tokens_used": {
            "title": "Tokens Used",
            "type": "integer"
          }
        },
        "required": [
          "objective",
          "status",
          "token_budget",
          "max_continuations",
          "deadline_at",
          "continuations",
          "tokens_used",
          "started_at",
          "ended_at"
        ],
        "title": "GoalRead",
        "type": "object"
      },
      "GroupManagerRead": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "label"
        ],
        "title": "GroupManagerRead",
        "type": "object"
      },
      "GroupMemberAdd": {
        "properties": {
          "member_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Member Id",
            "type": "string"
          },
          "member_kind": {
            "enum": [
              "user",
              "agent"
            ],
            "title": "Member Kind",
            "type": "string"
          }
        },
        "required": [
          "member_kind",
          "member_id"
        ],
        "title": "GroupMemberAdd",
        "type": "object"
      },
      "GroupMemberRead": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "member_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Member Id",
            "type": "string"
          },
          "member_kind": {
            "enum": [
              "user",
              "agent"
            ],
            "title": "Member Kind",
            "type": "string"
          }
        },
        "required": [
          "member_kind",
          "member_id",
          "label"
        ],
        "title": "GroupMemberRead",
        "type": "object"
      },
      "GuardrailModelOptionsRead": {
        "description": "Response schema for GET /agents/guardrail-model-options (issue #2321).\n\nReturns the enumerated set of valid model IDs for each per-agent override\nsurfaced by ``agent_proxy_config``: Prompt Guard, Llama Guard, and the\nembedding model used for memory / tool / skill context assembly. Seeded\nfrom the proxy's hardcoded defaults; extended by broker-registered\nvariants once a capability marker is available on the ``model`` table.\nComboboxes in the agent settings Guardrails section source from this list\nwhile still allowing free-form entry for forward-compat.",
        "properties": {
          "embedding": {
            "items": {
              "type": "string"
            },
            "title": "Embedding",
            "type": "array"
          },
          "llama_guard": {
            "items": {
              "type": "string"
            },
            "title": "Llama Guard",
            "type": "array"
          },
          "prompt_guard": {
            "items": {
              "type": "string"
            },
            "title": "Prompt Guard",
            "type": "array"
          }
        },
        "required": [
          "prompt_guard",
          "llama_guard",
          "embedding"
        ],
        "title": "GuardrailModelOptionsRead",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "HfDownloadRead": {
        "properties": {
          "bytes_downloaded": {
            "title": "Bytes Downloaded",
            "type": "integer"
          },
          "bytes_total": {
            "title": "Bytes Total",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "gcs_uri": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gcs Uri"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "model_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Id"
          },
          "repo_id": {
            "title": "Repo Id",
            "type": "string"
          },
          "requested_by": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Requested By"
          },
          "revision": {
            "title": "Revision",
            "type": "string"
          },
          "state": {
            "title": "State",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "repo_id",
          "revision",
          "filename",
          "state",
          "bytes_downloaded",
          "bytes_total",
          "gcs_uri",
          "error",
          "model_id",
          "requested_by",
          "created_at",
          "updated_at"
        ],
        "title": "HfDownloadRead",
        "type": "object"
      },
      "HfPullRequest": {
        "properties": {
          "filename": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Filename",
            "type": "string"
          },
          "license_acknowledged": {
            "default": false,
            "title": "License Acknowledged",
            "type": "boolean"
          },
          "repo_id": {
            "maxLength": 256,
            "minLength": 1,
            "title": "Repo Id",
            "type": "string"
          },
          "revision": {
            "default": "main",
            "maxLength": 128,
            "title": "Revision",
            "type": "string"
          }
        },
        "required": [
          "repo_id",
          "filename"
        ],
        "title": "HfPullRequest",
        "type": "object"
      },
      "HfRepoDetail": {
        "properties": {
          "author": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author"
          },
          "gated": {
            "default": false,
            "title": "Gated",
            "type": "boolean"
          },
          "gguf_files": {
            "items": {
              "$ref": "#/components/schemas/HfRepoFile"
            },
            "title": "Gguf Files",
            "type": "array"
          },
          "license": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "License"
          },
          "repo_id": {
            "title": "Repo Id",
            "type": "string"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          }
        },
        "required": [
          "repo_id"
        ],
        "title": "HfRepoDetail",
        "type": "object"
      },
      "HfRepoFile": {
        "properties": {
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "quantization": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantization"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          }
        },
        "required": [
          "filename",
          "size_bytes"
        ],
        "title": "HfRepoFile",
        "type": "object"
      },
      "HfSearchResultItem": {
        "properties": {
          "author": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author"
          },
          "downloads": {
            "default": 0,
            "title": "Downloads",
            "type": "integer"
          },
          "last_modified": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Modified"
          },
          "license": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "License"
          },
          "likes": {
            "default": 0,
            "title": "Likes",
            "type": "integer"
          },
          "pipeline_tag": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pipeline Tag"
          },
          "repo_id": {
            "title": "Repo Id",
            "type": "string"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          }
        },
        "required": [
          "repo_id"
        ],
        "title": "HfSearchResultItem",
        "type": "object"
      },
      "IdeEligibility": {
        "description": "Can this caller open the IDE here, and in what state is it?\n\nExists so the front-end can gate its controls on a server-supplied\n*attribute* rather than on \"a session exists\" \u2014 and so it can do that\nwithout opening a session, which would mint a credential as a side effect\nof rendering a page.",
        "properties": {
          "allowance_blocked": {
            "default": false,
            "title": "Allowance Blocked",
            "type": "boolean"
          },
          "allowance_minutes": {
            "default": 0,
            "title": "Allowance Minutes",
            "type": "integer"
          },
          "eligible": {
            "title": "Eligible",
            "type": "boolean"
          },
          "ide_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Kind"
          },
          "overage_enabled": {
            "default": false,
            "title": "Overage Enabled",
            "type": "boolean"
          },
          "preferred_kind": {
            "title": "Preferred Kind",
            "type": "string"
          },
          "reason": {
            "enum": [
              "owner",
              "owner_no_ssh_key",
              "granted",
              "not_granted",
              "not_in_plan"
            ],
            "title": "Reason",
            "type": "string"
          },
          "session_open": {
            "default": false,
            "title": "Session Open",
            "type": "boolean"
          },
          "used_minutes": {
            "default": 0,
            "title": "Used Minutes",
            "type": "integer"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Username"
          }
        },
        "required": [
          "eligible",
          "preferred_kind"
        ],
        "title": "IdeEligibility",
        "type": "object"
      },
      "IdeMountCreate": {
        "description": "Mount one thing. Exactly what the user clicked 'edit' on, nothing else.",
        "properties": {
          "kind": {
            "enum": [
              "skill",
              "monorepo"
            ],
            "title": "Kind",
            "type": "string"
          },
          "skill_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skill Id"
          }
        },
        "required": [
          "kind"
        ],
        "title": "IdeMountCreate",
        "type": "object"
      },
      "IdeMountRead": {
        "properties": {
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "path": {
            "title": "Path",
            "type": "string"
          },
          "read_only": {
            "default": false,
            "title": "Read Only",
            "type": "boolean"
          }
        },
        "required": [
          "kind",
          "name",
          "path"
        ],
        "title": "IdeMountRead",
        "type": "object"
      },
      "IdeMountsRead": {
        "properties": {
          "mounts": {
            "items": {
              "$ref": "#/components/schemas/IdeMountRead"
            },
            "title": "Mounts",
            "type": "array"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "workspace_file": {
            "title": "Workspace File",
            "type": "string"
          }
        },
        "required": [
          "workspace_file"
        ],
        "title": "IdeMountsRead",
        "type": "object"
      },
      "IdeOverageRead": {
        "description": "Web-IDE allowance + the overage add-on switch (#337).\n\nSame numbers as ``dev_env_ide_usage.allowance_state`` \u2014 the window the\nallowance is *enforced* against, so what the admin sees is what gates.",
        "properties": {
          "allowance_minutes": {
            "title": "Allowance Minutes",
            "type": "integer"
          },
          "blocked": {
            "title": "Blocked",
            "type": "boolean"
          },
          "overage_enabled": {
            "title": "Overage Enabled",
            "type": "boolean"
          },
          "overage_entitled": {
            "title": "Overage Entitled",
            "type": "boolean"
          },
          "remaining_minutes": {
            "title": "Remaining Minutes",
            "type": "integer"
          },
          "used_minutes": {
            "title": "Used Minutes",
            "type": "integer"
          },
          "window": {
            "$ref": "#/components/schemas/UsageWindow"
          }
        },
        "required": [
          "overage_enabled",
          "overage_entitled",
          "used_minutes",
          "allowance_minutes",
          "remaining_minutes",
          "blocked",
          "window"
        ],
        "title": "IdeOverageRead",
        "type": "object"
      },
      "IdeOverageUpdate": {
        "description": "The one caller-settable field. Anything else in the body is ignored \u2014\nthe tenant comes from the path, the actor from the request context.",
        "properties": {
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ],
        "title": "IdeOverageUpdate",
        "type": "object"
      },
      "IdeSessionOpen": {
        "description": "Open (or re-attach to) an IDE session.\n\n``ide_kind`` also **persists** as the caller's preference when supplied, so\nthe next environment they create opens in the editor they chose.",
        "properties": {
          "ide_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Kind"
          }
        },
        "title": "IdeSessionOpen",
        "type": "object"
      },
      "IdeSessionRead": {
        "properties": {
          "ide_kind": {
            "title": "Ide Kind",
            "type": "string"
          },
          "preferred_kind": {
            "title": "Preferred Kind",
            "type": "string"
          },
          "restart_required": {
            "title": "Restart Required",
            "type": "boolean"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "username": {
            "title": "Username",
            "type": "string"
          },
          "workspace_file": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workspace File"
          }
        },
        "required": [
          "session_id",
          "username",
          "ide_kind",
          "preferred_kind",
          "restart_required"
        ],
        "title": "IdeSessionRead",
        "type": "object"
      },
      "IdentityProviderCreate": {
        "properties": {
          "alias": {
            "description": "Tenant-visible alias. The realm-wide alias is namespaced as tenant-<tenant_id>-<alias>.",
            "maxLength": 40,
            "minLength": 2,
            "pattern": "^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]$",
            "title": "Alias",
            "type": "string"
          },
          "config": {
            "title": "Config",
            "type": "object"
          },
          "display_name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Display Name",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "provider_id": {
            "enum": [
              "oidc",
              "saml",
              "google",
              "microsoft",
              "github"
            ],
            "title": "Provider Id",
            "type": "string"
          }
        },
        "required": [
          "alias",
          "provider_id",
          "display_name"
        ],
        "title": "IdentityProviderCreate",
        "type": "object"
      },
      "IdentityProviderRead": {
        "description": "Returned to API callers. Hides the ``tenant-<id>-`` alias prefix.\n\n``provider_id`` is a plain ``str`` here (vs the ``ProviderId`` Literal on\ncreate/update) so an unrecognised ``providerId`` from Keycloak \u2014 e.g. an\nIdP created directly in the realm or a provider type added later \u2014 does\nnot 500 the read path. The Literal still gates writes.",
        "properties": {
          "alias": {
            "title": "Alias",
            "type": "string"
          },
          "config": {
            "title": "Config",
            "type": "object"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "provider_id": {
            "title": "Provider Id",
            "type": "string"
          }
        },
        "required": [
          "alias",
          "provider_id",
          "display_name",
          "enabled",
          "config"
        ],
        "title": "IdentityProviderRead",
        "type": "object"
      },
      "IdentityProviderUpdate": {
        "properties": {
          "config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "display_name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          }
        },
        "title": "IdentityProviderUpdate",
        "type": "object"
      },
      "ImpersonateTenantResponse": {
        "description": "Response payload for ``POST /admin/tenants/{tenant_id}/impersonate``.\n\nThe client navigates to ``redirect_url`` after the active-tenant cookie is set.",
        "properties": {
          "redirect_url": {
            "title": "Redirect Url",
            "type": "string"
          }
        },
        "required": [
          "redirect_url"
        ],
        "title": "ImpersonateTenantResponse",
        "type": "object"
      },
      "InstallLinkResponse": {
        "description": "The GitHub App install URL carrying a single-use ``state``.",
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "InstallLinkResponse",
        "type": "object"
      },
      "InstallStatusResponse": {
        "description": "Whether the tenant has the platform GitHub App connected.",
        "properties": {
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "installation_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Installation Id"
          }
        },
        "required": [
          "connected"
        ],
        "title": "InstallStatusResponse",
        "type": "object"
      },
      "InviteCreate": {
        "properties": {
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "role": {
            "default": "MEMBER",
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "title": "InviteCreate",
        "type": "object"
      },
      "InviteCreated": {
        "properties": {
          "created": {
            "title": "Created",
            "type": "boolean"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "tenant_id",
          "role",
          "created"
        ],
        "title": "InviteCreated",
        "type": "object"
      },
      "InviteTenantAdminRequest": {
        "properties": {
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "title": "InviteTenantAdminRequest",
        "type": "object"
      },
      "JsonObject": {
        "description": "Arbitrary JSON object. Mirrors `dict[str, Any]` on the Python side; codegen emits a model class with no required fields.",
        "type": "object"
      },
      "KahalaGrantCreate": {
        "description": "Body for ``POST /tenant/{tenant_id}/agents/{agent_id}/kahala-grants``.",
        "properties": {
          "tier": {
            "$ref": "#/components/schemas/KahalaGrantTier",
            "default": "suggest",
            "description": "Access tier: 'read' < 'suggest' < 'write' < 'modify_structure', each including the ones below it. Defaults to 'suggest' (the agent proposes edits for a human to accept). Re-granting the same scope with a different tier changes it."
          },
          "wiki_slug": {
            "anyOf": [
              {
                "maxLength": 256,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Kahala wiki slug to narrow this grant to. Omit (or null) to grant access to every wiki in this tenant.",
            "title": "Wiki Slug"
          }
        },
        "title": "KahalaGrantCreate",
        "type": "object"
      },
      "KahalaGrantRead": {
        "description": "One grant row as returned to an admin.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "granted_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Granted By User Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          },
          "wiki_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wiki Slug"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "wiki_slug",
          "tier",
          "granted_by_user_id",
          "revoked_at",
          "created_at"
        ],
        "title": "KahalaGrantRead",
        "type": "object"
      },
      "KahalaGrantTier": {
        "description": "The four grant tiers, low \u2192 high. ``str`` mix-in so a value serialises\nas its name and compares equal to the stored column string.",
        "enum": [
          "read",
          "suggest",
          "write",
          "modify_structure"
        ],
        "title": "KahalaGrantTier",
        "type": "string"
      },
      "KahalaWikiListResponse": {
        "description": "``GET /tenant/{tenant_id}/kahala/wikis`` \u2014 wrapped for later pagination.",
        "properties": {
          "wikis": {
            "items": {
              "$ref": "#/components/schemas/KahalaWikiOption"
            },
            "title": "Wikis",
            "type": "array"
          }
        },
        "required": [
          "wikis"
        ],
        "title": "KahalaWikiListResponse",
        "type": "object"
      },
      "KahalaWikiOption": {
        "description": "One wiki in a tenant's Kahala registry, as the grant typeahead shows it.",
        "properties": {
          "is_default": {
            "default": false,
            "title": "Is Default",
            "type": "boolean"
          },
          "name": {
            "description": "Human label shown in the picker.",
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "description": "Submitted value \u2014 what a grant's `wiki_slug` stores.",
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "slug",
          "name"
        ],
        "title": "KahalaWikiOption",
        "type": "object"
      },
      "LangflowInstanceRead": {
        "properties": {
          "entry_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entry Path"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "title": "LangflowInstanceRead",
        "type": "object"
      },
      "LangflowPromoteRequest": {
        "description": "Request body for ``POST .../langflow/flows/{flow_id}/promote``.\n\n``flow_data`` is the raw flow export JSON \u2014 the shape\n``GET /api/v1/flows/{id}`` returns on a tenant's Langflow instance. The\nAPI has no standing credential to fetch it itself (unlike Flowise's\nstored workspace API key \u2014 see ``docs/content/langflow.md``'s \"Known\ngap\"), so the caller (the front-end, already holding an authenticated\nproxied session to the instance) fetches it and posts it here.",
        "properties": {
          "agent_name": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Display name for the promoted agent. Defaults to the flow name.",
            "title": "Agent Name"
          },
          "agent_slug": {
            "anyOf": [
              {
                "maxLength": 60,
                "pattern": "^[a-z0-9][a-z0-9-]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "URL-safe slug. Defaults to a slugified version of the flow name.",
            "title": "Agent Slug"
          },
          "flow_data": {
            "description": "Raw Langflow flow export JSON, as returned by the tenant's Langflow instance's GET /api/v1/flows/{flow_id}.",
            "title": "Flow Data",
            "type": "object"
          },
          "overwrite": {
            "default": true,
            "description": "If True (the default), overwrite the agent repo's seed Agent.md / Soul.md / main.py with the translated flow output. Set False to keep any pre-existing files in place \u2014 useful when re-running promotion against an agent whose source has already been edited.",
            "title": "Overwrite",
            "type": "boolean"
          }
        },
        "required": [
          "flow_data"
        ],
        "title": "LangflowPromoteRequest",
        "type": "object"
      },
      "LangflowPromoteResponse": {
        "description": "Response from a successful flow promotion.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "agent_slug": {
            "title": "Agent Slug",
            "type": "string"
          },
          "files_written": {
            "items": {
              "type": "string"
            },
            "title": "Files Written",
            "type": "array"
          },
          "repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo Url"
          }
        },
        "required": [
          "agent_id",
          "agent_slug",
          "repo_url",
          "files_written"
        ],
        "title": "LangflowPromoteResponse",
        "type": "object"
      },
      "LinkableProvider": {
        "description": "One row of the user-linkable provider catalogue. Booleans only.",
        "properties": {
          "configured": {
            "title": "Configured",
            "type": "boolean"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "user_linkable": {
            "title": "User Linkable",
            "type": "boolean"
          }
        },
        "required": [
          "slug",
          "label",
          "configured",
          "user_linkable"
        ],
        "title": "LinkableProvider",
        "type": "object"
      },
      "LinkedIdentityPurpose": {
        "enum": [
          "tool",
          "auth_mirror"
        ],
        "title": "LinkedIdentityPurpose",
        "type": "string"
      },
      "LinkedIdentityRead": {
        "description": "Public projection of a ``linked_identity`` row. Never includes tokens.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "display_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Label"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "needs_relink": {
            "default": false,
            "title": "Needs Relink",
            "type": "boolean"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "provider_subject": {
            "title": "Provider Subject",
            "type": "string"
          },
          "purpose": {
            "$ref": "#/components/schemas/LinkedIdentityPurpose"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "provider",
          "provider_subject",
          "display_label",
          "purpose",
          "scopes",
          "expires_at",
          "created_at"
        ],
        "title": "LinkedIdentityRead",
        "type": "object"
      },
      "LinkedRepoCreate": {
        "properties": {
          "branch": {
            "maxLength": 255,
            "minLength": 1,
            "title": "Branch",
            "type": "string"
          },
          "linked_identity_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linked Identity Id"
          },
          "remote_url": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Remote Url",
            "type": "string"
          }
        },
        "required": [
          "remote_url",
          "branch"
        ],
        "title": "LinkedRepoCreate",
        "type": "object"
      },
      "LinkedRepoListResponse": {
        "properties": {
          "repos": {
            "items": {
              "$ref": "#/components/schemas/LinkedRepoRead"
            },
            "title": "Repos",
            "type": "array"
          }
        },
        "required": [
          "repos"
        ],
        "title": "LinkedRepoListResponse",
        "type": "object"
      },
      "LinkedRepoRead": {
        "properties": {
          "branch": {
            "title": "Branch",
            "type": "string"
          },
          "chunk_count": {
            "title": "Chunk Count",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "file_count": {
            "title": "File Count",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_ingested_sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Ingested Sha"
          },
          "remote_url": {
            "title": "Remote Url",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "truncated": {
            "title": "Truncated",
            "type": "boolean"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "remote_url",
          "branch",
          "status",
          "file_count",
          "chunk_count",
          "truncated",
          "created_at",
          "updated_at"
        ],
        "title": "LinkedRepoRead",
        "type": "object"
      },
      "LinkedRepoWebhookCreated": {
        "description": "Returned only on create/rotate \u2014 includes the raw signing secret (shown once).",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "linked_repo_id": {
            "title": "Linked Repo Id",
            "type": "string"
          },
          "secret": {
            "title": "Secret",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "webhook_id": {
            "title": "Webhook Id",
            "type": "string"
          },
          "webhook_url": {
            "title": "Webhook Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "linked_repo_id",
          "webhook_id",
          "webhook_url",
          "created_at",
          "updated_at",
          "secret"
        ],
        "title": "LinkedRepoWebhookCreated",
        "type": "object"
      },
      "LinkedRepoWebhookRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "linked_repo_id": {
            "title": "Linked Repo Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "webhook_id": {
            "title": "Webhook Id",
            "type": "string"
          },
          "webhook_url": {
            "title": "Webhook Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "linked_repo_id",
          "webhook_id",
          "webhook_url",
          "created_at",
          "updated_at"
        ],
        "title": "LinkedRepoWebhookRead",
        "type": "object"
      },
      "ListenModeUpdate": {
        "description": "Body for `POST /tenant/{t}/agent/{a}/sessions/{s}/listen`.\n\nDrives the chat composer's \"listen\" toggle. `on=True` enters the silent\nloop (user messages buffer, the agent is not invoked); `on=False` exits\nand flushes the buffered messages as one combined prompt. See\ndocs/content/chat-listen-mode.md.",
        "properties": {
          "on": {
            "title": "On",
            "type": "boolean"
          }
        },
        "required": [
          "on"
        ],
        "title": "ListenModeUpdate",
        "type": "object"
      },
      "ListingKind": {
        "enum": [
          "skill",
          "agent"
        ],
        "title": "ListingKind",
        "type": "string"
      },
      "ListingVisibility": {
        "enum": [
          "public",
          "unlisted"
        ],
        "title": "ListingVisibility",
        "type": "string"
      },
      "LoginRequest": {
        "properties": {
          "password": {
            "minLength": 1,
            "title": "Password",
            "type": "string"
          },
          "username": {
            "minLength": 1,
            "title": "Username",
            "type": "string"
          }
        },
        "required": [
          "username",
          "password"
        ],
        "title": "LoginRequest",
        "type": "object"
      },
      "LoginResponse": {
        "properties": {
          "email": {
            "title": "Email",
            "type": "string"
          },
          "expires_in": {
            "title": "Expires In",
            "type": "integer"
          },
          "token_type": {
            "title": "Token Type",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "user_id",
          "email",
          "expires_in",
          "token_type"
        ],
        "title": "LoginResponse",
        "type": "object"
      },
      "MailboxKind": {
        "enum": [
          "internal",
          "external"
        ],
        "title": "MailboxKind",
        "type": "string"
      },
      "MarketplaceListingBrowse": {
        "description": "Lightweight projection for the public browse endpoint.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "price_cents": {
            "title": "Price Cents",
            "type": "integer"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "title",
          "slug",
          "description",
          "price_cents",
          "currency",
          "created_at"
        ],
        "title": "MarketplaceListingBrowse",
        "type": "object"
      },
      "MarketplaceListingCreate": {
        "description": "Body for POST /tenant/{tenant_id}/marketplace/listings.",
        "properties": {
          "currency": {
            "default": "USD",
            "title": "Currency",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "kind": {
            "$ref": "#/components/schemas/ListingKind"
          },
          "price_cents": {
            "default": 0,
            "minimum": 0.0,
            "title": "Price Cents",
            "type": "integer"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "source_agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Agent Id"
          },
          "source_skill_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Skill Id"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "visibility": {
            "$ref": "#/components/schemas/ListingVisibility",
            "default": "public"
          }
        },
        "required": [
          "kind",
          "title",
          "slug"
        ],
        "title": "MarketplaceListingCreate",
        "type": "object"
      },
      "MarketplaceListingDetail": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "price_cents": {
            "title": "Price Cents",
            "type": "integer"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewer_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Id"
          },
          "seller_user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Seller User Id",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "versions": {
            "items": {
              "$ref": "#/components/schemas/MarketplaceVersionRead"
            },
            "title": "Versions",
            "type": "array"
          },
          "visibility": {
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "seller_user_id",
          "kind",
          "title",
          "slug",
          "description",
          "price_cents",
          "currency",
          "status",
          "visibility",
          "created_at",
          "updated_at"
        ],
        "title": "MarketplaceListingDetail",
        "type": "object"
      },
      "MarketplaceListingRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "price_cents": {
            "title": "Price Cents",
            "type": "integer"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewer_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Id"
          },
          "seller_user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Seller User Id",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "visibility": {
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "seller_user_id",
          "kind",
          "title",
          "slug",
          "description",
          "price_cents",
          "currency",
          "status",
          "visibility",
          "created_at",
          "updated_at"
        ],
        "title": "MarketplaceListingRead",
        "type": "object"
      },
      "MarketplacePayoutRead": {
        "description": "Response schema for payout history.",
        "properties": {
          "amount_cents": {
            "title": "Amount Cents",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "seller_user_id": {
            "title": "Seller User Id",
            "type": "string"
          },
          "stripe_transfer_id": {
            "title": "Stripe Transfer Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "seller_user_id",
          "stripe_transfer_id",
          "amount_cents",
          "currency",
          "created_at"
        ],
        "title": "MarketplacePayoutRead",
        "type": "object"
      },
      "MarketplaceReviewDecision": {
        "description": "Admin decision on a pending marketplace listing review (issue #3133).",
        "properties": {
          "decision": {
            "enum": [
              "approved",
              "rejected"
            ],
            "title": "Decision",
            "type": "string"
          },
          "review_notes": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          }
        },
        "required": [
          "decision"
        ],
        "title": "MarketplaceReviewDecision",
        "type": "object"
      },
      "MarketplaceReviewResponse": {
        "description": "Response after a submit-review or review action.",
        "properties": {
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewer_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Id"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "reviewer_id",
          "reviewed_at",
          "review_notes"
        ],
        "title": "MarketplaceReviewResponse",
        "type": "object"
      },
      "MarketplaceVersionRead": {
        "properties": {
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "listing_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Listing Id",
            "type": "string"
          },
          "published_at": {
            "format": "date-time",
            "title": "Published At",
            "type": "string"
          },
          "sha256": {
            "title": "Sha256",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "id",
          "listing_id",
          "version",
          "sha256",
          "published_at"
        ],
        "title": "MarketplaceVersionRead",
        "type": "object"
      },
      "MeResponse": {
        "properties": {
          "active_tenant_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Tenant Id"
          },
          "email_verified": {
            "default": false,
            "title": "Email Verified",
            "type": "boolean"
          },
          "is_super_admin": {
            "title": "Is Super Admin",
            "type": "boolean"
          },
          "self_serve_verified_email_required": {
            "default": false,
            "title": "Self Serve Verified Email Required",
            "type": "boolean"
          },
          "user": {
            "$ref": "#/components/schemas/UserRead"
          }
        },
        "required": [
          "user",
          "active_tenant_id",
          "is_super_admin"
        ],
        "title": "MeResponse",
        "type": "object"
      },
      "MemberRoleUpdate": {
        "properties": {
          "role": {
            "pattern": "^(ADMIN|MEMBER|GUEST)$",
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role"
        ],
        "title": "MemberRoleUpdate",
        "type": "object"
      },
      "MemoryCitation": {
        "description": "``ctx.memory.cite`` response \u2014 full memory record + optional transcript.\n\nReturned by ``GET /api/internal/sessions/{s}/memory/{memory_id}``. The\n``source_message`` field is populated when the memory was written with a\n``source_message_id`` AND the target transcript row is still visible to\nthe calling session (cross-session reads return ``source_message=None``\nrather than 403 so the citation chain degrades gracefully).",
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "source_message": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TranscriptTurn"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_message_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Message Id"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "id",
          "content",
          "kind"
        ],
        "title": "MemoryCitation",
        "type": "object"
      },
      "MemoryConflictListResponse": {
        "properties": {
          "conflicts": {
            "items": {
              "$ref": "#/components/schemas/MemoryConflictRead"
            },
            "title": "Conflicts",
            "type": "array"
          }
        },
        "required": [
          "conflicts"
        ],
        "title": "MemoryConflictListResponse",
        "type": "object"
      },
      "MemoryConflictRead": {
        "description": "A dream-cycle-detected pair of contradictory memories.\n\nMirrors ``models.agent_memory_conflict.AgentMemoryConflict`` minus\nthe FK columns. Used by both the tenant-admin route\n(``GET /tenant/{t}/agent/{a}/conflicts``) and the agent-side\ninternal route (``GET /sessions/{s}/memory/conflicts``).",
        "properties": {
          "detected_at": {
            "format": "date-time",
            "title": "Detected At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "memory_a_id": {
            "title": "Memory A Id",
            "type": "string"
          },
          "memory_b_id": {
            "title": "Memory B Id",
            "type": "string"
          },
          "resolution": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolution"
          },
          "resolved_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolved At"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          }
        },
        "required": [
          "id",
          "memory_a_id",
          "memory_b_id",
          "detected_at"
        ],
        "title": "MemoryConflictRead",
        "type": "object"
      },
      "MemoryConflictResolve": {
        "description": "Body for ``POST .../conflicts/{id}/resolve``.\n\n``keep`` must be one of the conflict's two memory ids; the loser is\ndropped from Valkey and the conflict row is marked resolved with\n``resolution = {\"kept\": <keep>, \"dropped\": <loser>, \"reason\": <reason>}``.",
        "properties": {
          "keep": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Keep",
            "type": "string"
          },
          "reason": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "keep",
          "reason"
        ],
        "title": "MemoryConflictResolve",
        "type": "object"
      },
      "MemoryExportResponse": {
        "description": "Response from ``POST /tenant/{t}/agent/{a}/memory/export``.\n\nThe export lands at ``gcs_uri`` (per-agent workspace folder, decision\n#11). ``download_url`` is a short-lived V4 signed URL \u2014 None in\nenvironments where signing isn't wired (local kind), so the UI falls\nback to the ``gs://`` URI for direct access from the cluster.",
        "properties": {
          "download_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Download Url"
          },
          "exported": {
            "title": "Exported",
            "type": "integer"
          },
          "gcs_uri": {
            "title": "Gcs Uri",
            "type": "string"
          },
          "include_embeddings": {
            "title": "Include Embeddings",
            "type": "boolean"
          }
        },
        "required": [
          "gcs_uri",
          "exported",
          "include_embeddings"
        ],
        "title": "MemoryExportResponse",
        "type": "object"
      },
      "MemoryImportRequest": {
        "description": "JSON body for ``POST /tenant/{t}/agent/{a}/memory/import-from-gcs``.\n\nThe ``/import`` endpoint is multipart-only \u2014 its ``gcs_uri`` is\naccepted as a form field alongside the optional ``file`` upload. This\nschema is the dedicated JSON entry point that re-imports an existing\nexport (e.g. service-to-service callers that already have the\n``gs://`` URI of a prior export).",
        "properties": {
          "gcs_uri": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gcs Uri"
          }
        },
        "title": "MemoryImportRequest",
        "type": "object"
      },
      "MemoryImportResponse": {
        "description": "Counts for ``POST /tenant/{t}/agent/{a}/memory/import``.\n\n``scanned`` is the number of JSONL rows the schema validator looked at;\n``imported`` is the subset that landed in Valkey; ``skipped`` is\nwell-formed rows the caller filtered out (e.g. duplicate ids); and\n``failed`` is rows that broke schema or re-embedding.",
        "properties": {
          "failed": {
            "title": "Failed",
            "type": "integer"
          },
          "imported": {
            "title": "Imported",
            "type": "integer"
          },
          "scanned": {
            "title": "Scanned",
            "type": "integer"
          },
          "skipped": {
            "title": "Skipped",
            "type": "integer"
          }
        },
        "required": [
          "scanned",
          "imported",
          "skipped",
          "failed"
        ],
        "title": "MemoryImportResponse",
        "type": "object"
      },
      "MemorySummaryRead": {
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "as_of": {
            "format": "date-time",
            "title": "As Of",
            "type": "string"
          },
          "generated_from_count": {
            "title": "Generated From Count",
            "type": "integer"
          },
          "summary_markdown": {
            "title": "Summary Markdown",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "summary_markdown",
          "as_of",
          "generated_from_count"
        ],
        "title": "MemorySummaryRead",
        "type": "object"
      },
      "MemorySummaryUpdate": {
        "properties": {
          "summary_markdown": {
            "maxLength": 50000,
            "minLength": 1,
            "title": "Summary Markdown",
            "type": "string"
          }
        },
        "required": [
          "summary_markdown"
        ],
        "title": "MemorySummaryUpdate",
        "type": "object"
      },
      "MentionItem": {
        "description": "A single resolved mention inside a chat message.",
        "properties": {
          "display": {
            "description": "Human-readable label shown in the chip",
            "minLength": 1,
            "title": "Display",
            "type": "string"
          },
          "id": {
            "description": "CUID (agent/user) or Slack channel id",
            "minLength": 1,
            "title": "Id",
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/MentionType"
          }
        },
        "required": [
          "type",
          "id",
          "display"
        ],
        "title": "MentionItem",
        "type": "object"
      },
      "MentionType": {
        "enum": [
          "agent",
          "user",
          "slack_channel"
        ],
        "title": "MentionType",
        "type": "string"
      },
      "MergeCallbackRequest": {
        "properties": {
          "category": {
            "examples": [
              "hris"
            ],
            "title": "Category",
            "type": "string"
          },
          "public_token": {
            "title": "Public Token",
            "type": "string"
          }
        },
        "required": [
          "public_token",
          "category"
        ],
        "title": "MergeCallbackRequest",
        "type": "object"
      },
      "MergeCallbackResponse": {
        "properties": {
          "external_account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Account Id"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "provider"
        ],
        "title": "MergeCallbackResponse",
        "type": "object"
      },
      "MergeLinkTokenRequest": {
        "properties": {
          "category": {
            "examples": [
              "hris",
              "accounting",
              "crm"
            ],
            "title": "Category",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "organization_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Organization Name"
          }
        },
        "required": [
          "category"
        ],
        "title": "MergeLinkTokenRequest",
        "type": "object"
      },
      "MergeLinkTokenResponse": {
        "properties": {
          "integration": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Integration"
          },
          "link_token": {
            "title": "Link Token",
            "type": "string"
          }
        },
        "required": [
          "link_token"
        ],
        "title": "MergeLinkTokenResponse",
        "type": "object"
      },
      "MessageContentText": {
        "properties": {
          "text": {
            "title": "Text",
            "type": "object"
          },
          "type": {
            "const": "text",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "title": "MessageContentText",
        "type": "object"
      },
      "MessageCreateRequest": {
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "metadata": {
            "title": "Metadata",
            "type": "object"
          },
          "role": {
            "enum": [
              "user",
              "assistant"
            ],
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "title": "MessageCreateRequest",
        "type": "object"
      },
      "MessageFeedbackCreate": {
        "description": "Body for POST .../messages/{message_id}/feedback.",
        "properties": {
          "rating": {
            "enum": [
              -1,
              1
            ],
            "title": "Rating",
            "type": "integer"
          }
        },
        "required": [
          "rating"
        ],
        "title": "MessageFeedbackCreate",
        "type": "object"
      },
      "MessageFeedbackRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "message_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Message Id",
            "type": "string"
          },
          "rating": {
            "title": "Rating",
            "type": "integer"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "message_id",
          "session_id",
          "agent_id",
          "user_id",
          "rating",
          "created_at",
          "updated_at"
        ],
        "title": "MessageFeedbackRead",
        "type": "object"
      },
      "MessageList": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/MessageObject"
            },
            "title": "Data",
            "type": "array"
          },
          "first_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Id"
          },
          "has_more": {
            "default": false,
            "title": "Has More",
            "type": "boolean"
          },
          "last_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Id"
          },
          "object": {
            "const": "list",
            "title": "Object",
            "type": "string"
          }
        },
        "required": [
          "data"
        ],
        "title": "MessageList",
        "type": "object"
      },
      "MessageObject": {
        "properties": {
          "assistant_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assistant Id"
          },
          "content": {
            "items": {
              "$ref": "#/components/schemas/MessageContentText"
            },
            "title": "Content",
            "type": "array"
          },
          "created_at": {
            "title": "Created At",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "metadata": {
            "title": "Metadata",
            "type": "object"
          },
          "object": {
            "const": "thread.message",
            "title": "Object",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Run Id"
          },
          "thread_id": {
            "title": "Thread Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "thread_id",
          "role",
          "content"
        ],
        "title": "MessageObject",
        "type": "object"
      },
      "ModelConflictRead": {
        "properties": {
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          }
        },
        "required": [
          "model_id",
          "display_name"
        ],
        "title": "ModelConflictRead",
        "type": "object"
      },
      "ModelCreate": {
        "properties": {
          "config": {
            "title": "Config",
            "type": "object"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "kind": {
            "enum": [
              "local",
              "openrouter",
              "anthropic",
              "openai",
              "google",
              "mistral",
              "cohere",
              "custom_http",
              "bedrock",
              "ifm"
            ],
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "pricing": {
            "title": "Pricing",
            "type": "object"
          }
        },
        "required": [
          "name",
          "kind"
        ],
        "title": "ModelCreate",
        "type": "object"
      },
      "ModelCredentialRead": {
        "description": "Metadata for one model-provider BYOK slot. Never carries the key.",
        "properties": {
          "configured": {
            "title": "Configured",
            "type": "boolean"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "vendor": {
            "title": "Vendor",
            "type": "string"
          }
        },
        "required": [
          "vendor",
          "provider",
          "configured"
        ],
        "title": "ModelCredentialRead",
        "type": "object"
      },
      "ModelCredentialSet": {
        "description": "Body for setting / rotating a vendor's BYOK key.\n\nOnly ``api_key`` is accepted \u2014 the vendor comes from the path and the\ntenant from the path (Casbin-verified membership). Any other field a\ncaller smuggles in (``tenant_id``, ``provider``, ``is_super_admin``, \u2026)\nis ignored by construction (mass-assignment defense).",
        "properties": {
          "api_key": {
            "minLength": 1,
            "title": "Api Key",
            "type": "string"
          }
        },
        "required": [
          "api_key"
        ],
        "title": "ModelCredentialSet",
        "type": "object"
      },
      "ModelEndpointCreate": {
        "description": "Register a new self-hosted model endpoint.",
        "properties": {
          "api_key": {
            "anyOf": [
              {
                "maxLength": 512,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key"
          },
          "context_window": {
            "default": 4096,
            "minimum": 1.0,
            "title": "Context Window",
            "type": "integer"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "endpoint_url": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Endpoint Url",
            "type": "string"
          },
          "input_cost_per_1k": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Input Cost Per 1K",
            "type": "number"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "output_cost_per_1k": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Output Cost Per 1K",
            "type": "number"
          },
          "supports_streaming": {
            "default": false,
            "title": "Supports Streaming",
            "type": "boolean"
          },
          "supports_tools": {
            "default": false,
            "title": "Supports Tools",
            "type": "boolean"
          },
          "supports_vision": {
            "default": false,
            "title": "Supports Vision",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "endpoint_url"
        ],
        "title": "ModelEndpointCreate",
        "type": "object"
      },
      "ModelEndpointHealthResult": {
        "description": "Result of a health check against a self-hosted endpoint.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latency Ms"
          },
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          },
          "reachable": {
            "title": "Reachable",
            "type": "boolean"
          }
        },
        "required": [
          "model_id",
          "reachable"
        ],
        "title": "ModelEndpointHealthResult",
        "type": "object"
      },
      "ModelEndpointRead": {
        "description": "Response for a self-hosted model endpoint. ``api_key`` is never returned.",
        "properties": {
          "context_window": {
            "title": "Context Window",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "endpoint_url": {
            "title": "Endpoint Url",
            "type": "string"
          },
          "health_checked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Health Checked At"
          },
          "health_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Health Latency Ms"
          },
          "health_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Health Status"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "input_cost_per_1k": {
            "title": "Input Cost Per 1K",
            "type": "number"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "output_cost_per_1k": {
            "title": "Output Cost Per 1K",
            "type": "number"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "supports_streaming": {
            "title": "Supports Streaming",
            "type": "boolean"
          },
          "supports_tools": {
            "title": "Supports Tools",
            "type": "boolean"
          },
          "supports_vision": {
            "title": "Supports Vision",
            "type": "boolean"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "endpoint_url",
          "status",
          "input_cost_per_1k",
          "output_cost_per_1k",
          "context_window",
          "supports_tools",
          "supports_vision",
          "supports_streaming",
          "created_at",
          "updated_at"
        ],
        "title": "ModelEndpointRead",
        "type": "object"
      },
      "ModelEndpointUpdate": {
        "description": "Partial update of a self-hosted model endpoint.",
        "properties": {
          "api_key": {
            "anyOf": [
              {
                "maxLength": 512,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key"
          },
          "context_window": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context Window"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "endpoint_url": {
            "anyOf": [
              {
                "maxLength": 512,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Endpoint Url"
          },
          "input_cost_per_1k": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Input Cost Per 1K"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "output_cost_per_1k": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output Cost Per 1K"
          },
          "supports_streaming": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Supports Streaming"
          },
          "supports_tools": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Supports Tools"
          },
          "supports_vision": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Supports Vision"
          }
        },
        "title": "ModelEndpointUpdate",
        "type": "object"
      },
      "ModelRead": {
        "properties": {
          "available_to_all_tenants": {
            "default": false,
            "title": "Available To All Tenants",
            "type": "boolean"
          },
          "config": {
            "title": "Config",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "endpoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Endpoint"
          },
          "failover_chain": {
            "items": {
              "maxLength": 25,
              "minLength": 25,
              "pattern": "^c[a-z0-9]{24}$",
              "type": "string"
            },
            "title": "Failover Chain",
            "type": "array"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_free": {
            "title": "Is Free",
            "type": "boolean"
          },
          "is_system_default": {
            "default": false,
            "title": "Is System Default",
            "type": "boolean"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "owner_user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Owner User Id",
            "type": "string"
          },
          "owning_tenant_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owning Tenant Id"
          },
          "pricing": {
            "title": "Pricing",
            "type": "object"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "owner_user_id",
          "name",
          "description",
          "kind",
          "status",
          "is_free",
          "config",
          "pricing",
          "endpoint",
          "created_at",
          "updated_at"
        ],
        "title": "ModelRead",
        "type": "object"
      },
      "ModelUpdate": {
        "properties": {
          "config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "pricing": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pricing"
          },
          "status": {
            "anyOf": [
              {
                "enum": [
                  "active",
                  "disabled",
                  "experimental",
                  "deprecated"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          }
        },
        "title": "ModelUpdate",
        "type": "object"
      },
      "NewsBotProvisionResponse": {
        "description": "Result of :func:`provision_newsbot_route`.",
        "properties": {
          "agent_id": {
            "description": "The id of the tenant's NewsBot agent.",
            "title": "Agent Id",
            "type": "string"
          },
          "agent_slug": {
            "description": "Always ``newsbot`` (the fixed seed slug).",
            "title": "Agent Slug",
            "type": "string"
          },
          "is_new": {
            "description": "``True`` iff this call provisioned a brand-new agent. ``False`` on a re-click, when the tenant already had a NewsBot.",
            "title": "Is New",
            "type": "boolean"
          }
        },
        "required": [
          "agent_id",
          "agent_slug",
          "is_new"
        ],
        "title": "NewsBotProvisionResponse",
        "type": "object"
      },
      "NotificationListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/NotificationRead"
            },
            "title": "Items",
            "type": "array"
          },
          "unread_count": {
            "title": "Unread Count",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "unread_count"
        ],
        "title": "NotificationListResponse",
        "type": "object"
      },
      "NotificationRead": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "read_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Read At"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "kind",
          "title",
          "created_at"
        ],
        "title": "NotificationRead",
        "type": "object"
      },
      "NotificationsMarkedRead": {
        "properties": {
          "updated": {
            "title": "Updated",
            "type": "integer"
          }
        },
        "required": [
          "updated"
        ],
        "title": "NotificationsMarkedRead",
        "type": "object"
      },
      "PendingTenantInviteRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "invited_by_user_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invited By User Id"
          }
        },
        "required": [
          "id",
          "email",
          "invited_by_user_id",
          "created_at"
        ],
        "title": "PendingTenantInviteRead",
        "type": "object"
      },
      "PersonalWorkspaceCreate": {
        "description": "Body for the self-serve \"create your workspace\" path (#3648).\n\nDeliberately minimal: the **only** caller-supplied field is an optional\ndisplay ``name``. Everything else that ``TenantCreate`` exposes \u2014 ``slug``,\n``plan_code``, ``billing_email``, ``seed_profile`` \u2014 is server-forced, which\nis the mass-assignment defense (CLAUDE.md security-testing): the plan is\nalways ``FREE``, the seed profile is always ``default`` (Janet + Michael),\nthe owner is always the caller, and any smuggled ``plan_id`` /\n``is_super_admin`` / ``is_platform_operator`` / ``owner_*`` / ``tenant_id``\nfield is simply not on this model and cannot reach the service.\n\n``name`` is optional so a drive-by PLG signup can create a workspace with a\nsingle click; when omitted the server derives a friendly name + slug from\nthe caller's email.",
        "properties": {
          "name": {
            "anyOf": [
              {
                "maxLength": 255,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "title": "PersonalWorkspaceCreate",
        "type": "object"
      },
      "PlanChangeRequest": {
        "properties": {
          "plan_code": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Plan Code",
            "type": "string"
          }
        },
        "required": [
          "plan_code"
        ],
        "title": "PlanChangeRequest",
        "type": "object"
      },
      "PlanCharges": {
        "description": "What the tenant's plan charges this calendar month (GitLab #353).\n\nAn estimate of the month in progress from the effective plan terms\n(overrides applied) plus the ledger of metered usage already reported.\nRecurring lines are billed by the Stripe subscription; metered lines are\nreported once the month closes.",
        "properties": {
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "estimated_total_cents": {
            "title": "Estimated Total Cents",
            "type": "integer"
          },
          "has_subscription": {
            "title": "Has Subscription",
            "type": "boolean"
          },
          "ide_billable_minutes": {
            "title": "Ide Billable Minutes",
            "type": "integer"
          },
          "ide_cents": {
            "title": "Ide Cents",
            "type": "integer"
          },
          "ide_free_minutes": {
            "title": "Ide Free Minutes",
            "type": "integer"
          },
          "ide_overage_enabled": {
            "title": "Ide Overage Enabled",
            "type": "boolean"
          },
          "ide_price_cents_per_user_hour": {
            "title": "Ide Price Cents Per User Hour",
            "type": "integer"
          },
          "ide_used_minutes": {
            "title": "Ide Used Minutes",
            "type": "integer"
          },
          "plan_code": {
            "title": "Plan Code",
            "type": "string"
          },
          "platform_fee_cents": {
            "title": "Platform Fee Cents",
            "type": "integer"
          },
          "reported": {
            "items": {
              "$ref": "#/components/schemas/PlanUsageReportRead"
            },
            "title": "Reported",
            "type": "array"
          },
          "reseller_billed": {
            "default": false,
            "title": "Reseller Billed",
            "type": "boolean"
          },
          "resold_tenant_count": {
            "default": 0,
            "title": "Resold Tenant Count",
            "type": "integer"
          },
          "resold_token_cents": {
            "default": 0,
            "title": "Resold Token Cents",
            "type": "integer"
          },
          "seat_price_cents": {
            "title": "Seat Price Cents",
            "type": "integer"
          },
          "seats": {
            "title": "Seats",
            "type": "integer"
          },
          "seats_cents": {
            "title": "Seats Cents",
            "type": "integer"
          },
          "token_cents": {
            "title": "Token Cents",
            "type": "integer"
          },
          "window": {
            "$ref": "#/components/schemas/UsageWindow"
          }
        },
        "required": [
          "plan_code",
          "currency",
          "window",
          "has_subscription",
          "platform_fee_cents",
          "seats",
          "seat_price_cents",
          "seats_cents",
          "ide_used_minutes",
          "ide_free_minutes",
          "ide_billable_minutes",
          "ide_price_cents_per_user_hour",
          "ide_overage_enabled",
          "ide_cents",
          "token_cents",
          "estimated_total_cents",
          "reported"
        ],
        "title": "PlanCharges",
        "type": "object"
      },
      "PlanCreate": {
        "description": "SuperAdmin: new plan. Unsent terms take the column defaults.",
        "properties": {
          "allow_byo_models": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Byo Models"
          },
          "allowed_merge_categories": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "hris",
                    "ats",
                    "accounting",
                    "ticketing",
                    "crm",
                    "mktg",
                    "filestorage"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Merge Categories"
          },
          "apps": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "boolean"
                },
                "propertyNames": {
                  "enum": [
                    "atd",
                    "kahala",
                    "newsbot",
                    "zoom",
                    "ide"
                  ]
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Apps"
          },
          "budgets": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": {
                    "type": "number"
                  },
                  "type": "object"
                },
                "description": "{scope: {window: USD}} - scope is user|agent, window is hour|day|week|month. In an override, null removes the plan's figure.",
                "title": "Budgets",
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budgets"
          },
          "code": {
            "maxLength": 32,
            "minLength": 1,
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "title": "Code",
            "type": "string"
          },
          "display_name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Display Name",
            "type": "string"
          },
          "free_tier_model_kinds": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Free Tier Model Kinds"
          },
          "ide_free_minutes_per_month": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Free Minutes Per Month"
          },
          "ide_price_cents_per_user_hour": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Price Cents Per User Hour"
          },
          "is_public": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Public"
          },
          "max_agents": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Agents"
          },
          "max_concurrent_sessions": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Concurrent Sessions"
          },
          "max_connections_per_agent": {
            "anyOf": [
              {
                "maximum": 1000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Connections Per Agent"
          },
          "max_mailboxes_per_agent": {
            "anyOf": [
              {
                "maximum": 10000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Mailboxes Per Agent"
          },
          "max_messages_per_mailbox": {
            "anyOf": [
              {
                "maximum": 10000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Messages Per Mailbox"
          },
          "max_storage_gb": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Storage Gb"
          },
          "max_tasks_per_day": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tasks Per Day"
          },
          "paid_tier": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paid Tier"
          },
          "price_cents": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price Cents"
          },
          "seat_price_cents": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seat Price Cents"
          },
          "stripe_price_id": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Price Id"
          },
          "token_markup_bps": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Markup Bps"
          },
          "zero_cost_model_kinds": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Zero Cost Model Kinds"
          }
        },
        "required": [
          "display_name",
          "code"
        ],
        "title": "PlanCreate",
        "type": "object"
      },
      "PlanLimitExcessRead": {
        "description": "A limit this tenant's current usage exceeds on a plan (GitLab #353).\n\nOn a downgrade the change is still allowed; the ``over`` newest resources\nbecome read-only until capacity returns (``services/plan_capacity.py``).",
        "properties": {
          "current": {
            "title": "Current",
            "type": "integer"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "over": {
            "title": "Over",
            "type": "integer"
          },
          "resource": {
            "title": "Resource",
            "type": "string"
          },
          "term": {
            "title": "Term",
            "type": "string"
          }
        },
        "required": [
          "term",
          "resource",
          "limit",
          "current",
          "over"
        ],
        "title": "PlanLimitExcessRead",
        "type": "object"
      },
      "PlanOptions": {
        "description": "``GET /tenant/{t}/billing/plans`` \u2014 the self-serve plan picker.",
        "properties": {
          "current_plan_code": {
            "title": "Current Plan Code",
            "type": "string"
          },
          "has_subscription": {
            "title": "Has Subscription",
            "type": "boolean"
          },
          "plans": {
            "items": {
              "$ref": "#/components/schemas/PublicPlanRead"
            },
            "title": "Plans",
            "type": "array"
          }
        },
        "required": [
          "current_plan_code",
          "has_subscription",
          "plans"
        ],
        "title": "PlanOptions",
        "type": "object"
      },
      "PlanRead": {
        "properties": {
          "allow_byo_models": {
            "title": "Allow Byo Models",
            "type": "boolean"
          },
          "allowed_merge_categories": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Merge Categories"
          },
          "apps": {
            "title": "Apps",
            "type": "object"
          },
          "budgets": {
            "title": "Budgets",
            "type": "object"
          },
          "code": {
            "title": "Code",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "features": {
            "title": "Features",
            "type": "object"
          },
          "free_tier_model_kinds": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Free Tier Model Kinds",
            "type": "array"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "ide_free_minutes_per_month": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Free Minutes Per Month"
          },
          "ide_price_cents_per_user_hour": {
            "title": "Ide Price Cents Per User Hour",
            "type": "integer"
          },
          "is_public": {
            "title": "Is Public",
            "type": "boolean"
          },
          "is_super_admin": {
            "title": "Is Super Admin",
            "type": "boolean"
          },
          "max_agents": {
            "title": "Max Agents",
            "type": "integer"
          },
          "max_concurrent_sessions": {
            "title": "Max Concurrent Sessions",
            "type": "integer"
          },
          "max_connections_per_agent": {
            "title": "Max Connections Per Agent",
            "type": "integer"
          },
          "max_mailboxes_per_agent": {
            "title": "Max Mailboxes Per Agent",
            "type": "integer"
          },
          "max_messages_per_mailbox": {
            "title": "Max Messages Per Mailbox",
            "type": "integer"
          },
          "max_storage_gb": {
            "title": "Max Storage Gb",
            "type": "integer"
          },
          "max_tasks_per_day": {
            "title": "Max Tasks Per Day",
            "type": "integer"
          },
          "paid_tier": {
            "default": false,
            "title": "Paid Tier",
            "type": "boolean"
          },
          "price_cents": {
            "title": "Price Cents",
            "type": "integer"
          },
          "seat_price_cents": {
            "title": "Seat Price Cents",
            "type": "integer"
          },
          "stripe_price_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Price Id"
          },
          "tenant_count": {
            "default": 0,
            "title": "Tenant Count",
            "type": "integer"
          },
          "token_markup_bps": {
            "title": "Token Markup Bps",
            "type": "integer"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "zero_cost_model_kinds": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Zero Cost Model Kinds",
            "type": "array"
          }
        },
        "required": [
          "id",
          "code",
          "display_name",
          "is_super_admin",
          "is_public",
          "max_agents",
          "max_tasks_per_day",
          "max_concurrent_sessions",
          "max_storage_gb",
          "max_mailboxes_per_agent",
          "max_messages_per_mailbox",
          "max_connections_per_agent",
          "price_cents",
          "seat_price_cents",
          "token_markup_bps",
          "ide_price_cents_per_user_hour",
          "ide_free_minutes_per_month",
          "allow_byo_models",
          "allowed_merge_categories",
          "budgets",
          "apps",
          "stripe_price_id",
          "features",
          "created_at",
          "updated_at"
        ],
        "title": "PlanRead",
        "type": "object"
      },
      "PlanTermsPatch": {
        "description": "Every overridable term, all optional. ``extra=\"forbid\"`` so a smuggled\n``is_super_admin`` / ``code`` / ``tenant_id`` is a 422, never ignored.",
        "properties": {
          "allow_byo_models": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Byo Models"
          },
          "allowed_merge_categories": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "hris",
                    "ats",
                    "accounting",
                    "ticketing",
                    "crm",
                    "mktg",
                    "filestorage"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Merge Categories"
          },
          "apps": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "boolean"
                },
                "propertyNames": {
                  "enum": [
                    "atd",
                    "kahala",
                    "newsbot",
                    "zoom",
                    "ide"
                  ]
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Apps"
          },
          "budgets": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": {
                    "type": "number"
                  },
                  "type": "object"
                },
                "description": "{scope: {window: USD}} - scope is user|agent, window is hour|day|week|month. In an override, null removes the plan's figure.",
                "title": "Budgets",
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budgets"
          },
          "free_tier_model_kinds": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Free Tier Model Kinds"
          },
          "ide_free_minutes_per_month": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Free Minutes Per Month"
          },
          "ide_price_cents_per_user_hour": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Price Cents Per User Hour"
          },
          "max_agents": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Agents"
          },
          "max_concurrent_sessions": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Concurrent Sessions"
          },
          "max_connections_per_agent": {
            "anyOf": [
              {
                "maximum": 1000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Connections Per Agent"
          },
          "max_mailboxes_per_agent": {
            "anyOf": [
              {
                "maximum": 10000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Mailboxes Per Agent"
          },
          "max_messages_per_mailbox": {
            "anyOf": [
              {
                "maximum": 10000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Messages Per Mailbox"
          },
          "max_storage_gb": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Storage Gb"
          },
          "max_tasks_per_day": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tasks Per Day"
          },
          "paid_tier": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paid Tier"
          },
          "price_cents": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price Cents"
          },
          "seat_price_cents": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seat Price Cents"
          },
          "token_markup_bps": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Markup Bps"
          },
          "zero_cost_model_kinds": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Zero Cost Model Kinds"
          }
        },
        "title": "PlanTermsPatch",
        "type": "object"
      },
      "PlanUpdateRequest": {
        "description": "SuperAdmin plan edit (issue #353). Every term plus the catalogue fields.\n\n``code`` and ``is_super_admin`` are immutable (``extra=\"forbid\"`` makes\nsending them a 422): code-keyed defaults such as memory retention read the\ncode, and the operator plan is a singleton.",
        "properties": {
          "allow_byo_models": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Byo Models"
          },
          "allowed_merge_categories": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "hris",
                    "ats",
                    "accounting",
                    "ticketing",
                    "crm",
                    "mktg",
                    "filestorage"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Merge Categories"
          },
          "apps": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "boolean"
                },
                "propertyNames": {
                  "enum": [
                    "atd",
                    "kahala",
                    "newsbot",
                    "zoom",
                    "ide"
                  ]
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Apps"
          },
          "budgets": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": {
                    "type": "number"
                  },
                  "type": "object"
                },
                "description": "{scope: {window: USD}} - scope is user|agent, window is hour|day|week|month. In an override, null removes the plan's figure.",
                "title": "Budgets",
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budgets"
          },
          "display_name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "free_tier_model_kinds": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Free Tier Model Kinds"
          },
          "ide_free_minutes_per_month": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Free Minutes Per Month"
          },
          "ide_price_cents_per_user_hour": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ide Price Cents Per User Hour"
          },
          "is_public": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Public"
          },
          "max_agents": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Agents"
          },
          "max_concurrent_sessions": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Concurrent Sessions"
          },
          "max_connections_per_agent": {
            "anyOf": [
              {
                "maximum": 1000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Connections Per Agent"
          },
          "max_mailboxes_per_agent": {
            "anyOf": [
              {
                "maximum": 10000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Mailboxes Per Agent"
          },
          "max_messages_per_mailbox": {
            "anyOf": [
              {
                "maximum": 10000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Messages Per Mailbox"
          },
          "max_storage_gb": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Storage Gb"
          },
          "max_tasks_per_day": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tasks Per Day"
          },
          "paid_tier": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paid Tier"
          },
          "price_cents": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price Cents"
          },
          "seat_price_cents": {
            "anyOf": [
              {
                "maximum": 100000000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seat Price Cents"
          },
          "stripe_price_id": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Price Id"
          },
          "token_markup_bps": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Markup Bps"
          },
          "zero_cost_model_kinds": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Zero Cost Model Kinds"
          }
        },
        "title": "PlanUpdateRequest",
        "type": "object"
      },
      "PlanUsageReportRead": {
        "description": "One metered-usage invoice item reported to Stripe (the ledger, #353).",
        "properties": {
          "amount_cents": {
            "title": "Amount Cents",
            "type": "integer"
          },
          "confirmed": {
            "title": "Confirmed",
            "type": "boolean"
          },
          "period_start": {
            "format": "date-time",
            "title": "Period Start",
            "type": "string"
          },
          "quantity": {
            "title": "Quantity",
            "type": "integer"
          },
          "seq": {
            "title": "Seq",
            "type": "integer"
          },
          "term": {
            "title": "Term",
            "type": "string"
          }
        },
        "required": [
          "term",
          "period_start",
          "seq",
          "quantity",
          "amount_cents",
          "confirmed"
        ],
        "title": "PlanUsageReportRead",
        "type": "object"
      },
      "PlatformBrandFaviconUploaded": {
        "properties": {
          "favicon_content_type": {
            "title": "Favicon Content Type",
            "type": "string"
          },
          "favicon_sha256": {
            "title": "Favicon Sha256",
            "type": "string"
          },
          "favicon_size_bytes": {
            "title": "Favicon Size Bytes",
            "type": "integer"
          }
        },
        "required": [
          "favicon_sha256",
          "favicon_content_type",
          "favicon_size_bytes"
        ],
        "title": "PlatformBrandFaviconUploaded",
        "type": "object"
      },
      "PlatformBrandRead": {
        "properties": {
          "favicon_content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favicon Content Type"
          },
          "favicon_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favicon Sha256"
          },
          "favicon_size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favicon Size Bytes"
          },
          "has_favicon": {
            "title": "Has Favicon",
            "type": "boolean"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "required": [
          "has_favicon"
        ],
        "title": "PlatformBrandRead",
        "type": "object"
      },
      "PlatformSecretRevealRead": {
        "properties": {
          "last_rotated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Rotated At"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "value",
          "last_rotated_at"
        ],
        "title": "PlatformSecretRevealRead",
        "type": "object"
      },
      "PlatformSecretRow": {
        "properties": {
          "is_set": {
            "title": "Is Set",
            "type": "boolean"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "last_rotated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Rotated At"
          },
          "masked": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Masked"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "rotated_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rotated By User Id"
          }
        },
        "required": [
          "provider",
          "label",
          "is_set",
          "last_rotated_at",
          "rotated_by_user_id",
          "masked"
        ],
        "title": "PlatformSecretRow",
        "type": "object"
      },
      "PlatformSecretSetRequest": {
        "description": "Body for PUT /admin/platform-secrets/{provider}.\n\n``label`` is required when creating a new provider; it's optional when\nrotating the value of an existing one (omit to keep the existing label).",
        "properties": {
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "value": {
            "title": "Value",
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "title": "PlatformSecretSetRequest",
        "type": "object"
      },
      "PolicyCreate": {
        "properties": {
          "act": {
            "title": "Act",
            "type": "string"
          },
          "eft": {
            "enum": [
              "allow",
              "deny"
            ],
            "title": "Eft",
            "type": "string"
          },
          "obj": {
            "title": "Obj",
            "type": "string"
          },
          "sub": {
            "title": "Sub",
            "type": "string"
          }
        },
        "required": [
          "sub",
          "obj",
          "act"
        ],
        "title": "PolicyCreate",
        "type": "object"
      },
      "PolicyRead": {
        "properties": {
          "act": {
            "title": "Act",
            "type": "string"
          },
          "dom": {
            "title": "Dom",
            "type": "string"
          },
          "eft": {
            "title": "Eft",
            "type": "string"
          },
          "obj": {
            "title": "Obj",
            "type": "string"
          },
          "sub": {
            "title": "Sub",
            "type": "string"
          }
        },
        "required": [
          "sub",
          "dom",
          "obj",
          "act",
          "eft"
        ],
        "title": "PolicyRead",
        "type": "object"
      },
      "PreferenceSuggestions": {
        "description": "Server-sourced suggestions for the NewsBot4 ``/preferences`` typeaheads.\n\nThese are *suggestions*, not identifiers \u2014 the front-end always accepts\nfree-form entry for the long tail \u2014 but per ``docs/content/ui.md`` the\nenumerable half is server-owned rather than a catalogue hard-coded in the\nfront-end (issue #3623). ``sources`` is the curated outlet list unioned with\nthe human names of the live source credentials the caller may use \u2014 never a\nsecret.",
        "properties": {
          "sources": {
            "items": {
              "type": "string"
            },
            "title": "Sources",
            "type": "array"
          },
          "topics": {
            "items": {
              "type": "string"
            },
            "title": "Topics",
            "type": "array"
          }
        },
        "required": [
          "topics",
          "sources"
        ],
        "title": "PreferenceSuggestions",
        "type": "object"
      },
      "ProjectRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "slug",
          "created_at",
          "updated_at"
        ],
        "title": "ProjectRead",
        "type": "object"
      },
      "PromptEmbeddingSettingsRead": {
        "description": "Response for GET /tenants/{id}/prompt-embedding.",
        "properties": {
          "opt_out": {
            "description": "When true, this tenant's prompts are not embedded for analytics or clustering. Default false \u2014 prompts are embedded locally (never sent to an outside vendor).",
            "title": "Opt Out",
            "type": "boolean"
          }
        },
        "required": [
          "opt_out"
        ],
        "title": "PromptEmbeddingSettingsRead",
        "type": "object"
      },
      "PromptEmbeddingSettingsUpdate": {
        "description": "Body for PUT /tenants/{id}/prompt-embedding.\n\nSetting ``opt_out`` to ``True`` also purges the tenant's existing\n``prompt_embedding`` rows; setting it back to ``False`` only re-enables\nembedding going forward (the backfill loop refills over time).",
        "properties": {
          "opt_out": {
            "description": "True to opt this tenant out of prompt embedding; false to opt back in.",
            "title": "Opt Out",
            "type": "boolean"
          }
        },
        "required": [
          "opt_out"
        ],
        "title": "PromptEmbeddingSettingsUpdate",
        "type": "object"
      },
      "ProxyGuardrailConfigRead": {
        "description": "Response schema for GET /agents/{id}/proxy-config.\n\nReturns the per-agent guardrail model overrides, egress allowlist, and\nbuilt-in detector toggles.  A ``None`` value means the override is not\nset and the global default applies \u2014 the proxy falls back to its\nhardcoded defaults for Prompt Guard / Llama Guard, and to the broker's\n``system:embedding`` sentinel for the embedding model.",
        "properties": {
          "built_in": {
            "$ref": "#/components/schemas/BuiltInDetectorConfigRead"
          },
          "egress_allowlist": {
            "items": {
              "type": "string"
            },
            "title": "Egress Allowlist",
            "type": "array"
          },
          "embedding_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embedding Model"
          },
          "llama_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llama Guard Model"
          },
          "prompt_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Guard Model"
          }
        },
        "title": "ProxyGuardrailConfigRead",
        "type": "object"
      },
      "ProxyGuardrailConfigUpdate": {
        "description": "Partial-update body for PUT /agents/{id}/proxy-config.\n\nFields are written only when present in the request body\n(``model_fields_set``).  Sending a field as ``null`` clears the override\nand falls back to the global default; omitting a field leaves the existing\nvalue untouched.  The service writes the value as-is into JSONB without\nmodel-ID validation; the proxy rejects unresolvable IDs at inference time.\n\n**Embedding-model dimension lock.**  Setting ``embedding_model`` to a\nvariant whose dimension differs from the agent's current vector indexes\n(Valkey memory + pgvector tool/skill routing) will silently break\nnearest-neighbour retrieval after the next embed call.  Until per-agent\nshadow-index migration lands, the picker enumeration is restricted to\nsame-dimension (1536) variants and any free-form override outside that\nfamily is operator-at-own-risk \u2014 see ``docs/content/guardrails.md``.",
        "properties": {
          "egress_allowlist": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Egress Allowlist"
          },
          "embedding_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embedding Model"
          },
          "llama_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llama Guard Model"
          },
          "max_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Bytes"
          },
          "pii_scrub": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pii Scrub"
          },
          "prompt_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Guard Model"
          },
          "secret_scrub": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secret Scrub"
          }
        },
        "title": "ProxyGuardrailConfigUpdate",
        "type": "object"
      },
      "PublicPlanRead": {
        "description": "A plan a tenant may choose for itself (``plan.is_public``) \u2014 GitLab #353.\n\nPrices are what *this* tenant would pay on it: the plan's terms with the\ntenant's SuperAdmin overrides applied.",
        "properties": {
          "code": {
            "title": "Code",
            "type": "string"
          },
          "current": {
            "default": false,
            "title": "Current",
            "type": "boolean"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "exceeds": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/PlanLimitExcessRead"
            },
            "title": "Exceeds",
            "type": "array"
          },
          "ide_price_cents_per_user_hour": {
            "title": "Ide Price Cents Per User Hour",
            "type": "integer"
          },
          "price_cents": {
            "title": "Price Cents",
            "type": "integer"
          },
          "seat_price_cents": {
            "title": "Seat Price Cents",
            "type": "integer"
          },
          "token_markup_bps": {
            "title": "Token Markup Bps",
            "type": "integer"
          }
        },
        "required": [
          "code",
          "display_name",
          "price_cents",
          "seat_price_cents",
          "token_markup_bps",
          "ide_price_cents_per_user_hour"
        ],
        "title": "PublicPlanRead",
        "type": "object"
      },
      "RBACCheckRequest": {
        "properties": {
          "action": {
            "title": "Action",
            "type": "string"
          },
          "agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "action"
        ],
        "title": "RBACCheckRequest",
        "type": "object"
      },
      "RBACCheckResponse": {
        "properties": {
          "allowed": {
            "title": "Allowed",
            "type": "boolean"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "allowed",
          "reason"
        ],
        "title": "RBACCheckResponse",
        "type": "object"
      },
      "ReaderTenantCreate": {
        "description": "Body of ``POST /reseller/readers`` (GitLab #594).\n\nOnly the reader's **asserted** Keycloak identity \u2014 the same trust posture\n``tenants/ensure`` (DRL) and ``tenants/import`` (atd) take: NewsBot4 has\nalready verified the reader's token and forwards the claims.\n\nThere is deliberately **no** ``plan_code`` / ``seed_profile`` / ``tenant_id``\n/ ``billed_to_tenant_id`` / ``reseller_tenant_id`` / ``owner_*`` /\n``is_super_admin`` field. Those are the mass-assignment guard: the plan, the\n``newsbot`` seed profile and the billed-to reseller are all server-forced\n(``newsbot_reader_provision`` \u2192 ``reseller_billing``), and the reseller is\nresolved from the per-environment setting, never from the body \u2014 so there is\nno cross-reseller surface. ``extra=\"forbid\"`` rejects any smuggled key\noutright (422) rather than silently dropping it.",
        "properties": {
          "email": {
            "minLength": 1,
            "title": "Email",
            "type": "string"
          },
          "email_verified": {
            "default": false,
            "title": "Email Verified",
            "type": "boolean"
          },
          "kc_subject": {
            "minLength": 1,
            "title": "Kc Subject",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "required": [
          "kc_subject",
          "email"
        ],
        "title": "ReaderTenantCreate",
        "type": "object"
      },
      "ReaderTenantRead": {
        "properties": {
          "created": {
            "title": "Created",
            "type": "boolean"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "created"
        ],
        "title": "ReaderTenantRead",
        "type": "object"
      },
      "ReaderTierRead": {
        "properties": {
          "paid": {
            "title": "Paid",
            "type": "boolean"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          },
          "tier": {
            "enum": [
              "free",
              "pro"
            ],
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "tier",
          "paid"
        ],
        "title": "ReaderTierRead",
        "type": "object"
      },
      "ReaderTierUpdate": {
        "description": "Body of ``PUT /reseller/tenants/{tenant_id}/tier``. Only the tier.",
        "properties": {
          "tier": {
            "enum": [
              "free",
              "pro"
            ],
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "tier"
        ],
        "title": "ReaderTierUpdate",
        "type": "object"
      },
      "ReassignAgentTenantRequest": {
        "properties": {
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id"
        ],
        "title": "ReassignAgentTenantRequest",
        "type": "object"
      },
      "ReassignAgentTenantResponse": {
        "description": "Response from ``PUT /admin/agents/{agent_id}/tenant``.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "integration_warnings": {
            "items": {
              "type": "string"
            },
            "title": "Integration Warnings",
            "type": "array"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "is_seed": {
            "title": "Is Seed",
            "type": "boolean"
          },
          "model_conflicts": {
            "items": {
              "$ref": "#/components/schemas/ModelConflictRead"
            },
            "title": "Model Conflicts",
            "type": "array"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "slug",
          "is_active",
          "is_seed",
          "created_at",
          "updated_at",
          "model_conflicts",
          "integration_warnings"
        ],
        "title": "ReassignAgentTenantResponse",
        "type": "object"
      },
      "ReorderItem": {
        "properties": {
          "display_order": {
            "minimum": 0.0,
            "title": "Display Order",
            "type": "integer"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "display_order"
        ],
        "title": "ReorderItem",
        "type": "object"
      },
      "ReorderRequest": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ReorderItem"
            },
            "minItems": 1,
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "ReorderRequest",
        "type": "object"
      },
      "RepoRevision": {
        "description": "One ``agent/self-edit-<session>`` branch surfaced as a pending revision.",
        "properties": {
          "author": {
            "title": "Author",
            "type": "string"
          },
          "branch": {
            "title": "Branch",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "mr_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mr Url"
          },
          "sha": {
            "title": "Sha",
            "type": "string"
          }
        },
        "required": [
          "branch",
          "sha",
          "author",
          "created_at"
        ],
        "title": "RepoRevision",
        "type": "object"
      },
      "ResoldTenantUsage": {
        "description": "One reseller-billed tenant's model usage for the period.\n\nBYOK calls are excluded from every figure (the platform never bills them;\nwholesale plans disallow BYO models anyway).",
        "properties": {
          "billed_cents": {
            "title": "Billed Cents",
            "type": "integer"
          },
          "billed_micro_usd": {
            "title": "Billed Micro Usd",
            "type": "integer"
          },
          "calls": {
            "title": "Calls",
            "type": "integer"
          },
          "provider_cost_cents": {
            "title": "Provider Cost Cents",
            "type": "integer"
          },
          "provider_cost_micro_usd": {
            "title": "Provider Cost Micro Usd",
            "type": "integer"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "slug",
          "calls",
          "provider_cost_micro_usd",
          "provider_cost_cents",
          "billed_micro_usd",
          "billed_cents"
        ],
        "title": "ResoldTenantUsage",
        "type": "object"
      },
      "ResoldUsage": {
        "properties": {
          "billed_cents": {
            "title": "Billed Cents",
            "type": "integer"
          },
          "billed_micro_usd": {
            "title": "Billed Micro Usd",
            "type": "integer"
          },
          "calls": {
            "title": "Calls",
            "type": "integer"
          },
          "closed": {
            "title": "Closed",
            "type": "boolean"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "period": {
            "title": "Period",
            "type": "string"
          },
          "period_end": {
            "format": "date-time",
            "title": "Period End",
            "type": "string"
          },
          "period_start": {
            "format": "date-time",
            "title": "Period Start",
            "type": "string"
          },
          "provider_cost_cents": {
            "title": "Provider Cost Cents",
            "type": "integer"
          },
          "provider_cost_micro_usd": {
            "title": "Provider Cost Micro Usd",
            "type": "integer"
          },
          "reseller_tenant_id": {
            "title": "Reseller Tenant Id",
            "type": "string"
          },
          "tenant_count": {
            "title": "Tenant Count",
            "type": "integer"
          },
          "tenants": {
            "items": {
              "$ref": "#/components/schemas/ResoldTenantUsage"
            },
            "title": "Tenants",
            "type": "array"
          }
        },
        "required": [
          "reseller_tenant_id",
          "period",
          "period_start",
          "period_end",
          "closed",
          "currency",
          "tenant_count",
          "calls",
          "provider_cost_micro_usd",
          "provider_cost_cents",
          "billed_micro_usd",
          "billed_cents",
          "tenants"
        ],
        "title": "ResoldUsage",
        "type": "object"
      },
      "RunCreateRequest": {
        "properties": {
          "additional_instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Additional Instructions"
          },
          "additional_messages": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/MessageCreateRequest"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Additional Messages"
          },
          "assistant_id": {
            "title": "Assistant Id",
            "type": "string"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instructions"
          },
          "metadata": {
            "title": "Metadata",
            "type": "object"
          },
          "stream": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stream"
          }
        },
        "required": [
          "assistant_id"
        ],
        "title": "RunCreateRequest",
        "type": "object"
      },
      "RunObject": {
        "properties": {
          "assistant_id": {
            "title": "Assistant Id",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instructions"
          },
          "metadata": {
            "title": "Metadata",
            "type": "object"
          },
          "model": {
            "default": "good-place-agent",
            "title": "Model",
            "type": "string"
          },
          "object": {
            "const": "thread.run",
            "title": "Object",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "thread_id": {
            "title": "Thread Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "thread_id",
          "assistant_id",
          "status"
        ],
        "title": "RunObject",
        "type": "object"
      },
      "SSOConfigRead": {
        "description": "SSO configuration surface for the tenant Organization > Security page.",
        "properties": {
          "active": {
            "title": "Active",
            "type": "boolean"
          },
          "identity_providers": {
            "items": {
              "$ref": "#/components/schemas/SSOIdentityProviderSummary"
            },
            "title": "Identity Providers",
            "type": "array"
          },
          "issuer_url": {
            "title": "Issuer Url",
            "type": "string"
          },
          "realm": {
            "title": "Realm",
            "type": "string"
          }
        },
        "required": [
          "active",
          "realm",
          "issuer_url",
          "identity_providers"
        ],
        "title": "SSOConfigRead",
        "type": "object"
      },
      "SSOIdentityProviderSummary": {
        "description": "Minimal IdP projection for the SSO config overview.",
        "properties": {
          "alias": {
            "title": "Alias",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "provider_id": {
            "title": "Provider Id",
            "type": "string"
          }
        },
        "required": [
          "alias",
          "display_name",
          "provider_id",
          "enabled"
        ],
        "title": "SSOIdentityProviderSummary",
        "type": "object"
      },
      "SampleUseCaseCreate": {
        "properties": {
          "category": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Category",
            "type": "string"
          },
          "description": {
            "maxLength": 5000,
            "minLength": 1,
            "title": "Description",
            "type": "string"
          },
          "title": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "title",
          "description",
          "category"
        ],
        "title": "SampleUseCaseCreate",
        "type": "object"
      },
      "SampleUseCaseIconUploaded": {
        "properties": {
          "icon_content_type": {
            "title": "Icon Content Type",
            "type": "string"
          },
          "icon_sha256": {
            "title": "Icon Sha256",
            "type": "string"
          },
          "icon_size_bytes": {
            "title": "Icon Size Bytes",
            "type": "integer"
          }
        },
        "required": [
          "icon_sha256",
          "icon_content_type",
          "icon_size_bytes"
        ],
        "title": "SampleUseCaseIconUploaded",
        "type": "object"
      },
      "SampleUseCaseRead": {
        "properties": {
          "category": {
            "title": "Category",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "display_order": {
            "title": "Display Order",
            "type": "integer"
          },
          "has_icon": {
            "title": "Has Icon",
            "type": "boolean"
          },
          "icon_content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon Content Type"
          },
          "icon_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon Sha256"
          },
          "icon_size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon Size Bytes"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "description",
          "category",
          "has_icon",
          "icon_content_type",
          "icon_sha256",
          "icon_size_bytes",
          "display_order",
          "is_active",
          "created_by",
          "created_at",
          "updated_at"
        ],
        "title": "SampleUseCaseRead",
        "type": "object"
      },
      "SampleUseCaseUpdate": {
        "properties": {
          "category": {
            "anyOf": [
              {
                "maxLength": 200,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 5000,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "display_order": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Order"
          },
          "is_active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Active"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 500,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "title": "SampleUseCaseUpdate",
        "type": "object"
      },
      "SelfEditBranchRead": {
        "description": "One row in the agent code-tab \"self-edit branches\" table.\n\n``mr_url`` is ``None`` when the SDK has pushed the branch but no merge\nrequest has been opened yet. The front-end renders the \"review MR\" link\nonly when the field is present.",
        "properties": {
          "author": {
            "title": "Author",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "mr_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mr Url"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "sha": {
            "title": "Sha",
            "type": "string"
          }
        },
        "required": [
          "name",
          "sha",
          "author",
          "created_at"
        ],
        "title": "SelfEditBranchRead",
        "type": "object"
      },
      "ServiceStatusRead": {
        "properties": {
          "bars": {
            "items": {
              "enum": [
                "green",
                "yellow",
                "red",
                "gray"
              ],
              "type": "string"
            },
            "title": "Bars",
            "type": "array"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "kind": {
            "enum": [
              "internal",
              "connector"
            ],
            "title": "Kind",
            "type": "string"
          },
          "service_key": {
            "title": "Service Key",
            "type": "string"
          }
        },
        "required": [
          "service_key",
          "display_name",
          "kind",
          "bars"
        ],
        "title": "ServiceStatusRead",
        "type": "object"
      },
      "SessionAttachmentRead": {
        "description": "Response for a successfully uploaded session attachment.\n\n``kind`` is constrained to the values of the ``AttachmentKind`` ORM enum so\nthe OpenAPI snapshot (which feeds the mobile Dart client) carries the\nallowed values rather than a free-form string.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "content_type": {
            "title": "Content Type",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "gcs_path": {
            "title": "Gcs Path",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "enum": [
              "image",
              "document"
            ],
            "title": "Kind",
            "type": "string"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "sha256": {
            "title": "Sha256",
            "type": "string"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "session_id",
          "tenant_id",
          "agent_id",
          "filename",
          "content_type",
          "size_bytes",
          "sha256",
          "gcs_path",
          "kind",
          "created_at"
        ],
        "title": "SessionAttachmentRead",
        "type": "object"
      },
      "SessionBriefRequest": {
        "description": "Body for ``POST /tenant/{t}/agent/{a}/sessions/{s}/brief`` (GitLab #531).\n\nStarts a *new* session seeded with a broker-generated brief of the source\nsession \u2014 the manual alternative to automatic compaction\n(docs/content/context-compaction.md). ``archive_source`` (default True)\ncontrols whether the source session transitions to ``archived_for_brief``\nonce the brief session exists; its transcript is never modified either way\n(decision #37).\n\nEvery other field a client might smuggle \u2014 ``parent_session_id``,\n``created_by_id``, ``status``, ``tenant_id``, ``read_only``,\n``is_super_admin`` \u2014 is ignored (pydantic drops unknown keys). The new\nsession's linkage, ownership, tenancy, and read-only flag are all resolved\nserver-side from the source session and the authenticated caller, never\nfrom this body (mass-assignment defence).",
        "properties": {
          "archive_source": {
            "default": true,
            "title": "Archive Source",
            "type": "boolean"
          }
        },
        "title": "SessionBriefRequest",
        "type": "object"
      },
      "SessionCancelRequest": {
        "description": "Optional body for `POST .../sessions/{session_id}/cancel` (#3124).\n\n``cascade=True`` is the opt-in \"stop this + its background tasks\" choice:\nafter the parent is cancelled, every still-active descendant subtask is\ncancelled too. Default ``False`` preserves the fire-and-forget contract \u2014\nan omitted body behaves exactly as before this field existed.",
        "properties": {
          "cascade": {
            "default": false,
            "title": "Cascade",
            "type": "boolean"
          }
        },
        "title": "SessionCancelRequest",
        "type": "object"
      },
      "SessionParticipant": {
        "description": "One human present in a session (session owner or a message author).",
        "properties": {
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id"
        ],
        "title": "SessionParticipant",
        "type": "object"
      },
      "SessionParticipantsOut": {
        "description": "The distinct humans present in a session, owner first.\n\nDerived from who has *participated* \u2014 the session creator plus every\ndistinct human-turn author (issue #605's ``task_message.author_user_id``).\nThis is \"participants who have posted\", not live view-presence; true\njoin/leave tracking would need a net-new SSE presence signal (deferred).",
        "properties": {
          "participants": {
            "items": {
              "$ref": "#/components/schemas/SessionParticipant"
            },
            "title": "Participants",
            "type": "array"
          }
        },
        "required": [
          "participants"
        ],
        "title": "SessionParticipantsOut",
        "type": "object"
      },
      "SessionTitleUpdate": {
        "description": "Body for ``PATCH /tenant/{t}/agent/{a}/sessions/{s}``.\n\nLets a user rename the current session from the chat header. The auto-namer\n(``services.session_naming``) still runs on every 5th user message and will\noverwrite a stale title, but a user-supplied title takes effect immediately\nand survives until the next auto-rename boundary.",
        "properties": {
          "title": {
            "maxLength": 255,
            "minLength": 1,
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "title"
        ],
        "title": "SessionTitleUpdate",
        "type": "object"
      },
      "SettleRequest": {
        "description": "Settle one lane of a session's retained output.\n\n``lane`` and ``action`` are the whole decision; there is no per-file\nselection (\"whole-output, path-disjoint or refused, never content\nsynthesis\", issue #10). Mass-assignment guard: no ``tenant_id`` /\n``session_id`` / ``settled_by_id`` here \u2014 all resolved server-side.",
        "properties": {
          "action": {
            "enum": [
              "select",
              "apply",
              "discard"
            ],
            "title": "Action",
            "type": "string"
          },
          "lane": {
            "enum": [
              "workspace",
              "repo"
            ],
            "title": "Lane",
            "type": "string"
          }
        },
        "required": [
          "lane",
          "action"
        ],
        "title": "SettleRequest",
        "type": "object"
      },
      "SettleResult": {
        "properties": {
          "file_count": {
            "title": "File Count",
            "type": "integer"
          },
          "lane": {
            "enum": [
              "workspace",
              "repo"
            ],
            "title": "Lane",
            "type": "string"
          },
          "mr_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "For a repo-lane `select`, the merged self-edit MR url",
            "title": "Mr Url"
          },
          "outcome": {
            "enum": [
              "select",
              "apply",
              "discard"
            ],
            "title": "Outcome",
            "type": "string"
          },
          "settlement_id": {
            "title": "Settlement Id",
            "type": "string"
          }
        },
        "required": [
          "lane",
          "outcome",
          "file_count",
          "settlement_id"
        ],
        "title": "SettleResult",
        "type": "object"
      },
      "SettlementStatus": {
        "description": "Whether a lane has already been settled (consume-once, decision #49).",
        "properties": {
          "lane": {
            "enum": [
              "workspace",
              "repo"
            ],
            "title": "Lane",
            "type": "string"
          },
          "outcome": {
            "anyOf": [
              {
                "enum": [
                  "select",
                  "apply",
                  "discard"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Outcome"
          },
          "settled": {
            "title": "Settled",
            "type": "boolean"
          },
          "settled_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Settled At"
          }
        },
        "required": [
          "lane",
          "settled"
        ],
        "title": "SettlementStatus",
        "type": "object"
      },
      "SiemConfigRead": {
        "description": "Response schema for GET /settings/siem.",
        "properties": {
          "custom_redaction_patterns": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/CustomRedactionPattern"
            },
            "title": "Custom Redaction Patterns",
            "type": "array"
          },
          "destinations": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/SiemDestinationRead"
            },
            "title": "Destinations",
            "type": "array"
          }
        },
        "title": "SiemConfigRead",
        "type": "object"
      },
      "SiemConfigUpdate": {
        "description": "Request schema for PUT /settings/siem.",
        "properties": {
          "custom_redaction_patterns": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/CustomRedactionPattern"
            },
            "title": "Custom Redaction Patterns",
            "type": "array"
          },
          "destinations": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/SiemDestination"
            },
            "title": "Destinations",
            "type": "array"
          }
        },
        "title": "SiemConfigUpdate",
        "type": "object"
      },
      "SiemDestination": {
        "description": "A single SIEM forwarding destination.",
        "properties": {
          "destination_type": {
            "$ref": "#/components/schemas/SiemDestinationType"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "endpoint_url": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Endpoint Url",
            "type": "string"
          },
          "token": {
            "anyOf": [
              {
                "maxLength": 4096,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token"
          }
        },
        "required": [
          "destination_type",
          "endpoint_url"
        ],
        "title": "SiemDestination",
        "type": "object"
      },
      "SiemDestinationRead": {
        "description": "Read-only view of a SIEM destination (token masked).",
        "properties": {
          "destination_type": {
            "$ref": "#/components/schemas/SiemDestinationType"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "endpoint_url": {
            "title": "Endpoint Url",
            "type": "string"
          },
          "has_token": {
            "title": "Has Token",
            "type": "boolean"
          }
        },
        "required": [
          "destination_type",
          "enabled",
          "endpoint_url",
          "has_token"
        ],
        "title": "SiemDestinationRead",
        "type": "object"
      },
      "SiemDestinationType": {
        "description": "Supported SIEM destination types.",
        "enum": [
          "splunk_hec",
          "datadog",
          "syslog",
          "webhook"
        ],
        "title": "SiemDestinationType",
        "type": "string"
      },
      "SkillAdminRead": {
        "description": "Extended skill view for tenant admins \u2014 includes derived fields.",
        "properties": {
          "agent_count": {
            "title": "Agent Count",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "entrypoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entrypoint"
          },
          "forked_from_skill_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Forked From Skill Id"
          },
          "forked_from_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Forked From Version"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "instruction_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instruction Content"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "network_enabled": {
            "title": "Network Enabled",
            "type": "boolean"
          },
          "owner_agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Agent Id"
          },
          "owner_agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Agent Name"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "review_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Status"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewer_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Id"
          },
          "skill_type": {
            "title": "Skill Type",
            "type": "string"
          },
          "source_repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Repo Url"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "tier": {
            "enum": [
              "agent",
              "tenant",
              "platform"
            ],
            "title": "Tier",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          },
          "visibility": {
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "owner_agent_id",
          "name",
          "description",
          "summary",
          "skill_type",
          "source_repo_url",
          "entrypoint",
          "instruction_content",
          "version",
          "visibility",
          "tier",
          "status",
          "review_status",
          "reviewer_id",
          "reviewed_at",
          "review_notes",
          "network_enabled",
          "tags",
          "created_at",
          "owner_agent_name",
          "agent_count"
        ],
        "title": "SkillAdminRead",
        "type": "object"
      },
      "SkillAgentRead": {
        "description": "Lightweight agent summary for the per-skill agents list.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "is_enabled": {
            "title": "Is Enabled",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "name",
          "is_enabled"
        ],
        "title": "SkillAgentRead",
        "type": "object"
      },
      "SkillCreate": {
        "properties": {
          "description": {
            "minLength": 1,
            "title": "Description",
            "type": "string"
          },
          "entrypoint": {
            "default": "skill:run",
            "title": "Entrypoint",
            "type": "string"
          },
          "instruction_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instruction Content"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "network_enabled": {
            "default": false,
            "title": "Network Enabled",
            "type": "boolean"
          },
          "owner_agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Owner Agent Id",
            "type": "string"
          },
          "skill_type": {
            "enum": [
              "executable",
              "text"
            ],
            "title": "Skill Type",
            "type": "string"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "visibility": {
            "enum": [
              "public",
              "private"
            ],
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "name",
          "description",
          "owner_agent_id"
        ],
        "title": "SkillCreate",
        "type": "object"
      },
      "SkillCredentialCreate": {
        "description": "Body for ``PUT /\u2026/skill-credentials/skill/{skill_id}`` \u2014 upsert on a triple.\n\nThe plaintext ``payload`` is encrypted immediately via the per-tenant\nFernet key and never written to the database in clear. Idempotent on the\ntriple \u2014 a second call with the same ``(agent_id, skill_id)`` overwrites\nthe previous row's ciphertext (rotation).",
        "properties": {
          "agent_id": {
            "minLength": 1,
            "title": "Agent Id",
            "type": "string"
          },
          "credential_kind": {
            "$ref": "#/components/schemas/SkillCredentialKind"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "payload": {
            "description": "Plaintext credential material. Encrypted immediately and never stored in clear. Treat as write-only.",
            "minLength": 1,
            "title": "Payload",
            "type": "string"
          },
          "skill_id": {
            "minLength": 1,
            "title": "Skill Id",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "skill_id",
          "credential_kind",
          "payload"
        ],
        "title": "SkillCredentialCreate",
        "type": "object"
      },
      "SkillCredentialKind": {
        "description": "Discriminator for the encrypted payload shape.\n\nStorage is opaque ``bytes`` either way; ``kind`` is metadata the skill\nruntime uses to interpret the plaintext (e.g. \"this is a JSON\n``{access_token, refresh_token}`` blob\" vs \"this is a raw API key\").",
        "enum": [
          "oauth_token",
          "pat",
          "api_key",
          "totp_seed",
          "imap_smtp"
        ],
        "title": "SkillCredentialKind",
        "type": "string"
      },
      "SkillCredentialRead": {
        "description": "Public projection \u2014 metadata only, never the payload.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "credential_kind": {
            "$ref": "#/components/schemas/SkillCredentialKind"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "skill_id": {
            "title": "Skill Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "agent_id",
          "skill_id",
          "credential_kind",
          "created_at",
          "updated_at",
          "last_used_at",
          "expires_at",
          "revoked_at"
        ],
        "title": "SkillCredentialRead",
        "type": "object"
      },
      "SkillCredentialReveal": {
        "description": "Returned by the read endpoint. Contains the decrypted payload.",
        "properties": {
          "credential_kind": {
            "$ref": "#/components/schemas/SkillCredentialKind"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "payload": {
            "title": "Payload",
            "type": "string"
          }
        },
        "required": [
          "id",
          "credential_kind",
          "payload"
        ],
        "title": "SkillCredentialReveal",
        "type": "object"
      },
      "SkillExecuteRequest": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "duration_ms": {
            "default": 0,
            "description": "Wall-clock ms, reported by the agent SDK",
            "minimum": 0.0,
            "title": "Duration Ms",
            "type": "integer"
          },
          "error_message": {
            "anyOf": [
              {
                "maxLength": 4096,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "input_args": {
            "title": "Input Args",
            "type": "object"
          },
          "mutates": {
            "default": false,
            "title": "Mutates",
            "type": "boolean"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "status": {
            "enum": [
              "success",
              "error",
              "timeout"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "agent_id"
        ],
        "title": "SkillExecuteRequest",
        "type": "object"
      },
      "SkillForkRead": {
        "description": "Response from POST /skills/{skill_id}/fork \u2014 the newly created skill.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "entrypoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entrypoint"
          },
          "forked_from_skill_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Forked From Skill Id"
          },
          "forked_from_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Forked From Version"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "instruction_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instruction Content"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "network_enabled": {
            "title": "Network Enabled",
            "type": "boolean"
          },
          "owner_agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Agent Id"
          },
          "skill_type": {
            "title": "Skill Type",
            "type": "string"
          },
          "source_repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Repo Url"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "version": {
            "title": "Version",
            "type": "string"
          },
          "visibility": {
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "owner_agent_id",
          "name",
          "description",
          "summary",
          "skill_type",
          "source_repo_url",
          "entrypoint",
          "instruction_content",
          "version",
          "visibility",
          "status",
          "network_enabled",
          "tags",
          "forked_from_skill_id",
          "forked_from_version",
          "created_at"
        ],
        "title": "SkillForkRead",
        "type": "object"
      },
      "SkillForkRequest": {
        "description": "Request body for POST /skills/{skill_id}/fork.",
        "properties": {
          "target_agent_id": {
            "description": "Agent that will own the forked skill",
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Target Agent Id",
            "type": "string"
          }
        },
        "required": [
          "target_agent_id"
        ],
        "title": "SkillForkRequest",
        "type": "object"
      },
      "SkillGlobalSummary": {
        "properties": {
          "by_status": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "By Status",
            "type": "object"
          },
          "by_type": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "By Type",
            "type": "object"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "by_status",
          "by_type"
        ],
        "title": "SkillGlobalSummary",
        "type": "object"
      },
      "SkillImportResult": {
        "description": "Response from POST /skills/import.",
        "properties": {
          "allowed_tools": {
            "items": {
              "type": "string"
            },
            "title": "Allowed Tools",
            "type": "array"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "entrypoint": {
            "title": "Entrypoint",
            "type": "string"
          },
          "env_vars": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Env Vars",
            "type": "object"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "instructions": {
            "title": "Instructions",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "network_enabled": {
            "title": "Network Enabled",
            "type": "boolean"
          },
          "source_repo_url": {
            "title": "Source Repo Url",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "entrypoint",
          "version",
          "status",
          "source_repo_url",
          "instructions",
          "network_enabled",
          "env_vars",
          "allowed_tools"
        ],
        "title": "SkillImportResult",
        "type": "object"
      },
      "SkillInvocationRead": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "duration_ms": {
            "title": "Duration Ms",
            "type": "integer"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          },
          "skill_platform_secret_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skill Platform Secret Name"
          },
          "skill_platform_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skill Platform Token"
          },
          "skill_version": {
            "title": "Skill Version",
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "enum": [
              "success",
              "error",
              "timeout"
            ],
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "id",
          "skill_id",
          "skill_version",
          "agent_id",
          "user_id",
          "session_id",
          "tenant_id",
          "status",
          "duration_ms",
          "error_message",
          "started_at",
          "created_at"
        ],
        "title": "SkillInvocationRead",
        "type": "object"
      },
      "SkillPublishRequest": {
        "properties": {
          "version": {
            "description": "Git tag or ref to publish",
            "maxLength": 128,
            "minLength": 1,
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "version"
        ],
        "title": "SkillPublishRequest",
        "type": "object"
      },
      "SkillRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "entrypoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entrypoint"
          },
          "forked_from_skill_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Forked From Skill Id"
          },
          "forked_from_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Forked From Version"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "instruction_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instruction Content"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "network_enabled": {
            "title": "Network Enabled",
            "type": "boolean"
          },
          "owner_agent_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Agent Id"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "review_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Status"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewer_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Id"
          },
          "skill_type": {
            "title": "Skill Type",
            "type": "string"
          },
          "source_repo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Repo Url"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "tier": {
            "enum": [
              "agent",
              "tenant",
              "platform"
            ],
            "title": "Tier",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          },
          "visibility": {
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "owner_agent_id",
          "name",
          "description",
          "summary",
          "skill_type",
          "source_repo_url",
          "entrypoint",
          "instruction_content",
          "version",
          "visibility",
          "tier",
          "status",
          "review_status",
          "reviewer_id",
          "reviewed_at",
          "review_notes",
          "network_enabled",
          "tags",
          "created_at"
        ],
        "title": "SkillRead",
        "type": "object"
      },
      "SkillReviewDecision": {
        "description": "Admin decision on a pending skill review.",
        "properties": {
          "decision": {
            "enum": [
              "approved",
              "rejected"
            ],
            "title": "Decision",
            "type": "string"
          },
          "review_notes": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          }
        },
        "required": [
          "decision"
        ],
        "title": "SkillReviewDecision",
        "type": "object"
      },
      "SkillReviewResponse": {
        "description": "Response after a review action.",
        "properties": {
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "review_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Status"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewer_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Id"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "review_status",
          "reviewer_id",
          "reviewed_at",
          "review_notes",
          "status"
        ],
        "title": "SkillReviewResponse",
        "type": "object"
      },
      "SkillTransferRequest": {
        "description": "Request body for POST /skills/{skill_id}/transfer.",
        "properties": {
          "target_agent_id": {
            "description": "Agent to transfer ownership to",
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Target Agent Id",
            "type": "string"
          }
        },
        "required": [
          "target_agent_id"
        ],
        "title": "SkillTransferRequest",
        "type": "object"
      },
      "SkillUpdate": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "instruction_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instruction Content"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "network_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Network Enabled"
          },
          "status": {
            "anyOf": [
              {
                "enum": [
                  "draft",
                  "active",
                  "deprecated",
                  "archived",
                  "pending_review"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags"
          }
        },
        "title": "SkillUpdate",
        "type": "object"
      },
      "SkillWebhookCreated": {
        "description": "Returned only on create/rotate \u2014 includes the raw bearer token (shown once).",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "token": {
            "title": "Token",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "webhook_id": {
            "title": "Webhook Id",
            "type": "string"
          },
          "webhook_url": {
            "title": "Webhook Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "skill_id",
          "tenant_id",
          "webhook_id",
          "webhook_url",
          "created_at",
          "updated_at",
          "token"
        ],
        "title": "SkillWebhookCreated",
        "type": "object"
      },
      "SkillWebhookRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "skill_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Skill Id",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "webhook_id": {
            "title": "Webhook Id",
            "type": "string"
          },
          "webhook_url": {
            "title": "Webhook Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "skill_id",
          "tenant_id",
          "webhook_id",
          "webhook_url",
          "created_at",
          "updated_at"
        ],
        "title": "SkillWebhookRead",
        "type": "object"
      },
      "SourceAddRequest": {
        "description": "Body of ``POST /api/v1/newsbot/sources``.\n\nThe caller supplies only a URL. ``is_public`` / ``age_tag`` /\n``added_by_user_id`` / ``title`` are server-owned \u2014 the mass-assignment\ntests confirm smuggled fields are ignored.",
        "properties": {
          "url": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "SourceAddRequest",
        "type": "object"
      },
      "SourceBlocklistRead": {
        "description": "Moderator-visible blocklist row.",
        "properties": {
          "added_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Added By User Id"
          },
          "canonical_url": {
            "title": "Canonical Url",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "id",
          "canonical_url",
          "reason",
          "added_by_user_id",
          "created_at"
        ],
        "title": "SourceBlocklistRead",
        "type": "object"
      },
      "SourceBlocklistRequest": {
        "description": "Body of ``POST /api/v1/newsbot/sources/blocklist``.",
        "properties": {
          "reason": {
            "maxLength": 1000,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          },
          "url": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "reason"
        ],
        "title": "SourceBlocklistRequest",
        "type": "object"
      },
      "SourceCredentialAdminRead": {
        "description": "One credential's metadata + its share grants. Never carries the secret.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Created By Id",
            "type": "string"
          },
          "credential_kind": {
            "$ref": "#/components/schemas/SourceCredentialKind"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "grants": {
            "items": {
              "$ref": "#/components/schemas/SourceCredentialGrantRead"
            },
            "title": "Grants",
            "type": "array"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "created_by_id",
          "name",
          "source",
          "credential_kind",
          "created_at",
          "updated_at",
          "last_used_at",
          "expires_at",
          "revoked_at"
        ],
        "title": "SourceCredentialAdminRead",
        "type": "object"
      },
      "SourceCredentialCreate": {
        "description": "Body for ``POST /\u2026/source-credentials`` \u2014 create a new credential.\n\nThe plaintext ``payload`` is encrypted immediately via the per-tenant\nFernet key and never stored in clear. ``name`` is unique per tenant.",
        "properties": {
          "credential_kind": {
            "$ref": "#/components/schemas/SourceCredentialKind"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "payload": {
            "description": "Plaintext credential material. Encrypted immediately and never stored in clear. Treat as write-only.",
            "minLength": 1,
            "title": "Payload",
            "type": "string"
          },
          "source": {
            "description": "The source host/domain the credential authenticates to, e.g. nytimes.com.",
            "maxLength": 255,
            "minLength": 1,
            "title": "Source",
            "type": "string"
          }
        },
        "required": [
          "name",
          "source",
          "credential_kind",
          "payload"
        ],
        "title": "SourceCredentialCreate",
        "type": "object"
      },
      "SourceCredentialGrantKind": {
        "description": "Who a grant makes the credential available to.\n\n- ``user`` \u2014 a specific user (``principal_id`` = user id).\n- ``agent`` \u2014 a specific agent (``principal_id`` = agent id).\n- ``role`` \u2014 every principal in a tenant **role** (``principal_id`` = role\n  name, e.g. ``MEMBER``) \u2014 the standard-RBAC target.\n- ``group`` \u2014 every user/agent member of a tenant-authored ``tenant_group``\n  (``principal_id`` = group id) \u2014 the decision-#43 grantee (G3/#424). The\n  intersection still holds: a group grant reaches a member's user side and\n  an agent member's agent side, each expanded by one flat join through\n  ``tenant_group_member``, and access remains ``user side \u2229 agent side``.\n- ``all`` \u2014 everyone in the tenant (``principal_id`` is NULL).",
        "enum": [
          "user",
          "agent",
          "role",
          "group",
          "all"
        ],
        "title": "SourceCredentialGrantKind",
        "type": "string"
      },
      "SourceCredentialGrantRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "grant_kind": {
            "$ref": "#/components/schemas/SourceCredentialGrantKind"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "principal_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Principal Id"
          }
        },
        "required": [
          "id",
          "grant_kind",
          "principal_id",
          "created_at"
        ],
        "title": "SourceCredentialGrantRead",
        "type": "object"
      },
      "SourceCredentialGrantRequest": {
        "description": "Add or remove one share grant.\n\n``all`` must omit ``principal_id``; every other kind requires one \u2014 the\nservice enforces this too (``add_grant``/``remove_grant`` raise\n``InvalidInput``).",
        "properties": {
          "grant_kind": {
            "$ref": "#/components/schemas/SourceCredentialGrantKind"
          },
          "principal_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Principal Id"
          }
        },
        "required": [
          "grant_kind"
        ],
        "title": "SourceCredentialGrantRequest",
        "type": "object"
      },
      "SourceCredentialKind": {
        "description": "Discriminator for the encrypted payload shape (storage is opaque bytes).\n\n``api_key`` / ``bearer`` are a single secret string; ``basic_auth`` is a\nJSON ``{username, password}`` blob; ``cookie`` is a raw Cookie header value;\n``oauth_token`` is a JSON ``{access_token, refresh_token}`` blob.",
        "enum": [
          "api_key",
          "bearer",
          "basic_auth",
          "cookie",
          "oauth_token"
        ],
        "title": "SourceCredentialKind",
        "type": "string"
      },
      "SourceCredentialRead": {
        "description": "Public projection \u2014 metadata only, never the payload.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_id": {
            "title": "Created By Id",
            "type": "string"
          },
          "credential_kind": {
            "$ref": "#/components/schemas/SourceCredentialKind"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "created_by_id",
          "name",
          "source",
          "credential_kind",
          "created_at",
          "updated_at",
          "last_used_at",
          "expires_at",
          "revoked_at"
        ],
        "title": "SourceCredentialRead",
        "type": "object"
      },
      "SourceCredentialRotate": {
        "description": "Body for ``POST /\u2026/source-credentials/{id}/rotate`` \u2014 new secret in place.\n\nRotation un-revokes and resets the expiry (default: no expiry).",
        "properties": {
          "credential_kind": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SourceCredentialKind"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "payload": {
            "description": "New plaintext credential material. Encrypted immediately.",
            "minLength": 1,
            "title": "Payload",
            "type": "string"
          }
        },
        "required": [
          "payload"
        ],
        "title": "SourceCredentialRotate",
        "type": "object"
      },
      "SourceGroupShareRequest": {
        "description": "Body of the source\u2194group visibility share/unshare routes (#424).\n\n``group_id`` is a tenant-group id; a group from another tenant returns 404\n(no cross-tenant existence oracle). ``group:<id>`` is the grantee \u2014 a source\nshared here becomes visible to every user member of the group.",
        "properties": {
          "group_id": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Group Id",
            "type": "string"
          }
        },
        "required": [
          "group_id"
        ],
        "title": "SourceGroupShareRequest",
        "type": "object"
      },
      "SourceListResponse": {
        "description": "Paginated ``GET /api/v1/newsbot/sources`` response.",
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "sources": {
            "items": {
              "$ref": "#/components/schemas/SourceRead"
            },
            "title": "Sources",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "sources",
          "total",
          "limit",
          "offset"
        ],
        "title": "SourceListResponse",
        "type": "object"
      },
      "SourceRead": {
        "description": "The tenant-caller-visible catalogue row.",
        "properties": {
          "age_tag": {
            "enum": [
              "general_audience",
              "young_adult",
              "adult_only",
              "unrated"
            ],
            "title": "Age Tag",
            "type": "string"
          },
          "canonical_url": {
            "title": "Canonical Url",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "is_public": {
            "title": "Is Public",
            "type": "boolean"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "canonical_url",
          "title",
          "is_public",
          "age_tag",
          "created_at"
        ],
        "title": "SourceRead",
        "type": "object"
      },
      "SourceTagRequest": {
        "description": "Body of ``POST /api/v1/newsbot/sources/{id}/tag``.",
        "properties": {
          "age_tag": {
            "enum": [
              "general_audience",
              "young_adult",
              "adult_only",
              "unrated"
            ],
            "title": "Age Tag",
            "type": "string"
          }
        },
        "required": [
          "age_tag"
        ],
        "title": "SourceTagRequest",
        "type": "object"
      },
      "SshKeyAdd": {
        "description": "Request body for adding or rotating an SSH private key.\n\nThe key is encrypted immediately and never returned via the API.\nProvider is stored as ``ssh:<host>`` so each target host has a distinct\nlinked_identity row.",
        "properties": {
          "host": {
            "description": "Hostname or IP address of the target server. Only letters, digits, dots, hyphens, and underscores are allowed \u2014 must match what the `ssh` connector accepts at exec time.",
            "maxLength": 59,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9._-]+$",
            "title": "Host",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Human-readable label for this key (defaults to username@host:port)",
            "title": "Label"
          },
          "port": {
            "default": 22,
            "description": "SSH port (default 22)",
            "maximum": 65535.0,
            "minimum": 1.0,
            "title": "Port",
            "type": "integer"
          },
          "private_key": {
            "description": "PEM or OpenSSH private key material (Ed25519, RSA, ECDSA, or DSS)",
            "minLength": 40,
            "title": "Private Key",
            "type": "string"
          },
          "username": {
            "description": "SSH username (letters, digits, dots, hyphens, underscores).",
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9._-]+$",
            "title": "Username",
            "type": "string"
          }
        },
        "required": [
          "host",
          "username",
          "private_key"
        ],
        "title": "SshKeyAdd",
        "type": "object"
      },
      "StartLinkResponse": {
        "description": "Returned by the ``start`` route.\n\n``authorize_url`` is the full upstream URL the browser must follow to begin\nthe OAuth dance. ``state`` is included so a JSON client (mobile, integration\ntests) can verify it matches the eventual callback \u2014 browser SPAs normally\nonly need the URL.",
        "properties": {
          "authorize_url": {
            "title": "Authorize Url",
            "type": "string"
          },
          "state": {
            "title": "State",
            "type": "string"
          }
        },
        "required": [
          "authorize_url",
          "state"
        ],
        "title": "StartLinkResponse",
        "type": "object"
      },
      "StatusAlertCreate": {
        "properties": {
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "platform_wide": {
            "default": false,
            "description": "If true, alert applies to all tenants. SuperAdmin only.",
            "title": "Platform Wide",
            "type": "boolean"
          },
          "severity": {
            "enum": [
              "info",
              "warning",
              "error",
              "critical"
            ],
            "title": "Severity",
            "type": "string"
          },
          "title": {
            "maxLength": 512,
            "minLength": 1,
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "title"
        ],
        "title": "StatusAlertCreate",
        "type": "object"
      },
      "StatusAlertPatch": {
        "properties": {
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "severity": {
            "anyOf": [
              {
                "enum": [
                  "info",
                  "warning",
                  "error",
                  "critical"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity"
          },
          "status": {
            "anyOf": [
              {
                "enum": [
                  "active",
                  "resolved"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 512,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "title": "StatusAlertPatch",
        "type": "object"
      },
      "StatusAlertRead": {
        "properties": {
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Agent Id"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "resolved_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolved At"
          },
          "severity": {
            "title": "Severity",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tenant Id"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "severity",
          "status",
          "created_at",
          "updated_at"
        ],
        "title": "StatusAlertRead",
        "type": "object"
      },
      "StatusAlertTimelineRead": {
        "properties": {
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Body"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Agent Id"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "resolved_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolved At"
          },
          "severity": {
            "title": "Severity",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tenant Id"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "updates": {
            "items": {
              "$ref": "#/components/schemas/StatusAlertUpdateRead"
            },
            "title": "Updates",
            "type": "array"
          }
        },
        "required": [
          "id",
          "title",
          "severity",
          "status",
          "created_at",
          "updated_at"
        ],
        "title": "StatusAlertTimelineRead",
        "type": "object"
      },
      "StatusAlertUpdateCreate": {
        "properties": {
          "body": {
            "minLength": 1,
            "title": "Body",
            "type": "string"
          }
        },
        "required": [
          "body"
        ],
        "title": "StatusAlertUpdateCreate",
        "type": "object"
      },
      "StatusAlertUpdateRead": {
        "properties": {
          "alert_id": {
            "title": "Alert Id",
            "type": "string"
          },
          "body": {
            "title": "Body",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Agent Id"
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By User Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "alert_id",
          "body",
          "created_at"
        ],
        "title": "StatusAlertUpdateRead",
        "type": "object"
      },
      "StepUpGrantCreate": {
        "properties": {
          "purpose": {
            "$ref": "#/components/schemas/StepUpPurpose"
          }
        },
        "required": [
          "purpose"
        ],
        "title": "StepUpGrantCreate",
        "type": "object"
      },
      "StepUpGrantRead": {
        "properties": {
          "expires_at": {
            "title": "Expires At",
            "type": "string"
          },
          "grant_id": {
            "title": "Grant Id",
            "type": "string"
          },
          "purpose": {
            "$ref": "#/components/schemas/StepUpPurpose"
          }
        },
        "required": [
          "grant_id",
          "purpose",
          "expires_at"
        ],
        "title": "StepUpGrantRead",
        "type": "object"
      },
      "StepUpPurpose": {
        "description": "What a reauth authorizes. A grant for one purpose never covers another.",
        "enum": [
          "agent_persona",
          "agent_ssh_key",
          "model_pricing",
          "plan_billing",
          "tenant_plan_change",
          "tenant_group_sensitive",
          "dev_env_ide_open",
          "workspace_settlement",
          "documents_bulk_delete",
          "agent_editor_access",
          "operator_cluster_restart",
          "github_app_connect",
          "export_transcript"
        ],
        "title": "StepUpPurpose",
        "type": "string"
      },
      "SubscriptionRead": {
        "description": "Current plan + Stripe lifecycle status for a tenant.",
        "properties": {
          "plan_code": {
            "title": "Plan Code",
            "type": "string"
          },
          "plan_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Plan Id",
            "type": "string"
          },
          "plan_status": {
            "enum": [
              "trialing",
              "active",
              "past_due",
              "canceled"
            ],
            "title": "Plan Status",
            "type": "string"
          },
          "stripe_customer_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Customer Id"
          },
          "stripe_enterprise_subscription_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Enterprise Subscription Id"
          },
          "stripe_langflow_subscription_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Langflow Subscription Id"
          },
          "stripe_subscription_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Subscription Id"
          },
          "stripe_support_subscription_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Support Subscription Id"
          }
        },
        "required": [
          "plan_id",
          "plan_code",
          "plan_status",
          "stripe_customer_id",
          "stripe_subscription_id"
        ],
        "title": "SubscriptionRead",
        "type": "object"
      },
      "SubtaskCancelRequest": {
        "description": "Body for `POST .../sessions/{session_id}/subtasks/cancel` (#3124).\n\nSelective reap: cancel exactly the listed descendant subtasks. Ids that are\nnot active descendants of this session (already terminal, or not in its\nsubtree) are silently ignored \u2014 the response reports what was actually\ncancelled, and a foreign id can never reach another session's row.",
        "properties": {
          "subtask_session_ids": {
            "items": {
              "maxLength": 25,
              "minLength": 25,
              "pattern": "^c[a-z0-9]{24}$",
              "type": "string"
            },
            "maxItems": 200,
            "minItems": 1,
            "title": "Subtask Session Ids",
            "type": "array"
          }
        },
        "required": [
          "subtask_session_ids"
        ],
        "title": "SubtaskCancelRequest",
        "type": "object"
      },
      "SubtaskCancelResponse": {
        "description": "Response for the two reap paths (#3124): the subtasks actually cancelled.",
        "properties": {
          "cancelled": {
            "items": {
              "$ref": "#/components/schemas/SubtaskSummary"
            },
            "title": "Cancelled",
            "type": "array"
          },
          "count": {
            "title": "Count",
            "type": "integer"
          }
        },
        "required": [
          "cancelled",
          "count"
        ],
        "title": "SubtaskCancelResponse",
        "type": "object"
      },
      "SubtaskSummary": {
        "description": "One active descendant subtask, for the reap picker (issue #3124).\n\nFlat entry in the \"running subtasks\" list a user sees when they stop, or\nwhen a parent thread reaches a terminal state with descendants still\nrunning. ``depth`` is the hop distance from the session being reaped (1 =\ndirect child) so the UI can indent nested subtasks.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "depth": {
            "title": "Depth",
            "type": "integer"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "required": [
          "session_id",
          "status",
          "depth",
          "created_at"
        ],
        "title": "SubtaskSummary",
        "type": "object"
      },
      "SystemDefaultModelSet": {
        "description": "Request body for PUT /admin/models/system-default.",
        "properties": {
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          }
        },
        "required": [
          "model_id"
        ],
        "title": "SystemDefaultModelSet",
        "type": "object"
      },
      "TaskMessageCreate": {
        "description": "Body for `POST /tenant/{t}/agent/{a}/sessions/{s}/messages`.\n\nContent is jsonb \u2014 typically `{\"text\": \"...\"}` for plain user messages but\ncan carry structured payloads (tool results, attachments). Role is locked\nto ``user``: browser-bound callers can't forge `assistant` / `system` /\n`tool` history. Internal callers (the agent SDK) inject those roles via\nthe internal API surface, not this route.",
        "properties": {
          "content": {
            "title": "Content",
            "type": "object"
          },
          "editor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EditorTurn"
              },
              {
                "type": "null"
              }
            ]
          },
          "mentions": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/MentionItem"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mentions"
          },
          "role": {
            "const": "user",
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "title": "TaskMessageCreate",
        "type": "object"
      },
      "TaskMessageOut": {
        "description": "Response shape for a single persisted message.",
        "properties": {
          "author_display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author Display Name"
          },
          "author_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author User Id"
          },
          "content": {
            "title": "Content",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "is_seed": {
            "default": false,
            "title": "Is Seed",
            "type": "boolean"
          },
          "mentions": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/MentionItem"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mentions"
          },
          "role": {
            "$ref": "#/components/schemas/TaskMessageRole"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "token_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Count"
          }
        },
        "required": [
          "id",
          "session_id",
          "role",
          "content",
          "token_count",
          "created_at"
        ],
        "title": "TaskMessageOut",
        "type": "object"
      },
      "TaskMessageRead": {
        "properties": {
          "child_completion_tokens": {
            "default": 0,
            "title": "Child Completion Tokens",
            "type": "integer"
          },
          "child_cost_cents": {
            "default": 0,
            "title": "Child Cost Cents",
            "type": "integer"
          },
          "child_prompt_tokens": {
            "default": 0,
            "title": "Child Prompt Tokens",
            "type": "integer"
          },
          "completion_tokens": {
            "default": 0,
            "title": "Completion Tokens",
            "type": "integer"
          },
          "content": {
            "title": "Content",
            "type": "object"
          },
          "cost_cents": {
            "default": 0,
            "title": "Cost Cents",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "mentions": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/MentionItem"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mentions"
          },
          "prompt_tokens": {
            "default": 0,
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "session_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Session Id",
            "type": "string"
          },
          "token_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Count"
          }
        },
        "required": [
          "id",
          "session_id",
          "role",
          "content",
          "created_at"
        ],
        "title": "TaskMessageRead",
        "type": "object"
      },
      "TaskMessageRole": {
        "enum": [
          "system",
          "user",
          "assistant",
          "tool"
        ],
        "title": "TaskMessageRole",
        "type": "string"
      },
      "TaskSessionCreate": {
        "description": "Body for `POST /tenant/{t}/agent/{a}/sessions`.\n\n`initial_message` is optional \u2014 callers can create an idle session and post\nthe first message separately. `read_only` is propagated to the agent pod\nvia the `READ_ONLY` env var (decision #32) and blocks memory writes / repo\ncommits / cron mutations server-side.",
        "properties": {
          "initial_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Message"
          },
          "read_only": {
            "default": false,
            "title": "Read Only",
            "type": "boolean"
          },
          "source_sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Sha"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "title": "TaskSessionCreate",
        "type": "object"
      },
      "TaskSessionDebugRead": {
        "description": "Full session dump for the tenant-admin debug view.",
        "properties": {
          "attributed_child_completion_tokens": {
            "default": 0,
            "title": "Attributed Child Completion Tokens",
            "type": "integer"
          },
          "attributed_child_cost_cents": {
            "default": 0,
            "title": "Attributed Child Cost Cents",
            "type": "integer"
          },
          "attributed_child_count": {
            "default": 0,
            "title": "Attributed Child Count",
            "type": "integer"
          },
          "attributed_child_prompt_tokens": {
            "default": 0,
            "title": "Attributed Child Prompt Tokens",
            "type": "integer"
          },
          "completion_tokens": {
            "default": 0,
            "title": "Completion Tokens",
            "type": "integer"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/TaskMessageRead"
            },
            "title": "Messages",
            "type": "array"
          },
          "prompt_tokens": {
            "default": 0,
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "session": {
            "$ref": "#/components/schemas/TaskSessionRead"
          },
          "total_cost_cents": {
            "default": 0,
            "title": "Total Cost Cents",
            "type": "integer"
          },
          "total_incl_children_cost_cents": {
            "default": 0,
            "title": "Total Incl Children Cost Cents",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "session",
          "messages",
          "total_tokens"
        ],
        "title": "TaskSessionDebugRead",
        "type": "object"
      },
      "TaskSessionRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "archived_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Archived At"
          },
          "boot_phase": {
            "anyOf": [
              {
                "enum": [
                  "not_yet_created",
                  "scheduling",
                  "pulling_image",
                  "cloning_repo",
                  "mounting_workspace",
                  "booting_agent",
                  "running",
                  "failed",
                  "unknown"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Boot Phase"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "category_confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category Confidence"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Id"
          },
          "failure_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failure Detail"
          },
          "failure_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failure Reason"
          },
          "fork_message_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fork Message Id"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "listen_mode": {
            "default": false,
            "title": "Listen Mode",
            "type": "boolean"
          },
          "next_retry_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Retry At"
          },
          "parent_relationship": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Relationship"
          },
          "parent_session_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Session Id"
          },
          "pod_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pod Name"
          },
          "read_only": {
            "title": "Read Only",
            "type": "boolean"
          },
          "retry_count": {
            "default": 0,
            "title": "Retry Count",
            "type": "integer"
          },
          "source_sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Sha"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "task_state": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task State"
          },
          "task_state_version": {
            "default": 0,
            "title": "Task State Version",
            "type": "integer"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "status",
          "read_only",
          "created_at",
          "updated_at"
        ],
        "title": "TaskSessionRead",
        "type": "object"
      },
      "TaskSummary30d": {
        "properties": {
          "total_messages": {
            "title": "Total Messages",
            "type": "integer"
          },
          "total_sessions": {
            "title": "Total Sessions",
            "type": "integer"
          }
        },
        "required": [
          "total_sessions",
          "total_messages"
        ],
        "title": "TaskSummary30d",
        "type": "object"
      },
      "TenantAgentRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By Id"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "invocations_30d": {
            "title": "Invocations 30D",
            "type": "integer"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "is_seed": {
            "title": "Is Seed",
            "type": "boolean"
          },
          "last_invoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Invoked At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "created_by_id",
          "is_active",
          "is_seed",
          "created_at",
          "last_invoked_at",
          "invocations_30d"
        ],
        "title": "TenantAgentRead",
        "type": "object"
      },
      "TenantAllowedAccountCreate": {
        "properties": {
          "auto_role": {
            "minLength": 1,
            "title": "Auto Role",
            "type": "string"
          },
          "pattern": {
            "maxLength": 253,
            "minLength": 1,
            "title": "Pattern",
            "type": "string"
          }
        },
        "required": [
          "pattern",
          "auto_role"
        ],
        "title": "TenantAllowedAccountCreate",
        "type": "object"
      },
      "TenantAllowedAccountRead": {
        "properties": {
          "auto_role": {
            "title": "Auto Role",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "pattern": {
            "title": "Pattern",
            "type": "string"
          }
        },
        "required": [
          "id",
          "pattern",
          "auto_role",
          "created_at"
        ],
        "title": "TenantAllowedAccountRead",
        "type": "object"
      },
      "TenantBrandFaviconUploaded": {
        "description": "Returned by the favicon-upload endpoint.",
        "properties": {
          "favicon_content_type": {
            "title": "Favicon Content Type",
            "type": "string"
          },
          "favicon_sha256": {
            "title": "Favicon Sha256",
            "type": "string"
          },
          "favicon_size_bytes": {
            "title": "Favicon Size Bytes",
            "type": "integer"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "favicon_sha256",
          "favicon_content_type",
          "favicon_size_bytes"
        ],
        "title": "TenantBrandFaviconUploaded",
        "type": "object"
      },
      "TenantBrandLogoUploaded": {
        "description": "Returned by the logo-upload endpoint.",
        "properties": {
          "logo_content_type": {
            "title": "Logo Content Type",
            "type": "string"
          },
          "logo_sha256": {
            "title": "Logo Sha256",
            "type": "string"
          },
          "logo_size_bytes": {
            "title": "Logo Size Bytes",
            "type": "integer"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "logo_sha256",
          "logo_content_type",
          "logo_size_bytes"
        ],
        "title": "TenantBrandLogoUploaded",
        "type": "object"
      },
      "TenantBrandRead": {
        "properties": {
          "accent_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accent Color"
          },
          "background_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Background Color"
          },
          "contrast_warnings": {
            "items": {
              "type": "string"
            },
            "title": "Contrast Warnings",
            "type": "array"
          },
          "default_appearance": {
            "$ref": "#/components/schemas/ThemePreference",
            "default": "system"
          },
          "favicon_content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favicon Content Type"
          },
          "favicon_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favicon Sha256"
          },
          "favicon_size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favicon Size Bytes"
          },
          "has_favicon": {
            "default": false,
            "title": "Has Favicon",
            "type": "boolean"
          },
          "has_logo": {
            "title": "Has Logo",
            "type": "boolean"
          },
          "logo_content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logo Content Type"
          },
          "logo_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logo Sha256"
          },
          "logo_size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logo Size Bytes"
          },
          "primary_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Primary Color"
          },
          "secondary_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secondary Color"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "text_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text Color"
          },
          "theme_extra": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Theme Extra"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "required": [
          "tenant_id",
          "has_logo"
        ],
        "title": "TenantBrandRead",
        "type": "object"
      },
      "TenantBrandUpdate": {
        "description": "Partial-update for theme tokens. Logo is uploaded via the separate\nmultipart endpoint. Pass ``null`` for a colour field to clear it.",
        "properties": {
          "accent_color": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accent Color"
          },
          "background_color": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Background Color"
          },
          "default_appearance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ThemePreference"
              },
              {
                "type": "null"
              }
            ]
          },
          "primary_color": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Primary Color"
          },
          "secondary_color": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secondary Color"
          },
          "text_color": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text Color"
          },
          "theme_extra": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TenantThemeExtra"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "TenantBrandUpdate",
        "type": "object"
      },
      "TenantCreate": {
        "properties": {
          "billing_email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Email"
          },
          "name": {
            "maxLength": 255,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "plan_code": {
            "default": "FREE",
            "title": "Plan Code",
            "type": "string"
          },
          "seed_profile": {
            "default": "default",
            "title": "Seed Profile",
            "type": "string"
          },
          "slug": {
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "name",
          "slug"
        ],
        "title": "TenantCreate",
        "type": "object"
      },
      "TenantEntitlementsRead": {
        "properties": {
          "allow_byo_models": {
            "title": "Allow Byo Models",
            "type": "boolean"
          },
          "allowed_merge_categories": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Merge Categories"
          },
          "apps": {
            "additionalProperties": {
              "type": "boolean"
            },
            "title": "Apps",
            "type": "object"
          },
          "budgets": {
            "additionalProperties": {
              "additionalProperties": {
                "type": "number"
              },
              "type": "object"
            },
            "title": "Budgets",
            "type": "object"
          },
          "plan_code": {
            "title": "Plan Code",
            "type": "string"
          }
        },
        "required": [
          "plan_code",
          "apps",
          "allow_byo_models",
          "allowed_merge_categories",
          "budgets"
        ],
        "title": "TenantEntitlementsRead",
        "type": "object"
      },
      "TenantGroupCreate": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "TenantGroupCreate",
        "type": "object"
      },
      "TenantGroupDetail": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "managers": {
            "items": {
              "$ref": "#/components/schemas/GroupManagerRead"
            },
            "title": "Managers",
            "type": "array"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/GroupMemberRead"
            },
            "title": "Members",
            "type": "array"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "members",
          "managers",
          "created_at",
          "updated_at"
        ],
        "title": "TenantGroupDetail",
        "type": "object"
      },
      "TenantGroupPermissionRead": {
        "description": "Capability flags a group grants its **user** members (#424).\n\n``inert_for_agent_members`` is always ``True`` today: these flags gate user\nactions and there is no agent-side capability gate yet, so an agent that is a\ngroup member gains nothing. The admin UI must surface this so a grant is not\nmistaken for conferring an agent a capability it cannot use.",
        "properties": {
          "can_create_agents": {
            "default": false,
            "title": "Can Create Agents",
            "type": "boolean"
          },
          "can_create_skills": {
            "default": false,
            "title": "Can Create Skills",
            "type": "boolean"
          },
          "can_invite_users": {
            "default": false,
            "title": "Can Invite Users",
            "type": "boolean"
          },
          "can_manage_settings": {
            "default": false,
            "title": "Can Manage Settings",
            "type": "boolean"
          },
          "can_view_billing": {
            "default": false,
            "title": "Can View Billing",
            "type": "boolean"
          },
          "group_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Group Id",
            "type": "string"
          },
          "inert_for_agent_members": {
            "default": true,
            "title": "Inert For Agent Members",
            "type": "boolean"
          }
        },
        "required": [
          "group_id"
        ],
        "title": "TenantGroupPermissionRead",
        "type": "object"
      },
      "TenantGroupPermissionUpdate": {
        "description": "Update body for a group's capability grant \u2014 all optional (patch subset).",
        "properties": {
          "can_create_agents": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Create Agents"
          },
          "can_create_skills": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Create Skills"
          },
          "can_invite_users": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Invite Users"
          },
          "can_manage_settings": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Manage Settings"
          },
          "can_view_billing": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can View Billing"
          }
        },
        "title": "TenantGroupPermissionUpdate",
        "type": "object"
      },
      "TenantGroupRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "manager_count": {
            "default": 0,
            "title": "Manager Count",
            "type": "integer"
          },
          "member_count": {
            "default": 0,
            "title": "Member Count",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "created_at",
          "updated_at"
        ],
        "title": "TenantGroupRead",
        "type": "object"
      },
      "TenantGroupSummary": {
        "description": "A group as seen by a member on the \"my groups\" surface.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_manager": {
            "default": false,
            "title": "Is Manager",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "name",
          "created_at",
          "updated_at"
        ],
        "title": "TenantGroupSummary",
        "type": "object"
      },
      "TenantGroupUpdate": {
        "description": "Rename / re-describe. Omitting a field leaves it; sending ``null`` on\n``description`` clears it (the route reads ``model_fields_set``).",
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "title": "TenantGroupUpdate",
        "type": "object"
      },
      "TenantGuardrailDefaultsRead": {
        "description": "Response schema for GET /tenants/{id}/guardrail-defaults.\n\nAll fields are nullable \u2014 ``None`` means \"no tenant default set;\nplatform default applies\".",
        "properties": {
          "built_in": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuiltInDefaults"
              },
              {
                "type": "null"
              }
            ]
          },
          "egress_allowlist": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Egress Allowlist"
          },
          "embedding_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embedding Model"
          },
          "llama_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llama Guard Model"
          },
          "prompt_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Guard Model"
          }
        },
        "title": "TenantGuardrailDefaultsRead",
        "type": "object"
      },
      "TenantGuardrailDefaultsUpdate": {
        "description": "Partial-update body for PUT /tenants/{id}/guardrail-defaults.\n\nFields present in the request body are written; omitted fields are\nleft untouched.  Sending a field as ``null`` clears the override and\nfalls back to the platform default.",
        "properties": {
          "built_in": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuiltInDefaults"
              },
              {
                "type": "null"
              }
            ]
          },
          "egress_allowlist": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Egress Allowlist"
          },
          "embedding_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embedding Model"
          },
          "llama_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llama Guard Model"
          },
          "prompt_guard_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Guard Model"
          }
        },
        "title": "TenantGuardrailDefaultsUpdate",
        "type": "object"
      },
      "TenantIdentityCreate": {
        "description": "Body for saving a BYOK credential in tenant_identity.\n\n`provider` must match the `tenant_identity.provider` convention:\n`model:<vendor>` for model BYOK keys (e.g. `model:openrouter`).\nThe plaintext `access_token` is encrypted immediately and never persisted\nin clear (CLAUDE.md decision #14).",
        "properties": {
          "access_token": {
            "minLength": 1,
            "title": "Access Token",
            "type": "string"
          },
          "external_account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Account Id"
          },
          "provider": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "access_token"
        ],
        "title": "TenantIdentityCreate",
        "type": "object"
      },
      "TenantIdentityRead": {
        "description": "Public projection of `tenant_identity`. Never includes tokens.",
        "properties": {
          "external_account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Account Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "needs_relink": {
            "default": false,
            "title": "Needs Relink",
            "type": "boolean"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "provider",
          "external_account_id",
          "scopes"
        ],
        "title": "TenantIdentityRead",
        "type": "object"
      },
      "TenantIntegrationRead": {
        "description": "Public projection of a tenant-wide integration.\n\nMirrors the ``TenantIntegration`` interface in\n``front-end/src/pages/tenants/[tenantId]/organization/integrations.astro``.",
        "properties": {
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "scope": {
            "title": "Scope",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "label",
          "connected",
          "scope"
        ],
        "title": "TenantIntegrationRead",
        "type": "object"
      },
      "TenantMailboxRow": {
        "description": "One mailbox row for the tenant-admin Mail page.\n\n``is_paused`` mirrors the SuperAdmin schema: paused == ``mailbox.is_active``\nis false. Tenant admins can see the state but cannot toggle it from this\nsurface (decision per ``mail.md``: \"Tenant admins cannot create or delete\nmailboxes\" \u2014 pause is a SuperAdmin lever).",
        "properties": {
          "address": {
            "title": "Address",
            "type": "string"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "bounce_count_7d": {
            "title": "Bounce Count 7D",
            "type": "integer"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_paused": {
            "title": "Is Paused",
            "type": "boolean"
          },
          "message_count_7d": {
            "title": "Message Count 7D",
            "type": "integer"
          },
          "service": {
            "enum": [
              "internal",
              "external"
            ],
            "title": "Service",
            "type": "string"
          }
        },
        "required": [
          "id",
          "address",
          "service",
          "agent_name",
          "message_count_7d",
          "bounce_count_7d",
          "is_paused"
        ],
        "title": "TenantMailboxRow",
        "type": "object"
      },
      "TenantMember": {
        "properties": {
          "email": {
            "title": "Email",
            "type": "string"
          },
          "joined_at": {
            "format": "date-time",
            "title": "Joined At",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "status": {
            "enum": [
              "active",
              "invited"
            ],
            "title": "Status",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "name",
          "role",
          "status",
          "joined_at"
        ],
        "title": "TenantMember",
        "type": "object"
      },
      "TenantMemberRead": {
        "properties": {
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "is_super_admin": {
            "title": "Is Super Admin",
            "type": "boolean"
          },
          "joined_at": {
            "format": "date-time",
            "title": "Joined At",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "display_name",
          "role",
          "is_super_admin",
          "joined_at"
        ],
        "title": "TenantMemberRead",
        "type": "object"
      },
      "TenantMembershipRead": {
        "properties": {
          "is_default": {
            "title": "Is Default",
            "type": "boolean"
          },
          "joined_at": {
            "format": "date-time",
            "title": "Joined At",
            "type": "string"
          },
          "plan_code": {
            "title": "Plan Code",
            "type": "string"
          },
          "plan_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Plan Id",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "tenant_name": {
            "title": "Tenant Name",
            "type": "string"
          },
          "tenant_slug": {
            "title": "Tenant Slug",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "tenant_name",
          "tenant_slug",
          "plan_id",
          "plan_code",
          "role",
          "is_default",
          "joined_at"
        ],
        "title": "TenantMembershipRead",
        "type": "object"
      },
      "TenantModelGrant": {
        "properties": {
          "status": {
            "enum": [
              "active",
              "disabled",
              "experimental",
              "deprecated"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "title": "TenantModelGrant",
        "type": "object"
      },
      "TenantModelListItem": {
        "description": "``ModelRead`` plus the per-tenant grant status. The tenant org models\npage needs both: ``status`` is the global ``Model.status`` (drives the\n\"globally disabled \u2014 not toggleable\" affordance) and ``tenant_status``\nis the ``tenant_model.status`` override the tenant admin flips on/off.",
        "properties": {
          "available_to_all_tenants": {
            "default": false,
            "title": "Available To All Tenants",
            "type": "boolean"
          },
          "config": {
            "title": "Config",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "endpoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Endpoint"
          },
          "failover_chain": {
            "items": {
              "maxLength": 25,
              "minLength": 25,
              "pattern": "^c[a-z0-9]{24}$",
              "type": "string"
            },
            "title": "Failover Chain",
            "type": "array"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_free": {
            "title": "Is Free",
            "type": "boolean"
          },
          "is_system_default": {
            "default": false,
            "title": "Is System Default",
            "type": "boolean"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "owner_user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Owner User Id",
            "type": "string"
          },
          "owning_tenant_id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owning Tenant Id"
          },
          "pricing": {
            "title": "Pricing",
            "type": "object"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_status": {
            "title": "Tenant Status",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "owner_user_id",
          "name",
          "description",
          "kind",
          "status",
          "is_free",
          "config",
          "pricing",
          "endpoint",
          "created_at",
          "updated_at",
          "tenant_status"
        ],
        "title": "TenantModelListItem",
        "type": "object"
      },
      "TenantModelRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "model_id",
          "status",
          "created_at"
        ],
        "title": "TenantModelRead",
        "type": "object"
      },
      "TenantPaidRequest": {
        "properties": {
          "paid": {
            "title": "Paid",
            "type": "boolean"
          }
        },
        "required": [
          "paid"
        ],
        "title": "TenantPaidRequest",
        "type": "object"
      },
      "TenantPlanChangeRequest": {
        "description": "``POST /tenant/{t}/billing/change-plan``. Only a plan code.\n\nEvery price, quantity and the tenant come from the server; any other field\nin the body (``price_id``, ``unit_amount``, ``quantity``, ``tenant_id`` \u2026)\nis ignored.",
        "properties": {
          "plan_code": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Plan Code",
            "type": "string"
          }
        },
        "required": [
          "plan_code"
        ],
        "title": "TenantPlanChangeRequest",
        "type": "object"
      },
      "TenantPlanChangeResult": {
        "properties": {
          "from_plan_code": {
            "title": "From Plan Code",
            "type": "string"
          },
          "plan_code": {
            "title": "Plan Code",
            "type": "string"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "required": [
          "status",
          "from_plan_code",
          "plan_code"
        ],
        "title": "TenantPlanChangeResult",
        "type": "object"
      },
      "TenantPlanOverridesRead": {
        "description": "A tenant's sparse overrides, its plan, and the resolved result.",
        "properties": {
          "effective": {
            "$ref": "#/components/schemas/EffectiveTerms"
          },
          "overrides": {
            "title": "Overrides",
            "type": "object"
          },
          "plan": {
            "$ref": "#/components/schemas/PlanRead"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "plan",
          "overrides",
          "effective"
        ],
        "title": "TenantPlanOverridesRead",
        "type": "object"
      },
      "TenantRead": {
        "properties": {
          "abandoned_warning_sent_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Abandoned Warning Sent At"
          },
          "allow_superadmin_access": {
            "default": true,
            "title": "Allow Superadmin Access",
            "type": "boolean"
          },
          "billing_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Email"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "default_skill_visibility_scope": {
            "enum": [
              "private_only",
              "tenant_allowed"
            ],
            "title": "Default Skill Visibility Scope",
            "type": "string"
          },
          "external_mail_enabled": {
            "default": false,
            "title": "External Mail Enabled",
            "type": "boolean"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_suspended": {
            "default": false,
            "title": "Is Suspended",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "paid": {
            "default": false,
            "title": "Paid",
            "type": "boolean"
          },
          "plan_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Plan Id",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/TenantStatus",
            "default": "active"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "voicebox_enabled": {
            "default": false,
            "title": "Voicebox Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "plan_id",
          "billing_email",
          "created_at",
          "updated_at"
        ],
        "title": "TenantRead",
        "type": "object"
      },
      "TenantSkillVisibilityScopeUpdate": {
        "description": "PUT body for ``/tenants/{tenant_id}/skill-visibility-scope-default``.\n\nSets the tenant-wide default that seeds ``skill_visibility_scope`` on\nnewly created agents. Existing agents are not retroactively changed.\nSee issue #550 and SkillVisibilityScope in models/agent.py.",
        "properties": {
          "default_skill_visibility_scope": {
            "enum": [
              "private_only",
              "tenant_allowed"
            ],
            "title": "Default Skill Visibility Scope",
            "type": "string"
          }
        },
        "required": [
          "default_skill_visibility_scope"
        ],
        "title": "TenantSkillVisibilityScopeUpdate",
        "type": "object"
      },
      "TenantStatus": {
        "description": "Tenant lifecycle status, orthogonal to the Stripe subscription state.\n\n``pending_payment`` \u2014 tenant created but Stripe checkout not yet completed.\n``active`` \u2014 fully usable (FREE auto-activates; paid activates on checkout).\n``suspended`` \u2014 administratively suspended; all mutating operations blocked.",
        "enum": [
          "pending_payment",
          "active",
          "suspended"
        ],
        "title": "TenantStatus",
        "type": "string"
      },
      "TenantThemeExtra": {
        "description": "Validated shape for ``tenant_brand.theme_extra``.\n\n``light`` / ``dark`` are each an optional ``{token: \"#RRGGBB\"}`` map. Both\nthe token names (must be in :data:`BRAND_TOKENS`) and the values (must match\n``#RRGGBB``) are validated, so a bad token name or an injection payload is a\n422 and can never reach a rendered ``<style>``. ``extra=\"forbid\"`` rejects\nany top-level key other than ``light`` / ``dark``.",
        "properties": {
          "dark": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dark"
          },
          "light": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Light"
          }
        },
        "title": "TenantThemeExtra",
        "type": "object"
      },
      "TenantTracingResponse": {
        "description": "Where this tenant's traces live. Never carries a credential.",
        "properties": {
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Langfuse Project id, or null when not provisioned.",
            "title": "Project Id"
          },
          "provisioned": {
            "description": "True once this tenant has a Langfuse Project. False while Langfuse is disabled for the deployment, or before the provisioner has reached this tenant.",
            "title": "Provisioned",
            "type": "boolean"
          }
        },
        "required": [
          "provisioned"
        ],
        "title": "TenantTracingResponse",
        "type": "object"
      },
      "TenantUpdate": {
        "properties": {
          "allow_superadmin_access": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Superadmin Access"
          },
          "billing_email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Email"
          },
          "external_mail_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Mail Enabled"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 255,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "voicebox_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voicebox Enabled"
          }
        },
        "title": "TenantUpdate",
        "type": "object"
      },
      "TenantUserPermissionRead": {
        "description": "Effective permissions for a user in a tenant.",
        "properties": {
          "can_create_agents": {
            "default": true,
            "title": "Can Create Agents",
            "type": "boolean"
          },
          "can_create_skills": {
            "default": true,
            "title": "Can Create Skills",
            "type": "boolean"
          },
          "can_invite_users": {
            "default": false,
            "title": "Can Invite Users",
            "type": "boolean"
          },
          "can_manage_settings": {
            "default": false,
            "title": "Can Manage Settings",
            "type": "boolean"
          },
          "can_view_billing": {
            "default": false,
            "title": "Can View Billing",
            "type": "boolean"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "id": {
            "anyOf": [
              {
                "maxLength": 25,
                "minLength": 25,
                "pattern": "^c[a-z0-9]{24}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "user_id"
        ],
        "title": "TenantUserPermissionRead",
        "type": "object"
      },
      "TenantUserPermissionUpdate": {
        "description": "Update body \u2014 all fields optional so callers can patch a subset.",
        "properties": {
          "can_create_agents": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Create Agents"
          },
          "can_create_skills": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Create Skills"
          },
          "can_invite_users": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Invite Users"
          },
          "can_manage_settings": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can Manage Settings"
          },
          "can_view_billing": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Can View Billing"
          }
        },
        "title": "TenantUserPermissionUpdate",
        "type": "object"
      },
      "ThemePreference": {
        "description": "UI appearance preference (issue #161).\n\nThe value set is owned here rather than by a PG enum so it can grow\nwithout a migration \u2014 ``user.theme_preference`` is plain text with a\nCHECK, the same shape as ``timezone`` / ``locale``. Keep the CHECK in\nmigration ``0224_user_theme_preference`` in lockstep with this enum.",
        "enum": [
          "system",
          "light",
          "dark"
        ],
        "title": "ThemePreference",
        "type": "string"
      },
      "ThreadCreateRequest": {
        "properties": {
          "metadata": {
            "title": "Metadata",
            "type": "object"
          }
        },
        "title": "ThreadCreateRequest",
        "type": "object"
      },
      "ThreadObject": {
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "metadata": {
            "title": "Metadata",
            "type": "object"
          },
          "object": {
            "const": "thread",
            "title": "Object",
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at"
        ],
        "title": "ThreadObject",
        "type": "object"
      },
      "ToolAdminRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "has_embedding": {
            "title": "Has Embedding",
            "type": "boolean"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "display_name",
          "description",
          "is_active",
          "has_embedding",
          "created_at",
          "updated_at"
        ],
        "title": "ToolAdminRead",
        "type": "object"
      },
      "ToolBundleRead": {
        "description": "One bundle as shown to a tenant admin choosing what to grant.\n\n``tool_count`` is the size of the bundle's membership, not its contents \u2014\nthe grant decision needs \"how much is this\", and the full tool list is a\nseparate, larger read. Both shipped bundles are empty for now (a follow-up\nMR fills them), so this reads ``0``.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "is_builtin": {
            "title": "Is Builtin",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "tenant_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tenant Id"
          },
          "tool_count": {
            "default": 0,
            "title": "Tool Count",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "description",
          "is_builtin",
          "tenant_id",
          "created_at"
        ],
        "title": "ToolBundleRead",
        "type": "object"
      },
      "ToolSyncResult": {
        "properties": {
          "embedded": {
            "title": "Embedded",
            "type": "boolean"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "id",
          "embedded"
        ],
        "title": "ToolSyncResult",
        "type": "object"
      },
      "ToolTenantRead": {
        "description": "Read-only tool-catalogue row for the tenant-admin Organization surface.\n\nTenants don't own tools \u2014 the catalogue is platform-wide and enablement is\nper-agent. This is the inventory a tenant admin browses to see which tools\ntheir agents can be granted. Drops the SuperAdmin-only embedding/timestamp\nfields carried by ``ToolAdminRead``.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "display_name",
          "description",
          "is_active"
        ],
        "title": "ToolTenantRead",
        "type": "object"
      },
      "ToolToggleRequest": {
        "properties": {
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          }
        },
        "required": [
          "is_active"
        ],
        "title": "ToolToggleRequest",
        "type": "object"
      },
      "TrajectoryBuilder": {
        "enum": [
          "per_request",
          "prefix_merging"
        ],
        "title": "TrajectoryBuilder",
        "type": "string"
      },
      "TranscriptSearchHit": {
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "message_id": {
            "title": "Message Id",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "score": {
            "description": "Relevance score. Meaning depends on the request's mode: ts_rank for keyword (1.0 for a date/agent-only filter with no query), 1 - cosine distance for vector, RRF fused score for hybrid. Not comparable across modes or across requests \u2014 treat as an ordering signal only.",
            "title": "Score",
            "type": "number"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "session_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Title"
          },
          "snippet": {
            "title": "Snippet",
            "type": "string"
          },
          "tenant_id": {
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "message_id",
          "session_id",
          "session_title",
          "tenant_id",
          "agent_id",
          "agent_name",
          "role",
          "snippet",
          "created_at",
          "score"
        ],
        "title": "TranscriptSearchHit",
        "type": "object"
      },
      "TranscriptSearchMode": {
        "description": "Ranking algorithm, per docs/content/transcript-search.md \u00a7 Vector pass (issue #3290 item 1).\n\n``keyword`` (default, v1 behaviour) \u2014 BM25 ``ts_rank`` over ``search_tsv``.\n``vector`` \u2014 cosine similarity over ``task_message.embedding``.\n``hybrid`` \u2014 both legs fused via reciprocal rank fusion, same shape as\n``docs/content/tool-skill-routing.md``.\n\n``vector``/``hybrid`` silently degrade to ``keyword`` (the response's\n``degraded_to`` is set) when there's no query text to embed, no tenant to\nbill the broker call against, or the broker call fails \u2014 the search\nitself never errors on a degraded embedding path.",
        "enum": [
          "keyword",
          "vector",
          "hybrid"
        ],
        "title": "TranscriptSearchMode",
        "type": "string"
      },
      "TranscriptSearchResponse": {
        "properties": {
          "degraded_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set to 'keyword' when a vector/hybrid request degraded to the keyword-only leg (no query to embed, no tenant to bill the embed call against, or a broker outage). Null otherwise.",
            "title": "Degraded To"
          },
          "next_page_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Page Token"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/TranscriptSearchHit"
            },
            "title": "Results",
            "type": "array"
          }
        },
        "required": [
          "results"
        ],
        "title": "TranscriptSearchResponse",
        "type": "object"
      },
      "TranscriptSearchScope": {
        "description": "Who the search reaches, per docs/content/transcript-search.md \u00a7 Scope of search.\n\n``mine`` \u2014 every authenticated user, sessions they created.\n``tenant`` \u2014 tenant OWNER/ADMIN only, every session in the active tenant.\n``super`` \u2014 SuperAdmin only, every session platform-wide.",
        "enum": [
          "mine",
          "tenant",
          "super"
        ],
        "title": "TranscriptSearchScope",
        "type": "string"
      },
      "TranscriptTurn": {
        "description": "One ``task_message`` row attached to a citation record (issue #1661).\n\nReturned by ``GET /api/internal/sessions/{s}/memory/{memory_id}`` when the\nmemory was pinned to a transcript turn via ``source_message_id``. ``role``\nis the raw ``task_message_role`` enum value (``user`` / ``assistant`` /\n``tool`` / ``system``); ``content`` is the message JSON exactly as\npersisted so the trace viewer can render whichever shape it expects\n(plain text, tool call, file view, etc.) without a server-side\ntranslation step.",
        "properties": {
          "content": {
            "title": "Content",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "session_id",
          "role",
          "content",
          "created_at"
        ],
        "title": "TranscriptTurn",
        "type": "object"
      },
      "UsageBucket": {
        "properties": {
          "byok_cost_cents": {
            "default": 0,
            "title": "Byok Cost Cents",
            "type": "integer"
          },
          "byok_cost_micro_usd": {
            "default": 0,
            "title": "Byok Cost Micro Usd",
            "type": "integer"
          },
          "cache_read_tokens": {
            "default": 0,
            "title": "Cache Read Tokens",
            "type": "integer"
          },
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "call_count": {
            "title": "Call Count",
            "type": "integer"
          },
          "completion_tokens": {
            "title": "Completion Tokens",
            "type": "integer"
          },
          "cost_cents": {
            "title": "Cost Cents",
            "type": "integer"
          },
          "cost_micro_usd": {
            "default": 0,
            "title": "Cost Micro Usd",
            "type": "integer"
          },
          "group_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group Key"
          },
          "group_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group Label"
          },
          "prompt_tokens": {
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "provider_cost_cents": {
            "default": 0,
            "title": "Provider Cost Cents",
            "type": "integer"
          },
          "provider_cost_micro_usd": {
            "default": 0,
            "title": "Provider Cost Micro Usd",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          },
          "ts": {
            "format": "date-time",
            "title": "Ts",
            "type": "string"
          }
        },
        "required": [
          "ts",
          "prompt_tokens",
          "completion_tokens",
          "total_tokens",
          "cost_cents",
          "call_count"
        ],
        "title": "UsageBucket",
        "type": "object"
      },
      "UsageRead": {
        "description": "Month-to-date model-broker usage rollup.\n\nSee decision #25 / docs/content/billing.md. ``cost_*`` is the billed\nfigure \u2014 provider cost with the plan's token markup applied per row; BYOK\ncalls are never billed (issue #353) \u2014 ``provider_cost_*`` the raw cost of\nthose billed calls, and ``byok_cost_*`` the provider cost of the BYOK\ncalls (paid to the tenant's own vendor; shown, not charged).",
        "properties": {
          "byok_cost_cents": {
            "default": 0,
            "title": "Byok Cost Cents",
            "type": "integer"
          },
          "byok_cost_micro_usd": {
            "default": 0,
            "title": "Byok Cost Micro Usd",
            "type": "integer"
          },
          "byok_request_count": {
            "default": 0,
            "title": "Byok Request Count",
            "type": "integer"
          },
          "cache_hit_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cache Hit Rate"
          },
          "cache_read_tokens": {
            "default": 0,
            "title": "Cache Read Tokens",
            "type": "integer"
          },
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "completion_tokens": {
            "title": "Completion Tokens",
            "type": "integer"
          },
          "cost_cents": {
            "title": "Cost Cents",
            "type": "integer"
          },
          "cost_micro_usd": {
            "default": 0,
            "title": "Cost Micro Usd",
            "type": "integer"
          },
          "prompt_tokens": {
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "provider_cost_cents": {
            "default": 0,
            "title": "Provider Cost Cents",
            "type": "integer"
          },
          "provider_cost_micro_usd": {
            "default": 0,
            "title": "Provider Cost Micro Usd",
            "type": "integer"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          },
          "window": {
            "$ref": "#/components/schemas/UsageWindow"
          }
        },
        "required": [
          "window",
          "prompt_tokens",
          "completion_tokens",
          "total_tokens",
          "cost_cents",
          "request_count"
        ],
        "title": "UsageRead",
        "type": "object"
      },
      "UsageReportRead": {
        "properties": {
          "buckets": {
            "items": {
              "$ref": "#/components/schemas/UsageBucket"
            },
            "title": "Buckets",
            "type": "array"
          },
          "totals": {
            "$ref": "#/components/schemas/UsageTotals"
          }
        },
        "required": [
          "buckets",
          "totals"
        ],
        "title": "UsageReportRead",
        "type": "object"
      },
      "UsageSummary30d": {
        "properties": {
          "total_byok_cost_cents": {
            "default": 0,
            "title": "Total Byok Cost Cents",
            "type": "integer"
          },
          "total_byok_cost_micro_usd": {
            "default": 0,
            "title": "Total Byok Cost Micro Usd",
            "type": "integer"
          },
          "total_cache_read_tokens": {
            "default": 0,
            "title": "Total Cache Read Tokens",
            "type": "integer"
          },
          "total_cache_write_tokens": {
            "default": 0,
            "title": "Total Cache Write Tokens",
            "type": "integer"
          },
          "total_calls": {
            "title": "Total Calls",
            "type": "integer"
          },
          "total_completion_tokens": {
            "title": "Total Completion Tokens",
            "type": "integer"
          },
          "total_cost_cents": {
            "title": "Total Cost Cents",
            "type": "integer"
          },
          "total_cost_micro_usd": {
            "default": 0,
            "title": "Total Cost Micro Usd",
            "type": "integer"
          },
          "total_prompt_tokens": {
            "title": "Total Prompt Tokens",
            "type": "integer"
          },
          "total_provider_cost_cents": {
            "default": 0,
            "title": "Total Provider Cost Cents",
            "type": "integer"
          },
          "total_provider_cost_micro_usd": {
            "default": 0,
            "title": "Total Provider Cost Micro Usd",
            "type": "integer"
          }
        },
        "required": [
          "total_calls",
          "total_prompt_tokens",
          "total_completion_tokens",
          "total_cost_cents"
        ],
        "title": "UsageSummary30d",
        "type": "object"
      },
      "UsageTotals": {
        "properties": {
          "byok_cost_cents": {
            "default": 0,
            "title": "Byok Cost Cents",
            "type": "integer"
          },
          "byok_cost_micro_usd": {
            "default": 0,
            "title": "Byok Cost Micro Usd",
            "type": "integer"
          },
          "cache_hit_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cache Hit Rate"
          },
          "cache_read_tokens": {
            "default": 0,
            "title": "Cache Read Tokens",
            "type": "integer"
          },
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "call_count": {
            "title": "Call Count",
            "type": "integer"
          },
          "completion_tokens": {
            "title": "Completion Tokens",
            "type": "integer"
          },
          "cost_cents": {
            "title": "Cost Cents",
            "type": "integer"
          },
          "cost_micro_usd": {
            "default": 0,
            "title": "Cost Micro Usd",
            "type": "integer"
          },
          "prompt_tokens": {
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "provider_cost_cents": {
            "default": 0,
            "title": "Provider Cost Cents",
            "type": "integer"
          },
          "provider_cost_micro_usd": {
            "default": 0,
            "title": "Provider Cost Micro Usd",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens",
          "cost_cents",
          "call_count"
        ],
        "title": "UsageTotals",
        "type": "object"
      },
      "UsageWindow": {
        "description": "Inclusive start, exclusive end. UTC.",
        "properties": {
          "end": {
            "format": "date-time",
            "title": "End",
            "type": "string"
          },
          "start": {
            "format": "date-time",
            "title": "Start",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end"
        ],
        "title": "UsageWindow",
        "type": "object"
      },
      "UserApiKeyCreate": {
        "properties": {
          "label": {
            "title": "Label",
            "type": "string"
          },
          "scopes": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "label"
        ],
        "title": "UserApiKeyCreate",
        "type": "object"
      },
      "UserApiKeyCreated": {
        "description": "Returned once, on creation. `key` is the one chance to copy it.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "label",
          "scopes",
          "last_used_at",
          "created_at",
          "revoked_at",
          "key"
        ],
        "title": "UserApiKeyCreated",
        "type": "object"
      },
      "UserApiKeyRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "label",
          "scopes",
          "last_used_at",
          "created_at",
          "revoked_at"
        ],
        "title": "UserApiKeyRead",
        "type": "object"
      },
      "UserCostAgentRow": {
        "description": "One agent a user's spend went to, inside a :class:`UserCostRow`.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "agent_name": {
            "title": "Agent Name",
            "type": "string"
          },
          "cost_usd": {
            "title": "Cost Usd",
            "type": "number"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          }
        },
        "required": [
          "agent_id",
          "agent_name",
          "requests",
          "cost_usd"
        ],
        "title": "UserCostAgentRow",
        "type": "object"
      },
      "UserCostRow": {
        "description": "One row in the per-user cost breakdown table.\n\n``user_id`` is ``None`` for spend that no longer resolves to a person \u2014\n``task_session.created_by_id`` is ``ON DELETE SET NULL`` and platform-\ninitiated anchor sessions never carry one. Those rows are surfaced rather\nthan dropped so the per-user column still sums to ``total_cost_usd``.",
        "properties": {
          "agents": {
            "items": {
              "$ref": "#/components/schemas/UserCostAgentRow"
            },
            "title": "Agents",
            "type": "array"
          },
          "byok_cost_usd": {
            "default": 0.0,
            "title": "Byok Cost Usd",
            "type": "number"
          },
          "cost_usd": {
            "title": "Cost Usd",
            "type": "number"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "provider_cost_usd": {
            "default": 0.0,
            "title": "Provider Cost Usd",
            "type": "number"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          },
          "sessions": {
            "title": "Sessions",
            "type": "integer"
          },
          "top_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Model"
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          }
        },
        "required": [
          "sessions",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_usd"
        ],
        "title": "UserCostRow",
        "type": "object"
      },
      "UserCostsResponse": {
        "description": "Full response for ``GET /tenant/{tenant_id}/billing/user-costs``.",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/CostPeriod"
          },
          "top_tasks": {
            "items": {
              "$ref": "#/components/schemas/ExpensiveTaskRow"
            },
            "title": "Top Tasks",
            "type": "array"
          },
          "total_byok_cost_usd": {
            "default": 0.0,
            "title": "Total Byok Cost Usd",
            "type": "number"
          },
          "total_cost_usd": {
            "title": "Total Cost Usd",
            "type": "number"
          },
          "total_provider_cost_usd": {
            "default": 0.0,
            "title": "Total Provider Cost Usd",
            "type": "number"
          },
          "users": {
            "items": {
              "$ref": "#/components/schemas/UserCostRow"
            },
            "title": "Users",
            "type": "array"
          }
        },
        "required": [
          "period",
          "users",
          "top_tasks",
          "total_cost_usd"
        ],
        "title": "UserCostsResponse",
        "type": "object"
      },
      "UserModelGrant": {
        "properties": {
          "access": {
            "enum": [
              "full",
              "read_only"
            ],
            "title": "Access",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id"
        ],
        "title": "UserModelGrant",
        "type": "object"
      },
      "UserModelGroupGrant": {
        "description": "Layer-2 grant to a **group** (#424) \u2014 the group grantee of ``user_model``.\n\n``group_id`` is a tenant-group id; a group from another tenant returns 404.\nEvery user member of the group is granted the model, honoured identically by\nthe broker's invoke gate.",
        "properties": {
          "access": {
            "enum": [
              "full",
              "read_only"
            ],
            "title": "Access",
            "type": "string"
          },
          "group_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Group Id",
            "type": "string"
          }
        },
        "required": [
          "group_id"
        ],
        "title": "UserModelGroupGrant",
        "type": "object"
      },
      "UserModelGroupRead": {
        "properties": {
          "access": {
            "title": "Access",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "group_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Group Id",
            "type": "string"
          },
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          }
        },
        "required": [
          "group_id",
          "model_id",
          "access",
          "created_at"
        ],
        "title": "UserModelGroupRead",
        "type": "object"
      },
      "UserModelRead": {
        "properties": {
          "access": {
            "title": "Access",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "model_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Model Id",
            "type": "string"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "model_id",
          "access",
          "created_at"
        ],
        "title": "UserModelRead",
        "type": "object"
      },
      "UserPreferencesUpdate": {
        "description": "Body of ``POST /me/preferences`` \u2014 the caller's *own* preferences.\n\nDeliberately tiny. The route resolves the target user from the request\ncontext, never from the body, so there is no ``user_id`` / ``tenant_id``\n/ ``is_super_admin`` field to smuggle: any such key is simply ignored by\npydantic (mass-assignment defense, exercised in\n``tests/routes/test_me_preferences_security.py``).",
        "properties": {
          "theme_preference": {
            "$ref": "#/components/schemas/ThemePreference"
          }
        },
        "required": [
          "theme_preference"
        ],
        "title": "UserPreferencesUpdate",
        "type": "object"
      },
      "UserRead": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "image": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image"
          },
          "is_super_admin": {
            "title": "Is Super Admin",
            "type": "boolean"
          },
          "is_suspended": {
            "title": "Is Suspended",
            "type": "boolean"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "theme_preference": {
            "$ref": "#/components/schemas/ThemePreference"
          },
          "timezone": {
            "title": "Timezone",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "image",
          "timezone",
          "theme_preference",
          "is_super_admin",
          "is_suspended",
          "created_at"
        ],
        "title": "UserRead",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "type": "string"
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "ValkeyMemoryCreate": {
        "description": "Body for ``POST /memories`` \u2014 the ``remember`` action of ``manage_memory``.\n\n``kind`` follows the memory-kind taxonomy (issue #1653): one of\n``episodic`` / ``semantic`` / ``procedural`` / ``reflective`` or a\nwell-formed ``custom:<slug>`` value. Unknown bare kinds 422.",
        "properties": {
          "content": {
            "maxLength": 50000,
            "minLength": 1,
            "title": "Content",
            "type": "string"
          },
          "kind": {
            "default": "episodic",
            "maxLength": 64,
            "minLength": 1,
            "title": "Kind",
            "type": "string"
          },
          "scope": {
            "anyOf": [
              {
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scope"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 20,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags"
          },
          "triggers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 20,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Triggers"
          },
          "ttl_seconds": {
            "anyOf": [
              {
                "maximum": 31536000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ttl Seconds"
          }
        },
        "required": [
          "content"
        ],
        "title": "ValkeyMemoryCreate",
        "type": "object"
      },
      "ValkeyMemoryCreated": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "title": "ValkeyMemoryCreated",
        "type": "object"
      },
      "ValkeyMemoryKindUpdate": {
        "description": "Body for ``PATCH /memories/{id}/kind`` \u2014 the ``update_kind`` action.\n\n``kind`` follows the taxonomy in :class:`ValkeyMemoryCreate` (issue #1653);\na 422 fires on unknown bare kinds. ``custom:*`` reclassification is\naccepted (e.g. promoting a ``custom:billing-note`` to ``semantic``).",
        "properties": {
          "kind": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Kind",
            "type": "string"
          }
        },
        "required": [
          "kind"
        ],
        "title": "ValkeyMemoryKindUpdate",
        "type": "object"
      },
      "ValkeyMemoryListResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "memories": {
            "items": {
              "$ref": "#/components/schemas/ValkeyMemoryRead"
            },
            "title": "Memories",
            "type": "array"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "memories",
          "total",
          "offset",
          "limit"
        ],
        "title": "ValkeyMemoryListResponse",
        "type": "object"
      },
      "ValkeyMemoryRead": {
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "scope": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scope"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "session_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Title"
          },
          "user_display": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Display"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "id",
          "content",
          "kind"
        ],
        "title": "ValkeyMemoryRead",
        "type": "object"
      },
      "ValkeyMemorySearchHit": {
        "description": "One hit from the public ``GET /memories/search`` hybrid search (#3037).\n\n``score`` is the cosine **distance** from the vector leg (0 == identical)\nwhen the atom surfaced there; it is ``None`` for a lexical-only hit \u2014 an\nexact-token match that carried no vector signal (a random nonce), which is\nprecisely the case pure KNN could not surface. ``rrf_score`` is the fused\nreciprocal-rank score the results are ordered by, and ``match_type`` records\nwhich leg(s) found the atom (``vector`` / ``lexical`` / ``hybrid``). The\nthree fields are additive; a client that only reads ``id`` / ``content``\nkeeps working unchanged.",
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "match_type": {
            "default": "vector",
            "title": "Match Type",
            "type": "string"
          },
          "rrf_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rrf Score"
          },
          "scope": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scope"
          },
          "score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Score"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "session_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Title"
          },
          "user_display": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Display"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "id",
          "content",
          "kind"
        ],
        "title": "ValkeyMemorySearchHit",
        "type": "object"
      },
      "ValkeyMemorySearchResponse": {
        "properties": {
          "hits": {
            "items": {
              "$ref": "#/components/schemas/ValkeyMemorySearchHit"
            },
            "title": "Hits",
            "type": "array"
          }
        },
        "required": [
          "hits"
        ],
        "title": "ValkeyMemorySearchResponse",
        "type": "object"
      },
      "ValkeyMemoryUpdate": {
        "properties": {
          "content": {
            "maxLength": 50000,
            "minLength": 1,
            "title": "Content",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "title": "ValkeyMemoryUpdate",
        "type": "object"
      },
      "VerifyEmailRequest": {
        "properties": {
          "token": {
            "minLength": 1,
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "VerifyEmailRequest",
        "type": "object"
      },
      "VideoRouteCreate": {
        "properties": {
          "config": {
            "title": "Config",
            "type": "object"
          },
          "direction": {
            "pattern": "^(in|out)$",
            "title": "Direction",
            "type": "string"
          },
          "recording_enabled": {
            "default": false,
            "title": "Recording Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "direction"
        ],
        "title": "VideoRouteCreate",
        "type": "object"
      },
      "VideoRouteRead": {
        "description": "Read shape for `video:read` callers. Excludes the RTMP `token`, which\nis a publish/egress credential and is only returned from write-gated\noperations (POST). See schemas/CLAUDE.md.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "config": {
            "title": "Config",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "direction": {
            "title": "Direction",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "recording_enabled": {
            "title": "Recording Enabled",
            "type": "boolean"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "direction",
          "recording_enabled",
          "config",
          "created_at"
        ],
        "title": "VideoRouteRead",
        "type": "object"
      },
      "VideoRouteUpdate": {
        "properties": {
          "config": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "recording_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recording Enabled"
          }
        },
        "title": "VideoRouteUpdate",
        "type": "object"
      },
      "VideoRouteWithToken": {
        "description": "Returned only by `video:write` operations that mint or rotate a token.",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "config": {
            "title": "Config",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "direction": {
            "title": "Direction",
            "type": "string"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "recording_enabled": {
            "title": "Recording Enabled",
            "type": "boolean"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "direction",
          "recording_enabled",
          "config",
          "created_at",
          "token"
        ],
        "title": "VideoRouteWithToken",
        "type": "object"
      },
      "VoiceConfigRead": {
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "speed": {
            "title": "Speed",
            "type": "number"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "voice_id": {
            "title": "Voice Id",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "user_id",
          "provider",
          "voice_id",
          "speed"
        ],
        "title": "VoiceConfigRead",
        "type": "object"
      },
      "VoiceConfigUpsert": {
        "properties": {
          "provider": {
            "enum": [
              "browser",
              "voicebox"
            ],
            "title": "Provider",
            "type": "string"
          },
          "speed": {
            "default": 1.0,
            "maximum": 4.0,
            "minimum": 0.25,
            "title": "Speed",
            "type": "number"
          },
          "voice_id": {
            "maxLength": 200,
            "title": "Voice Id",
            "type": "string"
          }
        },
        "required": [
          "voice_id"
        ],
        "title": "VoiceConfigUpsert",
        "type": "object"
      },
      "VoiceOptionsRead": {
        "description": "Voice providers available to the calling user for this agent.\n\n``voicebox_enabled`` mirrors ``tenant.voicebox_enabled`` \u2014 exposed on the\nagent-scoped voice route (gated by ``agent:read``) because plain members\ndon't hold ``tenant:read`` but the chat and voice-preferences surfaces\nstill need to know whether to offer the Voicebox option.",
        "properties": {
          "voicebox_enabled": {
            "title": "Voicebox Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "voicebox_enabled"
        ],
        "title": "VoiceOptionsRead",
        "type": "object"
      },
      "VoiceProfileItem": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "title": "VoiceProfileItem",
        "type": "object"
      },
      "VoiceProfilesRead": {
        "properties": {
          "profiles": {
            "items": {
              "$ref": "#/components/schemas/VoiceProfileItem"
            },
            "title": "Profiles",
            "type": "array"
          }
        },
        "required": [
          "profiles"
        ],
        "title": "VoiceProfilesRead",
        "type": "object"
      },
      "VoiceTranscribeRequest": {
        "description": "POST ``.../voice/transcribe`` body.\n\n``audio_base64`` is the browser's MediaRecorder clip (webm/opus by\ndefault). It is ClamAV-scanned server-side before the broker sees it\n(decision #24).",
        "properties": {
          "audio_base64": {
            "minLength": 1,
            "title": "Audio Base64",
            "type": "string"
          },
          "filename": {
            "default": "recording.webm",
            "maxLength": 200,
            "title": "Filename",
            "type": "string"
          },
          "language": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Language"
          }
        },
        "required": [
          "audio_base64"
        ],
        "title": "VoiceTranscribeRequest",
        "type": "object"
      },
      "VoiceTranscribeResponse": {
        "properties": {
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "title": "VoiceTranscribeResponse",
        "type": "object"
      },
      "VoiceTtsRequest": {
        "description": "POST ``.../voice/tts`` body.\n\n``voice_id`` is a Voicebox voice-profile id (see ``.../voice/profiles``).\n``speed`` is echoed for parity with ``agent_user_voice.speed`` but\nplayback speed is applied client-side \u2014 Voicebox synthesizes at natural\nspeed. The 4096-char cap mirrors the broker TTS route's own limit.\n``response_format`` defaults to ``\"wav\"`` (today's behavior, unchanged);\n``\"opus\"`` asks the broker's Voicebox provider to transcode via ffmpeg\n(issue #3230) for a materially smaller payload \u2014 useful on constrained\nconnections (e.g. a car's cellular link).",
        "properties": {
          "response_format": {
            "enum": [
              "wav",
              "opus"
            ],
            "title": "Response Format",
            "type": "string"
          },
          "speed": {
            "default": 1.0,
            "maximum": 4.0,
            "minimum": 0.25,
            "title": "Speed",
            "type": "number"
          },
          "text": {
            "maxLength": 4096,
            "minLength": 1,
            "title": "Text",
            "type": "string"
          },
          "voice_id": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Voice Id",
            "type": "string"
          }
        },
        "required": [
          "text",
          "voice_id"
        ],
        "title": "VoiceTtsRequest",
        "type": "object"
      },
      "VoiceTtsResponse": {
        "properties": {
          "audio_base64": {
            "title": "Audio Base64",
            "type": "string"
          },
          "format": {
            "title": "Format",
            "type": "string"
          }
        },
        "required": [
          "audio_base64",
          "format"
        ],
        "title": "VoiceTtsResponse",
        "type": "object"
      },
      "WebhookAck": {
        "description": "Stripe wants 2xx; the body is purely diagnostic.",
        "properties": {
          "status": {
            "enum": [
              "ok",
              "already_processed",
              "ignored"
            ],
            "title": "Status",
            "type": "string"
          },
          "stripe_event_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Event Id"
          },
          "type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          }
        },
        "required": [
          "status"
        ],
        "title": "WebhookAck",
        "type": "object"
      },
      "WebhookProvider": {
        "description": "Inbound webhook providers we verify end-to-end.\n\nEach entry corresponds to a provider adapter in\n``services/webhook_providers.py``. ``generic`` is the fallback for\nintegrations that just send a plain HMAC-SHA256 hex digest in\n``X-Webhook-Signature``.",
        "enum": [
          "github",
          "slack",
          "stripe",
          "zoom",
          "twilio",
          "google_meet",
          "generic"
        ],
        "title": "WebhookProvider",
        "type": "string"
      },
      "WebhookRouteCreate": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "auto_start": {
            "default": true,
            "title": "Auto Start",
            "type": "boolean"
          },
          "filters": {
            "title": "Filters",
            "type": "object"
          },
          "is_active": {
            "default": true,
            "title": "Is Active",
            "type": "boolean"
          },
          "provider": {
            "$ref": "#/components/schemas/WebhookProvider"
          }
        },
        "required": [
          "agent_id",
          "provider"
        ],
        "title": "WebhookRouteCreate",
        "type": "object"
      },
      "WebhookRouteCreated": {
        "description": "Returned only on create \u2014 includes the raw secret (shown once).",
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "auto_start": {
            "title": "Auto Start",
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filters": {
            "title": "Filters",
            "type": "object"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "path_token": {
            "title": "Path Token",
            "type": "string"
          },
          "provider": {
            "$ref": "#/components/schemas/WebhookProvider"
          },
          "secret": {
            "title": "Secret",
            "type": "string"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "provider",
          "path_token",
          "filters",
          "is_active",
          "auto_start",
          "created_at",
          "updated_at",
          "secret"
        ],
        "title": "WebhookRouteCreated",
        "type": "object"
      },
      "WebhookRouteRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "auto_start": {
            "title": "Auto Start",
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filters": {
            "title": "Filters",
            "type": "object"
          },
          "id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Id",
            "type": "string"
          },
          "is_active": {
            "title": "Is Active",
            "type": "boolean"
          },
          "path_token": {
            "title": "Path Token",
            "type": "string"
          },
          "provider": {
            "$ref": "#/components/schemas/WebhookProvider"
          },
          "tenant_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Tenant Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "agent_id",
          "provider",
          "path_token",
          "filters",
          "is_active",
          "auto_start",
          "created_at",
          "updated_at"
        ],
        "title": "WebhookRouteRead",
        "type": "object"
      },
      "WidgetMessageCreate": {
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "title": "WidgetMessageCreate",
        "type": "object"
      },
      "WidgetMessageOut": {
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "id",
          "role",
          "content",
          "created_at"
        ],
        "title": "WidgetMessageOut",
        "type": "object"
      },
      "WidgetSessionCreate": {
        "properties": {
          "initial_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Message"
          }
        },
        "title": "WidgetSessionCreate",
        "type": "object"
      },
      "WidgetSessionOut": {
        "properties": {
          "agent_name": {
            "title": "Agent Name",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "widget_token": {
            "title": "Widget Token",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "widget_token",
          "agent_name"
        ],
        "title": "WidgetSessionOut",
        "type": "object"
      },
      "WikiAccessAgent": {
        "description": "One agent that can reach the wiki (or once could, if revoked).",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "grant_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Grant Id"
          },
          "granted_by_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Granted By Label"
          },
          "implicit": {
            "default": false,
            "title": "Implicit",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "scope": {
            "enum": [
              "tenant",
              "wiki"
            ],
            "title": "Scope",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "agent_id",
          "name",
          "tier",
          "scope"
        ],
        "title": "WikiAccessAgent",
        "type": "object"
      },
      "WikiAccessGroup": {
        "description": "A #198 tenant group the wiki is shared with, expandable to its roster.",
        "properties": {
          "exists": {
            "default": true,
            "title": "Exists",
            "type": "boolean"
          },
          "group_id": {
            "title": "Group Id",
            "type": "string"
          },
          "member_count": {
            "default": 0,
            "title": "Member Count",
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/WikiAccessGroupMember"
            },
            "title": "Members",
            "type": "array"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "group_id",
          "name"
        ],
        "title": "WikiAccessGroup",
        "type": "object"
      },
      "WikiAccessGroupMember": {
        "description": "One member of a granted group (a user or an agent).",
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "member_id": {
            "title": "Member Id",
            "type": "string"
          },
          "member_kind": {
            "enum": [
              "user",
              "agent"
            ],
            "title": "Member Kind",
            "type": "string"
          }
        },
        "required": [
          "member_kind",
          "member_id",
          "label"
        ],
        "title": "WikiAccessGroupMember",
        "type": "object"
      },
      "WikiAccessHuman": {
        "description": "One human who can read the wiki, and how they got that access.",
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "source": {
            "enum": [
              "direct",
              "group",
              "tenant"
            ],
            "title": "Source",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "via_group_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Via Group Id"
          },
          "via_group_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Via Group Name"
          }
        },
        "required": [
          "user_id",
          "label",
          "source"
        ],
        "title": "WikiAccessHuman",
        "type": "object"
      },
      "WikiAccessView": {
        "description": "``GET /tenant/{tenant_id}/kahala/wikis/{wiki_slug}/access``.",
        "properties": {
          "agents": {
            "items": {
              "$ref": "#/components/schemas/WikiAccessAgent"
            },
            "title": "Agents",
            "type": "array"
          },
          "groups": {
            "items": {
              "$ref": "#/components/schemas/WikiAccessGroup"
            },
            "title": "Groups",
            "type": "array"
          },
          "humans": {
            "items": {
              "$ref": "#/components/schemas/WikiAccessHuman"
            },
            "title": "Humans",
            "type": "array"
          },
          "posture": {
            "enum": [
              "open",
              "restricted"
            ],
            "title": "Posture",
            "type": "string"
          },
          "tenant_member_count": {
            "default": 0,
            "title": "Tenant Member Count",
            "type": "integer"
          },
          "tenant_wide_share": {
            "default": false,
            "title": "Tenant Wide Share",
            "type": "boolean"
          },
          "wiki": {
            "$ref": "#/components/schemas/KahalaWikiOption"
          }
        },
        "required": [
          "wiki",
          "posture"
        ],
        "title": "WikiAccessView",
        "type": "object"
      },
      "WorkspaceEntry": {
        "description": "One file in the session workspace (GCS is flat, so ``path`` is the key).",
        "properties": {
          "content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stored MIME type, if any",
            "title": "Content Type"
          },
          "path": {
            "description": "Path relative to the workspace root",
            "title": "Path",
            "type": "string"
          },
          "size": {
            "description": "Size in bytes",
            "title": "Size",
            "type": "integer"
          },
          "updated": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO-8601 last-modified time",
            "title": "Updated"
          }
        },
        "required": [
          "path",
          "size"
        ],
        "title": "WorkspaceEntry",
        "type": "object"
      },
      "WorkspaceFileContent": {
        "description": "A single file's content for the viewer/editor.\n\n``encoding`` selects how ``content``/``download_url`` are populated:\n\n* ``utf-8`` \u2014 ``content`` is the decoded text.\n* ``base64`` \u2014 ``content`` is base64 of a small binary file.\n* ``url`` \u2014 the file was too large to inline; ``download_url`` is a\n  short-lived signed GET URL.",
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          },
          "content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content Type"
          },
          "download_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Download Url"
          },
          "encoding": {
            "enum": [
              "utf-8",
              "base64",
              "url"
            ],
            "title": "Encoding",
            "type": "string"
          },
          "path": {
            "title": "Path",
            "type": "string"
          },
          "read_only": {
            "description": "Whether this session refuses edits (decision #32)",
            "title": "Read Only",
            "type": "boolean"
          },
          "size": {
            "title": "Size",
            "type": "integer"
          }
        },
        "required": [
          "path",
          "size",
          "encoding",
          "read_only"
        ],
        "title": "WorkspaceFileContent",
        "type": "object"
      },
      "WorkspaceFileWrite": {
        "description": "Create-or-overwrite request body.",
        "properties": {
          "content": {
            "description": "File content (text, or base64 when encoding=base64)",
            "title": "Content",
            "type": "string"
          },
          "encoding": {
            "description": "How to decode ``content`` before writing",
            "enum": [
              "utf-8",
              "base64"
            ],
            "title": "Encoding",
            "type": "string"
          },
          "path": {
            "description": "Path relative to the workspace root",
            "title": "Path",
            "type": "string"
          }
        },
        "required": [
          "path",
          "content"
        ],
        "title": "WorkspaceFileWrite",
        "type": "object"
      },
      "WorkspaceListing": {
        "description": "Flat listing of the session workspace; the UI rebuilds the tree from paths.",
        "properties": {
          "entries": {
            "items": {
              "$ref": "#/components/schemas/WorkspaceEntry"
            },
            "title": "Entries",
            "type": "array"
          },
          "read_only": {
            "description": "Whether this session refuses edits (decision #32)",
            "title": "Read Only",
            "type": "boolean"
          },
          "truncated": {
            "default": false,
            "description": "True when the listing was capped and is incomplete",
            "title": "Truncated",
            "type": "boolean"
          },
          "workdir": {
            "description": "The session's GCS workspace prefix",
            "title": "Workdir",
            "type": "string"
          }
        },
        "required": [
          "workdir",
          "entries",
          "read_only"
        ],
        "title": "WorkspaceListing",
        "type": "object"
      },
      "_CredentialStatus": {
        "description": "Response for ``GET /admin/openrouter/credential``.\n\n``available`` is True iff a non-empty key was successfully resolved.\n``source`` is ``\"tenant\"`` for a BYOK row, ``\"platform\"`` for the\nGSM / env fallback, and ``None`` when nothing is configured.",
        "properties": {
          "available": {
            "title": "Available",
            "type": "boolean"
          },
          "source": {
            "anyOf": [
              {
                "enum": [
                  "tenant",
                  "platform"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          }
        },
        "required": [
          "available"
        ],
        "title": "_CredentialStatus",
        "type": "object"
      },
      "_SyncBody": {
        "description": "Body for the catalogue-sync endpoint.\n\nSuperAdmin may paste an OpenRouter API key in the request body \u2014 when\nsupplied, it is forwarded through the broker to OpenRouter and never\npersisted. When omitted, the API resolves a stored credential via the\nBYOK cascade (tenant BYOK row \u2192 platform-pool \u2192 Google Secret Manager\n``gp-or-key``) so the operator can sync without re-typing the key on\nevery visit.",
        "properties": {
          "api_key": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key"
          }
        },
        "title": "_SyncBody",
        "type": "object"
      },
      "good_place_api__schemas__identity__AgentGrantRead": {
        "description": "Public projection of an ``agent_user_identity`` row.",
        "properties": {
          "agent_id": {
            "title": "Agent Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "granted_by_user_id": {
            "title": "Granted By User Id",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "linked_identity_id": {
            "title": "Linked Identity Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "agent_id",
          "linked_identity_id",
          "granted_by_user_id",
          "created_at"
        ],
        "title": "AgentGrantRead",
        "type": "object"
      },
      "good_place_api__schemas__rbac__AgentGrantRead": {
        "properties": {
          "agent_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "Agent Id",
            "type": "string"
          },
          "role": {
            "anyOf": [
              {
                "enum": [
                  "VIEWER",
                  "EDITOR"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          },
          "user_id": {
            "maxLength": 25,
            "minLength": 25,
            "pattern": "^c[a-z0-9]{24}$",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "agent_id",
          "role"
        ],
        "title": "AgentGrantRead",
        "type": "object"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "good-place API",
    "version": "0.0.2"
  },
  "openapi": "3.1.0",
  "paths": {
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "MCP OAuth_oauth_authorization_server_metadata",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Oauth Authorization Server Metadata",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "operationId": "MCP OAuth_oauth_protected_resource_metadata",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Oauth Protected Resource Metadata",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/api/healthz": {
      "get": {
        "operationId": "healthz",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Healthz",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Healthz"
      }
    },
    "/api/sample-use-cases": {
      "get": {
        "description": "Public endpoint: return active sample use cases ordered by display_order.",
        "operationId": "sample_use_cases_list_active_use_cases",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SampleUseCaseRead"
                  },
                  "title": "Response Sample Use Cases List Active Use Cases",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Active Use Cases",
        "tags": [
          "sample-use-cases"
        ]
      }
    },
    "/api/sample-use-cases/{use_case_id}/icon": {
      "get": {
        "description": "Public endpoint: stream the icon bytes for a sample use case.\n\n``stream_icon`` prefetches the first chunk, so an open / read failure\nagainst GCS lands here as :class:`BrandStorageError` before the\n``StreamingResponse`` is constructed \u2014 we map that to a 502 instead of\na half-sent 200.",
        "operationId": "sample_use_cases_fetch_use_case_icon",
        "parameters": [
          {
            "in": "path",
            "name": "use_case_id",
            "required": true,
            "schema": {
              "title": "Use Case Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fetch Use Case Icon",
        "tags": [
          "sample-use-cases"
        ]
      }
    },
    "/api/status/timeline": {
      "get": {
        "operationId": "status_alerts_list_timeline",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/StatusAlertTimelineRead"
                  },
                  "title": "Response Status Alerts List Timeline",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Timeline",
        "tags": [
          "status-alerts"
        ]
      }
    },
    "/api/v1/admin/agents/{agent_id}/tenant": {
      "put": {
        "description": "SuperAdmin: reassign an agent to a different tenant.\n\nValidates the target tenant, re-evaluates model assignments and\ntenant-scoped integrations, updates ``agent.tenant_id``, and returns\nthe updated agent together with model conflicts and integration warnings.",
        "operationId": "admin_reassign_agent_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReassignAgentTenantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReassignAgentTenantResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Reassign Agent Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/allowed-accounts": {
      "get": {
        "operationId": "admin_list_allowed_accounts",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AllowedAccountRead"
                  },
                  "title": "Response Admin List Allowed Accounts",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Allowed Accounts",
        "tags": [
          "admin"
        ]
      },
      "post": {
        "operationId": "admin_create_allowed_account",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AllowedAccountCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllowedAccountRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Allowed Account",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/allowed-accounts/{account_id}": {
      "delete": {
        "operationId": "admin_delete_allowed_account",
        "parameters": [
          {
            "in": "path",
            "name": "account_id",
            "required": true,
            "schema": {
              "title": "Account Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Allowed Account",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/audit": {
      "get": {
        "operationId": "admin_read_audit",
        "parameters": [
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tenant Id"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AuditLogRead"
                  },
                  "title": "Response Admin Read Audit",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Read Audit",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/benchmarks": {
      "get": {
        "operationId": "admin_benchmarks_list_benchmarks",
        "parameters": [
          {
            "in": "query",
            "name": "active_only",
            "required": false,
            "schema": {
              "default": false,
              "title": "Active Only",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/BenchmarkRead"
                  },
                  "title": "Response Admin Benchmarks List Benchmarks",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Benchmarks",
        "tags": [
          "admin-benchmarks"
        ]
      },
      "post": {
        "operationId": "admin_benchmarks_create_benchmark",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BenchmarkCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BenchmarkRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Benchmark",
        "tags": [
          "admin-benchmarks"
        ]
      }
    },
    "/api/v1/admin/benchmarks/{benchmark_id}": {
      "get": {
        "operationId": "admin_benchmarks_get_benchmark",
        "parameters": [
          {
            "in": "path",
            "name": "benchmark_id",
            "required": true,
            "schema": {
              "title": "Benchmark Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BenchmarkRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Benchmark",
        "tags": [
          "admin-benchmarks"
        ]
      },
      "patch": {
        "operationId": "admin_benchmarks_update_benchmark",
        "parameters": [
          {
            "in": "path",
            "name": "benchmark_id",
            "required": true,
            "schema": {
              "title": "Benchmark Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BenchmarkUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BenchmarkRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Benchmark",
        "tags": [
          "admin-benchmarks"
        ]
      }
    },
    "/api/v1/admin/brand": {
      "get": {
        "operationId": "admin_get_platform_brand",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBrandRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Platform Brand",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/brand/favicon": {
      "delete": {
        "operationId": "admin_delete_platform_favicon",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Platform Favicon",
        "tags": [
          "admin"
        ]
      },
      "get": {
        "description": "Stream the platform-default favicon bytes (operator preview).\n\nThe user-facing fallback path streams through the tenant-scoped\n``GET /tenants/{id}/brand/favicon`` instead \u2014 this endpoint exists so\nSuperAdmins can preview the bytes from the operator UI even when no\ntenant context is selected.",
        "operationId": "admin_fetch_platform_favicon",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fetch Platform Favicon",
        "tags": [
          "admin"
        ]
      },
      "post": {
        "operationId": "admin_upload_platform_favicon",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_admin_upload_platform_favicon"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBrandFaviconUploaded"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Platform Favicon",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/code-findings": {
      "get": {
        "operationId": "admin_code_findings_list_all_findings",
        "parameters": [
          {
            "in": "query",
            "name": "scanner",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Scanner"
            }
          },
          {
            "in": "query",
            "name": "severity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Per Page",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CodeFindingRead"
                  },
                  "title": "Response Admin Code Findings List All Findings",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List All Findings",
        "tags": [
          "admin-code-findings"
        ]
      }
    },
    "/api/v1/admin/fine-tune/jobs": {
      "get": {
        "operationId": "admin_fine_tune_list_jobs",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/FineTuneJobRead"
                  },
                  "title": "Response Admin Fine Tune List Jobs",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Jobs",
        "tags": [
          "admin-fine-tune"
        ]
      },
      "post": {
        "operationId": "admin_fine_tune_create_job",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FineTuneJobCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FineTuneJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Job",
        "tags": [
          "admin-fine-tune"
        ]
      }
    },
    "/api/v1/admin/fine-tune/jobs/{job_id}": {
      "get": {
        "operationId": "admin_fine_tune_get_job",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FineTuneJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Job",
        "tags": [
          "admin-fine-tune"
        ]
      }
    },
    "/api/v1/admin/fine-tune/jobs/{job_id}/promote": {
      "post": {
        "operationId": "admin_fine_tune_promote_job",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FineTuneJobPromoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FineTuneJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Promote Job",
        "tags": [
          "admin-fine-tune"
        ]
      }
    },
    "/api/v1/admin/huggingface/pull": {
      "post": {
        "operationId": "admin_huggingface_pull_model",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HfPullRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HfDownloadRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Pull Model",
        "tags": [
          "admin-huggingface"
        ]
      }
    },
    "/api/v1/admin/huggingface/pulls": {
      "get": {
        "operationId": "admin_huggingface_list_pulls",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/HfDownloadRead"
                  },
                  "title": "Response Admin Huggingface List Pulls",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Pulls",
        "tags": [
          "admin-huggingface"
        ]
      }
    },
    "/api/v1/admin/huggingface/repos/{repo_id}": {
      "get": {
        "operationId": "admin_huggingface_get_repo_detail",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HfRepoDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Repo Detail",
        "tags": [
          "admin-huggingface"
        ]
      }
    },
    "/api/v1/admin/huggingface/search": {
      "get": {
        "operationId": "admin_huggingface_search_hf",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "maxLength": 256,
              "minLength": 1,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "enum": [
                "downloads",
                "likes",
                "trendingScore",
                "lastModified"
              ],
              "title": "Sort",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 50,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/HfSearchResultItem"
                  },
                  "title": "Response Admin Huggingface Search Hf",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Hf",
        "tags": [
          "admin-huggingface"
        ]
      }
    },
    "/api/v1/admin/invite-tenant-admin": {
      "post": {
        "operationId": "admin_invite_tenant_admin",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteTenantAdminRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PendingTenantInviteRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Invite Tenant Admin",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/mail/heal": {
      "post": {
        "description": "Trigger an on-demand mailbox backfill.\n\n``service=internal`` (the default) creates an internal mailbox for every\nagent that doesn't have one yet. ``service=external`` converges external\nmailboxes onto the tenant + per-agent enablement flags \u2014 provisioning one\nfor every eligible agent and soft-deleting those whose tenant or owner has\nopted out (see docs/content/mail.md \"External mailbox enablement\").\n\nSame logic as the periodic reconciler, but callable from the SuperAdmin\nconsole without waiting for the 5-minute loop.",
        "operationId": "admin_mail_heal_mailboxes",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/AdminMailHealRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminMailHealResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Heal Mailboxes",
        "tags": [
          "admin-mail"
        ]
      }
    },
    "/api/v1/admin/mail/mailboxes": {
      "get": {
        "description": "Cluster-wide mailbox roster for the SuperAdmin console.\n\n`service` filters by `mailbox.kind` (internal vs external). Omit to\nreturn both. FastAPI validates the enum, so an unknown value is a 422.",
        "operationId": "admin_mail_list_admin_mailboxes",
        "parameters": [
          {
            "in": "query",
            "name": "service",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/MailboxKind"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Service"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AdminMailboxRow"
                  },
                  "title": "Response Admin Mail List Admin Mailboxes",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Admin Mailboxes",
        "tags": [
          "admin-mail"
        ]
      }
    },
    "/api/v1/admin/model-endpoints": {
      "get": {
        "description": "List all self-hosted model endpoints with cached health status.",
        "operationId": "admin_model_endpoints_list_model_endpoints",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ModelEndpointRead"
                  },
                  "title": "Response Admin Model Endpoints List Model Endpoints",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Model Endpoints",
        "tags": [
          "admin-model-endpoints"
        ]
      },
      "post": {
        "description": "Register a new self-hosted model endpoint.",
        "operationId": "admin_model_endpoints_create_model_endpoint",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelEndpointCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelEndpointRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Model Endpoint",
        "tags": [
          "admin-model-endpoints"
        ]
      }
    },
    "/api/v1/admin/model-endpoints/{model_id}": {
      "delete": {
        "description": "Disable a self-hosted model endpoint (soft delete).",
        "operationId": "admin_model_endpoints_delete_model_endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Model Endpoint",
        "tags": [
          "admin-model-endpoints"
        ]
      },
      "patch": {
        "description": "Update a self-hosted model endpoint configuration.",
        "operationId": "admin_model_endpoints_update_model_endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelEndpointUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelEndpointRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Model Endpoint",
        "tags": [
          "admin-model-endpoints"
        ]
      }
    },
    "/api/v1/admin/model-endpoints/{model_id}/health-check": {
      "post": {
        "description": "Send a lightweight completion request to verify endpoint reachability.",
        "operationId": "admin_model_endpoints_health_check_model_endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelEndpointHealthResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Health Check Model Endpoint",
        "tags": [
          "admin-model-endpoints"
        ]
      }
    },
    "/api/v1/admin/models": {
      "get": {
        "operationId": "admin_models_list_models",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ModelRead"
                  },
                  "title": "Response Admin Models List Models",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Models",
        "tags": [
          "admin-models"
        ]
      },
      "post": {
        "description": "Register a model (local llama.cpp weights, OpenRouter slug, vendor API, etc.).",
        "operationId": "admin_models_register_model",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Register Model",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/system-default": {
      "get": {
        "description": "Return the model currently flagged as the system-wide default, or null.\n\nBelt-and-braces SuperAdmin gate on top of Casbin \u2014 the system default is a\nplatform-wide setting, not a tenant-scoped one, so access mustn't silently\nwiden via a future policy change.",
        "operationId": "admin_models_get_system_default",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ModelRead"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Response Admin Models Get System Default"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get System Default",
        "tags": [
          "admin-models"
        ]
      },
      "put": {
        "description": "Designate a model as the system-wide default (unsets any previous default).\n\nBelt-and-braces SuperAdmin gate \u2014 see ``get_system_default`` above for rationale.",
        "operationId": "admin_models_set_system_default",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemDefaultModelSet"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set System Default",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/{model_id}": {
      "patch": {
        "description": "SuperAdmin-only PATCH. Accepts every field tenant admins can set, plus\n`is_free` (the platform operator's call \u2014 drives free-tier filtering).",
        "operationId": "admin_models_update_model_admin",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminModelUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Model Admin",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/{model_id}/deploy": {
      "post": {
        "description": "Force the broker to create/refresh the K8s Deployment for a `local` model.",
        "operationId": "admin_models_deploy_model",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Admin Models Deploy Model",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Deploy Model",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/{model_id}/grants/tenant/{tenant_id}": {
      "delete": {
        "description": "SuperAdmin: remove a per-tenant grant (or per-tenant override row).",
        "operationId": "admin_models_revoke_from_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke From Tenant",
        "tags": [
          "admin-models"
        ]
      },
      "post": {
        "operationId": "admin_models_grant_to_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TenantModelGrant"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant To Tenant",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/{model_id}/grants/tenants": {
      "get": {
        "description": "SuperAdmin: list the explicit per-tenant grants/overrides for a model.",
        "operationId": "admin_models_list_tenant_grants",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantModelRead"
                  },
                  "title": "Response Admin Models List Tenant Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Grants",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/{model_id}/scale-to-zero": {
      "post": {
        "description": "Alias for undeploy \u2014 scales to zero replicas.",
        "operationId": "admin_models_scale_to_zero",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Admin Models Scale To Zero",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Scale To Zero",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/models/{model_id}/undeploy": {
      "post": {
        "description": "Scale a local model to zero replicas, keeping weights on GCS.",
        "operationId": "admin_models_undeploy_model",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Admin Models Undeploy Model",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Undeploy Model",
        "tags": [
          "admin-models"
        ]
      }
    },
    "/api/v1/admin/openrouter/catalogue": {
      "get": {
        "description": "Full OR catalogue + each slug's system-enabled state.",
        "operationId": "admin_openrouter_list_catalogue",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/JsonObject"
                  },
                  "title": "Response Admin Openrouter List Catalogue",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Catalogue",
        "tags": [
          "admin-openrouter"
        ]
      }
    },
    "/api/v1/admin/openrouter/credential": {
      "get": {
        "description": "Report whether an OpenRouter key is resolvable without prompting the user.\n\nNever returns the key itself; only whether one is available and where it\ncame from. Drives the SuperAdmin page's \"credential is configured\" hint\nso the operator doesn't have to paste a key every time.",
        "operationId": "admin_openrouter_credential_status",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/_CredentialStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Credential Status",
        "tags": [
          "admin-openrouter"
        ]
      }
    },
    "/api/v1/admin/openrouter/sync": {
      "post": {
        "description": "Refresh the system-wide OpenRouter catalogue via the broker.\n\nIf ``body.api_key`` is omitted, the API resolves a stored credential via\nthe BYOK cascade (tenant BYOK row \u2192 platform-pool / GSM ``gp-or-key``).\nReturns 400 when nothing is configured so the UI can prompt for a key.",
        "operationId": "admin_openrouter_sync_catalogue",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/_SyncBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Admin Openrouter Sync Catalogue",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Sync Catalogue",
        "tags": [
          "admin-openrouter"
        ]
      }
    },
    "/api/v1/admin/openrouter/{slug}/disable": {
      "post": {
        "description": "Disable an OR slug system-wide (status=disabled).",
        "operationId": "admin_openrouter_disable_slug",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "title": "Slug",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Admin Openrouter Disable Slug",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Disable Slug",
        "tags": [
          "admin-openrouter"
        ]
      }
    },
    "/api/v1/admin/openrouter/{slug}/enable": {
      "post": {
        "description": "Enable an OR slug system-wide.\n\nSlug uses ``:path`` so vendor-prefixed slugs like\n``anthropic/claude-3.5-sonnet`` survive routing.",
        "operationId": "admin_openrouter_enable_slug",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "title": "Slug",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Admin Openrouter Enable Slug",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Enable Slug",
        "tags": [
          "admin-openrouter"
        ]
      }
    },
    "/api/v1/admin/pending-invites": {
      "get": {
        "operationId": "admin_list_pending_invites",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/PendingTenantInviteRead"
                  },
                  "title": "Response Admin List Pending Invites",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Pending Invites",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/pending-invites/{invite_id}": {
      "delete": {
        "operationId": "admin_delete_pending_invite",
        "parameters": [
          {
            "in": "path",
            "name": "invite_id",
            "required": true,
            "schema": {
              "title": "Invite Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Pending Invite",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/plans": {
      "get": {
        "operationId": "admin_list_plans",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/PlanRead"
                  },
                  "title": "Response Admin List Plans",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Plans",
        "tags": [
          "admin"
        ]
      },
      "post": {
        "operationId": "admin_create_plan",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Plan",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/plans/{plan_id}": {
      "patch": {
        "description": "Edit a plan. Tenants on it pick the change up on their next request,\nexcept for terms they override.",
        "operationId": "admin_update_plan",
        "parameters": [
          {
            "in": "path",
            "name": "plan_id",
            "required": true,
            "schema": {
              "title": "Plan Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Plan",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/platform-secrets": {
      "get": {
        "description": "List all known platform secrets (metadata only \u2014 no plaintext, no ciphertext).",
        "operationId": "admin_list_platform_secrets",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/PlatformSecretRow"
                  },
                  "title": "Response Admin List Platform Secrets",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Platform Secrets",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/platform-secrets/{provider}": {
      "delete": {
        "description": "Clear the stored value of a platform secret. SuperAdmin only.\n\nThe row is preserved (``value_enc`` set to NULL) so the SuperAdmin page\nstill shows the provider slot as \"missing\". The cache is invalidated\nimmediately. An ``admin.platform_secrets.delete`` audit row is written.",
        "operationId": "admin_delete_platform_secret",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Platform Secret",
        "tags": [
          "admin"
        ]
      },
      "put": {
        "description": "Create or rotate a platform secret. Plaintext is encrypted at rest.\n\nAudit metadata records the provider (never the value) and whether the\noperation was a create (``new=True``) or a rotation (``new=False``).",
        "operationId": "admin_set_platform_secret",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformSecretSetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformSecretRow"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Platform Secret",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/platform-secrets/{provider}/reveal": {
      "get": {
        "description": "Reveal the plaintext value of a single platform secret. SuperAdmin only.\n\nEvery call is recorded in the audit log so reveals are traceable.",
        "operationId": "admin_reveal_platform_secret",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformSecretRevealRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Reveal Platform Secret",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/skills": {
      "get": {
        "description": "List a tenant's tenant-tier (public, agent-owned) skills.\n\nThis is the promotion candidate pool for ``promote_skill_to_platform`` \u2014\nagent-tier (private) skills must be promoted to tenant-tier first\n(`POST /tenant/{id}/skills/{id}/promote-to-tenant`), and platform-tier\nskills have no owning tenant to list them under.",
        "operationId": "admin_list_promotable_skills",
        "parameters": [
          {
            "description": "Tenant whose tenant-tier skills to list",
            "in": "query",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "description": "Tenant whose tenant-tier skills to list",
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillRead"
                  },
                  "title": "Response Admin List Promotable Skills",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Promotable Skills",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/skills/platform": {
      "get": {
        "description": "List every platform-tier (global) skill \u2014 the demote candidate pool.\n\nThe mirror of ``list_promotable_skills``: platform-tier skills\n(``owner_agent_id IS NULL``) belong to no tenant, so this is cross-tenant\nand takes no ``tenant_id``. Each row can be demoted back to its originating\ntenant via ``demote_skill_to_tenant`` (issue #3041).",
        "operationId": "admin_list_platform_tier_skills",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillRead"
                  },
                  "title": "Response Admin List Platform Tier Skills",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Platform Tier Skills",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/skills/{skill_id}/demote-to-tenant": {
      "post": {
        "description": "Demote a platform-tier skill back to its originating tenant (issue #3041).\n\nReverses ``promote_skill_to_platform``. The originating tenant and owning\nagent are recovered from the most recent ``skill.promote_to_platform``\naudit row (the promotion nulls ``owner_agent_id``, so the DB alone can't\nsay where the skill came from). For ``executable`` skills the GitLab\nproject is transferred back from ``good-place/skills`` into the tenant's\n``skills`` subgroup before ``owner_agent_id`` is restored; ``text`` skills\nonly change ownership. Demoting a non-platform-tier skill is a 422.\n\nReturns 409 when the promotion origin can't be reconstructed \u2014 no promotion\naudit row, its tenant was deleted (``tenant_id`` SET NULL), or the original\nowning agent no longer exists \u2014 since those cases need manual placement.",
        "operationId": "admin_demote_skill_to_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Demote Skill To Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/skills/{skill_id}/promote-to-platform": {
      "post": {
        "description": "Promote a tenant-tier skill to platform-tier (global, every tenant).\n\nFor executable skills this physically moves the GitLab project from the\nowning tenant's ``skills`` subgroup into the platform ``good-place/skills``\ngroup before flipping ``owner_agent_id`` to NULL; text skills (no GitLab\nrepo) only change ownership. Promoting an agent-tier or already\nplatform-tier skill is a 422 \u2014 the ladder promotes one tier at a time.",
        "operationId": "admin_promote_skill_to_platform",
        "parameters": [
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Promote Skill To Platform",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants": {
      "get": {
        "operationId": "admin_list_all_tenants",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AdminTenantRead"
                  },
                  "title": "Response Admin List All Tenants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List All Tenants",
        "tags": [
          "admin"
        ]
      },
      "post": {
        "description": "SuperAdmin: create an empty tenant (no members yet).\n\nJanet + Michael are seeded as usual so the tenant matches the standard\nshape. Use this before the first tenant admin exists \u2014 typically paired\nwith ``POST /tenant/{tenant_id}/identities/idp`` to pre-provision SAML /\nOIDC / Okta federation in Keycloak so the customer's first admin signs in\nthrough their corporate IdP.",
        "operationId": "admin_create_empty_tenant",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Empty Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}": {
      "get": {
        "operationId": "admin_get_tenant_detail",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminTenantDetailRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tenant Detail",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/agents": {
      "get": {
        "operationId": "admin_list_tenant_agents",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantAgentRead"
                  },
                  "title": "Response Admin List Tenant Agents",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Agents",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/archive": {
      "post": {
        "description": "SuperAdmin: archive a tenant and enqueue async teardown.\n\nImmediately suspends the tenant so no further API calls succeed, then\nenqueues an ``archive:tenant`` event for the **archive worker**\n(``services.tenant_archiver.run_archive_worker``) to tear down Langfuse,\nFlowise, Stripe subscriptions, Keycloak IdPs, GitLab groups, GCS storage,\nValkey memory indices, and mail domains. The archive worker is a separate\nbackground task from the tenant provisioner worker.\n\nIdempotent: calling again on an already-archived tenant re-enqueues the\nteardown so a partially-failed first run retries.",
        "operationId": "admin_archive_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Archive Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/impersonate": {
      "post": {
        "description": "Switch the SuperAdmin's active tenant cookie and return a redirect URL.\n\nCalled via fetch() from the SuperAdmin tenants page. Sets the active-tenant\ncookie and returns a JSON body with ``redirect_url`` so the client can\nnavigate.",
        "operationId": "admin_impersonate_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImpersonateTenantResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Impersonate Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/members": {
      "get": {
        "operationId": "admin_list_tenant_members",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantMemberRead"
                  },
                  "title": "Response Admin List Tenant Members",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Members",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/paid": {
      "patch": {
        "operationId": "admin_set_tenant_paid",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantPaidRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Tenant Paid",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/plan": {
      "patch": {
        "operationId": "admin_change_plan",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanChangeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Change Plan",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/plan-overrides": {
      "get": {
        "operationId": "admin_get_plan_overrides",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantPlanOverridesRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Plan Overrides",
        "tags": [
          "admin"
        ]
      },
      "put": {
        "description": "Replace a tenant's plan overrides. Send ``{}`` to clear them all.",
        "operationId": "admin_set_plan_overrides",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanTermsPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantPlanOverridesRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Plan Overrides",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/resume": {
      "post": {
        "operationId": "admin_resume_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resume Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/suspend": {
      "post": {
        "operationId": "admin_suspend_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Suspend Tenant",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tenants/{tenant_id}/usage": {
      "get": {
        "operationId": "admin_get_tenant_usage",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "in": "query",
            "name": "grain",
            "required": false,
            "schema": {
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ],
              "title": "Grain",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "group_by",
            "required": false,
            "schema": {
              "enum": [
                "model",
                "agent",
                "user",
                "none"
              ],
              "title": "Group By",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageReportRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tenant Usage",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tools": {
      "get": {
        "description": "Return every registered tool for the SuperAdmin inventory.",
        "operationId": "admin_list_tools",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ToolAdminRead"
                  },
                  "title": "Response Admin List Tools",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tools",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tools/skills-summary": {
      "get": {
        "description": "Cross-tenant skill counts for the SuperAdmin dashboard.",
        "operationId": "admin_skills_summary",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillGlobalSummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Skills Summary",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tools/sync-connectors": {
      "post": {
        "description": "Upsert tool rows from a connector catalog and compute embeddings.\n\nSuperAdmin only. The tools-service pushes its connector registry here\nat deploy time so each connector's description is embedded into pgvector\nfor the hybrid retrieval pass (decision #31).",
        "operationId": "admin_sync_connector_catalog",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "items": {
                  "$ref": "#/components/schemas/ConnectorToolSync"
                },
                "title": "Body",
                "type": "array"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ToolSyncResult"
                  },
                  "title": "Response Admin Sync Connector Catalog",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Sync Connector Catalog",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/tools/{tool_id}": {
      "patch": {
        "description": "Enable or disable a tool globally.",
        "operationId": "admin_toggle_tool",
        "parameters": [
          {
            "in": "path",
            "name": "tool_id",
            "required": true,
            "schema": {
              "title": "Tool Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToolToggleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolAdminRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Toggle Tool",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/users": {
      "get": {
        "description": "All-platform users, optionally restricted to members of ``tenant_id``.\n\nPowers the SuperAdmin \"Users\" sub-tab. See ``docs/content/navigation.md``.",
        "operationId": "admin_list_all_users",
        "parameters": [
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tenant Id"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AdminUserRow"
                  },
                  "title": "Response Admin List All Users",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List All Users",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/users/{user_id}/resume": {
      "post": {
        "operationId": "admin_resume_user",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resume User",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/admin/users/{user_id}/suspend": {
      "post": {
        "description": "SuperAdmin: mark a user as suspended.\n\nRefuses to suspend the calling user (so a SuperAdmin can't accidentally\nlock themselves out) and refuses to suspend any SuperAdmin. Once\nsuspended, the user's authenticated requests are rejected with HTTP 403\nby ``_build_request_context``.",
        "operationId": "admin_suspend_user",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Suspend User",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/api/widget/sessions": {
      "post": {
        "description": "Create a new widget session against the platform demo agent.\n\nRate-limited per IP. Returns a one-time widget token that the client must\ninclude on all subsequent requests for this session.",
        "operationId": "widget_create_widget_session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WidgetSessionCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetSessionOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Widget Session",
        "tags": [
          "widget"
        ]
      }
    },
    "/api/v1/api/widget/sessions/{session_id}/messages": {
      "get": {
        "description": "Full message history for a widget session (for page-reload rehydration).",
        "operationId": "widget_list_widget_messages",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-widget-token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Widget-Token"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/WidgetMessageOut"
                  },
                  "title": "Response Widget List Widget Messages",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Widget Messages",
        "tags": [
          "widget"
        ]
      },
      "post": {
        "description": "Send a user message to the widget session.",
        "operationId": "widget_add_widget_message",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-widget-token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Widget-Token"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WidgetMessageCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetMessageOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Widget Message",
        "tags": [
          "widget"
        ]
      }
    },
    "/api/v1/assistants": {
      "get": {
        "operationId": "assistants_shim_list_assistants",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantList"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Assistants",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/v1/assistants/{assistant_id}": {
      "get": {
        "operationId": "assistants_shim_get_assistant",
        "parameters": [
          {
            "in": "path",
            "name": "assistant_id",
            "required": true,
            "schema": {
              "title": "Assistant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantObject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Assistant",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/v1/auth/desktop-client": {
      "get": {
        "operationId": "auth_desktop_client_config",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DesktopClientConfig"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Desktop Client Config",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/email/verify/confirm": {
      "post": {
        "description": "Redeem a verification link's token. Public \u2014 the token is the credential.",
        "operationId": "auth_confirm_email_verification",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyEmailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailVerificationResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Confirm Email Verification",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/email/verify/request": {
      "post": {
        "description": "Send the caller a verification link via platform system mail.",
        "operationId": "auth_request_email_verification",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailVerificationResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Request Email Verification",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/email/verify/status": {
      "get": {
        "description": "Return the caller's email-verification state (for the front-end banner).",
        "operationId": "auth_email_verification_status",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailVerificationStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Email Verification Status",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/login": {
      "post": {
        "description": "Exchange username/password for a session cookie via Keycloak Direct Grant.\n\nIn stub mode (``keycloak_mode != \"real\"``), `login_with_password` returns a\nsynthetic token bundle and we skip `validate_browser_jwt` \u2014 the Principal\nis constructed directly from the submitted username so dev/CI flows don't\nrequire a running Keycloak.",
        "operationId": "auth_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Login",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/logout": {
      "post": {
        "operationId": "auth_logout",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Auth Logout",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Logout",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/github-app/callback": {
      "get": {
        "description": "GitHub App install callback. Validates state, records the install.\n\nGitHub lands the installing OWNER/ADMIN browser here, so the caller is an\nauthenticated session (``request_context`` 401s an anonymous caller). Never\n500s on bad input: an unknown / expired / replayed / cross-user state is a\n400. The state is single-use (``consumed`` set before any write) and bound to\nthe tenant + user it was minted for, so a caller can never record an install\nagainst a tenant they did not start the flow for.",
        "operationId": "github_app_github_app_callback",
        "parameters": [
          {
            "in": "query",
            "name": "state",
            "required": true,
            "schema": {
              "title": "State",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "installation_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Installation Id"
            }
          },
          {
            "in": "query",
            "name": "setup_action",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Setup Action"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "303": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Github App Callback",
        "tags": [
          "github-app"
        ]
      }
    },
    "/api/v1/marketplace": {
      "get": {
        "operationId": "marketplace_browse",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/ListingKind"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/MarketplaceListingBrowse"
                  },
                  "title": "Response Marketplace Browse",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Browse",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/marketplace/listings/{slug}": {
      "get": {
        "operationId": "marketplace_get_listing",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "title": "Slug",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceListingDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Listing",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/me": {
      "get": {
        "operationId": "me_get_me",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Me",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/active-tenant": {
      "post": {
        "description": "Swap the session's active tenant. SuperAdmins may target any tenant.",
        "operationId": "me_set_active_tenant",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "title": "Payload",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Me Set Active Tenant",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Active Tenant",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/api-keys": {
      "get": {
        "operationId": "me_list_api_keys",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyRead"
                  },
                  "title": "Response Me List Api Keys",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Api Keys",
        "tags": [
          "me"
        ]
      },
      "post": {
        "operationId": "me_create_api_key",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Api Key",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/api-keys/{key_id}": {
      "delete": {
        "operationId": "me_delete_api_key",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "required": true,
            "schema": {
              "title": "Key Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Api Key",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/linked-identities": {
      "get": {
        "description": "List the caller's tool-only linked identities.",
        "operationId": "identities_list_links",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/LinkedIdentityRead"
                  },
                  "title": "Response Identities List Links",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Links",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/database": {
      "post": {
        "description": "Store (or rotate) a PostgreSQL password for use with the ``db_query`` connector.\n\nThe password is encrypted immediately at rest. Re-posting for the same\nhost, username, port, and database rotates the stored credential in-place.\n\nOnce added, agents granted access to the identity can call\n``db_query.query(host=..., sql=...)`` and other db_query actions.\nThe password is never returned via the API.",
        "operationId": "identities_add_database_credential",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatabaseCredentialAdd"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedIdentityRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add or rotate a PostgreSQL database credential",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/providers": {
      "get": {
        "description": "List the OAuth providers the caller may link, with a ``configured`` flag.",
        "operationId": "identities_list_linkable_providers",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/LinkableProvider"
                  },
                  "title": "Response Identities List Linkable Providers",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Linkable Providers",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/ssh": {
      "post": {
        "description": "Store (or rotate) an SSH private key for use with the ``ssh`` connector.\n\nThe key is encrypted immediately at rest.  Re-posting for the same host,\nusername, and port rotates the stored key in-place.\n\nOnce added, agents granted access to the identity can call\n``ssh.exec(host=..., command=...)`` to run commands on the remote server.\nThe private key is never returned via the API.",
        "operationId": "identities_add_ssh_key",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SshKeyAdd"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedIdentityRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add or rotate an SSH private key",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/{linked_id}": {
      "delete": {
        "description": "Revoke a linked identity. ``agent_user_identity`` grants cascade-delete.\n\nPer docs/content/identity-linking.md, in-flight tool calls aren't cancelled.",
        "operationId": "identities_revoke_link",
        "parameters": [
          {
            "in": "path",
            "name": "linked_id",
            "required": true,
            "schema": {
              "title": "Linked Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Identities Revoke Link",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Link",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/{linked_id}/grants": {
      "get": {
        "description": "List the agents currently authorised to act as the given linked identity.",
        "operationId": "identities_list_agent_grants",
        "parameters": [
          {
            "in": "path",
            "name": "linked_id",
            "required": true,
            "schema": {
              "title": "Linked Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/good_place_api__schemas__identity__AgentGrantRead"
                  },
                  "title": "Response Identities List Agent Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Grants",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/{linked_id}/grants/agent/{agent_id}": {
      "delete": {
        "description": "Revoke ``agent_id``'s permission to use ``linked_id``.",
        "operationId": "identities_revoke_agent_grant",
        "parameters": [
          {
            "in": "path",
            "name": "linked_id",
            "required": true,
            "schema": {
              "title": "Linked Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Identities Revoke Agent Grant",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Agent Grant",
        "tags": [
          "identities"
        ]
      },
      "post": {
        "description": "Authorise ``agent_id`` to use the linked identity ``linked_id``.",
        "operationId": "identities_grant_to_agent",
        "parameters": [
          {
            "in": "path",
            "name": "linked_id",
            "required": true,
            "schema": {
              "title": "Linked Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/good_place_api__schemas__identity__AgentGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant To Agent",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/{provider}/callback": {
      "get": {
        "description": "Exchange the upstream ``code`` for tokens, persist, and send the browser home.\n\nThe upstream provider lands the *browser* here, so every outcome is a 303\nto ``/tenants/<tenant>/settings/identity`` \u2014 ``?linked=<provider>`` on\nsuccess, ``?link_error=<code>`` on failure where ``<code>`` is one of\n``state`` / ``denied`` / ``exchange`` / ``not_configured``. Upstream error\ntext never reaches the URL. An unknown or non-user-linkable provider still\n404s (nothing to link, so no page to return to), and a missing session\nstill 401s from ``request_context`` (no user to bind the state to).\n\nIdempotent on ``(user_id, provider, provider_subject)`` \u2014 re-linking the\nsame upstream account replaces the encrypted tokens rather than inserting\na duplicate.",
        "operationId": "identities_complete_link",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Code"
            }
          },
          {
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "State"
            }
          },
          {
            "in": "query",
            "name": "error",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Error"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "303": {
            "description": "Back to the identity settings page with `?linked=<provider>` or `?link_error=<code>&provider=<provider>`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Complete Link",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/linked-identities/{provider}/start": {
      "post": {
        "description": "Issue an OAuth authorize URL the browser should redirect the user to.\n\nThe caller follows ``authorize_url``; the upstream provider sends the user\nback to ``/{provider}/callback`` with the same ``state`` we issued here.\n\nTenant-scoped providers (e.g. ``google:workspace``) are rejected with 404 so\na user cannot bypass the per-user catalogue and obtain a tenant-only scope\nset through ``linked_identity``. Tenant integrations go through the\n``/tenant/{tenant_id}/integrations`` route which resolves from its own\ncatalogue (``routes/tenant_integrations.py``).",
        "operationId": "identities_start_link",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartLinkResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Link",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/me/notifications": {
      "get": {
        "description": "List the current user's notifications, newest first.\n\n``agent_id`` narrows to notifications that one agent sent the caller\n(the per-agent view); ``unread_only`` narrows to unread. ``unread_count``\nis always the caller's total unread, unaffected by filters.",
        "operationId": "notifications_list_notifications",
        "parameters": [
          {
            "in": "query",
            "name": "agent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          },
          {
            "in": "query",
            "name": "unread_only",
            "required": false,
            "schema": {
              "default": false,
              "title": "Unread Only",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Notifications",
        "tags": [
          "notifications"
        ]
      }
    },
    "/api/v1/me/notifications/read-all": {
      "post": {
        "operationId": "notifications_mark_all_notifications_read",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationsMarkedRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Mark All Notifications Read",
        "tags": [
          "notifications"
        ]
      }
    },
    "/api/v1/me/notifications/{notification_id}/read": {
      "post": {
        "description": "Mark one notification read (idempotent). 404 for missing OR unowned id.",
        "operationId": "notifications_mark_notification_read",
        "parameters": [
          {
            "in": "path",
            "name": "notification_id",
            "required": true,
            "schema": {
              "title": "Notification Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Mark Notification Read",
        "tags": [
          "notifications"
        ]
      }
    },
    "/api/v1/me/preferences": {
      "post": {
        "description": "Update the caller's own UI preferences (issue #161).\n\nToday that is just ``theme_preference`` \u2014 Light / Dark / System. The\ntarget user is **always** ``ctx.user_id``: there is no path parameter and\nno body field that names a user, so one caller can never write another\ncaller's row. Unknown body keys are ignored by pydantic rather than\nassigned (mass-assignment defense).\n\nNot audit-logged and not step-up-gated: an appearance preference is not a\nsensitive action under the root ``CLAUDE.md`` definition \u2014 it is neither\ndestructive, nor a privilege change, nor an exposure of anything the\ncaller could not already see. The value set is closed and validated by\n``ThemePreference``, so a bad value is a 422 rather than a silent write,\nand the ``ck_user_theme_preference`` CHECK backstops it at the DB.",
        "operationId": "me_update_my_preferences",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserPreferencesUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update My Preferences",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/seller/connect": {
      "get": {
        "operationId": "seller_get_connect_status",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectStatusRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Connect Status",
        "tags": [
          "seller",
          "seller"
        ]
      },
      "post": {
        "description": "Create or refresh a Stripe Connect Express onboarding link for the user.\n\nTwo-step: if the user doesn't yet have a ``stripe_connect_account`` row,\ncreate a Stripe Express ``Account`` first and persist its ``acct_...`` id\nso subsequent ``account.updated`` webhooks have a row to update. Then\ncreate the AccountLink against that ``acct_...`` id \u2014 Stripe rejects the\nrequest if ``account`` isn't a real Stripe id.",
        "operationId": "seller_start_connect_onboarding",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectOnboardingLink"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Connect Onboarding",
        "tags": [
          "seller",
          "seller"
        ]
      }
    },
    "/api/v1/me/sessions": {
      "get": {
        "description": "Return task sessions the current user created in their active tenant.\n\nPowers the multi-task side rail. Optional ``status`` query param filters\nby TaskSessionStatus value (e.g. ``in_progress``, ``pending``).\nComma-separated lists are accepted (e.g. ``in_progress,waiting_for_user``).",
        "operationId": "me_list_my_sessions",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TaskSessionRead"
                  },
                  "title": "Response Me List My Sessions",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List My Sessions",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/sessions/events": {
      "get": {
        "description": "SSE stream of session updates for the current user's active tenant.\n\nPowers the multi-task side rail's live updates. The front-end opens an\n``EventSource`` against this path and listens for ``update`` events\ncarrying a ``TaskSessionRead``-shaped payload. Resume via\n``Last-Event-ID`` per decision #27.",
        "operationId": "me_stream_session_events",
        "parameters": [
          {
            "in": "header",
            "name": "Last-Event-ID",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Last-Event-Id"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Server-Sent Events stream of session updates."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stream Session Events",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/tenants": {
      "get": {
        "operationId": "me_list_my_tenants",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantMembershipRead"
                  },
                  "title": "Response Me List My Tenants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List My Tenants",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/transcripts/search": {
      "get": {
        "description": "Search ``task_message`` for the caller's search scope.\n\n``scope=mine`` (default): sessions the caller created in their active\ntenant, open to every authenticated user. ``scope=tenant``: every\nsession in the active tenant, gated by the ``transcripts:search:tenant``\nCasbin permission (OWNER/ADMIN only, via their wildcard grant \u2014 same\nshape as ``tasks:audit``). ``scope=super``: every session platform-wide,\nSuperAdmin only. ``scope=tenant``/``super`` write an ``audit_log`` entry\nper call \u2014 cross-user/cross-tenant reads are sensitive.\n\n``mode`` (default ``keyword``, backward compatible with v1) selects the\nranking algorithm. ``vector``/``hybrid`` rank via ``task_message.embedding``\nand gracefully degrade to keyword (``degraded_to`` on the response) when\nthere's nothing to embed or the broker is unavailable \u2014 not supported\ntogether with ``format`` (bulk export stays keyword-only for now).\n\n``format=json``/``ndjson`` switches to a bounded bulk export (up to\n``TRANSCRIPT_SEARCH_EXPORT_MAX_ROWS`` rows in one non-paginated query,\nsame shape as ``GET /tenants/{tenant_id}/sessions/audit-export``) and\nalways writes an ``audit_log`` entry regardless of scope \u2014 a bulk export\nis sensitive even for scope=mine.",
        "operationId": "me_search_transcripts",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 500,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/TranscriptSearchScope",
              "default": "mine"
            }
          },
          {
            "in": "query",
            "name": "agent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          },
          {
            "in": "query",
            "name": "role",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Role"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Until"
            }
          },
          {
            "in": "query",
            "name": "page_token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Page Token"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Ranking algorithm (issue #3290 item 1). See TranscriptSearchMode.",
            "in": "query",
            "name": "mode",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/TranscriptSearchMode",
              "default": "keyword",
              "description": "Ranking algorithm (issue #3290 item 1). See TranscriptSearchMode."
            }
          },
          {
            "description": "Bulk export (issue #3290 item 4); bypasses pagination.",
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "json",
                    "ndjson"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Bulk export (issue #3290 item 4); bypasses pagination.",
              "title": "Format"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranscriptSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Transcripts",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/user-api-keys": {
      "get": {
        "operationId": "me_list_user_api_keys",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/UserApiKeyRead"
                  },
                  "title": "Response Me List User Api Keys",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List User Api Keys",
        "tags": [
          "me"
        ]
      },
      "post": {
        "operationId": "me_create_user_api_key",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserApiKeyCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserApiKeyCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create User Api Key",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/user-api-keys/{key_id}": {
      "delete": {
        "operationId": "me_delete_user_api_key",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "required": true,
            "schema": {
              "title": "Key Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete User Api Key",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/me/workspace": {
      "post": {
        "description": "Self-serve \"create your workspace\" for a tenant-less signed-in user (#3648).\n\nLow-friction PLG onboarding: a signed-in Keycloak user who belongs to no\ntenant creates a personal workspace in one click. The new tenant lands on\nthe **FREE** plan, the **caller becomes OWNER**, and it gets the **seed\nagents** (Janet + Michael, decision #10) \u2014 all via the existing\n``services.tenants.create_tenant`` path, so the Keycloak group tree, GitLab\ngroup, Postgres schema, GCS prefix and plan relationship are provisioned\nexactly as for any other tenant.\n\nNot Casbin-gated: like ``POST /tenants``, there is no tenant to anchor the\npermission against yet, and a tenant-less caller can never satisfy\n``require(...)``. The abuse controls are enforced in the service instead \u2014\nan **email-verification gate** (403 when the policy is on and the caller's\nemail is unverified, issue #31), **one personal workspace per user** (409 if\nthe caller already belongs to a tenant), a **rate limit** (429), and this is\na **sensitive action** so it writes an ``audit_log`` row. The verification\nstate is read from the authoritative ``user`` row, never the body;\nplan/slug/seed-profile/owner are all server-forced (mass-assignment\ndefense); the body carries only an optional display ``name``.",
        "operationId": "me_create_personal_workspace",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PersonalWorkspaceCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Personal Workspace",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/newsbot/sources": {
      "get": {
        "description": "The caller's visible catalogue.\n\nPublic rows plus every private row the caller previously added, minus\nanything on the blocklist. Paginated by ``created_at DESC`` and\nfilterable by ``age_tag``.",
        "operationId": "newsbot_list_sources",
        "parameters": [
          {
            "in": "query",
            "name": "age_tag",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Age Tag"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Sources",
        "tags": [
          "newsbot"
        ]
      },
      "post": {
        "description": "Canonicalize, blocklist-check, dedupe, fetch title, insert.\n\nAlso inserts the caller's row into the visibility M2M \u2014 load-bearing\ninvariant that makes the ``/flag`` workflow correct.",
        "operationId": "newsbot_add_source",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceAddRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Source",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/newsbot/sources/blocklist": {
      "get": {
        "description": "Moderator-only. Full blocklist paginated by ``created_at DESC``.",
        "operationId": "newsbot_list_blocklist",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SourceBlocklistRead"
                  },
                  "title": "Response Newsbot List Blocklist",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Blocklist",
        "tags": [
          "newsbot"
        ]
      },
      "post": {
        "description": "Moderator-only. Add a URL to the blocklist and retract every catalogue row.",
        "operationId": "newsbot_add_blocklist_entry",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceBlocklistRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceBlocklistRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Blocklist Entry",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/newsbot/sources/blocklist/{blocklist_id}": {
      "delete": {
        "description": "Moderator-only. Remove a blocklist entry (does not restore old rows).",
        "operationId": "newsbot_remove_blocklist_entry",
        "parameters": [
          {
            "in": "path",
            "name": "blocklist_id",
            "required": true,
            "schema": {
              "title": "Blocklist Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Blocklist Entry",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/newsbot/sources/{source_id}/flag": {
      "post": {
        "description": "Flip a source to ``is_public=FALSE``. Idempotent, any authenticated caller.",
        "operationId": "newsbot_flag_source",
        "parameters": [
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Flag Source",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/newsbot/sources/{source_id}/publicize": {
      "post": {
        "description": "Moderator-only. Flip a source back to ``is_public=TRUE``.",
        "operationId": "newsbot_publicize_source",
        "parameters": [
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Publicize Source",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/newsbot/sources/{source_id}/share-group": {
      "delete": {
        "description": "Revoke a source\u2194group visibility grant (#424). Immediate; idempotent.",
        "operationId": "newsbot_unshare_source_from_group",
        "parameters": [
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceGroupShareRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unshare Source From Group",
        "tags": [
          "newsbot"
        ]
      },
      "post": {
        "description": "Share a source with a tenant group \u2014 visible to every user member (#424).\n\nIdempotent. A group from another tenant (or a missing one) returns the same\n404 as a missing source: no cross-tenant existence oracle. Blocked in a\nread-only session (decision #32).",
        "operationId": "newsbot_share_source_with_group",
        "parameters": [
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceGroupShareRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Share Source With Group",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/newsbot/sources/{source_id}/tag": {
      "post": {
        "description": "Moderator-only. Set the content-rating tag on a source.",
        "operationId": "newsbot_tag_source",
        "parameters": [
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceTagRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Tag Source",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/rbac/agent-grant": {
      "post": {
        "description": "Create / update / revoke an agent-user grant from the RBAC matrix UI.\n\nAlways returns ``AgentGrantRead`` so clients see one shape: ``role`` is the\nnew role on create/update, and ``null`` after a revoke.",
        "operationId": "rbac_set_agent_grant",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentGrantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/good_place_api__schemas__rbac__AgentGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Agent Grant",
        "tags": [
          "rbac"
        ]
      }
    },
    "/api/v1/rbac/check": {
      "post": {
        "description": "Browser-friendly twin of ``/tenant/{id}/rbac/check``.\n\nUses the active-tenant cookie. Requires ``rbac:read``.",
        "operationId": "rbac_simulate_browser",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RBACCheckRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RBACCheckResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Simulate Browser",
        "tags": [
          "rbac"
        ]
      }
    },
    "/api/v1/reseller/readers": {
      "post": {
        "description": "Self-serve a NewsBot reader workspace, billed to the reseller (GitLab #594).\n\nThe intended counterpart to #583's operator-gate: a NewsBot reader is\ncreated **without** a SuperAdmin, on the reseller client's service-account\nauthority (``require_reseller_service`` \u2014 a reader's own login token through\nthe same client is refused there). The reseller, the ``newsbot`` seed\nprofile and the ``NEWSBOT_WHOLESALE`` plan are all server-forced\n(``newsbot_reader_provision`` \u2192 ``reseller_billing``); the body carries only\nthe reader's asserted Keycloak identity, so there is no cross-reseller or\nplan surface. Idempotent per subject: 201 when minted, 200 when an existing\nreader is returned.\n\nCreating a billed tenant is sensitive (money-adjacent), so every allow and\nthe over-cap deny write an ``audit_log`` ``tenant.create`` row with\n``meta.source = \"newsbot_reseller\"``. No browser step-up applies \u2014 the caller\nis a service account, not a person \u2014 and the reseller scope is bound\nserver-side from the token's configured client, not re-proven per call.",
        "operationId": "reseller_create_reader_tenant",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReaderTenantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReaderTenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Reader Tenant",
        "tags": [
          "reseller"
        ]
      }
    },
    "/api/v1/reseller/tenants/{tenant_id}/tier": {
      "put": {
        "description": "NewsBot4 tells the platform a reader is on NewsBot Free or Pro (GitLab #583).\n\n``free`` \u2192 free models + the wholesale plan's ``free_tier_model_kinds``\n(IFM); ``pro`` \u2192 every model. Only a tenant billed to the configured\nreseller can be addressed \u2014 any other id (another reseller's, an ordinary\ntenant, a nonexistent one) is the same 404. Idempotent; audited\n(``billing.reseller.tier.set``) with the previous tier.",
        "operationId": "reseller_set_reader_tier",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReaderTierUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReaderTierRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Reader Tier",
        "tags": [
          "reseller"
        ]
      }
    },
    "/api/v1/reseller/usage": {
      "get": {
        "description": "Per-reader model usage for *period*, for the configured reseller only.",
        "operationId": "reseller_get_reseller_usage",
        "parameters": [
          {
            "description": "UTC calendar month, YYYY-MM",
            "in": "query",
            "name": "period",
            "required": true,
            "schema": {
              "description": "UTC calendar month, YYYY-MM",
              "title": "Period",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResoldUsage"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Reseller Usage",
        "tags": [
          "reseller"
        ]
      }
    },
    "/api/v1/status/active": {
      "get": {
        "operationId": "status_alerts_list_active_alerts",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/StatusAlertRead"
                  },
                  "title": "Response Status Alerts List Active Alerts",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Active Alerts",
        "tags": [
          "status-alerts"
        ]
      }
    },
    "/api/v1/status/alerts": {
      "post": {
        "operationId": "status_alerts_create_alert",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusAlertCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusAlertRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Alert",
        "tags": [
          "status-alerts"
        ]
      }
    },
    "/api/v1/status/alerts/{alert_id}": {
      "patch": {
        "operationId": "status_alerts_patch_alert",
        "parameters": [
          {
            "in": "path",
            "name": "alert_id",
            "required": true,
            "schema": {
              "title": "Alert Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusAlertPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusAlertRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Patch Alert",
        "tags": [
          "status-alerts"
        ]
      }
    },
    "/api/v1/status/alerts/{alert_id}/updates": {
      "post": {
        "operationId": "status_alerts_add_alert_update",
        "parameters": [
          {
            "in": "path",
            "name": "alert_id",
            "required": true,
            "schema": {
              "title": "Alert Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusAlertUpdateCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusAlertUpdateRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Alert Update",
        "tags": [
          "status-alerts"
        ]
      }
    },
    "/api/v1/status/global": {
      "get": {
        "operationId": "admin_get_global_status",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ServiceStatusRead"
                  },
                  "title": "Response Admin Get Global Status",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Global Status",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/status/tenant/{tenant_id}": {
      "get": {
        "description": "Tenant-scoped health: internal services this tenant depends on plus\nits linked connectors. Gated by ``tenant:read``, which in the seed\n``policy.csv`` is granted via the ``/{tenant_id}/*`` wildcard to\nOWNER and ADMIN (and SUPER_ADMIN bypasses Casbin entirely). MEMBER\nand GUEST cannot satisfy this check \u2014 matching the OWNER/ADMIN-only\ngate in ``front-end/src/layouts/OrgLayout.astro``.",
        "operationId": "admin_get_tenant_status",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ServiceStatusRead"
                  },
                  "title": "Response Admin Get Tenant Status",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tenant Status",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/super-admin/sample-use-cases": {
      "get": {
        "operationId": "admin_list_all_use_cases",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SampleUseCaseRead"
                  },
                  "title": "Response Admin List All Use Cases",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List All Use Cases",
        "tags": [
          "admin"
        ]
      },
      "post": {
        "operationId": "admin_create_use_case",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SampleUseCaseCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SampleUseCaseRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Use Case",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/super-admin/sample-use-cases/reorder": {
      "put": {
        "operationId": "admin_reorder_use_cases",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Reorder Use Cases",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/super-admin/sample-use-cases/{use_case_id}": {
      "delete": {
        "operationId": "admin_delete_use_case",
        "parameters": [
          {
            "in": "path",
            "name": "use_case_id",
            "required": true,
            "schema": {
              "title": "Use Case Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Use Case",
        "tags": [
          "admin"
        ]
      },
      "patch": {
        "operationId": "admin_update_use_case",
        "parameters": [
          {
            "in": "path",
            "name": "use_case_id",
            "required": true,
            "schema": {
              "title": "Use Case Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SampleUseCaseUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SampleUseCaseRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Use Case",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/super-admin/sample-use-cases/{use_case_id}/icon": {
      "delete": {
        "operationId": "admin_delete_use_case_icon",
        "parameters": [
          {
            "in": "path",
            "name": "use_case_id",
            "required": true,
            "schema": {
              "title": "Use Case Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Use Case Icon",
        "tags": [
          "admin"
        ]
      },
      "post": {
        "operationId": "admin_upload_use_case_icon",
        "parameters": [
          {
            "in": "path",
            "name": "use_case_id",
            "required": true,
            "schema": {
              "title": "Use Case Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_admin_upload_use_case_icon"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SampleUseCaseIconUploaded"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Use Case Icon",
        "tags": [
          "admin"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent-grants": {
      "get": {
        "description": "All agent-user grants for the tenant. Used by the RBAC matrix page.",
        "operationId": "rbac_list_agent_grants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/good_place_api__schemas__rbac__AgentGrantRead"
                  },
                  "title": "Response Rbac List Agent Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Grants",
        "tags": [
          "rbac"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/billing/zoom-checkout": {
      "post": {
        "description": "Open a Stripe Checkout Session to enable Zoom-as-a-Service for this agent.\n\n403 in a read-only session (decision #32). Creating the session is a\nmoney-adjacent action, so it is audited (#433).",
        "operationId": "billing_start_zoom_checkout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionRedirect"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Zoom Checkout",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/briefing/today": {
      "post": {
        "description": "Resolve (creating + briefing if needed) the caller's briefing thread for\ntheir local today, and return its id.\n\n``tasks:create`` \u2014 this route can create a session and enqueue a briefing\nturn, so it is gated exactly like ``POST .../sessions``: a MEMBER managing\ntheir own briefings holds it; a GUEST (``tasks:read`` only) does not and\ngets 403. The thread is attributed to the calling user, so a member can\nonly ever reach their own \u2014 never another user's or another tenant's.",
        "operationId": "newsbot_resolve_today_briefing",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingToday"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resolve Today Briefing",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/code-ref": {
      "patch": {
        "description": "Pin ``agent.code_ref`` to a branch or tag on the agent's GitLab project.\n\nThe chosen ref is validated against the project's real branch + tag set\nso a typo (or a stale UI tab) can't pin the orchestrator's clone target\nto a ref that doesn't exist. Unknown refs return 422 with an actionable\nmessage; the next ``start_agent`` would otherwise fail at init-container\nclone time with a far less helpful error. Issue #1835.\n\nValidation has three modes:\n\n* **Complete listing** (``refs.complete == True``) \u2014 the cached set is\n  authoritative; any ref outside it is rejected with 422.\n* **Partial listing** (``refs.complete == False`` but the project does\n  exist) \u2014 the cache might be missing the candidate (truncated past\n  :data:`_REPO_REFS_BRANCH_HARD_CAP` / :data:`_REPO_REFS_TAG_HARD_CAP`,\n  or one listing errored). Fall back to a direct single-ref GitLab\n  lookup; only reject when GitLab definitively answers 404 on both\n  branch and tag.\n* **Unavailable** (project lookup itself failed) \u2014 fail open so the\n  operator isn't trapped by an upstream outage. The init container\n  catches a genuinely bad ref on the next start.",
        "operationId": "agents_pin_code_ref",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCodeRefUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Pin Code Ref",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/conflicts": {
      "get": {
        "description": "Every still-open conflict for this (tenant, agent).\n\nRead-only by nature (decision #32 allows it). Returns ``[]`` when no\nunresolved rows exist \u2014 the dream-cycle detector (issue #1656) writes\nthese on its nightly pass.",
        "operationId": "memories_list_conflicts",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryConflictListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Conflicts",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/conflicts/{conflict_id}/resolve": {
      "post": {
        "description": "Drop the loser memory and mark the conflict resolved.\n\nAdmin (or tenant member with ``memory:write``) resolution surface.\nThe agent-side counterpart is ``ctx.memory.resolve_conflict(...)`` which\nlands at ``POST /api/internal/sessions/{s}/memory/conflicts/{id}/resolve``.\nBoth call into ``services.memory_conflicts.resolve``.",
        "operationId": "memories_resolve_conflict_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "conflict_id",
            "required": true,
            "schema": {
              "title": "Conflict Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemoryConflictResolve"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryConflictRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resolve Conflict Route",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/cron/jobs": {
      "get": {
        "operationId": "cron_list_jobs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CronJobRead"
                  },
                  "title": "Response Cron List Jobs",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Jobs",
        "tags": [
          "cron"
        ]
      },
      "post": {
        "operationId": "cron_create_job",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CronJobCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Job",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/cron/jobs/{job_id}": {
      "delete": {
        "operationId": "cron_delete_job",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Job",
        "tags": [
          "cron"
        ]
      },
      "get": {
        "operationId": "cron_get_job",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "description": "Fetch the request body from the cron service (#216). For an internal_agent routine this is the prompt the agent receives.",
            "in": "query",
            "name": "include_body",
            "required": false,
            "schema": {
              "default": false,
              "description": "Fetch the request body from the cron service (#216). For an internal_agent routine this is the prompt the agent receives.",
              "title": "Include Body",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronJobDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Job",
        "tags": [
          "cron"
        ]
      },
      "patch": {
        "operationId": "cron_update_job",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CronJobUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Job",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/cron/jobs/{job_id}/cancel": {
      "post": {
        "description": "Stop a routine but keep its record (#216; cron-service ``unschedule``).\n\nThe primary stop action. Marks the row ``completed`` and tells the cron\nservice to drop the schedule and the GCS body, leaving the row and its\n``cron_run`` history in place (#2658). ``DELETE`` is the deliberate one that\nerases the fact the routine existed.",
        "operationId": "cron_cancel_job",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Job",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/cron/jobs/{job_id}/pause": {
      "post": {
        "operationId": "cron_pause_job",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Pause Job",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/cron/jobs/{job_id}/run": {
      "post": {
        "description": "Fire a routine immediately (#216).\n\n**Refuses inside an active blackout window** (409) and names the window, so\na user who scheduled something over the holidays learns why it didn't run\ninstead of watching a button do nothing. This is deliberately *not* the\nbehaviour of the cron service's internal force-fire, which bypasses\nblackouts on purpose (owner decision on #217). The agent-side\n``manage_routines.run_now`` still calls that force-fire; making it refuse\nthe same way is #621.\n\nA blanket-grant caller (OWNER/ADMIN) may override with\n``{\"override_blackout\": true}``, which is audited as a distinct action so\n\"did someone force a job past a blackout\" stays answerable. An own-scoped\ncaller (MEMBER) cannot override \u2014 overriding a tenant-wide control is an\nadmin act.\n\nNot step-up gated: this re-runs a routine that already exists and was\nalready reviewed, by a caller who already holds ``cron:write``. Nothing new\nis exposed and nothing is destroyed, so it does not clear the sensitive-\naction bar. It is confirm-gated in the UI and audited here.",
        "operationId": "cron_run_job_now",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/CronRunNowRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronJobRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Run Job Now",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/cron/jobs/{job_id}/runs": {
      "get": {
        "description": "Fire-attempt history for one routine (#216).\n\nResolve the job first \u2014 that is what enforces tenant, agent and (for an\nown-scoped caller) ownership. Querying ``cron_run`` by ``job_id`` alone\nwould happily return another tenant's history.",
        "operationId": "cron_list_runs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CronRunRead"
                  },
                  "title": "Response Cron List Runs",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Runs",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/decision-log": {
      "get": {
        "operationId": "decision_log_list_decision_log",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Page Token"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "direction",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^(inbound|outbound)$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Direction"
            }
          },
          {
            "in": "query",
            "name": "decision",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^(allow|flag|block|redact)$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Decision"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Until"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionLogResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Decision Log",
        "tags": [
          "decision-log"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/documents/files": {
      "get": {
        "description": "List the documents this agent can see, newest first.\n\nSame ``DocumentFile`` shape as the tenant-scoped admin list \u2014 the UI\nrenders both with one component \u2014 and the same ``documents:read`` gate as\nthe sibling routes in this file, so the decision-#6 intersection (user\npermissions \u2229 agent permissions) applies exactly as it does to search.\nIt deliberately does **not** require ``documents:write``: there is no\nmutation at agent scope.\n\nScope note: DocWorker has no per-agent ownership of projects or files \u2014\na project belongs to a *tenant*. The agent leg of the intersection gates\nwhether this caller may act through this agent at all; the corpus it then\nsees is the tenant's, exactly as ``GET /projects`` above already behaves.\nA ``project_id`` from another tenant returns an empty page rather than\nthat tenant's files, because DocWorker scopes every query by the tenant\nin the JWT and the URL.",
        "operationId": "documents_list_files",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project Id"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFileListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Files",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/documents/projects": {
      "get": {
        "operationId": "documents_list_projects",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ProjectRead"
                  },
                  "title": "Response Documents List Projects",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Projects",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/documents/search": {
      "post": {
        "operationId": "documents_search_documents",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Documents",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/attachments": {
      "post": {
        "description": "Stage + scan an outbound attachment. Returns a resolvable ref on success.\n\nThe bytes are ClamAV-scanned (writing one ``file_scan`` row regardless of\nverdict \u2014 decision #24) and, on a clean verdict, stored in the session's GCS\nworkspace as a ``session_attachment`` row. The returned ``ref`` is that\nrow's id; ``/mail/send`` resolves it back to concrete bytes before the proxy\nbuilds the MIME message. An infected verdict returns 422; the row (and thus\na usable ref) is never created for it.",
        "operationId": "mail_upload_attachment",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "filename",
            "required": true,
            "schema": {
              "title": "Filename",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_mail_upload_attachment"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Upload Attachment",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Attachment",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/mailboxes": {
      "get": {
        "description": "Return live mailboxes for this agent.",
        "operationId": "mail_list_mailboxes",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentMailboxRow"
                  },
                  "title": "Response Mail List Mailboxes",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Mailboxes",
        "tags": [
          "mail"
        ]
      },
      "post": {
        "description": "Create a new internal mailbox for this agent.\n\nDelegates to the proxy -> mail-internal provisioning handler (decision #29:\n``provision.py`` is the sole writer of ``mail.mailbox`` rows).",
        "operationId": "mail_create_mailbox",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "title": "Body",
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Create Mailbox",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Mailbox",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/mailboxes/{mailbox_id}": {
      "delete": {
        "description": "Delete a mailbox.",
        "operationId": "mail_delete_mailbox",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "mailbox_id",
            "required": true,
            "schema": {
              "title": "Mailbox Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Delete Mailbox",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Mailbox",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/mailboxes/{mailbox_id}/messages/{message_id}/attachments": {
      "get": {
        "description": "List attachment metadata for a message. Verifies mailbox ownership.",
        "operationId": "mail_list_attachments",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "mailbox_id",
            "required": true,
            "schema": {
              "title": "Mailbox Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentAttachmentRow"
                  },
                  "title": "Response Mail List Attachments",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Attachments",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/mailboxes/{mailbox_id}/messages/{message_id}/attachments/{attachment_id}": {
      "get": {
        "description": "Returns attachment metadata + a signed GCS download URL.",
        "operationId": "mail_get_attachment",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "mailbox_id",
            "required": true,
            "schema": {
              "title": "Mailbox Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "attachment_id",
            "required": true,
            "schema": {
              "title": "Attachment Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Get Attachment",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Attachment",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/messages": {
      "get": {
        "description": "List messages in a folder. Calls proxy -> mail-internal JMAP endpoint.",
        "operationId": "mail_list_messages",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "folder",
            "required": false,
            "schema": {
              "default": "inbox",
              "title": "Folder",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "unread_only",
            "required": false,
            "schema": {
              "default": false,
              "title": "Unread Only",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/JsonObject"
                  },
                  "title": "Response Mail List Messages",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Messages",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/messages/{message_id}": {
      "delete": {
        "description": "Delete a message (soft-delete to trash).",
        "operationId": "mail_delete_message",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Delete Message",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Message",
        "tags": [
          "mail"
        ]
      },
      "get": {
        "description": "Fetch a full message by id. Calls proxy -> mail-internal JMAP endpoint.",
        "operationId": "mail_get_message",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Get Message",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Message",
        "tags": [
          "mail"
        ]
      },
      "patch": {
        "description": "Move to folder, mark read/unread.",
        "operationId": "mail_update_message",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "title": "Body",
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Update Message",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Message",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/mail/send": {
      "post": {
        "description": "Send mail. Internal targets go to mail-internal; external flag routes to mail-external.\n\nStaged attachment refs (from ``/mail/attachments``) are resolved to concrete\n``{content_type, filename, data(base64)}`` dicts *here* \u2014 before the proxy's\n``build_message`` runs \u2014 because the API owns the attachment store + the\nClamAV scan record. The proxy never sees bare refs.",
        "operationId": "mail_send_message",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "title": "Body",
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Mail Send Message",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Send Message",
        "tags": [
          "mail"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memories": {
      "get": {
        "description": "Paginated listing of an agent's Valkey memories.\n\n``filter_tag`` matches an exact entry of the ``tags`` TAG field written by\n``POST /memories`` and is ANDed with ``filter_kind``. It exists so a caller\nthat wrote a *specific* memory can read it back deterministically instead\nof hoping vector search surfaces it \u2014 NewsBot4's preference profile is one\n``semantic`` row tagged ``newsbot4:preferences``. The tag is not an\nauthorization boundary: this route's ``memory:read`` gate is.\n\n``filter_user_id`` scopes the listing to one reader's rows server-side. An\nown-scoped caller (``memory:own:read`` only \u2014 a MEMBER, issue #3621) may\n*only* see their own rows, so it is forced to their ``user_id`` here rather\nthan trusting a client-side filter; a full-access caller may pass it to ask\nfor a specific reader's rows (the NewsBot4 preferences page requests exactly\nthe viewer's own profile this way).",
        "operationId": "memories_list_memories",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "filter_kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Filter Kind"
            }
          },
          {
            "in": "query",
            "name": "filter_tag",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 128,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Filter Tag"
            }
          },
          {
            "in": "query",
            "name": "filter_user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Filter User Id"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValkeyMemoryListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Memories",
        "tags": [
          "memories"
        ]
      },
      "post": {
        "description": "Write a memory to Valkey. Backs the ``manage_memory.remember`` action.\n\nRead-only gating happens via the Casbin ``memory:write`` permission combined\nwith the proxy's read-only enforcement (decision #32) on the inbound prompt\nthat prompted the agent to call the tool.\n\n``user_id`` is stamped from the caller's request context, never from the\nbody, so an own-scoped caller (a MEMBER \u2014 issue #3621) can only ever file a\nrow under themselves: mass assignment stays closed.",
        "operationId": "memories_create_memory",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValkeyMemoryCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValkeyMemoryCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Memory",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memories/search": {
      "get": {
        "description": "Rank memories relevant to ``q``. Backs ``manage_memory.recall``.\n\nHybrid by default (issue #3037): a lexical/exact-token leg runs alongside\nthe vector leg and the two are RRF-fused, mirroring the proxy's\nsession-scoped retriever (decision #31). This is what makes an exact token\n(a nonce, an id, a codename) retrievable when it would never rank in the\ntop-``top_k`` on semantic similarity alone. Both legs query only this\nagent's index \u2014 the search never crosses tenant/agent (same scoping as the\nvector leg).\n\nReconciling the two retrieval surfaces the issue flagged: this public route\nnow honours **both** ``top_k`` (final result count) and ``radius`` (the\nvector-leg similarity floor, cosine distance \u2264 ``radius``), the same two\nknobs the proxy's route exposes as ``k`` / ``radius`` \u2014 so a caller can tell\n\"no match\" from \"ranked past ``top_k``\". ``hybrid=false`` restores the\nlegacy pure-vector behaviour for a caller that wants only similarity ranking.\n\n**Reader scope (GitLab issue #192): deliberately wide, and it stays wide.**\nThis route is gated on the blanket ``memory:read``, which only OWNER /\nADMIN / SuperAdmin hold \u2014 ``rbac/policy.csv:34-35`` grants a MEMBER\n``memory:own:read`` and nothing more, so a MEMBER already gets 403 here.\nIt is therefore an admin surface that intentionally spans every user of\nthe agent, exactly like ``admin_memory.py``, and it is passed\n``READER_ANY`` on purpose rather than by omission. Note that the sibling\n``GET /memories`` listing *does* carry an own-scoped path because it is\ngated on ``require_memory(\"read\")``; converting this route's gate to match\nwould *widen* who may call it, which is a capability change and out of\nscope for the #192 stop-gap.",
        "operationId": "memories_search_memories",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "maxLength": 50000,
              "minLength": 1,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "top_k",
            "required": false,
            "schema": {
              "default": 8,
              "maximum": 50,
              "minimum": 1,
              "title": "Top K",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "radius",
            "required": false,
            "schema": {
              "default": 0.5,
              "maximum": 2.0,
              "minimum": 0.0,
              "title": "Radius",
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "hybrid",
            "required": false,
            "schema": {
              "default": true,
              "title": "Hybrid",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "filter_kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Filter Kind"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValkeyMemorySearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Memories",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memories/{memory_id}": {
      "delete": {
        "description": "Drop a memory by id. Backs the ``manage_memory.delete`` action.",
        "operationId": "memories_delete_memory",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "memory_id",
            "required": true,
            "schema": {
              "title": "Memory Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Memory",
        "tags": [
          "memories"
        ]
      },
      "put": {
        "operationId": "memories_update_memory",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "memory_id",
            "required": true,
            "schema": {
              "title": "Memory Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValkeyMemoryUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValkeyMemoryRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Memory",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memories/{memory_id}/kind": {
      "patch": {
        "description": "Change a memory's ``kind`` without re-embedding. Backs ``manage_memory.update_kind``.",
        "operationId": "memories_update_memory_kind",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "memory_id",
            "required": true,
            "schema": {
              "title": "Memory Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValkeyMemoryKindUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValkeyMemoryRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Memory Kind",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memory-summary": {
      "get": {
        "operationId": "memories_get_memory_summary",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MemorySummaryRead"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Response Memories Get Memory Summary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Memory Summary",
        "tags": [
          "memories"
        ]
      },
      "put": {
        "operationId": "memories_update_memory_summary",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemorySummaryUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemorySummaryRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Memory Summary",
        "tags": [
          "memories"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memory/export": {
      "post": {
        "description": "Dump every Valkey memory for the agent as JSONL on GCS.\n\n``include_embeddings`` is False by default; set it true to round-trip\nembeddings as base64-packed float32 buffers (one per row). Even with\nthem included the import path *always* re-embeds via the broker, so\nthe field is for archival completeness, not for skipping embed cost.",
        "operationId": "memory_export_import_export_memory",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_embeddings",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Embeddings",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryExportResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Export Memory",
        "tags": [
          "memory-export-import"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memory/import": {
      "post": {
        "description": "Reload memories from a JSONL artefact.\n\nThe endpoint is multipart-only:\n\n- ``file=<jsonl>`` \u2014 upload the artefact directly (admin UI path).\n- ``gcs_uri=<gs://...>`` \u2014 re-import a prior export without re-uploading.\n\nA JSON body is intentionally NOT accepted; combining JSON and\nmultipart parsing on one FastAPI route is brittle. Service-to-service\ncallers that want to re-import an existing export use the dedicated\nJSON sibling :func:`import_memory_from_gcs` below.",
        "operationId": "memory_export_import_import_memory",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_memory_export_import_import_memory"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryImportResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import Memory",
        "tags": [
          "memory-export-import"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/memory/import-from-gcs": {
      "post": {
        "description": "JSON sibling of :func:`import_memory` for re-importing an existing export.\n\n``body.gcs_uri`` is required. Same downstream pipeline as ``/import``\n(ClamAV \u2192 JSONL schema \u2192 re-embed \u2192 HSET).",
        "operationId": "memory_export_import_import_memory_from_gcs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemoryImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryImportResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import Memory From Gcs",
        "tags": [
          "memory-export-import"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/preferences/suggestions": {
      "get": {
        "description": "Topic + outlet suggestions for the NewsBot4 preferences page.",
        "operationId": "newsbot_preference_suggestions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreferenceSuggestions"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Preference Suggestions",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/refs": {
      "get": {
        "description": "List every branch + tag on the agent's GitLab project.\n\nFeeds the code-tab ``code_ref`` typeahead so the operator can only pin\n``agent.code_ref`` to a ref that actually exists (issue #1835).\n\nReturns empty lists when GitLab is unreachable or the project is\nmissing \u2014 the front-end falls back to a free-form input with a clear\nbanner in that case, so a transient GitLab outage doesn't lock the user\nout of pinning a ref they know is valid.",
        "operationId": "agents_list_repo_refs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRepoRefs"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Repo Refs",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/self-edit-branches": {
      "get": {
        "description": "List ``agent/self-edit-*`` branches on the agent's GitLab repo.\n\nReturns ``[]`` when GitLab isn't reachable or the project is missing \u2014\nthe front-end already renders an honest \"No self-edit branches yet\"\nstate, so we never surface 502s for ops noise here.",
        "operationId": "agents_list_self_edit_branches",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SelfEditBranchRead"
                  },
                  "title": "Response Agents List Self Edit Branches",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Self Edit Branches",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions": {
      "get": {
        "operationId": "tasks_list_sessions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Include user-archived sessions (``archived_at IS NOT NULL``) in the response. Default ``false`` matches the agent-detail Sessions tab's initial paint; the tab's 'Include archived' checkbox flips this to ``true``. The multi-task rail (``/me/sessions``) does NOT honour this flag \u2014 archived rows never appear there.",
            "in": "query",
            "name": "include_archived",
            "required": false,
            "schema": {
              "default": false,
              "description": "Include user-archived sessions (``archived_at IS NOT NULL``) in the response. Default ``false`` matches the agent-detail Sessions tab's initial paint; the tab's 'Include archived' checkbox flips this to ``true``. The multi-task rail (``/me/sessions``) does NOT honour this flag \u2014 archived rows never appear there.",
              "title": "Include Archived",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TaskSessionRead"
                  },
                  "title": "Response Tasks List Sessions",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Sessions",
        "tags": [
          "tasks"
        ]
      },
      "post": {
        "description": "Create a task session and spawn its agent pod.\n\nReturns 201 with the persisted row (status=PENDING). The next reconcile\ncall will lift status to IN_PROGRESS once the K8s Job's pod becomes\nactive. Errors:\n- 404 if the agent doesn't exist in this tenant.\n- 402 when the tenant has hit its concurrent-session or daily-task quota.\n- 409 if the agent has no provisioned GitLab repo yet.\n- 503 if the K8s API rejects the Job creation.",
        "operationId": "tasks_create_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskSessionCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Session",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}": {
      "delete": {
        "description": "Permanently delete a session, its messages, and per-session usage.\n\nRefuses with 409 (``SessionActive``) when the session is still active\n(``pending`` / ``in_progress`` / ``waiting_for_user``) \u2014 issue !90:\nconcurrent deletes were pruning live Janet sessions mid-turn, so the\nagent's ``POST /messages`` came back 410 Gone and the assistant reply\nnever landed. Terminal sessions (``completed`` / ``failed`` /\n``cancelled`` / ``token_limit_reached``) delete immediately. A\nSuperAdmin may pass ``?force=true`` to override; the check is\nserver-side against ``ctx.is_super_admin`` (decision #6 ABAC + the\nCLAUDE.md security-testing policy) so the query flag can never\nsmuggle privilege for a non-SuperAdmin caller.\n\nUnder the SuperAdmin override, active pods are torn down before the\nrow is removed (same K8s path as cancel); the per-session GitLab\ndeploy key is deprovisioned best-effort. 404 if the session doesn't\nbelong to this (tenant, agent) pair; 503 if the K8s API rejects the\npod teardown.",
        "operationId": "tasks_delete_session_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "description": "SuperAdmin-only override: delete a non-terminal session anyway. Requires ``ctx.is_super_admin`` (issue !90). Refused with 409 for a non-SuperAdmin caller so the query param can never smuggle privilege.",
            "in": "query",
            "name": "force",
            "required": false,
            "schema": {
              "default": false,
              "description": "SuperAdmin-only override: delete a non-terminal session anyway. Requires ``ctx.is_super_admin`` (issue !90). Refused with 409 for a non-SuperAdmin caller so the query param can never smuggle privilege.",
              "title": "Force",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Session Route",
        "tags": [
          "tasks"
        ]
      },
      "get": {
        "operationId": "tasks_get_session_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session Route",
        "tags": [
          "tasks"
        ]
      },
      "patch": {
        "description": "Rename the session from the chat header.\n\nReuses the ``tasks:create`` gate \u2014 anyone who can create a session in this\n(tenant, agent) pair can rename one. The auto-namer\n(``services.session_naming``) still runs on every 5th user message and may\noverwrite the user-supplied title on the next boundary; the user can\nalways rename again.",
        "operationId": "tasks_update_session_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionTitleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Session Route",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/archive": {
      "post": {
        "description": "Soft-hide a session from user-facing listings that don't opt in.\n\nIdempotent. Explicitly NOT a delete: the row + its ``task_message``\ntranscript stay intact (decision #37) and the K8s Job / Valkey stream\nare untouched. Callers who want to also stop work should ``cancel``\nfirst. Casbin gate is ``tasks:delete`` \u2014 see the service docstring for\nwhy archive uses the same permission as delete.\n\n404: session doesn't belong to this (tenant, agent) pair.",
        "operationId": "tasks_archive_session_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Archive Session Route",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/attachments": {
      "get": {
        "description": "List every file attachment uploaded in this session, oldest-first.\n\nThe browser uses this to build the \"files in this session\" panel so\nusers can reference prior uploads. The agent SDK uses the internal twin\nof this endpoint via ``ctx.attachments.list()`` (issue #497).",
        "operationId": "tasks_list_session_attachments",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SessionAttachmentRead"
                  },
                  "title": "Response Tasks List Session Attachments",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Session Attachments",
        "tags": [
          "tasks"
        ]
      },
      "post": {
        "description": "Upload a file attachment for a session.\n\nThe file is ClamAV-scanned and stored in the session's GCS workspace folder\nbefore the attachment row is created. Two downstream paths:\n- Images (jpg/jpeg/png/gif/webp): sent as multimodal content blocks to the model broker.\n- Documents (everything else): the GCS path is embedded in message metadata\n  so the agent can pass it to tools such as ``docworker.upload_files``.\n\nReturns 422 for an infected file or an empty upload, 413 for oversized\nuploads, 503 if the AV scanner or GCS is unavailable.",
        "operationId": "tasks_upload_session_attachment",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_tasks_upload_session_attachment"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionAttachmentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Session Attachment",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/brief": {
      "post": {
        "description": "Start a NEW session seeded with a broker-generated brief of this one.\n\nThe user-driven, deliberate alternative to automatic compaction\n(docs/content/context-compaction.md \u00a7 \"Start a new session with a brief\"):\nthe ``system:summary`` model writes a hand-off brief, that brief becomes the\nfirst ``task_message`` of a fresh session linked back via\n``parent_relationship=\"brief\"``, and (unless ``archive_source=false``) the\nsource session moves to ``archived_for_brief``. The source transcript is\nnever modified (decision #37).\n\nGate is ``tasks:create`` \u2014 this creates a session, same as ``POST\n/sessions``. Errors:\n- 404 if the source session doesn't belong to this (tenant, agent) pair\n  (IDOR-safe \u2014 a foreign id gets the same not-found shape as GET).\n- 403 if the source session is read-only (decision #32 \u2014 the archive is a\n  mutation).\n- 402 when the tenant has hit its concurrent-session quota.\n- 409 if the agent has no provisioned GitLab repo yet.\n- 502 if the broker's ``system:summary`` call fails (the brief is the whole\n  point \u2014 we don't silently degrade).\n- 503 if the K8s API rejects the new pod.\n\nReturns 201 with the new brief session row.",
        "operationId": "tasks_start_brief",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionBriefRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Brief",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/cancel": {
      "post": {
        "description": "Stop the agent pod and mark the session terminal.\n\n503 surfaces a K8s-side delete failure; 404 means the session doesn't\nbelong to this (tenant, agent) pair. Optional body ``{\"cascade\": true}``\n(issue #3124) also cancels every still-active descendant subtask; an\nomitted body preserves the fire-and-forget default.",
        "operationId": "tasks_cancel_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionCancelRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Session",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/citations/{citation_id}": {
      "get": {
        "description": "Resolve a ``[m_xxxx]`` citation back to the memory + (optional) source turn.\n\nUser-facing twin of the agent-SDK\n``GET /api/internal/sessions/{s}/memory/{memory_id}`` lookup (issue #1661):\nthe chat-message renderer and the trace inspector page call this when a\nuser clicks a citation badge so the side-panel can render the memory's\nkind / content / created_at plus the originating transcript turn when\nvisible. See issue #1679 and ``docs/content/memories.md`` (Citations).\n\nAccepts the three citation shapes the user might have in hand (rendered\n``[m_abc]``, bare ``m_abc``, raw ``abc``) \u2014 normalised by\n:func:`memory_citations.normalize_citation_id`. ``s_*`` (scenario) ids\nreturn 400 to keep the cross-grammar mistake from silently 404ing.\n\nCross-session degradation: when the memory was pinned to a turn that\nbelongs to a different session, ``source_message_id`` is returned but\n``source_message`` is ``None`` so the UI can render the \"pinned to\nmsg_X \u2014 not visible in this session\" hint (acceptance criterion #6).",
        "operationId": "tasks_get_session_citation",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "citation_id",
            "required": true,
            "schema": {
              "title": "Citation Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryCitation"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session Citation",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/credential-submit": {
      "post": {
        "description": "Browser submits a credential value from the masked input widget.\n\nThe value is stored directly in ``agent_skill.config_enc`` (encrypted at\nrest) and NEVER written to ``session_message`` or conversation history\n(issue #551). Reuses the ``tasks:message`` RBAC gate \u2014 anyone who can\nsend a message in a session can submit a requested credential.\n\nAfter storage a ``credential_stored`` SSE event is published so the\nagent can proceed, and a non-sensitive history message\n(\"Credential stored: [config_key]\") is persisted.",
        "operationId": "tasks_submit_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CredentialSubmit"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Tasks Submit Credential",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Credential",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/dba-approvals/{approval_id}/decide": {
      "post": {
        "description": "Approve/deny one per-statement approval (gates (b)/(c)). OWNER/ADMIN only.",
        "operationId": "tasks_decide_dba_approval",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "approval_id",
            "required": true,
            "schema": {
              "title": "Approval Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalDecision"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Tasks Decide Dba Approval",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Decide Dba Approval",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/dba-writes/enable": {
      "post": {
        "description": "Enable DBA writes for this login (gate (a)). OWNER/ADMIN + operator only.",
        "operationId": "tasks_enable_dba_writes",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableWritesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Enable Dba Writes",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/debug": {
      "get": {
        "description": "Full session dump for the tenant-admin debug view.\n\nReturns the session metadata plus every message (with content and\ntoken counts) in chronological order. Read-only \u2014 no mutations.",
        "operationId": "tasks_debug_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionDebugRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Debug Session",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/digest": {
      "get": {
        "description": "Return the latest structured digest for this session, or ``null``.\n\nAny session-reader (down to a tenant GUEST \u2014 the digest gate mirrors\n``tasks:read``) can read the digest. Wrong-tenant / wrong-agent / missing\nsession all 404 with the same shape (``get_session_for_agent`` raises\n``SessionNotFound`` on any mismatch); an owned session with no digest yet\nreturns ``200 null``.",
        "operationId": "digest_get_session_digest",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/DigestRead"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Response Digest Get Session Digest"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session Digest",
        "tags": [
          "digest"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/editor/results": {
      "post": {
        "description": "Deliver one tool result from the editor attached to this session's turn.",
        "operationId": "tasks_submit_editor_result",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditorToolResult"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "boolean"
                  },
                  "title": "Response Tasks Submit Editor Result",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "403": {
            "description": "Editor access is off for this agent"
          },
          "404": {
            "description": "Nothing is waiting for this result \u2014 final, do not retry"
          },
          "413": {
            "description": "Result too large; truncate it and retry"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Editor Result",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/export": {
      "get": {
        "description": "Download a session's transcript as Markdown (default) or JSON (issue #610).\n\nA re-format of the same transcript the chat UI and ``GET .../messages``\nalready serve to this caller, but a one-click whole-conversation **download**\nis materially easier bulk egress than paginated ``/messages`` reads, which\n``security-testing.md`` classifies as sensitive. So it reuses the\n``tasks:read`` gate for *authorisation* and adds a step-up on top:\n``require_fresh_reauth`` refuses unless the browser caller's verified\n``auth_time`` is fresh (the front-end then sends the user through reauth and\nretries). The agent twin (``export_session_transcript``) carries the matching\n``require_agent_step_up`` so the tool can't be used to dodge this prompt.\nAuthorship is attributed to each turn's *real* author by name, never \"You\"\n(a file is read outside the viewer's context \u2014 #605).\n\nScoping: ``require(\"tasks:read\")`` authorises the caller for *this* tenant\n(``request_context`` asserts path-tenant membership, SuperAdmin aside) and\n``transcript_export.build_export`` resolves the session through the\ntenant-scoped ``sessions.list_messages`` gate, which 404s on any\ntenant/session mismatch (IDOR/BOLA). The redundant ``ctx.tenant_id`` check\nis the same defence-in-depth belt the citation/attachment routes carry.\n\nNo file is written to GCS (the body is rendered in memory and streamed), so\nno ClamAV scan is involved (decision #24 governs ingest/egress of *stored*\nfiles). Every export writes an ``audit_log`` row \u2014 it is a transcript\ndata-egress.",
        "operationId": "tasks_export_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "md",
              "title": "Format",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Export Session",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/fork": {
      "post": {
        "description": "Branch a NEW session from a historical message of session ``{session_id}``.\n\nSession forking (issue #8): \"go back to before the agent went down the\nwrong path and try a different instruction\" without touching the original.\nThe new fork references the parent's transcript up to and including\n``fork_message_id`` (the \"cut\") \u2014 the session-history endpoints render that\nas a read-only parent-prefix \u2014 and is append-only from its own birth. The\nparent transcript is never modified (decision #37): forking is the\nsanctioned no-truncation design. See docs/content/session-forking.md.\n\nGate is ``tasks:create`` \u2014 a fork *is* a new session, same as ``POST\n/sessions`` and ``/brief``. Errors:\n- 401/403 for anonymous / insufficient per-agent role (the real Casbin gate).\n- 403 if the caller is operating in a read-only session capsule (decision\n  #32 \u2014 forking is a mutation; the fork itself *inherits* the parent's\n  ``read_only`` stance, so a read-only investigation forks into a read-only\n  branch, but a read-only actor cannot initiate the fork).\n- 404 if the parent session doesn't belong to this (tenant, agent) pair, or\n  if ``fork_message_id`` is not a message of that parent \u2014 both return the\n  same not-found shape as GET (IDOR/BOLA-safe: a foreign id can't be used\n  to confirm a message exists in a session the caller doesn't own).\n- 402 when the tenant has hit its concurrent-session / daily-task quota.\n- 409 if the agent has no provisioned GitLab repo yet.\n- 503 if the K8s API rejects the new pod.\n\nState reconstruction (memory replay, workspace copy-at-cut, repo\ncheckout-at-cut, irreversible-effect markers) is deliberately deferred to\nthe effect-ledger P2 (docs/content/session-effect-ledger.md, #512): a v1\nfork starts with fresh backends. Returns 201 with the new fork session row.",
        "operationId": "tasks_fork_session_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkSessionCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fork Session Route",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/listen": {
      "post": {
        "description": "Toggle the chat \"shut up and listen\" loop for this session.\n\n`on=True` enters the loop (user messages buffer, the agent is not invoked);\n`on=False` exits and flushes the buffered messages as one combined prompt.\nReuses the `tasks:message` gate \u2014 it's the same actor driving the same\nsession's conversational input. See docs/content/chat-listen-mode.md.",
        "operationId": "tasks_set_listen_mode",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListenModeUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Listen Mode",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/messages": {
      "get": {
        "description": "Return the full message history for a session, ordered oldest-first.\n\nIncludes tool-call turns, tool results, and all intermediate agent turns so that\na page refresh during an active task shows complete progress. See #641.",
        "operationId": "tasks_list_messages",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TaskMessageOut"
                  },
                  "title": "Response Tasks List Messages",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Messages",
        "tags": [
          "tasks"
        ]
      },
      "post": {
        "description": "Persist the user's message and enqueue it on the agent's task stream.\n\nRead-only sessions still accept user messages \u2014 the read-only flag blocks\nside-effecting *agent* writes (memory / repo / cron), not conversational\ninput that drives the agent. See decision #32 / `docs/read-only-mode.md`.",
        "operationId": "tasks_add_message",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskMessageCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskMessageRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Message",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/messages/{message_id}/feedback": {
      "delete": {
        "description": "Remove the calling user's feedback on a message.",
        "operationId": "feedback_delete_feedback",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Feedback",
        "tags": [
          "feedback"
        ]
      },
      "get": {
        "description": "Return the calling user's feedback on a message, or 404.",
        "operationId": "feedback_get_feedback",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageFeedbackRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Feedback",
        "tags": [
          "feedback"
        ]
      },
      "post": {
        "description": "Create or update feedback on an agent message.",
        "operationId": "feedback_upsert_feedback",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "message_id",
            "required": true,
            "schema": {
              "title": "Message Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageFeedbackCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageFeedbackRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upsert Feedback",
        "tags": [
          "feedback"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/participants": {
      "get": {
        "description": "Return the humans present in a session for the presence indicator (#606).\n\nA session can silently become multi-user. The chip rendered from this list\ntells a viewer that another human can see the conversation and the agent's\noutput (awareness / consent). Participants are *who has participated* \u2014 the\nsession owner plus every distinct human-turn author (issue #605) \u2014 not live\nview-presence, which has no signal today (deferred follow-up).\n\n**Consent surface, so authorization is load-bearing:**\n\n- Gated by ``tasks:read`` (same as the transcript) \u2014 a non-member / anon\n  caller never reaches it.\n- Ownership is validated against ``(tenant_id, agent_id)`` via\n  ``get_session_for_agent``, which raises the SAME 404 for a wrong-tenant\n  or wrong-agent ``session_id`` as for a missing one \u2014 a caller can't probe\n  another tenant's session or learn who is in it (IDOR / BOLA).\n- Names are resolved id->name **server-side, scoped to this tenant**\n  (``user_labels``, reused from #605), so a participant's name can never\n  leak across tenants; the ``user_id`` is returned so the browser decides\n  which participant is *itself* (never baked server-side).",
        "operationId": "tasks_list_session_participants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionParticipantsOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Session Participants",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/resume": {
      "post": {
        "description": "Spawn a new pod bound to the same `gcs_workdir`. The previous pod must\nalready be gone (terminal status) \u2014 typically after a completed run or a\ncancel. Status flips back to PENDING; the next reconcile lifts it.",
        "operationId": "tasks_resume_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resume Session",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/settlement/changeset": {
      "get": {
        "description": "The reviewable proposal for this session (staged workspace files + repo lane).",
        "operationId": "settlement_get_changeset",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Changeset"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Changeset",
        "tags": [
          "settlement"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/settlement/settle": {
      "post": {
        "description": "Select / apply / discard one lane of this session's retained output.\n\nSensitive: requires a fresh browser reauth (decision #49). 403 read-only /\ntenant mismatch / stale reauth, 404 missing session or empty lane, 409\nalready settled or refused (fast-forward blocked / path overlap), 422\ninfected staged file, 503 scanner down.",
        "operationId": "settlement_settle",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettleResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Settle",
        "tags": [
          "settlement"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/subtasks/active": {
      "get": {
        "description": "List this session's still-running descendant subtasks (issue #3124).\n\nPowers the reap picker and the \"N running subtasks\" indicator a failed or\ncompleted parent shows. 404 if the session doesn't belong to this\n(tenant, agent) pair \u2014 a foreign id can't enumerate another session's\nfan-out.",
        "operationId": "tasks_list_active_subtasks",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActiveSubtasksResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Active Subtasks",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/subtasks/cancel": {
      "post": {
        "description": "Cancel a selected set of this session's active descendant subtasks (#3124).\n\nThe checkbox-reap path for a failed or completed parent. Only ids that are\nlive descendants of ``session_id`` are cancelled; anything else (already\nterminal, not in this subtree, or another session's row) is silently\ndropped, so the response reflects exactly what was stopped. 404 if the\nparent session isn't owned by this (tenant, agent) pair.",
        "operationId": "tasks_cancel_subtasks",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubtaskCancelRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubtaskCancelResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Subtasks",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/unarchive": {
      "post": {
        "description": "Restore an archived session to the default listings. Idempotent.\n\n404: session doesn't belong to this (tenant, agent) pair.",
        "operationId": "tasks_unarchive_session_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unarchive Session Route",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/workspace/file": {
      "get": {
        "description": "Read one workspace file (ClamAV-scanned) for the viewer/editor.",
        "operationId": "agent_workspace_read_workspace_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "description": "Path relative to the workspace root",
            "in": "query",
            "name": "path",
            "required": true,
            "schema": {
              "description": "Path relative to the workspace root",
              "title": "Path",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceFileContent"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Read Workspace File",
        "tags": [
          "agent-workspace"
        ]
      },
      "put": {
        "description": "Create or overwrite a workspace file.\n\nRefuses read-only sessions with 403 (decision #32), scans the bytes with\nClamAV (decision #24), and records an audit row. 422 for an infected file,\n413 when the payload is too large, 400 for a bad path or malformed base64.",
        "operationId": "agent_workspace_write_workspace_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceFileWrite"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceEntry"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Write Workspace File",
        "tags": [
          "agent-workspace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/sessions/{session_id}/workspace/tree": {
      "get": {
        "description": "List the files in this session's ``/workspace`` folder (flat, path-keyed).",
        "operationId": "agent_workspace_list_workspace_tree",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceListing"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Workspace Tree",
        "tags": [
          "agent-workspace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/skill-credentials": {
      "get": {
        "description": "List the caller's live (non-revoked) credentials for the given agent.\n\nMetadata only \u2014 never the payload. Use the per-skill reveal endpoint to\nfetch plaintext (audited).",
        "operationId": "skill_credentials_list_skill_credentials",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillCredentialRead"
                  },
                  "title": "Response Skill Credentials List Skill Credentials",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Skill Credentials",
        "tags": [
          "skill-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/skill-credentials/skill/{skill_id}": {
      "delete": {
        "description": "Soft-revoke the credential. Returns 404 if no live row exists.\n\nSets ``revoked_at`` rather than dropping the row so audit history can\nstill explain \"this credential resolved here through date X\".",
        "operationId": "skill_credentials_revoke_skill_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Skill Credential",
        "tags": [
          "skill-credentials"
        ]
      },
      "put": {
        "description": "Create or rotate the credential for ``(ctx.user_id, agent_id, skill_id)``.\n\nIdempotent on the triple \u2014 a second call overwrites the ciphertext and\nrefreshes ``updated_at``. The body's ``agent_id`` / ``skill_id`` must\nmatch the path values (defence in depth against the wrong triple landing\nin the table on a buggy client).",
        "operationId": "skill_credentials_upsert_skill_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillCredentialCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillCredentialRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upsert Skill Credential",
        "tags": [
          "skill-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/skill-credentials/skill/{skill_id}/reveal": {
      "get": {
        "description": "Decrypt and return the credential for the triple. Audited on every call.\n\nReturns 404 if the row is missing, revoked, or expired \u2014 the caller\nnever learns *which* of the three failed (an attacker could otherwise\nuse the distinction to probe for valid triples).",
        "operationId": "skill_credentials_read_skill_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillCredentialReveal"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Read Skill Credential",
        "tags": [
          "skill-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/video/routes": {
      "get": {
        "operationId": "video_list_routes",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/VideoRouteRead"
                  },
                  "title": "Response Video List Routes",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Routes",
        "tags": [
          "video"
        ]
      },
      "post": {
        "operationId": "video_create_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRouteCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoRouteWithToken"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Route",
        "tags": [
          "video"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/video/routes/{route_id}": {
      "delete": {
        "operationId": "video_delete_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Route",
        "tags": [
          "video"
        ]
      },
      "get": {
        "operationId": "video_get_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoRouteRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Route",
        "tags": [
          "video"
        ]
      },
      "patch": {
        "operationId": "video_update_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRouteUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoRouteRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Route",
        "tags": [
          "video"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/voice": {
      "delete": {
        "description": "Delete the calling user's voice config, reverting to defaults.",
        "operationId": "voice_delete_voice_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Voice Config",
        "tags": [
          "voice"
        ]
      },
      "get": {
        "description": "Get the calling user's voice config for this agent, or null if unset.",
        "operationId": "voice_get_voice_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/VoiceConfigRead"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Response Voice Get Voice Config"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Voice Config",
        "tags": [
          "voice"
        ]
      },
      "put": {
        "description": "Set or update the calling user's voice config for this agent.",
        "operationId": "voice_upsert_voice_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceConfigUpsert"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upsert Voice Config",
        "tags": [
          "voice"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/voice/options": {
      "get": {
        "description": "Which voice providers the tenant allows (browser is always available).",
        "operationId": "voice_get_voice_options",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceOptionsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Voice Options",
        "tags": [
          "voice"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/voice/profiles": {
      "get": {
        "description": "Voice profiles on the in-cluster Voicebox instance (picker source).",
        "operationId": "voice_list_voice_profiles",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceProfilesRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Voice Profiles",
        "tags": [
          "voice"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/voice/transcribe": {
      "post": {
        "description": "Transcribe a browser-recorded clip (ClamAV-scanned, decision #24).",
        "operationId": "voice_transcribe_speech",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceTranscribeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceTranscribeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Transcribe Speech",
        "tags": [
          "voice"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agent/{agent_id}/voice/tts": {
      "post": {
        "description": "Synthesize speech via the broker's Voicebox provider (decision #12).",
        "operationId": "voice_synthesize_speech",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceTtsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceTtsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Synthesize Speech",
        "tags": [
          "voice"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents": {
      "get": {
        "operationId": "agents_list_agents",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "favorites",
            "required": false,
            "schema": {
              "default": 0,
              "maximum": 1,
              "minimum": 0,
              "title": "Favorites",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "owner",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Owner"
            }
          },
          {
            "in": "query",
            "name": "include_hidden",
            "required": false,
            "schema": {
              "default": 0,
              "maximum": 1,
              "minimum": 0,
              "title": "Include Hidden",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "default": "name_asc",
              "title": "Sort",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentListRead"
                  },
                  "title": "Response Agents List Agents",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agents",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "operationId": "agents_create_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Agent",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/guardrail-model-options": {
      "get": {
        "description": "Return the enumerated set of guardrail model IDs available for selection.\n\nComboboxes in the agent settings Guardrails section source from this list\nwhile still accepting free-form input for forward-compat.  Gated to\nOWNER/ADMIN via ``agent:proxy_config:read`` \u2014 same as the per-agent GET.\nThe explicit ``obj_template`` anchors the Casbin object under\n``/{tenant_id}/agents/*`` so the existing AGENT_MANAGER/AGENT_OWNER\npolicies match without adding new policy lines.  Issue #2321.",
        "operationId": "agents_list_guardrail_model_options",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuardrailModelOptionsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Guardrail Model Options",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/import": {
      "post": {
        "description": "Create an agent from an uploaded ``verinfast.agent-export`` bundle.",
        "operationId": "agent_import_import_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_agent_import_import_agent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentImportResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import Agent",
        "tags": [
          "agent-import"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/import-from-gcs": {
      "post": {
        "description": "JSON sibling of :func:`import_agent`, reading the bundle from GCS.",
        "operationId": "agent_import_import_agent_from_gcs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentImportFromGcsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentImportResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import Agent From Gcs",
        "tags": [
          "agent-import"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}": {
      "delete": {
        "operationId": "agents_delete_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Agent",
        "tags": [
          "agents"
        ]
      },
      "get": {
        "operationId": "agents_get_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Agent",
        "tags": [
          "agents"
        ]
      },
      "patch": {
        "operationId": "agents_update_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Agent",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/atd-grants": {
      "get": {
        "description": "List an agent's atd grants. Live-only unless ``include_revoked``.",
        "operationId": "agents_list_atd_grants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_revoked",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Revoked",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AtdGrantRead"
                  },
                  "title": "Response Agents List Atd Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Atd Grants",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Grant an agent atd query access, optionally narrowed to one repository.",
        "operationId": "agents_create_atd_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AtdGrantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AtdGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Atd Grant",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/atd-grants/{grant_id}": {
      "delete": {
        "description": "Revoke one grant. Takes effect on the agent's very next atd query.",
        "operationId": "agents_revoke_atd_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "grant_id",
            "required": true,
            "schema": {
              "title": "Grant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AtdGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Atd Grant",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/avatar": {
      "delete": {
        "description": "Remove the platform avatar. The GitLab avatar is left as last synced.",
        "operationId": "agents_delete_avatar",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentAvatarRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Avatar",
        "tags": [
          "agents"
        ]
      },
      "get": {
        "operationId": "agents_fetch_avatar",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fetch Avatar",
        "tags": [
          "agents"
        ]
      },
      "put": {
        "description": "Upload an avatar. Normalised to a 192x192 PNG, scanned in and out, then\npushed to the agent's GitLab user (best-effort; see ``gitlab_synced``).",
        "operationId": "agents_upload_avatar",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_agents_upload_avatar"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentAvatarRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Avatar",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/budget": {
      "get": {
        "operationId": "agents_get_budget",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Budget",
        "tags": [
          "agents"
        ]
      },
      "patch": {
        "operationId": "agents_set_budget",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentBudgetUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Budget",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/can-author-skills": {
      "put": {
        "description": "Toggle the agent-level skill authoring permission.\n\nThe path, body field, and audit action all use ``can_author_skills`` so\nthey match the column name exposed by ``AgentRead``. No second name for\nthe same boolean.",
        "operationId": "agents_update_can_author_skills",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCanAuthorSkillsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Can Author Skills",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/clone": {
      "post": {
        "description": "Clone an existing agent into a new independent agent.",
        "operationId": "agents_clone_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentClone"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Clone Agent",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/code-findings": {
      "get": {
        "operationId": "code_findings_list_agent_findings",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "scanner",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Scanner"
            }
          },
          {
            "in": "query",
            "name": "severity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Per Page",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CodeFindingRead"
                  },
                  "title": "Response Code Findings List Agent Findings",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Findings",
        "tags": [
          "code-findings"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/dev-env": {
      "get": {
        "description": "Is this agent's dev environment up? Drives the Start button's state.",
        "operationId": "agents_get_dev_env",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevEnvStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Dev Env",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Start (or adopt) this agent's dev environment.\n\nThe request body carries nothing \u2014 deliberately. The internal route lets its\ncaller override the image, but a browser must not choose what image runs in\nthe tenant's cluster, so the image is resolved server-side (the platform\nagent base image, ``settings.agent_base_image``). ``DevEnvStartRequest``\nforbids extra fields, so a smuggled ``image``, ``tenant_id`` or\n``is_super_admin`` is a 422, never a silently applied one.",
        "operationId": "agents_start_dev_env",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/DevEnvStartRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevEnvCreateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Dev Env",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/dev-env/ssh-keys": {
      "get": {
        "description": "List extra SSH keys for an agent's dev environment.",
        "operationId": "agents_list_extra_ssh_keys",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DevEnvExtraSshKeyRead"
                  },
                  "title": "Response Agents List Extra Ssh Keys",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Extra Ssh Keys",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Grant an additional SSH account to an agent's dev environment.\n\nStep-up-gated (``agent_ssh_key``, GitLab #345), same as the owner key on\n``PATCH /agents/{id}``: the key lands in the dev env's ``authorized_keys``.\nA human proves a fresh reauth; an agent (a future per-user Michael tool)\npresents a live grant \u2014 ``require_step_up`` picks by caller (#541).",
        "operationId": "agents_add_extra_ssh_key",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevEnvExtraSshKeyCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevEnvExtraSshKeyRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Extra Ssh Key",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/dev-env/ssh-keys/group-ide-grants": {
      "get": {
        "description": "List the agent's web-IDE grants to tenant groups (#424).",
        "operationId": "agents_list_group_ide_grants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DevEnvGroupIdeGrantRead"
                  },
                  "title": "Response Agents List Group Ide Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Group Ide Grants",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Grant web-IDE access to a tenant group's user members (#424).\n\nSensitive (opens a browser session onto the dev env), so it needs the same\nstep-up as an SSH-key grant \u2014 browser (fresh reauth) or agent (live grant),\npicked by ``require_step_up`` so Michael's ``dev_ide_grant`` tool works\n(#541). A group from another tenant returns the same 404 as a missing agent\n\u2014 no cross-tenant existence oracle. No key material is installed (the browser\neditor runs as the shared uid).",
        "operationId": "agents_add_group_ide_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevEnvGroupIdeGrantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevEnvGroupIdeGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Group Ide Grant",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/dev-env/ssh-keys/group-ide-grants/{group_id}": {
      "delete": {
        "description": "Revoke a group's web-IDE grant (#424). Immediate; idempotent.",
        "operationId": "agents_remove_group_ide_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Group Ide Grant",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/dev-env/ssh-keys/{username}": {
      "delete": {
        "description": "Revoke an extra SSH account from an agent's dev environment.\n\nStep-up-gated too (``agent_ssh_key``, GitLab #345) \u2014 same purpose as a grant,\nas clearing the owner key needs the same step-up as setting it (browser or\nagent, ``require_step_up``).",
        "operationId": "agents_remove_extra_ssh_key",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "username",
            "required": true,
            "schema": {
              "title": "Username",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Extra Ssh Key",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/favorite": {
      "delete": {
        "operationId": "agents_remove_favorite",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Favorite",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "operationId": "agents_add_favorite",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentFavoriteRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Favorite",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/files/{file_path}": {
      "get": {
        "description": "Serve an agent workspace file via a short-lived signed GCS URL.\n\n1. Verify user has read access to this agent (via ``require(\"agent:read\")``)\n2. Resolve the file in the agent's GCS workspace\n3. Check for an existing clean ``file_scan`` row; if none, trigger a\n   synchronous ClamAV scan\n4. If clean, redirect to a 15-min signed GCS URL\n5. Return 404 (not found), 403 (access denied / tenant mismatch),\n   422 (infected)",
        "operationId": "agent_files_serve_agent_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "file_path",
            "required": true,
            "schema": {
              "title": "File Path",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to a short-lived signed GCS URL"
          },
          "400": {
            "description": "Invalid file path"
          },
          "403": {
            "description": "Tenant mismatch or access denied"
          },
          "404": {
            "description": "Agent or file not found"
          },
          "422": {
            "description": "File failed virus scan"
          },
          "503": {
            "description": "Virus scanner unavailable"
          }
        },
        "summary": "Serve Agent File",
        "tags": [
          "agent-files"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/ide-session": {
      "post": {
        "description": "Open an IDE session: mint this session's credentials and inject them.",
        "operationId": "dev_env_ide_open_ide_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdeSessionOpen"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdeSessionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Open Ide Session",
        "tags": [
          "dev-env-ide"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/ide-session/eligibility": {
      "get": {
        "description": "Read-only: may this caller open the IDE here?\n\nThe front-end gates its controls on this rather than on \"a session exists\",\nper the ABAC rule \u2014 and reading it must never have the side effect of\nminting a credential, which is why this is not just \"try to open one\".\n\nUnlike the mutating routes this returns ``eligible: false`` instead of a\n404. It leaks nothing a caller cannot already determine: they are asking\nabout *their own* access to an agent they already hold ``agent:ui:view``\non, and the answer for someone else's agent is the same ``false`` a\nnon-existent one gives.",
        "operationId": "dev_env_ide_ide_eligibility",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdeEligibility"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Ide Eligibility",
        "tags": [
          "dev-env-ide"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/ide-session/{session_id}": {
      "delete": {
        "description": "Close a session: revoke its credentials and wipe them from the pod.",
        "operationId": "dev_env_ide_close_ide_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Close Ide Session",
        "tags": [
          "dev-env-ide"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/ide-session/{session_id}/heartbeat": {
      "post": {
        "description": "Keep the session alive. Lane 7 meters from this; lane 8 parks off it.",
        "operationId": "dev_env_ide_heartbeat",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Heartbeat",
        "tags": [
          "dev-env-ide"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/ide-session/{session_id}/mounts": {
      "get": {
        "operationId": "dev_env_ide_list_mounts",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdeMountsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Mounts",
        "tags": [
          "dev-env-ide"
        ]
      },
      "post": {
        "description": "Mount one repo \u2014 only what the user clicked 'edit' on.",
        "operationId": "dev_env_ide_add_mount",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdeMountCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdeMountsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Mount",
        "tags": [
          "dev-env-ide"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/image-repo": {
      "post": {
        "description": "Scaffold the custom-image GitLab repo for an agent (GitLab #49, decision #9).\n\nCreates the 4th per-tenant subgroup repo\n``good-place/tenants/<slug>/agent-images/<agent_slug>`` and seeds it with a\ndeps-only ``Dockerfile`` (extending the platform base image),\n``requirements.txt``, ``.dockerignore``, and a build+push ``.gitlab-ci.yml``.\nThe tenant admin then fills in the dependencies; the pipeline pushes the\nbuilt image to the tenant's own GCR namespace, and the agent's ``image_ref``\ncan be pointed at it.\n\nOWNER/ADMIN only (``agent:image_repo:create`` \u2014 no MEMBER policy row, so the\nreal Casbin gate refuses non-admins). Tenancy is server-derived: the target\ntenant is ``ctx.tenant_id`` (the path ``tenant_id`` is asserted against the\ncaller's membership by ``request_context`` before Casbin runs), the tenant\nslug is read from that row, and the agent slug from the agent row scoped to\nthat tenant \u2014 no body is accepted, so there is nothing to smuggle. Refused\nin a read-only session (decision #32).",
        "operationId": "agents_create_agent_image_repo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentImageRepoRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Agent Image Repo",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/integrations": {
      "get": {
        "description": "Return the set of supported per-agent integrations with connected status.",
        "operationId": "integrations_list_agent_integrations",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentIntegrationRead"
                  },
                  "title": "Response Integrations List Agent Integrations",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Integrations",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/integrations/slack": {
      "delete": {
        "description": "Revoke this agent's Slack bot token.\n\nDeletes the ``tenant_identity`` row with provider ``slack:bot:{slug}``.\nDoes nothing and returns 204 if the token was never installed.",
        "operationId": "integrations_revoke_agent_slack",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Agent Slack",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/integrations/slack/connect": {
      "post": {
        "description": "Begin the Slack OAuth flow to install a bot token for this agent.\n\nIssues an agent-scoped state token and returns the Slack authorize URL.\nThe browser must redirect to that URL; Slack will bounce back to the\ncallback endpoint when the user completes the install.",
        "operationId": "integrations_connect_agent_slack",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectAgentIntegrationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Connect Agent Slack",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/integrations/slack/rotate": {
      "post": {
        "description": "Re-run the Slack OAuth flow to rotate the agent's bot token.\n\nSame machinery as ``connect``; the callback's upsert is idempotent.",
        "operationId": "integrations_rotate_agent_slack",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectAgentIntegrationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Agent Slack",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/kahala-grants": {
      "get": {
        "description": "List an agent's Kahala grants. Live-only unless ``include_revoked``.",
        "operationId": "agents_list_kahala_grants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_revoked",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Revoked",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/KahalaGrantRead"
                  },
                  "title": "Response Agents List Kahala Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Kahala Grants",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Grant an agent Kahala query access, optionally narrowed to one wiki.\n\nA non-null ``wiki_slug`` must exist in this tenant's Kahala registry\n(#240) \u2014 404 ``wiki not found`` otherwise, 503 if it can't be checked.",
        "operationId": "agents_create_kahala_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KahalaGrantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KahalaGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Kahala Grant",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/kahala-grants/{grant_id}": {
      "delete": {
        "description": "Revoke one grant. Takes effect on the agent's very next Kahala query.",
        "operationId": "agents_revoke_kahala_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "grant_id",
            "required": true,
            "schema": {
              "title": "Grant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KahalaGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Kahala Grant",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/model-chain": {
      "get": {
        "description": "Return the agent's model grants ordered by priority (ascending).",
        "operationId": "agents_get_model_chain",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentModelRead"
                  },
                  "title": "Response Agents Get Model Chain",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Model Chain",
        "tags": [
          "agents"
        ]
      },
      "put": {
        "description": "Replace the agent's model chain with an ordered list of model IDs.",
        "operationId": "agents_set_model_chain",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentModelChainUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentModelRead"
                  },
                  "title": "Response Agents Set Model Chain",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Model Chain",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/models": {
      "get": {
        "description": "Every tenant-reachable chat model, any kind, with the agent's toggle.",
        "operationId": "models_list_agent_models",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentCatalogModel"
                  },
                  "title": "Response Models List Agent Models",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Models",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/models/{model_id}/disable": {
      "post": {
        "description": "Remove the agent's grant for a model. Idempotent.",
        "operationId": "models_disable_agent_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCatalogToggle"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Disable Agent Model",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/models/{model_id}/enable": {
      "post": {
        "description": "Grant the agent a tenant-reachable model of any kind. Idempotent.",
        "operationId": "models_enable_agent_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCatalogToggle"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Enable Agent Model",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/openrouter/models": {
      "get": {
        "description": "List tenant-active OR models with the agent's enable toggle.",
        "operationId": "openrouter_list_agent_models",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/JsonObject"
                  },
                  "title": "Response Openrouter List Agent Models",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Models",
        "tags": [
          "openrouter"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/openrouter/models/{model_id}/disable": {
      "post": {
        "description": "Agent owner: disable an OR model for an agent. Idempotent.",
        "operationId": "openrouter_disable_for_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Openrouter Disable For Agent",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Disable For Agent",
        "tags": [
          "openrouter"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/openrouter/models/{model_id}/enable": {
      "post": {
        "description": "Agent owner: enable an OR model for an agent. Idempotent.",
        "operationId": "openrouter_enable_for_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Openrouter Enable For Agent",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Enable For Agent",
        "tags": [
          "openrouter"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/prompt-provenance": {
      "get": {
        "description": "Repo history and live-vs-repo drift for this agent's two prompt files.",
        "operationId": "agents_read_prompt_provenance",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPromptProvenanceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Read Prompt Provenance",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/proxy-config": {
      "get": {
        "description": "Return the per-agent guardrail model overrides.\n\nA ``null`` value for a field means the global default (from ``Settings``)\napplies. Gated to OWNER/ADMIN via the ``agent:proxy_config:read``\npermission (decision #10, issue #2319).",
        "operationId": "agents_get_proxy_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProxyGuardrailConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Proxy Config",
        "tags": [
          "agents"
        ]
      },
      "put": {
        "description": "Partial update of the per-agent guardrail model overrides.\n\nOmitted fields are left untouched; sending a field as ``null`` clears\nthe override. Model IDs are stored as-is without validation; the proxy\nrejects unresolvable IDs at inference time. Gated to OWNER/ADMIN via\nthe ``agent:proxy_config:write`` permission (decision #10, issue #2319).",
        "operationId": "agents_update_proxy_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProxyGuardrailConfigUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProxyGuardrailConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Proxy Config",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/roles": {
      "get": {
        "description": "List all role assignments for an agent.",
        "operationId": "agent_roles_list_roles",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentRoleAssignmentRead"
                  },
                  "title": "Response Agent Roles List Roles",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Roles",
        "tags": [
          "agent-roles"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/roles/default": {
      "get": {
        "description": "Return whether the per-agent tenant default is enabled for this agent.",
        "operationId": "agent_roles_get_default_role",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDefaultRoleRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Default Role",
        "tags": [
          "agent-roles"
        ]
      },
      "put": {
        "description": "Enable or tighten the per-agent tenant default on this agent.",
        "operationId": "agent_roles_set_default_role",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentDefaultRoleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDefaultRoleRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Default Role",
        "tags": [
          "agent-roles"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/roles/group-grants": {
      "get": {
        "description": "List the group role grants on this agent.",
        "operationId": "agent_roles_list_group_grants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentRoleGroupGrantRead"
                  },
                  "title": "Response Agent Roles List Group Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Group Grants",
        "tags": [
          "agent-roles"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/roles/group-grants/{group_id}": {
      "delete": {
        "description": "Remove a group's per-agent role grant on this agent.",
        "operationId": "agent_roles_remove_group_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Group Grant",
        "tags": [
          "agent-roles"
        ]
      },
      "put": {
        "description": "Grant a tenant group a per-agent role on this agent (create or update).",
        "operationId": "agent_roles_set_group_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRoleGroupGrantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRoleGroupGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Group Grant",
        "tags": [
          "agent-roles"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/roles/permissions-grid": {
      "get": {
        "description": "Return the permissions grid metadata for the frontend.",
        "operationId": "agent_roles_get_permissions_grid",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRolePermissionGrid"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Permissions Grid",
        "tags": [
          "agent-roles"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/roles/{user_id}": {
      "delete": {
        "description": "Remove a user's role assignment for this agent.",
        "operationId": "agent_roles_remove_role",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Role",
        "tags": [
          "agent-roles"
        ]
      },
      "put": {
        "description": "Set a user's role for this agent. Creates or updates the assignment.",
        "operationId": "agent_roles_set_role",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRoleAssignmentCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRoleAssignmentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Role",
        "tags": [
          "agent-roles"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/skill-permissions": {
      "get": {
        "description": "Return all skill permission rows for an agent.",
        "operationId": "agents_list_skill_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentSkillPermissionRead"
                  },
                  "title": "Response Agents List Skill Permissions",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Skill Permissions",
        "tags": [
          "agents"
        ]
      },
      "put": {
        "description": "Replace the skill permission allowlist for an agent.",
        "operationId": "agents_update_skill_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSkillPermissionUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentSkillPermissionRead"
                  },
                  "title": "Response Agents Update Skill Permissions",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Skill Permissions",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/skill-visibility-scope": {
      "put": {
        "description": "Set the skill-authoring visibility scope for this agent.\n\n``private_only`` \u2014 agent may only author ``visibility='private'`` skills.\n``tenant_allowed`` \u2014 agent may also author ``visibility='public'`` skills.\n\nOWNER/ADMIN only (issue #550): ``agent:skill_visibility_scope:write`` has no\n``policy.csv`` row, so only their ``*`` wildcard holds it. It used to be\n``agent:update``, which MEMBER holds on ``/{tenant_id}/agents/*`` \u2014 the very\nobject this ``{agent_id}`` route authorizes on \u2014 so any member could let any\nagent publish tenant-visible skills (GitLab #345).",
        "operationId": "agents_update_skill_visibility_scope",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSkillVisibilityScopeUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Skill Visibility Scope",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/skills": {
      "get": {
        "operationId": "agents_list_agent_skills",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentSkillRead"
                  },
                  "title": "Response Agents List Agent Skills",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Skills",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "operationId": "agents_add_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSkillGrant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Skill",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/skills/{skill_id}": {
      "delete": {
        "operationId": "agents_remove_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Skill",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/skills/{skill_id}/config": {
      "get": {
        "description": "Decrypted per-attachment config blob.\n\nGated behind ``agent:skills:write`` because the blob may carry sensitive\nsettings (and we don't want it on the cheap read RBAC path). Returns\n``config=None`` when no blob has been set.",
        "operationId": "agents_get_agent_skill_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSkillConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Agent Skill Config",
        "tags": [
          "agents"
        ]
      },
      "patch": {
        "description": "Replace the per-attachment config blob (or clear it).\n\nA ``config`` field that is ``null`` or omitted clears the column.\nOtherwise the dict is JSON-serialised and encrypted with the tenant's\nFernet key before persisting.\n\nSecrets should still flow through ``linked_identity`` /\n``tenant_identity`` and ``request_credential`` (#551) so they never reach\nchat history \u2014 but the column is encrypted regardless to keep accidental\nwrites out of plaintext on disk.",
        "operationId": "agents_update_agent_skill_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSkillConfigUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Agent Skill Config",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/slack-config": {
      "get": {
        "operationId": "agents_get_slack_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSlackConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Slack Config",
        "tags": [
          "agents"
        ]
      },
      "put": {
        "operationId": "agents_update_slack_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSlackConfigUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSlackConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Slack Config",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/tool-bundles": {
      "get": {
        "description": "Which bundles one agent holds.",
        "operationId": "agents_list_agent_tool_bundles",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentToolBundleRead"
                  },
                  "title": "Response Agents List Agent Tool Bundles",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Tool Bundles",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Bind a bundle's tools to this agent. Idempotent.",
        "operationId": "agents_grant_tool_bundle",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentToolBundleGrantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentToolBundleRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant Tool Bundle",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/tool-bundles/{bundle_id}": {
      "delete": {
        "description": "Unbind a bundle. The agent stops loading its tools on its next boot.",
        "operationId": "agents_revoke_tool_bundle",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "bundle_id",
            "required": true,
            "schema": {
              "title": "Bundle Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolBundleRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Tool Bundle",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/tools": {
      "get": {
        "operationId": "agents_list_agent_tools",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AgentToolRead"
                  },
                  "title": "Response Agents List Agent Tools",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Agent Tools",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "operationId": "agents_add_tool",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentToolGrant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentToolRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Tool",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/tools/{tool_id}": {
      "delete": {
        "operationId": "agents_remove_tool",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tool_id",
            "required": true,
            "schema": {
              "title": "Tool Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Tool",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/transfer-ownership": {
      "post": {
        "operationId": "agents_transfer_ownership",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentOwnershipTransfer"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Transfer Ownership",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/agents/{agent_id}/users": {
      "post": {
        "description": "Add or update a per-agent role grant in the legacy VIEWER/EDITOR shape.\n\nSince #477 this is a thin facade over the unified ``agent_role_assignment``\nmodel (VIEWER->VIEWER, EDITOR->MANAGER); the write funnels through the single\n``agent_roles.set_role`` path, so it also enforces tenant membership.",
        "operationId": "agents_grant_user",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUserGrant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUserGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant User",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/atd/repositories": {
      "get": {
        "description": "Every repository scanned across any report for this tenant's atd org.",
        "operationId": "atd_list_atd_repositories",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AtdRepositoryListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Atd Repositories",
        "tags": [
          "atd"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/agent-costs": {
      "get": {
        "description": "Per-agent cost breakdown for the requested time window.\n\nRequires ``tenant:billing:read`` (OWNER / ADMIN wildcard covers it) and\nthe ``can_view_billing`` capability.",
        "operationId": "billing_get_agent_costs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "enum": [
                "day",
                "week",
                "month"
              ],
              "title": "Period",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCostsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Agent Costs",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/category-costs": {
      "get": {
        "description": "Per-session-category cost breakdown for the requested time window.\n\nRequires ``tenant:billing:read`` (OWNER / ADMIN wildcard covers it) and the\n``can_view_billing`` capability \u2014 same gates as the sibling cost tabs.",
        "operationId": "billing_get_category_costs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "enum": [
                "day",
                "week",
                "month"
              ],
              "title": "Period",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryCostsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Category Costs",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/change-plan": {
      "post": {
        "description": "Move this workspace onto the public plan ``plan_code``.\n\n``checkout`` \u2192 send the browser to ``url``; ``changed`` \u2192 done (the live\nsubscription was repriced in place, prorated, or a free plan was switched\nto directly); ``unchanged`` \u2192 already on it.",
        "operationId": "billing_change_plan",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantPlanChangeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantPlanChangeResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Change Plan",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/checkout-session": {
      "post": {
        "description": "Open Stripe Checkout for the tenant's plan subscription (GitLab #353).\n\n**Takes no body.** What is charged is derived server-side from the path\ntenant's effective plan terms (``services/plan_billing.start_checkout`` \u2014\nplatform fee + seats, overrides applied); before #353 the caller named a\nStripe ``price_id``, which let a tenant subscribe itself at any price in\nthe account. Any body sent is ignored.\n\n403 in a read-only session; 409 when the tenant already has a plan\nsubscription that is not canceled (its prices then follow the terms\nthrough the reconciler).\nNot step-up gated: creating the session moves no money \u2014 the payer\nconfirms on Stripe's hosted page, which carries its own SCA. Audited.",
        "operationId": "billing_start_checkout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionRedirect"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Checkout",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/enterprise-checkout": {
      "post": {
        "description": "Open a Stripe Checkout Session for the Enterprise add-on.\n\n403 in a read-only session (decision #32). Creating the session is a\nmoney-adjacent action, so it is audited (#433).",
        "operationId": "billing_start_enterprise_checkout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionRedirect"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Enterprise Checkout",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/ide-overage": {
      "get": {
        "description": "Used / allowance / remaining minutes and the add-on switch.",
        "operationId": "billing_get_ide_overage",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdeOverageRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Ide Overage",
        "tags": [
          "billing",
          "billing"
        ]
      },
      "put": {
        "description": "Turn the web-IDE overage add-on on or off.\n\n403 in a read-only session; 404 for an unknown tenant; 402 when turning it\non for a tenant with no billing set up.",
        "operationId": "billing_set_ide_overage",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdeOverageUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdeOverageRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Ide Overage",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/langflow-checkout": {
      "post": {
        "description": "Open a Stripe Checkout Session for the Langflow add-on (issue #3106).\n\n403 in a read-only session (decision #32). Creating the session is a\nmoney-adjacent action, so it is audited (#433).",
        "operationId": "billing_start_langflow_checkout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionRedirect"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Langflow Checkout",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/plan-charges": {
      "get": {
        "description": "Platform fee, seats, IDE overage and billed tokens for the month in progress.",
        "operationId": "billing_get_plan_charges",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanCharges"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Plan Charges",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/plans": {
      "get": {
        "description": "Public plans only \u2014 a private plan is never listed (nor named, unless current).\n\nEach plan carries ``exceeds``: the limits this tenant's usage would be over\non it. A downgrade is still allowed (owner, epic #354 \u00a7 Lifecycle); the\nexcess goes read-only rather than being deleted.",
        "operationId": "billing_list_plan_options",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanOptions"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Plan Options",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/portal-session": {
      "post": {
        "description": "Create a Stripe Billing Portal session so the tenant can manage their subscription.\n\n403 in a read-only session (decision #32). The portal lets the tenant\nchange or cancel subscriptions, so opening it is a money-adjacent action\nand is audited (#433).",
        "operationId": "billing_create_portal_session",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalRedirect"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Portal Session",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/resold-usage": {
      "get": {
        "operationId": "billing_get_resold_usage",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "description": "UTC calendar month, YYYY-MM",
            "in": "query",
            "name": "period",
            "required": true,
            "schema": {
              "description": "UTC calendar month, YYYY-MM",
              "title": "Period",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResoldUsage"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Resold Usage",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/subscription": {
      "get": {
        "operationId": "billing_get_subscription",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Subscription",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/support-checkout": {
      "post": {
        "description": "Open a Stripe Checkout Session for the Support add-on.\n\n403 in a read-only session (decision #32). Creating the session is a\nmoney-adjacent action, so it is audited (#433).",
        "operationId": "billing_start_support_checkout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionRedirect"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Support Checkout",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/usage": {
      "get": {
        "description": "Month-to-date model-broker rollup for the calling tenant.\n\n``cost_*`` is what the tenant is billed (per-row snapshotted markup; BYOK\ncalls are never billed \u2014 issue #353); ``provider_cost_*`` is the raw cost\nof those billed calls and ``byok_cost_*`` the provider cost of the BYOK\ncalls (paid to the tenant's own vendor, shown but not charged).",
        "operationId": "billing_get_usage",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Usage",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/billing/user-costs": {
      "get": {
        "description": "Per-user cost breakdown + the Top 5 most expensive tasks in the window.",
        "operationId": "billing_get_user_costs",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "enum": [
                "day",
                "week",
                "month"
              ],
              "title": "Period",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserCostsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get User Costs",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/code-findings": {
      "get": {
        "operationId": "code_findings_list_findings",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "scanner",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Scanner"
            }
          },
          {
            "in": "query",
            "name": "severity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Per Page",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CodeFindingRead"
                  },
                  "title": "Response Code Findings List Findings",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Findings",
        "tags": [
          "code-findings"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/code-findings/{finding_id}/suppress": {
      "delete": {
        "operationId": "code_findings_unsuppress_finding",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "finding_id",
            "required": true,
            "schema": {
              "title": "Finding Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeFindingRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unsuppress Finding",
        "tags": [
          "code-findings"
        ]
      },
      "patch": {
        "operationId": "code_findings_suppress_finding",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "finding_id",
            "required": true,
            "schema": {
              "title": "Finding Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeFindingSuppressRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeFindingRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Suppress Finding",
        "tags": [
          "code-findings"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/cron/blackouts": {
      "get": {
        "operationId": "cron_list_blackouts",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "agent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CronBlackoutRead"
                  },
                  "title": "Response Cron List Blackouts",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Blackouts",
        "tags": [
          "cron"
        ]
      },
      "post": {
        "operationId": "cron_create_blackout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CronBlackoutCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronBlackoutRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Blackout",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/cron/blackouts/{blackout_id}": {
      "delete": {
        "operationId": "cron_delete_blackout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "blackout_id",
            "required": true,
            "schema": {
              "title": "Blackout Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Blackout",
        "tags": [
          "cron"
        ]
      },
      "get": {
        "operationId": "cron_get_blackout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "blackout_id",
            "required": true,
            "schema": {
              "title": "Blackout Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronBlackoutRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Blackout",
        "tags": [
          "cron"
        ]
      },
      "patch": {
        "operationId": "cron_update_blackout",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "blackout_id",
            "required": true,
            "schema": {
              "title": "Blackout Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CronBlackoutUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronBlackoutRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Blackout",
        "tags": [
          "cron"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/delegations": {
      "get": {
        "description": "Return all delegation entries owned by the calling user.",
        "operationId": "delegations_list_delegations",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DelegationRead"
                  },
                  "title": "Response Delegations List Delegations",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List delegations for the current user",
        "tags": [
          "delegations"
        ]
      },
      "post": {
        "description": "Create a delegation entry granting *agent_id* read-only access to the\ncalling user's linked identity for *provider*.",
        "operationId": "delegations_grant_delegation",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelegationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DelegationRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant an agent read-only access to a linked identity",
        "tags": [
          "delegations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/delegations/{delegation_id}": {
      "delete": {
        "description": "Revoke a delegation. The owning user or a tenant admin can revoke.",
        "operationId": "delegations_revoke_delegation",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "delegation_id",
            "required": true,
            "schema": {
              "title": "Delegation Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Delegations Revoke Delegation",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke a delegation",
        "tags": [
          "delegations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/files": {
      "get": {
        "operationId": "documents_list_tenant_files",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project Id"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFileListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Files",
        "tags": [
          "documents"
        ]
      },
      "post": {
        "description": "Upload a document into a project.\n\nThe bytes are handed to DocWorker's ``POST /files``, which ClamAV-scans\nthem and writes the ``file_scan`` row before anything reaches GCS\n(decision #24). There is deliberately no platform-side storage path: a\nroute that wrote GCS itself would be an unscanned ingest.\n\nAn infected file comes back as DocWorker's 415 and is surfaced verbatim \u2014\nthe scan row is already written on that path.",
        "operationId": "documents_upload_tenant_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_documents_upload_tenant_file"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFile"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Tenant File",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/files/batch-delete": {
      "post": {
        "description": "Delete several files in one action \u2014 the \"Manage files\" bulk delete.\n\nSensitive (destructive **and** bulk), so on top of ``documents:write``\n(OWNER/ADMIN via the tenant wildcard), a read-only-session refusal (decision\n#32), a front-end app-modal confirm naming the count, and one ``audit_log``\nrow per file actually removed, it requires **step-up re-authentication**\n(``DOCUMENTS_BULK_DELETE``, GitLab #539): a fresh verified ``auth_time``, so\na stale session (or a prompt-injected turn on a browser tab left open) cannot\nwipe a batch of documents on the strength of a login from hours ago. The\nper-item single delete is deliberately left ungated \u2014 one file is not a bulk\naction. The gate is browser-only by construction (``require_fresh_reauth``\nignores grants and no agent tool reaches this route).\n\nPartial success by design: each id is deleted independently, so one bad id\n(a typo, or another tenant's id \u2014 both 404 upstream and are reported as a\ncoarse \"not found\") does not sink the rest. A 5xx from DocWorker means the\nservice is unhealthy, not that one file is missing, so it aborts the whole\ncall with a 502 rather than silently marking every file \"failed\".\n\nThe ``file_scan`` rows for each deleted file are retained, exactly as the\nsingle delete retains them \u2014 decision #24 has no bulk exemption.",
        "operationId": "documents_batch_delete_tenant_files",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFileBatchDeleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFileBatchDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Batch Delete Tenant Files",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/files/{file_id}": {
      "delete": {
        "description": "Delete a file: GCS artefacts + derived rows go, the scan audit stays.\n\nDestructive and irreversible, so the front-end confirms in an app-modal\nand this route writes an ``audit_log`` row. The ``file_scan`` rows for\nthe file are deliberately retained (decision #24 has no exemptions \u2014 the\nevidence that we scanned something outlives the something).",
        "operationId": "documents_delete_tenant_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Tenant File",
        "tags": [
          "documents"
        ]
      },
      "get": {
        "operationId": "documents_get_tenant_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFile"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tenant File",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/files/{file_id}/download": {
      "get": {
        "description": "Stream a document's raw bytes for the \"Manage files\" View/Download (#538).\n\nRead-only (``documents:read``, MEMBER and up): a download is data egress, not\na mutation. A file id from another tenant (or an unknown id) 404s exactly\nlike a typo \u2014 DocWorker scopes by the tenant in the URL, so the two are\nindistinguishable (IDOR/BOLA). The bytes and their ``Content-Disposition``\ncome straight from DocWorker; nothing here touches GCS (decision #24 \u2014 the\nsingle scanned ingest path owns the bucket).",
        "operationId": "documents_download_tenant_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Download Tenant File",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/files/{file_id}/reprocess": {
      "post": {
        "description": "Re-run extract \u2192 chunk \u2192 embed for a file.\n\nDocWorker enqueues the work on its Valkey ingest stream and returns the\nfile row immediately; clients poll ``GET /files/{file_id}`` for the\nstatus transitions.",
        "operationId": "documents_reprocess_tenant_file",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFile"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Reprocess Tenant File",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/projects": {
      "get": {
        "operationId": "documents_list_tenant_projects",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentProjectListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Projects",
        "tags": [
          "documents"
        ]
      },
      "post": {
        "description": "Create a project.\n\nThe slug is derived from the name (never asked for). A slug collision\ninside the tenant \u2014 two projects may legitimately share a display name \u2014\nis retried once with a short random suffix; a second collision surfaces\nDocWorker's 409.",
        "operationId": "documents_create_tenant_project",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentProjectCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentProject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Tenant Project",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/projects/{project_id}": {
      "delete": {
        "description": "Delete a project. Its files, chunks and text units cascade in DocWorker.\n\n``file_scan`` rows are *not* touched \u2014 they live in this service's\ndatabase and are the decision-#24 audit trail.\n\nThe project's files count toward the tenant's storage quota, so their total\nsize is summed **before** the cascade wipes them and released back after a\nsuccessful delete (issue #482) \u2014 the same ``size_bytes`` source and\nzero-clamped ``release_storage`` the single- and batch-delete paths use.\nWithout this the cumulative ``plan:storage:<tenant>`` counter would drift\nupward on every project delete and eventually lock the tenant out of uploads.",
        "operationId": "documents_delete_tenant_project",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Tenant Project",
        "tags": [
          "documents"
        ]
      },
      "patch": {
        "operationId": "documents_update_tenant_project",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentProjectUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentProject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Tenant Project",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/sources": {
      "get": {
        "operationId": "documents_list_sources",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSourceListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Sources",
        "tags": [
          "documents"
        ]
      },
      "post": {
        "description": "Select the folders of a linked file-storage account to import from.\n\nRe-posting the same provider replaces the selection rather than stacking\nduplicate rows. A provider outside the allowlist is a 400, and a provider\nwith no merge.dev link yet is a 409 \u2014 \"link the account first\" \u2014 rather\nthan an import that silently finds nothing.",
        "operationId": "documents_link_source",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSourceCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSource"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Link Source",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/sources/providers": {
      "get": {
        "description": "The selectable providers, each flagged with whether it is linked.\n\n``connected`` comes from the tenant's own merge.dev file-storage link\n(decision #20 \u2014 the token is read from ``tenant_identity``, never from\nthe client). At most one can be connected: merge.dev links one account\nper category.",
        "operationId": "documents_list_source_providers",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSourceProviderListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Source Providers",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/sources/providers/{provider}/folders": {
      "get": {
        "description": "Folders under *parent_id* (top level when omitted) for one provider.\n\nFolder names are customer data, so a provider the tenant has **not**\nlinked returns 404 \u2014 the same shape as a provider that does not exist \u2014\nrather than an empty 200 that would confirm the provider is real.",
        "operationId": "documents_list_source_folders",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "parent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Parent Id"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSourceFolderListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Source Folders",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/sources/{source_id}": {
      "delete": {
        "description": "Unlink a source. Already-imported files stay in the knowledge base.",
        "operationId": "documents_unlink_source",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unlink Source",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/sources/{source_id}/import": {
      "post": {
        "description": "Start an import run and return its id immediately.\n\nBulk ingest: it pulls an external corpus into the tenant's knowledge base\nand can take minutes, so the run row is committed before the response and\nthe work continues in the background. Poll ``/import-status``.\n\nA run already in flight for this source is not duplicated \u2014 the existing\nrun id comes back instead, so a double-click cannot double-import.",
        "operationId": "documents_trigger_import",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentImportTriggered"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Trigger Import",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/documents/sources/{source_id}/import-status": {
      "get": {
        "description": "Status of the most recent import run for this source.",
        "operationId": "documents_import_status",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_id",
            "required": true,
            "schema": {
              "title": "Source Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentImportStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import Status",
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/files/scan": {
      "post": {
        "description": "Server-side ClamAV gate for a browser upload.\n\n``resource_type`` defaults to ``file`` and accepts ``attachment`` /\n``bundle`` for callers that already know what the upload is for. The\nresponse shape mirrors :class:`good_place_api.routes.internal.file_scan.FileScanRead`\nminus the row id (the front-end never needs to look it up later).\n\nPer-tenant size cap is enforced via ``settings.max_upload_mb``; bigger\nuploads return 413 instead of being scanned (clamd would still scan\nthem, but the cost belongs in the agent / DocWorker flow that knows\nwhy the file is large).",
        "operationId": "files_scan_upload",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_files_scan_upload"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Files Scan Upload",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Scan Upload",
        "tags": [
          "files"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/files/{attachment_id}/content": {
      "get": {
        "description": "Return file content for a session attachment.\n\nWithout ``?raw=true``: returns the file with ``Content-Disposition:\nattachment`` so the browser triggers a download.\n\nWith ``?raw=true``: returns the body as ``text/plain; charset=utf-8``\nwithout a download prompt. Currently restricted to ``.md`` files;\nnon-markdown files return 400.",
        "operationId": "files_get_file_content",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "attachment_id",
            "required": true,
            "schema": {
              "title": "Attachment Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "raw",
            "required": false,
            "schema": {
              "default": false,
              "title": "Raw",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "File content (text/plain with `?raw=true`; the stored MIME type otherwise, as an attachment download)."
          },
          "400": {
            "description": "Raw mode is only supported for `.md` files."
          },
          "403": {
            "description": "Tenant mismatch or permission denied."
          },
          "404": {
            "description": "Attachment not found."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "GCS unavailable."
          }
        },
        "summary": "Get File Content",
        "tags": [
          "files"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/flowise/chatflows/{chatflow_id}/promote": {
      "post": {
        "description": "Promote a Flowise chatflow to a first-class LangChain agent.\n\nFetches the chatflow definition from Flowise, translates it into LangChain\nagent source files (``Agent.md``, ``Soul.md``, ``main.py``), creates an\n``Agent`` row, provisions a GitLab repo, and commits the generated files.",
        "operationId": "flowise_promote_flowise_chatflow",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "chatflow_id",
            "required": true,
            "schema": {
              "title": "Chatflow Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlowisePromoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlowisePromoteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Promote Flowise Chatflow",
        "tags": [
          "flowise"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github-app/install": {
      "delete": {
        "description": "Disconnect the tenant GitHub App installation.\n\nRevokes the ``github_app:install`` row; the next ``github`` connector call\ndegrades to the per-user ``github_tool`` PAT. Revocation is one click (no\nstep-up), but still refused in a read-only session (decision #32) and\naudit-logged. 404 when nothing is connected (so a wrong-tenant id cannot\nprobe another tenant state -- ``request_context`` 403s a non-member first).",
        "operationId": "github_app_github_app_disconnect",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Github App Disconnect",
        "tags": [
          "github-app"
        ]
      },
      "get": {
        "description": "Report whether the platform GitHub App is connected for this tenant.",
        "operationId": "github_app_github_app_install_status",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Github App Install Status",
        "tags": [
          "github-app"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github-app/install-link": {
      "post": {
        "description": "Mint a single-use ``state`` and return the GitHub App install URL.\n\nSensitive (credential-connect + privilege change): step-up reauth, audit\nrow, read-only refusal. ``require_step_up`` refuses a read-only session\nbefore the mint, so the gate holds for both browser and agent (Michael)\ncallers.",
        "operationId": "github_app_github_app_install_link",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "currentUrl",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Currenturl"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallLinkResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Github App Install Link",
        "tags": [
          "github-app"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github/install": {
      "post": {
        "description": "Store the GitHub App installation_id for this tenant.\n\nThe tenant admin completes the GitHub App install flow in the browser and\nprovides the ``installation_id`` returned by GitHub's callback. The API\npersists this in ``tenant_identity`` (provider ``github:app``).\n\nThe access token exchange (installation \u2192 token) is deferred to the first\nAPI call that needs it (e.g. listing repos), following the same lazy-refresh\npattern used by other tenant_identity providers.",
        "operationId": "github_webhooks_register_github_app_install",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubAppInstallRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubAppInstallResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Register Github App Install",
        "tags": [
          "github-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github/repos": {
      "get": {
        "description": "List all GitHub-provider webhook routes for this tenant.",
        "operationId": "github_webhooks_list_github_repo_webhooks",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/GitHubRepoWebhookRead"
                  },
                  "title": "Response Github Webhooks List Github Repo Webhooks",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Github Repo Webhooks",
        "tags": [
          "github-webhooks"
        ]
      },
      "post": {
        "description": "Create a webhook route wired to a specific GitHub repo + event types.",
        "operationId": "github_webhooks_create_github_repo_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubRepoWebhookCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRouteCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Github Repo Webhook",
        "tags": [
          "github-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github/repos/{route_id}": {
      "delete": {
        "description": "Delete a GitHub repo webhook route.",
        "operationId": "github_webhooks_delete_github_repo_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Github Repo Webhook",
        "tags": [
          "github-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github/repos/{route_id}/events": {
      "get": {
        "description": "List recent GitHub webhook deliveries for a route.",
        "operationId": "github_webhooks_list_github_webhook_events",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/GitHubWebhookEventRead"
                  },
                  "title": "Response Github Webhooks List Github Webhook Events",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Github Webhook Events",
        "tags": [
          "github-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/github/repos/{route_id}/rotate-secret": {
      "post": {
        "description": "Rotate the HMAC secret for a GitHub webhook route.",
        "operationId": "github_webhooks_rotate_github_webhook_secret",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRouteCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Github Webhook Secret",
        "tags": [
          "github-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/groups": {
      "get": {
        "description": "All groups in the tenant with counts (OWNER/ADMIN).",
        "operationId": "tenant_groups_list_groups",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantGroupRead"
                  },
                  "title": "Response Tenant Groups List Groups",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Groups",
        "tags": [
          "tenant-groups"
        ]
      },
      "post": {
        "operationId": "tenant_groups_create_group",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantGroupCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGroupRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Group",
        "tags": [
          "tenant-groups"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/groups/mine": {
      "get": {
        "description": "Groups the caller belongs to or manages (MEMBER-reachable).",
        "operationId": "tenant_groups_list_my_groups",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantGroupSummary"
                  },
                  "title": "Response Tenant Groups List My Groups",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List My Groups",
        "tags": [
          "tenant-groups"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/groups/{group_id}": {
      "delete": {
        "operationId": "tenant_groups_delete_group",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Group",
        "tags": [
          "tenant-groups"
        ]
      },
      "get": {
        "description": "One group with its full roster (OWNER/ADMIN).",
        "operationId": "tenant_groups_get_group",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGroupDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Group",
        "tags": [
          "tenant-groups"
        ]
      },
      "patch": {
        "operationId": "tenant_groups_update_group",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantGroupUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGroupRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Group",
        "tags": [
          "tenant-groups"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/groups/{group_id}/managers/{user_id}": {
      "delete": {
        "operationId": "tenant_groups_remove_manager",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Manager",
        "tags": [
          "tenant-groups"
        ]
      },
      "put": {
        "operationId": "tenant_groups_add_manager",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Manager",
        "tags": [
          "tenant-groups"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/groups/{group_id}/members": {
      "post": {
        "operationId": "tenant_groups_add_member",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GroupMemberAdd"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Member",
        "tags": [
          "tenant-groups"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/groups/{group_id}/members/{member_kind}/{member_id}": {
      "delete": {
        "operationId": "tenant_groups_remove_member",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member_kind",
            "required": true,
            "schema": {
              "title": "Member Kind",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member_id",
            "required": true,
            "schema": {
              "title": "Member Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Member",
        "tags": [
          "tenant-groups"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/identities": {
      "get": {
        "description": "List outbound OAuth identities the tenant has linked.",
        "operationId": "identities_list_tenant_identities",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantIdentityRead"
                  },
                  "title": "Response Identities List Tenant Identities",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Identities",
        "tags": [
          "identities"
        ]
      },
      "post": {
        "description": "Save or rotate a BYOK credential in `tenant_identity`.\n\nThe plaintext access_token is encrypted immediately via `services/secrets`\nand never written to the database in clear. A plan without BYO models or a\nMerge category refuses the matching provider (issue #353, 402).\n\nRefuses when the caller acts inside a read-only agent session (decision\n#32): storing/rotating a credential is a mutation, and this is the write\npath that populates the operator tenant's ``github:platform_write``\ncredential (GitLab #524), so it must honour read-only mode just like the\n``revoke`` path below. The ``read-only`` message lets the\n``tenant_identity_mgmt`` connector translate the 403 into a\n``ReadOnlyViolation``. Browser callers never set ``read_only``.",
        "operationId": "identities_upsert_tenant_identity",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantIdentityCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantIdentityRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upsert Tenant Identity",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/identities/idp": {
      "get": {
        "operationId": "identities_list_identity_providers",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/IdentityProviderRead"
                  },
                  "title": "Response Identities List Identity Providers",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Identity Providers",
        "tags": [
          "identities"
        ]
      },
      "post": {
        "operationId": "identities_create_identity_provider",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdentityProviderCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdentityProviderRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Identity Provider",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/identities/idp/{alias}": {
      "delete": {
        "operationId": "identities_delete_identity_provider",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "alias",
            "required": true,
            "schema": {
              "title": "Alias",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Identity Provider",
        "tags": [
          "identities"
        ]
      },
      "get": {
        "operationId": "identities_get_identity_provider",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "alias",
            "required": true,
            "schema": {
              "title": "Alias",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdentityProviderRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Identity Provider",
        "tags": [
          "identities"
        ]
      },
      "put": {
        "operationId": "identities_update_identity_provider",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "alias",
            "required": true,
            "schema": {
              "title": "Alias",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdentityProviderUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdentityProviderRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Identity Provider",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/identities/merge/callback": {
      "post": {
        "description": "Complete a merge.dev Link \u2014 exchange the ``public_token`` for the\nlong-lived ``account_token`` and persist it (encrypted) in\n``tenant_identity``. Idempotent per ``(tenant_id, merge:<category>)``.",
        "operationId": "identities_merge_callback",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MergeCallbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeCallbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Merge Callback",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/identities/merge/link-token": {
      "post": {
        "description": "Begin the merge.dev Link flow \u2014 return a short-lived link token.",
        "operationId": "identities_merge_link_token",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MergeLinkTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeLinkTokenResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Merge Link Token",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/identities/{identity_id}": {
      "delete": {
        "description": "Delete the `tenant_identity` row, revoking broker access to this credential.\n\nRefuses when the caller acts inside a read-only agent session (decision\n#32): a permanent row deletion is exactly the kind of mutation read-only\nmode exists to block. The ``read-only`` message lets the\n``tenant_identity_mgmt`` connector translate the 403 into a\n``ReadOnlyViolation`` so dispatch records the run as ``blocked``. Browser\ncallers never set ``read_only``.",
        "operationId": "identities_revoke_tenant_identity",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "identity_id",
            "required": true,
            "schema": {
              "title": "Identity Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Tenant Identity",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/integrations": {
      "get": {
        "description": "Return the catalogue of supported integrations with connected status.\n\nEntries the tenant's plan excludes (a Merge category off the plan's\nallow-list, issue #353) are left out rather than shown un-connectable.",
        "operationId": "integrations_list_tenant_integrations",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantIntegrationRead"
                  },
                  "title": "Response Integrations List Tenant Integrations",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Integrations",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/integrations/{provider}/connect": {
      "post": {
        "description": "Begin the per-provider link flow.\n\nFor OAuth providers this issues a tenant-bound state token and returns\nthe upstream authorize URL. For merge.dev categories it asks merge.dev\nfor a Magic Link URL bound to our callback. Either way the front-end\nsees a ``{url}`` payload and redirects the browser.",
        "operationId": "integrations_connect_tenant_integration",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectIntegrationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Connect Tenant Integration",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/integrations/{provider}/rotate": {
      "post": {
        "description": "Re-run the link flow for an already-connected integration.\n\nSame machinery as ``connect``; on callback ``upsert_from_oauth`` /\n``merge.complete_link`` are idempotent on ``(tenant_id, provider)`` and\noverwrite the encrypted tokens in place.",
        "operationId": "integrations_rotate_tenant_integration",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectIntegrationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Tenant Integration",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/kahala/wikis": {
      "get": {
        "description": "Every wiki in this tenant's Kahala registry.",
        "operationId": "kahala_list_kahala_wikis",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KahalaWikiListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Kahala Wikis",
        "tags": [
          "kahala"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/kahala/wikis/{wiki_slug}/access": {
      "get": {
        "description": "Who can access one wiki \u2014 humans, groups, agents (GitLab #239).\n\nOne view over every principal that reaches ``wiki_slug``:\n\n* **humans** \u2014 direct ``resource_share`` (kind ``wiki``) grants and\n  membership-derived access through granted #198 tenant groups;\n* **groups** \u2014 each expandable to its roster;\n* **agents** \u2014 live ``agent_kahala_grant`` rows (tier + tenant-wide/pinned\n  scope), the ``is_admin_only`` seeds that reach every wiki *implicitly*\n  (decision #10), and revoked grants kept as history.\n\nOWNER/ADMIN-only (``agent:kahala_grant:read``, the same gate as the wiki\nlisting and the per-agent grant panel); MEMBER/GUEST/VIEWER get 403 from\nthe real enforcer. The wiki slug is validated against the tenant's Kahala\nregistry read with the *caller's own* Keycloak token, so a slug from\nanother tenant returns the same ``404 wiki not found`` a typo gets \u2014 never\nan oracle for which wikis exist elsewhere. Read-only.",
        "operationId": "kahala_get_wiki_access",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "wiki_slug",
            "required": true,
            "schema": {
              "title": "Wiki Slug",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiAccessView"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Wiki Access",
        "tags": [
          "kahala"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/langflow": {
      "get": {
        "operationId": "langflow_get_langflow_status",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LangflowInstanceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Langflow Status",
        "tags": [
          "langflow"
        ]
      },
      "post": {
        "operationId": "langflow_provision_langflow",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LangflowInstanceRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Provision Langflow",
        "tags": [
          "langflow"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/langflow/flows/{flow_id}/promote": {
      "post": {
        "description": "Promote a Langflow flow to a first-class LangChain agent.\n\nTranslates the caller-supplied flow export JSON into LangChain agent\nsource files (``Agent.md``, ``Soul.md``, ``main.py``), creates an\n``Agent`` row, provisions a GitLab repo, and commits the generated files.",
        "operationId": "langflow_promote_langflow_flow",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "flow_id",
            "required": true,
            "schema": {
              "title": "Flow Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LangflowPromoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LangflowPromoteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Promote Langflow Flow",
        "tags": [
          "langflow"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/langfuse": {
      "get": {
        "description": "Return this tenant's Langfuse Project id, or ``provisioned: false``.\n\nThe Casbin check above authorizes against ``ctx.tenant_id`` \u2014 the tenant\n``request_context`` resolved \u2014 while the path carries its own\n``tenant_id``. Those agree by construction today (the context builder\nresolves the active tenant *from* the path and 403s a non-member), but the\nread below is a data access keyed on an id, so it does not lean on that:\nif the two ever diverge, this refuses rather than serving one tenant's row\nunder another tenant's authorization. Defense in depth for the\nswapped-id case in `docs/content/security-testing.md`.",
        "operationId": "langfuse_get_tenant_tracing",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantTracingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tenant Tracing",
        "tags": [
          "langfuse"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/linked-repos": {
      "get": {
        "operationId": "linked_repos_list_linked_repos",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedRepoListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Linked Repos",
        "tags": [
          "linked-repos"
        ]
      },
      "post": {
        "operationId": "linked_repos_link_repo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkedRepoCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedRepoRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Link Repo",
        "tags": [
          "linked-repos"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/linked-repos/{repo_id}": {
      "delete": {
        "operationId": "linked_repos_unlink_repo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unlink Repo",
        "tags": [
          "linked-repos"
        ]
      },
      "get": {
        "operationId": "linked_repos_get_linked_repo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedRepoRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Linked Repo",
        "tags": [
          "linked-repos"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/linked-repos/{repo_id}/search": {
      "post": {
        "description": "Semantic/hybrid search over one linked repo. Read-only \u2014 allowed in\nread-only sessions (decision #32).",
        "operationId": "linked_repos_search_linked_repo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Linked Repo",
        "tags": [
          "linked-repos"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/linked-repos/{repo_id}/webhook": {
      "delete": {
        "operationId": "linked_repos_delete_linked_repo_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Linked Repo Webhook",
        "tags": [
          "linked-repos"
        ]
      },
      "get": {
        "operationId": "linked_repos_get_linked_repo_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedRepoWebhookRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Linked Repo Webhook",
        "tags": [
          "linked-repos"
        ]
      },
      "post": {
        "operationId": "linked_repos_create_linked_repo_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedRepoWebhookCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Linked Repo Webhook",
        "tags": [
          "linked-repos"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/linked-repos/{repo_id}/webhook/rotate-secret": {
      "post": {
        "operationId": "linked_repos_rotate_linked_repo_webhook_secret",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkedRepoWebhookCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Linked Repo Webhook Secret",
        "tags": [
          "linked-repos"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/marketplace/listings": {
      "post": {
        "description": "Create a draft listing from an existing skill or agent.",
        "operationId": "marketplace_create_listing",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketplaceListingCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceListingRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Listing",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/marketplace/listings/{listing_id}/review": {
      "post": {
        "description": "Admin approves or rejects a listing pending review (issue #3133).\n\nThe **only** path that can set ``status = 'active'``. ``marketplace:review``\nis not granted to MEMBER in ``policy.csv`` -- only OWNER/ADMIN (via the\ntenant-wide wildcard) and SuperAdmin can approve a listing, same shape as\n``skills:review`` (#511).",
        "operationId": "marketplace_review_listing",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "listing_id",
            "required": true,
            "schema": {
              "title": "Listing Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketplaceReviewDecision"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceReviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Review Listing",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/marketplace/listings/{listing_id}/submit-review": {
      "post": {
        "description": "Seller submits their draft listing for admin review (issue #3133).\n\nThis is step one of the required submission review gate: a listing\ncannot reach ``active`` (and therefore cannot surface in ``browse()`` or\nbe retrieved into the agent preamble via vector routing, decision #31)\nwithout an admin approving it through ``POST .../review`` below.",
        "operationId": "marketplace_submit_listing_for_review",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "listing_id",
            "required": true,
            "schema": {
              "title": "Listing Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceReviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Listing For Review",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/marketplace/listings/{listing_id}/versions": {
      "post": {
        "description": "Freeze a bundle, ClamAV-scan, upload to GCS, persist the version row.\n\nDecision #26 + #24: every marketplace bundle goes through ClamAV before\nit can become buyable. ``scanned_by_service='marketplace'`` lands in\n``file_scan`` for audit. The bundle bytes are uploaded to\n``gs://<tenant-bucket>/marketplace/<listing>/<version>.bundle`` *before*\nthe version row is committed \u2014 a successful row means the GCS object\nexists, so listings never point at a missing bundle.",
        "operationId": "marketplace_publish_version",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "listing_id",
            "required": true,
            "schema": {
              "title": "Listing Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_marketplace_publish_version"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketplaceVersionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Publish Version",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/marketplace/payouts": {
      "get": {
        "description": "List Stripe Connect transfer history for the calling seller.",
        "operationId": "marketplace_list_payouts",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/MarketplacePayoutRead"
                  },
                  "title": "Response Marketplace List Payouts",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Payouts",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/marketplace/purchase/{listing_id}": {
      "post": {
        "description": "Start Stripe Checkout for a marketplace listing; install on webhook completion.",
        "operationId": "marketplace_purchase",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "listing_id",
            "required": true,
            "schema": {
              "title": "Listing Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Marketplace Purchase",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Purchase",
        "tags": [
          "marketplace"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/mentions/agents": {
      "get": {
        "description": "Return agents visible to the caller, filtered by name/slug substring.",
        "operationId": "mentions_autocomplete_agents",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "default": "",
              "maxLength": 100,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AutocompleteItem"
                  },
                  "title": "Response Mentions Autocomplete Agents",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Autocomplete Agents",
        "tags": [
          "mentions"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/mentions/slack-channels": {
      "get": {
        "description": "Return Slack channels for the tenant's connected Slack workspace.\n\nReturns an empty list when no Slack identity is connected so the UI can\nshow a \"connect Slack\" empty state. Live channel fetch is a follow-up\nonce the tools-service Slack connector is wired (must go through the\nproxy per decision #14).",
        "operationId": "mentions_autocomplete_slack_channels",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "default": "",
              "maxLength": 100,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AutocompleteItem"
                  },
                  "title": "Response Mentions Autocomplete Slack Channels",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Autocomplete Slack Channels",
        "tags": [
          "mentions"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/mentions/users": {
      "get": {
        "description": "Return workspace members, filtered by name/email substring.",
        "operationId": "mentions_autocomplete_users",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "default": "",
              "maxLength": 100,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AutocompleteItem"
                  },
                  "title": "Response Mentions Autocomplete Users",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Autocomplete Users",
        "tags": [
          "mentions"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/model-credentials": {
      "get": {
        "description": "List every manageable model provider and whether a BYOK key is stored.\n\nMetadata only \u2014 the encrypted key is never read or returned. Providers\nwith a platform-pool fallback (OpenRouter / IFM) still report their own\nper-tenant ``configured`` state: ``False`` means \"using the platform key\".",
        "operationId": "models_list_model_credentials",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ModelCredentialRead"
                  },
                  "title": "Response Models List Model Credentials",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Model Credentials",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/model-credentials/{vendor}": {
      "delete": {
        "description": "Delete the stored BYOK key for ``vendor``.\n\nSensitive action: refuses in a read-only session and writes an\n``audit_log`` row. 404 when no key is stored for the vendor. For a\nplatform-pool vendor (OpenRouter / IFM) this reverts the tenant to the\nplatform key rather than disabling the provider.",
        "operationId": "models_revoke_model_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "vendor",
            "required": true,
            "schema": {
              "title": "Vendor",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelCredentialRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Model Credential",
        "tags": [
          "models"
        ]
      },
      "put": {
        "description": "Store or rotate the BYOK key for ``vendor``.\n\nSensitive action: refuses in a read-only session, requires a plan that\nallows BYO models, and writes an ``audit_log`` row (never the key). The\nplaintext is encrypted immediately and never persisted in clear.",
        "operationId": "models_set_model_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "vendor",
            "required": true,
            "schema": {
              "title": "Vendor",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelCredentialSet"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelCredentialRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Model Credential",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models": {
      "get": {
        "description": "List models available in the tenant (via tenant_model).\n\nFree-tier tenants only see models marked ``is_free=True``. SuperAdmins\nbypass the filter so they can debug paid models in any tenant.\n\nEach row carries both ``status`` (the global ``Model.status``) and\n``tenant_status`` (the per-tenant ``tenant_model.status`` override). The\ntenant org models page uses ``status`` to decide whether the toggle is\ninteractive at all \u2014 globally ``disabled`` / ``deprecated`` models stay\nun-toggleable per decision #13 \u2014 and ``tenant_status`` to drive the\nswitch's on/off state.",
        "operationId": "models_list_models",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantModelListItem"
                  },
                  "title": "Response Models List Models",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Models",
        "tags": [
          "models"
        ]
      },
      "post": {
        "description": "Create a model owned by the authenticated user.\n\nThe created model is stamped with this tenant as its ``owning_tenant_id``\n(so only this tenant's OWNER/ADMIN can edit it later \u2014 GitLab #398) and\nauto-granted to the calling tenant (`tenant_model`). Cross-tenant /\nimpersonation flows are not supported here \u2014 admins use\n`routes/admin_models.py` for those. A plan without BYO models refuses\n(402, issue #353).",
        "operationId": "models_create_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Model",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/custom-http": {
      "post": {
        "description": "Register a tenant-owned self-hosted OpenAI-compatible model.\n\nThe endpoint is health-probed through the proxy before it is created, so a\nregistered model is one that actually answered (\"shown \u2261 callable\",\ndecision #13). Blocked in a read-only session (decision #32).",
        "operationId": "models_register_custom_http_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomHttpModelCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Register Custom Http Model",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}": {
      "delete": {
        "description": "Delete a model THIS tenant registered. Global platform models and\nSuperAdmin-granted ones are refused with the same 404 as a missing model\n(GitLab #398) \u2014 a tenant must not be able to delete a shared model for\neveryone. Blocked in a read-only session (decision #32).",
        "operationId": "models_delete_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Model",
        "tags": [
          "models"
        ]
      },
      "get": {
        "operationId": "models_get_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Model",
        "tags": [
          "models"
        ]
      },
      "patch": {
        "description": "403 when the acting principal has read_only access (gated separately\nfrom Casbin). Casbin's `model:update` decides whether the principal is\nallowed at all \u2014 tenant admins, model owners, and super-admins per the\npolicy in `docs/content/models.md`.\n\nA body that *changes* a price additionally needs a fresh credential entry\n(step-up, GitLab #333/#348) \u2014 the same gate `/admin/models/{id}` carries,\nbecause both routes write the same `model.pricing`.\n\nOnly a model THIS tenant registered (`owning_tenant_id`) is editable here;\nglobal platform models and SuperAdmin-granted ones are refused with the\nsame 404 as a missing model (GitLab #398). The ownership resolve runs\nFIRST, so a cross-tenant caller gets that 404 before the step-up 403 could\nreveal the model exists (no existence oracle).\n\nBlocked in a read-only session (decision #32) \u2014 this route mutates.",
        "operationId": "models_update_model",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Model",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/disable": {
      "post": {
        "description": "Tenant admin: flip the per-tenant grant to ``disabled``. Idempotent.",
        "operationId": "models_disable_for_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantModelListItem"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Disable For Tenant",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/enable": {
      "post": {
        "description": "Tenant admin: flip the per-tenant grant to ``active``. Idempotent.\n\nBlocked when the SuperAdmin has globally disabled the model \u2014 that's\nlayer 1 of decision #13's cascade and a tenant admin can't override it.",
        "operationId": "models_enable_for_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantModelListItem"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Enable For Tenant",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/grants/agents": {
      "post": {
        "description": "Model owner: grant a model to an agent (access=full|read_only).\n\nCasbin's `model:grant:agent` policy is what decides \"can this caller\ngrant this model?\" \u2014 owner-only, owner-or-tenant-admin, etc. \u2014 per\n`docs/content/models.md`. This route does not duplicate the check.",
        "operationId": "models_grant_to_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentModelGrant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant To Agent",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/grants/agents/{agent_id}": {
      "delete": {
        "description": "Model owner: revoke a model grant from an agent.",
        "operationId": "models_revoke_from_agent",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke From Agent",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/grants/groups": {
      "get": {
        "description": "List the layer-2 group grants on a model, scoped to this tenant's groups (#424).",
        "operationId": "models_list_group_grants",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/UserModelGroupRead"
                  },
                  "title": "Response Models List Group Grants",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Group Grants",
        "tags": [
          "models"
        ]
      },
      "post": {
        "description": "Tenant admin: grant a model to a **group** (#424, layer-2 group grantee).\n\nGated by the same ``model:grant:user`` permission as the per-user layer-2\ngrant \u2014 a group grant is the same tenant-admin authority over the same\ncascade layer, so it does not introduce a new Casbin action (avoids a\n``policy.csv`` change that would collide with #421). A group from another\ntenant returns 404 (no cross-tenant existence oracle).",
        "operationId": "models_grant_to_group",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserModelGroupGrant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserModelGroupRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant To Group",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/grants/groups/{group_id}": {
      "delete": {
        "description": "Tenant admin: revoke a model grant from a group (#424). Immediate.",
        "operationId": "models_revoke_from_group",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke From Group",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/grants/users": {
      "post": {
        "description": "Tenant admin: grant a model to a user (access=full|read_only).",
        "operationId": "models_grant_to_user",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserModelGrant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserModelRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grant To User",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/models/{model_id}/grants/users/{user_id}": {
      "delete": {
        "description": "Tenant admin: revoke a model grant from a user.",
        "operationId": "models_revoke_from_user",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke From User",
        "tags": [
          "models"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/newsbot/provision": {
      "post": {
        "description": "Idempotently add NewsBot to ``tenant_id``.\n\n* Casbin gate: ``agent:create`` \u2014 OWNER/ADMIN only.\n* Read-only sessions: refused with 403.\n* Body: none. Everything comes from the path \u2014 no smuggled ids to worry\n  about (the tenant is Casbin-checked, the agent slug is fixed).\n* Response: ``{agent_id, agent_slug, is_new}``. ``200`` on a re-click\n  (``is_new=false``); ``200`` on first provision (``is_new=true``).",
        "operationId": "newsbot_provision_newsbot_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewsBotProvisionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Provision Newsbot Route",
        "tags": [
          "newsbot"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/openrouter/models": {
      "get": {
        "description": "List system-active OR models with the tenant's enable toggle.",
        "operationId": "openrouter_list_tenant_models",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/JsonObject"
                  },
                  "title": "Response Openrouter List Tenant Models",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Models",
        "tags": [
          "openrouter"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/openrouter/models/{model_id}/disable": {
      "post": {
        "description": "Tenant admin: disable an OR model for the tenant. Idempotent.",
        "operationId": "openrouter_disable_for_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Openrouter Disable For Tenant",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Disable For Tenant",
        "tags": [
          "openrouter"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/openrouter/models/{model_id}/enable": {
      "post": {
        "description": "Tenant admin: enable an OR model for the tenant. Idempotent.",
        "operationId": "openrouter_enable_for_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Openrouter Enable For Tenant",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Enable For Tenant",
        "tags": [
          "openrouter"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/rbac/check": {
      "post": {
        "description": "What can user X + agent Y actually do? Drives the UI simulator.",
        "operationId": "rbac_simulate",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RBACCheckRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RBACCheckResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Simulate",
        "tags": [
          "rbac"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/rbac/policies": {
      "get": {
        "description": "Return all Casbin policies applicable to this tenant (tenant-scoped + global).",
        "operationId": "rbac_list_policies",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/PolicyRead"
                  },
                  "title": "Response Rbac List Policies",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Policies",
        "tags": [
          "rbac"
        ]
      },
      "post": {
        "description": "Add a Casbin policy rule scoped to this tenant.\n\n``obj`` must stay under the ``{tenant_id}`` placeholder convention every seed\npolicy uses (see ``rbac/policy.csv``) \u2014 rejecting anything else keeps a\ntenant-authored row from reading as \"every path everywhere\" even though the\nmatcher's own domain check (#2590) already confines it to this tenant.\n\nA ``group:<id>`` subject (G2 \u2014 issue #423) must name a group **in this\ntenant**; a cross-tenant (or missing) group id gets the same 404 not-found\nshape, so the editor is not a cross-tenant existence oracle.",
        "operationId": "rbac_create_policy",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Policy",
        "tags": [
          "rbac"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/sessions": {
      "get": {
        "description": "All task sessions across every agent in this tenant, newest first.\n\nPowers the agents+tasks panes on the org billing page. The response model\nis ``TaskSessionRead`` with ``agent_name`` populated.",
        "operationId": "tasks_list_tenant_sessions_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TaskSessionRead"
                  },
                  "title": "Response Tasks List Tenant Sessions Route",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Sessions Route",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/sessions/{session_id}/goal": {
      "delete": {
        "description": "Clear this session's goal (user only). Stops the continuation loop.",
        "operationId": "tasks_clear_session_goal",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoalRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Clear Session Goal",
        "tags": [
          "tasks"
        ]
      },
      "get": {
        "description": "Read the server-authoritative goal state (404 when no goal is set).",
        "operationId": "tasks_get_session_goal",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoalRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session Goal",
        "tags": [
          "tasks"
        ]
      },
      "put": {
        "description": "Create or replace this session's goal (user only).\n\nOne goal per session: this overwrites any existing goal and records the\nreplaced goal (if any) in the ``audit_log`` row. A goal that carries a token\nbudget is money-equivalent and always audited.",
        "operationId": "tasks_set_session_goal",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GoalCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoalRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Session Goal",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/sessions/{session_id}/goal/pause": {
      "post": {
        "description": "Pause an active goal (user only). No continuation fires while paused.",
        "operationId": "tasks_pause_session_goal",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoalRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Pause Session Goal",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/sessions/{session_id}/goal/resume": {
      "post": {
        "description": "Resume a paused goal (user only). The loop restarts on the next turn.",
        "operationId": "tasks_resume_session_goal",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoalRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resume Session Goal",
        "tags": [
          "tasks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/settings/siem": {
      "get": {
        "description": "List configured SIEM destinations and custom redaction patterns.",
        "operationId": "siem_get_siem_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiemConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Siem Config",
        "tags": [
          "siem"
        ]
      },
      "put": {
        "description": "Replace SIEM destinations and custom redaction patterns.",
        "operationId": "siem_update_siem_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SiemConfigUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiemConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Siem Config",
        "tags": [
          "siem"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills": {
      "get": {
        "operationId": "skills_list_skills",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "description": "Filter by lifecycle status",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by lifecycle status",
              "title": "Status"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillRead"
                  },
                  "title": "Response Skills List Skills",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Skills",
        "tags": [
          "skills"
        ]
      },
      "post": {
        "description": "Create a skill.\n\nFor executable skills a GitLab repo is scaffolded automatically and the\nresulting clone URL is stored on the row.\nFor text skills no repo is created; ``instruction_content`` is stored\ndirectly and the skill starts in ``draft`` status ready for immediate use\nonce activated.",
        "operationId": "skills_create_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/admin": {
      "get": {
        "description": "Tenant-admin view of all skills \u2014 no visibility filter, with agent count.",
        "operationId": "skills_list_skills_admin",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "description": "Filter by lifecycle status",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by lifecycle status",
              "title": "Status"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillAdminRead"
                  },
                  "title": "Response Skills List Skills Admin",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Skills Admin",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/import": {
      "post": {
        "description": "Import a skill from an external zip package (Anthropic-format compatible).",
        "operationId": "skills_import_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_skills_import_skill"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillImportResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/pending-reviews": {
      "get": {
        "description": "List all skills pending admin review in this tenant.",
        "operationId": "skills_list_pending_reviews",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillRead"
                  },
                  "title": "Response Skills List Pending Reviews",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Pending Reviews",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}": {
      "delete": {
        "operationId": "skills_delete_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Skill",
        "tags": [
          "skills"
        ]
      },
      "get": {
        "description": "Return skill metadata. Private skills are only accessible to their owner.",
        "operationId": "skills_get_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Skill",
        "tags": [
          "skills"
        ]
      },
      "patch": {
        "operationId": "skills_update_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/agents": {
      "get": {
        "description": "Return agents in this tenant that have this skill attached.",
        "operationId": "skills_list_skill_agents",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillAgentRead"
                  },
                  "title": "Response Skills List Skill Agents",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Skill Agents",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/execute": {
      "post": {
        "description": "Execute a skill on behalf of an agent session.",
        "operationId": "skills_execute_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillExecuteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillInvocationRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Execute Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/fork": {
      "post": {
        "description": "Fork a skill \u2014 create an independent copy under an agent the caller owns.",
        "operationId": "skills_fork_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillForkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillForkRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fork Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/invocations": {
      "get": {
        "description": "List invocations for a skill, newest first by execution start time.",
        "operationId": "skills_list_skill_invocations",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "agent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "query",
            "name": "session_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Session Id"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Until"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SkillInvocationRead"
                  },
                  "title": "Response Skills List Skill Invocations",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Skill Invocations",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/promote-to-tenant": {
      "post": {
        "description": "Promote an agent-tier (private) skill to tenant-tier (public).",
        "operationId": "skills_promote_skill_to_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Promote Skill To Tenant",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/publish": {
      "post": {
        "description": "Publish a new version: regenerate embedding + summary, flip status to active.",
        "operationId": "skills_publish_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillPublishRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Publish Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/review": {
      "post": {
        "description": "Admin approves or rejects a pending skill.",
        "operationId": "skills_review_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillReviewDecision"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillReviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Review Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/submit-review": {
      "post": {
        "description": "Submit a draft skill for admin review.",
        "operationId": "skills_submit_skill_for_review",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillReviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Skill For Review",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/transfer": {
      "post": {
        "description": "Transfer skill ownership to another agent. Only org admins may transfer.",
        "operationId": "skills_transfer_skill",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillTransferRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Transfer Skill",
        "tags": [
          "skills"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/webhook": {
      "delete": {
        "operationId": "skill_webhooks_delete_skill_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Skill Webhook",
        "tags": [
          "skill-webhooks"
        ]
      },
      "get": {
        "operationId": "skill_webhooks_get_skill_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillWebhookRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Skill Webhook",
        "tags": [
          "skill-webhooks"
        ]
      },
      "post": {
        "operationId": "skill_webhooks_create_skill_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillWebhookCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Skill Webhook",
        "tags": [
          "skill-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/skills/{skill_id}/webhook/rotate": {
      "post": {
        "operationId": "skill_webhooks_rotate_skill_webhook_token",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "skill_id",
            "required": true,
            "schema": {
              "title": "Skill Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillWebhookCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Skill Webhook Token",
        "tags": [
          "skill-webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/source-credentials": {
      "get": {
        "description": "Every credential in the tenant (incl. soft-revoked), with its share grants.",
        "operationId": "source_credentials_list_credentials",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SourceCredentialAdminRead"
                  },
                  "title": "Response Source Credentials List Credentials",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Credentials",
        "tags": [
          "source-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/source-credentials/mine": {
      "get": {
        "description": "List the caller's own live (non-revoked) source credentials.\n\nMetadata only \u2014 the payload is never returned by any of these routes.",
        "operationId": "source_credentials_list_source_credentials",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SourceCredentialRead"
                  },
                  "title": "Response Source Credentials List Source Credentials",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Source Credentials",
        "tags": [
          "source-credentials"
        ]
      },
      "post": {
        "description": "Create a credential owned by the caller (audited; blocked read-only).",
        "operationId": "source_credentials_create_source_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceCredentialCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceCredentialRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Source Credential",
        "tags": [
          "source-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/source-credentials/mine/{credential_id}/revoke": {
      "post": {
        "description": "Soft-revoke a credential the caller owns (audited; read-only 403).\n\nIdempotent: an already-revoked (hence not-listed) credential is a 404, the\nsame shape as a missing / wrong-tenant / not-owned id.",
        "operationId": "source_credentials_revoke_source_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "credential_id",
            "required": true,
            "schema": {
              "title": "Credential Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Source Credential",
        "tags": [
          "source-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/source-credentials/mine/{credential_id}/rotate": {
      "post": {
        "description": "Rotate the secret of a credential the caller owns (audited; read-only 403).\n\nA missing / wrong-tenant / not-owned id is a uniform 404 (no oracle).",
        "operationId": "source_credentials_rotate_source_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "credential_id",
            "required": true,
            "schema": {
              "title": "Credential Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceCredentialRotate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceCredentialRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Source Credential",
        "tags": [
          "source-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/source-credentials/{credential_id}/grants": {
      "delete": {
        "description": "Revoke a share grant. No-op (still 200) if the grant didn't exist.",
        "operationId": "source_credentials_remove_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "credential_id",
            "required": true,
            "schema": {
              "title": "Credential Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceCredentialGrantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceCredentialAdminRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Grant",
        "tags": [
          "source-credentials"
        ]
      },
      "post": {
        "description": "Share a credential with a user / agent / role / group / all. Idempotent.\n\nA ``group`` grant names a tenant-group id in ``principal_id``; a group from\nanother tenant (or a missing one) returns the same 404 as a missing\ncredential \u2014 no cross-tenant existence oracle (#424).",
        "operationId": "source_credentials_add_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "credential_id",
            "required": true,
            "schema": {
              "title": "Credential Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceCredentialGrantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceCredentialAdminRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Add Grant",
        "tags": [
          "source-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/source-credentials/{credential_id}/revoke": {
      "post": {
        "description": "Admin kill-switch: soft-revoke a credential (keeps the row for audit).",
        "operationId": "source_credentials_revoke_credential",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "credential_id",
            "required": true,
            "schema": {
              "title": "Credential Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceCredentialAdminRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke Credential",
        "tags": [
          "source-credentials"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/sso-config": {
      "get": {
        "description": "Return the SSO / Keycloak realm configuration for this tenant.",
        "operationId": "identities_get_sso_config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SSOConfigRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Sso Config",
        "tags": [
          "identities"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/step-up/grants": {
      "post": {
        "description": "Record a fresh reauth so an agent acting for the caller may use it.",
        "operationId": "auth_create_step_up_grant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StepUpGrantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StepUpGrantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Step Up Grant",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/tool-bundles": {
      "get": {
        "description": "Bundles this tenant may grant: platform bundles plus its own.\n\nAnother tenant's bundles are not listed and, by ``_visible_bundle``, not\naddressable either.",
        "operationId": "agents_list_tool_bundles",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ToolBundleRead"
                  },
                  "title": "Response Agents List Tool Bundles",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tool Bundles",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/tools": {
      "get": {
        "description": "Return the tool catalogue for the tenant-admin inventory.",
        "operationId": "tools_list_tenant_tools",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ToolTenantRead"
                  },
                  "title": "Response Tools List Tenant Tools",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Tools",
        "tags": [
          "tools"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/webhooks": {
      "get": {
        "operationId": "webhooks_list_routes",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/WebhookRouteRead"
                  },
                  "title": "Response Webhooks List Routes",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Routes",
        "tags": [
          "webhooks"
        ]
      },
      "post": {
        "operationId": "webhooks_create_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRouteCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRouteCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Route",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/webhooks/{route_id}": {
      "delete": {
        "operationId": "webhooks_delete_route",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Route",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/tenant/{tenant_id}/webhooks/{route_id}/rotate-secret": {
      "post": {
        "operationId": "webhooks_rotate_secret",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "route_id",
            "required": true,
            "schema": {
              "title": "Route Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRouteCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Secret",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/tenants": {
      "post": {
        "description": "Any authenticated user can create a tenant \u2014 they become its OWNER.\n\n``tenant:create`` isn't checked via Casbin because there's no tenant to anchor it\nagainst yet; it's a platform-level action available to every authenticated user.\n\nA **non-default** ``seed_profile`` is operator-gated, though (GitLab #583). A\nvertical-product profile such as ``\"newsbot\"`` is not a cosmetic choice: it\ntriggers reseller wholesale billing (``reseller_billing`` server-forces the\nprivate plan + ``billed_to`` = the reseller + ``active``-without-payment), so\nan arbitrary authenticated user selecting it could mint a free workspace\nwhose usage rolls onto the reseller's invoice. Only an effective SuperAdmin\n(the platform-operator path) may create a tenant on a product profile; every\nother caller is restricted to the base ``\"default\"`` experience. The\nself-serve reader path through the reseller's own authenticated context is\ntracked separately (GitLab #594) \u2014 see\n``docs/content/tenancy.md`` (Public and private plans).",
        "operationId": "tenants_create_tenant",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Tenant",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}": {
      "get": {
        "operationId": "tenants_get_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tenant",
        "tags": [
          "tenants"
        ]
      },
      "patch": {
        "operationId": "tenants_update_tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Tenant",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/allowed-accounts": {
      "get": {
        "operationId": "tenant_allowed_accounts_list_allowed_accounts",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantAllowedAccountRead"
                  },
                  "title": "Response Tenant Allowed Accounts List Allowed Accounts",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Allowed Accounts",
        "tags": [
          "tenant-allowed-accounts"
        ]
      },
      "post": {
        "operationId": "tenant_allowed_accounts_create_allowed_account",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantAllowedAccountCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantAllowedAccountRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Allowed Account",
        "tags": [
          "tenant-allowed-accounts"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/allowed-accounts/{account_id}": {
      "delete": {
        "operationId": "tenant_allowed_accounts_delete_allowed_account",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "account_id",
            "required": true,
            "schema": {
              "title": "Account Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Allowed Account",
        "tags": [
          "tenant-allowed-accounts"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/brand": {
      "get": {
        "operationId": "tenant_brand_get_brand",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantBrandRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Brand",
        "tags": [
          "tenant-brand"
        ]
      },
      "put": {
        "description": "Upsert the colour theme. Fields left unset are not touched; passing\nexplicit ``null`` clears a single field.",
        "operationId": "tenant_brand_update_brand_theme",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantBrandUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantBrandRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Brand Theme",
        "tags": [
          "tenant-brand"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/brand/favicon": {
      "delete": {
        "operationId": "tenant_brand_delete_favicon",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Favicon",
        "tags": [
          "tenant-brand"
        ]
      },
      "get": {
        "description": "Stream the effective favicon for this tenant.\n\nFalls back to the platform default when the tenant hasn't uploaded\none, so the same URL is safe for layouts to embed unconditionally.\nA 404 means no tenant favicon AND no platform default.",
        "operationId": "tenant_brand_fetch_favicon",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fetch Favicon",
        "tags": [
          "tenant-brand"
        ]
      },
      "post": {
        "description": "Upload a brand favicon. ClamAV-scanned before storage.",
        "operationId": "tenant_brand_upload_favicon",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_tenant_brand_upload_favicon"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantBrandFaviconUploaded"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Favicon",
        "tags": [
          "tenant-brand"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/brand/logo": {
      "delete": {
        "operationId": "tenant_brand_delete_logo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Logo",
        "tags": [
          "tenant-brand"
        ]
      },
      "get": {
        "description": "Stream the logo bytes back to the browser.\n\nAuth-gated by ``tenant:brand:read`` so non-members can't enumerate\narbitrary tenants' logos. The bytes come straight from the tenant's\nGCS bucket; we never hand out signed URIs.",
        "operationId": "tenant_brand_fetch_logo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fetch Logo",
        "tags": [
          "tenant-brand"
        ]
      },
      "post": {
        "description": "Upload a brand logo. Scanned via ClamAV before storage; a non-clean\nverdict returns 422 and no DB row is written.",
        "operationId": "tenant_brand_upload_logo",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_tenant_brand_upload_logo"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantBrandLogoUploaded"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Logo",
        "tags": [
          "tenant-brand"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/default-permissions": {
      "get": {
        "description": "Return the tenant-wide default permission set.",
        "operationId": "tenants_get_default_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultPermissionsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Default Permissions",
        "tags": [
          "tenants"
        ]
      },
      "put": {
        "description": "Update tenant-wide default permissions (tenant admin only).",
        "operationId": "tenants_update_default_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DefaultPermissionsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultPermissionsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Default Permissions",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/entitlements": {
      "get": {
        "operationId": "tenants_get_entitlements",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEntitlementsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Entitlements",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/groups/{group_id}/permissions": {
      "get": {
        "description": "The capability flags a group grants its user members (#424).\n\nA group id from another tenant returns the same 404 as a missing one \u2014 no\ncross-tenant existence oracle. Flags are **inert for agent members**.",
        "operationId": "tenants_get_group_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGroupPermissionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Group Permissions",
        "tags": [
          "tenants"
        ]
      },
      "put": {
        "description": "Grant capability flags to a group's user members (tenant admin only, #424).\n\nInert for agent members until an agent-side capability gate exists \u2014 the UI\nmust say so. A cross-tenant / missing group id returns 404.",
        "operationId": "tenants_update_group_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "title": "Group Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantGroupPermissionUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGroupPermissionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Group Permissions",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/guardrail-defaults": {
      "get": {
        "description": "Return the current tenant-wide guardrail defaults.\n\nA ``null`` field means \"no tenant default set; platform default applies.\"\nGated to OWNER/ADMIN via ``tenant:guardrail_defaults:read``.",
        "operationId": "tenants_get_guardrail_defaults",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGuardrailDefaultsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Guardrail Defaults",
        "tags": [
          "tenants"
        ]
      },
      "put": {
        "description": "Partially update the tenant-wide guardrail defaults.\n\nOmitted fields are left untouched; sending a field as ``null`` clears\nthe default and falls back to the platform default.  Gated to\nOWNER/ADMIN via ``tenant:guardrail_defaults:write``.",
        "operationId": "tenants_update_guardrail_defaults",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantGuardrailDefaultsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantGuardrailDefaultsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Guardrail Defaults",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/guardrail-model-options": {
      "get": {
        "description": "Return the enumerated set of guardrail model IDs for tenant defaults.\n\nSame list as the per-agent endpoint; provided here so the tenant\ndefaults page can populate combobox options without needing an agent id.",
        "operationId": "tenants_list_guardrail_model_options",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuardrailModelOptionsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Guardrail Model Options",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/invites": {
      "post": {
        "operationId": "tenants_invite_user",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Invite User",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/keep-alive": {
      "post": {
        "description": "Cancel a pending abandoned-workspace archival warning (issue #3695).\n\nThe explicit \"keep my workspace\" path: an OWNER/ADMIN who wants to hold\nonto an inert self-serve workspace without necessarily creating a\nsession or agent right away. A no-op (still 200) for a tenant that was\nnever warned \u2014 this route only ever clears state, so it can't be used to\nset or extend anything an attacker doesn't already control by using the\nworkspace.",
        "operationId": "tenants_keep_workspace_alive",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Keep Workspace Alive",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/mail/mailboxes": {
      "get": {
        "description": "Read-only roster of this tenant's mailboxes (internal + external).\n\nBoth kinds are returned in a single call so the front-end can render one\ntable; the ``service`` column on each row tells them apart. Active\nmailboxes come first, then internal-vs-external, then alphabetical by\naddress \u2014 see ``services.tenant_mail.list_tenant_mailboxes``.\n\nCasbin gates this on ``tenant:mail:read``; OWNER/ADMIN inherit it from\ntheir ``/{tenant_id}/*`` wildcard in ``policy.csv``, MEMBER/GUEST/VIEWER\ndon't (mailbox addresses leak which agents exist, so the roster stays\ntenant-admin only).",
        "operationId": "tenant_mail_list_tenant_mailboxes",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantMailboxRow"
                  },
                  "title": "Response Tenant Mail List Tenant Mailboxes",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tenant Mailboxes",
        "tags": [
          "tenant-mail"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/members": {
      "get": {
        "operationId": "tenants_list_members",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TenantMember"
                  },
                  "title": "Response Tenants List Members",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Members",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/members/{user_id}": {
      "delete": {
        "operationId": "tenants_remove_member",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Member",
        "tags": [
          "tenants"
        ]
      },
      "patch": {
        "description": "Change a member's role. Cannot change the OWNER's role.",
        "operationId": "tenants_update_member_role",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemberRoleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantMember"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Member Role",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/prompt-embedding": {
      "get": {
        "description": "Return the tenant's prompt-embedding opt-out flag.\n\nGated to OWNER/ADMIN via ``tenant:prompt_embedding:read``.",
        "operationId": "tenants_get_prompt_embedding_settings",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptEmbeddingSettingsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Prompt Embedding Settings",
        "tags": [
          "tenants"
        ]
      },
      "put": {
        "description": "Set the tenant's prompt-embedding opt-out flag.\n\nOpting out (``opt_out=true``) purges the tenant's existing\n``prompt_embedding`` rows and stops the backfill loop from embedding any\nmore of its prompts. Gated to OWNER/ADMIN via\n``tenant:prompt_embedding:write``; every change writes an ``audit_log`` row.",
        "operationId": "tenants_update_prompt_embedding_settings",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptEmbeddingSettingsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromptEmbeddingSettingsRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Prompt Embedding Settings",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/sessions/audit": {
      "get": {
        "description": "Paginated list of all sessions across all agents in this tenant.\n\nPowers the Organization > Sessions audit page. Query params support\nfiltering by agent, user, date range, and keyword search on session title.\nRequires tenant admin role (OWNER/ADMIN).",
        "operationId": "session_audit_list_sessions_audit",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "agent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Per Page",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditSessionListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Sessions Audit",
        "tags": [
          "session-audit"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/sessions/audit-export": {
      "get": {
        "description": "Export filtered session list as CSV or JSON.\n\nUses the same filters as the list endpoint. Fetches up to 10 000 rows\n(hard cap) to keep the export bounded.",
        "operationId": "session_audit_export_sessions_audit",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "enum": [
                "csv",
                "json"
              ],
              "title": "Format",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "agent_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Export Sessions Audit",
        "tags": [
          "session-audit"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/sessions/audit/{session_id}": {
      "get": {
        "description": "Full debug data for a single session, including all messages with tool\ncalls, system prompts, token usage, and cost attribution.\n\nEvery call writes an ``audit_log`` entry so there's a trail of who\ninspected which session's debug data.",
        "operationId": "session_audit_get_session_audit_detail",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditSessionDetailResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session Audit Detail",
        "tags": [
          "session-audit"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/skill-visibility-scope-default": {
      "put": {
        "description": "Set the tenant-wide default skill-authoring visibility scope.\n\nSeeds ``skill_visibility_scope`` on newly created agents. Existing agents\nare not retroactively changed. Requires ``tenant:update`` (OWNER/ADMIN only).\nSee issue #550.",
        "operationId": "tenants_update_skill_visibility_scope_default",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantSkillVisibilityScopeUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Skill Visibility Scope Default",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/tenants/{tenant_id}/users/{user_id}/permissions": {
      "get": {
        "description": "Return effective permissions for a user in this tenant.",
        "operationId": "tenants_get_user_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantUserPermissionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get User Permissions",
        "tags": [
          "tenants"
        ]
      },
      "put": {
        "description": "Update per-user capability overrides (tenant admin only).",
        "operationId": "tenants_update_user_permissions",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantUserPermissionUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantUserPermissionRead"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update User Permissions",
        "tags": [
          "tenants"
        ]
      }
    },
    "/api/v1/threads": {
      "post": {
        "operationId": "assistants_shim_create_thread",
        "parameters": [
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ThreadCreateRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThreadObject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Thread",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/v1/threads/{thread_id}": {
      "get": {
        "operationId": "assistants_shim_get_thread",
        "parameters": [
          {
            "in": "path",
            "name": "thread_id",
            "required": true,
            "schema": {
              "title": "Thread Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThreadObject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Thread",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/v1/threads/{thread_id}/messages": {
      "get": {
        "operationId": "assistants_shim_list_messages",
        "parameters": [
          {
            "in": "path",
            "name": "thread_id",
            "required": true,
            "schema": {
              "title": "Thread Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "default": "desc",
              "title": "Order",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageList"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Messages",
        "tags": [
          "assistants-shim"
        ]
      },
      "post": {
        "operationId": "assistants_shim_create_message",
        "parameters": [
          {
            "in": "path",
            "name": "thread_id",
            "required": true,
            "schema": {
              "title": "Thread Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageObject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Message",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/v1/threads/{thread_id}/runs": {
      "post": {
        "operationId": "assistants_shim_create_run",
        "parameters": [
          {
            "in": "path",
            "name": "thread_id",
            "required": true,
            "schema": {
              "title": "Thread Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunObject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Run",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/v1/threads/{thread_id}/runs/{run_id}": {
      "get": {
        "operationId": "assistants_shim_get_run",
        "parameters": [
          {
            "in": "path",
            "name": "thread_id",
            "required": true,
            "schema": {
              "title": "Thread Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunObject"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Run",
        "tags": [
          "assistants-shim"
        ]
      }
    },
    "/api/webhooks/linked-repos/{webhook_id}": {
      "post": {
        "description": "Public endpoint. Auth is HMAC via GitHub's signature; webhook_id resolves the row.",
        "operationId": "linked_repos_webhooks_public_receive_linked_repo_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Linked Repos Webhooks Public Receive Linked Repo Webhook",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Receive Linked Repo Webhook",
        "tags": [
          "linked-repos-webhooks-public"
        ]
      }
    },
    "/api/webhooks/skills/{webhook_id}": {
      "post": {
        "description": "Public endpoint. Auth is bearer token; webhook_id resolves the skill.\n\nOn a verified call we cold-start a session for the skill's owner agent and\nforward the raw payload through ``proxy_client.inbound`` so the inbound\nguardrails run and the work item lands on the agent's Valkey stream\n(decision #16).",
        "operationId": "skill_webhooks_public_invoke_skill_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Skill Webhooks Public Invoke Skill Webhook",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Invoke Skill Webhook",
        "tags": [
          "skill-webhooks-public"
        ]
      }
    },
    "/api/webhooks/stripe/{path_token}": {
      "post": {
        "description": "Public Stripe webhook receiver.\n\n1. Validate path_token.\n2. HMAC-verify the body.\n3. Insert StripeEvent row (idempotency).\n4. Dispatch to per-event handler.",
        "operationId": "stripe_webhooks_stripe_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "path_token",
            "required": true,
            "schema": {
              "title": "Path Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookAck"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stripe Webhook",
        "tags": [
          "stripe-webhooks",
          "stripe-webhooks"
        ]
      }
    },
    "/api/webhooks/{provider}/{path_token}": {
      "post": {
        "description": "Public endpoint. Auth is HMAC via provider signature; path_token resolves the route.",
        "operationId": "webhooks_public_receive_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "path_token",
            "required": true,
            "schema": {
              "title": "Path Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Receive Webhook",
        "tags": [
          "webhooks-public"
        ]
      }
    },
    "/mcp": {
      "post": {
        "description": "Streamable HTTP transport for the Good Place Model Context Protocol server. Accepts a JSON-RPC 2.0 request and returns a JSON-RPC response. Requires a Good Place-minted OAuth 2.1 access token (Authorization: Bearer); see /.well-known/oauth-protected-resource.",
        "operationId": "MCP_mcp_endpoint",
        "parameters": [
          {
            "in": "header",
            "name": "origin",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Origin"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          },
          {
            "BearerAuth": []
          }
        ],
        "summary": "Good Place MCP JSON-RPC endpoint",
        "tags": [
          "MCP"
        ]
      }
    },
    "/oauth/authorize": {
      "get": {
        "operationId": "MCP OAuth_authorize",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Authorize",
        "tags": [
          "MCP OAuth"
        ]
      },
      "post": {
        "operationId": "MCP OAuth_authorize_decision",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Authorize Decision",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/oauth/register": {
      "post": {
        "operationId": "MCP OAuth_register_client",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Register Client",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/oauth/revoke": {
      "post": {
        "operationId": "MCP OAuth_revoke",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Body_MCP_OAuth_revoke"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Revoke",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/oauth/set-session": {
      "post": {
        "description": "Accept a session JWT from the front-end and set it as a cookie.\n\nThe MCP OAuth flow redirects the user to the front-end login page.\nAfter the user authenticates via Keycloak, the front-end posts the\nsession token here so the ``/oauth/authorize`` endpoint can find it.",
        "operationId": "MCP OAuth_set_session",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Set Session",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/oauth/token": {
      "post": {
        "operationId": "MCP OAuth_token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Body_MCP_OAuth_token"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Token",
        "tags": [
          "MCP OAuth"
        ]
      }
    },
    "/tenant/{tenant_id}/agent/{agent_id}/session/{session_id}/events": {
      "get": {
        "description": "SSE stream of agent events sourced from Valkey ``events:<session_id>``.\n\nA reconnecting client sends ``Last-Event-ID: <cursor>``; we resume from\nthere. Without the header we start at ``$`` \u2014 only events written after\nthe subscription begins, which avoids replaying the full history on a\nfresh open. The internal twin at ``/api/v1/internal/...`` exists for\nservice-JWT callers that need the same fan-out without going through\nthe browser auth surface.",
        "operationId": "agent_proxy_stream_events",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "title": "Tenant Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Last-Event-ID",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Last-Event-Id"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "in": "header",
            "name": "X-Dev-User-Email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Dev-User-Email"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stream Events",
        "tags": [
          "agent-proxy"
        ]
      }
    }
  }
}
