DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
feat(auth): add secure public session handoff (#1467)
XZH352897cd4e0c
diff --git a/README.md b/README.mdindex bf1f2054e..69d9fe53a 100644--- a/README.md+++ b/README.md@@ -851,6 +851,8 @@ The **first registered user becomes admin** and owns model catalogs, provider cr**Enable it:** turn auth on in `data/user/settings/auth.json`, restart `deeptutor start`, register the first admin at `/register`, then add users from `/admin/users` and assign models, KBs, skills, partners, tool/MCP/CLI-app policy, and code-execution access through grants; configure shared books under each user's **Book access** panel.+For split private/public origins, set `auth.private_login_hosts` (or `AUTH_PRIVATE_LOGIN_HOSTS`) to the private frontend hosts that may show password sign-in and registration. Keep the backend API reachable through the DeepTutor frontend proxy rather than exposing it directly, because that proxy supplies the trusted frontend-host boundary. Loopback is always allowed; when the list is non-empty, an authenticated user on a private origin can open **Profile → Public device sign-in** and create a short-lived, host-bound pairing link for an HTTPS public origin. The public `/handoff` page exchanges the one-time code for an equally short JWE ticket in a POST body, consumes the ticket once, and receives the normal HttpOnly session cookie.+> PocketBase stays a single-user integration — keep `integrations.pocketbase_url` blank for multi-user deployments unless you've wired up an external user store.</details>diff --git a/deeptutor/api/routers/auth.py b/deeptutor/api/routers/auth.pyindex f99b7c5cf..cc749db77 100644--- a/deeptutor/api/routers/auth.py+++ b/deeptutor/api/routers/auth.py@@ -4,6 +4,8 @@ from contextvars import Token as _CtxTokenfrom datetime import datetime, timedelta, timezoneimport loggingimport re+import secrets+import timefrom fastapi import (APIRouter,@@ -42,6 +44,20 @@ from deeptutor.multi_user.identity import get_user_by_idfrom deeptutor.multi_user.learning_access import learning_policy_for_userfrom deeptutor.multi_user.models import AccountPresetfrom deeptutor.multi_user.paths import local_admin_user+from deeptutor.multi_user.session_handoff import (+ CODE_LIFETIME_SECONDS,+ TICKET_LIFETIME_SECONDS,+ HandoffError,+ HandoffRateLimited,+ HandoffRejected,+ canonical_host,+ decrypt_ticket_payload,+ encrypt_ticket_payload,+ get_session_handoff_store,+ hash_secret,+ is_loopback_host,+ public_origin,+)from deeptutor.services.auth import (AUTH_ENABLED,POCKETBASE_ENABLED,@@ -74,6 +90,11 @@ router = APIRouter()_COOKIE_NAME = "dt_token"_COOKIE_MAX_AGE = TOKEN_EXPIRE_HOURS * 3600+_FRONTEND_HOST_HEADER = "x-deeptutor-frontend-host"+_AUTH_RUNTIME_SETTINGS = load_auth_settings()+PRIVATE_LOGIN_HOSTS = frozenset(+ str(host).lower().rstrip(".") for host in _AUTH_RUNTIME_SETTINGS.get("private_login_hosts", [])+)def _cookie_attrs() -> dict:@@ -94,6 +115,35 @@ def _cookie_attrs() -> dict:}+def _request_frontend_host(request: Request) -> str:+ raw = request.headers.get(_FRONTEND_HOST_HEADER) or request.headers.get("host", "")+ try:+ return canonical_host(raw)+ except HandoffError:+ return ""+++def _require_private_frontend(request: Request) -> None:+ """Restrict credential endpoints only when private hosts are configured."""++ if not PRIVATE_LOGIN_HOSTS:+ return+ host = _request_frontend_host(request)+ if is_loopback_host(host) or host in PRIVATE_LOGIN_HOSTS:+ return+ logger.warning(+ "Credential endpoint refused for non-private frontend host policy",+ )+ raise HTTPException(+ status_code=status.HTTP_403_FORBIDDEN,+ detail="Sign-in is only available from a private DeepTutor origin",+ )+++def _no_store(response: Response) -> None:+ response.headers["Cache-Control"] = "no-store"++# ---------------------------------------------------------------------------# Schemas# ---------------------------------------------------------------------------@@ -152,6 +202,24 @@ class RegisterRequest(BaseModel):return v+class SessionHandoffCreateRequest(BaseModel):+ """Private request that starts a one-time public handoff."""++ public_origin: str = Field(min_length=8, max_length=2048)+++class SessionHandoffExchangeRequest(BaseModel):+ """Public request that trades a pairing code for a JWE ticket."""++ code: str = Field(min_length=16, max_length=256)+++class SessionHandoffCompleteRequest(BaseModel):+ """Public request that trades a JWE ticket for the normal cookie."""++ ticket: str = Field(min_length=32, max_length=8192)++class SetRoleRequest(BaseModel):"""Payload for the PUT /users/{username}/role endpoint."""@@ -531,11 +599,14 @@ async def auth_status(@router.post("/login")-async def login(body: LoginRequest, response: Response) -> dict:+async def login(body: LoginRequest, request: Request, response: Response) -> dict:"""Validate credentials and set a JWT cookie."""if not AUTH_ENABLED:return {"ok": True, "message": "Auth is disabled — no login required."}+ _require_private_frontend(request)+ _no_store(response)+if POCKETBASE_ENABLED:# PocketBase mode: email = username field for backwards-compat with the# existing LoginRequest schema; users can pass their email as "username".@@ -621,6 +692,176 @@ async def device_login(body: DeviceLoginRequest, response: Response) -> dict:}[email protected]("/session-handoff")+async def create_session_handoff(+ body: SessionHandoffCreateRequest,+ request: Request,+ response: Response,+ authorization: str | None = Header(default=None, alias="Authorization"),+ dt_token: str | None = Cookie(default=None, alias=_COOKIE_NAME),+ payload: TokenPayload | None = Depends(require_auth),+) -> dict:+ """Create a host-bound, one-time pairing code from the private origin."""++ _no_store(response)+ if not AUTH_ENABLED or payload is None:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="Session handoff requires multi-user authentication.",+ )+ _require_private_frontend(request)++ try:+ target_origin = public_origin(body.public_origin)+ target_host = canonical_host(target_origin.removeprefix("https://"))+ now = int(time.time())+ ticket_claims: dict[str, object] = {+ "nonce": secrets.token_urlsafe(24),+ "host": target_host,+ "exp": now + TICKET_LIFETIME_SECONDS,+ }+ if POCKETBASE_ENABLED:+ ticket_claims.update(+ {"mode": "pocketbase", "token": _extract_token(authorization, dt_token)}+ )+ else:+ ticket_claims.update(+ {+ "mode": "builtin",+ "username": payload.username,+ "role": payload.role,+ "user_id": payload.user_id,+ "device_credential_id": payload.device_credential_id,+ "device_session_nonce": payload.device_session_nonce,+ }+ )+ ticket = encrypt_ticket_payload(ticket_claims)+ record = get_session_handoff_store().create(+ encrypted_ticket=ticket,+ ticket_hash=hash_secret(ticket),+ public_host=target_host,+ rate_key=payload.user_id or payload.username,+ )+ except HandoffRateLimited:+ raise HTTPException(+ status_code=status.HTTP_429_TOO_MANY_REQUESTS,+ detail="Too many handoff requests. Try again later.",+ )+ except HandoffError:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="Enter a valid HTTPS public origin",+ )++ logger.info(+ "Created session handoff for user=%s target_host=%s",+ payload.username,+ target_host,+ )+ return {+ "ok": True,+ "code": record.code,+ "handoff_url": f"{target_origin}/handoff?code={record.code}",+ "expires_at": record.expires_at,+ "expires_in": CODE_LIFETIME_SECONDS,+ }++[email protected]("/session-handoff/exchange")+async def exchange_session_handoff(+ body: SessionHandoffExchangeRequest,+ request: Request,+ response: Response,+) -> dict:+ """Consume a pairing code and return a short-lived ticket in the response body."""++ _no_store(response)+ host = _request_frontend_host(request)+ if not host:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="Pairing request has no valid frontend host",+ )+ try:+ ticket = get_session_handoff_store().exchange(+ code=body.code,+ public_host=host,+ )+ except HandoffRateLimited:+ raise HTTPException(+ status_code=status.HTTP_429_TOO_MANY_REQUESTS,+ detail="Too many handoff requests. Try again later.",+ )+ except HandoffError:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="Pairing code is invalid, expired, or already used",+ )+ logger.info("Exchanged session handoff code for host=%s", host)+ return {"ok": True, "ticket": ticket}++[email protected]("/session-handoff/complete")+async def complete_session_handoff(+ body: SessionHandoffCompleteRequest,+ request: Request,+ response: Response,+) -> dict:+ """Consume a ticket once and issue the normal HttpOnly session cookie."""++ _no_store(response)+ host = _request_frontend_host(request)+ if not host:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="Handoff request has no valid frontend host",+ )+ try:+ ticket = get_session_handoff_store().consume_ticket(+ ticket=body.ticket,+ public_host=host,+ )+ claims = decrypt_ticket_payload(ticket)+ if str(claims.get("host")) != host:+ raise HandoffRejected("Invalid handoff ticket")+ try:+ expires_at = int(claims.get("exp"))+ except (TypeError, ValueError):+ raise HandoffRejected("Invalid handoff ticket") from None+ if expires_at <= int(time.time()):+ raise HandoffRejected("Invalid handoff ticket")++ mode = str(claims.get("mode"))+ if mode == "pocketbase":+ token = str(claims.get("token") or "")+ if not token or decode_token(token) is None:+ raise HandoffRejected("Invalid handoff ticket")+ elif mode == "builtin":+ token = create_token(+ str(claims.get("username") or ""),+ str(claims.get("role") or "user"),+ str(claims.get("user_id") or ""),+ device_credential_id=str(claims.get("device_credential_id") or ""),+ device_session_nonce=str(claims.get("device_session_nonce") or ""),+ )+ else:+ raise HandoffRejected("Invalid handoff ticket")+ except HandoffRateLimited:+ raise HTTPException(+ status_code=status.HTTP_429_TOO_MANY_REQUESTS,+ detail="Too many handoff requests. Try again later.",+ )+ except HandoffError:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="Handoff ticket is invalid, expired, or already used",+ )++ response.set_cookie(value=token, max_age=_COOKIE_MAX_AGE, **_cookie_attrs())+ logger.info("Completed session handoff for host=%s", host)+ return {"ok": True}++@router.post("/device/heartbeat")async def device_heartbeat(response: Response,@@ -665,7 +906,7 @@ async def logout(response: Response) -> dict:@router.post("/register", status_code=status.HTTP_201_CREATED)-async def register(body: RegisterRequest) -> dict:+async def register(body: RegisterRequest, request: Request, response: Response) -> dict:"""Bootstrap-only registration.@@ -681,6 +922,9 @@ async def register(body: RegisterRequest) -> dict:detail="Auth is disabled — registration is not available.",)+ _require_private_frontend(request)+ _no_store(response)+if POCKETBASE_ENABLED:# PocketBase deployments are documented as single-user. Keep registration# closed and require admins to provision users in the PocketBase admin UI.diff --git a/deeptutor/multi_user/session_handoff.py b/deeptutor/multi_user/session_handoff.pynew file mode 100644index 000000000..01485e587--- /dev/null+++ b/deeptutor/multi_user/session_handoff.py@@ -0,0 +1,472 @@+"""Security state for private-to-public session handoff.++Pairing codes and tickets are represented only by SHA-256 fingerprints in+SQLite. A short-lived JWE carries the credential between the two public POST+calls, so the deployment-private database never contains a plaintext bearer+token.+"""++from __future__ import annotations++from dataclasses import dataclass+import hashlib+import ipaddress+import json+import os+from pathlib import Path+import secrets+import sqlite3+import time+from typing import Any+from urllib.parse import urlsplit, urlunsplit++from jose import jwe+from jose.exceptions import JWSError++from .identity import AUTH_DIR, load_or_create_auth_secret++CODE_LIFETIME_SECONDS = 300+TICKET_LIFETIME_SECONDS = 120+MAX_CODE_ATTEMPTS = 5+CREATE_RATE_LIMIT = (5, 60)+EXCHANGE_RATE_LIMIT = (10, 60)+COMPLETE_RATE_LIMIT = (10, 60)+GLOBAL_EXCHANGE_RATE_LIMIT = (30, 60)+STATE_RETENTION_SECONDS = 600++_DB_FILENAME = "session_handoff.sqlite3"+++class HandoffError(Exception):+ """A controlled handoff failure that is safe to expose generically."""+++class HandoffRejected(HandoffError):+ """The code/ticket is absent, malformed, expired, or already used."""+++class HandoffRateLimited(HandoffError):+ """The caller exceeded a handoff rate limit."""+++@dataclass(frozen=True)+class HandoffRecord:+ code: str+ ticket: str+ public_origin: str+ expires_at: int+++def _normalized_hostname(hostname: str) -> str:+ if not hostname or len(hostname) > 253:+ raise HandoffError("Invalid host")+ if any(ch.isspace() or ord(ch) < 0x20 or ch == "\x7f" for ch in hostname):+ raise HandoffError("Invalid host")+ try:+ return hostname.rstrip(".").lower()+ except UnicodeError as exc:+ raise HandoffError("Invalid host") from exc+++def canonical_host(value: str, *, default_port: int | None = None) -> str:+ """Canonicalize an HTTP Host value without accepting path-like input."""++ raw = value.strip()+ if not raw or "/" in raw or "?" in raw or "#" in raw or "@" in raw:+ raise HandoffError("Invalid host")+ try:+ parsed = urlsplit(f"//{raw}", allow_fragments=False)+ hostname = parsed.hostname+ port = parsed.port+ except ValueError as exc:+ raise HandoffError("Invalid host") from exc+ if not hostname:+ raise HandoffError("Invalid host")+ host = _normalized_hostname(hostname)+ try:+ address = ipaddress.ip_address(host)+ except ValueError:+ try:+ host = host.encode("idna").decode("ascii").lower()+ except UnicodeError as exc:+ raise HandoffError("Invalid host") from exc+ else:+ host = str(address)+ if port is None:+ port = default_port+ if port is not None and port != default_port:+ host = f"[{host}]:{port}" if ":" in host else f"{host}:{port}"+ return host+++def is_loopback_host(host: str) -> bool:+ if host.startswith("["):+ host = host.split("]", 1)[0][1:]+ elif host.count(":") == 1:+ host = host.split(":", 1)[0]+ try:+ address = ipaddress.ip_address(host)+ except ValueError:+ return host == "localhost"+ return address.is_loopback+++def public_origin(value: str) -> str:+ """Validate and canonicalize the HTTPS origin to which a ticket is bound."""++ raw = value.strip()+ try:+ parsed = urlsplit(raw)+ port = parsed.port+ except ValueError as exc:+ raise HandoffError("Public origin must use HTTPS") from exc+ if parsed.scheme.lower() != "https" or not parsed.hostname:+ raise HandoffError("Public origin must use HTTPS")+ if (+ parsed.username+ or parsed.password+ or parsed.path not in ("", "/")+ or parsed.query+ or parsed.fragment+ ):+ raise HandoffError("Public origin must not contain a path or credentials")+ host = canonical_host(parsed.netloc, default_port=443)+ if is_loopback_host(host):+ raise HandoffError("Public origin cannot be loopback")+ try:+ address = ipaddress.ip_address(host)+ except ValueError:+ if "." not in host:+ raise HandoffError("Public origin hostname is invalid")+ else:+ if not address.is_global:+ raise HandoffError("Public origin must use a public address")+ if port is not None and port != 443:+ return urlunsplit(("https", host, "", "", ""))+ return urlunsplit(("https", host, "", "", ""))+++def hash_secret(value: str) -> str:+ return hashlib.sha256(value.encode("utf-8")).hexdigest()+++def _jwe_key(secret: str | None = None) -> bytes:+ material = secret or load_or_create_auth_secret()+ if not material:+ raise HandoffError("Handoff encryption key is unavailable")+ return hashlib.sha256(material.encode("utf-8")).digest()+++def encrypt_ticket_payload(payload: dict[str, Any], *, secret: str | None = None) -> str:+ plaintext = json.dumps(payload, separators=(",", ":"), sort_keys=True).encode("utf-8")+ try:+ token = jwe.encrypt(+ plaintext,+ _jwe_key(secret),+ algorithm="dir",+ encryption="A256GCM",+ )+ return token.decode("ascii") if isinstance(token, bytes) else token+ except (JWSError, ValueError) as exc:+ raise HandoffError("Could not protect the handoff ticket") from exc+++def decrypt_ticket_payload(token: str, *, secret: str | None = None) -> dict[str, Any]:+ try:+ plaintext = jwe.decrypt(token, _jwe_key(secret))+ payload = json.loads(plaintext)+ except (JWSError, ValueError, TypeError, json.JSONDecodeError):+ raise HandoffRejected("Invalid handoff ticket") from None+ if not isinstance(payload, dict):+ raise HandoffRejected("Invalid handoff ticket")+ return payload+++class SessionHandoffStore:+ """SQLite-backed atomic code/ticket state with owner-only permissions."""++ def __init__(self, db_path: Path | None = None) -> None:+ self.db_path = db_path or AUTH_DIR / _DB_FILENAME++ def _connect(self) -> sqlite3.Connection:+ parent_existed = self.db_path.parent.exists()+ self.db_path.parent.mkdir(parents=True, exist_ok=True)+ if not parent_existed:+ os.chmod(self.db_path.parent, 0o700)+ connection = sqlite3.connect(self.db_path, timeout=10, isolation_level=None)+ connection.row_factory = sqlite3.Row+ connection.execute("PRAGMA journal_mode=WAL")+ connection.execute("PRAGMA synchronous=FULL")+ connection.execute("PRAGMA busy_timeout=10000")+ return connection++ def _initialize(self, connection: sqlite3.Connection) -> None:+ connection.executescript(+ """+ CREATE TABLE IF NOT EXISTS handoff_records (+ code_hash TEXT PRIMARY KEY,+ ticket_hash TEXT NOT NULL UNIQUE,+ encrypted_ticket TEXT NOT NULL,+ public_host TEXT NOT NULL,+ expires_at INTEGER NOT NULL,+ code_consumed_at INTEGER,+ ticket_consumed_at INTEGER,+ failed_attempts INTEGER NOT NULL DEFAULT 0,+ created_at INTEGER NOT NULL+ );+ CREATE INDEX IF NOT EXISTS handoff_expiry_idx+ ON handoff_records(expires_at);+ CREATE TABLE IF NOT EXISTS handoff_rate_limits (+ bucket TEXT PRIMARY KEY,+ window_start INTEGER NOT NULL,+ count INTEGER NOT NULL+ );+ """+ )+ try:+ os.chmod(self.db_path, 0o600)+ os.chmod(self.db_path.parent, 0o700)+ except FileNotFoundError: # pragma: no cover - dropped concurrently+ pass++ def _cleanup(self, connection: sqlite3.Connection, now: int) -> None:+ connection.execute(+ "DELETE FROM handoff_records WHERE expires_at + ? < ?",+ (STATE_RETENTION_SECONDS, now),+ )+ connection.execute(+ "DELETE FROM handoff_rate_limits WHERE window_start + 3600 < ?",+ (now,),+ )++ @staticmethod+ def _check_rate(+ connection: sqlite3.Connection,+ bucket: str,+ limit: tuple[int, int],+ now: int,+ ) -> None:+ count, window_seconds = limit+ window_start = now - (now % window_seconds)+ connection.execute("BEGIN IMMEDIATE")+ try:+ connection.execute(+ """+ INSERT INTO handoff_rate_limits(bucket, window_start, count)+ VALUES (?, ?, 0)+ ON CONFLICT(bucket) DO UPDATE SET+ window_start=excluded.window_start,+ count=CASE+ WHEN handoff_rate_limits.window_start != excluded.window_start+ THEN 0 ELSE handoff_rate_limits.count+ END+ """,+ (bucket, window_start),+ )+ connection.execute(+ "UPDATE handoff_rate_limits SET count=count+1 WHERE bucket=?",+ (bucket,),+ )+ row = connection.execute(+ "SELECT count FROM handoff_rate_limits WHERE bucket=?",+ (bucket,),+ ).fetchone()+ connection.commit()+ except Exception:+ connection.rollback()+ raise+ if int(row["count"]) > count:+ raise HandoffRateLimited("Too many handoff requests")++ def _rate_limit(+ self,+ bucket: str,+ limit: tuple[int, int],+ *,+ now: int | None,+ ) -> None:+ current = int(time.time() if now is None else now)+ with self._connect() as connection:+ self._initialize(connection)+ self._check_rate(connection, bucket, limit, current)++ def create(+ self,+ *,+ encrypted_ticket: str,+ ticket_hash: str,+ public_host: str,+ now: int | None = None,+ code_lifetime: int = CODE_LIFETIME_SECONDS,+ rate_key: str = "unknown",+ ) -> HandoffRecord:+ current = int(time.time() if now is None else now)+ self._rate_limit(f"create:{rate_key}", CREATE_RATE_LIMIT, now=now)+ code = secrets.token_urlsafe(32)+ expires_at = current + code_lifetime+ with self._connect() as connection:+ self._initialize(connection)+ connection.execute("BEGIN IMMEDIATE")+ try:+ self._cleanup(connection, current)+ connection.execute(+ """+ INSERT INTO handoff_records(+ code_hash, ticket_hash, encrypted_ticket, public_host,+ expires_at, created_at+ ) VALUES (?, ?, ?, ?, ?, ?)+ """,+ (+ hash_secret(code),+ ticket_hash,+ encrypted_ticket,+ public_host,+ expires_at,+ current,+ ),+ )+ connection.commit()+ except Exception:+ connection.rollback()+ raise+ return HandoffRecord(code, encrypted_ticket, public_host, expires_at)++ def exchange(+ self,+ *,+ code: str,+ public_host: str,+ now: int | None = None,+ ) -> str:+ current = int(time.time() if now is None else now)+ self._rate_limit(f"exchange:{public_host}", EXCHANGE_RATE_LIMIT, now=now)+ self._rate_limit("exchange:global", GLOBAL_EXCHANGE_RATE_LIMIT, now=now)+ code_hash = hash_secret(code)+ with self._connect() as connection:+ self._initialize(connection)+ connection.execute("BEGIN IMMEDIATE")+ try:+ self._cleanup(connection, current)+ row = connection.execute(+ """+ SELECT encrypted_ticket, public_host, expires_at,+ code_consumed_at, failed_attempts+ FROM handoff_records WHERE code_hash=?+ """,+ (code_hash,),+ ).fetchone()+ if row is None:+ connection.commit()+ raise HandoffRejected("Invalid pairing code")+ if row["code_consumed_at"] is not None:+ connection.commit()+ raise HandoffRejected("Invalid pairing code")+ if row["expires_at"] <= current:+ connection.execute(+ "DELETE FROM handoff_records WHERE code_hash=?", (code_hash,)+ )+ connection.commit()+ raise HandoffRejected("Invalid pairing code")+ if row["public_host"] != public_host:+ attempts = int(row["failed_attempts"]) + 1+ if attempts >= MAX_CODE_ATTEMPTS:+ connection.execute(+ "DELETE FROM handoff_records WHERE code_hash=?", (code_hash,)+ )+ else:+ connection.execute(+ "UPDATE handoff_records SET failed_attempts=? WHERE code_hash=?",+ (attempts, code_hash),+ )+ connection.commit()+ raise HandoffRejected("Pairing code is not valid for this site")+ connection.execute(+ """+ UPDATE handoff_records+ SET code_consumed_at=?, failed_attempts=0+ WHERE code_hash=? AND code_consumed_at IS NULL+ """,+ (current, code_hash),+ )+ connection.commit()+ except HandoffError:+ connection.rollback()+ raise+ except Exception:+ connection.rollback()+ raise+ return str(row["encrypted_ticket"])++ def consume_ticket(+ self,+ *,+ ticket: str,+ public_host: str,+ now: int | None = None,+ ) -> str:+ current = int(time.time() if now is None else now)+ self._rate_limit(f"complete:{public_host}", COMPLETE_RATE_LIMIT, now=now)+ ticket_hash = hash_secret(ticket)+ with self._connect() as connection:+ self._initialize(connection)+ connection.execute("BEGIN IMMEDIATE")+ try:+ self._cleanup(connection, current)+ row = connection.execute(+ """+ SELECT encrypted_ticket, public_host, expires_at,+ ticket_consumed_at, code_consumed_at+ FROM handoff_records WHERE ticket_hash=?+ """,+ (ticket_hash,),+ ).fetchone()+ if (+ row is None+ or row["ticket_consumed_at"] is not None+ or row["code_consumed_at"] is None+ or row["expires_at"] + TICKET_LIFETIME_SECONDS <= current+ ):+ if row is not None:+ connection.execute(+ "DELETE FROM handoff_records WHERE ticket_hash=?",+ (ticket_hash,),+ )+ connection.commit()+ raise HandoffRejected("Invalid handoff ticket")+ if row["public_host"] != public_host:+ connection.commit()+ raise HandoffRejected("Handoff ticket is not valid for this site")+ if str(row["encrypted_ticket"]) != ticket:+ connection.commit()+ raise HandoffRejected("Invalid handoff ticket")+ connection.execute(+ """+ UPDATE handoff_records+ SET ticket_consumed_at=?+ WHERE ticket_hash=? AND ticket_consumed_at IS NULL+ """,+ (current, ticket_hash),+ )+ connection.commit()+ except HandoffError:+ connection.rollback()+ raise+ except Exception:+ connection.rollback()+ raise+ return ticket+++_DEFAULT_STORE: SessionHandoffStore | None = None+++def get_session_handoff_store() -> SessionHandoffStore:+ global _DEFAULT_STORE+ if _DEFAULT_STORE is None:+ _DEFAULT_STORE = SessionHandoffStore()+ return _DEFAULT_STORE+++def reset_session_handoff_store_for_tests() -> None:+ global _DEFAULT_STORE+ _DEFAULT_STORE = Nonediff --git a/deeptutor/services/config/runtime_settings.py b/deeptutor/services/config/runtime_settings.pyindex 09900a4bc..dbe087864 100644--- a/deeptutor/services/config/runtime_settings.py+++ b/deeptutor/services/config/runtime_settings.py@@ -84,6 +84,7 @@ DEFAULT_AUTH_SETTINGS: dict[str, Any] = {"password_hash": "","token_expire_hours": 24,"cookie_secure": False,+ "private_login_hosts": [],}DEFAULT_INTEGRATIONS_SETTINGS: dict[str, Any] = {@@ -424,6 +425,17 @@ def _string(value: Any) -> str:return "" if value is None else str(value).strip()+def _host_list(value: Any) -> list[str]:+ if isinstance(value, list):+ return [item for raw in value if (item := _string(raw).lower().rstrip("."))]+ raw = _string(value)+ return [+ item+ for piece in raw.replace(";", ",").split(",")+ if (item := piece.strip().lower().rstrip("."))+ ]++def _string_or_list(value: Any) -> str | list[str]:if isinstance(value, list):return [item for raw in value if (item := _string(raw))]@@ -674,6 +686,7 @@ class RuntimeSettingsService:"AUTH_PASSWORD_HASH": auth["password_hash"],"AUTH_TOKEN_EXPIRE_HOURS": str(auth["token_expire_hours"]),"AUTH_COOKIE_SECURE": _bool_env(auth["cookie_secure"]),+ "AUTH_PRIVATE_LOGIN_HOSTS": ",".join(auth["private_login_hosts"]),"NEXT_PUBLIC_AUTH_ENABLED": _bool_env(auth["enabled"]),# Consumed server-side by the Next.js middleware (web/proxy.ts) at# request time — NOT inlined into the browser bundle. The proxy@@ -824,6 +837,8 @@ class RuntimeSettingsService:payload["token_expire_hours"] = valueif value := self._process_env_value("AUTH_COOKIE_SECURE"):payload["cookie_secure"] = value+ if value := self._process_env_value("AUTH_PRIVATE_LOGIN_HOSTS"):+ payload["private_login_hosts"] = valuereturn self._normalize_auth(payload)def _apply_integrations_process_overrides(self, settings: dict[str, Any]) -> dict[str, Any]:@@ -1210,6 +1225,7 @@ class RuntimeSettingsService:"password_hash": _string(settings.get("password_hash")),"token_expire_hours": max(1, _coerce_int(settings.get("token_expire_hours"), 24)),"cookie_secure": _coerce_bool(settings.get("cookie_secure"), False),+ "private_login_hosts": _host_list(settings.get("private_login_hosts")),}def _normalize_integrations(self, settings: dict[str, Any]) -> dict[str, Any]:diff --git a/tests/api/test_session_handoff.py b/tests/api/test_session_handoff.pynew file mode 100644index 000000000..b1130f7a4--- /dev/null+++ b/tests/api/test_session_handoff.py@@ -0,0 +1,210 @@+"""HTTP regression tests for the private-to-public auth handoff."""++from __future__ import annotations++from pathlib import Path+import sqlite3++from fastapi import FastAPI+from fastapi.testclient import TestClient++from deeptutor.api.routers import auth as auth_router+from deeptutor.multi_user import session_handoff+from deeptutor.services import auth as auth_service+++def _handoff_client(+ tmp_path: Path,+ monkeypatch,+ *,+ pocketbase: bool = False,+) -> tuple[TestClient, str]:+ state_root = tmp_path / "state"+ monkeypatch.setattr(session_handoff, "AUTH_DIR", state_root / "auth")+ monkeypatch.setattr(session_handoff, "_DEFAULT_STORE", None)+ monkeypatch.setattr(session_handoff, "load_or_create_auth_secret", lambda: "test-secret")++ monkeypatch.setattr(auth_service, "AUTH_ENABLED", True)+ monkeypatch.setattr(auth_service, "AUTH_SECRET", "test-secret")+ monkeypatch.setattr(auth_service, "TOKEN_EXPIRE_HOURS", 24)+ monkeypatch.setattr(auth_router, "AUTH_ENABLED", True)+ monkeypatch.setattr(auth_router, "POCKETBASE_ENABLED", pocketbase)+ monkeypatch.setattr(auth_router, "PRIVATE_LOGIN_HOSTS", frozenset({"private.example:8443"}))++ if pocketbase:+ monkeypatch.setattr(+ auth_router,+ "decode_token",+ lambda _token: auth_service.TokenPayload(+ username="[email protected]", role="user", user_id="pb-user"+ ),+ )+ bearer = "pb-bearer-token-that-must-not-persist"+ else:+ bearer = auth_service.create_token("alice", "user", "u-alice")++ app = FastAPI()+ app.include_router(auth_router.router, prefix="/api/auth")+ return TestClient(app), bearer+++def test_private_create_public_exchange_and_complete(tmp_path, monkeypatch) -> None:+ client, bearer = _handoff_client(tmp_path, monkeypatch)+ monkeypatch.setattr(auth_router, "_SECURE", True)+ monkeypatch.setattr(auth_router, "_SAMESITE", "none")++ created = client.post(+ "/api/auth/session-handoff",+ headers={+ "x-deeptutor-frontend-host": "private.example:8443",+ "Authorization": f"Bearer {bearer}",+ },+ json={"public_origin": "https://app.example"},+ )+ assert created.status_code == 200+ assert created.headers["cache-control"] == "no-store"+ body = created.json()+ assert body["handoff_url"] == f"https://app.example/handoff?code={body['code']}"++ exchanged = client.post(+ "/api/auth/session-handoff/exchange",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"code": body["code"]},+ )+ assert exchanged.status_code == 200+ assert exchanged.headers["cache-control"] == "no-store"+ ticket = exchanged.json()["ticket"]++ completed = client.post(+ "/api/auth/session-handoff/complete",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"ticket": ticket},+ )+ assert completed.status_code == 200+ cookie = completed.headers["set-cookie"]+ assert "httponly" in cookie.lower()+ assert "secure" in cookie.lower()+ assert "samesite=none" in cookie.lower()+ session = auth_service.decode_token(+ completed.cookies.get("dt_token", ""),+ )+ assert session is not None+ assert (session.username, session.role, session.user_id) == ("alice", "user", "u-alice")++ replayed = client.post(+ "/api/auth/session-handoff/complete",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"ticket": ticket},+ )+ assert replayed.status_code == 400+++def test_codes_and_tickets_reject_mismatched_frontend_hosts(tmp_path, monkeypatch) -> None:+ client, bearer = _handoff_client(tmp_path, monkeypatch)+ created = client.post(+ "/api/auth/session-handoff",+ headers={+ "x-deeptutor-frontend-host": "private.example:8443",+ "Authorization": f"Bearer {bearer}",+ },+ json={"public_origin": "https://app.example"},+ ).json()++ assert (+ client.post(+ "/api/auth/session-handoff/exchange",+ headers={"x-deeptutor-frontend-host": "attacker.example"},+ json={"code": created["code"]},+ ).status_code+ == 400+ )+ exchanged = client.post(+ "/api/auth/session-handoff/exchange",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"code": created["code"]},+ )+ assert exchanged.status_code == 200+ assert (+ client.post(+ "/api/auth/session-handoff/complete",+ headers={"x-deeptutor-frontend-host": "attacker.example"},+ json={"ticket": exchanged.json()["ticket"]},+ ).status_code+ == 400+ )+++def test_malformed_frontend_host_is_rejected_without_server_error(tmp_path, monkeypatch) -> None:+ client, _ = _handoff_client(tmp_path, monkeypatch)++ exchange = client.post(+ "/api/auth/session-handoff/exchange",+ headers={"x-deeptutor-frontend-host": "app.example:not-a-port"},+ json={"code": "1234567890abcdef"},+ )+ complete = client.post(+ "/api/auth/session-handoff/complete",+ headers={"x-deeptutor-frontend-host": "app.example:not-a-port"},+ json={"ticket": "x" * 32},+ )++ assert exchange.status_code == 400+ assert complete.status_code == 400+++def test_pocketbase_bearer_is_jwe_wrapped_and_cookie_is_http_only(tmp_path, monkeypatch) -> None:+ client, bearer = _handoff_client(tmp_path, monkeypatch, pocketbase=True)+ monkeypatch.setattr(auth_router, "_SECURE", True)+ monkeypatch.setattr(auth_router, "_SAMESITE", "none")++ created = client.post(+ "/api/auth/session-handoff",+ headers={"x-deeptutor-frontend-host": "private.example:8443"},+ cookies={"dt_token": bearer},+ json={"public_origin": "https://app.example"},+ ).json()+ ticket = client.post(+ "/api/auth/session-handoff/exchange",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"code": created["code"]},+ ).json()["ticket"]+ completed = client.post(+ "/api/auth/session-handoff/complete",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"ticket": ticket},+ )++ assert completed.status_code == 200+ assert completed.cookies.get("dt_token") == bearer+ assert "httponly" in completed.headers["set-cookie"].lower()++ connection = sqlite3.connect(tmp_path / "state" / "auth" / "session_handoff.sqlite3")+ persisted = " ".join(+ str(value) for row in connection.execute("SELECT * FROM handoff_records") for value in row+ )+ connection.close()+ assert bearer not in persisted+++def test_private_login_host_policy_gates_password_login(tmp_path, monkeypatch) -> None:+ _, bearer = _handoff_client(tmp_path, monkeypatch)+ payload = auth_service.TokenPayload(username="alice", role="user", user_id="u-alice")+ monkeypatch.setattr(auth_router, "authenticate", lambda _username, _password: payload)+ monkeypatch.setattr(auth_router, "create_token", lambda *_args, **_kwargs: bearer)++ app = FastAPI()+ app.add_api_route("/login", auth_router.login, methods=["POST"])+ with TestClient(app) as client:+ refused = client.post(+ "/login",+ headers={"x-deeptutor-frontend-host": "app.example"},+ json={"username": "alice", "password": "password123"},+ )+ allowed = client.post(+ "/login",+ headers={"x-deeptutor-frontend-host": "127.0.0.1:8001"},+ json={"username": "alice", "password": "password123"},+ )++ assert refused.status_code == 403+ assert allowed.status_code == 200diff --git a/tests/multi_user/test_session_handoff.py b/tests/multi_user/test_session_handoff.pynew file mode 100644index 000000000..aed67a9bf--- /dev/null+++ b/tests/multi_user/test_session_handoff.py@@ -0,0 +1,111 @@+"""Security state regression tests for public session handoff."""++from __future__ import annotations++import sqlite3++import pytest++from deeptutor.multi_user import session_handoff+++def test_public_origin_is_https_and_host_bound() -> None:+ assert session_handoff.public_origin("https://APP.example/") == "https://app.example"+ assert session_handoff.public_origin("https://app.example:8443") == "https://app.example:8443"++ for raw in (+ "http://app.example",+ "https://app.example/chat",+ "https://[email protected]",+ "https://127.0.0.1",+ "https://192.168.1.10",+ "https://localhost",+ ):+ with pytest.raises(session_handoff.HandoffError):+ session_handoff.public_origin(raw)+++def test_handoff_code_and_ticket_are_single_use(tmp_path) -> None:+ store = session_handoff.SessionHandoffStore(tmp_path / "handoff.sqlite3")+ ticket = session_handoff.encrypt_ticket_payload(+ {"mode": "builtin", "host": "app.example", "exp": 220},+ secret="test-secret",+ )+ record = store.create(+ encrypted_ticket=ticket,+ ticket_hash=session_handoff.hash_secret(ticket),+ public_host="app.example",+ now=100,+ )++ with pytest.raises(session_handoff.HandoffRejected):+ store.exchange(code=record.code, public_host="other.example", now=101)+ assert store.exchange(code=record.code, public_host="app.example", now=102) == ticket+ with pytest.raises(session_handoff.HandoffRejected):+ store.exchange(code=record.code, public_host="app.example", now=103)++ with pytest.raises(session_handoff.HandoffRejected):+ store.consume_ticket(ticket=ticket, public_host="other.example", now=104)+ assert store.consume_ticket(ticket=ticket, public_host="app.example", now=105) == ticket+ with pytest.raises(session_handoff.HandoffRejected):+ store.consume_ticket(ticket=ticket, public_host="app.example", now=106)+++def test_expired_code_is_rejected_and_rate_limited(tmp_path, monkeypatch) -> None:+ store = session_handoff.SessionHandoffStore(tmp_path / "handoff.sqlite3")+ ticket = session_handoff.encrypt_ticket_payload(+ {"mode": "builtin", "host": "app.example", "exp": 150},+ secret="test-secret",+ )+ record = store.create(+ encrypted_ticket=ticket,+ ticket_hash=session_handoff.hash_secret(ticket),+ public_host="app.example",+ now=100,+ code_lifetime=100,+ )+ with pytest.raises(session_handoff.HandoffRejected):+ store.exchange(code=record.code, public_host="app.example", now=201)++ monkeypatch.setattr(session_handoff, "CREATE_RATE_LIMIT", (1, 60))+ limited = session_handoff.SessionHandoffStore(tmp_path / "limited.sqlite3")+ ticket = session_handoff.encrypt_ticket_payload({}, secret="test-secret")+ limited.create(+ encrypted_ticket=ticket,+ ticket_hash=session_handoff.hash_secret(ticket),+ public_host="app.example",+ now=300,+ rate_key="alice",+ )+ with pytest.raises(session_handoff.HandoffRateLimited):+ limited.create(+ encrypted_ticket=ticket + "different",+ ticket_hash=session_handoff.hash_secret(ticket + "different"),+ public_host="app.example",+ now=301,+ rate_key="alice",+ )+++def test_database_never_stores_plaintext_code_ticket_or_bearer(tmp_path) -> None:+ store = session_handoff.SessionHandoffStore(tmp_path / "handoff.sqlite3")+ bearer = "pb-bearer-token-that-must-not-persist"+ ticket = session_handoff.encrypt_ticket_payload(+ {"mode": "pocketbase", "token": bearer, "host": "app.example", "exp": 220},+ secret="test-secret",+ )+ record = store.create(+ encrypted_ticket=ticket,+ ticket_hash=session_handoff.hash_secret(ticket),+ public_host="app.example",+ now=100,+ )++ connection = sqlite3.connect(store.db_path)+ persisted = " ".join(+ str(value) for row in connection.execute("SELECT * FROM handoff_records") for value in row+ )+ connection.close()++ assert record.code not in persisted+ assert bearer not in persisteddiff --git a/tests/services/config/test_runtime_settings.py b/tests/services/config/test_runtime_settings.pyindex 1be4f9de4..5e839488b 100644--- a/tests/services/config/test_runtime_settings.py+++ b/tests/services/config/test_runtime_settings.py@@ -26,6 +26,7 @@ RUNTIME_ENV_KEYS = ("AUTH_PASSWORD_HASH","AUTH_TOKEN_EXPIRE_HOURS","AUTH_COOKIE_SECURE",+ "AUTH_PRIVATE_LOGIN_HOSTS","POCKETBASE_URL","POCKETBASE_PORT","POCKETBASE_EXTERNAL_URL",@@ -54,6 +55,7 @@ def test_runtime_settings_creates_defaults_without_reading_dotenv(tmp_path: Pathassert service.load_system(include_process_overrides=False)["backend_port"] == 8001assert service.load_system(include_process_overrides=False)["version_check_enabled"] is Trueassert service.load_auth(include_process_overrides=False)["enabled"] is False+ assert service.load_auth(include_process_overrides=False)["private_login_hosts"] == []assert service.load_integrations(include_process_overrides=False)["pocketbase_url"] == ""assert _read_json(service.path_for("system"))["backend_port"] == 8001@@ -117,6 +119,7 @@ def test_runtime_process_env_is_explicit_override(tmp_path: Path) -> None:assert service.load_system()["backend_port"] == 9100assert service.load_system()["version_check_enabled"] is Falseassert service.load_auth()["enabled"] is True+ assert service.load_auth()["private_login_hosts"] == []assert service.load_integrations()["pocketbase_port"] == 9090assert _read_json(service.path_for("system"))["backend_port"] == 8001assert _read_json(service.path_for("auth"))["enabled"] is False@@ -134,7 +137,14 @@ def test_render_environment_uses_json_backed_runtime_names(monkeypatch, tmp_path"disable_ssl_verify": True,})- service.save_auth({"enabled": True, "username": "admin", "token_expire_hours": 12})+ service.save_auth(+ {+ "enabled": True,+ "username": "admin",+ "token_expire_hours": 12,+ "private_login_hosts": ["Private.Example", "tailnet.example:8443", ""],+ }+ )service.save_integrations({"pocketbase_url": "http://pocketbase:8090",@@ -150,6 +160,11 @@ def test_render_environment_uses_json_backed_runtime_names(monkeypatch, tmp_pathassert env["CORS_ORIGINS"] == "https://app.example"assert env["DISABLE_SSL_VERIFY"] == "true"assert env["AUTH_ENABLED"] == "true"+ assert service.load_auth()["private_login_hosts"] == [+ "private.example",+ "tailnet.example:8443",+ ]+ assert env["AUTH_PRIVATE_LOGIN_HOSTS"] == "private.example,tailnet.example:8443"assert env["NEXT_PUBLIC_AUTH_ENABLED"] == "true"# Server-side proxy contract consumed by web/proxy.ts (the Next.js# middleware). DEEPTUTOR_AUTH_ENABLED gates the login redirect;@@ -566,6 +581,20 @@ def test_runtime_settings_can_ignore_process_overrides(tmp_path: Path) -> None:assert service.load_auth()["enabled"] is False+def test_auth_private_login_hosts_process_env_override(tmp_path: Path) -> None:+ service = RuntimeSettingsService(+ tmp_path / "settings",+ process_env={"AUTH_PRIVATE_LOGIN_HOSTS": "Private.Example;tailnet.example:8443"},+ )+ service.save_auth({"private_login_hosts": ["unused.example"]})++ assert service.load_auth()["private_login_hosts"] == [+ "private.example",+ "tailnet.example:8443",+ ]+ assert _read_json(service.path_for("auth"))["private_login_hosts"] == ["unused.example"]++def test_chat_attachment_limits_defaults_and_clamping(tmp_path: Path) -> None:service = RuntimeSettingsService(tmp_path / "settings", process_env={})system = service.load_system()diff --git a/web/app/(utility)/profile/page.tsx b/web/app/(utility)/profile/page.tsxindex 03ea668d4..903d4e43d 100644--- a/web/app/(utility)/profile/page.tsx+++ b/web/app/(utility)/profile/page.tsx@@ -4,7 +4,7 @@ import { useCallback, useEffect, useRef, useState } from "react";import Link from "next/link";import { useRouter } from "next/navigation";import { createElement } from "react";-import { ArrowLeft, ImageUp, LogOut, ShieldCheck, Trash2 } from "lucide-react";+import { ArrowLeft, ImageUp, KeyRound, LogOut, ShieldCheck, Trash2 } from "lucide-react";import { useTranslation } from "react-i18next";import { fetchAuthStatus, logout } from "@/lib/auth";import {@@ -272,6 +272,13 @@ export default function ProfilePage() {)}</div></div>+ <Link+ href="/session-handoff"+ className="mt-5 inline-flex items-center gap-1.5 rounded-lg border border-[var(--border)] px-3 py-1.5 text-sm text-[var(--foreground)] transition-colors hover:bg-[var(--background)]/60"+ >+ <KeyRound size={14} />+ {t("Public device sign-in")}+ </Link></div>{/* Avatar card */}diff --git a/web/app/(utility)/session-handoff/page.tsx b/web/app/(utility)/session-handoff/page.tsxnew file mode 100644index 000000000..3bc88e125--- /dev/null+++ b/web/app/(utility)/session-handoff/page.tsx@@ -0,0 +1,139 @@+"use client";++import { useCallback, useEffect, useState } from "react";+import Link from "next/link";+import { useRouter } from "next/navigation";+import { ArrowLeft, ClipboardCopy, KeyRound, Link2 } from "lucide-react";+import { useTranslation } from "react-i18next";+import { fetchAuthStatus } from "@/lib/auth";+import { copyText } from "@/lib/clipboard";+import { createSessionHandoff, type SessionHandoff } from "@/lib/session-handoff-api";++export default function SessionHandoffPage() {+ const router = useRouter();+ const { t } = useTranslation();+ const [publicOrigin, setPublicOrigin] = useState("https://");+ const [handoff, setHandoff] = useState<SessionHandoff | null>(null);+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState("");+ const [copied, setCopied] = useState(false);++ useEffect(() => {+ let cancelled = false;+ void fetchAuthStatus().then((status) => {+ if (cancelled) return;+ if (!status?.enabled || !status.authenticated) router.replace("/login");+ });+ return () => {+ cancelled = true;+ };+ }, [router]);++ const submit = useCallback(async () => {+ setLoading(true);+ setError("");+ setCopied(false);+ try {+ setHandoff(await createSessionHandoff(publicOrigin.trim()));+ } catch (err) {+ setHandoff(null);+ setError(err instanceof Error ? err.message : String(err));+ } finally {+ setLoading(false);+ }+ }, [publicOrigin]);++ const copy = useCallback(async () => {+ if (!handoff) return;+ try {+ await copyText(handoff.handoff_url);+ setCopied(true);+ } catch (err) {+ setError(err instanceof Error ? err.message : String(err));+ }+ }, [handoff]);++ return (+ <div className="min-h-screen bg-[var(--background)] px-4 py-10">+ <div className="mx-auto max-w-xl">+ <Link+ href="/profile"+ className="mb-4 inline-flex items-center gap-1.5 text-sm text-[var(--muted-foreground)] transition-colors hover:text-[var(--foreground)]"+ >+ <ArrowLeft size={16} />+ {t("Back")}+ </Link>+ <div className="rounded-2xl border border-[var(--border)] bg-[var(--card)] p-6 shadow-sm">+ <div className="flex items-center gap-2.5">+ <KeyRound size={18} className="text-[var(--primary)]" />+ <h1 className="text-lg font-semibold text-[var(--foreground)]">+ {t("Public device sign-in")}+ </h1>+ </div>+ <form+ className="mt-5 space-y-3"+ onSubmit={(event) => {+ event.preventDefault();+ void submit();+ }}+ >+ <label+ htmlFor="public-origin"+ className="block text-sm font-medium text-[var(--foreground)]"+ >+ {t("Public HTTPS origin")}+ </label>+ <div className="flex flex-col gap-2 sm:flex-row">+ <input+ id="public-origin"+ value={publicOrigin}+ onChange={(event) => setPublicOrigin(event.target.value)}+ inputMode="url"+ autoComplete="url"+ spellCheck={false}+ className="min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--background)] px-3 py-2 text-sm text-[var(--foreground)] outline-none focus:ring-2 focus:ring-[var(--primary)]"+ />+ <button+ type="submit"+ disabled={loading}+ className="inline-flex items-center justify-center gap-1.5 rounded-lg bg-[var(--primary)] px-3.5 py-2 text-sm font-medium text-[var(--primary-foreground)] transition-opacity disabled:opacity-50"+ >+ <Link2 size={14} />+ {loading ? t("Creating…") : t("Create link")}+ </button>+ </div>+ </form>+ {error && (+ <p className="mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400">+ {error}+ </p>+ )}+ {handoff && (+ <div className="mt-5 rounded-xl border border-[var(--border)] bg-[var(--background)] p-4">+ <div className="flex flex-wrap items-center justify-between gap-3">+ <span className="font-mono text-sm break-all text-[var(--foreground)]">+ {handoff.code}+ </span>+ <button+ type="button"+ onClick={() => void copy()}+ title={t("Copy link")}+ className="inline-flex items-center gap-1.5 rounded-lg border border-[var(--border)] px-2.5 py-1.5 text-xs text-[var(--foreground)] transition-colors hover:bg-[var(--card)]"+ >+ <ClipboardCopy size={14} />+ {copied ? t("Copied") : t("Copy")}+ </button>+ </div>+ <p className="mt-3 break-all text-sm text-[var(--muted-foreground)]">+ {handoff.handoff_url}+ </p>+ <p className="mt-2 text-xs text-[var(--muted-foreground)]">+ {t("Expires in {{seconds}} seconds", { seconds: handoff.expires_in })}+ </p>+ </div>+ )}+ </div>+ </div>+ </div>+ );+}diff --git a/web/app/handoff/page.tsx b/web/app/handoff/page.tsxnew file mode 100644index 000000000..1b1dbf9ee--- /dev/null+++ b/web/app/handoff/page.tsx@@ -0,0 +1,109 @@+"use client";++import { Suspense, useCallback, useEffect, useRef, useState } from "react";+import { useRouter, useSearchParams } from "next/navigation";+import { KeyRound } from "lucide-react";+import { useTranslation } from "react-i18next";+import { normalizeInternalReturnPath } from "@/shared/auth/return-url";+import {+ completeSessionHandoff,+ exchangeSessionHandoff,+} from "@/lib/session-handoff-api";++function HandoffPageContent() {+ const router = useRouter();+ const searchParams = useSearchParams();+ const { t } = useTranslation();+ const next = normalizeInternalReturnPath(searchParams.get("next"));+ const [manualCode, setManualCode] = useState("");+ const [status, setStatus] = useState<"idle" | "working" | "error">("idle");+ const [error, setError] = useState("");+ const started = useRef(false);++ const finish = useCallback(+ async (code: string) => {+ setStatus("working");+ setError("");+ try {+ const ticket = await exchangeSessionHandoff(code.trim());+ await completeSessionHandoff(ticket);+ router.replace(next);+ } catch (err) {+ setStatus("error");+ setError(err instanceof Error ? err.message : String(err));+ }+ },+ [next, router],+ );++ useEffect(() => {+ const code = searchParams.get("code")?.trim() ?? "";+ window.history.replaceState(null, "", window.location.pathname);+ if (!code || started.current) return;+ started.current = true;+ const timer = window.setTimeout(() => {+ void finish(code);+ }, 0);+ return () => window.clearTimeout(timer);+ }, [finish, searchParams]);++ return (+ <main className="flex min-h-screen items-center justify-center bg-[var(--background)] px-4">+ <div className="w-full max-w-sm rounded-2xl border border-[var(--border)] bg-[var(--card)] p-7 shadow-sm">+ <div className="flex items-center gap-2.5">+ <KeyRound size={18} className="text-[var(--primary)]" />+ <h1 className="text-lg font-semibold text-[var(--foreground)]">+ {t("Public device sign-in")}+ </h1>+ </div>+ {status === "working" ? (+ <p className="mt-4 text-sm text-[var(--muted-foreground)]">+ {t("Completing sign-in…")}+ </p>+ ) : (+ <form+ className="mt-5 space-y-3"+ onSubmit={(event) => {+ event.preventDefault();+ void finish(manualCode);+ }}+ >+ <label+ htmlFor="handoff-code"+ className="block text-sm font-medium text-[var(--foreground)]"+ >+ {t("Pairing code")}+ </label>+ <input+ id="handoff-code"+ value={manualCode}+ onChange={(event) => setManualCode(event.target.value)}+ autoComplete="one-time-code"+ spellCheck={false}+ className="w-full rounded-lg border border-[var(--border)] bg-[var(--background)] px-3 py-2 font-mono text-sm text-[var(--foreground)] outline-none focus:ring-2 focus:ring-[var(--primary)]"+ />+ <button+ type="submit"+ className="w-full rounded-lg bg-[var(--primary)] px-3.5 py-2 text-sm font-medium text-[var(--primary-foreground)] transition-opacity hover:opacity-90"+ >+ {t("Continue")}+ </button>+ </form>+ )}+ {status === "error" && (+ <p className="mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400">+ {error}+ </p>+ )}+ </div>+ </main>+ );+}++export default function HandoffPage() {+ return (+ <Suspense fallback={null}>+ <HandoffPageContent />+ </Suspense>+ );+}diff --git a/web/contracts/generated/api.ts b/web/contracts/generated/api.tsindex 4e0342db5..c1183bfe7 100644--- a/web/contracts/generated/api.ts+++ b/web/contracts/generated/api.ts@@ -357,6 +357,66 @@ export interface paths {readonly patch?: never;readonly trace?: never;};+ readonly "/api/auth/session-handoff": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly get?: never;+ readonly put?: never;+ /**+ * Create Session Handoff+ * @description Create a host-bound, one-time pairing code from the private origin.+ */+ readonly post: operations["create_session_handoff_api_auth_session_handoff_post"];+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/api/auth/session-handoff/complete": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly get?: never;+ readonly put?: never;+ /**+ * Complete Session Handoff+ * @description Consume a ticket once and issue the normal HttpOnly session cookie.+ */+ readonly post: operations["complete_session_handoff_api_auth_session_handoff_complete_post"];+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/api/auth/session-handoff/exchange": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly get?: never;+ readonly put?: never;+ /**+ * Exchange Session Handoff+ * @description Consume a pairing code and return a short-lived ticket in the response body.+ */+ readonly post: operations["exchange_session_handoff_api_auth_session_handoff_exchange_post"];+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };readonly "/api/auth/status": {readonly parameters: {readonly query?: never;@@ -6397,6 +6457,23 @@ export interface paths {readonly patch: operations["update_session_organization_api_sessions__session_id__organization_patch"];readonly trace?: never;};+ readonly "/api/sessions/{session_id}/purge": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly get?: never;+ readonly put?: never;+ readonly post?: never;+ /** Purge Session */+ readonly delete: operations["purge_session_api_sessions__session_id__purge_delete"];+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };readonly "/api/sessions/{session_id}/quiz-results": {readonly parameters: {readonly query?: never;@@ -6414,6 +6491,40 @@ export interface paths {readonly patch?: never;readonly trace?: never;};+ readonly "/api/sessions/{session_id}/restore": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly get?: never;+ readonly put?: never;+ /** Restore Session */+ readonly post: operations["restore_session_api_sessions__session_id__restore_post"];+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/api/sessions/recycle-bin": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ /** List Recycle Bin */+ readonly get: operations["list_recycle_bin_api_sessions_recycle_bin_get"];+ readonly put?: never;+ readonly post?: never;+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };readonly "/api/sessions/search": {readonly parameters: {readonly query?: never;@@ -8893,6 +9004,122 @@ export interface paths {readonly patch?: never;readonly trace?: never;};+ readonly "/files/library/": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ /**+ * List Library Files+ * @description List active library entries, newest first.+ */+ readonly get: operations["library_list"];+ readonly put?: never;+ /**+ * Add Library File+ * @description Add a file to the library.+ *+ * The request must be ``multipart/form-data`` with a ``file`` field containing+ * the raw bytes. If a file with the same SHA-256 content hash already exists+ * in the library, returns the existing entry (deduplication).+ */+ readonly post: operations["library_add"];+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/files/library/{file_id}": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ /**+ * Get Library File+ * @description Get a single library entry by id (includes soft-deleted).+ */+ readonly get: operations["library_get"];+ readonly put?: never;+ readonly post?: never;+ /**+ * Delete Library File+ * @description Soft-delete a library file (sets is_deleted=1).+ */+ readonly delete: operations["library_delete"];+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/files/library/{file_id}/download": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ /**+ * Download Library File+ * @description Download a library file by id.+ */+ readonly get: operations["library_download"];+ readonly put?: never;+ readonly post?: never;+ readonly delete?: never;+ readonly options?: never;+ /**+ * Download Library File Head+ * @description Check whether a library file exists (HEAD only).+ */+ readonly head: operations["library_download_head"];+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/files/library/{file_id}/restore": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly get?: never;+ readonly put?: never;+ /**+ * Restore Library File+ * @description Restore a soft-deleted library file.+ */+ readonly post: operations["library_restore"];+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };+ readonly "/files/library/search": {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ /**+ * Search Library Files+ * @description Search library entries by filename (case-insensitive substring).+ */+ readonly get: operations["library_search"];+ readonly put?: never;+ readonly post?: never;+ readonly delete?: never;+ readonly options?: never;+ readonly head?: never;+ readonly patch?: never;+ readonly trace?: never;+ };readonly "/files/outputs/{output_path}": {readonly parameters: {readonly query?: never;@@ -9382,6 +9609,24 @@ export interface components {/** File */readonly file: string;};+ /** Body_library_add */+ readonly Body_library_add: {+ /**+ * File+ * @description Raw file bytes+ */+ readonly file: string;+ /**+ * Filename+ * @description Original filename+ */+ readonly filename: string;+ /**+ * Mime Type+ * @default+ */+ readonly mime_type: string;+ };/** Body_reindex_knowledge_base_api_knowledge_bases__kb_name__reindex_post */readonly Body_reindex_knowledge_base_api_knowledge_bases__kb_name__reindex_post: {/**@@ -12294,6 +12539,30 @@ export interface components {*/readonly updated_at: number | null;};+ /**+ * SessionHandoffCompleteRequest+ * @description Public request that trades a JWE ticket for the normal cookie.+ */+ readonly SessionHandoffCompleteRequest: {+ /** Ticket */+ readonly ticket: string;+ };+ /**+ * SessionHandoffCreateRequest+ * @description Private request that starts a one-time public handoff.+ */+ readonly SessionHandoffCreateRequest: {+ /** Public Origin */+ readonly public_origin: string;+ };+ /**+ * SessionHandoffExchangeRequest+ * @description Public request that trades a pairing code for a JWE ticket.+ */+ readonly SessionHandoffExchangeRequest: {+ /** Code */+ readonly code: string;+ };/** SessionKeyBody */readonly SessionKeyBody: {/** Session Key */@@ -13593,6 +13862,7 @@ export type SchemaBodyImportDocxApiDocumentsImportDocxPost =components["schemas"]["Body_import_docx_api_documents_import_docx_post"];export type SchemaBodyImportVisualizerApiVisualizersImportPost =components["schemas"]["Body_import_visualizer_api_visualizers_import_post"];+export type SchemaBodyLibraryAdd = components["schemas"]["Body_library_add"];export type SchemaBodyReindexKnowledgeBaseApiKnowledgeBasesKbNameReindexPost =components["schemas"]["Body_reindex_knowledge_base_api_knowledge_bases__kb_name__reindex_post"];export type SchemaBodySpeechToTextApiVoiceSttPost =@@ -13905,6 +14175,12 @@ export type SchemaServerPayload = components["schemas"]["ServerPayload"];export type SchemaSessionBranchBody =components["schemas"]["SessionBranchBody"];export type SchemaSessionDetail = components["schemas"]["SessionDetail"];+export type SchemaSessionHandoffCompleteRequest =+ components["schemas"]["SessionHandoffCompleteRequest"];+export type SchemaSessionHandoffCreateRequest =+ components["schemas"]["SessionHandoffCreateRequest"];+export type SchemaSessionHandoffExchangeRequest =+ components["schemas"]["SessionHandoffExchangeRequest"];export type SchemaSessionKeyBody = components["schemas"]["SessionKeyBody"];export type SchemaSessionOrganizationRequest =components["schemas"]["SessionOrganizationRequest"];@@ -14699,6 +14975,115 @@ export interface operations {};};};+ readonly create_session_handoff_api_auth_session_handoff_post: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path?: never;+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["SessionHandoffCreateRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: unknown;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly complete_session_handoff_api_auth_session_handoff_complete_post: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["SessionHandoffCompleteRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: unknown;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly exchange_session_handoff_api_auth_session_handoff_exchange_post: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: never;+ readonly path?: never;+ readonly cookie?: never;+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["SessionHandoffExchangeRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: unknown;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };readonly auth_status_api_auth_status_get: {readonly parameters: {readonly query?: never;@@ -28295,24 +28680,136 @@ export interface operations {};};};- readonly rename_session_api_sessions__session_id__patch: {+ readonly rename_session_api_sessions__session_id__patch: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly session_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["SessionRenameRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": unknown;+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly get_session_ask_hint_api_sessions__session_id__ask_hint_get: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly session_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: unknown;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly update_branch_selection_api_sessions__session_id__branch_selection_put: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly session_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["BranchSelectionRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": unknown;+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly delete_turn_by_message_api_sessions__session_id__messages__message_id__delete: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {+ readonly message_id: number;readonly session_id: string;};readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody: {- readonly content: {- readonly "application/json": components["schemas"]["SessionRenameRequest"];- };- };+ readonly requestBody?: never;readonly responses: {/** @description Successful Response */readonly 200: {@@ -28334,13 +28831,17 @@ export interface operations {};};};- readonly get_session_ask_hint_api_sessions__session_id__ask_hint_get: {+ readonly get_message_events_api_sessions__session_id__messages__message_id__events_get: {readonly parameters: {- readonly query?: never;+ readonly query?: {+ readonly after_seq?: number;+ readonly limit?: number;+ };readonly header?: {readonly Authorization?: string | null;};readonly path: {+ readonly message_id: string;readonly session_id: string;};readonly cookie?: {@@ -28355,9 +28856,7 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": {- readonly [key: string]: unknown;- };+ readonly "application/json": unknown;};};/** @description Validation Error */@@ -28371,7 +28870,7 @@ export interface operations {};};};- readonly update_branch_selection_api_sessions__session_id__branch_selection_put: {+ readonly update_session_organization_api_sessions__session_id__organization_patch: {readonly parameters: {readonly query?: never;readonly header?: {@@ -28386,7 +28885,7 @@ export interface operations {};readonly requestBody: {readonly content: {- readonly "application/json": components["schemas"]["BranchSelectionRequest"];+ readonly "application/json": components["schemas"]["SessionOrganizationRequest"];};};readonly responses: {@@ -28410,14 +28909,13 @@ export interface operations {};};};- readonly delete_turn_by_message_api_sessions__session_id__messages__message_id__delete: {+ readonly purge_session_api_sessions__session_id__purge_delete: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly message_id: number;readonly session_id: string;};readonly cookie?: {@@ -28446,24 +28944,24 @@ export interface operations {};};};- readonly get_message_events_api_sessions__session_id__messages__message_id__events_get: {+ readonly record_quiz_results_api_sessions__session_id__quiz_results_post: {readonly parameters: {- readonly query?: {- readonly after_seq?: number;- readonly limit?: number;- };+ readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly message_id: string;readonly session_id: string;};readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody?: never;+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["QuizResultsRequest"];+ };+ };readonly responses: {/** @description Successful Response */readonly 200: {@@ -28485,7 +28983,7 @@ export interface operations {};};};- readonly update_session_organization_api_sessions__session_id__organization_patch: {+ readonly restore_session_api_sessions__session_id__restore_post: {readonly parameters: {readonly query?: never;readonly header?: {@@ -28498,11 +28996,7 @@ export interface operations {readonly dt_token?: string | null;};};- readonly requestBody: {- readonly content: {- readonly "application/json": components["schemas"]["SessionOrganizationRequest"];- };- };+ readonly requestBody?: never;readonly responses: {/** @description Successful Response */readonly 200: {@@ -28524,24 +29018,21 @@ export interface operations {};};};- readonly record_quiz_results_api_sessions__session_id__quiz_results_post: {+ readonly list_recycle_bin_api_sessions_recycle_bin_get: {readonly parameters: {- readonly query?: never;+ readonly query?: {+ readonly limit?: number;+ readonly offset?: number;+ };readonly header?: {readonly Authorization?: string | null;};- readonly path: {- readonly session_id: string;- };+ readonly path?: never;readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody: {- readonly content: {- readonly "application/json": components["schemas"]["QuizResultsRequest"];- };- };+ readonly requestBody?: never;readonly responses: {/** @description Successful Response */readonly 200: {@@ -33260,7 +33751,200 @@ export interface operations {};};};- readonly update_video_note_api_video_learning_materials__material_id__notes__note_id__put: {+ readonly update_video_note_api_video_learning_materials__material_id__notes__note_id__put: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly material_id: string;+ readonly note_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["UpdateVideoNoteRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: unknown;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly delete_video_note_api_video_learning_materials__material_id__notes__note_id__delete: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly material_id: string;+ readonly note_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: string;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly save_video_progress_api_video_learning_materials__material_id__progress_put: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly material_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["deeptutor__api__routers__video_learning__ProgressRequest"];+ };+ };+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: number;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly stream_video_get: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly format_id: string;+ readonly material_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": unknown;+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly stream_video_head: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly format_id: string;+ readonly material_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": unknown;+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly get_video_subtitles_api_video_learning_materials__material_id__subtitles_vtt_get: {readonly parameters: {readonly query?: never;readonly header?: {@@ -33268,17 +33952,12 @@ export interface operations {};readonly path: {readonly material_id: string;- readonly note_id: string;};readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody: {- readonly content: {- readonly "application/json": components["schemas"]["UpdateVideoNoteRequest"];- };- };+ readonly requestBody?: never;readonly responses: {/** @description Successful Response */readonly 200: {@@ -33286,9 +33965,7 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": {- readonly [key: string]: unknown;- };+ readonly "application/json": unknown;};};/** @description Validation Error */@@ -33302,7 +33979,7 @@ export interface operations {};};};- readonly delete_video_note_api_video_learning_materials__material_id__notes__note_id__delete: {+ readonly refresh_video_transcript_api_video_learning_materials__material_id__transcript_refresh_post: {readonly parameters: {readonly query?: never;readonly header?: {@@ -33310,7 +33987,6 @@ export interface operations {};readonly path: {readonly material_id: string;- readonly note_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33325,7 +34001,7 @@ export interface operations {};content: {readonly "application/json": {- readonly [key: string]: string;+ readonly [key: string]: unknown;};};};@@ -33340,22 +34016,20 @@ export interface operations {};};};- readonly save_video_progress_api_video_learning_materials__material_id__progress_put: {+ readonly resolve_video_api_video_learning_materials_resolve_post: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path: {- readonly material_id: string;- };+ readonly path?: never;readonly cookie?: {readonly dt_token?: string | null;};};readonly requestBody: {readonly content: {- readonly "application/json": components["schemas"]["deeptutor__api__routers__video_learning__ProgressRequest"];+ readonly "application/json": components["schemas"]["ResolveRequest"];};};readonly responses: {@@ -33366,7 +34040,7 @@ export interface operations {};content: {readonly "application/json": {- readonly [key: string]: number;+ readonly [key: string]: unknown;};};};@@ -33381,15 +34055,14 @@ export interface operations {};};};- readonly stream_video_get: {+ readonly uninstall_visualizer_api_visualizers__visualizer_id__delete: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly format_id: string;- readonly material_id: string;+ readonly visualizer_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33403,7 +34076,9 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": unknown;+ readonly "application/json": {+ readonly [key: string]: string;+ };};};/** @description Validation Error */@@ -33417,15 +34092,15 @@ export interface operations {};};};- readonly stream_video_head: {+ readonly get_visualizer_asset_api_visualizers__visualizer_id__assets__asset_path__get: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly format_id: string;- readonly material_id: string;+ readonly asset_path: string;+ readonly visualizer_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33453,14 +34128,14 @@ export interface operations {};};};- readonly get_video_subtitles_api_video_learning_materials__material_id__subtitles_vtt_get: {+ readonly disable_visualizer_api_visualizers__visualizer_id__disable_post: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly material_id: string;+ readonly visualizer_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33474,7 +34149,9 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": unknown;+ readonly "application/json": {+ readonly [key: string]: string;+ };};};/** @description Validation Error */@@ -33488,14 +34165,51 @@ export interface operations {};};};- readonly refresh_video_transcript_api_video_learning_materials__material_id__transcript_refresh_post: {+ readonly enable_visualizer_api_visualizers__visualizer_id__enable_post: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly material_id: string;+ readonly visualizer_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": {+ readonly [key: string]: string;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly install_bundled_api_visualizers_bundled__visualizer_id__install_post: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly visualizer_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33525,7 +34239,7 @@ export interface operations {};};};- readonly resolve_video_api_video_learning_materials_resolve_post: {+ readonly import_visualizer_api_visualizers_import_post: {readonly parameters: {readonly query?: never;readonly header?: {@@ -33538,7 +34252,7 @@ export interface operations {};readonly requestBody: {readonly content: {- readonly "application/json": components["schemas"]["ResolveRequest"];+ readonly "multipart/form-data": components["schemas"]["Body_import_visualizer_api_visualizers_import_post"];};};readonly responses: {@@ -33564,15 +34278,13 @@ export interface operations {};};};- readonly uninstall_visualizer_api_visualizers__visualizer_id__delete: {+ readonly list_visualizers_api_visualizers_list_get: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path: {- readonly visualizer_id: string;- };+ readonly path?: never;readonly cookie?: {readonly dt_token?: string | null;};@@ -33586,7 +34298,7 @@ export interface operations {};content: {readonly "application/json": {- readonly [key: string]: string;+ readonly [key: string]: unknown;};};};@@ -33601,21 +34313,22 @@ export interface operations {};};};- readonly get_visualizer_asset_api_visualizers__visualizer_id__assets__asset_path__get: {+ readonly speech_to_text_api_voice_stt_post: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path: {- readonly asset_path: string;- readonly visualizer_id: string;- };+ readonly path?: never;readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody?: never;+ readonly requestBody: {+ readonly content: {+ readonly "multipart/form-data": components["schemas"]["Body_speech_to_text_api_voice_stt_post"];+ };+ };readonly responses: {/** @description Successful Response */readonly 200: {@@ -33623,7 +34336,9 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": unknown;+ readonly "application/json": {+ readonly [key: string]: string;+ };};};/** @description Validation Error */@@ -33637,20 +34352,22 @@ export interface operations {};};};- readonly disable_visualizer_api_visualizers__visualizer_id__disable_post: {+ readonly text_to_speech_api_voice_tts_post: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path: {- readonly visualizer_id: string;- };+ readonly path?: never;readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody?: never;+ readonly requestBody: {+ readonly content: {+ readonly "application/json": components["schemas"]["TTSRequest"];+ };+ };readonly responses: {/** @description Successful Response */readonly 200: {@@ -33658,9 +34375,7 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": {- readonly [key: string]: string;- };+ readonly "application/json": unknown;};};/** @description Validation Error */@@ -33674,14 +34389,16 @@ export interface operations {};};};- readonly enable_visualizer_api_visualizers__visualizer_id__enable_post: {+ readonly get_attachment_files_attachments__session_id___attachment_id___filename__get: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly visualizer_id: string;+ readonly attachment_id: string;+ readonly filename: string;+ readonly session_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33695,9 +34412,7 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": {- readonly [key: string]: string;- };+ readonly "application/json": unknown;};};/** @description Validation Error */@@ -33711,15 +34426,16 @@ export interface operations {};};};- readonly install_bundled_api_visualizers_bundled__visualizer_id__install_post: {+ readonly library_list: {readonly parameters: {- readonly query?: never;+ readonly query?: {+ readonly limit?: number;+ readonly offset?: number;+ };readonly header?: {readonly Authorization?: string | null;};- readonly path: {- readonly visualizer_id: string;- };+ readonly path?: never;readonly cookie?: {readonly dt_token?: string | null;};@@ -33732,9 +34448,9 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": {+ readonly "application/json": readonly {readonly [key: string]: unknown;- };+ }[];};};/** @description Validation Error */@@ -33748,7 +34464,7 @@ export interface operations {};};};- readonly import_visualizer_api_visualizers_import_post: {+ readonly library_add: {readonly parameters: {readonly query?: never;readonly header?: {@@ -33761,7 +34477,7 @@ export interface operations {};readonly requestBody: {readonly content: {- readonly "multipart/form-data": components["schemas"]["Body_import_visualizer_api_visualizers_import_post"];+ readonly "multipart/form-data": components["schemas"]["Body_library_add"];};};readonly responses: {@@ -33787,13 +34503,15 @@ export interface operations {};};};- readonly list_visualizers_api_visualizers_list_get: {+ readonly library_get: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path?: never;+ readonly path: {+ readonly file_id: string;+ };readonly cookie?: {readonly dt_token?: string | null;};@@ -33822,22 +34540,20 @@ export interface operations {};};};- readonly speech_to_text_api_voice_stt_post: {+ readonly library_delete: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path?: never;+ readonly path: {+ readonly file_id: string;+ };readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody: {- readonly content: {- readonly "multipart/form-data": components["schemas"]["Body_speech_to_text_api_voice_stt_post"];- };- };+ readonly requestBody?: never;readonly responses: {/** @description Successful Response */readonly 200: {@@ -33846,7 +34562,7 @@ export interface operations {};content: {readonly "application/json": {- readonly [key: string]: string;+ readonly [key: string]: unknown;};};};@@ -33861,22 +34577,55 @@ export interface operations {};};};- readonly text_to_speech_api_voice_tts_post: {+ readonly library_download: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};- readonly path?: never;+ readonly path: {+ readonly file_id: string;+ };readonly cookie?: {readonly dt_token?: string | null;};};- readonly requestBody: {- readonly content: {- readonly "application/json": components["schemas"]["TTSRequest"];+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": unknown;+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };};};+ };+ readonly library_download_head: {+ readonly parameters: {+ readonly query?: never;+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path: {+ readonly file_id: string;+ };+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;readonly responses: {/** @description Successful Response */readonly 200: {@@ -33898,16 +34647,14 @@ export interface operations {};};};- readonly get_attachment_files_attachments__session_id___attachment_id___filename__get: {+ readonly library_restore: {readonly parameters: {readonly query?: never;readonly header?: {readonly Authorization?: string | null;};readonly path: {- readonly attachment_id: string;- readonly filename: string;- readonly session_id: string;+ readonly file_id: string;};readonly cookie?: {readonly dt_token?: string | null;@@ -33921,7 +34668,46 @@ export interface operations {readonly [name: string]: unknown;};content: {- readonly "application/json": unknown;+ readonly "application/json": {+ readonly [key: string]: unknown;+ };+ };+ };+ /** @description Validation Error */+ readonly 422: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": components["schemas"]["HTTPValidationError"];+ };+ };+ };+ };+ readonly library_search: {+ readonly parameters: {+ readonly query: {+ readonly q: string;+ };+ readonly header?: {+ readonly Authorization?: string | null;+ };+ readonly path?: never;+ readonly cookie?: {+ readonly dt_token?: string | null;+ };+ };+ readonly requestBody?: never;+ readonly responses: {+ /** @description Successful Response */+ readonly 200: {+ headers: {+ readonly [name: string]: unknown;+ };+ content: {+ readonly "application/json": readonly {+ readonly [key: string]: unknown;+ }[];};};/** @description Validation Error */diff --git a/web/contracts/schema/openapi.json b/web/contracts/schema/openapi.jsonindex 9c2862f3e..1827483ea 100644--- a/web/contracts/schema/openapi.json+++ b/web/contracts/schema/openapi.json@@ -750,6 +750,32 @@"title": "Body_import_visualizer_api_visualizers_import_post","type": "object"},+ "Body_library_add": {+ "properties": {+ "file": {+ "contentMediaType": "application/octet-stream",+ "description": "Raw file bytes",+ "title": "File",+ "type": "string"+ },+ "filename": {+ "description": "Original filename",+ "title": "Filename",+ "type": "string"+ },+ "mime_type": {+ "default": "",+ "title": "Mime Type",+ "type": "string"+ }+ },+ "required": [+ "filename",+ "file"+ ],+ "title": "Body_library_add",+ "type": "object"+ },"Body_reindex_knowledge_base_api_knowledge_bases__kb_name__reindex_post": {"properties": {"indexing_llm": {@@ -6947,6 +6973,54 @@"title": "SessionDetail","type": "object"},+ "SessionHandoffCompleteRequest": {+ "description": "Public request that trades a JWE ticket for the normal cookie.",+ "properties": {+ "ticket": {+ "maxLength": 8192,+ "minLength": 32,+ "title": "Ticket",+ "type": "string"+ }+ },+ "required": [+ "ticket"+ ],+ "title": "SessionHandoffCompleteRequest",+ "type": "object"+ },+ "SessionHandoffCreateRequest": {+ "description": "Private request that starts a one-time public handoff.",+ "properties": {+ "public_origin": {+ "maxLength": 2048,+ "minLength": 8,+ "title": "Public Origin",+ "type": "string"+ }+ },+ "required": [+ "public_origin"+ ],+ "title": "SessionHandoffCreateRequest",+ "type": "object"+ },+ "SessionHandoffExchangeRequest": {+ "description": "Public request that trades a pairing code for a JWE ticket.",+ "properties": {+ "code": {+ "maxLength": 256,+ "minLength": 16,+ "title": "Code",+ "type": "string"+ }+ },+ "required": [+ "code"+ ],+ "title": "SessionHandoffExchangeRequest",+ "type": "object"+ },"SessionKeyBody": {"properties": {"session_key": {@@ -11292,6 +11366,172 @@]}},+ "/api/auth/session-handoff": {+ "post": {+ "description": "Create a host-bound, one-time pairing code from the private origin.",+ "operationId": "create_session_handoff_api_auth_session_handoff_post",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SessionHandoffCreateRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Create Session Handoff Api Auth Session Handoff Post",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Create Session Handoff",+ "tags": [+ "auth"+ ]+ }+ },+ "/api/auth/session-handoff/complete": {+ "post": {+ "description": "Consume a ticket once and issue the normal HttpOnly session cookie.",+ "operationId": "complete_session_handoff_api_auth_session_handoff_complete_post",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SessionHandoffCompleteRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Complete Session Handoff Api Auth Session Handoff Complete Post",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Complete Session Handoff",+ "tags": [+ "auth"+ ]+ }+ },+ "/api/auth/session-handoff/exchange": {+ "post": {+ "description": "Consume a pairing code and return a short-lived ticket in the response body.",+ "operationId": "exchange_session_handoff_api_auth_session_handoff_exchange_post",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SessionHandoffExchangeRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Exchange Session Handoff Api Auth Session Handoff Exchange Post",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Exchange Session Handoff",+ "tags": [+ "auth"+ ]+ }+ },"/api/auth/status": {"get": {"description": "Return whether auth is enabled and whether the current request is authenticated.",@@ -39810,29 +40050,17 @@]}},- "/api/sessions/search": {+ "/api/sessions/recycle-bin": {"get": {- "description": "Search titles and persisted user/assistant messages for a literal term.",- "operationId": "search_sessions_api_sessions_search_get",+ "operationId": "list_recycle_bin_api_sessions_recycle_bin_get","parameters": [- {- "in": "query",- "name": "q",- "required": true,- "schema": {- "maxLength": 200,- "minLength": 1,- "title": "Q",- "type": "string"- }- },{"in": "query","name": "limit","required": false,"schema": {"default": 50,- "maximum": 100,+ "maximum": 200,"minimum": 1,"title": "Limit","type": "integer"@@ -39902,25 +40130,51 @@"description": "Validation Error"}},- "summary": "Search Sessions",+ "summary": "List Recycle Bin","tags": ["sessions"]}},- "/api/sessions/{session_id}": {- "delete": {- "operationId": "delete_session_api_sessions__session_id__delete",+ "/api/sessions/search": {+ "get": {+ "description": "Search titles and persisted user/assistant messages for a literal term.",+ "operationId": "search_sessions_api_sessions_search_get","parameters": [{- "in": "path",- "name": "session_id",+ "in": "query",+ "name": "q","required": true,"schema": {- "title": "Session Id",+ "maxLength": 200,+ "minLength": 1,+ "title": "Q","type": "string"}},+ {+ "in": "query",+ "name": "limit",+ "required": false,+ "schema": {+ "default": 50,+ "maximum": 100,+ "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",@@ -39974,13 +40228,85 @@"description": "Validation Error"}},- "summary": "Delete Session",+ "summary": "Search Sessions","tags": ["sessions"]- },- "get": {- "operationId": "get_session_api_sessions__session_id__get",+ }+ },+ "/api/sessions/{session_id}": {+ "delete": {+ "operationId": "delete_session_api_sessions__session_id__delete",+ "parameters": [+ {+ "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": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Delete Session",+ "tags": [+ "sessions"+ ]+ },+ "get": {+ "operationId": "get_session_api_sessions__session_id__get","parameters": [{"in": "path",@@ -40556,9 +40882,9 @@]}},- "/api/sessions/{session_id}/quiz-results": {- "post": {- "operationId": "record_quiz_results_api_sessions__session_id__quiz_results_post",+ "/api/sessions/{session_id}/purge": {+ "delete": {+ "operationId": "purge_session_api_sessions__session_id__purge_delete","parameters": [{"in": "path",@@ -40602,16 +40928,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/QuizResultsRequest"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -40632,80 +40948,25 @@"description": "Validation Error"}},- "summary": "Record Quiz Results",+ "summary": "Purge Session","tags": ["sessions"]}},- "/api/settings": {- "get": {- "operationId": "get_settings_api_settings_get",+ "/api/sessions/{session_id}/quiz-results": {+ "post": {+ "operationId": "record_quiz_results_api_sessions__session_id__quiz_results_post","parameters": [{- "in": "header",- "name": "Authorization",- "required": false,+ "in": "path",+ "name": "session_id",+ "required": true,"schema": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Authorization"+ "title": "Session Id",+ "type": "string"}},- {- "in": "cookie",- "name": "dt_token",- "required": false,- "schema": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Dt Token"- }- }- ],- "responses": {- "200": {- "content": {- "application/json": {- "schema": {}- }- },- "description": "Successful Response"- },- "422": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/HTTPValidationError"- }- }- },- "description": "Validation Error"- }- },- "summary": "Get Settings",- "tags": [- "settings"- ]- }- },- "/api/settings/apply": {- "post": {- "description": "Move settings into the files the runtime reads, and clear the draft.\n\nWith no body this promotes the stored draft's catalog, which is how the\nsettings UI applies: credentials that only ever existed in a draft would\notherwise have to round-trip through the browser as placeholders and come\nback resolving to the previous key.",- "operationId": "apply_catalog_api_settings_apply_post",- "parameters": [{"in": "header","name": "Authorization",@@ -40743,18 +41004,11 @@"content": {"application/json": {"schema": {- "anyOf": [- {- "$ref": "#/components/schemas/CatalogPayload"- },- {- "type": "null"- }- ],- "title": "Payload"+ "$ref": "#/components/schemas/QuizResultsRequest"}}- }+ },+ "required": true},"responses": {"200": {@@ -40776,90 +41030,25 @@"description": "Validation Error"}},- "summary": "Apply Catalog",+ "summary": "Record Quiz Results","tags": [- "settings"+ "sessions"]}},- "/api/settings/apply/service": {+ "/api/sessions/{session_id}/restore": {"post": {- "description": "Apply one model service while leaving every other draft untouched.\n\nProvider dialogs use this narrower commit path for their Done action. A\nuser may still have unrelated edits elsewhere in Settings, and closing an\nSTT dialog must not silently promote those edits too.",- "operationId": "apply_catalog_service_api_settings_apply_service_post",+ "operationId": "restore_session_api_sessions__session_id__restore_post","parameters": [{- "in": "header",- "name": "Authorization",- "required": false,- "schema": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Authorization"- }- },- {- "in": "cookie",- "name": "dt_token",- "required": false,+ "in": "path",+ "name": "session_id",+ "required": true,"schema": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Dt Token"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CatalogServicePayload"- }+ "title": "Session Id",+ "type": "string"}},- "required": true- },- "responses": {- "200": {- "content": {- "application/json": {- "schema": {}- }- },- "description": "Successful Response"- },- "422": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/HTTPValidationError"- }- }- },- "description": "Validation Error"- }- },- "summary": "Apply Catalog Service",- "tags": [- "settings"- ]- }- },- "/api/settings/catalog": {- "get": {- "operationId": "get_catalog_api_settings_catalog_get",- "parameters": [{"in": "header","name": "Authorization",@@ -40913,13 +41102,15 @@"description": "Validation Error"}},- "summary": "Get Catalog",+ "summary": "Restore Session","tags": [- "settings"+ "sessions"]- },- "put": {- "operationId": "update_catalog_api_settings_catalog_put",+ }+ },+ "/api/settings": {+ "get": {+ "operationId": "get_settings_api_settings_get","parameters": [{"in": "header",@@ -40954,16 +41145,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CatalogPayload"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -40984,77 +41165,16 @@"description": "Validation Error"}},- "summary": "Update Catalog",+ "summary": "Get Settings","tags": ["settings"]}},- "/api/settings/chat-attachments": {- "get": {- "description": "Chat attachment policy. Readable by any user — the composer needs the\ncaps to gate file picks client-side; only the PUT is admin-gated.",- "operationId": "get_chat_attachment_settings_api_settings_chat_attachments_get",- "parameters": [- {- "in": "header",- "name": "Authorization",- "required": false,- "schema": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Authorization"- }- },- {- "in": "cookie",- "name": "dt_token",- "required": false,- "schema": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Dt Token"- }- }- ],- "responses": {- "200": {- "content": {- "application/json": {- "schema": {}- }- },- "description": "Successful Response"- },- "422": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/HTTPValidationError"- }- }- },- "description": "Validation Error"- }- },- "summary": "Get Chat Attachment Settings",- "tags": [- "settings"- ]- },- "put": {- "operationId": "update_chat_attachment_settings_api_settings_chat_attachments_put",+ "/api/settings/apply": {+ "post": {+ "description": "Move settings into the files the runtime reads, and clear the draft.\n\nWith no body this promotes the stored draft's catalog, which is how the\nsettings UI applies: credentials that only ever existed in a draft would\notherwise have to round-trip through the browser as placeholders and come\nback resolving to the previous key.",+ "operationId": "apply_catalog_api_settings_apply_post","parameters": [{"in": "header",@@ -41093,11 +41213,18 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ChatAttachmentSettingsUpdate"+ "anyOf": [+ {+ "$ref": "#/components/schemas/CatalogPayload"+ },+ {+ "type": "null"+ }+ ],+ "title": "Payload"}}- },- "required": true+ }},"responses": {"200": {@@ -41119,16 +41246,16 @@"description": "Validation Error"}},- "summary": "Update Chat Attachment Settings",+ "summary": "Apply Catalog","tags": ["settings"]}},- "/api/settings/chat-response-timeout": {- "put": {- "description": "Persist how long the chat UI waits for a turn event before timing out.\n\nA personal UI preference (any authenticated user). Slow tools like image /\nvideo generation can take longer than the old 60s default, so this is\nuser-adjustable; the chat surface reads it client-side.",- "operationId": "update_chat_response_timeout_api_settings_chat_response_timeout_put",+ "/api/settings/apply/service": {+ "post": {+ "description": "Apply one model service while leaving every other draft untouched.\n\nProvider dialogs use this narrower commit path for their Done action. A\nuser may still have unrelated edits elsewhere in Settings, and closing an\nSTT dialog must not silently promote those edits too.",+ "operationId": "apply_catalog_service_api_settings_apply_service_post","parameters": [{"in": "header",@@ -41167,7 +41294,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ChatResponseTimeoutUpdate"+ "$ref": "#/components/schemas/CatalogServicePayload"}}},@@ -41193,16 +41320,15 @@"description": "Validation Error"}},- "summary": "Update Chat Response Timeout",+ "summary": "Apply Catalog Service","tags": ["settings"]}},- "/api/settings/chat-starters": {+ "/api/settings/catalog": {"get": {- "description": "How many recent activities shape the home screen's starting points.\n\nPer user and not admin-gated, unlike the attachment caps next door: this\nchanges the size of one prompt built from the caller's own memory, not any\nresource other people share.",- "operationId": "get_chat_starter_settings_api_settings_chat_starters_get",+ "operationId": "get_catalog_api_settings_catalog_get","parameters": [{"in": "header",@@ -41257,13 +41383,13 @@"description": "Validation Error"}},- "summary": "Get Chat Starter Settings",+ "summary": "Get Catalog","tags": ["settings"]},"put": {- "operationId": "update_chat_starter_settings_api_settings_chat_starters_put",+ "operationId": "update_catalog_api_settings_catalog_put","parameters": [{"in": "header",@@ -41302,7 +41428,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ChatStarterSettingsUpdate"+ "$ref": "#/components/schemas/CatalogPayload"}}},@@ -41328,15 +41454,16 @@"description": "Validation Error"}},- "summary": "Update Chat Starter Settings",+ "summary": "Update Catalog","tags": ["settings"]}},- "/api/settings/document-parsing": {+ "/api/settings/chat-attachments": {"get": {- "operationId": "get_document_parsing_settings_api_settings_document_parsing_get",+ "description": "Chat attachment policy. Readable by any user — the composer needs the\ncaps to gate file picks client-side; only the PUT is admin-gated.",+ "operationId": "get_chat_attachment_settings_api_settings_chat_attachments_get","parameters": [{"in": "header",@@ -41391,13 +41518,13 @@"description": "Validation Error"}},- "summary": "Get Document Parsing Settings",+ "summary": "Get Chat Attachment Settings","tags": ["settings"]},"put": {- "operationId": "update_document_parsing_settings_api_settings_document_parsing_put",+ "operationId": "update_chat_attachment_settings_api_settings_chat_attachments_put","parameters": [{"in": "header",@@ -41436,7 +41563,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DocumentParsingUpdate"+ "$ref": "#/components/schemas/ChatAttachmentSettingsUpdate"}}},@@ -41462,16 +41589,16 @@"description": "Validation Error"}},- "summary": "Update Document Parsing Settings",+ "summary": "Update Chat Attachment Settings","tags": ["settings"]}},- "/api/settings/document-parsing/docling/test": {- "post": {- "description": "Live connectivity check for the Docling remote-server draft values.\nPings the server health + version endpoints and returns ``ok`` + a\nhuman-readable detail. Tests draft form values so the user can verify the\nURL/key before saving; falls back to the stored key when the secret field\nis untouched.",- "operationId": "test_docling_remote_connection_api_settings_document_parsing_docling_test_post",+ "/api/settings/chat-response-timeout": {+ "put": {+ "description": "Persist how long the chat UI waits for a turn event before timing out.\n\nA personal UI preference (any authenticated user). Slow tools like image /\nvideo generation can take longer than the old 60s default, so this is\nuser-adjustable; the chat surface reads it client-side.",+ "operationId": "update_chat_response_timeout_api_settings_chat_response_timeout_put","parameters": [{"in": "header",@@ -41510,7 +41637,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DoclingRemoteTest"+ "$ref": "#/components/schemas/ChatResponseTimeoutUpdate"}}},@@ -41536,16 +41663,16 @@"description": "Validation Error"}},- "summary": "Test Docling Remote Connection",+ "summary": "Update Chat Response Timeout","tags": ["settings"]}},- "/api/settings/document-parsing/install": {- "post": {- "description": "Kick off a one-click ``pip install`` of an optional engine's package(s).\n\nReturns ``{ok, message}`` immediately; progress is polled via the shared job\nstatus endpoint. Only one job runs at a time (process-wide singleton). The\nengine must be in the install allow-list (``ENGINE_PIP_SPECS``).",- "operationId": "start_document_parsing_install_api_settings_document_parsing_install_post",+ "/api/settings/chat-starters": {+ "get": {+ "description": "How many recent activities shape the home screen's starting points.\n\nPer user and not admin-gated, unlike the attachment caps next door: this\nchanges the size of one prompt built from the caller's own memory, not any\nresource other people share.",+ "operationId": "get_chat_starter_settings_api_settings_chat_starters_get","parameters": [{"in": "header",@@ -41580,16 +41707,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/DocumentParsingInstall"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -41610,15 +41727,13 @@"description": "Validation Error"}},- "summary": "Start Document Parsing Install",+ "summary": "Get Chat Starter Settings","tags": ["settings"]- }- },- "/api/settings/document-parsing/job/cancel": {- "post": {- "operationId": "cancel_document_parsing_job_api_settings_document_parsing_job_cancel_post",+ },+ "put": {+ "operationId": "update_chat_starter_settings_api_settings_chat_starters_put","parameters": [{"in": "header",@@ -41653,6 +41768,16 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ChatStarterSettingsUpdate"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {@@ -41673,26 +41798,16 @@"description": "Validation Error"}},- "summary": "Cancel Document Parsing Job",+ "summary": "Update Chat Starter Settings","tags": ["settings"]}},- "/api/settings/document-parsing/job/status": {+ "/api/settings/document-parsing": {"get": {- "operationId": "document_parsing_job_status_api_settings_document_parsing_job_status_get",+ "operationId": "get_document_parsing_settings_api_settings_document_parsing_get","parameters": [- {- "in": "query",- "name": "cursor",- "required": false,- "schema": {- "default": 0,- "title": "Cursor",- "type": "integer"- }- },{"in": "header","name": "Authorization",@@ -41746,16 +41861,13 @@"description": "Validation Error"}},- "summary": "Document Parsing Job Status",+ "summary": "Get Document Parsing Settings","tags": ["settings"]- }- },- "/api/settings/document-parsing/models/download": {- "post": {- "description": "Kick off a one-click model-weight download for an engine (e.g. Docling).\n\nRuns the engine's downloader console script (``docling-tools models\ndownload``) as a background subprocess; progress is polled via the shared job\nstatus endpoint. The engine must be in ``ENGINE_MODEL_DOWNLOADERS`` and its\nscript reachable next to the server's python or on PATH.",- "operationId": "start_document_parsing_model_download_api_settings_document_parsing_models_download_post",+ },+ "put": {+ "operationId": "update_document_parsing_settings_api_settings_document_parsing_put","parameters": [{"in": "header",@@ -41794,7 +41906,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DocumentParsingInstall"+ "$ref": "#/components/schemas/DocumentParsingUpdate"}}},@@ -41820,16 +41932,16 @@"description": "Validation Error"}},- "summary": "Start Document Parsing Model Download",+ "summary": "Update Document Parsing Settings","tags": ["settings"]}},- "/api/settings/document-parsing/test": {+ "/api/settings/document-parsing/docling/test": {"post": {- "description": "Readiness test for an engine. For MinerU's deeper checks (live cloud\ntoken / CLI ``--version``) the UI uses ``/mineru/test``; this generic test\ncovers engine availability + model readiness for all engines.",- "operationId": "test_document_parsing_api_settings_document_parsing_test_post",+ "description": "Live connectivity check for the Docling remote-server draft values.\nPings the server health + version endpoints and returns ``ok`` + a\nhuman-readable detail. Tests draft form values so the user can verify the\nURL/key before saving; falls back to the stored key when the secret field\nis untouched.",+ "operationId": "test_docling_remote_connection_api_settings_document_parsing_docling_test_post","parameters": [{"in": "header",@@ -41868,7 +41980,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DocumentParsingTest"+ "$ref": "#/components/schemas/DoclingRemoteTest"}}},@@ -41894,16 +42006,16 @@"description": "Validation Error"}},- "summary": "Test Document Parsing",+ "summary": "Test Docling Remote Connection","tags": ["settings"]}},- "/api/settings/document-parsing/tika/test": {+ "/api/settings/document-parsing/install": {"post": {- "description": "Live connectivity check for the Tika server draft URL. Pings ``/version``\nso the user can verify the URL before saving.",- "operationId": "test_tika_remote_connection_api_settings_document_parsing_tika_test_post",+ "description": "Kick off a one-click ``pip install`` of an optional engine's package(s).\n\nReturns ``{ok, message}`` immediately; progress is polled via the shared job\nstatus endpoint. Only one job runs at a time (process-wide singleton). The\nengine must be in the install allow-list (``ENGINE_PIP_SPECS``).",+ "operationId": "start_document_parsing_install_api_settings_document_parsing_install_post","parameters": [{"in": "header",@@ -41942,7 +42054,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TikaRemoteTest"+ "$ref": "#/components/schemas/DocumentParsingInstall"}}},@@ -41968,15 +42080,15 @@"description": "Validation Error"}},- "summary": "Test Tika Remote Connection",+ "summary": "Start Document Parsing Install","tags": ["settings"]}},- "/api/settings/draft": {- "delete": {- "operationId": "discard_settings_draft_api_settings_draft_delete",+ "/api/settings/document-parsing/job/cancel": {+ "post": {+ "operationId": "cancel_document_parsing_job_api_settings_document_parsing_job_cancel_post","parameters": [{"in": "header",@@ -42031,15 +42143,26 @@"description": "Validation Error"}},- "summary": "Discard Settings Draft",+ "summary": "Cancel Document Parsing Job","tags": ["settings"]- },+ }+ },+ "/api/settings/document-parsing/job/status": {"get": {- "description": "Return the unapplied draft, or nothing when there is none.\n\nThe draft is deliberately invisible to every other read path: nothing that\nresolves runtime configuration looks here, which is the whole difference\nbetween saving a draft and applying it.",- "operationId": "get_settings_draft_api_settings_draft_get",+ "operationId": "document_parsing_job_status_api_settings_document_parsing_job_status_get","parameters": [+ {+ "in": "query",+ "name": "cursor",+ "required": false,+ "schema": {+ "default": 0,+ "title": "Cursor",+ "type": "integer"+ }+ },{"in": "header","name": "Authorization",@@ -42093,13 +42216,16 @@"description": "Validation Error"}},- "summary": "Get Settings Draft",+ "summary": "Document Parsing Job Status","tags": ["settings"]- },- "put": {- "operationId": "update_settings_draft_api_settings_draft_put",+ }+ },+ "/api/settings/document-parsing/models/download": {+ "post": {+ "description": "Kick off a one-click model-weight download for an engine (e.g. Docling).\n\nRuns the engine's downloader console script (``docling-tools models\ndownload``) as a background subprocess; progress is polled via the shared job\nstatus endpoint. The engine must be in ``ENGINE_MODEL_DOWNLOADERS`` and its\nscript reachable next to the server's python or on PATH.",+ "operationId": "start_document_parsing_model_download_api_settings_document_parsing_models_download_post","parameters": [{"in": "header",@@ -42138,7 +42264,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/SettingsDraftPayload"+ "$ref": "#/components/schemas/DocumentParsingInstall"}}},@@ -42164,15 +42290,16 @@"description": "Validation Error"}},- "summary": "Update Settings Draft",+ "summary": "Start Document Parsing Model Download","tags": ["settings"]}},- "/api/settings/enabled-tools": {- "put": {- "operationId": "update_enabled_tools_api_settings_enabled_tools_put",+ "/api/settings/document-parsing/test": {+ "post": {+ "description": "Readiness test for an engine. For MinerU's deeper checks (live cloud\ntoken / CLI ``--version``) the UI uses ``/mineru/test``; this generic test\ncovers engine availability + model readiness for all engines.",+ "operationId": "test_document_parsing_api_settings_document_parsing_test_post","parameters": [{"in": "header",@@ -42211,7 +42338,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/EnabledToolsUpdate"+ "$ref": "#/components/schemas/DocumentParsingTest"}}},@@ -42237,16 +42364,16 @@"description": "Validation Error"}},- "summary": "Update Enabled Tools",+ "summary": "Test Document Parsing","tags": ["settings"]}},- "/api/settings/fetch-models": {+ "/api/settings/document-parsing/tika/test": {"post": {- "description": "List the model IDs an OpenAI-compatible provider exposes.\n\nThin HTTP surface over ``factory.fetch_models`` so the settings UI can\npopulate a model picker from ``base_url`` + ``api_key`` instead of making\nthe user type model IDs by hand.",- "operationId": "fetch_models_from_provider_api_settings_fetch_models_post",+ "description": "Live connectivity check for the Tika server draft URL. Pings ``/version``\nso the user can verify the URL before saving.",+ "operationId": "test_tika_remote_connection_api_settings_document_parsing_tika_test_post","parameters": [{"in": "header",@@ -42285,7 +42412,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/FetchModelsPayload"+ "$ref": "#/components/schemas/TikaRemoteTest"}}},@@ -42311,15 +42438,15 @@"description": "Validation Error"}},- "summary": "Fetch Models From Provider",+ "summary": "Test Tika Remote Connection","tags": ["settings"]}},- "/api/settings/language": {- "put": {- "operationId": "update_language_api_settings_language_put",+ "/api/settings/draft": {+ "delete": {+ "operationId": "discard_settings_draft_api_settings_draft_delete","parameters": [{"in": "header",@@ -42354,16 +42481,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/LanguageUpdate"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -42384,15 +42501,14 @@"description": "Validation Error"}},- "summary": "Update Language",+ "summary": "Discard Settings Draft","tags": ["settings"]- }- },- "/api/settings/llm-options": {+ },"get": {- "operationId": "get_llm_options_api_settings_llm_options_get",+ "description": "Return the unapplied draft, or nothing when there is none.\n\nThe draft is deliberately invisible to every other read path: nothing that\nresolves runtime configuration looks here, which is the whole difference\nbetween saving a draft and applying it.",+ "operationId": "get_settings_draft_api_settings_draft_get","parameters": [{"in": "header",@@ -42447,15 +42563,13 @@"description": "Validation Error"}},- "summary": "Get Llm Options",+ "summary": "Get Settings Draft","tags": ["settings"]- }- },- "/api/settings/mcp": {- "get": {- "operationId": "get_mcp_settings_api_settings_mcp_get",+ },+ "put": {+ "operationId": "update_settings_draft_api_settings_draft_put","parameters": [{"in": "header",@@ -42490,15 +42604,21 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SettingsDraftPayload"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Get Mcp Settings Api Settings Mcp Get",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -42514,13 +42634,15 @@"description": "Validation Error"}},- "summary": "Get Mcp Settings",+ "summary": "Update Settings Draft","tags": [- "mcp-settings"+ "settings"]- },+ }+ },+ "/api/settings/enabled-tools": {"put": {- "operationId": "update_mcp_settings_api_settings_mcp_put",+ "operationId": "update_enabled_tools_api_settings_enabled_tools_put","parameters": [{"in": "header",@@ -42559,7 +42681,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/MCPSettingsPayload"+ "$ref": "#/components/schemas/EnabledToolsUpdate"}}},@@ -42569,11 +42691,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Update Mcp Settings Api Settings Mcp Put",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -42589,25 +42707,17 @@"description": "Validation Error"}},- "summary": "Update Mcp Settings",+ "summary": "Update Enabled Tools","tags": [- "mcp-settings"+ "settings"]}},- "/api/settings/mcp/servers/{name}": {- "delete": {- "operationId": "delete_mcp_server_api_settings_mcp_servers__name__delete",+ "/api/settings/fetch-models": {+ "post": {+ "description": "List the model IDs an OpenAI-compatible provider exposes.\n\nThin HTTP surface over ``factory.fetch_models`` so the settings UI can\npopulate a model picker from ``base_url`` + ``api_key`` instead of making\nthe user type model IDs by hand.",+ "operationId": "fetch_models_from_provider_api_settings_fetch_models_post","parameters": [- {- "in": "path",- "name": "name",- "required": true,- "schema": {- "title": "Name",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -42641,15 +42751,21 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/FetchModelsPayload"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Delete Mcp Server Api Settings Mcp Servers Name Delete",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -42665,24 +42781,16 @@"description": "Validation Error"}},- "summary": "Delete Mcp Server",+ "summary": "Fetch Models From Provider","tags": [- "mcp-settings"+ "settings"]- },+ }+ },+ "/api/settings/language": {"put": {- "description": "Upsert one server, leaving every other entry byte-identical.\n\nThe whole-map ``PUT`` above cannot express \"change this one\": a client has to\nsend back everything it read, so it silently drops any field it does not\nmodel (a hand-written ``disabled_tools`` blocklist) and overwrites whatever\na second administrator saved in between.",- "operationId": "upsert_mcp_server_api_settings_mcp_servers__name__put",+ "operationId": "update_language_api_settings_language_put","parameters": [- {- "in": "path",- "name": "name",- "required": true,- "schema": {- "title": "Name",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -42720,7 +42828,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/MCPServerConfig"+ "$ref": "#/components/schemas/LanguageUpdate"}}},@@ -42730,11 +42838,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Upsert Mcp Server Api Settings Mcp Servers Name Put",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -42750,15 +42854,15 @@"description": "Validation Error"}},- "summary": "Upsert Mcp Server",+ "summary": "Update Language","tags": [- "mcp-settings"+ "settings"]}},- "/api/settings/mcp/test": {- "post": {- "operationId": "test_mcp_server_api_settings_mcp_test_post",+ "/api/settings/llm-options": {+ "get": {+ "operationId": "get_llm_options_api_settings_llm_options_get","parameters": [{"in": "header",@@ -42793,23 +42897,76 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/MCPServerConfig"+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}}- }+ },+ "description": "Successful Response"},- "required": true+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }},+ "summary": "Get Llm Options",+ "tags": [+ "settings"+ ]+ }+ },+ "/api/settings/mcp": {+ "get": {+ "operationId": "get_mcp_settings_api_settings_mcp_get",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],"responses": {"200": {"content": {"application/json": {"schema": {"additionalProperties": true,- "title": "Response Test Mcp Server Api Settings Mcp Test Post",+ "title": "Response Get Mcp Settings Api Settings Mcp Get","type": "object"}}@@ -42827,15 +42984,13 @@"description": "Validation Error"}},- "summary": "Test Mcp Server",+ "summary": "Get Mcp Settings","tags": ["mcp-settings"]- }- },- "/api/settings/mineru": {- "get": {- "operationId": "get_mineru_settings_api_settings_mineru_get",+ },+ "put": {+ "operationId": "update_mcp_settings_api_settings_mcp_put","parameters": [{"in": "header",@@ -42870,11 +43025,25 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/MCPSettingsPayload"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Update Mcp Settings Api Settings Mcp Put",+ "type": "object"+ }}},"description": "Successful Response"@@ -42890,14 +43059,100 @@"description": "Validation Error"}},- "summary": "Get Mineru Settings",+ "summary": "Update Mcp Settings","tags": [- "settings"+ "mcp-settings"+ ]+ }+ },+ "/api/settings/mcp/servers/{name}": {+ "delete": {+ "operationId": "delete_mcp_server_api_settings_mcp_servers__name__delete",+ "parameters": [+ {+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "title": "Name",+ "type": "string"+ }+ },+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Delete Mcp Server Api Settings Mcp Servers Name Delete",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Delete Mcp Server",+ "tags": [+ "mcp-settings"]},"put": {- "operationId": "update_mineru_settings_api_settings_mineru_put",+ "description": "Upsert one server, leaving every other entry byte-identical.\n\nThe whole-map ``PUT`` above cannot express \"change this one\": a client has to\nsend back everything it read, so it silently drops any field it does not\nmodel (a hand-written ``disabled_tools`` blocklist) and overwrites whatever\na second administrator saved in between.",+ "operationId": "upsert_mcp_server_api_settings_mcp_servers__name__put","parameters": [+ {+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "title": "Name",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -42935,7 +43190,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/MinerUSettingsUpdate"+ "$ref": "#/components/schemas/MCPServerConfig"}}},@@ -42945,7 +43200,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Upsert Mcp Server Api Settings Mcp Servers Name Put",+ "type": "object"+ }}},"description": "Successful Response"@@ -42961,16 +43220,15 @@"description": "Validation Error"}},- "summary": "Update Mineru Settings",+ "summary": "Upsert Mcp Server","tags": [- "settings"+ "mcp-settings"]}},- "/api/settings/mineru/models/download": {+ "/api/settings/mcp/test": {"post": {- "description": "Kick off a one-click model download via ``mineru-models-download``.\n\nReturns ``{ok, message}`` immediately; progress is polled via the status\nendpoint. Only one download runs at a time (process-wide singleton).",- "operationId": "start_mineru_models_download_api_settings_mineru_models_download_post",+ "operationId": "test_mcp_server_api_settings_mcp_test_post","parameters": [{"in": "header",@@ -43009,7 +43267,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/MinerUModelDownloadPayload"+ "$ref": "#/components/schemas/MCPServerConfig"}}},@@ -43019,7 +43277,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Test Mcp Server Api Settings Mcp Test Post",+ "type": "object"+ }}},"description": "Successful Response"@@ -43035,15 +43297,15 @@"description": "Validation Error"}},- "summary": "Start Mineru Models Download",+ "summary": "Test Mcp Server","tags": [- "settings"+ "mcp-settings"]}},- "/api/settings/mineru/models/download/cancel": {- "post": {- "operationId": "cancel_mineru_models_download_api_settings_mineru_models_download_cancel_post",+ "/api/settings/mineru": {+ "get": {+ "operationId": "get_mineru_settings_api_settings_mineru_get","parameters": [{"in": "header",@@ -43098,26 +43360,14 @@"description": "Validation Error"}},- "summary": "Cancel Mineru Models Download",+ "summary": "Get Mineru Settings","tags": ["settings"]- }- },- "/api/settings/mineru/models/download/status": {- "get": {- "operationId": "mineru_models_download_status_api_settings_mineru_models_download_status_get",+ },+ "put": {+ "operationId": "update_mineru_settings_api_settings_mineru_put","parameters": [- {- "in": "query",- "name": "cursor",- "required": false,- "schema": {- "default": 0,- "title": "Cursor",- "type": "integer"- }- },{"in": "header","name": "Authorization",@@ -43151,6 +43401,16 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/MinerUSettingsUpdate"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {@@ -43171,16 +43431,16 @@"description": "Validation Error"}},- "summary": "Mineru Models Download Status",+ "summary": "Update Mineru Settings","tags": ["settings"]}},- "/api/settings/mineru/test": {+ "/api/settings/mineru/models/download": {"post": {- "description": "Validate the active backend. ``mode == \"local\"`` checks the CLI install\n(PATH probe + ``--version``); cloud mode validates the token against the\nlive MinerU API (no parse quota consumed). Tests the draft form values so\nthe user can verify before saving; falls back to the stored token when the\nsecret field is untouched.",- "operationId": "test_mineru_connection_api_settings_mineru_test_post",+ "description": "Kick off a one-click model download via ``mineru-models-download``.\n\nReturns ``{ok, message}`` immediately; progress is polled via the status\nendpoint. Only one download runs at a time (process-wide singleton).",+ "operationId": "start_mineru_models_download_api_settings_mineru_models_download_post","parameters": [{"in": "header",@@ -43219,7 +43479,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/MinerUSettingsUpdate"+ "$ref": "#/components/schemas/MinerUModelDownloadPayload"}}},@@ -43245,16 +43505,15 @@"description": "Validation Error"}},- "summary": "Test Mineru Connection",+ "summary": "Start Mineru Models Download","tags": ["settings"]}},- "/api/settings/model-capabilities": {+ "/api/settings/mineru/models/download/cancel": {"post": {- "description": "What the built-in capability tables assume for one provider/model pair.\n\nThe settings UI shows these as the value \"Auto\" resolves to next to each\nper-model override, so a user can see what they are overriding.",- "operationId": "resolve_model_capabilities_api_settings_model_capabilities_post",+ "operationId": "cancel_mineru_models_download_api_settings_mineru_models_download_cancel_post","parameters": [{"in": "header",@@ -43289,16 +43548,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/ModelCapabilitiesQuery"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -43319,16 +43568,26 @@"description": "Validation Error"}},- "summary": "Resolve Model Capabilities",+ "summary": "Cancel Mineru Models Download","tags": ["settings"]}},- "/api/settings/network": {+ "/api/settings/mineru/models/download/status": {"get": {- "operationId": "get_network_settings_api_settings_network_get",+ "operationId": "mineru_models_download_status_api_settings_mineru_models_download_status_get","parameters": [+ {+ "in": "query",+ "name": "cursor",+ "required": false,+ "schema": {+ "default": 0,+ "title": "Cursor",+ "type": "integer"+ }+ },{"in": "header","name": "Authorization",@@ -43382,13 +43641,16 @@"description": "Validation Error"}},- "summary": "Get Network Settings",+ "summary": "Mineru Models Download Status","tags": ["settings"]- },- "put": {- "operationId": "update_network_settings_api_settings_network_put",+ }+ },+ "/api/settings/mineru/test": {+ "post": {+ "description": "Validate the active backend. ``mode == \"local\"`` checks the CLI install\n(PATH probe + ``--version``); cloud mode validates the token against the\nlive MinerU API (no parse quota consumed). Tests the draft form values so\nthe user can verify before saving; falls back to the stored token when the\nsecret field is untouched.",+ "operationId": "test_mineru_connection_api_settings_mineru_test_post","parameters": [{"in": "header",@@ -43427,7 +43689,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/NetworkSettingsUpdate"+ "$ref": "#/components/schemas/MinerUSettingsUpdate"}}},@@ -43453,15 +43715,16 @@"description": "Validation Error"}},- "summary": "Update Network Settings",+ "summary": "Test Mineru Connection","tags": ["settings"]}},- "/api/settings/providers/codebuddy/auth/cancel": {+ "/api/settings/model-capabilities": {"post": {- "operationId": "cancel_codebuddy_auth_api_settings_providers_codebuddy_auth_cancel_post",+ "description": "What the built-in capability tables assume for one provider/model pair.\n\nThe settings UI shows these as the value \"Auto\" resolves to next to each\nper-model override, so a user can see what they are overriding.",+ "operationId": "resolve_model_capabilities_api_settings_model_capabilities_post","parameters": [{"in": "header",@@ -43496,15 +43759,21 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ModelCapabilitiesQuery"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Cancel Codebuddy Auth Api Settings Providers Codebuddy Auth Cancel Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -43520,15 +43789,15 @@"description": "Validation Error"}},- "summary": "Cancel Codebuddy Auth",+ "summary": "Resolve Model Capabilities","tags": ["settings"]}},- "/api/settings/providers/codebuddy/auth/logout": {- "post": {- "operationId": "logout_codebuddy_auth_api_settings_providers_codebuddy_auth_logout_post",+ "/api/settings/network": {+ "get": {+ "operationId": "get_network_settings_api_settings_network_get","parameters": [{"in": "header",@@ -43567,11 +43836,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Logout Codebuddy Auth Api Settings Providers Codebuddy Auth Logout Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -43587,15 +43852,13 @@"description": "Validation Error"}},- "summary": "Logout Codebuddy Auth",+ "summary": "Get Network Settings","tags": ["settings"]- }- },- "/api/settings/providers/codebuddy/auth/start": {- "post": {- "operationId": "start_codebuddy_auth_api_settings_providers_codebuddy_auth_start_post",+ },+ "put": {+ "operationId": "update_network_settings_api_settings_network_put","parameters": [{"in": "header",@@ -43630,15 +43893,21 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/NetworkSettingsUpdate"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Start Codebuddy Auth Api Settings Providers Codebuddy Auth Start Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -43654,15 +43923,15 @@"description": "Validation Error"}},- "summary": "Start Codebuddy Auth",+ "summary": "Update Network Settings","tags": ["settings"]}},- "/api/settings/providers/codebuddy/auth/status": {- "get": {- "operationId": "get_codebuddy_auth_status_api_settings_providers_codebuddy_auth_status_get",+ "/api/settings/providers/codebuddy/auth/cancel": {+ "post": {+ "operationId": "cancel_codebuddy_auth_api_settings_providers_codebuddy_auth_cancel_post","parameters": [{"in": "header",@@ -43703,7 +43972,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Get Codebuddy Auth Status Api Settings Providers Codebuddy Auth Status Get",+ "title": "Response Cancel Codebuddy Auth Api Settings Providers Codebuddy Auth Cancel Post","type": "object"}}@@ -43721,15 +43990,15 @@"description": "Validation Error"}},- "summary": "Get Codebuddy Auth Status",+ "summary": "Cancel Codebuddy Auth","tags": ["settings"]}},- "/api/settings/providers/openai-codex/models/reasoning-effort": {+ "/api/settings/providers/codebuddy/auth/logout": {"post": {- "operationId": "update_openai_codex_reasoning_effort_api_settings_providers_openai_codex_models_reasoning_effort_post",+ "operationId": "logout_codebuddy_auth_api_settings_providers_codebuddy_auth_logout_post","parameters": [{"in": "header",@@ -43764,23 +44033,13 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CodexReasoningEffortUpdate"- }- }- },- "required": true- },"responses": {"200": {"content": {"application/json": {"schema": {"additionalProperties": true,- "title": "Response Update Openai Codex Reasoning Effort Api Settings Providers Openai Codex Models Reasoning Effort Post",+ "title": "Response Logout Codebuddy Auth Api Settings Providers Codebuddy Auth Logout Post","type": "object"}}@@ -43798,15 +44057,15 @@"description": "Validation Error"}},- "summary": "Update Openai Codex Reasoning Effort",+ "summary": "Logout Codebuddy Auth","tags": ["settings"]}},- "/api/settings/providers/openai-codex/models/refresh": {+ "/api/settings/providers/codebuddy/auth/start": {"post": {- "operationId": "refresh_openai_codex_models_api_settings_providers_openai_codex_models_refresh_post",+ "operationId": "start_codebuddy_auth_api_settings_providers_codebuddy_auth_start_post","parameters": [{"in": "header",@@ -43847,7 +44106,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Refresh Openai Codex Models Api Settings Providers Openai Codex Models Refresh Post",+ "title": "Response Start Codebuddy Auth Api Settings Providers Codebuddy Auth Start Post","type": "object"}}@@ -43865,15 +44124,15 @@"description": "Validation Error"}},- "summary": "Refresh Openai Codex Models",+ "summary": "Start Codebuddy Auth","tags": ["settings"]}},- "/api/settings/providers/openai-codex/oauth/cancel": {- "post": {- "operationId": "cancel_openai_codex_oauth_api_settings_providers_openai_codex_oauth_cancel_post",+ "/api/settings/providers/codebuddy/auth/status": {+ "get": {+ "operationId": "get_codebuddy_auth_status_api_settings_providers_codebuddy_auth_status_get","parameters": [{"in": "header",@@ -43914,7 +44173,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Cancel Openai Codex Oauth Api Settings Providers Openai Codex Oauth Cancel Post",+ "title": "Response Get Codebuddy Auth Status Api Settings Providers Codebuddy Auth Status Get","type": "object"}}@@ -43932,16 +44191,15 @@"description": "Validation Error"}},- "summary": "Cancel Openai Codex Oauth",+ "summary": "Get Codebuddy Auth Status","tags": ["settings"]}},- "/api/settings/providers/openai-codex/oauth/complete": {+ "/api/settings/providers/openai-codex/models/reasoning-effort": {"post": {- "description": "Finish a waiting Codex login from a callback address the user pasted.\n\nThe provider redirects the browser to a loopback listener. In Docker that\nlistener lives in the container and the published ports do not include it,\nso the browser shows a failed page while the sign-in waits forever\n(#1252). This is the way back in without a tunnel: the address is parsed\nfor its OAuth result and discarded, and the exchange is the same one the\nlistener would have driven.",- "operationId": "complete_openai_codex_oauth_api_settings_providers_openai_codex_oauth_complete_post",+ "operationId": "update_openai_codex_reasoning_effort_api_settings_providers_openai_codex_models_reasoning_effort_post","parameters": [{"in": "header",@@ -43980,7 +44238,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CodexOAuthCallbackPayload"+ "$ref": "#/components/schemas/CodexReasoningEffortUpdate"}}},@@ -43992,7 +44250,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Complete Openai Codex Oauth Api Settings Providers Openai Codex Oauth Complete Post",+ "title": "Response Update Openai Codex Reasoning Effort Api Settings Providers Openai Codex Models Reasoning Effort Post","type": "object"}}@@ -44010,15 +44268,15 @@"description": "Validation Error"}},- "summary": "Complete Openai Codex Oauth",+ "summary": "Update Openai Codex Reasoning Effort","tags": ["settings"]}},- "/api/settings/providers/openai-codex/oauth/logout": {+ "/api/settings/providers/openai-codex/models/refresh": {"post": {- "operationId": "logout_openai_codex_oauth_api_settings_providers_openai_codex_oauth_logout_post",+ "operationId": "refresh_openai_codex_models_api_settings_providers_openai_codex_models_refresh_post","parameters": [{"in": "header",@@ -44059,7 +44317,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Logout Openai Codex Oauth Api Settings Providers Openai Codex Oauth Logout Post",+ "title": "Response Refresh Openai Codex Models Api Settings Providers Openai Codex Models Refresh Post","type": "object"}}@@ -44077,15 +44335,15 @@"description": "Validation Error"}},- "summary": "Logout Openai Codex Oauth",+ "summary": "Refresh Openai Codex Models","tags": ["settings"]}},- "/api/settings/providers/openai-codex/oauth/start": {+ "/api/settings/providers/openai-codex/oauth/cancel": {"post": {- "operationId": "start_openai_codex_oauth_api_settings_providers_openai_codex_oauth_start_post",+ "operationId": "cancel_openai_codex_oauth_api_settings_providers_openai_codex_oauth_cancel_post","parameters": [{"in": "header",@@ -44126,7 +44384,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Start Openai Codex Oauth Api Settings Providers Openai Codex Oauth Start Post",+ "title": "Response Cancel Openai Codex Oauth Api Settings Providers Openai Codex Oauth Cancel Post","type": "object"}}@@ -44144,15 +44402,16 @@"description": "Validation Error"}},- "summary": "Start Openai Codex Oauth",+ "summary": "Cancel Openai Codex Oauth","tags": ["settings"]}},- "/api/settings/providers/openai-codex/oauth/status": {- "get": {- "operationId": "get_openai_codex_oauth_status_api_settings_providers_openai_codex_oauth_status_get",+ "/api/settings/providers/openai-codex/oauth/complete": {+ "post": {+ "description": "Finish a waiting Codex login from a callback address the user pasted.\n\nThe provider redirects the browser to a loopback listener. In Docker that\nlistener lives in the container and the published ports do not include it,\nso the browser shows a failed page while the sign-in waits forever\n(#1252). This is the way back in without a tunnel: the address is parsed\nfor its OAuth result and discarded, and the exchange is the same one the\nlistener would have driven.",+ "operationId": "complete_openai_codex_oauth_api_settings_providers_openai_codex_oauth_complete_post","parameters": [{"in": "header",@@ -44187,13 +44446,23 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CodexOAuthCallbackPayload"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {"schema": {"additionalProperties": true,- "title": "Response Get Openai Codex Oauth Status Api Settings Providers Openai Codex Oauth Status Get",+ "title": "Response Complete Openai Codex Oauth Api Settings Providers Openai Codex Oauth Complete Post","type": "object"}}@@ -44211,16 +44480,15 @@"description": "Validation Error"}},- "summary": "Get Openai Codex Oauth Status",+ "summary": "Complete Openai Codex Oauth","tags": ["settings"]}},- "/api/settings/readiness": {- "get": {- "description": "Return the value-free cross-setting capability readiness matrix.",- "operationId": "get_settings_readiness_api_settings_readiness_get",+ "/api/settings/providers/openai-codex/oauth/logout": {+ "post": {+ "operationId": "logout_openai_codex_oauth_api_settings_providers_openai_codex_oauth_logout_post","parameters": [{"in": "header",@@ -44259,7 +44527,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Logout Openai Codex Oauth Api Settings Providers Openai Codex Oauth Logout Post",+ "type": "object"+ }}},"description": "Successful Response"@@ -44275,15 +44547,15 @@"description": "Validation Error"}},- "summary": "Get Settings Readiness",+ "summary": "Logout Openai Codex Oauth","tags": ["settings"]}},- "/api/settings/reset": {+ "/api/settings/providers/openai-codex/oauth/start": {"post": {- "operationId": "reset_settings_api_settings_reset_post",+ "operationId": "start_openai_codex_oauth_api_settings_providers_openai_codex_oauth_start_post","parameters": [{"in": "header",@@ -44322,7 +44594,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Start Openai Codex Oauth Api Settings Providers Openai Codex Oauth Start Post",+ "type": "object"+ }}},"description": "Successful Response"@@ -44338,15 +44614,15 @@"description": "Validation Error"}},- "summary": "Reset Settings",+ "summary": "Start Openai Codex Oauth","tags": ["settings"]}},- "/api/settings/sidebar": {+ "/api/settings/providers/openai-codex/oauth/status": {"get": {- "operationId": "get_sidebar_settings_api_settings_sidebar_get",+ "operationId": "get_openai_codex_oauth_status_api_settings_providers_openai_codex_oauth_status_get","parameters": [{"in": "header",@@ -44385,7 +44661,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Get Openai Codex Oauth Status Api Settings Providers Openai Codex Oauth Status Get",+ "type": "object"+ }}},"description": "Successful Response"@@ -44401,15 +44681,16 @@"description": "Validation Error"}},- "summary": "Get Sidebar Settings",+ "summary": "Get Openai Codex Oauth Status","tags": ["settings"]}},- "/api/settings/sidebar/description": {- "put": {- "operationId": "update_sidebar_description_api_settings_sidebar_description_put",+ "/api/settings/readiness": {+ "get": {+ "description": "Return the value-free cross-setting capability readiness matrix.",+ "operationId": "get_settings_readiness_api_settings_readiness_get","parameters": [{"in": "header",@@ -44444,16 +44725,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/SidebarDescriptionUpdate"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -44474,15 +44745,15 @@"description": "Validation Error"}},- "summary": "Update Sidebar Description",+ "summary": "Get Settings Readiness","tags": ["settings"]}},- "/api/settings/sidebar/nav-order": {- "put": {- "operationId": "update_sidebar_nav_order_api_settings_sidebar_nav_order_put",+ "/api/settings/reset": {+ "post": {+ "operationId": "reset_settings_api_settings_reset_post","parameters": [{"in": "header",@@ -44517,16 +44788,69 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/SidebarNavOrderUpdate"+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}}- }+ },+ "description": "Successful Response"},- "required": true+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }},+ "summary": "Reset Settings",+ "tags": [+ "settings"+ ]+ }+ },+ "/api/settings/sidebar": {+ "get": {+ "operationId": "get_sidebar_settings_api_settings_sidebar_get",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],"responses": {"200": {"content": {@@ -44547,25 +44871,16 @@"description": "Validation Error"}},- "summary": "Update Sidebar Nav Order",+ "summary": "Get Sidebar Settings","tags": ["settings"]}},- "/api/settings/tests/{service}/start": {- "post": {- "operationId": "start_service_test_api_settings_tests__service__start_post",+ "/api/settings/sidebar/description": {+ "put": {+ "operationId": "update_sidebar_description_api_settings_sidebar_description_put","parameters": [- {- "in": "path",- "name": "service",- "required": true,- "schema": {- "title": "Service",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -44603,18 +44918,11 @@"content": {"application/json": {"schema": {- "anyOf": [- {- "$ref": "#/components/schemas/CatalogPayload"- },- {- "type": "null"- }- ],- "title": "Payload"+ "$ref": "#/components/schemas/SidebarDescriptionUpdate"}}- }+ },+ "required": true},"responses": {"200": {@@ -44636,34 +44944,16 @@"description": "Validation Error"}},- "summary": "Start Service Test",+ "summary": "Update Sidebar Description","tags": ["settings"]}},- "/api/settings/tests/{service}/{run_id}/cancel": {- "post": {- "operationId": "cancel_service_test_api_settings_tests__service___run_id__cancel_post",+ "/api/settings/sidebar/nav-order": {+ "put": {+ "operationId": "update_sidebar_nav_order_api_settings_sidebar_nav_order_put","parameters": [- {- "in": "path",- "name": "service",- "required": true,- "schema": {- "title": "Service",- "type": "string"- }- },- {- "in": "path",- "name": "run_id",- "required": true,- "schema": {- "title": "Run Id",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -44697,6 +44987,16 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SidebarNavOrderUpdate"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {@@ -44717,15 +45017,15 @@"description": "Validation Error"}},- "summary": "Cancel Service Test",+ "summary": "Update Sidebar Nav Order","tags": ["settings"]}},- "/api/settings/tests/{service}/{run_id}/events": {- "get": {- "operationId": "stream_service_test_events_api_settings_tests__service___run_id__events_get",+ "/api/settings/tests/{service}/start": {+ "post": {+ "operationId": "start_service_test_api_settings_tests__service__start_post","parameters": [{"in": "path",@@ -44736,15 +45036,6 @@"type": "string"}},- {- "in": "path",- "name": "run_id",- "required": true,- "schema": {- "title": "Run Id",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -44778,6 +45069,23 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/CatalogPayload"+ },+ {+ "type": "null"+ }+ ],+ "title": "Payload"+ }+ }+ }+ },"responses": {"200": {"content": {@@ -44798,16 +45106,34 @@"description": "Validation Error"}},- "summary": "Stream Service Test Events",+ "summary": "Start Service Test","tags": ["settings"]}},- "/api/settings/theme": {- "put": {- "operationId": "update_theme_api_settings_theme_put",+ "/api/settings/tests/{service}/{run_id}/cancel": {+ "post": {+ "operationId": "cancel_service_test_api_settings_tests__service___run_id__cancel_post","parameters": [+ {+ "in": "path",+ "name": "service",+ "required": true,+ "schema": {+ "title": "Service",+ "type": "string"+ }+ },+ {+ "in": "path",+ "name": "run_id",+ "required": true,+ "schema": {+ "title": "Run Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -44841,16 +45167,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/ThemeUpdate"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -44871,16 +45187,34 @@"description": "Validation Error"}},- "summary": "Update Theme",+ "summary": "Cancel Service Test","tags": ["settings"]}},- "/api/settings/themes": {+ "/api/settings/tests/{service}/{run_id}/events": {"get": {- "operationId": "get_themes_api_settings_themes_get",+ "operationId": "stream_service_test_events_api_settings_tests__service___run_id__events_get","parameters": [+ {+ "in": "path",+ "name": "service",+ "required": true,+ "schema": {+ "title": "Service",+ "type": "string"+ }+ },+ {+ "in": "path",+ "name": "run_id",+ "required": true,+ "schema": {+ "title": "Run Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -44934,15 +45268,15 @@"description": "Validation Error"}},- "summary": "Get Themes",+ "summary": "Stream Service Test Events","tags": ["settings"]}},- "/api/settings/tour/complete": {- "post": {- "operationId": "complete_tour_api_settings_tour_complete_post",+ "/api/settings/theme": {+ "put": {+ "operationId": "update_theme_api_settings_theme_put","parameters": [{"in": "header",@@ -44981,18 +45315,11 @@"content": {"application/json": {"schema": {- "anyOf": [- {- "$ref": "#/components/schemas/TourCompletePayload"- },- {- "type": "null"- }- ],- "title": "Payload"+ "$ref": "#/components/schemas/ThemeUpdate"}}- }+ },+ "required": true},"responses": {"200": {@@ -45014,15 +45341,15 @@"description": "Validation Error"}},- "summary": "Complete Tour",+ "summary": "Update Theme","tags": ["settings"]}},- "/api/settings/tour/reopen": {- "post": {- "operationId": "reopen_tour_api_settings_tour_reopen_post",+ "/api/settings/themes": {+ "get": {+ "operationId": "get_themes_api_settings_themes_get","parameters": [{"in": "header",@@ -45077,15 +45404,15 @@"description": "Validation Error"}},- "summary": "Reopen Tour",+ "summary": "Get Themes","tags": ["settings"]}},- "/api/settings/tour/status": {- "get": {- "operationId": "tour_status_api_settings_tour_status_get",+ "/api/settings/tour/complete": {+ "post": {+ "operationId": "complete_tour_api_settings_tour_complete_post","parameters": [{"in": "header",@@ -45120,6 +45447,23 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/TourCompletePayload"+ },+ {+ "type": "null"+ }+ ],+ "title": "Payload"+ }+ }+ }+ },"responses": {"200": {"content": {@@ -45140,34 +45484,15 @@"description": "Validation Error"}},- "summary": "Tour Status",+ "summary": "Complete Tour","tags": ["settings"]}},- "/api/settings/ui": {- "get": {- "description": "Return the pre-session UI preferences: theme and the two languages.\n\nPublic by design, which is why it is a narrow projection rather than the\nsaved ``ui`` blob. The app shell — and the statically prerendered auth\npages, which have no session at all — adopt the persisted languages here\nduring bootstrap. Theme rides along so those pages can paint in the right\none instead of flashing.\n\nEverything else under ``ui`` (sidebar_nav_order, enabled_optional_tools,\nchat_response_timeout, …) describes what the deployment has turned on, so\nit stays behind auth: read it from the ``ui`` key of GET /settings.",- "operationId": "get_ui_settings_api_settings_ui_get",- "responses": {- "200": {- "content": {- "application/json": {- "schema": {}- }- },- "description": "Successful Response"- }- },- "summary": "Get Ui Settings",- "tags": [- "settings"- ]- },- "put": {- "description": "Merge frontend partial update into current UI settings.\n\nUses exclude_unset=True semantics so that only fields explicitly provided\nby the frontend override saved values. Fields not in the frontend payload\n(even if they equal the model defaults) are omitted from the merge.",- "operationId": "update_ui_settings_api_settings_ui_put",+ "/api/settings/tour/reopen": {+ "post": {+ "operationId": "reopen_tour_api_settings_tour_reopen_post","parameters": [{"in": "header",@@ -45202,16 +45527,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/UISettingsUpdate"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -45232,15 +45547,170 @@"description": "Validation Error"}},- "summary": "Update Ui Settings",+ "summary": "Reopen Tour","tags": ["settings"]}},- "/api/settings/video-learning": {+ "/api/settings/tour/status": {"get": {- "operationId": "get_video_learning_settings_api_settings_video_learning_get",+ "operationId": "tour_status_api_settings_tour_status_get",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Tour Status",+ "tags": [+ "settings"+ ]+ }+ },+ "/api/settings/ui": {+ "get": {+ "description": "Return the pre-session UI preferences: theme and the two languages.\n\nPublic by design, which is why it is a narrow projection rather than the\nsaved ``ui`` blob. The app shell — and the statically prerendered auth\npages, which have no session at all — adopt the persisted languages here\nduring bootstrap. Theme rides along so those pages can paint in the right\none instead of flashing.\n\nEverything else under ``ui`` (sidebar_nav_order, enabled_optional_tools,\nchat_response_timeout, …) describes what the deployment has turned on, so\nit stays behind auth: read it from the ``ui`` key of GET /settings.",+ "operationId": "get_ui_settings_api_settings_ui_get",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"+ }+ },+ "summary": "Get Ui Settings",+ "tags": [+ "settings"+ ]+ },+ "put": {+ "description": "Merge frontend partial update into current UI settings.\n\nUses exclude_unset=True semantics so that only fields explicitly provided\nby the frontend override saved values. Fields not in the frontend payload\n(even if they equal the model defaults) are omitted from the merge.",+ "operationId": "update_ui_settings_api_settings_ui_put",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UISettingsUpdate"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Update Ui Settings",+ "tags": [+ "settings"+ ]+ }+ },+ "/api/settings/video-learning": {+ "get": {+ "operationId": "get_video_learning_settings_api_settings_video_learning_get","parameters": [{"in": "header",@@ -47492,7 +47962,331 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response List Servers Api Space Mcp Servers Get",+ "title": "Response List Servers Api Space Mcp Servers Get",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "List Servers",+ "tags": [+ "space-mcp"+ ]+ }+ },+ "/api/space/mcp/servers/{name}": {+ "delete": {+ "operationId": "remove_server_api_space_mcp_servers__name__delete",+ "parameters": [+ {+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "title": "Name",+ "type": "string"+ }+ },+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Remove Server Api Space Mcp Servers Name Delete",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Remove Server",+ "tags": [+ "space-mcp"+ ]+ },+ "put": {+ "operationId": "upsert_server_api_space_mcp_servers__name__put",+ "parameters": [+ {+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "title": "Name",+ "type": "string"+ }+ },+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ServerPayload"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Upsert Server Api Space Mcp Servers Name Put",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Upsert Server",+ "tags": [+ "space-mcp"+ ]+ }+ },+ "/api/space/mcp/servers/{name}/authorize": {+ "post": {+ "description": "Begin an OAuth consent for one of the caller's servers.\n\nReturns the URL to send the person to. This is the **only** place a flow may\nstart: a background reconnect has nobody in front of it, so it reports\n``needs_auth`` and waits for someone to click.",+ "operationId": "authorize_server_api_space_mcp_servers__name__authorize_post",+ "parameters": [+ {+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "title": "Name",+ "type": "string"+ }+ },+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Authorize Server Api Space Mcp Servers Name Authorize Post",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Authorize Server",+ "tags": [+ "space-mcp"+ ]+ }+ },+ "/api/space/mcp/servers/{name}/test": {+ "post": {+ "description": "Probe a definition before saving it.\n\nRuns under the caller's own owner id so the probe obeys the same address\npolicy and redirect rule the real connection will — a Test more permissive\nthan the connection it previews is worse than no Test at all.\n\nDeliberately side-effect free: nothing is written, so the incoming config is\nprobed as given (any literal credential in it is used in memory only). That\nalso means a caller may probe under a scratch name the store would refuse,\nwhich is how the UI tests a draft before it has one.",+ "operationId": "test_server_api_space_mcp_servers__name__test_post",+ "parameters": [+ {+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "title": "Name",+ "type": "string"+ }+ },+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ServerPayload"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Test Server Api Space Mcp Servers Name Test Post","type": "object"}}@@ -47510,22 +48304,87 @@"description": "Validation Error"}},- "summary": "List Servers",+ "summary": "Test Server","tags": ["space-mcp"]}},- "/api/space/mcp/servers/{name}": {- "delete": {- "operationId": "remove_server_api_space_mcp_servers__name__delete",+ "/api/subagents/backends/options": {+ "get": {+ "description": "Synced model + reasoning-effort options per backend (settings page sync).",+ "operationId": "backend_options_api_subagents_backends_options_get",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Backend Options",+ "tags": [+ "subagents"+ ]+ }+ },+ "/api/subagents/backends/{kind}/sync": {+ "post": {+ "description": "Re-pull one backend's model catalog (the settings \"sync\" button).\n\nFor Claude Code this scrapes its ``/model`` TUI live and caches the result;\nfor Codex it re-reads the CLI-maintained cache.",+ "operationId": "sync_backend_api_subagents_backends__kind__sync_post","parameters": [{"in": "path",- "name": "name",+ "name": "kind","required": true,"schema": {- "title": "Name",+ "title": "Kind","type": "string"}},@@ -47566,11 +48425,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Remove Server Api Space Mcp Servers Name Delete",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -47586,23 +48441,79 @@"description": "Validation Error"}},- "summary": "Remove Server",+ "summary": "Sync Backend","tags": [- "space-mcp"+ "subagents"]- },- "put": {- "operationId": "upsert_server_api_space_mcp_servers__name__put",+ }+ },+ "/api/subagents/connections": {+ "get": {+ "description": "List the current user's connected subagents.",+ "operationId": "list_connections_api_subagents_connections_get","parameters": [{- "in": "path",- "name": "name",- "required": true,+ "in": "header",+ "name": "Authorization",+ "required": false,"schema": {- "title": "Name",- "type": "string"+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"}+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"},+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "List Connections",+ "tags": [+ "subagents"+ ]+ },+ "post": {+ "description": "Connect a local, remote, or Partner subagent as a selectable KB.\n\nA partner connection (``agent_kind == \"partner\"``) binds a ``partner_id``\ninstead of a working directory: consulting it opens a fresh session on that\npartner, exactly as if the user started one from the partner page. Every\nconsult within one DeepTutor chat lands in that one partner session.",+ "operationId": "create_connection_api_subagents_connections_post",+ "parameters": [{"in": "header","name": "Authorization",@@ -47640,7 +48551,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ServerPayload"+ "$ref": "#/components/schemas/ConnectSubagentRequest"}}},@@ -47650,11 +48561,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Upsert Server Api Space Mcp Servers Name Put",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -47670,16 +48577,16 @@"description": "Validation Error"}},- "summary": "Upsert Server",+ "summary": "Create Connection","tags": [- "space-mcp"+ "subagents"]}},- "/api/space/mcp/servers/{name}/authorize": {- "post": {- "description": "Begin an OAuth consent for one of the caller's servers.\n\nReturns the URL to send the person to. This is the **only** place a flow may\nstart: a background reconnect has nobody in front of it, so it reports\n``needs_auth`` and waits for someone to click.",- "operationId": "authorize_server_api_space_mcp_servers__name__authorize_post",+ "/api/subagents/connections/{name}": {+ "delete": {+ "description": "Disconnect a subagent (removes the pointer KB; touches no files).",+ "operationId": "delete_connection_api_subagents_connections__name__delete","parameters": [{"in": "path",@@ -47727,11 +48634,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Authorize Server Api Space Mcp Servers Name Authorize Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -47747,16 +48650,16 @@"description": "Validation Error"}},- "summary": "Authorize Server",+ "summary": "Delete Connection","tags": [- "space-mcp"+ "subagents"]}},- "/api/space/mcp/servers/{name}/test": {+ "/api/subagents/connections/{name}/message": {"post": {- "description": "Probe a definition before saving it.\n\nRuns under the caller's own owner id so the probe obeys the same address\npolicy and redirect rule the real connection will — a Test more permissive\nthan the connection it previews is worse than no Test at all.\n\nDeliberately side-effect free: nothing is written, so the incoming config is\nprobed as given (any literal credential in it is used in memory only). That\nalso means a caller may probe under a scratch name the store would refuse,\nwhich is how the UI tests a draft before it has one.",- "operationId": "test_server_api_space_mcp_servers__name__test_post",+ "description": "Send a message straight to a connected subagent and stream its run.\n\nThis is the sidebar's \"talk to the agent directly\" path: it resumes the same\nlive session DeepTutor consults (shared via the cross-turn registry, keyed by\nchat session + connection), so the agent keeps full context. Streams the\nnative run as newline-delimited JSON, in the same channel shape the chat WS\nuses, so the sidebar transcript renders it identically.",+ "operationId": "message_connection_api_subagents_connections__name__message_post","parameters": [{"in": "path",@@ -47804,7 +48707,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ServerPayload"+ "$ref": "#/components/schemas/SubagentMessageRequest"}}},@@ -47814,11 +48717,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Test Server Api Space Mcp Servers Name Test Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -47834,16 +48733,16 @@"description": "Validation Error"}},- "summary": "Test Server",+ "summary": "Message Connection","tags": [- "space-mcp"+ "subagents"]}},- "/api/subagents/backends/options": {+ "/api/subagents/detect": {"get": {- "description": "Synced model + reasoning-effort options per backend (settings page sync).",- "operationId": "backend_options_api_subagents_backends_options_get",+ "description": "Report which local and remote agent backends are usable.",+ "operationId": "detect_subagents_api_subagents_detect_get","parameters": [{"in": "header",@@ -47898,26 +48797,17 @@"description": "Validation Error"}},- "summary": "Backend Options",+ "summary": "Detect Subagents","tags": ["subagents"]}},- "/api/subagents/backends/{kind}/sync": {- "post": {- "description": "Re-pull one backend's model catalog (the settings \"sync\" button).\n\nFor Claude Code this scrapes its ``/model`` TUI live and caches the result;\nfor Codex it re-reads the CLI-maintained cache.",- "operationId": "sync_backend_api_subagents_backends__kind__sync_post",+ "/api/subagents/partners": {+ "get": {+ "description": "Partners the current user can connect & consult.\n\nReturns every partner for an admin, or just the ones an admin has assigned\nfor a non-admin. The partner CRUD API (``/api/partners``) stays fully\nadmin-gated; this is the read surface the connect flow and the partner list\npage use, so a non-admin sees their assigned partners without a 403.",+ "operationId": "list_visible_partners_api_subagents_partners_get","parameters": [- {- "in": "path",- "name": "kind",- "required": true,- "schema": {- "title": "Kind",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -47971,16 +48861,16 @@"description": "Validation Error"}},- "summary": "Sync Backend",+ "summary": "List Visible Partners","tags": ["subagents"]}},- "/api/subagents/connections": {+ "/api/subagents/settings": {"get": {- "description": "List the current user's connected subagents.",- "operationId": "list_connections_api_subagents_connections_get",+ "description": "Read the consult budget and per-backend run config.",+ "operationId": "get_settings_api_subagents_settings_get","parameters": [{"in": "header",@@ -48035,14 +48925,14 @@"description": "Validation Error"}},- "summary": "List Connections",+ "summary": "Get Settings","tags": ["subagents"]},- "post": {- "description": "Connect a local, remote, or Partner subagent as a selectable KB.\n\nA partner connection (``agent_kind == \"partner\"``) binds a ``partner_id``\ninstead of a working directory: consulting it opens a fresh session on that\npartner, exactly as if the user started one from the partner page. Every\nconsult within one DeepTutor chat lands in that one partner session.",- "operationId": "create_connection_api_subagents_connections_post",+ "put": {+ "description": "Update the subagent settings (admin-gated; deployment-wide).",+ "operationId": "update_settings_api_subagents_settings_put","parameters": [{"in": "header",@@ -48081,7 +48971,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ConnectSubagentRequest"+ "$ref": "#/components/schemas/SubagentSettingsPayload"}}},@@ -48107,26 +48997,17 @@"description": "Validation Error"}},- "summary": "Create Connection",+ "summary": "Update Settings","tags": ["subagents"]}},- "/api/subagents/connections/{name}": {- "delete": {- "description": "Disconnect a subagent (removes the pointer KB; touches no files).",- "operationId": "delete_connection_api_subagents_connections__name__delete",+ "/api/system/memory": {+ "get": {+ "description": "Resident memory of the running DeepTutor process tree.\n\nDeliberately separate from ``/status``: that snapshot resolves the LLM,\nembedding and search configs and is fetched once per settings mount, while\nthis one is cheap enough for the status strip to poll.\n\nAdmin-only, for the same reason ``/status`` strips model names from\nnon-admins — process composition and host memory are operational detail a\ntenant has no need for.",+ "operationId": "get_memory_usage_api_system_memory_get","parameters": [- {- "in": "path",- "name": "name",- "required": true,- "schema": {- "title": "Name",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -48180,26 +49061,17 @@"description": "Validation Error"}},- "summary": "Delete Connection",+ "summary": "Get Memory Usage","tags": [- "subagents"+ "system"]}},- "/api/subagents/connections/{name}/message": {- "post": {- "description": "Send a message straight to a connected subagent and stream its run.\n\nThis is the sidebar's \"talk to the agent directly\" path: it resumes the same\nlive session DeepTutor consults (shared via the cross-turn registry, keyed by\nchat session + connection), so the agent keeps full context. Streams the\nnative run as newline-delimited JSON, in the same channel shape the chat WS\nuses, so the sidebar transcript renders it identically.",- "operationId": "message_connection_api_subagents_connections__name__message_post",+ "/api/system/runtime": {+ "get": {+ "description": "Return credential-free coordination and worker diagnostics.",+ "operationId": "get_runtime_status_api_system_runtime_get","parameters": [- {- "in": "path",- "name": "name",- "required": true,- "schema": {- "title": "Name",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -48233,21 +49105,13 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/SubagentMessageRequest"- }- }- },- "required": true- },"responses": {"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "$ref": "#/components/schemas/RuntimeStatus"+ }}},"description": "Successful Response"@@ -48263,16 +49127,16 @@"description": "Validation Error"}},- "summary": "Message Connection",+ "summary": "Get Runtime Status","tags": [- "subagents"+ "system"]}},- "/api/subagents/detect": {+ "/api/system/status": {"get": {- "description": "Report which local and remote agent backends are usable.",- "operationId": "detect_subagents_api_subagents_detect_get",+ "description": "Get overall system status including backend and model configurations\n\nReturns:\n Dictionary containing status of backend, LLM, embeddings, and search",+ "operationId": "get_system_status_api_system_status_get","parameters": [{"in": "header",@@ -48327,16 +49191,16 @@"description": "Validation Error"}},- "summary": "Detect Subagents",+ "summary": "Get System Status","tags": [- "subagents"+ "system"]}},- "/api/subagents/partners": {- "get": {- "description": "Partners the current user can connect & consult.\n\nReturns every partner for an admin, or just the ones an admin has assigned\nfor a non-admin. The partner CRUD API (``/api/partners``) stays fully\nadmin-gated; this is the read surface the connect flow and the partner list\npage use, so a non-admin sees their assigned partners without a 403.",- "operationId": "list_visible_partners_api_subagents_partners_get",+ "/api/system/test/embeddings": {+ "post": {+ "description": "Test Embeddings model connection by sending a simple embedding request\n\nReturns:\n Test result with success status and response time",+ "operationId": "test_embeddings_connection_api_system_test_embeddings_post","parameters": [{"in": "header",@@ -48375,7 +49239,9 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "$ref": "#/components/schemas/TestResponse"+ }}},"description": "Successful Response"@@ -48391,16 +49257,16 @@"description": "Validation Error"}},- "summary": "List Visible Partners",+ "summary": "Test Embeddings Connection","tags": [- "subagents"+ "system"]}},- "/api/subagents/settings": {- "get": {- "description": "Read the consult budget and per-backend run config.",- "operationId": "get_settings_api_subagents_settings_get",+ "/api/system/test/llm": {+ "post": {+ "description": "Test LLM model connection by sending a simple completion request\n\nReturns:\n Test result with success status and response time",+ "operationId": "test_llm_connection_api_system_test_llm_post","parameters": [{"in": "header",@@ -48439,7 +49305,9 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "$ref": "#/components/schemas/TestResponse"+ }}},"description": "Successful Response"@@ -48455,14 +49323,15 @@"description": "Validation Error"}},- "summary": "Get Settings",+ "summary": "Test Llm Connection","tags": [- "subagents"+ "system"]- },- "put": {- "description": "Update the subagent settings (admin-gated; deployment-wide).",- "operationId": "update_settings_api_subagents_settings_put",+ }+ },+ "/api/system/test/search": {+ "post": {+ "operationId": "test_search_connection_api_system_test_search_post","parameters": [{"in": "header",@@ -48497,21 +49366,13 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/SubagentSettingsPayload"- }- }- },- "required": true- },"responses": {"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "$ref": "#/components/schemas/TestResponse"+ }}},"description": "Successful Response"@@ -48527,16 +49388,16 @@"description": "Validation Error"}},- "summary": "Update Settings",+ "summary": "Test Search Connection","tags": [- "subagents"+ "system"]}},- "/api/system/memory": {+ "/api/system/update": {"get": {- "description": "Resident memory of the running DeepTutor process tree.\n\nDeliberately separate from ``/status``: that snapshot resolves the LLM,\nembedding and search configs and is fetched once per settings mount, while\nthis one is cheap enough for the status strip to poll.\n\nAdmin-only, for the same reason ``/status`` strips model names from\nnon-admins — process composition and host memory are operational detail a\ntenant has no need for.",- "operationId": "get_memory_usage_api_system_memory_get",+ "description": "Return About-page version state, checking at most once per 24 hours.",+ "operationId": "get_update_status_api_system_update_get","parameters": [{"in": "header",@@ -48575,7 +49436,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Get Update Status Api System Update Get",+ "type": "object"+ }}},"description": "Successful Response"@@ -48591,16 +49456,92 @@"description": "Validation Error"}},- "summary": "Get Memory Usage",+ "summary": "Get Update Status",+ "tags": [+ "system"+ ]+ },+ "post": {+ "description": "Reserve one safe update for the supervising launcher to apply.",+ "operationId": "request_managed_update_api_system_update_post",+ "parameters": [+ {+ "in": "header",+ "name": "Authorization",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ManagedUpdateRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "202": {+ "content": {+ "application/json": {+ "schema": {+ "additionalProperties": true,+ "title": "Response Request Managed Update Api System Update Post",+ "type": "object"+ }+ }+ },+ "description": "Successful Response"+ },+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Request Managed Update","tags": ["system"]}},- "/api/system/runtime": {- "get": {- "description": "Return credential-free coordination and worker diagnostics.",- "operationId": "get_runtime_status_api_system_runtime_get",+ "/api/system/update/check": {+ "post": {+ "description": "Perform an explicit administrator-requested release check.",+ "operationId": "check_for_update_api_system_update_check_post","parameters": [{"in": "header",@@ -48640,7 +49581,9 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/RuntimeStatus"+ "additionalProperties": true,+ "title": "Response Check For Update Api System Update Check Post",+ "type": "object"}}},@@ -48657,16 +49600,15 @@"description": "Validation Error"}},- "summary": "Get Runtime Status",+ "summary": "Check For Update","tags": ["system"]}},- "/api/system/status": {+ "/api/system/update/job": {"get": {- "description": "Get overall system status including backend and model configurations\n\nReturns:\n Dictionary containing status of backend, LLM, embeddings, and search",- "operationId": "get_system_status_api_system_status_get",+ "operationId": "get_update_job_api_system_update_job_get","parameters": [{"in": "header",@@ -48705,7 +49647,18 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Response Get Update Job Api System Update Job Get"+ }}},"description": "Successful Response"@@ -48721,16 +49674,15 @@"description": "Validation Error"}},- "summary": "Get System Status",+ "summary": "Get Update Job","tags": ["system"]}},- "/api/system/test/embeddings": {- "post": {- "description": "Test Embeddings model connection by sending a simple embedding request\n\nReturns:\n Test result with success status and response time",- "operationId": "test_embeddings_connection_api_system_test_embeddings_post",+ "/api/system/update/settings": {+ "put": {+ "operationId": "update_check_settings_api_system_update_settings_put","parameters": [{"in": "header",@@ -48765,12 +49717,24 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateSettingsRequest"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TestResponse"+ "additionalProperties": true,+ "title": "Response Update Check Settings Api System Update Settings Put",+ "type": "object"}}},@@ -48787,16 +49751,16 @@"description": "Validation Error"}},- "summary": "Test Embeddings Connection",+ "summary": "Update Check Settings","tags": ["system"]}},- "/api/system/test/llm": {- "post": {- "description": "Test LLM model connection by sending a simple completion request\n\nReturns:\n Test result with success status and response time",- "operationId": "test_llm_connection_api_system_test_llm_post",+ "/api/tools": {+ "get": {+ "description": "Return all built-in tools the chat agent can invoke, plus any\ncoming-soon placeholders for the settings page.",+ "operationId": "list_builtin_tools_api_tools_get","parameters": [{"in": "header",@@ -48836,7 +49800,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TestResponse"+ "$ref": "#/components/schemas/ToolsListResponse"}}},@@ -48853,15 +49817,15 @@"description": "Validation Error"}},- "summary": "Test Llm Connection",+ "summary": "List Builtin Tools","tags": [- "system"+ "tools"]}},- "/api/system/test/search": {+ "/api/video-learning/invidious/account/authorize": {"post": {- "operationId": "test_search_connection_api_system_test_search_post",+ "operationId": "authorize_invidious_account_api_video_learning_invidious_account_authorize_post","parameters": [{"in": "header",@@ -48901,7 +49865,11 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TestResponse"+ "additionalProperties": {+ "type": "string"+ },+ "title": "Response Authorize Invidious Account Api Video Learning Invidious Account Authorize Post",+ "type": "object"}}},@@ -48918,17 +49886,36 @@"description": "Validation Error"}},- "summary": "Test Search Connection",+ "summary": "Authorize Invidious Account","tags": [- "system"+ "video-learning"]}},- "/api/system/update": {+ "/api/video-learning/invidious/account/callback": {"get": {- "description": "Return About-page version state, checking at most once per 24 hours.",- "operationId": "get_update_status_api_system_update_get",+ "operationId": "invidious_account_callback_api_video_learning_invidious_account_callback_get","parameters": [+ {+ "in": "query",+ "name": "token",+ "required": false,+ "schema": {+ "default": "",+ "title": "Token",+ "type": "string"+ }+ },+ {+ "in": "query",+ "name": "state",+ "required": false,+ "schema": {+ "default": "",+ "title": "State",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -48966,11 +49953,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Get Update Status Api System Update Get",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -48986,14 +49969,15 @@"description": "Validation Error"}},- "summary": "Get Update Status",+ "summary": "Invidious Account Callback","tags": [- "system"+ "video-learning"]- },+ }+ },+ "/api/video-learning/invidious/account/disconnect": {"post": {- "description": "Reserve one safe update for the supervising launcher to apply.",- "operationId": "request_managed_update_api_system_update_post",+ "operationId": "disconnect_invidious_account_api_video_learning_invidious_account_disconnect_post","parameters": [{"in": "header",@@ -49028,23 +50012,13 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/ManagedUpdateRequest"- }- }- },- "required": true- },"responses": {- "202": {+ "200": {"content": {"application/json": {"schema": {"additionalProperties": true,- "title": "Response Request Managed Update Api System Update Post",+ "title": "Response Disconnect Invidious Account Api Video Learning Invidious Account Disconnect Post","type": "object"}}@@ -49062,16 +50036,15 @@"description": "Validation Error"}},- "summary": "Request Managed Update",+ "summary": "Disconnect Invidious Account","tags": [- "system"+ "video-learning"]}},- "/api/system/update/check": {- "post": {- "description": "Perform an explicit administrator-requested release check.",- "operationId": "check_for_update_api_system_update_check_post",+ "/api/video-learning/invidious/account/status": {+ "get": {+ "operationId": "get_invidious_account_status_api_video_learning_invidious_account_status_get","parameters": [{"in": "header",@@ -49112,7 +50085,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Check For Update Api System Update Check Post",+ "title": "Response Get Invidious Account Status Api Video Learning Invidious Account Status Get","type": "object"}}@@ -49130,16 +50103,59 @@"description": "Validation Error"}},- "summary": "Check For Update",+ "summary": "Get Invidious Account Status","tags": [- "system"+ "video-learning"]}},- "/api/system/update/job": {+ "/api/video-learning/invidious/browse/{kind}": {"get": {- "operationId": "get_update_job_api_system_update_job_get",+ "operationId": "browse_invidious_api_video_learning_invidious_browse__kind__get","parameters": [+ {+ "in": "path",+ "name": "kind",+ "required": true,+ "schema": {+ "title": "Kind",+ "type": "string"+ }+ },+ {+ "in": "query",+ "name": "q",+ "required": false,+ "schema": {+ "default": "",+ "maxLength": 500,+ "title": "Q",+ "type": "string"+ }+ },+ {+ "in": "query",+ "name": "page",+ "required": false,+ "schema": {+ "default": 1,+ "maximum": 1000,+ "minimum": 1,+ "title": "Page",+ "type": "integer"+ }+ },+ {+ "in": "query",+ "name": "playlist_id",+ "required": false,+ "schema": {+ "default": "",+ "maxLength": 100,+ "title": "Playlist Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49177,18 +50193,7 @@"200": {"content": {"application/json": {- "schema": {- "anyOf": [- {- "additionalProperties": true,- "type": "object"- },- {- "type": "null"- }- ],- "title": "Response Get Update Job Api System Update Job Get"- }+ "schema": {}}},"description": "Successful Response"@@ -49204,15 +50209,15 @@"description": "Validation Error"}},- "summary": "Get Update Job",+ "summary": "Browse Invidious","tags": [- "system"+ "video-learning"]}},- "/api/system/update/settings": {- "put": {- "operationId": "update_check_settings_api_system_update_settings_put",+ "/api/video-learning/materials/resolve": {+ "post": {+ "operationId": "resolve_video_api_video_learning_materials_resolve_post","parameters": [{"in": "header",@@ -49251,7 +50256,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateSettingsRequest"+ "$ref": "#/components/schemas/ResolveRequest"}}},@@ -49263,7 +50268,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Update Check Settings Api System Update Settings Put",+ "title": "Response Resolve Video Api Video Learning Materials Resolve Post","type": "object"}}@@ -49281,17 +50286,25 @@"description": "Validation Error"}},- "summary": "Update Check Settings",+ "summary": "Resolve Video","tags": [- "system"+ "video-learning"]}},- "/api/tools": {+ "/api/video-learning/materials/{material_id}": {"get": {- "description": "Return all built-in tools the chat agent can invoke, plus any\ncoming-soon placeholders for the settings page.",- "operationId": "list_builtin_tools_api_tools_get",+ "operationId": "get_video_material_api_video_learning_materials__material_id__get","parameters": [+ {+ "in": "path",+ "name": "material_id",+ "required": true,+ "schema": {+ "title": "Material Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49330,7 +50343,9 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ToolsListResponse"+ "additionalProperties": true,+ "title": "Response Get Video Material Api Video Learning Materials Material Id Get",+ "type": "object"}}},@@ -49347,16 +50362,25 @@"description": "Validation Error"}},- "summary": "List Builtin Tools",+ "summary": "Get Video Material","tags": [- "tools"+ "video-learning"]}},- "/api/video-learning/invidious/account/authorize": {- "post": {- "operationId": "authorize_invidious_account_api_video_learning_invidious_account_authorize_post",+ "/api/video-learning/materials/{material_id}/notes": {+ "get": {+ "operationId": "list_video_notes_api_video_learning_materials__material_id__notes_get","parameters": [+ {+ "in": "path",+ "name": "material_id",+ "required": true,+ "schema": {+ "title": "Material Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49395,11 +50419,12 @@"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "string"+ "items": {+ "additionalProperties": true,+ "type": "object"},- "title": "Response Authorize Invidious Account Api Video Learning Invidious Account Authorize Post",- "type": "object"+ "title": "Response List Video Notes Api Video Learning Materials Material Id Notes Get",+ "type": "array"}}},@@ -49416,33 +50441,20 @@"description": "Validation Error"}},- "summary": "Authorize Invidious Account",+ "summary": "List Video Notes","tags": ["video-learning"]- }- },- "/api/video-learning/invidious/account/callback": {- "get": {- "operationId": "invidious_account_callback_api_video_learning_invidious_account_callback_get",+ },+ "post": {+ "operationId": "create_video_note_api_video_learning_materials__material_id__notes_post","parameters": [{- "in": "query",- "name": "token",- "required": false,- "schema": {- "default": "",- "title": "Token",- "type": "string"- }- },- {- "in": "query",- "name": "state",- "required": false,+ "in": "path",+ "name": "material_id",+ "required": true,"schema": {- "default": "",- "title": "State",+ "title": "Material Id","type": "string"}},@@ -49479,11 +50491,25 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateVideoNoteRequest"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Create Video Note Api Video Learning Materials Material Id Notes Post",+ "type": "object"+ }}},"description": "Successful Response"@@ -49499,16 +50525,25 @@"description": "Validation Error"}},- "summary": "Invidious Account Callback",+ "summary": "Create Video Note","tags": ["video-learning"]}},- "/api/video-learning/invidious/account/disconnect": {- "post": {- "operationId": "disconnect_invidious_account_api_video_learning_invidious_account_disconnect_post",+ "/api/video-learning/materials/{material_id}/notes.md": {+ "get": {+ "operationId": "export_video_notes_api_video_learning_materials__material_id__notes_md_get","parameters": [+ {+ "in": "path",+ "name": "material_id",+ "required": true,+ "schema": {+ "title": "Material Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49546,11 +50581,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Disconnect Invidious Account Api Video Learning Invidious Account Disconnect Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -49566,16 +50597,34 @@"description": "Validation Error"}},- "summary": "Disconnect Invidious Account",+ "summary": "Export Video Notes","tags": ["video-learning"]}},- "/api/video-learning/invidious/account/status": {- "get": {- "operationId": "get_invidious_account_status_api_video_learning_invidious_account_status_get",+ "/api/video-learning/materials/{material_id}/notes/{note_id}": {+ "delete": {+ "operationId": "delete_video_note_api_video_learning_materials__material_id__notes__note_id__delete","parameters": [+ {+ "in": "path",+ "name": "material_id",+ "required": true,+ "schema": {+ "title": "Material Id",+ "type": "string"+ }+ },+ {+ "in": "path",+ "name": "note_id",+ "required": true,+ "schema": {+ "title": "Note Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49614,8 +50663,10 @@"content": {"application/json": {"schema": {- "additionalProperties": true,- "title": "Response Get Invidious Account Status Api Video Learning Invidious Account Status Get",+ "additionalProperties": {+ "type": "string"+ },+ "title": "Response Delete Video Note Api Video Learning Materials Material Id Notes Note Id Delete","type": "object"}}@@ -49633,56 +50684,29 @@"description": "Validation Error"}},- "summary": "Get Invidious Account Status",+ "summary": "Delete Video Note","tags": ["video-learning"]- }- },- "/api/video-learning/invidious/browse/{kind}": {- "get": {- "operationId": "browse_invidious_api_video_learning_invidious_browse__kind__get",+ },+ "put": {+ "operationId": "update_video_note_api_video_learning_materials__material_id__notes__note_id__put","parameters": [{"in": "path",- "name": "kind",+ "name": "material_id","required": true,"schema": {- "title": "Kind",- "type": "string"- }- },- {- "in": "query",- "name": "q",- "required": false,- "schema": {- "default": "",- "maxLength": 500,- "title": "Q",+ "title": "Material Id","type": "string"}},{- "in": "query",- "name": "page",- "required": false,- "schema": {- "default": 1,- "maximum": 1000,- "minimum": 1,- "title": "Page",- "type": "integer"- }- },- {- "in": "query",- "name": "playlist_id",- "required": false,+ "in": "path",+ "name": "note_id",+ "required": true,"schema": {- "default": "",- "maxLength": 100,- "title": "Playlist Id",+ "title": "Note Id","type": "string"}},@@ -49719,11 +50743,25 @@}}],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateVideoNoteRequest"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Update Video Note Api Video Learning Materials Material Id Notes Note Id Put",+ "type": "object"+ }}},"description": "Successful Response"@@ -49739,16 +50777,25 @@"description": "Validation Error"}},- "summary": "Browse Invidious",+ "summary": "Update Video Note","tags": ["video-learning"]}},- "/api/video-learning/materials/resolve": {- "post": {- "operationId": "resolve_video_api_video_learning_materials_resolve_post",+ "/api/video-learning/materials/{material_id}/progress": {+ "put": {+ "operationId": "save_video_progress_api_video_learning_materials__material_id__progress_put","parameters": [+ {+ "in": "path",+ "name": "material_id",+ "required": true,+ "schema": {+ "title": "Material Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49786,7 +50833,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ResolveRequest"+ "$ref": "#/components/schemas/deeptutor__api__routers__video_learning__ProgressRequest"}}},@@ -49797,8 +50844,10 @@"content": {"application/json": {"schema": {- "additionalProperties": true,- "title": "Response Resolve Video Api Video Learning Materials Resolve Post",+ "additionalProperties": {+ "type": "number"+ },+ "title": "Response Save Video Progress Api Video Learning Materials Material Id Progress Put","type": "object"}}@@ -49816,15 +50865,15 @@"description": "Validation Error"}},- "summary": "Resolve Video",+ "summary": "Save Video Progress","tags": ["video-learning"]}},- "/api/video-learning/materials/{material_id}": {+ "/api/video-learning/materials/{material_id}/stream/{format_id}": {"get": {- "operationId": "get_video_material_api_video_learning_materials__material_id__get",+ "operationId": "stream_video_get","parameters": [{"in": "path",@@ -49835,6 +50884,15 @@"type": "string"}},+ {+ "in": "path",+ "name": "format_id",+ "required": true,+ "schema": {+ "title": "Format Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49872,11 +50930,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Get Video Material Api Video Learning Materials Material Id Get",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -49892,15 +50946,13 @@"description": "Validation Error"}},- "summary": "Get Video Material",+ "summary": "Stream Video","tags": ["video-learning"]- }- },- "/api/video-learning/materials/{material_id}/notes": {- "get": {- "operationId": "list_video_notes_api_video_learning_materials__material_id__notes_get",+ },+ "head": {+ "operationId": "stream_video_head","parameters": [{"in": "path",@@ -49911,6 +50963,15 @@"type": "string"}},+ {+ "in": "path",+ "name": "format_id",+ "required": true,+ "schema": {+ "title": "Format Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -49948,14 +51009,7 @@"200": {"content": {"application/json": {- "schema": {- "items": {- "additionalProperties": true,- "type": "object"- },- "title": "Response List Video Notes Api Video Learning Materials Material Id Notes Get",- "type": "array"- }+ "schema": {}}},"description": "Successful Response"@@ -49971,13 +51025,15 @@"description": "Validation Error"}},- "summary": "List Video Notes",+ "summary": "Stream Video","tags": ["video-learning"]- },- "post": {- "operationId": "create_video_note_api_video_learning_materials__material_id__notes_post",+ }+ },+ "/api/video-learning/materials/{material_id}/subtitles.vtt": {+ "get": {+ "operationId": "get_video_subtitles_api_video_learning_materials__material_id__subtitles_vtt_get","parameters": [{"in": "path",@@ -50021,25 +51077,11 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateVideoNoteRequest"- }- }- },- "required": true- },"responses": {"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Create Video Note Api Video Learning Materials Material Id Notes Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -50055,15 +51097,15 @@"description": "Validation Error"}},- "summary": "Create Video Note",+ "summary": "Get Video Subtitles","tags": ["video-learning"]}},- "/api/video-learning/materials/{material_id}/notes.md": {- "get": {- "operationId": "export_video_notes_api_video_learning_materials__material_id__notes_md_get",+ "/api/video-learning/materials/{material_id}/transcript/refresh": {+ "post": {+ "operationId": "refresh_video_transcript_api_video_learning_materials__material_id__transcript_refresh_post","parameters": [{"in": "path",@@ -50111,7 +51153,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Refresh Video Transcript Api Video Learning Materials Material Id Transcript Refresh Post",+ "type": "object"+ }}},"description": "Successful Response"@@ -50127,31 +51173,22 @@"description": "Validation Error"}},- "summary": "Export Video Notes",+ "summary": "Refresh Video Transcript","tags": ["video-learning"]}},- "/api/video-learning/materials/{material_id}/notes/{note_id}": {- "delete": {- "operationId": "delete_video_note_api_video_learning_materials__material_id__notes__note_id__delete",+ "/api/visualizers/bundled/{visualizer_id}/install": {+ "post": {+ "operationId": "install_bundled_api_visualizers_bundled__visualizer_id__install_post","parameters": [{"in": "path",- "name": "material_id",- "required": true,- "schema": {- "title": "Material Id",- "type": "string"- }- },- {- "in": "path",- "name": "note_id",+ "name": "visualizer_id","required": true,"schema": {- "title": "Note Id",+ "title": "Visualizer Id","type": "string"}},@@ -50193,10 +51230,8 @@"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "string"- },- "title": "Response Delete Video Note Api Video Learning Materials Material Id Notes Note Id Delete",+ "additionalProperties": true,+ "title": "Response Install Bundled Api Visualizers Bundled Visualizer Id Install Post","type": "object"}}@@ -50214,32 +51249,17 @@"description": "Validation Error"}},- "summary": "Delete Video Note",+ "summary": "Install Bundled","tags": [- "video-learning"+ "visualizers"]- },- "put": {- "operationId": "update_video_note_api_video_learning_materials__material_id__notes__note_id__put",+ }+ },+ "/api/visualizers/import": {+ "post": {+ "description": "Install one declarative ``visualizer.json`` + iframe bundle zip.",+ "operationId": "import_visualizer_api_visualizers_import_post","parameters": [- {- "in": "path",- "name": "material_id",- "required": true,- "schema": {- "title": "Material Id",- "type": "string"- }- },- {- "in": "path",- "name": "note_id",- "required": true,- "schema": {- "title": "Note Id",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -50275,9 +51295,9 @@],"requestBody": {"content": {- "application/json": {+ "multipart/form-data": {"schema": {- "$ref": "#/components/schemas/UpdateVideoNoteRequest"+ "$ref": "#/components/schemas/Body_import_visualizer_api_visualizers_import_post"}}},@@ -50289,7 +51309,7 @@"application/json": {"schema": {"additionalProperties": true,- "title": "Response Update Video Note Api Video Learning Materials Material Id Notes Note Id Put",+ "title": "Response Import Visualizer Api Visualizers Import Post","type": "object"}}@@ -50307,25 +51327,16 @@"description": "Validation Error"}},- "summary": "Update Video Note",+ "summary": "Import Visualizer","tags": [- "video-learning"+ "visualizers"]}},- "/api/video-learning/materials/{material_id}/progress": {- "put": {- "operationId": "save_video_progress_api_video_learning_materials__material_id__progress_put",+ "/api/visualizers/list": {+ "get": {+ "operationId": "list_visualizers_api_visualizers_list_get","parameters": [- {- "in": "path",- "name": "material_id",- "required": true,- "schema": {- "title": "Material Id",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -50359,25 +51370,13 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/deeptutor__api__routers__video_learning__ProgressRequest"- }- }- },- "required": true- },"responses": {"200": {"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "number"- },- "title": "Response Save Video Progress Api Video Learning Materials Material Id Progress Put",+ "additionalProperties": true,+ "title": "Response List Visualizers Api Visualizers List Get","type": "object"}}@@ -50395,31 +51394,22 @@"description": "Validation Error"}},- "summary": "Save Video Progress",+ "summary": "List Visualizers","tags": [- "video-learning"+ "visualizers"]}},- "/api/video-learning/materials/{material_id}/stream/{format_id}": {- "get": {- "operationId": "stream_video_get",+ "/api/visualizers/{visualizer_id}": {+ "delete": {+ "operationId": "uninstall_visualizer_api_visualizers__visualizer_id__delete","parameters": [{"in": "path",- "name": "material_id",- "required": true,- "schema": {- "title": "Material Id",- "type": "string"- }- },- {- "in": "path",- "name": "format_id",+ "name": "visualizer_id","required": true,"schema": {- "title": "Format Id",+ "title": "Visualizer Id","type": "string"}},@@ -50460,7 +51450,13 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": {+ "type": "string"+ },+ "title": "Response Uninstall Visualizer Api Visualizers Visualizer Id Delete",+ "type": "object"+ }}},"description": "Successful Response"@@ -50476,29 +51472,31 @@"description": "Validation Error"}},- "summary": "Stream Video",+ "summary": "Uninstall Visualizer","tags": [- "video-learning"+ "visualizers"]- },- "head": {- "operationId": "stream_video_head",+ }+ },+ "/api/visualizers/{visualizer_id}/assets/{asset_path}": {+ "get": {+ "operationId": "get_visualizer_asset_api_visualizers__visualizer_id__assets__asset_path__get","parameters": [{"in": "path",- "name": "material_id",+ "name": "visualizer_id","required": true,"schema": {- "title": "Material Id",+ "title": "Visualizer Id","type": "string"}},{"in": "path",- "name": "format_id",+ "name": "asset_path","required": true,"schema": {- "title": "Format Id",+ "title": "Asset Path","type": "string"}},@@ -50555,22 +51553,22 @@"description": "Validation Error"}},- "summary": "Stream Video",+ "summary": "Get Visualizer Asset","tags": [- "video-learning"+ "visualizers"]}},- "/api/video-learning/materials/{material_id}/subtitles.vtt": {- "get": {- "operationId": "get_video_subtitles_api_video_learning_materials__material_id__subtitles_vtt_get",+ "/api/visualizers/{visualizer_id}/disable": {+ "post": {+ "operationId": "disable_visualizer_api_visualizers__visualizer_id__disable_post","parameters": [{"in": "path",- "name": "material_id",+ "name": "visualizer_id","required": true,"schema": {- "title": "Material Id",+ "title": "Visualizer Id","type": "string"}},@@ -50611,7 +51609,13 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": {+ "type": "string"+ },+ "title": "Response Disable Visualizer Api Visualizers Visualizer Id Disable Post",+ "type": "object"+ }}},"description": "Successful Response"@@ -50627,22 +51631,22 @@"description": "Validation Error"}},- "summary": "Get Video Subtitles",+ "summary": "Disable Visualizer","tags": [- "video-learning"+ "visualizers"]}},- "/api/video-learning/materials/{material_id}/transcript/refresh": {+ "/api/visualizers/{visualizer_id}/enable": {"post": {- "operationId": "refresh_video_transcript_api_video_learning_materials__material_id__transcript_refresh_post",+ "operationId": "enable_visualizer_api_visualizers__visualizer_id__enable_post","parameters": [{"in": "path",- "name": "material_id",+ "name": "visualizer_id","required": true,"schema": {- "title": "Material Id",+ "title": "Visualizer Id","type": "string"}},@@ -50684,8 +51688,10 @@"content": {"application/json": {"schema": {- "additionalProperties": true,- "title": "Response Refresh Video Transcript Api Video Learning Materials Material Id Transcript Refresh Post",+ "additionalProperties": {+ "type": "string"+ },+ "title": "Response Enable Visualizer Api Visualizers Visualizer Id Enable Post","type": "object"}}@@ -50703,25 +51709,17 @@"description": "Validation Error"}},- "summary": "Refresh Video Transcript",+ "summary": "Enable Visualizer","tags": [- "video-learning"+ "visualizers"]}},- "/api/visualizers/bundled/{visualizer_id}/install": {+ "/api/voice/stt": {"post": {- "operationId": "install_bundled_api_visualizers_bundled__visualizer_id__install_post",+ "description": "Transcribe an uploaded audio clip using the active STT provider.",+ "operationId": "speech_to_text_api_voice_stt_post","parameters": [- {- "in": "path",- "name": "visualizer_id",- "required": true,- "schema": {- "title": "Visualizer Id",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -50755,13 +51753,25 @@}}],+ "requestBody": {+ "content": {+ "multipart/form-data": {+ "schema": {+ "$ref": "#/components/schemas/Body_speech_to_text_api_voice_stt_post"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {"schema": {- "additionalProperties": true,- "title": "Response Install Bundled Api Visualizers Bundled Visualizer Id Install Post",+ "additionalProperties": {+ "type": "string"+ },+ "title": "Response Speech To Text Api Voice Stt Post","type": "object"}}@@ -50779,16 +51789,16 @@"description": "Validation Error"}},- "summary": "Install Bundled",+ "summary": "Speech To Text","tags": [- "visualizers"+ "voice"]}},- "/api/visualizers/import": {+ "/api/voice/tts": {"post": {- "description": "Install one declarative ``visualizer.json`` + iframe bundle zip.",- "operationId": "import_visualizer_api_visualizers_import_post",+ "description": "Synthesize ``text`` to audio using the active TTS provider.",+ "operationId": "text_to_speech_api_voice_tts_post","parameters": [{"in": "header",@@ -50825,9 +51835,9 @@],"requestBody": {"content": {- "multipart/form-data": {+ "application/json": {"schema": {- "$ref": "#/components/schemas/Body_import_visualizer_api_visualizers_import_post"+ "$ref": "#/components/schemas/TTSRequest"}}},@@ -50837,11 +51847,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response Import Visualizer Api Visualizers Import Post",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -50857,16 +51863,44 @@"description": "Validation Error"}},- "summary": "Import Visualizer",+ "summary": "Text To Speech","tags": [- "visualizers"+ "voice"]}},- "/api/visualizers/list": {+ "/files/attachments/{session_id}/{attachment_id}/{filename}": {"get": {- "operationId": "list_visualizers_api_visualizers_list_get",+ "description": "Serve a previously uploaded chat attachment.\n\nResponds with ``Content-Disposition: inline`` so browsers preview PDFs\nand images directly in an ``<iframe>`` / ``<img>``. For unknown types\nthe browser still falls back to download, which is fine for the\ndrawer's \"Download\" button path.",+ "operationId": "get_attachment_files_attachments__session_id___attachment_id___filename__get","parameters": [+ {+ "in": "path",+ "name": "session_id",+ "required": true,+ "schema": {+ "title": "Session Id",+ "type": "string"+ }+ },+ {+ "in": "path",+ "name": "attachment_id",+ "required": true,+ "schema": {+ "title": "Attachment Id",+ "type": "string"+ }+ },+ {+ "in": "path",+ "name": "filename",+ "required": true,+ "schema": {+ "title": "Filename",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -50904,11 +51938,7 @@"200": {"content": {"application/json": {- "schema": {- "additionalProperties": true,- "title": "Response List Visualizers Api Visualizers List Get",- "type": "object"- }+ "schema": {}}},"description": "Successful Response"@@ -50924,23 +51954,38 @@"description": "Validation Error"}},- "summary": "List Visualizers",+ "summary": "Get Attachment","tags": [- "visualizers"+ "attachments"]}},- "/api/visualizers/{visualizer_id}": {- "delete": {- "operationId": "uninstall_visualizer_api_visualizers__visualizer_id__delete",+ "/files/library/": {+ "get": {+ "description": "List active library entries, newest first.",+ "operationId": "library_list","parameters": [{- "in": "path",- "name": "visualizer_id",- "required": true,+ "in": "query",+ "name": "limit",+ "required": false,"schema": {- "title": "Visualizer Id",- "type": "string"+ "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"}},{@@ -50981,11 +52026,12 @@"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "string"+ "items": {+ "additionalProperties": true,+ "type": "object"},- "title": "Response Uninstall Visualizer Api Visualizers Visualizer Id Delete",- "type": "object"+ "title": "Response Library List",+ "type": "array"}}},@@ -51002,34 +52048,15 @@"description": "Validation Error"}},- "summary": "Uninstall Visualizer",+ "summary": "List Library Files","tags": [- "visualizers"+ "library"]- }- },- "/api/visualizers/{visualizer_id}/assets/{asset_path}": {- "get": {- "operationId": "get_visualizer_asset_api_visualizers__visualizer_id__assets__asset_path__get",+ },+ "post": {+ "description": "Add a file to the library.\n\nThe request must be ``multipart/form-data`` with a ``file`` field containing\nthe raw bytes. If a file with the same SHA-256 content hash already exists\nin the library, returns the existing entry (deduplication).",+ "operationId": "library_add","parameters": [- {- "in": "path",- "name": "visualizer_id",- "required": true,- "schema": {- "title": "Visualizer Id",- "type": "string"- }- },- {- "in": "path",- "name": "asset_path",- "required": true,- "schema": {- "title": "Asset Path",- "type": "string"- }- },{"in": "header","name": "Authorization",@@ -51063,11 +52090,25 @@}}],+ "requestBody": {+ "content": {+ "multipart/form-data": {+ "schema": {+ "$ref": "#/components/schemas/Body_library_add"+ }+ }+ },+ "required": true+ },"responses": {"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Library Add",+ "type": "object"+ }}},"description": "Successful Response"@@ -51083,22 +52124,25 @@"description": "Validation Error"}},- "summary": "Get Visualizer Asset",+ "summary": "Add Library File","tags": [- "visualizers"+ "library"]}},- "/api/visualizers/{visualizer_id}/disable": {- "post": {- "operationId": "disable_visualizer_api_visualizers__visualizer_id__disable_post",+ "/files/library/search": {+ "get": {+ "description": "Search library entries by filename (case-insensitive substring).",+ "operationId": "library_search","parameters": [{- "in": "path",- "name": "visualizer_id",+ "in": "query",+ "name": "q","required": true,"schema": {- "title": "Visualizer Id",+ "maxLength": 200,+ "minLength": 1,+ "title": "Q","type": "string"}},@@ -51140,11 +52184,12 @@"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "string"+ "items": {+ "additionalProperties": true,+ "type": "object"},- "title": "Response Disable Visualizer Api Visualizers Visualizer Id Disable Post",- "type": "object"+ "title": "Response Library Search",+ "type": "array"}}},@@ -51161,22 +52206,23 @@"description": "Validation Error"}},- "summary": "Disable Visualizer",+ "summary": "Search Library Files","tags": [- "visualizers"+ "library"]}},- "/api/visualizers/{visualizer_id}/enable": {- "post": {- "operationId": "enable_visualizer_api_visualizers__visualizer_id__enable_post",+ "/files/library/{file_id}": {+ "delete": {+ "description": "Soft-delete a library file (sets is_deleted=1).",+ "operationId": "library_delete","parameters": [{"in": "path",- "name": "visualizer_id",+ "name": "file_id","required": true,"schema": {- "title": "Visualizer Id",+ "title": "File Id","type": "string"}},@@ -51218,10 +52264,8 @@"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "string"- },- "title": "Response Enable Visualizer Api Visualizers Visualizer Id Enable Post",+ "additionalProperties": true,+ "title": "Response Library Delete","type": "object"}}@@ -51239,17 +52283,24 @@"description": "Validation Error"}},- "summary": "Enable Visualizer",+ "summary": "Delete Library File","tags": [- "visualizers"+ "library"]- }- },- "/api/voice/stt": {- "post": {- "description": "Transcribe an uploaded audio clip using the active STT provider.",- "operationId": "speech_to_text_api_voice_stt_post",+ },+ "get": {+ "description": "Get a single library entry by id (includes soft-deleted).",+ "operationId": "library_get","parameters": [+ {+ "in": "path",+ "name": "file_id",+ "required": true,+ "schema": {+ "title": "File Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -51283,25 +52334,13 @@}}],- "requestBody": {- "content": {- "multipart/form-data": {- "schema": {- "$ref": "#/components/schemas/Body_speech_to_text_api_voice_stt_post"- }- }- },- "required": true- },"responses": {"200": {"content": {"application/json": {"schema": {- "additionalProperties": {- "type": "string"- },- "title": "Response Speech To Text Api Voice Stt Post",+ "additionalProperties": true,+ "title": "Response Library Get","type": "object"}}@@ -51319,17 +52358,26 @@"description": "Validation Error"}},- "summary": "Speech To Text",+ "summary": "Get Library File","tags": [- "voice"+ "library"]}},- "/api/voice/tts": {- "post": {- "description": "Synthesize ``text`` to audio using the active TTS provider.",- "operationId": "text_to_speech_api_voice_tts_post",+ "/files/library/{file_id}/download": {+ "get": {+ "description": "Download a library file by id.",+ "operationId": "library_download","parameters": [+ {+ "in": "path",+ "name": "file_id",+ "required": true,+ "schema": {+ "title": "File Id",+ "type": "string"+ }+ },{"in": "header","name": "Authorization",@@ -51363,16 +52411,6 @@}}],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/TTSRequest"- }- }- },- "required": true- },"responses": {"200": {"content": {@@ -51393,41 +52431,94 @@"description": "Validation Error"}},- "summary": "Text To Speech",+ "summary": "Download Library File","tags": [- "voice"+ "library"]- }- },- "/files/attachments/{session_id}/{attachment_id}/{filename}": {- "get": {- "description": "Serve a previously uploaded chat attachment.\n\nResponds with ``Content-Disposition: inline`` so browsers preview PDFs\nand images directly in an ``<iframe>`` / ``<img>``. For unknown types\nthe browser still falls back to download, which is fine for the\ndrawer's \"Download\" button path.",- "operationId": "get_attachment_files_attachments__session_id___attachment_id___filename__get",+ },+ "head": {+ "description": "Check whether a library file exists (HEAD only).",+ "operationId": "library_download_head","parameters": [{"in": "path",- "name": "session_id",+ "name": "file_id","required": true,"schema": {- "title": "Session Id",+ "title": "File Id","type": "string"}},{- "in": "path",- "name": "attachment_id",- "required": true,+ "in": "header",+ "name": "Authorization",+ "required": false,"schema": {- "title": "Attachment Id",- "type": "string"+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Authorization"+ }+ },+ {+ "in": "cookie",+ "name": "dt_token",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Dt Token"}+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {}+ }+ },+ "description": "Successful Response"},+ "422": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ },+ "description": "Validation Error"+ }+ },+ "summary": "Download Library File Head",+ "tags": [+ "library"+ ]+ }+ },+ "/files/library/{file_id}/restore": {+ "post": {+ "description": "Restore a soft-deleted library file.",+ "operationId": "library_restore",+ "parameters": [{"in": "path",- "name": "filename",+ "name": "file_id","required": true,"schema": {- "title": "Filename",+ "title": "File Id","type": "string"}},@@ -51468,7 +52559,11 @@"200": {"content": {"application/json": {- "schema": {}+ "schema": {+ "additionalProperties": true,+ "title": "Response Library Restore",+ "type": "object"+ }}},"description": "Successful Response"@@ -51484,9 +52579,9 @@"description": "Validation Error"}},- "summary": "Get Attachment",+ "summary": "Restore Library File","tags": [- "attachments"+ "library"]}},diff --git a/web/lib/backend-forward.ts b/web/lib/backend-forward.tsnew file mode 100644index 000000000..ec992e651--- /dev/null+++ b/web/lib/backend-forward.ts@@ -0,0 +1,33 @@+export const FRONTEND_HOST_HEADER = "x-deeptutor-frontend-host";++const UNTRUSTED_FORWARD_HEADERS = [+ "connection",+ "forwarded",+ "x-forwarded-host",+ "x-forwarded-proto",+ "x-forwarded-for",+ "x-forwarded-port",+ "x-forwarded-server",+ "x-real-ip",+ "x-client-ip",+ "x-host",+ "x-original-host",+ FRONTEND_HOST_HEADER,+];++export function prepareBackendForwardHeaders(+ source: Headers,+ frontendHost: string,+): Headers {+ const headers = new Headers(source);+ const connectionTokens = (headers.get("connection") || "")+ .split(",")+ .map((value) => value.trim().toLowerCase())+ .filter(Boolean);++ for (const name of [...UNTRUSTED_FORWARD_HEADERS, ...connectionTokens]) {+ headers.delete(name);+ }+ headers.set(FRONTEND_HOST_HEADER, frontendHost);+ return headers;+}diff --git a/web/lib/proxy-policy.ts b/web/lib/proxy-policy.tsindex ad363188d..72e9a9543 100644--- a/web/lib/proxy-policy.ts+++ b/web/lib/proxy-policy.ts@@ -7,6 +7,7 @@// can be unit-tested in the node harness without booting the Next runtime.export const LOGIN_PATH = "/login";+export const HANDOFF_PATH = "/handoff";export const COOKIE_NAME = "dt_token";export const CODEX_CALLBACK_PATH = "/auth/callback";export const CODEX_CALLBACK_API_PATH = "/api/auth/openai-codex/callback";@@ -50,6 +51,7 @@ export function isAuthExempt(pathname: string): boolean {return (pathname.startsWith(LOGIN_PATH) ||pathname.startsWith("/register") ||+ pathname === HANDOFF_PATH ||pathname.startsWith("/_next") ||pathname.startsWith("/favicon") ||STATIC_ASSET.test(pathname)diff --git a/web/lib/session-handoff-api.ts b/web/lib/session-handoff-api.tsnew file mode 100644index 000000000..56c66c8d3--- /dev/null+++ b/web/lib/session-handoff-api.ts@@ -0,0 +1,51 @@+import { apiFetch, apiUrl } from "@/lib/api";++export interface SessionHandoff {+ code: string;+ handoff_url: string;+ expires_at: number;+ expires_in: number;+}++export async function createSessionHandoff(+ publicOrigin: string,+): Promise<SessionHandoff> {+ const response = await apiFetch(apiUrl("/api/auth/session-handoff"), {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ public_origin: publicOrigin }),+ skipAuthRedirect: true,+ });+ const body = await response.json().catch(() => ({}));+ if (!response.ok) {+ throw new Error(String(body.detail ?? "Could not create pairing link"));+ }+ return body as SessionHandoff;+}++export async function exchangeSessionHandoff(code: string): Promise<string> {+ const response = await apiFetch(apiUrl("/api/auth/session-handoff/exchange"), {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ code }),+ skipAuthRedirect: true,+ });+ const body = await response.json().catch(() => ({}));+ if (!response.ok) {+ throw new Error(String(body.detail ?? "Pairing code is invalid"));+ }+ return String(body.ticket);+}++export async function completeSessionHandoff(ticket: string): Promise<void> {+ const response = await apiFetch(apiUrl("/api/auth/session-handoff/complete"), {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ ticket }),+ skipAuthRedirect: true,+ });+ if (!response.ok) {+ const body = await response.json().catch(() => ({}));+ throw new Error(String(body.detail ?? "Pairing could not be completed"));+ }+}diff --git a/web/lib/streaming-upload-proxy.ts b/web/lib/streaming-upload-proxy.tsindex 364ac82de..c9220a6b5 100644--- a/web/lib/streaming-upload-proxy.ts+++ b/web/lib/streaming-upload-proxy.ts@@ -1,4 +1,5 @@import { resolveBackendApiBase } from "./backend-runtime-config";+import { prepareBackendForwardHeaders } from "./backend-forward";// HTTP/1.1 hop-by-hop headers describe one transport connection and must not// be replayed on the independent frontend -> backend connection.@@ -30,14 +31,15 @@ export interface UploadProxyDependencies {fetchImpl?: typeof fetch;}-function forwardedHeaders(source: Headers, { request }: { request: boolean }) {- const headers = new Headers(source);- const connectionTokens = (headers.get("connection") || "")- .split(",")- .map((value) => value.trim().toLowerCase())- .filter(Boolean);-- for (const name of [...HOP_BY_HOP_HEADERS, ...connectionTokens]) {+function forwardedHeaders(+ source: Headers,+ { request, frontendHost }: { request: boolean; frontendHost?: string },+) {+ const headers =+ request && frontendHost+ ? prepareBackendForwardHeaders(source, frontendHost)+ : new Headers(source);+ for (const name of HOP_BY_HOP_HEADERS) {headers.delete(name);}if (request) headers.delete("host");@@ -63,7 +65,10 @@ export async function forwardBackendUpload(const init: StreamingRequestInit = {method: request.method,- headers: forwardedHeaders(request.headers, { request: true }),+ headers: forwardedHeaders(request.headers, {+ request: true,+ frontendHost: incomingUrl.host,+ }),signal: request.signal,redirect: "manual",};diff --git a/web/locales/en/app.json b/web/locales/en/app.jsonindex 99a278f2f..7b180a508 100644--- a/web/locales/en/app.json+++ b/web/locales/en/app.json@@ -4051,5 +4051,11 @@"The Invidious instance could not verify your account. Check the instance and reconnect.": "The Invidious instance could not verify your account. Check the instance and reconnect.","Your DeepTutor login expired during authorization. Sign in, then start a new Invidious connection.": "Your DeepTutor login expired during authorization. Sign in, then start a new Invidious connection.","The account could not be connected. Please start a new connection.": "The account could not be connected. Please start a new connection.",- "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate."+ "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.",+ "Public device sign-in": "Public device sign-in",+ "Public HTTPS origin": "Public HTTPS origin",+ "Create link": "Create link",+ "Pairing code": "Pairing code",+ "Completing sign-in…": "Completing sign-in…",+ "Expires in {{seconds}} seconds": "Expires in {{seconds}} seconds"}diff --git a/web/locales/zh/app.json b/web/locales/zh/app.jsonindex e0c6bccbc..bc9aa72f7 100644--- a/web/locales/zh/app.json+++ b/web/locales/zh/app.json@@ -4051,5 +4051,11 @@"The Invidious instance could not verify your account. Check the instance and reconnect.": "Invidious 实例暂时无法验证账号,请检查实例后重新关联。","Your DeepTutor login expired during authorization. Sign in, then start a new Invidious connection.": "授权期间 DeepTutor 登录已失效,请先登录 DeepTutor,再重新关联 Invidious。","The account could not be connected. Please start a new connection.": "账号关联失败,请重新发起关联。",- "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "请使用 Invidious 账号登录,确认只读授权后会自动返回此页。DeepTutor 与 Invidious 使用各自的登录账号。"+ "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "请使用 Invidious 账号登录,确认只读授权后会自动返回此页。DeepTutor 与 Invidious 使用各自的登录账号。",+ "Public device sign-in": "公共设备登录",+ "Public HTTPS origin": "公共 HTTPS 地址",+ "Create link": "创建链接",+ "Pairing code": "配对码",+ "Completing sign-in…": "正在完成登录…",+ "Expires in {{seconds}} seconds": "{{seconds}} 秒后过期"}diff --git a/web/proxy.ts b/web/proxy.tsindex 6e5a4011c..205e82a0d 100644--- a/web/proxy.ts+++ b/web/proxy.ts@@ -1,6 +1,7 @@import { NextRequest, NextResponse } from "next/server";import { parseAuthEnabled } from "./lib/api";import { resolveBackendApiBase } from "./lib/backend-runtime-config";+import { prepareBackendForwardHeaders } from "./lib/backend-forward";import {CODEX_CALLBACK_API_PATH,COOKIE_NAME,@@ -63,7 +64,11 @@ export function proxy(req: NextRequest): NextResponse {// This keeps the URL knowledge in one place (the entrypoint + system.json)// rather than baked into the frontend bundle.if (isBackendPath(pathname)) {- return NextResponse.rewrite(new URL(pathname + search, API_BASE_URL));+ return NextResponse.rewrite(new URL(pathname + search, API_BASE_URL), {+ request: {+ headers: prepareBackendForwardHeaders(req.headers, req.nextUrl.host),+ },+ });}// 2. Auth gate — multi-user mode only. Disabled by default, and never blocksdiff --git a/web/tests/proxy-policy.test.ts b/web/tests/proxy-policy.test.tsindex 33440dfaa..826a1a36c 100644--- a/web/tests/proxy-policy.test.ts+++ b/web/tests/proxy-policy.test.ts@@ -13,12 +13,14 @@ import { config as proxyConfig } from "../proxy";import {CODEX_CALLBACK_API_PATH,CODEX_CALLBACK_PATH,+ HANDOFF_PATH,classifyToken,isAuthExempt,isBackendPath,isCodexCallbackPath,isRetiredPagePath,} from "../lib/proxy-policy";+import { prepareBackendForwardHeaders } from "../lib/backend-forward";function makeToken(payload: Record<string, unknown>): string {const encode = (value: unknown) =>@@ -112,6 +114,44 @@ test("isAuthExempt allows auth pages and Next internals", () => {assert.equal(isAuthExempt("/favicon-32x32.png"), true);});+test("public handoff page is exempt without exposing protected route prefixes", () => {+ assert.equal(isAuthExempt(HANDOFF_PATH), true);+ assert.equal(isAuthExempt("/handoff/extra"), false);+ assert.equal(isAuthExempt("/handoff-lookalike"), false);+});++test("backend forwarding replaces client identity headers with frontend host", () => {+ const headers = prepareBackendForwardHeaders(+ new Headers({+ connection: "keep-alive, x-remove-me",+ cookie: "dt_token=session",+ forwarded: "for=1.2.3.4;host=attacker.example",+ host: "attacker.example",+ "x-forwarded-for": "1.2.3.4",+ "x-forwarded-host": "attacker.example",+ "x-forwarded-proto": "https",+ "x-real-ip": "1.2.3.4",+ "x-deeptutor-frontend-host": "attacker.example",+ "x-remove-me": "hop-by-hop",+ }),+ "app.example",+ );++ assert.equal(headers.get("x-deeptutor-frontend-host"), "app.example");+ assert.equal(headers.get("cookie"), "dt_token=session");+ for (const name of [+ "connection",+ "forwarded",+ "x-forwarded-for",+ "x-forwarded-host",+ "x-forwarded-proto",+ "x-real-ip",+ "x-remove-me",+ ]) {+ assert.equal(headers.has(name), false, name);+ }+});+test("isAuthExempt does NOT exempt protected app routes", () => {assert.equal(isAuthExempt("/chat"), false);assert.equal(isAuthExempt("/dashboard"), false);diff --git a/web/tests/streaming-upload-proxy.test.ts b/web/tests/streaming-upload-proxy.test.tsindex 48c251317..76e1f3a26 100644--- a/web/tests/streaming-upload-proxy.test.ts+++ b/web/tests/streaming-upload-proxy.test.ts@@ -11,9 +11,13 @@ test("upload proxy streams the original body and preserves the backend response"method: "POST",headers: {connection: "keep-alive, x-remove-me",+ forwarded: "for=1.2.3.4;host=attacker.example","content-type": "multipart/form-data; boundary=example",cookie: "deeptutor_session=token",host: "frontend.test",+ "x-forwarded-for": "1.2.3.4",+ "x-forwarded-host": "attacker.example",+ "x-real-ip": "1.2.3.4","x-remove-me": "transport-only",},body: new Blob(["multipart bytes"]).stream(),@@ -36,6 +40,11 @@ test("upload proxy streams the original body and preserves the backend response");assert.equal(headers.get("cookie"), "deeptutor_session=token");assert.equal(headers.has("connection"), false);+ assert.equal(headers.has("forwarded"), false);+ assert.equal(headers.has("x-forwarded-for"), false);+ assert.equal(headers.has("x-forwarded-host"), false);+ assert.equal(headers.has("x-real-ip"), false);+ assert.equal(headers.get("x-deeptutor-frontend-host"), "frontend.test");assert.equal(headers.has("host"), false);assert.equal(headers.has("x-remove-me"), false);assert.equal((init as StreamingRequestInit).duplex, "half");