DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
release: v1.4.1 — security & stability patch
Bingxi Zhao (Frank)6c024857b7fc
diff --git a/.gitignore b/.gitignoreindex b3747f0f7..f8d06f13e 100644--- a/.gitignore+++ b/.gitignore@@ -11,7 +11,7 @@ data/run_code_workspace/deeptutor/agents/question/reference_papers/deeptutor/services/rag/eg_only_for_analysis/-docs/+/docs/.claude# LaTeX build artifacts@@ -251,9 +251,6 @@ celerybeat.pid# Rope project settings.ropeproject-# mkdocs documentation-/site-# ============================================# Profiling# ============================================diff --git a/README.md b/README.mdindex d87940a00..496dfa59a 100644--- a/README.md+++ b/README.md@@ -44,17 +44,19 @@### 📦 Releases+> **[2026.5.27]** [v1.4.1](https://github.com/HKUDS/DeepTutor/releases/tag/v1.4.1) — Security + stability patch: TutorBot tool sandbox locked down, per-user resource isolation, multimodal image fallback for vision-capable providers, an HTTP/SSE API for talking to a TutorBot, and a v1.4.0 chat regression fix.+> **[2026.5.22]** [v1.4.0](https://github.com/HKUDS/DeepTutor/releases/tag/v1.4.0) — GA cut of v1.4: Auto Mode, three-layer Memory, agentic Deep Research / Solve / Question, LlamaIndex RAG refactor, Visualize/Animator merge, plus reasoning-effort normalization, tool-schema fallback, and restart-safe turn runtime.> **[2026.5.21]** [v1.4.0-beta](https://github.com/HKUDS/DeepTutor/releases/tag/v1.4.0-beta) — Three-layer Memory workbench (L1/L2/L3), every chat capability rebuilt on a single agentic engine, LlamaIndex-only RAG, and a unified Settings + Capabilities surface.> **[2026.5.10]** [v1.3.10](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.10) — Remote Docker CORS recovery, `DISABLE_SSL_VERIFY` across SDK providers, safer code-block citations, and optional Matrix E2EE add-on.-> **[2026.5.9]** [v1.3.9](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.9) — TutorBot Zulip and NVIDIA NIM support, safer thinking-model routing, `deeptutor start`, sidebar tooltips, and session-store parity.-<details><summary><b>Past releases (more than 2 weeks ago)</b></summary>+> **[2026.5.9]** [v1.3.9](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.9) — TutorBot Zulip and NVIDIA NIM support, safer thinking-model routing, `deeptutor start`, sidebar tooltips, and session-store parity.+> **[2026.5.8]** [v1.3.8](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.8) — Optional multi-user deployments with isolated user workspaces, admin grants, auth routes, and scoped runtime access.> **[2026.5.4]** [v1.3.7](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.7) — Thinking-model/provider fixes, visible Knowledge index history, and safer Co-Writer clear/template editing.@@ -166,7 +168,7 @@DeepTutor ships four installation paths. They all share one workspace layout: settings live in `data/user/settings/` under the directory you launch from (or under `DEEPTUTOR_HOME` / `deeptutor start --home` if you set one explicitly). For the full app, the recommended flow is **pick a workspace directory → install → `deeptutor init` → `deeptutor start`**.-> ✨ **v1.4.0 is live.** `pip install -U deeptutor` picks up the latest stable. Pre-releases (when available) opt in with `pip install --pre -U deeptutor`.+> ✨ **v1.4.1 is live.** `pip install -U deeptutor` picks up the latest stable. Pre-releases (when available) opt in with `pip install --pre -U deeptutor`.### Option 1 — Install From PyPI@@ -266,6 +268,27 @@ Open [http://127.0.0.1:3782](http://127.0.0.1:3782). The container creates `/app- **Different host ports:** change the left side of each `-p host:container` mapping (e.g. `-p 127.0.0.1:8088:3782`). If you change container-side ports in `/app/data/user/settings/system.json`, restart and update the right side of each mapping to match.- **Detached:** add `-d`, then `docker logs -f deeptutor` to follow, `docker stop deeptutor` to stop, `docker rm deeptutor` before reusing the name. The `deeptutor-data` volume keeps your settings and workspace across restarts.+**Remote Docker / reverse proxy:** the Web UI runs in the browser, so the+browser needs a backend URL it can reach. For remote servers, open+**Settings -> Network** or edit `data/user/settings/system.json`:++```json+{+ "next_public_api_base_external": "https://deeptutor.example.com"+}+```++`public_api_base` is accepted as a compatibility alias and is normalized into+`next_public_api_base_external` on save. CORS uses frontend **origins**, not API+URLs. With auth disabled, DeepTutor permits normal HTTP/HTTPS browser origins by+default. With auth enabled, add exact frontend origins:++```json+{+ "cors_origins": ["https://deeptutor.example.com"]+}+```+<details><summary><b>Connecting to Ollama / LM Studio / llama.cpp / vLLM on the host</b></summary>@@ -653,6 +676,7 @@ Flip on authentication and DeepTutor turns into a multi-tenant deployment with *```bash# 1. Enable auth in data/user/settings/auth.json:# {"enabled": true, "token_expire_hours": 24, "cookie_secure": false}+# Use cookie_secure=true for HTTPS deployments where Web and API are cross-site.# 2. Restart the web stack.deeptutor start@@ -706,8 +730,9 @@ multi-user/| `data/user/settings/auth.json: enabled` | Yes | Set to `true` to enable multi-user auth. Default `false` (single-user mode — admin paths everywhere). || `multi-user/_system/auth/auth_secret` | Recommended | JWT signing secret. Auto-generated on first authenticated boot if missing. || `data/user/settings/auth.json: token_expire_hours` | No | JWT lifetime; defaults to `24`. |+| `data/user/settings/auth.json: cookie_secure` | HTTPS / cross-site auth | Set `true` for HTTPS deployments that need `SameSite=None` cookies. Keep `false` for local HTTP. || `data/user/settings/auth.json: username/password_hash` | No | Optional headless single-user bootstrap credential. Leave blank when using browser registration. |-| `data/user/settings/system.json` | No | `deeptutor start` derives frontend auth flags and API base from runtime settings. |+| `data/user/settings/system.json` | No | `deeptutor start` derives frontend auth flags, public API base, and CORS origins from runtime settings. |> ⚠️ **PocketBase mode (`integrations.pocketbase_url` set) is single-user only.** The default PocketBase schema has no `role` field on `users` (every login resolves to `role=user`, no admin can be created), and `sessions` / `messages` / `turns` queries are not filtered by `user_id`. Multi-user deployments must keep `integrations.pocketbase_url` blank and use the default JSON/SQLite backend.diff --git a/assets/releases/ver1-4-1.md b/assets/releases/ver1-4-1.mdnew file mode 100644index 000000000..9300e8a33--- /dev/null+++ b/assets/releases/ver1-4-1.md@@ -0,0 +1,72 @@+# DeepTutor v1.4.1 Release Notes++**Release Date:** 2026.05.27++v1.4.1 is a security and stability patch on [v1.4.0](ver1-4-0.md). It locks down+the TutorBot tool sandbox, isolates per-user resources, fixes a v1.4.0 chat+regression, adds an HTTP API for talking to a specific TutorBot, and ships a+multimodal image-fallback fix for providers DeepTutor has no vision entry for.++## What's New++### TutorBot Tool Sandbox Is Opt-In+The shell `exec` tool is no longer registered unless an admin sets+`allow_shell_exec`, and all filesystem + shell access is confined to the bot+workspace by default. Command deny-lists were re-anchored at command+boundaries, and `allow_shell_exec` can't be flipped on via the update payload.++### Per-User Resource Isolation+Book roots, session databases, turn-runtime stores, and TutorBot directories+are scoped per user, and web/API conversations are keyed per session — so+cross-user requests can't reach each other's data.++### HTTP / SSE API For A TutorBot+New `POST /{bot_id}/chat` and `/chat/execute-stream` (SSE) endpoints with+auto-start and persistent per-session context, for multi-turn conversations+with a specific bot from external clients.++### Multimodal Image Fallback+Images are sent optimistically to every provider; if a request carrying images+fails and the model isn't in the known-vision allowlist, the turn retries+text-only. Fixes silently dropped images on Doubao / VolcEngine and other+multimodal models that lack a capability entry.++### Safe ZIP Upload + Network Settings+`.zip` knowledge uploads expand member-by-member through the document validator+with size / count / compression-ratio bounds and path-escape guards; the+archive itself is never indexed. A new `/settings/network` page surfaces ports,+public API base, and CORS origins (normalized to tolerate `host:port` and+trailing slashes), plus a "fetch models" action listing model IDs from an+OpenAI-compatible endpoint.++## Community Fixes & Changes++**Security** — closed TutorBot RCE via the shell tool (#518), path traversal in+the filesystem tool (#517), cross-bot file-management authz bypass (#516),+cross-session turn-regeneration authz bypass (#515), book-confirmation authz+bypass (#514), and ExecTool executing LLM shell commands over chat (#506,+first hardened in PR #507).++**Bug fixes** — chat input disabled after the first turn (v1.4.0 regression,+#520), knowledge-base embedding failure on long documents (#521 / PR #509),+new users unable to create a profile under Docker (#512 / PR #513), Qwen+reasoning models failing native tool calling (#527 / PR #528), and the GPT-5+init-wizard token parameter (PR #508).++**Merged / reworked PRs** — native tool calling for reasoning models (#528),+oversized session-event truncation (#524), empty-state profile button (#513),+chunking-pipeline fix (#509), GPT-5 probe (#508), ExecTool hardening (#507).+Contributions #522 (zip upload) and #523 (model fetching + notebook lookup)+were reimplemented locally and ship here.++**Feature request** — HTTP API for multi-turn chat with a specific TutorBot+(#511).++## Upgrade Notes+- Drop-in from v1.4.0: `pip install -U deeptutor`; Docker users pull+ `ghcr.io/hkuds/deeptutor:latest`.+- **TutorBot shell exec is now disabled by default.** If you relied on it, set+ `allow_shell_exec` on the bot; tool access stays confined to the workspace.+- For cross-site HTTPS auth, set explicit CORS origins and `cookie_secure=true`.++**Full Changelog**: https://github.com/HKUDS/DeepTutor/compare/v1.4.0...v1.4.1diff --git a/deeptutor/__version__.py b/deeptutor/__version__.pyindex c82d232df..e9ffe56a3 100644--- a/deeptutor/__version__.py+++ b/deeptutor/__version__.py@@ -6,6 +6,6 @@ before publishing to PyPI; the web sidebar badge and CLI banner read from thisfile directly."""-__version__ = "1.4.0"+__version__ = "1.4.1"__all__ = ("__version__",)diff --git a/deeptutor/agents/base_agent.py b/deeptutor/agents/base_agent.pyindex 74fb1ff53..ecf222373 100644--- a/deeptutor/agents/base_agent.py+++ b/deeptutor/agents/base_agent.py@@ -422,12 +422,6 @@ class BaseAgent(ABC):messages, attachments, binding=self.binding, model=model)messages = mm_result.messages- if mm_result.images_stripped:- self.logger.info(- "Images stripped for %s/%s – model does not support vision",- self.binding,- model,- )if messages:kwargs["messages"] = messages@@ -585,12 +579,6 @@ class BaseAgent(ABC):messages, attachments, binding=self.binding, model=model)messages = mm_result.messages- if mm_result.images_stripped:- self.logger.info(- "Images stripped for %s/%s – model does not support vision",- self.binding,- model,- )# Log inputstage_label = stage or self.agent_namediff --git a/deeptutor/agents/chat/agentic_pipeline.py b/deeptutor/agents/chat/agentic_pipeline.pyindex 2828b3697..93737c6ac 100644--- a/deeptutor/agents/chat/agentic_pipeline.py+++ b/deeptutor/agents/chat/agentic_pipeline.py@@ -77,13 +77,13 @@ from deeptutor.services.llm import (prepare_multimodal_messages,supports_tools, # noqa: F401 (re-exported for tests))-from deeptutor.services.provider_registry import find_by_namefrom deeptutor.services.llm import (stream as llm_stream,)from deeptutor.services.llm.context_window import resolve_effective_context_windowfrom deeptutor.services.prompt import get_prompt_managerfrom deeptutor.services.prompt.language import append_language_directive+from deeptutor.services.provider_registry import find_by_namelogger = logging.getLogger(__name__)@@ -398,18 +398,7 @@ class AgenticChatPipeline:system_prompt=system_prompt,user_content=user_content,)- messages, images_stripped = self._prepare_messages_with_attachments(messages, context)-- if images_stripped:- # ``images_stripped`` is a transient warning, not a sub-trace, so- # it carries no call_id (frontend ``CallTracePanel`` groups by- # call_id and would otherwise spawn an empty sub-trace row).- await stream.thinking(- self._t("notices.images_stripped", model=self.model or ""),- source="chat",- stage="responding",- metadata={"trace_kind": "warning"},- )+ messages = self._prepare_messages_with_attachments(messages, context)# Build the per-turn OpenAI client via ``_build_openai_client`` so# tests can monkey-patch that method post-instantiation to inject a@@ -476,7 +465,9 @@ class AgenticChatPipeline:# answer lives in ``content``, reasoning in# ``reasoning_content``. Non-reasoning models that emit# ``<think/>`` tags get LABEL_THINK so the loop continues.- implicit_think_label=LABEL_FINISH if (_is_reasoner and use_native_tools) else LABEL_THINK,+ implicit_think_label=LABEL_FINISH+ if (_is_reasoner and use_native_tools)+ else LABEL_THINK,)if outcome.sources:@@ -1058,7 +1049,7 @@ class AgenticChatPipeline:system_prompt=system_prompt,user_content=original_user_message,)- messages, _ = self._prepare_messages_with_attachments(messages, context)+ messages = self._prepare_messages_with_attachments(messages, context)if partial_response:messages.append({"role": "assistant", "content": partial_response})messages.append(@@ -1325,14 +1316,17 @@ class AgenticChatPipeline:self,messages: list[dict[str, Any]],context: UnifiedContext,- ) -> tuple[list[dict[str, Any]], bool]:+ ) -> list[dict[str, Any]]:+ # Stage-1: images are injected for every model. A model that cannot+ # actually handle them degrades to text-only via the Stage-2 fallback+ # in ``labeled_step`` (it strips images and retries) rather than here.mm_result = prepare_multimodal_messages(messages,context.attachments,binding=self.binding,model=self.model,)- return mm_result.messages, mm_result.images_stripped+ return mm_result.messages# ------------------------------------------------------------------# Tool selection + scheme constructiondiff --git a/deeptutor/agents/chat/prompts/en/agentic_chat.yaml b/deeptutor/agents/chat/prompts/en/agentic_chat.yamlindex 1b11e9376..2de4d62db 100644--- a/deeptutor/agents/chat/prompts/en/agentic_chat.yaml+++ b/deeptutor/agents/chat/prompts/en/agentic_chat.yaml@@ -144,7 +144,6 @@ notices:tool_unknown_error: "An unknown error occurred while executing {tool}."start_retrieval: "Starting retrieval"empty_tool_result: "The tool completed without returning text output."- images_stripped: "The current model `{model}` does not support image input, so image attachments were ignored."max_iterations_reached: "Reached the maximum number of tool iterations for this turn. Producing the best answer I can with what I have."protocol_retry: "The model violated the action-label protocol; retrying this iteration."final_protocol_failed: "The model still did not produce a valid FINISH reply after the finalization prompt."diff --git a/deeptutor/agents/chat/prompts/zh/agentic_chat.yaml b/deeptutor/agents/chat/prompts/zh/agentic_chat.yamlindex a97c508a7..b0701674e 100644--- a/deeptutor/agents/chat/prompts/zh/agentic_chat.yaml+++ b/deeptutor/agents/chat/prompts/zh/agentic_chat.yaml@@ -123,7 +123,6 @@ notices:tool_unknown_error: "执行工具 {tool} 时发生未知错误。"start_retrieval: "开始检索"empty_tool_result: "工具执行完成,但没有返回文本内容。"- images_stripped: "当前模型 `{model}` 不支持图像输入,本轮图片附件已被忽略。"max_iterations_reached: "已达到本轮工具迭代上限,将基于当前材料给出最佳回答。"protocol_retry: "模型违反了动作标签协议,正在重试本次迭代。"final_protocol_failed: "最终化提示后,模型仍未产出合格的 FINISH 回复。"diff --git a/deeptutor/api/main.py b/deeptutor/api/main.pyindex 368832913..dfe1ef986 100644--- a/deeptutor/api/main.py+++ b/deeptutor/api/main.py@@ -12,6 +12,7 @@ from deeptutor.services.config import (load_auth_settings,load_system_settings,)+from deeptutor.services.config.origins import normalize_originsfrom deeptutor.services.path_service import get_path_serviceensure_runtime_settings_files()@@ -80,27 +81,13 @@ def validate_tool_consistency():raise-def _split_origins(value: str | None) -> list[str]:- if not value:- return []- origins: list[str] = []- seen: set[str] = set()- for raw in value.replace("\n", ",").split(","):- origin = raw.strip().rstrip("/")- if not origin or origin in seen:- continue- origins.append(origin)- seen.add(origin)- return origins--def _build_cors_settings() -> dict[str, object]:"""Build CORS settings for both localhost and remote Docker deployments."""system_settings = load_system_settings()auth_settings = load_auth_settings()frontend_port = str(system_settings["frontend_port"])- extra_origins = _split_origins(system_settings["cors_origin"]) + _split_origins(- ",".join(system_settings["cors_origins"])+ extra_origins = normalize_origins(+ [system_settings["cors_origin"], system_settings["cors_origins"]])origins = [f"http://localhost:{frontend_port}",@@ -117,7 +104,12 @@ def _build_cors_settings() -> dict[str, object]:# When auth is enabled, require explicit CORS_ORIGIN(S) for credentialed# cross-origin requests.allow_origin_regex = None if auth_settings["enabled"] else r"https?://.*"- return {"allow_origins": origins, "allow_origin_regex": allow_origin_regex}+ mode = "explicit" if auth_settings["enabled"] else "permissive"+ return {+ "allow_origins": origins,+ "allow_origin_regex": allow_origin_regex,+ "mode": mode,+ }@asynccontextmanager@@ -233,6 +225,12 @@ async def selective_access_log(request, call_next):_cors_settings = _build_cors_settings()+logger.info(+ "CORS configured: mode=%s allow_origins=%s allow_origin_regex=%s",+ _cors_settings["mode"],+ _cors_settings["allow_origins"],+ _cors_settings["allow_origin_regex"],+)app.add_middleware(CORSMiddleware,allow_origins=_cors_settings["allow_origins"],diff --git a/deeptutor/api/routers/knowledge.py b/deeptutor/api/routers/knowledge.pyindex f476182a5..b44b97106 100644--- a/deeptutor/api/routers/knowledge.py+++ b/deeptutor/api/routers/knowledge.py@@ -177,6 +177,68 @@ def _build_unique_task_id(task_type: str, task_key_prefix: str) -> str:return task_manager.generate_task_id(task_type, task_key)+def _save_zip_archive(+ file: UploadFile,+ sanitized_filename: str,+ target_dir: Path,+ allowed_extensions: set[str] | None,+) -> list[Path]:+ """Safely expand an uploaded ``.zip`` into ``target_dir``.++ The archive itself is never persisted; each member is validated and+ extracted via :func:`safe_extract_zip` (Zip Slip / zip-bomb / extension+ guards). Returns the list of written file paths.+ """+ import tempfile+ import zipfile++ from deeptutor.utils.archive_extractor import ArchiveTooLargeError, safe_extract_zip++ file.file.seek(0)+ max_size = DocumentValidator.MAX_FILE_SIZE+ tmp_path: Path | None = None+ try:+ with tempfile.NamedTemporaryFile(suffix=".zip", delete=False) as tmp:+ tmp_path = Path(tmp.name)+ written = 0+ for chunk in iter(lambda: file.file.read(8192), b""):+ written += len(chunk)+ if written > max_size:+ raise HTTPException(+ status_code=400,+ detail=(+ f"Archive '{sanitized_filename}' exceeds maximum size limit of "+ f"{format_bytes_human_readable(max_size)}"+ ),+ )+ tmp.write(chunk)++ try:+ result = safe_extract_zip(+ tmp_path, target_dir, allowed_extensions=allowed_extensions or set()+ )+ except ArchiveTooLargeError as exc:+ raise HTTPException(+ status_code=400,+ detail=f"Rejected archive '{sanitized_filename}': {exc}",+ ) from exc+ except zipfile.BadZipFile as exc:+ raise HTTPException(+ status_code=400,+ detail=f"'{sanitized_filename}' is not a valid zip archive.",+ ) from exc++ if not result.extracted:+ raise HTTPException(+ status_code=400,+ detail=f"Archive '{sanitized_filename}' contained no supported files.",+ )+ return result.extracted+ finally:+ if tmp_path is not None:+ tmp_path.unlink(missing_ok=True)++def _save_uploaded_files(files: list[UploadFile],target_dir: Path,@@ -210,6 +272,26 @@ def _save_uploaded_files()file.filename = sanitized_filename+ if Path(sanitized_filename).suffix.lower() == ".zip":+ # Expand the archive in place; register each extracted+ # member instead of the zip itself.+ for dest in _save_zip_archive(+ file, sanitized_filename, target_dir, allowed_extensions+ ):+ written_file_paths.append(dest)+ uploaded_files.append(dest.name)+ uploaded_file_paths.append(str(dest))+ if _pb_sync and kb_name:+ try:+ _upload_file_to_pb(kb_name, dest.name, dest)+ except Exception as pb_exc:+ logger.debug(+ "PocketBase file upload failed for '%s': %s",+ dest.name,+ pb_exc,+ )+ continue+file_path = target_dir / sanitized_filenamemax_size = DocumentValidator.MAX_FILE_SIZEwritten_bytes = 0@@ -1059,9 +1141,13 @@ async def upload_files(),)allowed_extensions = FileTypeRouter.get_supported_extensions()- _validate_upload_batch(files, allowed_extensions=allowed_extensions)+ # ``.zip`` is accepted as an upload container; its members are+ # validated against ``allowed_extensions`` during extraction and the+ # archive itself is never indexed (``safe_extract_zip`` skips ``.zip``).+ upload_extensions = allowed_extensions | {".zip"}+ _validate_upload_batch(files, allowed_extensions=upload_extensions)uploaded_files, uploaded_file_paths = _save_uploaded_files(- files, raw_dir, allowed_extensions=allowed_extensions+ files, raw_dir, allowed_extensions=upload_extensions)task_id = _build_unique_task_id("kb_upload", kb_name)get_task_stream_manager().ensure_task(task_id)diff --git a/deeptutor/api/routers/plugins_api.py b/deeptutor/api/routers/plugins_api.pyindex 04cf6d2f3..94503761d 100644--- a/deeptutor/api/routers/plugins_api.py+++ b/deeptutor/api/routers/plugins_api.py@@ -16,7 +16,7 @@ from typing import Any, AsyncGeneratorfrom fastapi import APIRouter, HTTPExceptionfrom fastapi.responses import StreamingResponse-from pydantic import BaseModel+from pydantic import BaseModel, ConfigDict, Fieldfrom deeptutor.logging import (ProcessLogEvent,@@ -43,16 +43,22 @@ def _discover_plugins() -> list[Any]:class ToolExecuteRequest(BaseModel):- params: dict[str, Any] = {}+ params: dict[str, Any] = Field(default_factory=dict)class CapabilityExecuteRequest(BaseModel):+ model_config = ConfigDict(populate_by_name=True)+content: str- tools: list[str] = []- knowledge_bases: list[str] = []+ tools: list[str] = Field(default_factory=list, alias="enabledTools")+ knowledge_bases: list[str] = Field(default_factory=list, alias="knowledgeBases")language: str = "en"- config: dict[str, Any] = {}- attachments: list[dict[str, Any]] = []+ config: dict[str, Any] = Field(default_factory=dict)+ attachments: list[dict[str, Any]] = Field(default_factory=list)+ bot_id: str | None = None+ session_id: str | None = None+ chat_id: str | None = None+ llm_selection: dict[str, str] | None = Field(default=None, alias="llmSelection")@router.get("/list")@@ -283,6 +289,32 @@ async def _execute_capability_stream(body: CapabilityExecuteRequest,) -> AsyncGenerator[str, None]:"""Run a capability while streaming process logs, trace events, and the result."""+ bot_id = (body.bot_id or "").strip()+ if capability_name == "chat" and bot_id:+ from deeptutor.api.routers.tutorbot import (+ ChatMessageRequest,+ _bot_chat_stream,+ _ensure_running_bot,+ )++ if not body.content.strip():+ yield _sse("error", {"detail": "content is required"})+ return+ try:+ await _ensure_running_bot(bot_id)+ except HTTPException as exc:+ yield _sse("error", {"detail": exc.detail, "status_code": exc.status_code})+ return+ request = ChatMessageRequest(+ content=body.content,+ session_id=body.session_id,+ chat_id=body.chat_id,+ llm_selection=body.llm_selection,+ )+ async for chunk in _bot_chat_stream(bot_id, request):+ yield chunk+ return+from deeptutor.core.context import Attachment, UnifiedContextfrom deeptutor.runtime.orchestrator import ChatOrchestratordiff --git a/deeptutor/api/routers/question_notebook.py b/deeptutor/api/routers/question_notebook.pyindex fb89f93a0..4190b3cd2 100644--- a/deeptutor/api/routers/question_notebook.py+++ b/deeptutor/api/routers/question_notebook.py@@ -8,7 +8,7 @@ import base64 as _b64import loggingimport uuid as _uuid-from fastapi import APIRouter, HTTPException, Query+from fastapi import APIRouter, HTTPException, Query, Responsefrom pydantic import BaseModel, Fieldfrom deeptutor.services.session import get_sqlite_session_store@@ -229,10 +229,18 @@ async def lookup_entry(session_id: str = Query(...),question_id: str = Query(...),turn_id: str | None = Query(default=None),+ missing_ok: bool = Query(+ default=False,+ description="Return 204 No Content instead of 404 when the entry is "+ "absent — used by the quiz viewer to probe not-yet-saved questions "+ "without logging noisy 404s.",+ ),):store = get_sqlite_session_store()entry = await store.find_notebook_entry(session_id, question_id, turn_id=turn_id)if entry is None:+ if missing_ok:+ return Response(status_code=204)raise HTTPException(status_code=404, detail="Entry not found")return entrydiff --git a/deeptutor/api/routers/sessions.py b/deeptutor/api/routers/sessions.pyindex ea6876bfc..89a55c999 100644--- a/deeptutor/api/routers/sessions.py+++ b/deeptutor/api/routers/sessions.py@@ -4,8 +4,8 @@ Unified session history API.from __future__ import annotations-import jsonimport logging+from typing import Anyfrom fastapi import APIRouter, HTTPException, Queryfrom pydantic import BaseModel, Field, field_validator@@ -87,52 +87,56 @@ async def list_sessions(return {"sessions": sessions}+# Cap (in characters) for a single event payload returned to the UI. RAG+# tools can attach whole KB documents to ``tool_result``/``observation``+# events; the frontend TraceSurface only needs a preview, and the LLM context+# is built from a separate content-only store, so capping here never affects+# model input.+MAX_EVENT_PAYLOAD = 1024 * 1024+_TRUNCATION_NOTICE = "\n\n[... content truncated]"+_TRUNCATABLE_EVENT_TYPES = ("tool_result", "observation")+++def _truncate_oversized_events(+ messages: list[dict[str, Any]], limit: int = MAX_EVENT_PAYLOAD+) -> None:+ """Cap oversized ``tool_result``/``observation`` payloads in place.++ The session store already returns each message's events as a parsed+ ``events`` list (see ``SqliteSessionStore._serialize_message``), so we+ mutate that list directly. Only the UI rendering path is affected.+ """++ def _cap(container: dict[str, Any], field: str) -> bool:+ value = container.get(field)+ if isinstance(value, str) and len(value) > limit:+ container[field] = value[:limit] + _TRUNCATION_NOTICE+ return True+ return False++ for msg in messages:+ events = msg.get("events")+ if not isinstance(events, list):+ continue+ for event in events:+ if not isinstance(event, dict) or event.get("type") not in _TRUNCATABLE_EVENT_TYPES:+ continue+ truncated = _cap(event, "content")+ tool_metadata = (event.get("metadata") or {}).get("tool_metadata")+ if isinstance(tool_metadata, dict):+ for field in ("content", "answer"):+ truncated = _cap(tool_metadata, field) or truncated+ if truncated:+ event["_truncated"] = True++@router.get("/{session_id}")async def get_session(session_id: str):store = get_session_store()session = await store.get_session_with_messages(session_id)if session is None:raise HTTPException(status_code=404, detail="Session not found")-- # Truncate oversized event payloads (e.g. full KB documents returned by RAG- # tools) so that the frontend TraceSurface can load large sessions without- # running out of memory. This only affects the UI rendering path — the LLM- # context builder reads from a separate content-only store and is unaffected.- MAX_EVENT_PAYLOAD = 1024 * 1024- for msg in session.get("messages", []):- events_raw = msg.get("events_json") or msg.get("events")- if not events_raw or not isinstance(events_raw, (str, list)):- continue- try:- events = json.loads(events_raw) if isinstance(events_raw, str) else events_raw- truncated = False- for event in events:- if event.get("type") in ("tool_result", "observation"):- # Truncate top-level content- if isinstance(event.get("content"), str) and len(event["content"]) > MAX_EVENT_PAYLOAD:- event["content"] = event["content"][:MAX_EVENT_PAYLOAD] + "\n\n[... content truncated]"- event["_truncated"] = True- truncated = True- # Truncate nested tool_metadata fields- tm = event.get("metadata", {}).get("tool_metadata", {})- if isinstance(tm, dict):- for field in ("content", "answer"):- val = tm.get(field)- if isinstance(val, str) and len(val) > MAX_EVENT_PAYLOAD:- tm[field] = val[:MAX_EVENT_PAYLOAD] + "\n\n[... content truncated]"- event["_truncated"] = True- truncated = True- if truncated:- msg["events"] = events- msg.pop("events_json", None)- except (json.JSONDecodeError, TypeError, AttributeError):- pass-- # Deduplicate redundant events_json strings (the events dict already- # carries the same data after the transformations above).- for msg in session.get("messages", []):- msg.pop("events_json", None)-+ _truncate_oversized_events(session.get("messages", []))return sessiondiff --git a/deeptutor/api/routers/settings.py b/deeptutor/api/routers/settings.pyindex 9bc9bcc1f..77e801de7 100644--- a/deeptutor/api/routers/settings.py+++ b/deeptutor/api/routers/settings.py@@ -15,13 +15,18 @@ from typing import Any, List, Literal, Optionalfrom fastapi import APIRouter, HTTPException, Request, statusfrom fastapi.responses import StreamingResponse-from pydantic import BaseModel+from pydantic import BaseModel, Fieldlogger = logging.getLogger(__name__)from deeptutor.multi_user.context import get_current_userfrom deeptutor.multi_user.model_access import allowed_llm_options, redacted_model_access-from deeptutor.services.config import get_config_test_runner, get_model_catalog_service+from deeptutor.services.config import (+ get_config_test_runner,+ get_model_catalog_service,+ get_runtime_settings_service,+)+from deeptutor.services.config.origins import normalize_originsfrom deeptutor.services.embedding.client import reset_embedding_clientfrom deeptutor.services.llm.client import reset_llm_clientfrom deeptutor.services.llm.config import clear_llm_config_cache@@ -98,6 +103,19 @@ class CatalogPayload(BaseModel):catalog: dict[str, Any]+class FetchModelsPayload(BaseModel):+ binding: str = ""+ base_url: str+ api_key: Optional[str] = None+++class NetworkSettingsUpdate(BaseModel):+ backend_port: int = Field(ge=1, le=65535)+ frontend_port: int = Field(ge=1, le=65535)+ public_api_base: str = ""+ cors_origins: list[str] = Field(default_factory=list)++def _invalidate_runtime_caches() -> None:"""Force runtime clients/config to pick up the latest saved catalog.@@ -219,6 +237,58 @@ def _provider_choices() -> dict[str, list[dict[str, str]]]:return {"llm": llm, "embedding": embedding, "search": search}+def _api_base_source(system: dict[str, Any]) -> str:+ if system.get("next_public_api_base_external"):+ return "next_public_api_base_external"+ if system.get("next_public_api_base"):+ return "next_public_api_base"+ return "default_backend_url"+++def _network_settings_payload() -> dict[str, Any]:+ service = get_runtime_settings_service()+ file_system = service.load_system(include_process_overrides=False)+ effective_system = service.load_system(include_process_overrides=True)+ auth = service.load_auth(include_process_overrides=True)+ backend_url = f"http://localhost:{effective_system['backend_port']}"+ browser_api_base = (+ effective_system["next_public_api_base_external"]+ or effective_system["next_public_api_base"]+ or backend_url+ )+ cors_origins = normalize_origins(+ [effective_system["cors_origin"], effective_system["cors_origins"]]+ )+ auth_enabled = bool(auth["enabled"])+ cookie_secure = bool(auth["cookie_secure"])+ return {+ "settings": {+ "backend_port": file_system["backend_port"],+ "frontend_port": file_system["frontend_port"],+ "public_api_base": file_system["next_public_api_base_external"],+ "cors_origins": normalize_origins(+ [file_system["cors_origin"], file_system["cors_origins"]]+ ),+ },+ "effective": {+ "backend_url": backend_url,+ "frontend_url": f"http://localhost:{effective_system['frontend_port']}",+ "browser_api_base": browser_api_base,+ "api_base_source": _api_base_source(effective_system),+ "cors_mode": "explicit" if auth_enabled else "permissive",+ "cors_origins": cors_origins,+ "allow_remote_http_origins": not auth_enabled,+ },+ "auth": {+ "enabled": auth_enabled,+ "cookie_secure": cookie_secure,+ "cookie_samesite": "none" if cookie_secure else "lax",+ "cross_site_cookie_ready": bool(auth_enabled and cookie_secure),+ },+ "restart_required": True,+ }++@router.get("")async def get_settings():user = get_current_user()@@ -240,6 +310,30 @@ async def get_catalog():return {"catalog": get_model_catalog_service().load()}[email protected]("/network")+async def get_network_settings():+ _require_settings_admin()+ return _network_settings_payload()++[email protected]("/network")+async def update_network_settings(payload: NetworkSettingsUpdate):+ _require_settings_admin()+ service = get_runtime_settings_service()+ current = service.load_system(include_process_overrides=False)+ service.save_system(+ {+ **current,+ "backend_port": payload.backend_port,+ "frontend_port": payload.frontend_port,+ "next_public_api_base_external": payload.public_api_base.strip(),+ "cors_origin": "",+ "cors_origins": normalize_origins(payload.cors_origins),+ }+ )+ return _network_settings_payload()++@router.get("/llm-options")async def get_llm_options():if not get_current_user().is_admin:@@ -268,6 +362,37 @@ async def apply_catalog(payload: CatalogPayload | None = None):}[email protected]("/fetch-models")+async def fetch_models_from_provider(payload: FetchModelsPayload):+ """List the model IDs an OpenAI-compatible provider exposes.++ Thin HTTP surface over ``factory.fetch_models`` so the settings UI can+ populate a model picker from ``base_url`` + ``api_key`` instead of making+ the user type model IDs by hand.+ """+ _require_settings_admin()+ from deeptutor.services.llm.factory import fetch_models as fetch_llm_models++ base_url = (payload.base_url or "").strip()+ binding = (payload.binding or "").strip().lower() or "openai"+ if not base_url:+ raise HTTPException(+ status_code=status.HTTP_400_BAD_REQUEST,+ detail="base_url is required.",+ )++ try:+ model_ids = await fetch_llm_models(binding, base_url, payload.api_key)+ except Exception as exc: # noqa: BLE001 — surface any provider error as 502+ logger.exception("Failed to fetch models from %s", base_url)+ raise HTTPException(+ status_code=status.HTTP_502_BAD_GATEWAY,+ detail=f"Provider request failed: {exc}",+ ) from exc++ return {"models": [{"id": model_id, "name": model_id} for model_id in model_ids]}++@router.put("/theme")async def update_theme(update: ThemeUpdate):current_ui = load_ui_settings()diff --git a/deeptutor/api/routers/tutorbot.py b/deeptutor/api/routers/tutorbot.pyindex be15567a5..e80295269 100644--- a/deeptutor/api/routers/tutorbot.py+++ b/deeptutor/api/routers/tutorbot.py@@ -7,9 +7,12 @@ from __future__ import annotationsimport asyncioimport jsonimport logging+from typing import Any, AsyncGenerator+from uuid import uuid4from fastapi import APIRouter, HTTPException, Query, WebSocket, WebSocketDisconnect-from pydantic import BaseModel, ValidationError+from fastapi.responses import StreamingResponse+from pydantic import BaseModel, ConfigDict, Field, ValidationErrorfrom deeptutor.services.tutorbot import get_tutorbot_managerfrom deeptutor.services.tutorbot.manager import (@@ -40,6 +43,30 @@ async def _get_start_lock(bot_id: str) -> asyncio.Lock:return lock+async def _ensure_running_bot(bot_id: str) -> TutorBotInstance:+ mgr = get_tutorbot_manager()+ instance = mgr.get_bot(bot_id)+ if instance and instance.running:+ return instance++ config = mgr.load_bot_config(bot_id)+ if config is None:+ raise HTTPException(status_code=404, detail="Bot not found")++ lock = await _get_start_lock(bot_id)+ async with lock:+ instance = mgr.get_bot(bot_id)+ if instance and instance.running:+ return instance+ try:+ return await mgr.start_bot(bot_id, config)+ except RuntimeError as exc:+ raise HTTPException(status_code=500, detail=str(exc)) from None+ except Exception as exc:+ logger.exception("Failed to auto-start bot '%s'", bot_id)+ raise HTTPException(status_code=500, detail="Failed to start bot") from exc++class CreateBotRequest(BaseModel):bot_id: strname: str | None = None@@ -63,6 +90,15 @@ class FileUpdateRequest(BaseModel):content: str+class ChatMessageRequest(BaseModel):+ model_config = ConfigDict(populate_by_name=True)++ content: str = Field(..., min_length=1)+ session_id: str | None = None+ chat_id: str | None = None+ llm_selection: dict[str, str] | None = Field(default=None, alias="llmSelection")++class SoulCreateRequest(BaseModel):id: strname: str@@ -201,6 +237,7 @@ def _stopped_bot_dict("channels": channels,"model": cfg.model,"llm_selection": cfg.llm_selection,+ "allow_shell_exec": cfg.allow_shell_exec,"running": False,"started_at": None,"last_reload_error": None,@@ -389,6 +426,113 @@ async def get_bot_history(bot_id: str, limit: int = 100):return get_tutorbot_manager().get_bot_history(bot_id, limit=limit)+def _sse(event: str, payload: dict[str, Any]) -> str:+ return f"event: {event}\ndata: {json.dumps(payload, ensure_ascii=False, default=str)}\n\n"+++def _resolve_http_session(payload: ChatMessageRequest) -> tuple[str, str]:+ """Return ``(session_id, chat_id)`` for HTTP/SSE TutorBot conversations."""+ explicit_session = (payload.session_id or "").strip()+ explicit_chat = (payload.chat_id or "").strip()+ if explicit_session:+ return explicit_session, explicit_chat or explicit_session+ if explicit_chat:+ return explicit_chat, explicit_chat+ session_id = uuid4().hex+ return session_id, session_id++[email protected]("/{bot_id}/chat")+async def bot_chat_http(bot_id: str, payload: ChatMessageRequest) -> dict[str, Any]:+ """Send one HTTP message to a specified TutorBot with persistent session context."""+ content = payload.content.strip()+ if not content:+ raise HTTPException(status_code=400, detail="content is required")+ await _ensure_running_bot(bot_id)+ mgr = get_tutorbot_manager()+ session_id, chat_id = _resolve_http_session(payload)+ try:+ response = await mgr.send_message(+ bot_id,+ content,+ chat_id=chat_id,+ session_id=session_id,+ )+ except RuntimeError as exc:+ raise HTTPException(status_code=400, detail=str(exc)) from None+ return {+ "bot_id": bot_id,+ "session_id": session_id,+ "content": response,+ }+++async def _bot_chat_stream(+ bot_id: str,+ payload: ChatMessageRequest,+) -> AsyncGenerator[str, None]:+ mgr = get_tutorbot_manager()+ content = payload.content.strip()+ if not content:+ yield _sse("error", {"detail": "content is required"})+ return+ session_id, chat_id = _resolve_http_session(payload)+ queue: asyncio.Queue[dict[str, Any]] = asyncio.Queue()+ done = asyncio.Event()+ holder: dict[str, Any] = {}++ async def on_progress(text: str) -> None:+ await queue.put({"event": "thinking", "payload": {"content": text}})++ async def run() -> None:+ try:+ holder["content"] = await mgr.send_message(+ bot_id,+ content,+ chat_id=chat_id,+ session_id=session_id,+ on_progress=on_progress,+ )+ except Exception as exc: # noqa: BLE001+ holder["error"] = str(exc)+ finally:+ done.set()++ yield _sse("session", {"bot_id": bot_id, "session_id": session_id})+ task = asyncio.create_task(run())+ try:+ while not done.is_set():+ try:+ item = await asyncio.wait_for(queue.get(), timeout=0.15)+ except asyncio.TimeoutError:+ continue+ yield _sse(item["event"], item["payload"])+ while not queue.empty():+ item = queue.get_nowait()+ yield _sse(item["event"], item["payload"])+ if holder.get("error"):+ yield _sse("error", {"detail": holder["error"]})+ return+ yield _sse("content", {"content": holder.get("content", "")})+ yield _sse("done", {"bot_id": bot_id, "session_id": session_id})+ finally:+ if not task.done():+ task.cancel()++[email protected]("/{bot_id}/chat/execute-stream")+async def bot_chat_http_stream(bot_id: str, payload: ChatMessageRequest):+ """Stream one HTTP message to a specified TutorBot as server-sent events."""+ if not payload.content.strip():+ raise HTTPException(status_code=400, detail="content is required")+ await _ensure_running_bot(bot_id)+ return StreamingResponse(+ _bot_chat_stream(bot_id, payload),+ media_type="text/event-stream",+ headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"},+ )++@router.websocket("/{bot_id}/ws")async def bot_chat_ws(ws: WebSocket, bot_id: str):from deeptutor.api.routers.auth import ws_auth_failed, ws_require_auth@@ -465,10 +609,12 @@ async def bot_chat_ws(ws: WebSocket, bot_id: str):try:chat_id_value = data.get("chat_id", "web")+ session_id_value = data.get("session_id")response = await mgr.send_message(bot_id,content,chat_id=chat_id_value,+ session_id=session_id_value,on_progress=on_progress,)if not await _safe_send({"type": "content", "content": response}):diff --git a/deeptutor/core/agentic/client.py b/deeptutor/core/agentic/client.pyindex 9f56a1b16..7b54b6645 100644--- a/deeptutor/core/agentic/client.py+++ b/deeptutor/core/agentic/client.py@@ -7,7 +7,10 @@ provider gating, Azure detection, SSL bypass, or per-model token caps.from __future__ import annotations+import asynciofrom dataclasses import dataclass+import json+from types import SimpleNamespacefrom typing import Anyimport httpx@@ -15,6 +18,9 @@ from openai import AsyncAzureOpenAI, AsyncOpenAIfrom deeptutor.services.config import load_system_settingsfrom deeptutor.services.llm import get_token_limit_kwargs, supports_tools+from deeptutor.services.llm.reasoning_params import (+ build_openai_compatible_reasoning_kwargs,+)from deeptutor.services.provider_registry import find_by_name# Providers that don't reliably support OpenAI function-calling. The loop@@ -22,12 +28,6 @@ from deeptutor.services.provider_registry import find_by_name_NATIVE_TOOL_BLOCKED_BINDINGS: frozenset[str] = frozenset({"anthropic", "claude", "ollama", "lm_studio", "vllm", "llama_cpp"})-_THINKING_STYLE_MAP = {- "thinking_type": lambda enabled: {"thinking": {"type": "enabled" if enabled else "disabled"}},- "enable_thinking": lambda enabled: {"enable_thinking": enabled},- "reasoning_split": lambda enabled: {"reasoning_split": enabled},-}-_THINKING_DISABLED_BY_DEFAULT: tuple[tuple[str, str], ...] = (("deepseek", "deepseek-v4-flash"),)@dataclass(frozen=True)@@ -45,10 +45,23 @@ class LLMClientConfig:def build_openai_client(config: LLMClientConfig) -> Any:"""Construct an ``AsyncOpenAI`` / ``AsyncAzureOpenAI`` client."""+ default_headers = config.extra_headers or None+ spec = find_by_name(config.binding)+ if spec and spec.backend == "anthropic":+ from deeptutor.services.llm.provider_core import AnthropicProvider++ provider = AnthropicProvider(+ api_key=config.api_key,+ api_base=config.base_url or spec.default_api_base or None,+ default_model=config.model or "claude-sonnet-4-20250514",+ extra_headers=config.extra_headers,+ supports_prompt_caching=spec.supports_prompt_caching,+ )+ return _AnthropicOpenAIAdapter(provider)+http_client = Noneif load_system_settings()["disable_ssl_verify"]:http_client = httpx.AsyncClient(verify=False) # nosec B501- default_headers = config.extra_headers or Noneif config.binding == "azure_openai" or (config.binding == "openai" and config.api_version):return AsyncAzureOpenAI(api_key=config.api_key or "sk-no-key-required",@@ -65,6 +78,185 @@ def build_openai_client(config: LLMClientConfig) -> Any:)+class _AnthropicOpenAIAdapter:+ """OpenAI chat-completions facade backed by the native Anthropic provider."""++ def __init__(self, provider: Any):+ self._provider = provider+ self.chat = SimpleNamespace(completions=SimpleNamespace(create=self._create_completion))++ async def _create_completion(self, **kwargs: Any) -> Any:+ stream = bool(kwargs.pop("stream", False))+ messages = kwargs.pop("messages", [])+ model = kwargs.pop("model", None)+ tools = kwargs.pop("tools", None)+ tool_choice = kwargs.pop("tool_choice", None)+ temperature = kwargs.pop("temperature", 0.7)+ max_tokens = kwargs.pop("max_completion_tokens", None)+ if max_tokens is None:+ max_tokens = kwargs.pop("max_tokens", 4096)+ reasoning_effort = kwargs.pop("reasoning_effort", None)+ kwargs.pop("stream_options", None)++ if stream:+ return _AnthropicOpenAIStream(+ provider=self._provider,+ messages=messages,+ tools=tools,+ model=model,+ max_tokens=max_tokens,+ temperature=temperature,+ reasoning_effort=reasoning_effort,+ tool_choice=tool_choice,+ extra_kwargs=kwargs,+ )++ response = await self._provider.chat(+ messages=messages,+ tools=tools,+ model=model,+ max_tokens=max_tokens,+ temperature=temperature,+ reasoning_effort=reasoning_effort,+ tool_choice=tool_choice,+ **kwargs,+ )+ return SimpleNamespace(+ choices=[+ SimpleNamespace(+ message=SimpleNamespace(+ content=response.content or "",+ tool_calls=[+ _openai_tool_call(tool_call, index=index)+ for index, tool_call in enumerate(response.tool_calls or [])+ ],+ ),+ finish_reason=response.finish_reason or "stop",+ )+ ],+ usage=response.usage or None,+ )+++class _AnthropicOpenAIStream:+ def __init__(+ self,+ *,+ provider: Any,+ messages: list[dict[str, Any]],+ tools: list[dict[str, Any]] | None,+ model: str | None,+ max_tokens: Any,+ temperature: Any,+ reasoning_effort: str | None,+ tool_choice: str | dict[str, Any] | None,+ extra_kwargs: dict[str, Any],+ ) -> None:+ self._provider = provider+ self._messages = messages+ self._tools = tools+ self._model = model+ self._max_tokens = max_tokens+ self._temperature = temperature+ self._reasoning_effort = reasoning_effort+ self._tool_choice = tool_choice+ self._extra_kwargs = extra_kwargs+ self._queue: asyncio.Queue[Any] | None = None+ self._task: asyncio.Task[None] | None = None+ self._emitted_content = False++ def __aiter__(self) -> "_AnthropicOpenAIStream":+ if self._queue is None:+ self._queue = asyncio.Queue()+ self._task = asyncio.create_task(self._run())+ return self++ async def __anext__(self) -> Any:+ if self._queue is None:+ self.__aiter__()+ assert self._queue is not None+ item = await self._queue.get()+ if item is None:+ raise StopAsyncIteration+ if isinstance(item, Exception):+ raise item+ return item++ async def close(self) -> None:+ if self._task and not self._task.done():+ self._task.cancel()++ async def _run(self) -> None:+ assert self._queue is not None++ async def _on_content_delta(text: str) -> None:+ if text:+ self._emitted_content = True+ await self._queue.put(_openai_stream_chunk(content=text))++ try:+ response = await self._provider.chat_stream(+ messages=self._messages,+ tools=self._tools,+ model=self._model,+ max_tokens=self._max_tokens,+ temperature=self._temperature,+ reasoning_effort=self._reasoning_effort,+ tool_choice=self._tool_choice,+ on_content_delta=_on_content_delta,+ **self._extra_kwargs,+ )+ if response.content and not self._emitted_content:+ await self._queue.put(_openai_stream_chunk(content=response.content))+ for index, tool_call in enumerate(response.tool_calls or []):+ await self._queue.put(_openai_stream_chunk(tool_call=tool_call, index=index))+ await self._queue.put(+ _openai_stream_chunk(+ finish_reason=response.finish_reason or "stop",+ usage=response.usage or None,+ )+ )+ except Exception as exc:+ await self._queue.put(exc)+ finally:+ await self._queue.put(None)+++def _openai_tool_call(tool_call: Any, *, index: int) -> Any:+ function = SimpleNamespace(+ name=getattr(tool_call, "name", ""),+ arguments=json.dumps(getattr(tool_call, "arguments", {}) or {}, ensure_ascii=False),+ )+ return SimpleNamespace(+ index=index,+ id=getattr(tool_call, "id", ""),+ type="function",+ function=function,+ )+++def _openai_stream_chunk(+ *,+ content: str | None = None,+ tool_call: Any | None = None,+ index: int = 0,+ finish_reason: str | None = None,+ usage: dict[str, int] | None = None,+) -> Any:+ tool_calls = None+ if tool_call is not None:+ tool_calls = [_openai_tool_call(tool_call, index=index)]+ return SimpleNamespace(+ choices=[+ SimpleNamespace(+ delta=SimpleNamespace(content=content, tool_calls=tool_calls),+ finish_reason=finish_reason,+ )+ ],+ usage=usage,+ )++def build_completion_kwargs(*,temperature: float,@@ -87,15 +279,6 @@ def build_completion_kwargs(return kwargs-def _disable_thinking_by_default(binding: str | None, model: str | None) -> bool:- normalized_model = (model or "").strip().lower()- normalized_binding = (binding or "").strip().lower()- return any(- normalized_binding == provider and pattern in normalized_model- for provider, pattern in _THINKING_DISABLED_BY_DEFAULT- )--def build_provider_extra_kwargs(*,binding: str | None,@@ -110,43 +293,19 @@ def build_provider_extra_kwargs(provider-specific thinking flags."""spec = find_by_name(binding)- model_name = model or ""- resolved_effort = reasoning_effort- if resolved_effort is None and spec and spec.reasoning_model_patterns:- model_lower = model_name.lower()- if any(pattern.lower() in model_lower for pattern in spec.reasoning_model_patterns):- resolved_effort = "high"-- semantic_effort: str | None = None- if isinstance(resolved_effort, str):- semantic_effort = resolved_effort.lower()- if semantic_effort == "minimum":- semantic_effort = "minimal"-- wire_effort = resolved_effort- if spec and spec.name == "dashscope" and semantic_effort == "minimal":- wire_effort = "minimum"-- kwargs: dict[str, Any] = {}- if wire_effort and not (spec and spec.thinking_style and semantic_effort == "minimal"):- kwargs["reasoning_effort"] = wire_effort-- if spec and spec.thinking_style and resolved_effort is not None:- thinking_enabled = semantic_effort != "minimal"- extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _enabled: None)(- thinking_enabled- )- if extra:- kwargs.setdefault("extra_body", {}).update(extra)- elif spec and spec.thinking_style and _disable_thinking_by_default(spec.name, model_name):- extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _enabled: None)(False)- if extra:- kwargs.setdefault("extra_body", {}).update(extra)- return kwargs+ return build_openai_compatible_reasoning_kwargs(+ spec=spec,+ binding=binding,+ model=model,+ reasoning_effort=reasoning_effort,+ )def can_use_native_tool_calling(*, binding: str, model: str | None) -> bool:"""Whether the current provider supports OpenAI-style function calling."""if not supports_tools(binding, model):return False+ spec = find_by_name(binding)+ if spec and spec.backend == "anthropic":+ return Truereturn binding not in _NATIVE_TOOL_BLOCKED_BINDINGSdiff --git a/deeptutor/core/agentic/labeled_step.py b/deeptutor/core/agentic/labeled_step.pyindex cbbfc7bf2..f3a65c5b8 100644--- a/deeptutor/core/agentic/labeled_step.py+++ b/deeptutor/core/agentic/labeled_step.py@@ -47,6 +47,7 @@ from deeptutor.core.agentic.usage import UsageTrackerfrom deeptutor.core.stream_bus import StreamBusfrom deeptutor.core.trace import merge_trace_metadatafrom deeptutor.services.llm import clean_thinking_tags+from deeptutor.services.llm.multimodal import should_degrade_to_text, strip_image_parts_inplace# Reasoning models (Qwen, Deepseek-R1 via certain proxies, etc.) sometimes# inline a literal ``<think>...</think>`` block in the content stream before@@ -118,8 +119,8 @@ def _message_content_chars(message: dict[str, Any]) -> int:return len(str(content))-def _is_stream_options_unsupported(exc: Exception) -> bool:- """Detect providers that reject OpenAI's ``stream_options`` parameter."""+def _error_text(exc: Exception) -> str:+ """Best-effort lowercase error body for provider-capability detection."""response = getattr(exc, "response", None)body = (getattr(exc, "body", None)@@ -128,7 +129,12 @@ def _is_stream_options_unsupported(exc: Exception) -> bool:or getattr(exc, "message", None)or str(exc))- text = str(body).lower()+ return str(body).lower()+++def _is_stream_options_unsupported(exc: Exception) -> bool:+ """Detect providers that reject OpenAI's ``stream_options`` parameter."""+ text = _error_text(exc)return any(marker in textfor marker in (@@ -145,15 +151,7 @@ def _is_stream_options_unsupported(exc: Exception) -> bool:def _is_tool_schema_unsupported(exc: Exception) -> bool:"""Detect providers that reject native tool/function-calling schemas."""- response = getattr(exc, "response", None)- body = (- getattr(exc, "body", None)- or getattr(exc, "doc", None)- or getattr(response, "text", None)- or getattr(exc, "message", None)- or str(exc)- )- text = str(body).lower()+ text = _error_text(exc)return any(marker in textfor marker in (@@ -169,6 +167,32 @@ def _is_tool_schema_unsupported(exc: Exception) -> bool:)+def _is_image_input_unsupported(exc: Exception) -> bool:+ """Detect providers/models that reject image (multimodal) content.++ Covers both explicit "no vision" rejections and the structural errors a+ text-only OpenAI-compatible model raises when it receives the content+ *array* the image injection produced (it expected a plain string).+ Transient errors (rate limit / 5xx) never mention these markers, so they+ don't trigger the image fallback.+ """+ text = _error_text(exc)+ return any(+ marker in text+ for marker in (+ "image",+ "vision",+ "multimodal",+ "image_url",+ "content type",+ "must be a string",+ "expected a string",+ "expected string",+ "invalid type for 'messages",+ )+ )++async def run_labeled_step(*,client: Any,@@ -484,6 +508,24 @@ async def run_labeled_step(retry_kwargs.pop("tools", None)retry_kwargs.pop("tool_choice", None)return await client.chat.completions.create(**retry_kwargs)+ # Stage-2 vision fallback: the model rejected our image content and+ # it is not in the known-vision allowlist. Strip images in place+ # (so they aren't re-sent on later loop iterations) and retry the+ # turn text-only rather than hard-failing.+ if _is_image_input_unsupported(exc) and should_degrade_to_text(+ binding, model, kwargs.get("messages") or []+ ):+ strip_image_parts_inplace(kwargs["messages"])+ await stream.progress(+ "Model does not support image input; retrying without images.",+ source=source,+ stage=stage,+ metadata=merge_trace_metadata(+ iter_meta,+ {"trace_kind": "warning", "image_fallback": True},+ ),+ )+ return await client.chat.completions.create(**kwargs)raiseresponse_stream = await _create_response_stream()diff --git a/deeptutor/services/config/origins.py b/deeptutor/services/config/origins.pynew file mode 100644index 000000000..380b55054--- /dev/null+++ b/deeptutor/services/config/origins.py@@ -0,0 +1,55 @@+from __future__ import annotations++import re+from typing import Any, Iterable+from urllib.parse import urlparse++_ORIGIN_SEPARATORS = re.compile(r"[,;\n]+")+++def _raw_origin_items(value: Any) -> Iterable[str]:+ if value is None:+ return []+ if isinstance(value, (list, tuple, set)):+ items: list[str] = []+ for item in value:+ items.extend(_raw_origin_items(item))+ return items+ return _ORIGIN_SEPARATORS.split(str(value))+++def normalize_origin(value: Any) -> str:+ """Normalize a browser Origin value for CORS allowlists.++ Operators often paste values as ``host:port`` or separate multiple origins+ with semicolons. Browsers always send an Origin as ``scheme://host[:port]``.+ This helper makes common deployment input tolerant while keeping the output+ as exact origins for Starlette's CORSMiddleware.+ """++ origin = str(value or "").strip().rstrip("/")+ if not origin:+ return ""+ if origin in {"*", "null"}:+ return origin+ if "://" not in origin:+ origin = f"http://{origin}"++ try:+ parsed = urlparse(origin)+ except ValueError:+ return origin+ if parsed.scheme in {"http", "https"} and parsed.netloc:+ return f"{parsed.scheme}://{parsed.netloc}".rstrip("/")+ return origin+++def normalize_origins(value: Any) -> list[str]:+ origins: list[str] = []+ seen: set[str] = set()+ for raw in _raw_origin_items(value):+ origin = normalize_origin(raw)+ if origin and origin not in seen:+ origins.append(origin)+ seen.add(origin)+ return originsdiff --git a/deeptutor/services/config/runtime_settings.py b/deeptutor/services/config/runtime_settings.pyindex c51928907..8c8d8d218 100644--- a/deeptutor/services/config/runtime_settings.py+++ b/deeptutor/services/config/runtime_settings.py@@ -9,6 +9,8 @@ from typing import Any, Callablefrom deeptutor.services.path_service import get_path_service+from .origins import normalize_origins+DEFAULT_SYSTEM_SETTINGS: dict[str, Any] = {"version": 1,"backend_port": 8001,@@ -68,18 +70,7 @@ def _coerce_port(value: Any, default: int) -> int:def _coerce_origins(value: Any) -> list[str]:- if isinstance(value, list):- raw_items = value- else:- raw_items = str(value or "").replace("\n", ",").split(",")- origins: list[str] = []- seen: set[str] = set()- for raw in raw_items:- origin = str(raw).strip().rstrip("/")- if origin and origin not in seen:- origins.append(origin)- seen.add(origin)- return origins+ return normalize_origins(value)def _deepcopy_default(defaults: dict[str, Any]) -> dict[str, Any]:@@ -286,6 +277,8 @@ class RuntimeSettingsService:payload["frontend_port"] = valueif value := self._process_env_value("NEXT_PUBLIC_API_BASE_EXTERNAL"):payload["next_public_api_base_external"] = value+ if value := self._process_env_value("PUBLIC_API_BASE"):+ payload["next_public_api_base_external"] = valueif value := self._process_env_value("NEXT_PUBLIC_API_BASE"):payload["next_public_api_base"] = valueif value := self._process_env_value("CORS_ORIGIN"):@@ -330,11 +323,14 @@ class RuntimeSettingsService:return self._normalize_integrations(payload)def _normalize_system(self, settings: dict[str, Any]) -> dict[str, Any]:+ public_api_base = _string(settings.get("next_public_api_base_external")) or _string(+ settings.get("public_api_base")+ )return {"version": 1,"backend_port": _coerce_port(settings.get("backend_port"), 8001),"frontend_port": _coerce_port(settings.get("frontend_port"), 3782),- "next_public_api_base_external": _string(settings.get("next_public_api_base_external")),+ "next_public_api_base_external": public_api_base,"next_public_api_base": _string(settings.get("next_public_api_base")),"cors_origin": _string(settings.get("cors_origin")),"cors_origins": _coerce_origins(settings.get("cors_origins")),diff --git a/deeptutor/services/llm/capabilities.py b/deeptutor/services/llm/capabilities.pyindex c56fba082..e437109f0 100644--- a/deeptutor/services/llm/capabilities.py+++ b/deeptutor/services/llm/capabilities.py@@ -35,6 +35,7 @@ PROVIDER_CAPABILITIES: dict[str, dict[str, object]] = {"supports_streaming": True,"supports_tools": True, # Most OpenAI-compat endpoints support function calling"supports_vision": False, # Per-model; set True via MODEL_OVERRIDES+ "vision_url_supported": True,"system_in_messages": True,"has_thinking_tags": False, # Per-model; MODEL_OVERRIDES handles qwen/deepseek etc.},@@ -66,6 +67,24 @@ PROVIDER_CAPABILITIES: dict[str, dict[str, object]] = {"system_in_messages": False,"has_thinking_tags": False,},+ "custom_anthropic": {+ "supports_response_format": False,+ "supports_streaming": True,+ "supports_tools": True,+ "supports_vision": True,+ "vision_url_supported": False,+ "system_in_messages": False,+ "has_thinking_tags": False,+ },+ "minimax_anthropic": {+ "supports_response_format": False,+ "supports_streaming": True,+ "supports_tools": True,+ "supports_vision": True,+ "vision_url_supported": False,+ "system_in_messages": False,+ "has_thinking_tags": False,+ },# DeepSeek"deepseek": {"supports_response_format": False, # DeepSeek doesn't support strict JSON schema yet@@ -75,6 +94,28 @@ PROVIDER_CAPABILITIES: dict[str, dict[str, object]] = {"system_in_messages": True,"has_thinking_tags": True, # DeepSeek reasoner has thinking tags},+ # VolcEngine Ark (Doubao) and BytePlus — OpenAI-compatible gateways that+ # host natively multimodal models (Doubao-Vision). ``supports_vision`` is+ # the Stage-2 fallback hint (see ``multimodal.py``), not a pre-flight gate:+ # marking these True means a transient failure never causes images to be+ # silently dropped. The Ark API expects inline base64 image data, so+ # url-only attachments are resolved to bytes before sending.+ "volcengine": {+ "supports_response_format": True,+ "supports_streaming": True,+ "supports_tools": True,+ "supports_vision": True,+ "vision_url_supported": False,+ "system_in_messages": True,+ },+ "byteplus": {+ "supports_response_format": True,+ "supports_streaming": True,+ "supports_tools": True,+ "supports_vision": True,+ "vision_url_supported": False,+ "system_in_messages": True,+ },# OpenRouter (aggregator, generally OpenAI-compatible)"openrouter": {"supports_response_format": True, # Depends on underlying modeldiff --git a/deeptutor/services/llm/factory.py b/deeptutor/services/llm/factory.pyindex e123d6d62..7292b3da1 100644--- a/deeptutor/services/llm/factory.py+++ b/deeptutor/services/llm/factory.py@@ -17,7 +17,7 @@ from deeptutor.services.provider_registry import (find_gateway,)-from .capabilities import supports_response_format+from .capabilities import supports_response_format, supports_visionfrom .config import LLMConfig, get_llm_configfrom .error_mapping import map_errorfrom .multimodal import prepare_multimodal_messages@@ -272,13 +272,6 @@ def _build_messages(]-def _find_last_user_message(messages: list[dict[str, Any]]) -> dict[str, Any] | None:- for message in reversed(messages):- if message.get("role") == "user":- return message- return None--def _coerce_stream_coalesce_chars(value: Any) -> int:try:return max(1, int(value))@@ -293,23 +286,6 @@ def _coerce_stream_coalesce_seconds(value: Any) -> float:return DEFAULT_STREAM_COALESCE_SECONDS-def _append_image_placeholder(messages: list[dict[str, Any]]) -> None:- target = _find_last_user_message(messages)- placeholder = "[image omitted]"- if target is None:- messages.append({"role": "user", "content": placeholder})- return-- content = target.get("content")- if isinstance(content, str):- target["content"] = f"{content}\n\n{placeholder}" if content else placeholder- return- if isinstance(content, list):- content.append({"type": "text", "text": placeholder})- return- target["content"] = placeholder--def _apply_inline_image_data(messages: list[dict[str, Any]],*,@@ -329,8 +305,6 @@ def _apply_inline_image_data(mime_type=image_mime_type,)result = prepare_multimodal_messages(messages, [attachment], binding=binding, model=model)- if result.images_stripped:- _append_image_placeholder(messages)return result.messages@@ -411,6 +385,7 @@ async def complete(model=config.model,reasoning_effort=config.reasoning_effort,retry_delays=retry_delays,+ allow_image_fallback=not supports_vision(capability_binding, config.model),**extra_kwargs,)except Exception as exc:@@ -510,6 +485,7 @@ async def stream(on_content_delta=_on_content_delta,on_reasoning_delta=_on_reasoning_delta,retry_delays=retry_delays,+ allow_image_fallback=not supports_vision(capability_binding, config.model),**extra_kwargs,)if in_think_block:diff --git a/deeptutor/services/llm/multimodal.py b/deeptutor/services/llm/multimodal.pyindex 2ee955d81..00873a789 100644--- a/deeptutor/services/llm/multimodal.py+++ b/deeptutor/services/llm/multimodal.py@@ -28,11 +28,15 @@ _LOCAL_ATTACHMENT_PREFIX = "/api/attachments/"@dataclassclass MultimodalResult:- """Result of multimodal message preparation."""+ """Result of Stage-1 multimodal message preparation.++ Images are injected optimistically for every provider, so there is no+ "stripped because unsupported" outcome here — that decision is deferred+ to the Stage-2 fallback at each call site's retry seam (see+ :func:`should_degrade_to_text`).+ """messages: list[dict[str, Any]]- vision_supported: bool- images_stripped: bool# Number of url-only images we had to drop because the provider requires# base64 and we couldn't resolve the URL locally (external URL or missing# file). The caller can surface this to the user.@@ -79,11 +83,6 @@ def _build_anthropic_image_part(}-def _image_placeholder(url: str = "", filename: str = "") -> str:- label = filename or url- return f"[image: {label}]" if label else "[image omitted]"--def _resolve_local_attachment_url(url: str) -> tuple[str, str] | None:"""Resolve a ``/api/attachments/<sid>/<aid>/<name>`` URL to (base64, mime).@@ -127,67 +126,46 @@ def prepare_multimodal_messages(model: str | None = None,) -> MultimodalResult:"""- Inject image attachments into the last user message.-- If the model supports vision the last user message ``content`` field is- converted from a plain string into a content-parts array that includes- both the original text and the image(s).-- If the model does **not** support vision, the messages are returned- unchanged and ``images_stripped`` is set to ``True`` so the caller- can emit a warning to the user.+ Inject image attachments into the last user message (Stage 1).++ Images are injected **optimistically for every provider/model** — this+ function does not consult ``supports_vision``. A model that natively+ understands images therefore always receives them, even one DeepTutor has+ no capability entry for (the original Doubao/VolcEngine bug). When a model+ genuinely cannot handle images the request fails and the Stage-2 fallback+ (:func:`should_degrade_to_text` + :func:`strip_image_parts`, applied at+ each call site's retry seam) strips the images and retries as text-only.++ The last user message ``content`` is converted from a plain string into a+ content-parts array holding the original text plus the image(s). The only+ images dropped *here* are url-only attachments the provider can't accept in+ URL form (Anthropic, or ``vision_url_supported=False``) and that can't be+ resolved to local bytes — counted in ``url_images_dropped``.Args:messages: The OpenAI-style messages list (may be mutated).attachments: ``Attachment`` objects from ``UnifiedContext``.binding: Provider binding (``"openai"``, ``"anthropic"``, …).- model: Model name used for capability lookup.+ model: Model name (used only to pick the URL-vs-base64 image format).Returns:A ``MultimodalResult`` with the (potentially modified) messages."""if not attachments:- return MultimodalResult(- messages=messages,- vision_supported=True,- images_stripped=False,- )+ return MultimodalResult(messages=messages)image_attachments = [a for a in attachments if getattr(a, "type", "") == "image"]if not image_attachments:- return MultimodalResult(- messages=messages,- vision_supported=True,- images_stripped=False,- )-- vision_ok = supports_vision(binding, model)-- if not vision_ok:- logger.info(- "Model %s/%s does not support vision – stripping %d image(s)",- binding,- model,- len(image_attachments),- )- return MultimodalResult(- messages=messages,- vision_supported=False,- images_stripped=True,- )+ return MultimodalResult(messages=messages)last_user_idx = _find_last_user_message(messages)if last_user_idx is None:- return MultimodalResult(- messages=messages,- vision_supported=True,- images_stripped=False,- )+ return MultimodalResult(messages=messages)is_anthropic = (binding or "").lower() in ("anthropic", "claude")# Anthropic adapter only emits base64 source blocks, and providers like- # Moonshot reject URL form outright. In both cases url-only attachments- # must be resolved to bytes before injection.+ # Moonshot / VolcEngine reject URL form outright. In both cases url-only+ # attachments must be resolved to bytes before injection.require_base64 = is_anthropic or not supports_vision_url(binding, model)dropped = _inject_images(messages,@@ -197,12 +175,7 @@ def prepare_multimodal_messages(require_base64=require_base64,)- return MultimodalResult(- messages=messages,- vision_supported=True,- images_stripped=False,- url_images_dropped=dropped,- )+ return MultimodalResult(messages=messages, url_images_dropped=dropped)def _find_last_user_message(messages: list[dict[str, Any]]) -> int | None:@@ -295,6 +268,24 @@ def _inject_images(return dropped+_IMAGE_BLOCK_TYPES = frozenset({"image_url", "image"})+++def _block_image_placeholder(block: dict[str, Any]) -> str:+ """Human-readable text placeholder for an image block being stripped."""+ meta = block.get("_meta") or {}+ label = ""+ if isinstance(meta, dict):+ label = str(meta.get("path") or meta.get("filename") or "").strip()+ if not label and block.get("type") == "image_url":+ image_url = block.get("image_url") or {}+ if isinstance(image_url, dict):+ url = str(image_url.get("url") or "").strip()+ if url and not url.startswith("data:"):+ label = url+ return f"[image: {label}]" if label else "[image omitted]"++def has_image_parts(messages: list[dict[str, Any]]) -> bool:"""Return True when any message content contains image blocks."""for msg in messages:@@ -302,38 +293,75 @@ def has_image_parts(messages: list[dict[str, Any]]) -> bool:if not isinstance(content, list):continuefor item in content:- if isinstance(item, dict) and item.get("type") in {"image_url", "image"}:+ if isinstance(item, dict) and item.get("type") in _IMAGE_BLOCK_TYPES:return Truereturn Falsedef strip_image_parts(messages: list[dict[str, Any]]) -> list[dict[str, Any]]:- """Replace image blocks with text placeholders for fallback retries."""+ """Return a **new** message list with image blocks replaced by text+ placeholders. Use when the caller must preserve the original (e.g. to+ attempt a text-only retry while keeping the image payload for a possible+ second provider)."""stripped: list[dict[str, Any]] = []for msg in messages:content = msg.get("content")if not isinstance(content, list):stripped.append(dict(msg))continue- new_content: list[dict[str, Any]] = []- for item in content:- if isinstance(item, dict) and item.get("type") in {"image_url", "image"}:- image_url = item.get("image_url") or {}- url = image_url.get("url", "") if isinstance(image_url, dict) else ""- meta = item.get("_meta") or {}- filename = ""- if isinstance(meta, dict):- filename = str(meta.get("path") or meta.get("filename") or "")- new_content.append({"type": "text", "text": _image_placeholder(url, filename)})- else:- new_content.append(item)+ new_content: list[dict[str, Any]] = [+ {"type": "text", "text": _block_image_placeholder(item)}+ if isinstance(item, dict) and item.get("type") in _IMAGE_BLOCK_TYPES+ else item+ for item in content+ ]stripped.append({**msg, "content": new_content})return stripped+def strip_image_parts_inplace(messages: list[dict[str, Any]]) -> bool:+ """Replace image blocks with text placeholders **in place**; return True+ if any were replaced.++ Used by call sites that share one message list across retries / loop+ iterations (the chat agentic loop) so the degrade persists and images are+ not re-sent — and re-rejected — on every subsequent call."""+ found = False+ for msg in messages:+ content = msg.get("content")+ if not isinstance(content, list):+ continue+ for idx, block in enumerate(content):+ if isinstance(block, dict) and block.get("type") in _IMAGE_BLOCK_TYPES:+ content[idx] = {"type": "text", "text": _block_image_placeholder(block)}+ found = True+ return found+++def should_degrade_to_text(+ binding: str | None,+ model: str | None,+ messages: list[dict[str, Any]],+) -> bool:+ """Stage-2 fallback decision.++ After a request that carried image content fails, return True when we+ should strip the images and retry as text-only — i.e. the payload+ actually had image parts **and** the model is *not* in the known-vision+ allowlist (``supports_vision`` is False). For allowlisted (known+ vision-capable) models we keep the images so a genuine error surfaces+ instead of silently returning a misleading text-only answer.+ """+ if not has_image_parts(messages):+ return False+ return not supports_vision(binding or "openai", model)++__all__ = ["MultimodalResult","has_image_parts","prepare_multimodal_messages",+ "should_degrade_to_text","strip_image_parts",+ "strip_image_parts_inplace",]diff --git a/deeptutor/services/llm/provider_core/base.py b/deeptutor/services/llm/provider_core/base.pyindex fff6fbefb..d7b7363db 100644--- a/deeptutor/services/llm/provider_core/base.py+++ b/deeptutor/services/llm/provider_core/base.py@@ -85,7 +85,6 @@ class LLMProvider(ABC):"server error","temporarily unavailable",)- _IMAGE_BLOCK_TYPES = frozenset({"image_url", "image"})_SENTINEL = object()@staticmethod@@ -190,54 +189,6 @@ class LLMProvider(ABC):sanitized.append(clean)return sanitized- @staticmethod- def _image_placeholder(block: dict[str, Any]) -> str:- meta = block.get("_meta") or {}- label = ""- if isinstance(meta, dict):- label = str(meta.get("path") or meta.get("filename") or "").strip()- if not label and block.get("type") == "image_url":- image_url = block.get("image_url") or {}- if isinstance(image_url, dict):- url = str(image_url.get("url") or "").strip()- if url and not url.startswith("data:"):- label = url- return f"[image: {label}]" if label else "[image omitted]"-- @classmethod- def _strip_image_content(cls, messages: list[dict[str, Any]]) -> list[dict[str, Any]] | None:- """Replace image blocks with text placeholders."""- found = False- stripped: list[dict[str, Any]] = []- for msg in messages:- content = msg.get("content")- if not isinstance(content, list):- stripped.append(dict(msg))- continue- new_content: list[dict[str, Any]] = []- for block in content:- if isinstance(block, dict) and block.get("type") in cls._IMAGE_BLOCK_TYPES:- new_content.append({"type": "text", "text": cls._image_placeholder(block)})- found = True- else:- new_content.append(block)- stripped.append({**msg, "content": new_content})- return stripped if found else None-- @classmethod- def _strip_image_content_inplace(cls, messages: list[dict[str, Any]]) -> bool:- """Replace image blocks with text placeholders in-place."""- found = False- for msg in messages:- content = msg.get("content")- if not isinstance(content, list):- continue- for idx, block in enumerate(content):- if isinstance(block, dict) and block.get("type") in cls._IMAGE_BLOCK_TYPES:- content[idx] = {"type": "text", "text": cls._image_placeholder(block)}- found = True- return found-@staticmethoddef _normalize_retry_delays(retry_delays: Sequence[float] | None) -> tuple[float, ...]:if retry_delays is None:@@ -313,8 +264,15 @@ class LLMProvider(ABC):reasoning_effort: str | None,tool_choice: str | dict[str, Any] | None,retry_delays: Sequence[float] | None,+ allow_image_fallback: bool = True,**kwargs: Any,) -> LLMResponse:+ from deeptutor.services.llm.multimodal import (+ has_image_parts,+ strip_image_parts,+ strip_image_parts_inplace,+ )+delays = self._normalize_retry_delays(retry_delays)attempt = 0@@ -343,13 +301,17 @@ class LLMProvider(ABC):return responseif not self._is_transient_error(response.content):- stripped = self._strip_image_content(messages)- if stripped is not None:+ # Stage-2 vision fallback: only degrade to text-only when the+ # caller opted in (model is *not* in the known-vision+ # allowlist). For allowlisted models we trust the images and+ # let the real error surface rather than masking it.+ if allow_image_fallback and has_image_parts(messages):logger.warning(- "Non-transient LLM error with image content, retrying once without images"+ "Non-transient LLM error with image content; model is not"+ " known vision-capable, retrying once without images")retry_response = await call(- messages=stripped,+ messages=strip_image_parts(messages),tools=tools,model=model,max_tokens=max_tokens,@@ -359,7 +321,7 @@ class LLMProvider(ABC):**kwargs,)if retry_response.finish_reason != "error":- self._strip_image_content_inplace(messages)+ strip_image_parts_inplace(messages)return retry_responsereturn response@@ -386,9 +348,16 @@ class LLMProvider(ABC):reasoning_effort: object = _SENTINEL,tool_choice: str | dict[str, Any] | None = None,retry_delays: Sequence[float] | None = None,+ allow_image_fallback: bool = True,**kwargs: Any,) -> LLMResponse:- """Call chat() with retry on transient provider failures."""+ """Call chat() with retry on transient provider failures.++ ``allow_image_fallback`` (Stage-2 gate) controls whether a+ non-transient failure carrying images is retried text-only; the+ factory sets it from ``supports_vision`` so known-vision models keep+ their images.+ """if max_tokens is self._SENTINEL:max_tokens = self.generation.max_tokensif temperature is self._SENTINEL:@@ -414,6 +383,7 @@ class LLMProvider(ABC):reasoning_effort=resolved_reasoning_effort,tool_choice=tool_choice,retry_delays=retry_delays,+ allow_image_fallback=allow_image_fallback,**kwargs,)@@ -429,9 +399,11 @@ class LLMProvider(ABC):on_content_delta: Callable[[str], Awaitable[None]] | None = None,on_reasoning_delta: Callable[[str], Awaitable[None]] | None = None,retry_delays: Sequence[float] | None = None,+ allow_image_fallback: bool = True,**kwargs: Any,) -> LLMResponse:- """Call chat_stream() with the same transient retry policy as chat()."""+ """Call chat_stream() with the same transient + Stage-2 image retry+ policy as :meth:`chat_with_retry`."""if max_tokens is self._SENTINEL:max_tokens = self.generation.max_tokensif temperature is self._SENTINEL:@@ -457,6 +429,7 @@ class LLMProvider(ABC):reasoning_effort=resolved_reasoning_effort,tool_choice=tool_choice,retry_delays=retry_delays,+ allow_image_fallback=allow_image_fallback,on_content_delta=on_content_delta,on_reasoning_delta=on_reasoning_delta,**kwargs,diff --git a/deeptutor/services/llm/provider_core/openai_compat_provider.py b/deeptutor/services/llm/provider_core/openai_compat_provider.pyindex e9bcd0864..06724119d 100644--- a/deeptutor/services/llm/provider_core/openai_compat_provider.py+++ b/deeptutor/services/llm/provider_core/openai_compat_provider.py@@ -28,6 +28,9 @@ from deeptutor.services.llm.provider_core.openai_responses import (convert_tools,parse_response_output,)+from deeptutor.services.llm.reasoning_params import (+ build_openai_compatible_reasoning_kwargs,+)if TYPE_CHECKING:from deeptutor.services.provider_registry import ProviderSpec@@ -51,12 +54,6 @@ _DEFAULT_OPENROUTER_HEADERS = {}_RESPONSES_FAILURE_THRESHOLD = 2_RESPONSES_PROBE_INTERVAL_S = 300.0-_THINKING_STYLE_MAP = {- "thinking_type": lambda enabled: {"thinking": {"type": "enabled" if enabled else "disabled"}},- "enable_thinking": lambda enabled: {"enable_thinking": enabled},- "reasoning_split": lambda enabled: {"reasoning_split": enabled},-}-_THINKING_DISABLED_BY_DEFAULT: tuple[tuple[str, str], ...] = (("deepseek", "deepseek-v4-flash"),)def _short_tool_id() -> str:@@ -106,16 +103,6 @@ def _responses_circuit_key(return f"{model_name}|{effort}"-def _disable_thinking_by_default(spec: "ProviderSpec | None", model_name: str) -> bool:- if not spec:- return False- normalized = (model_name or "").strip().lower()- return any(- spec.name == provider and pattern in normalized- for provider, pattern in _THINKING_DISABLED_BY_DEFAULT- )--class OpenAICompatProvider(LLMProvider):"""Unified provider for all OpenAI-compatible APIs.@@ -306,38 +293,14 @@ class OpenAICompatProvider(LLMProvider):kwargs.update(overrides)break- if reasoning_effort is None and spec and spec.reasoning_model_patterns:- model_lower = model_name.lower()- if any(p.lower() in model_lower for p in spec.reasoning_model_patterns):- reasoning_effort = "high"-- semantic_effort: str | None = None- if isinstance(reasoning_effort, str):- semantic_effort = reasoning_effort.lower()- if semantic_effort == "minimum":- semantic_effort = "minimal"-- wire_effort = reasoning_effort- if spec and spec.name == "dashscope" and semantic_effort == "minimal":- wire_effort = "minimum"-- # Providers with thinking_style handle thinking via extra_body.- # "minimal" means disable thinking — only send via extra_body, never- # as a top-level reasoning_effort (e.g. DeepSeek rejects it).- if wire_effort and not (spec and spec.thinking_style and semantic_effort == "minimal"):- kwargs["reasoning_effort"] = wire_effort-- if spec and spec.thinking_style and reasoning_effort is not None:- thinking_enabled = semantic_effort != "minimal"- extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _enabled: None)(- thinking_enabled+ kwargs.update(+ build_openai_compatible_reasoning_kwargs(+ spec=spec,+ binding=getattr(spec, "name", None),+ model=model_name,+ reasoning_effort=reasoning_effort,)- if extra:- kwargs.setdefault("extra_body", {}).update(extra)- elif spec and spec.thinking_style and _disable_thinking_by_default(spec, model_name):- extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _enabled: None)(False)- if extra:- kwargs.setdefault("extra_body", {}).update(extra)+ )if tools:kwargs["tools"] = toolsdiff --git a/deeptutor/services/llm/reasoning_params.py b/deeptutor/services/llm/reasoning_params.pynew file mode 100644index 000000000..66c0a4ecb--- /dev/null+++ b/deeptutor/services/llm/reasoning_params.py@@ -0,0 +1,116 @@+"""Reasoning/thinking parameters for OpenAI-compatible provider calls."""++from __future__ import annotations++from typing import Any++_THINKING_STYLE_MAP = {+ "thinking_type": lambda enabled: {"thinking": {"type": "enabled" if enabled else "disabled"}},+ "enable_thinking": lambda enabled: {"enable_thinking": enabled},+ "reasoning_split": lambda enabled: {"reasoning_split": enabled},+}+_PROVIDER_THINKING_STYLES = {+ "deepseek": "thinking_type",+ "volcengine": "thinking_type",+ "volcengine_coding_plan": "thinking_type",+ "byteplus": "thinking_type",+ "byteplus_coding_plan": "thinking_type",+ "dashscope": "enable_thinking",+ "minimax": "reasoning_split",+}+_PROVIDER_REASONING_PATTERNS = {+ "deepseek": ("deepseek-v4-pro", "deepseek-reasoner"),+ "dashscope": ("qwen3", "qwen-3", "qwq", "qwen-plus"),+}+_CUSTOM_MODEL_THINKING_STYLES: tuple[tuple[tuple[str, ...], str], ...] = (+ (("qwen3", "qwen-3", "qwq", "qwen-plus"), "enable_thinking"),+ (("deepseek-v4-pro", "deepseek-reasoner"), "thinking_type"),+)+_THINKING_DISABLED_BY_DEFAULT: tuple[tuple[str, str], ...] = (("deepseek", "deepseek-v4-flash"),)+++def _spec_name(spec: Any, binding: str | None) -> str:+ return str(getattr(spec, "name", None) or binding or "").strip().lower()+++def _matches(model_name: str, patterns: tuple[str, ...]) -> bool:+ model_lower = model_name.lower()+ return any(pattern.lower() in model_lower for pattern in patterns)+++def _custom_thinking_style(model_name: str) -> tuple[str, tuple[str, ...]]:+ for patterns, style in _CUSTOM_MODEL_THINKING_STYLES:+ if _matches(model_name, patterns):+ return style, patterns+ return "", ()+++def _disable_thinking_by_default(provider_name: str, model_name: str) -> bool:+ normalized = model_name.strip().lower()+ return any(+ provider_name == provider and pattern in normalized+ for provider, pattern in _THINKING_DISABLED_BY_DEFAULT+ )+++def build_openai_compatible_reasoning_kwargs(+ *,+ spec: Any,+ binding: str | None,+ model: str | None,+ reasoning_effort: str | None,+) -> dict[str, Any]:+ """Return reasoning kwargs for OpenAI-compatible Chat Completions calls.++ Some OpenAI-compatible providers expose thinking controls through+ ``extra_body`` instead of the top-level ``reasoning_effort`` field. Direct+ ``custom`` bindings need model-family inference because their endpoint is+ user supplied and therefore cannot be identified by provider name alone.+ """+ provider_name = _spec_name(spec, binding)+ model_name = model or ""+ thinking_style = str(getattr(spec, "thinking_style", "") or "")+ patterns = tuple(getattr(spec, "reasoning_model_patterns", ()) or ())++ if not thinking_style:+ thinking_style = _PROVIDER_THINKING_STYLES.get(provider_name, "")+ if not patterns:+ patterns = _PROVIDER_REASONING_PATTERNS.get(provider_name, ())+ if provider_name == "custom":+ custom_style, custom_patterns = _custom_thinking_style(model_name)+ if custom_style:+ thinking_style = custom_style+ patterns = custom_patterns++ resolved_effort = reasoning_effort+ if resolved_effort is None and patterns and _matches(model_name, patterns):+ resolved_effort = "high"++ semantic_effort: str | None = None+ if isinstance(resolved_effort, str):+ semantic_effort = resolved_effort.lower()+ if semantic_effort == "minimum":+ semantic_effort = "minimal"++ kwargs: dict[str, Any] = {}+ if resolved_effort:+ suppress_top_level = bool(+ thinking_style and (semantic_effort == "minimal" or thinking_style == "enable_thinking")+ )+ if not suppress_top_level:+ kwargs["reasoning_effort"] = resolved_effort++ if thinking_style and resolved_effort is not None:+ thinking_enabled = semantic_effort != "minimal"+ extra = _THINKING_STYLE_MAP.get(thinking_style, lambda _enabled: None)(thinking_enabled)+ if extra:+ kwargs.setdefault("extra_body", {}).update(extra)+ elif thinking_style and _disable_thinking_by_default(provider_name, model_name):+ extra = _THINKING_STYLE_MAP.get(thinking_style, lambda _enabled: None)(False)+ if extra:+ kwargs.setdefault("extra_body", {}).update(extra)++ return kwargs+++__all__ = ["build_openai_compatible_reasoning_kwargs"]diff --git a/deeptutor/services/rag/pipelines/llamaindex/ingestion.py b/deeptutor/services/rag/pipelines/llamaindex/ingestion.pyindex 820de00ee..3bcc1a2cf 100644--- a/deeptutor/services/rag/pipelines/llamaindex/ingestion.py+++ b/deeptutor/services/rag/pipelines/llamaindex/ingestion.py@@ -9,10 +9,10 @@ from __future__ import annotationsfrom pathlib import Pathfrom typing import Any-from llama_index.core import Settings, VectorStoreIndex+from llama_index.core import Document, Settings, VectorStoreIndexfrom llama_index.core.ingestion import IngestionPipelinefrom llama_index.core.node_parser import SentenceSplitter-from llama_index.core.schema import BaseNode, Document+from llama_index.core.schema import BaseNodedef build_ingestion_pipeline() -> IngestionPipeline:@@ -34,19 +34,28 @@ def build_ingestion_pipeline() -> IngestionPipeline:)-def _has_precomputed_embedding(node: Any) -> bool:- """Return True if node already carries an embedding vector.+def _has_precomputed_embedding(document: Any) -> bool:+ """Return True only for non-Document nodes that already carry a vector.- LlamaIndex's Document class inherits from BaseNode, so a naive- ``isinstance(doc, BaseNode)`` check incorrectly classifies every- Document as pre-embedded, bypassing the chunking pipeline entirely.- This helper distinguishes genuinely pre-embedded nodes (e.g. ImageNode- produced by multimodal loaders) from regular Documents that still need- splitting and embedding.+ LlamaIndex's ``Document`` class inherits from ``BaseNode``, so a naive+ ``isinstance(doc, BaseNode)`` check incorrectly classifies every Document+ as pre-embedded, bypassing the chunking pipeline entirely. This helper+ distinguishes genuinely pre-embedded nodes (e.g. ImageNode produced by+ multimodal loaders) from regular Documents that still need splitting and+ embedding. The embedding may be a list or a numpy array, so we check+ ``len(...) > 0`` rather than ``bool(...)`` (ambiguous for ndarrays)."""- if isinstance(node, Document):+ if isinstance(document, Document):return False- return isinstance(node, BaseNode) and bool(getattr(node, "embedding", None))+ if not isinstance(document, BaseNode):+ return False+ embedding = getattr(document, "embedding", None)+ if embedding is None:+ return False+ try:+ return len(embedding) > 0+ except TypeError:+ return Truedef documents_to_nodes(documents: list[Any], *, show_progress: bool = True) -> list[Any]:@@ -55,8 +64,10 @@ def documents_to_nodes(documents: list[Any], *, show_progress: bool = True) -> lPre-embedded nodes, such as ImageNode instances produced by the documentloader, pass through unchanged so they are not re-embedded as text."""- text_documents = [doc for doc in documents if not _has_precomputed_embedding(doc)]- preembedded_nodes = [doc for doc in documents if _has_precomputed_embedding(doc)]+ text_documents = [+ document for document in documents if not _has_precomputed_embedding(document)+ ]+ preembedded_nodes = [document for document in documents if _has_precomputed_embedding(document)]nodes: list[Any] = []if text_documents:diff --git a/deeptutor/services/session/turn_runtime.py b/deeptutor/services/session/turn_runtime.pyindex 48a4e7592..b912625d2 100644--- a/deeptutor/services/session/turn_runtime.py+++ b/deeptutor/services/session/turn_runtime.py@@ -1516,12 +1516,14 @@ class TurnRuntimeManager:)orch = ChatOrchestrator()+ pending_done_event: StreamEvent | None = Noneasync for event in orch.handle(context):if event.type == StreamEventType.SESSION:continue- payload_event = await self._publish_live_event(execution, event)if event.type == StreamEventType.DONE:- stream_done_sent = True+ pending_done_event = event+ continue+ payload_event = await self._publish_live_event(execution, event)if payload_event.get("type") not in {"done", "session"}:assistant_events.append(payload_event)if _should_capture_assistant_content(event):@@ -1576,6 +1578,14 @@ class TurnRuntimeManager:)except Exception:logger.debug("Failed to generate session title", exc_info=True)+ if pending_done_event is None:+ pending_done_event = StreamEvent(+ type=StreamEventType.DONE,+ source=capability_name,+ metadata={"status": "completed"},+ )+ await self._publish_live_event(execution, pending_done_event)+ stream_done_sent = Trueexcept asyncio.CancelledError:if not stream_done_sent:await self._publish_live_event(diff --git a/deeptutor/services/tutorbot/manager.py b/deeptutor/services/tutorbot/manager.pyindex cb59dce16..a9348b829 100644--- a/deeptutor/services/tutorbot/manager.py+++ b/deeptutor/services/tutorbot/manager.py@@ -104,6 +104,22 @@ def normalize_message_content(content: Any) -> str:return str(content)+def _strict_config_bool(value: Any, *, default: bool = False) -> bool:+ """Parse security-sensitive config booleans without truthy string surprises."""+ if isinstance(value, bool):+ return value+ if isinstance(value, str):+ normalized = value.strip().lower()+ if normalized in {"1", "true", "yes", "on"}:+ return True+ if normalized in {"0", "false", "no", "off", ""}:+ return False+ return default+ if isinstance(value, int) and value in (0, 1):+ return bool(value)+ return default++def _history_sort_timestamp(message: dict[str, Any], fallback: float) -> float:"""Return a numeric timestamp for stable cross-session history ordering."""raw = message.get("timestamp")@@ -125,6 +141,7 @@ class BotConfig:channels: dict[str, Any] = field(default_factory=dict)model: str | None = Nonellm_selection: dict[str, str] | None = None+ allow_shell_exec: bool = False@dataclass@@ -182,6 +199,7 @@ class TutorBotInstance:"channels": channels,"model": self.config.model,"llm_selection": self.config.llm_selection,+ "allow_shell_exec": self.config.allow_shell_exec,"running": self.running,"started_at": self.started_at.isoformat(),"last_reload_error": self.last_reload_error,@@ -313,6 +331,7 @@ class TutorBotManager:"channels","model","llm_selection",+ "allow_shell_exec",)def load_bot_config(self, bot_id: str) -> BotConfig | None:@@ -329,6 +348,7 @@ class TutorBotManager:channels=data.get("channels", {}),model=data.get("model"),llm_selection=data.get("llm_selection"),+ allow_shell_exec=_strict_config_bool(data.get("allow_shell_exec", False)),)except Exception:logger.exception("Failed to load bot config %s", bot_id)@@ -348,6 +368,7 @@ class TutorBotManager:"description": config.description,"persona": config.persona,"channels": config.channels,+ "allow_shell_exec": config.allow_shell_exec,"auto_start": auto_start,}if config.model:@@ -424,7 +445,11 @@ class TutorBotManager:soul_path.write_text(config.persona, encoding="utf-8")venv_bin = str(Path(sys.executable).parent)- exec_config = ExecToolConfig(timeout=300, path_append=venv_bin)+ exec_config = ExecToolConfig(+ enabled=config.allow_shell_exec,+ timeout=300,+ path_append=venv_bin,+ )canonical_key = f"bot:{bot_id}"@@ -437,7 +462,7 @@ class TutorBotManager:exec_config=exec_config,session_manager=session_adapter,shared_memory_dir=self._shared_memory_dir,- restrict_to_workspace=False,+ restrict_to_workspace=True,default_session_key=canonical_key,)@@ -823,6 +848,17 @@ class TutorBotManager:messages = [item[2] for item in indexed_messages]return messages[-limit:]+ @staticmethod+ def web_session_key(bot_id: str, *, chat_id: str = "web", session_id: str | None = None) -> str:+ """Return the TutorBot session key used for web/API conversations."""+ normalized_session = str(session_id or "").strip()+ if normalized_session:+ return f"web:{normalized_session}"+ normalized_chat = str(chat_id or "web").strip() or "web"+ if normalized_chat != "web":+ return f"web:{normalized_chat}"+ return f"bot:{bot_id}"+def get_recent_active_bots(self, limit: int = 3) -> list[dict[str, Any]]:"""Return the most recently active bots with their last message preview."""bot_activity: list[tuple[float, str, dict[str, Any]]] = []@@ -878,6 +914,7 @@ class TutorBotManager:bot_id: str,content: str,chat_id: str = "web",+ session_id: str | None = None,on_progress: Callable[[str], Awaitable[None]] | None = None,) -> str:"""Send a message to a running bot and return the response."""@@ -885,7 +922,7 @@ class TutorBotManager:if not instance or not instance.running:raise RuntimeError(f"Bot '{bot_id}' is not running")- canonical_key = f"bot:{bot_id}"+ session_key = self.web_session_key(bot_id, chat_id=chat_id, session_id=session_id)async def _progress(text: str, *, tool_hint: bool = False) -> None:if on_progress:@@ -893,9 +930,9 @@ class TutorBotManager:response = await instance.agent_loop.process_direct(content,- session_key=canonical_key,+ session_key=session_key,channel="web",- chat_id=chat_id,+ chat_id=session_id or chat_id,on_progress=_progress,)diff --git a/deeptutor/tutorbot/agent/loop.py b/deeptutor/tutorbot/agent/loop.pyindex d05d54899..8f0c6a484 100644--- a/deeptutor/tutorbot/agent/loop.py+++ b/deeptutor/tutorbot/agent/loop.py@@ -61,7 +61,7 @@ class AgentLoop:team_max_workers: int = 5,team_worker_max_iterations: int = 25,cron_service: CronService | None = None,- restrict_to_workspace: bool = False,+ restrict_to_workspace: bool = True,session_manager: SessionManager | None = None,mcp_servers: dict | None = None,channels_config: ChannelsConfig | None = None,diff --git a/deeptutor/tutorbot/agent/subagent.py b/deeptutor/tutorbot/agent/subagent.pyindex 01d058899..2285b89e3 100644--- a/deeptutor/tutorbot/agent/subagent.py+++ b/deeptutor/tutorbot/agent/subagent.py@@ -31,7 +31,7 @@ class SubagentManager:web_search_config: "WebSearchConfig | None" = None,web_proxy: str | None = None,exec_config: "ExecToolConfig | None" = None,- restrict_to_workspace: bool = False,+ restrict_to_workspace: bool = True,):from deeptutor.tutorbot.config.schema import ExecToolConfig, WebSearchConfigdiff --git a/deeptutor/tutorbot/agent/team/__init__.py b/deeptutor/tutorbot/agent/team/__init__.pyindex 14c6c19fc..fb4695aa8 100644--- a/deeptutor/tutorbot/agent/team/__init__.py+++ b/deeptutor/tutorbot/agent/team/__init__.py@@ -60,7 +60,7 @@ class TeamManager:web_search_config: "WebSearchConfig | None" = None,web_proxy: str | None = None,exec_config: ExecToolConfig | None = None,- restrict_to_workspace: bool = False,+ restrict_to_workspace: bool = True,max_workers: int = 5,worker_max_iterations: int = 25,):diff --git a/deeptutor/tutorbot/agent/tools/registry.py b/deeptutor/tutorbot/agent/tools/registry.pyindex 7630649e9..c5b2ec09e 100644--- a/deeptutor/tutorbot/agent/tools/registry.py+++ b/deeptutor/tutorbot/agent/tools/registry.py@@ -81,30 +81,32 @@ def build_base_tools(exec_config: "ExecToolConfig",web_search_config: "WebSearchConfig | None" = None,web_proxy: str | None = None,- restrict_to_workspace: bool = False,+ restrict_to_workspace: bool = True,) -> ToolRegistry:- """Build a ToolRegistry pre-loaded with filesystem, shell, and web tools."""+ """Build a ToolRegistry pre-loaded with filesystem, optional shell, and web tools."""from deeptutor.tutorbot.agent.tools.filesystem import (EditFileTool,ListDirTool,ReadFileTool,WriteFileTool,)- from deeptutor.tutorbot.agent.tools.shell import ExecToolfrom deeptutor.tutorbot.agent.tools.web import WebFetchTool, WebSearchTooltools = ToolRegistry()allowed_dir = workspace if restrict_to_workspace else Nonefor cls in (ReadFileTool, WriteFileTool, EditFileTool, ListDirTool):tools.register(cls(workspace=workspace, allowed_dir=allowed_dir))- tools.register(- ExecTool(- working_dir=str(workspace),- timeout=exec_config.timeout,- restrict_to_workspace=restrict_to_workspace,- path_append=exec_config.path_append,+ if exec_config.enabled:+ from deeptutor.tutorbot.agent.tools.shell import ExecTool++ tools.register(+ ExecTool(+ working_dir=str(workspace),+ timeout=exec_config.timeout,+ restrict_to_workspace=restrict_to_workspace,+ path_append=exec_config.path_append,+ ))- )tools.register(WebSearchTool(config=web_search_config, proxy=web_proxy))tools.register(WebFetchTool(proxy=web_proxy, config=web_search_config))return toolsdiff --git a/deeptutor/tutorbot/agent/tools/shell.py b/deeptutor/tutorbot/agent/tools/shell.pyindex 53dc0b2d9..8a144bdb4 100644--- a/deeptutor/tutorbot/agent/tools/shell.py+++ b/deeptutor/tutorbot/agent/tools/shell.py@@ -37,18 +37,19 @@ class ExecTool(Tool):r">\s*/dev/sd", # write to diskr"\b(shutdown|reboot|poweroff)\b", # system powerr":\(\)\s*\{.*\};\s*:", # fork bomb- # Network exfiltration- r"\b(curl|wget|nc|ncat|netcat|socat)\b",- r"\b(ssh|scp|sftp|rsync|ftp)\b",- # Reverse shells / interpreters used for exfiltration- r"\bpython[23]?\s+-c\b",- r"\bperl\s+-e\b",- r"\bruby\s+-e\b",- # Sensitive file access- r"\bcat\s+.*/etc/(passwd|shadow|sudoers)",- r"\bchmod\s+[0-7]*[267][0-7]*\b", # world-writable perms- r"\bcrontab\b",- r"\b(useradd|usermod|passwd)\b", # user management+ # Network exfiltration / remote transfer. Anchored to command+ # start or a shell separator to avoid false positives on safe+ # uses (e.g. ``echo "curl ..."`` or a filename containing these).+ r"(?:^|[;&|]\s*)(curl|wget|nc|ncat|netcat|socat)\b",+ r"(?:^|[;&|]\s*)(ssh|scp|sftp|rsync|ftp)\b",+ # Inline interpreters used for reverse shells / exfiltration.+ r"(?:^|[;&|]\s*)(python|python3|perl|ruby|node|php)\s+-[ce]\b",+ # Sensitive file access.+ r"\bcat\s+/(etc/(passwd|shadow|sudoers)|proc/self/environ)\b",+ # User / privilege management.+ r"(?:^|[;&|]\s*)(useradd|usermod|passwd|chpasswd|crontab)\b",+ # World-writable / additive-write permission changes.+ r"\bchmod\s+(?:[0-7]*[2367](?:\s|$)|(?:a|o|\+)\+?w|[ugo]*[ao]\+w)\b",]self.allow_patterns = allow_patterns or []self.restrict_to_workspace = restrict_to_workspacediff --git a/deeptutor/tutorbot/config/schema.py b/deeptutor/tutorbot/config/schema.pyindex b8745036f..5ec638787 100644--- a/deeptutor/tutorbot/config/schema.py+++ b/deeptutor/tutorbot/config/schema.py@@ -142,6 +142,7 @@ class WebToolsConfig(Base):class ExecToolConfig(Base):"""Shell exec tool configuration."""+ enabled: bool = Falsetimeout: int = 60path_append: str = ""@@ -166,5 +167,5 @@ class ToolsConfig(Base):web: WebToolsConfig = Field(default_factory=WebToolsConfig)exec: ExecToolConfig = Field(default_factory=ExecToolConfig)- restrict_to_workspace: bool = False # If true, restrict all tool access to workspace directory+ restrict_to_workspace: bool = True # If true, restrict all tool access to workspace directorymcp_servers: dict[str, MCPServerConfig] = Field(default_factory=dict)diff --git a/deeptutor/tutorbot/providers/openai_compat_provider.py b/deeptutor/tutorbot/providers/openai_compat_provider.pyindex 59a0f8685..72ef20c1b 100644--- a/deeptutor/tutorbot/providers/openai_compat_provider.py+++ b/deeptutor/tutorbot/providers/openai_compat_provider.py@@ -18,6 +18,9 @@ import json_repairfrom openai import AsyncOpenAIfrom deeptutor.services.llm.openai_http_client import openai_client_kwargs+from deeptutor.services.llm.reasoning_params import (+ build_openai_compatible_reasoning_kwargs,+)from deeptutor.tutorbot.providers.base import LLMProvider, LLMResponse, ToolCallRequestif TYPE_CHECKING:@@ -40,7 +43,6 @@ _DEFAULT_OPENROUTER_HEADERS = {"HTTP-Referer": "https://github.com/HKUDS/DeepTutor","X-OpenRouter-Title": "DeepTutor",}-_THINKING_DISABLED_BY_DEFAULT: tuple[tuple[str, str], ...] = (("deepseek", "deepseek-v4-flash"),)def _short_tool_id() -> str:@@ -48,16 +50,6 @@ def _short_tool_id() -> str:return "".join(secrets.choice(_ALNUM) for _ in range(9))-def _disable_thinking_by_default(spec: ProviderSpec | None, model_name: str) -> bool:- if not spec:- return False- normalized = (model_name or "").strip().lower()- return any(- spec.name == provider and pattern in normalized- for provider, pattern in _THINKING_DISABLED_BY_DEFAULT- )--def _get(obj: Any, key: str) -> Any:if isinstance(obj, dict):return obj.get(key)@@ -270,31 +262,14 @@ class OpenAICompatProvider(LLMProvider):kwargs.update(overrides)break- extra: dict[str, Any] | None = None- if spec and reasoning_effort is not None:- thinking_enabled = reasoning_effort.lower() != "minimal"- if spec.name == "dashscope":- extra = {"enable_thinking": thinking_enabled}- elif spec.name in (- "volcengine",- "volcengine_coding_plan",- "byteplus",- "byteplus_coding_plan",- "deepseek",- ):- extra = {"thinking": {"type": "enabled" if thinking_enabled else "disabled"}}- elif spec.name == "minimax":- extra = {"reasoning_split": thinking_enabled}- if extra:- kwargs.setdefault("extra_body", {}).update(extra)- elif spec and _disable_thinking_by_default(spec, model_name):- if spec.name == "deepseek":- kwargs.setdefault("extra_body", {}).update({"thinking": {"type": "disabled"}})-- # Providers that handle thinking via extra_body don't need a- # top-level reasoning_effort when the intent is to disable thinking.- if reasoning_effort and not (extra and reasoning_effort.lower() == "minimal"):- kwargs["reasoning_effort"] = reasoning_effort+ kwargs.update(+ build_openai_compatible_reasoning_kwargs(+ spec=spec,+ binding=getattr(spec, "name", None),+ model=model_name,+ reasoning_effort=reasoning_effort,+ )+ )if tools:kwargs["tools"] = toolsdiff --git a/deeptutor/tutorbot/templates/TOOLS.md b/deeptutor/tutorbot/templates/TOOLS.mdindex 51c3a2d0d..fa3f0a3d5 100644--- a/deeptutor/tutorbot/templates/TOOLS.md+++ b/deeptutor/tutorbot/templates/TOOLS.md@@ -3,12 +3,13 @@Tool signatures are provided automatically via function calling.This file documents non-obvious constraints and usage patterns.-## exec — Safety Limits+## exec — Shell Execution-- Commands have a configurable timeout (default 60s)-- Dangerous commands are blocked (rm -rf, format, dd, shutdown, etc.)-- Output is truncated at 10,000 characters-- `restrictToWorkspace` config can limit file access to the workspace+- The shell execution tool is disabled unless an administrator explicitly enables it.+- When enabled, commands have a configurable timeout (default 60s).+- Dangerous commands are blocked (rm -rf, format, dd, shutdown, etc.).+- Output is truncated at 10,000 characters.+- File access is restricted to the workspace by default.## cron — Scheduled Remindersdiff --git a/deeptutor/utils/archive_extractor.py b/deeptutor/utils/archive_extractor.pynew file mode 100644index 000000000..9d69713a1--- /dev/null+++ b/deeptutor/utils/archive_extractor.py@@ -0,0 +1,197 @@+"""Safe extraction of user-uploaded ZIP archives.++A naive ``ZipFile.extractall`` is unsafe for untrusted uploads: it is+vulnerable to *Zip Slip* (path traversal via ``../`` or absolute member+names), *zip bombs* (tiny archives that decompress to fill the disk), and it+happily writes any file type. This module extracts members one at a time and+puts each through the same ``DocumentValidator`` gate as a direct upload:++* member names are collapsed to a sanitized basename, which defuses Zip Slip+ (no path component survives) and enforces the extension whitelist;+* per-entry uncompressed size, cumulative size, entry count and compression+ ratio are all bounded to defeat zip bombs;+* ``__MACOSX`` resource forks, dotfiles, directories and nested archives are+ skipped rather than trusted.++The extractor is deliberately decoupled from the upload router so it can be+unit-tested in isolation and reused by any ingestion path.+"""++from __future__ import annotations++from dataclasses import dataclass, field+import logging+from pathlib import Path+import zipfile++from deeptutor.utils.document_validator import DocumentValidator++logger = logging.getLogger(__name__)+++class ArchiveTooLargeError(ValueError):+ """Raised when an archive exceeds the configured extraction limits."""+++@dataclass(frozen=True)+class ZipExtractionLimits:+ """Bounds applied while extracting an archive.++ Defaults are intentionally conservative and reuse the upload size cap so a+ zip cannot smuggle in more data than a direct upload would allow.+ """++ max_total_bytes: int = DocumentValidator.MAX_FILE_SIZE+ max_entry_bytes: int = DocumentValidator.MAX_FILE_SIZE+ max_entries: int = 1000+ max_compression_ratio: float = 200.0+++@dataclass+class ZipExtractionResult:+ """Outcome of an extraction: written paths and skipped members + reasons."""++ extracted: list[Path] = field(default_factory=list)+ skipped: list[tuple[str, str]] = field(default_factory=list)+++def _is_within(path: Path, root: Path) -> bool:+ """True if ``path`` is ``root`` or lives underneath it."""+ try:+ path.relative_to(root)+ return True+ except ValueError:+ return False+++def safe_extract_zip(+ zip_path: str | Path,+ target_dir: str | Path,+ *,+ allowed_extensions: set[str],+ limits: ZipExtractionLimits | None = None,+) -> ZipExtractionResult:+ """Extract ``zip_path`` into ``target_dir``, flattening to safe basenames.++ Args:+ zip_path: Path to the ``.zip`` archive on disk.+ target_dir: Directory that extracted files are written into (created+ if missing). Files are written flat — subdirectories in the+ archive are dropped, so two members with the same basename collide+ and the later one is skipped as a duplicate.+ allowed_extensions: Extensions a member may have to be extracted.+ ``.zip`` is always excluded to prevent nested-archive recursion.+ limits: Optional size/count bounds; sensible defaults are used.++ Returns:+ A :class:`ZipExtractionResult` listing written paths and skipped+ members (with a reason for each skip).++ Raises:+ ArchiveTooLargeError: If the archive trips a zip-bomb guard.+ zipfile.BadZipFile: If the file is not a valid zip archive.+ """+ limits = limits or ZipExtractionLimits()+ target_dir = Path(target_dir)+ target_dir.mkdir(parents=True, exist_ok=True)+ target_root = target_dir.resolve()++ # Never extract nested archives — they are an unbounded-recursion vector.+ extract_extensions = {ext.lower() for ext in allowed_extensions if ext.lower() != ".zip"}++ result = ZipExtractionResult()+ seen_names: set[str] = set()+ total_bytes = 0++ with zipfile.ZipFile(zip_path) as archive:+ members = [info for info in archive.infolist() if not info.is_dir()]+ if len(members) > limits.max_entries:+ raise ArchiveTooLargeError(+ f"Archive has too many entries: {len(members)} > {limits.max_entries}"+ )++ for info in members:+ member = info.filename+ basename = member.replace("\\", "/").rsplit("/", 1)[-1]++ if member.startswith("__MACOSX/") or basename.startswith("."):+ result.skipped.append((member, "system file or dotfile"))+ continue++ # Zip-bomb guards evaluated against the archive's own metadata+ # *before* writing a single byte.+ if info.file_size > limits.max_entry_bytes:+ raise ArchiveTooLargeError(+ f"Zip entry too large: {member} ({info.file_size} bytes)"+ )+ if info.compress_size > 0:+ ratio = info.file_size / info.compress_size+ if ratio > limits.max_compression_ratio:+ raise ArchiveTooLargeError(+ f"Suspicious compression ratio for {member}: {ratio:.0f}x"+ )+ if total_bytes + info.file_size > limits.max_total_bytes:+ raise ArchiveTooLargeError(+ f"Archive exceeds total size limit of {limits.max_total_bytes} bytes"+ )++ # Validate + sanitize using the same gate as direct uploads. This+ # collapses any path (defusing Zip Slip) and enforces the+ # extension whitelist and per-file size.+ try:+ safe_name = DocumentValidator.validate_upload_safety(+ basename, info.file_size, allowed_extensions=extract_extensions+ )+ except ValueError as exc:+ result.skipped.append((member, str(exc)))+ continue++ if safe_name in seen_names:+ result.skipped.append((member, "duplicate name after flattening"))+ continue++ destination = (target_root / safe_name).resolve()+ if not _is_within(destination, target_root): # defense in depth+ result.skipped.append((member, "path escapes target directory"))+ continue++ written = _extract_member(archive, info, destination, limits.max_entry_bytes)+ if written > info.file_size:+ # Decompressed more than the header declared → treat as a bomb.+ destination.unlink(missing_ok=True)+ raise ArchiveTooLargeError(+ f"Zip entry decompressed past its declared size: {member}"+ )++ total_bytes += written+ seen_names.add(safe_name)+ result.extracted.append(destination)++ return result+++def _extract_member(+ archive: zipfile.ZipFile,+ info: zipfile.ZipInfo,+ destination: Path,+ max_entry_bytes: int,+ chunk_size: int = 1 << 16,+) -> int:+ """Stream a single member to ``destination`` with a hard byte budget.++ Returns the number of bytes written. If the member decompresses past+ ``max_entry_bytes`` the partial output is removed and the byte count+ returned still exceeds the limit so the caller can detect the overflow.+ """+ written = 0+ with archive.open(info) as source, open(destination, "wb") as sink:+ while True:+ chunk = source.read(chunk_size)+ if not chunk:+ break+ written += len(chunk)+ if written > max_entry_bytes:+ sink.write(chunk)+ return written # signal overflow; caller cleans up+ sink.write(chunk)+ return writtendiff --git a/site/.gitignore b/site/.gitignorenew file mode 100644index 000000000..6240da8b1--- /dev/null+++ b/site/.gitignore@@ -0,0 +1,21 @@+# build output+dist/+# generated types+.astro/++# dependencies+node_modules/++# logs+npm-debug.log*+yarn-debug.log*+yarn-error.log*+pnpm-debug.log*+++# environment variables+.env+.env.production++# macOS-specific files+.DS_Storediff --git a/site/README.md b/site/README.mdnew file mode 100644index 000000000..1b7f5c3d7--- /dev/null+++ b/site/README.md@@ -0,0 +1,49 @@+# Starlight Starter Kit: Basics++[](https://starlight.astro.build)++```+npm create astro@latest -- --template starlight+```++> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!++## 🚀 Project Structure++Inside of your Astro + Starlight project, you'll see the following folders and files:++```+.+├── public/+├── src/+│ ├── assets/+│ ├── content/+│ │ └── docs/+│ └── content.config.ts+├── astro.config.mjs+├── package.json+└── tsconfig.json+```++Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.++Images can be added to `src/assets/` and embedded in Markdown with a relative link.++Static assets, like favicons, can be placed in the `public/` directory.++## 🧞 Commands++All commands are run from the root of the project, from a terminal:++| Command | Action |+| :------------------------ | :----------------------------------------------- |+| `npm install` | Installs dependencies |+| `npm run dev` | Starts local dev server at `localhost:4321` |+| `npm run build` | Build your production site to `./dist/` |+| `npm run preview` | Preview your build locally, before deploying |+| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |+| `npm run astro -- --help` | Get help using the Astro CLI |++## 👀 Want to learn more?++Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).diff --git a/site/astro.config.mjs b/site/astro.config.mjsnew file mode 100644index 000000000..3f379283d--- /dev/null+++ b/site/astro.config.mjs@@ -0,0 +1,228 @@+// @ts-check+import { defineConfig } from "astro/config";+import starlight from "@astrojs/starlight";++// i18n — English is the source-of-truth locale. Chinese pages live under+// `src/content/docs/zh-cn/` mirroring the English structure. Pages not yet+// translated fall back to English automatically.+const zh = "zh-CN";++export default defineConfig({+ site: "https://deeptutor.info",+ redirects: {+ "/docs/developer/contributing/": "/docs/contributing/",+ "/zh-cn/docs/developer/contributing/": "/zh-cn/docs/contributing/",+ },+ integrations: [+ starlight({+ title: "DeepTutor",+ description: "Agent-native, open-source personalized tutoring.",+ defaultLocale: "root",+ locales: {+ root: { label: "English", lang: "en" },+ "zh-cn": { label: "简体中文", lang: "zh-CN" },+ },+ logo: {+ src: "./src/assets/logo.png",+ replacesTitle: false,+ },+ customCss: ["./src/styles/global.css", "./src/styles/starlight.css"],+ components: {+ SiteTitle: "./src/components/SiteTitle.astro",+ SocialIcons: "./src/components/SocialIcons.astro",+ },+ social: [+ {+ icon: "github",+ label: "GitHub",+ href: "https://github.com/HKUDS/DeepTutor",+ },+ {+ icon: "discord",+ label: "Discord",+ href: "https://discord.gg/eRsjPgMU4t",+ },+ ],+ sidebar: [+ {+ label: "Overview",+ translations: { [zh]: "总览" },+ items: [+ {+ label: "Documentation home",+ translations: { [zh]: "文档主页" },+ slug: "docs",+ },+ {+ label: "Contributing",+ translations: { [zh]: "参与贡献" },+ slug: "docs/contributing",+ },+ ],+ },+ {+ label: "Get Started",+ translations: { [zh]: "快速上手" },+ items: [+ {+ label: "Overview",+ translations: { [zh]: "概览" },+ slug: "docs/get-started",+ },+ {+ label: "1 · Install from PyPI",+ translations: { [zh]: "1 · PyPI 安装" },+ slug: "docs/get-started/pypi",+ },+ {+ label: "2 · Install from Source",+ translations: { [zh]: "2 · 源码安装" },+ slug: "docs/get-started/from-source",+ },+ {+ label: "3 · Docker",+ translations: { [zh]: "3 · Docker" },+ slug: "docs/get-started/docker",+ },+ {+ label: "4 · CLI-Only Install",+ translations: { [zh]: "4 · 纯 CLI 安装" },+ slug: "docs/get-started/cli-only",+ },+ {+ label: "Multi-User Deployment",+ translations: { [zh]: "多用户部署" },+ slug: "docs/get-started/multi-user",+ },+ {+ label: "Providers",+ translations: { [zh]: "模型与搜索提供商" },+ slug: "docs/get-started/providers",+ },+ {+ label: "Troubleshooting",+ translations: { [zh]: "故障排查" },+ slug: "docs/get-started/troubleshooting",+ },+ ],+ },+ {+ label: "Explore DeepTutor",+ translations: { [zh]: "探索 DeepTutor" },+ items: [+ {+ label: "Overview",+ translations: { [zh]: "概览" },+ slug: "docs/explore",+ },+ {+ label: "Chat Workspace",+ translations: { [zh]: "聊天工作台" },+ slug: "docs/explore/chat-workspace",+ },+ {+ label: "Co-Writer",+ translations: { [zh]: "Co-Writer 协同写作" },+ slug: "docs/explore/co-writer",+ },+ {+ label: "Book Engine",+ translations: { [zh]: "Book Engine" },+ slug: "docs/explore/book",+ },+ {+ label: "Knowledge",+ translations: { [zh]: "知识库" },+ slug: "docs/explore/knowledge",+ },+ {+ label: "Space",+ translations: { [zh]: "Space 空间" },+ slug: "docs/explore/space",+ },+ {+ label: "Memory",+ translations: { [zh]: "记忆系统" },+ slug: "docs/explore/memory",+ },+ {+ label: "Settings",+ translations: { [zh]: "设置" },+ slug: "docs/explore/settings",+ },+ ],+ },+ {+ label: "Explore TutorBot",+ translations: { [zh]: "TutorBot 渠道" },+ items: [+ {+ label: "Overview",+ translations: { [zh]: "概览" },+ slug: "docs/tutorbot",+ },+ { label: "Telegram", slug: "docs/tutorbot/telegram" },+ { label: "Discord", slug: "docs/tutorbot/discord" },+ { label: "Slack", slug: "docs/tutorbot/slack" },+ { label: "Matrix", slug: "docs/tutorbot/matrix" },+ { label: "Zulip", slug: "docs/tutorbot/zulip" },+ {+ label: "Feishu / Lark",+ translations: { [zh]: "飞书 / Lark" },+ slug: "docs/tutorbot/feishu",+ },+ {+ label: "WeCom",+ translations: { [zh]: "企业微信" },+ slug: "docs/tutorbot/wecom",+ },+ {+ label: "DingTalk",+ translations: { [zh]: "钉钉" },+ slug: "docs/tutorbot/dingtalk",+ },+ { label: "QQ", slug: "docs/tutorbot/qq" },+ { label: "WhatsApp", slug: "docs/tutorbot/whatsapp" },+ {+ label: "Email",+ translations: { [zh]: "电子邮件" },+ slug: "docs/tutorbot/email",+ },+ { label: "Mochat", slug: "docs/tutorbot/mochat" },+ ],+ },+ {+ label: "DeepTutor CLI",+ translations: { [zh]: "DeepTutor CLI" },+ items: [+ {+ label: "Overview",+ translations: { [zh]: "概览" },+ slug: "docs/cli",+ },+ {+ label: "Command Reference",+ translations: { [zh]: "命令参考" },+ slug: "docs/cli/commands",+ },+ {+ label: "Interactive REPL",+ translations: { [zh]: "交互式 REPL" },+ slug: "docs/cli/chat-repl",+ },+ {+ label: "Agent Handoff",+ translations: { [zh]: "代理交接" },+ slug: "docs/cli/agent-handoff",+ },+ {+ label: "Server API",+ translations: { [zh]: "服务端 API" },+ slug: "docs/cli/server-api",+ },+ ],+ },+ ],+ }),+ ],+});diff --git a/site/functions/api/release.ts b/site/functions/api/release.tsnew file mode 100644index 000000000..60c62cab3--- /dev/null+++ b/site/functions/api/release.ts@@ -0,0 +1,75 @@+/**+ * Cloudflare Pages Function — most recent GitHub release for HKUDS/DeepTutor.+ *+ * Returns the FIRST item from `/releases` (most recently published,+ * including prereleases) so that `v1.4.0-beta`-style tags surface on the+ * landing page immediately instead of waiting for the next stable.+ *+ * Optional env var:+ * - GITHUB_TOKEN any read-only PAT, bumps rate limit to 5k/h.+ * Not required for current traffic (unauth = 60/h, plenty+ * given the 30-min edge cache).+ */++interface Env {+ GITHUB_TOKEN?: string;+}++interface GithubRelease {+ tag_name: string;+ name: string | null;+ html_url: string;+ published_at: string;+ prerelease: boolean;+ draft: boolean;+}++const ENDPOINT =+ "https://api.github.com/repos/HKUDS/DeepTutor/releases?per_page=5";++export const onRequestGet: PagesFunction<Env> = async ({ env }) => {+ try {+ const headers: Record<string, string> = {+ Accept: "application/vnd.github+json",+ "User-Agent": "deeptutor-info-pages",+ "X-GitHub-Api-Version": "2022-11-28",+ };+ if (env.GITHUB_TOKEN) {+ headers.Authorization = `Bearer ${env.GITHUB_TOKEN}`;+ }++ const upstream = await fetch(ENDPOINT, { headers });+ if (!upstream.ok) {+ return json({ error: "upstream_status", status: upstream.status }, 502);+ }++ const releases = (await upstream.json()) as GithubRelease[];+ const latest = releases.find((r) => !r.draft) ?? null;+ if (!latest) {+ return json({ error: "no_release" }, 404);+ }++ return json(+ {+ tag: latest.tag_name,+ name: latest.name ?? latest.tag_name,+ url: latest.html_url,+ published_at: latest.published_at,+ prerelease: latest.prerelease,+ },+ 200,+ "public, max-age=1800, s-maxage=1800, stale-while-revalidate=3600",+ );+ } catch (err) {+ return json({ error: "fetch_failed", detail: String(err) }, 502);+ }+};++function json(body: unknown, status = 200, cache?: string): Response {+ const headers: Record<string, string> = {+ "Content-Type": "application/json; charset=utf-8",+ "Access-Control-Allow-Origin": "*",+ };+ if (cache) headers["Cache-Control"] = cache;+ return new Response(JSON.stringify(body), { status, headers });+}diff --git a/site/functions/api/traffic.ts b/site/functions/api/traffic.tsnew file mode 100644index 000000000..52b3532b4--- /dev/null+++ b/site/functions/api/traffic.ts@@ -0,0 +1,116 @@+/**+ * Cloudflare Pages Function — cumulative-since-launch traffic summary for+ * the landing-page heartbeat. Queries Cloudflare's GraphQL Analytics API+ * over the full retention window (30 days on free, 6 months on Pro).+ *+ * Env vars (Pages → Settings → Environment variables):+ * - CF_API_TOKEN API token with `Zone Analytics: Read` (scoped to deeptutor.info).+ * - CF_ZONE_ID deeptutor.info zone id (Cloudflare → Overview → API).+ *+ * Edge-cached 1 hour. Returns `{ error }` with a useful status when the+ * upstream is unreachable so the client can hide the heartbeat row.+ */++interface Env {+ CF_API_TOKEN?: string;+ CF_ZONE_ID?: string;+}++interface AnalyticsGroup {+ sum: { requests: number; bytes: number };+ uniq?: { uniques?: number };+}++interface GraphqlResponse {+ data?: {+ viewer?: {+ zones?: { httpRequests1dGroups?: AnalyticsGroup[] }[];+ };+ };+ errors?: { message: string }[];+}++// `httpRequests1dGroups` with `limit: 30` — Cloudflare's free-plan retention+// is 30 days. Upstream returns whatever exists within the window, so the+// effective scope is "since launch, capped at 30 days back".+const QUERY = `+ query Total($zoneTag: String!, $since: Date!) {+ viewer {+ zones(filter: { zoneTag: $zoneTag }) {+ httpRequests1dGroups(+ limit: 30+ filter: { date_geq: $since }+ orderBy: [date_DESC]+ ) {+ sum { requests bytes }+ uniq { uniques }+ }+ }+ }+ }+`;++export const onRequestGet: PagesFunction<Env> = async ({ env }) => {+ if (!env.CF_API_TOKEN || !env.CF_ZONE_ID) {+ return json({ error: "not_configured" }, 503);+ }++ const since = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)+ .toISOString()+ .slice(0, 10);++ try {+ const upstream = await fetch("https://api.cloudflare.com/client/v4/graphql", {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${env.CF_API_TOKEN}`,+ },+ body: JSON.stringify({+ query: QUERY,+ variables: { zoneTag: env.CF_ZONE_ID, since },+ }),+ });++ if (!upstream.ok) {+ return json({ error: "upstream_status", status: upstream.status }, 502);+ }++ const payload = (await upstream.json()) as GraphqlResponse;+ if (payload.errors?.length) {+ return json({ error: "graphql_error", detail: payload.errors[0].message }, 502);+ }++ const groups = payload.data?.viewer?.zones?.[0]?.httpRequests1dGroups ?? [];+ const totals = groups.reduce(+ (acc, g) => ({+ requests: acc.requests + (g.sum?.requests ?? 0),+ bytes: acc.bytes + (g.sum?.bytes ?? 0),+ uniques: acc.uniques + (g.uniq?.uniques ?? 0),+ }),+ { requests: 0, bytes: 0, uniques: 0 },+ );++ return json(+ {+ window: "total",+ requests: totals.requests,+ bytes: totals.bytes,+ uniques: totals.uniques,+ },+ 200,+ "public, max-age=3600, s-maxage=3600, stale-while-revalidate=7200",+ );+ } catch (err) {+ return json({ error: "fetch_failed", detail: String(err) }, 502);+ }+};++function json(body: unknown, status = 200, cache?: string): Response {+ const headers: Record<string, string> = {+ "Content-Type": "application/json; charset=utf-8",+ "Access-Control-Allow-Origin": "*",+ };+ if (cache) headers["Cache-Control"] = cache;+ return new Response(JSON.stringify(body), { status, headers });+}diff --git a/site/package-lock.json b/site/package-lock.jsonnew file mode 100644index 000000000..4f92cf972--- /dev/null+++ b/site/package-lock.json@@ -0,0 +1,6205 @@+{+ "name": "site",+ "version": "0.0.1",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "site",+ "version": "0.0.1",+ "dependencies": {+ "@astrojs/starlight": "^0.39.2",+ "astro": "^6.3.1",+ "sharp": "^0.34.5"+ },+ "devDependencies": {+ "i18n-iso-countries": "^7.14.0"+ }+ },+ "node_modules/@astrojs/compiler": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-4.0.0.tgz",+ "integrity": "sha512-eouss7G8ygdZqHuke033VMcVw5HTZUu+PXd/h06DGDUg/jt5btPYPqh66ENWw/mU78rBrf/oeC4oqoBwMtDMNA==",+ "license": "MIT"+ },+ "node_modules/@astrojs/internal-helpers": {+ "version": "0.9.1",+ "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.9.1.tgz",+ "integrity": "sha512-1pWuARqYom/TzuU3+0ZugsTrKlUydWKuULmDqSMTuonY+9IRDUEGKX/8PXQ1nBxRq3w85uGtd9q9SXfqEldMIQ==",+ "license": "MIT",+ "dependencies": {+ "picomatch": "^4.0.4"+ }+ },+ "node_modules/@astrojs/markdown-remark": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.1.2.tgz",+ "integrity": "sha512-caXZ4Dc2St2dW8luEg22GlP0gupLdztCTQE4EzZOxW1pqWXz9mbeJEuHUkgDYcKWW8tjIHkydYDhWLVoxJ327Q==",+ "license": "MIT",+ "dependencies": {+ "@astrojs/internal-helpers": "0.9.1",+ "@astrojs/prism": "4.0.2",+ "github-slugger": "^2.0.0",+ "hast-util-from-html": "^2.0.3",+ "hast-util-to-text": "^4.0.2",+ "js-yaml": "^4.1.1",+ "mdast-util-definitions": "^6.0.0",+ "rehype-raw": "^7.0.0",+ "rehype-stringify": "^10.0.1",+ "remark-gfm": "^4.0.1",+ "remark-parse": "^11.0.0",+ "remark-rehype": "^11.1.2",+ "remark-smartypants": "^3.0.2",+ "retext-smartypants": "^6.2.0",+ "shiki": "^4.0.0",+ "smol-toml": "^1.6.0",+ "unified": "^11.0.5",+ "unist-util-remove-position": "^5.0.0",+ "unist-util-visit": "^5.1.0",+ "unist-util-visit-parents": "^6.0.2",+ "vfile": "^6.0.3"+ }+ },+ "node_modules/@astrojs/mdx": {+ "version": "5.0.6",+ "resolved": "https://registry.npmjs.org/@astrojs/mdx/-/mdx-5.0.6.tgz",+ "integrity": "sha512-4dKe0ZMmqujofPNDHahzClkwinn9f8jHPcaXcgdGvPAlboD2mjzkUCofli2cBnxYAkdfhC6d50gBJ8i/cH8gHw==",+ "license": "MIT",+ "dependencies": {+ "@astrojs/markdown-remark": "7.1.2",+ "@mdx-js/mdx": "^3.1.1",+ "acorn": "^8.16.0",+ "es-module-lexer": "^2.0.0",+ "estree-util-visit": "^2.0.0",+ "hast-util-to-html": "^9.0.5",+ "piccolore": "^0.1.3",+ "rehype-raw": "^7.0.0",+ "remark-gfm": "^4.0.1",+ "remark-smartypants": "^3.0.2",+ "source-map": "^0.7.6",+ "unist-util-visit": "^5.1.0",+ "vfile": "^6.0.3"+ },+ "engines": {+ "node": ">=22.12.0"+ },+ "peerDependencies": {+ "astro": "^6.0.0"+ }+ },+ "node_modules/@astrojs/prism": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz",+ "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==",+ "license": "MIT",+ "dependencies": {+ "prismjs": "^1.30.0"+ },+ "engines": {+ "node": ">=22.12.0"+ }+ },+ "node_modules/@astrojs/sitemap": {+ "version": "3.7.2",+ "resolved": "https://registry.npmjs.org/@astrojs/sitemap/-/sitemap-3.7.2.tgz",+ "integrity": "sha512-PqkzkcZTb5ICiyIR8VoKbIAP/laNRXi5tw616N1Ckk+40oNB8Can1AzVV56lrbC5GKSZFCyJYUVYqVivMisvpA==",+ "license": "MIT",+ "dependencies": {+ "sitemap": "^9.0.0",+ "stream-replace-string": "^2.0.0",+ "zod": "^4.3.6"+ }+ },+ "node_modules/@astrojs/starlight": {+ "version": "0.39.2",+ "resolved": "https://registry.npmjs.org/@astrojs/starlight/-/starlight-0.39.2.tgz",+ "integrity": "sha512-vlw+bwnjtf5buCTUtLU7JfV6D3knslxqnspr6LKs6hfRuFZiyr5hT44F7GyDqR9FKANUqFxnIzWM81F1k/kOUA==",+ "license": "MIT",+ "dependencies": {+ "@astrojs/markdown-remark": "^7.1.1",+ "@astrojs/mdx": "^5.0.4",+ "@astrojs/sitemap": "^3.7.2",+ "@pagefind/default-ui": "^1.3.0",+ "@types/hast": "^3.0.4",+ "@types/js-yaml": "^4.0.9",+ "@types/mdast": "^4.0.4",+ "astro-expressive-code": "^0.42.0",+ "bcp-47": "^2.1.0",+ "hast-util-from-html": "^2.0.3",+ "hast-util-select": "^6.0.4",+ "hast-util-to-string": "^3.0.1",+ "hastscript": "^9.0.1",+ "i18next": "^26.0.7",+ "js-yaml": "^4.1.1",+ "klona": "^2.0.6",+ "magic-string": "^0.30.21",+ "mdast-util-directive": "^3.1.0",+ "mdast-util-to-markdown": "^2.1.2",+ "mdast-util-to-string": "^4.0.0",+ "pagefind": "^1.3.0",+ "rehype": "^13.0.2",+ "rehype-format": "^5.0.1",+ "remark-directive": "^4.0.0",+ "ultrahtml": "^1.6.0",+ "unified": "^11.0.5",+ "unist-util-visit": "^5.1.0",+ "vfile": "^6.0.3"+ },+ "peerDependencies": {+ "astro": "^6.0.0"+ }+ },+ "node_modules/@astrojs/telemetry": {+ "version": "3.3.2",+ "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz",+ "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==",+ "license": "MIT",+ "dependencies": {+ "ci-info": "^4.4.0",+ "dset": "^3.1.4",+ "is-docker": "^4.0.0",+ "is-wsl": "^3.1.1",+ "which-pm-runs": "^1.1.0"+ },+ "engines": {+ "node": "18.20.8 || ^20.3.0 || >=22.0.0"+ }+ },+ "node_modules/@babel/helper-string-parser": {+ "version": "7.27.1",+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-validator-identifier": {+ "version": "7.28.5",+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",+ "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/parser": {+ "version": "7.29.3",+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz",+ "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==",+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.29.0"+ },+ "bin": {+ "parser": "bin/babel-parser.js"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@babel/types": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",+ "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-string-parser": "^7.27.1",+ "@babel/helper-validator-identifier": "^7.28.5"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@capsizecss/unpack": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/@capsizecss/unpack/-/unpack-4.0.0.tgz",+ "integrity": "sha512-VERIM64vtTP1C4mxQ5thVT9fK0apjPFobqybMtA1UdUujWka24ERHbRHFGmpbbhp73MhV+KSsHQH9C6uOTdEQA==",+ "license": "MIT",+ "dependencies": {+ "fontkitten": "^1.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@clack/core": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.3.1.tgz",+ "integrity": "sha512-fT1qHVGAag4IEkrupZ6lRRbNCs1vS9P01KB/sG8zKgvUztbYtFBtQpjSITNwooDZ83tpsPzP0mRNs1/KVszCRA==",+ "license": "MIT",+ "dependencies": {+ "fast-wrap-ansi": "^0.2.0",+ "sisteransi": "^1.0.5"+ },+ "engines": {+ "node": ">= 20.12.0"+ }+ },+ "node_modules/@clack/prompts": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.4.0.tgz",+ "integrity": "sha512-S0My7XPGIgpRWMDG8uRqalbgT+a6FmCUdOW+HaIOVVpUPHOb7RrpvjTjiODadKp06fsrVDJZlIzc6yCTp4AnxA==",+ "license": "MIT",+ "dependencies": {+ "@clack/core": "1.3.1",+ "fast-string-width": "^3.0.2",+ "fast-wrap-ansi": "^0.2.0",+ "sisteransi": "^1.0.5"+ },+ "engines": {+ "node": ">= 20.12.0"+ }+ },+ "node_modules/@ctrl/tinycolor": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-4.2.0.tgz",+ "integrity": "sha512-kzyuwOAQnXJNLS9PSyrk0CWk35nWJW/zl/6KvnTBMFK65gm7U1/Z5BqjxeapjZCIhQcM/DsrEmcbRwDyXyXK4A==",+ "license": "MIT",+ "engines": {+ "node": ">=14"+ }+ },+ "node_modules/@emnapi/runtime": {+ "version": "1.10.0",+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",+ "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "tslib": "^2.4.0"+ }+ },+ "node_modules/@esbuild/aix-ppc64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",+ "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-arm": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz",+ "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz",+ "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz",+ "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/darwin-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz",+ "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/darwin-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz",+ "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/freebsd-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz",+ "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/freebsd-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz",+ "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-arm": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz",+ "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz",+ "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-ia32": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz",+ "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==",+ "cpu": [+ "ia32"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-loong64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz",+ "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==",+ "cpu": [+ "loong64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-mips64el": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz",+ "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==",+ "cpu": [+ "mips64el"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-ppc64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz",+ "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-riscv64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz",+ "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==",+ "cpu": [+ "riscv64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-s390x": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz",+ "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==",+ "cpu": [+ "s390x"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz",+ "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/netbsd-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz",+ "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/netbsd-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz",+ "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openbsd-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz",+ "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openbsd-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz",+ "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openharmony-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz",+ "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/sunos-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz",+ "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-arm64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz",+ "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-ia32": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz",+ "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==",+ "cpu": [+ "ia32"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-x64": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz",+ "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@expressive-code/core": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/@expressive-code/core/-/core-0.42.0.tgz",+ "integrity": "sha512-MN11+9nfmaC7sYu2BZJXAXqwkBRt8t1xTSqP+Ti1NfTEskgl6xUnzDxoaiQkg0BMzpglA0pys4dpDKquP/cyIw==",+ "license": "MIT",+ "dependencies": {+ "@ctrl/tinycolor": "^4.0.4",+ "hast-util-select": "^6.0.2",+ "hast-util-to-html": "^9.0.1",+ "hast-util-to-text": "^4.0.1",+ "hastscript": "^9.0.0",+ "postcss": "^8.4.38",+ "postcss-nested": "^6.0.1",+ "unist-util-visit": "^5.0.0",+ "unist-util-visit-parents": "^6.0.1"+ }+ },+ "node_modules/@expressive-code/plugin-frames": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/@expressive-code/plugin-frames/-/plugin-frames-0.42.0.tgz",+ "integrity": "sha512-XtkPm+941Uta7Y+81Acv+OA/20F1NJmJhCX6UYGKpqEIGqplNh3PTOhcURp6tcruhlzJcWcvpWy6Oigz3SrjqA==",+ "license": "MIT",+ "dependencies": {+ "@expressive-code/core": "^0.42.0"+ }+ },+ "node_modules/@expressive-code/plugin-shiki": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/@expressive-code/plugin-shiki/-/plugin-shiki-0.42.0.tgz",+ "integrity": "sha512-PMKey/kLmewttAHQezL+Y5Fx3vVssfDi3+FJOYQQS2mXP3tQspFELtKKAfsXfmSXdToZYgwoO69HJndqfE+09g==",+ "license": "MIT",+ "dependencies": {+ "@expressive-code/core": "^0.42.0",+ "shiki": "^4.0.2"+ }+ },+ "node_modules/@expressive-code/plugin-text-markers": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/@expressive-code/plugin-text-markers/-/plugin-text-markers-0.42.0.tgz",+ "integrity": "sha512-l59lUx8fq1v5g6SpmbDjiU0+7IdfbiWnAyRmtTVSpfhyq+nZMN4UcmYyu2b9Mynhzt7Gr+O+cXyEPDNb2AVWVQ==",+ "license": "MIT",+ "dependencies": {+ "@expressive-code/core": "^0.42.0"+ }+ },+ "node_modules/@img/colour": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@img/sharp-darwin-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.5.tgz",+ "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-arm64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-darwin-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.5.tgz",+ "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-x64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-arm64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.4.tgz",+ "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-x64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.4.tgz",+ "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.4.tgz",+ "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==",+ "cpu": [+ "arm"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.4.tgz",+ "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-ppc64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.4.tgz",+ "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==",+ "cpu": [+ "ppc64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-riscv64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.2.4.tgz",+ "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==",+ "cpu": [+ "riscv64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-s390x": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.4.tgz",+ "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==",+ "cpu": [+ "s390x"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-x64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.4.tgz",+ "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.4.tgz",+ "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.4.tgz",+ "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-linux-arm": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.5.tgz",+ "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==",+ "cpu": [+ "arm"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.5.tgz",+ "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-ppc64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.5.tgz",+ "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-ppc64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-riscv64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.34.5.tgz",+ "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==",+ "cpu": [+ "riscv64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-riscv64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-s390x": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.5.tgz",+ "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==",+ "cpu": [+ "s390x"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-s390x": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.5.tgz",+ "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-x64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linuxmusl-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.5.tgz",+ "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-arm64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linuxmusl-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.5.tgz",+ "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-x64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-wasm32": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz",+ "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==",+ "cpu": [+ "wasm32"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",+ "optional": true,+ "dependencies": {+ "@emnapi/runtime": "^1.7.0"+ },+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.5.tgz",+ "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-ia32": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.5.tgz",+ "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==",+ "cpu": [+ "ia32"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.5.tgz",+ "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.5.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",+ "license": "MIT"+ },+ "node_modules/@mdx-js/mdx": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.1.tgz",+ "integrity": "sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdx": "^2.0.0",+ "acorn": "^8.0.0",+ "collapse-white-space": "^2.0.0",+ "devlop": "^1.0.0",+ "estree-util-is-identifier-name": "^3.0.0",+ "estree-util-scope": "^1.0.0",+ "estree-walker": "^3.0.0",+ "hast-util-to-jsx-runtime": "^2.0.0",+ "markdown-extensions": "^2.0.0",+ "recma-build-jsx": "^1.0.0",+ "recma-jsx": "^1.0.0",+ "recma-stringify": "^1.0.0",+ "rehype-recma": "^1.0.0",+ "remark-mdx": "^3.0.0",+ "remark-parse": "^11.0.0",+ "remark-rehype": "^11.0.0",+ "source-map": "^0.7.0",+ "unified": "^11.0.0",+ "unist-util-position-from-estree": "^2.0.0",+ "unist-util-stringify-position": "^4.0.0",+ "unist-util-visit": "^5.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/@oslojs/encoding": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz",+ "integrity": "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==",+ "license": "MIT"+ },+ "node_modules/@pagefind/darwin-arm64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.5.2.tgz",+ "integrity": "sha512-MXpI+7HsAdPkvJ0gk9xj9g541BCqBZOBbdwj9g6lB5LCj6kSV6nqDSjzcAJwvOsfu0fjwvC8hQU+ecfhp+MpiQ==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@pagefind/darwin-x64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.5.2.tgz",+ "integrity": "sha512-IojxFWMEJe0RQ7PQ3KXQsPIImNsbpPYpoZ+QUDrL8fAl/O27IX+LVLs74/UzEZy5uA2LD8Nz1AiwKr72vrkZQw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@pagefind/default-ui": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/default-ui/-/default-ui-1.5.2.tgz",+ "integrity": "sha512-pm1LMnQg8N2B3n2TnjKlhaFihpz6zTiA4HiGQ6/slKO/+8K9CAU5kcjdSSPgpuk1PMuuN4hxLipUIifnrkl3Sg==",+ "license": "MIT"+ },+ "node_modules/@pagefind/freebsd-x64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/freebsd-x64/-/freebsd-x64-1.5.2.tgz",+ "integrity": "sha512-7EVzo9+0w+2cbe671BtMj10UlNo83I+HrLVLfRxO731svHRJKUfJ/mo05gU14pe9PCfpKNQT8FS3Xc/oDN6pOA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@pagefind/linux-arm64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.5.2.tgz",+ "integrity": "sha512-Ovt9+K35sqzn8H3ZMXGwls4TD/wMJuvRtShHIsmUQREmaxjrDEX7gHckRCrwYJ4XE1H1p6HkLz3wukrAnsfXQw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@pagefind/linux-x64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.5.2.tgz",+ "integrity": "sha512-V+tFqHKXhQKq/WqPBD67AFy7scn1/aZID00ws4fSDd+1daSi5UHR9VVlRrOUYKxn3VuFQYRD7lYXdZK1WED1YA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@pagefind/windows-arm64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/windows-arm64/-/windows-arm64-1.5.2.tgz",+ "integrity": "sha512-hN9Nh90fNW61nNRCW9ZyQrAj/mD0eRvmJ8NlTUzkbuW8kIzGJUi3cxjFkEcMZ5h/8FsKWD/VcouZl4yo1F7B6g==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@pagefind/windows-x64": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.5.2.tgz",+ "integrity": "sha512-Fa2Iyw7kaDRzGMfNYNUXNW2zbL5FQVDgSOcbDHdzBrDEdpqOqg8TcZ68F22ol6NJ9IGzvUdmeyZypLW5dyhqsg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/pluginutils": {+ "version": "5.3.0",+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz",+ "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "estree-walker": "^2.0.2",+ "picomatch": "^4.0.2"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "peerDependencies": {+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"+ },+ "peerDependenciesMeta": {+ "rollup": {+ "optional": true+ }+ }+ },+ "node_modules/@rollup/pluginutils/node_modules/estree-walker": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",+ "license": "MIT"+ },+ "node_modules/@rollup/rollup-android-arm-eabi": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.4.tgz",+ "integrity": "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-android-arm64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.4.tgz",+ "integrity": "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-darwin-arm64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.4.tgz",+ "integrity": "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-darwin-x64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.4.tgz",+ "integrity": "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-arm64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.4.tgz",+ "integrity": "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-x64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.4.tgz",+ "integrity": "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.4.tgz",+ "integrity": "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.4.tgz",+ "integrity": "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.4.tgz",+ "integrity": "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-musl": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.4.tgz",+ "integrity": "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.4.tgz",+ "integrity": "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ==",+ "cpu": [+ "loong64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-musl": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.4.tgz",+ "integrity": "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw==",+ "cpu": [+ "loong64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.4.tgz",+ "integrity": "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-musl": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.4.tgz",+ "integrity": "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.4.tgz",+ "integrity": "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA==",+ "cpu": [+ "riscv64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-musl": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.4.tgz",+ "integrity": "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw==",+ "cpu": [+ "riscv64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-s390x-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.4.tgz",+ "integrity": "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ==",+ "cpu": [+ "s390x"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.4.tgz",+ "integrity": "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-musl": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.4.tgz",+ "integrity": "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-openbsd-x64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.4.tgz",+ "integrity": "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ]+ },+ "node_modules/@rollup/rollup-openharmony-arm64": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.4.tgz",+ "integrity": "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ]+ },+ "node_modules/@rollup/rollup-win32-arm64-msvc": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.4.tgz",+ "integrity": "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-ia32-msvc": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.4.tgz",+ "integrity": "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA==",+ "cpu": [+ "ia32"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-gnu": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.4.tgz",+ "integrity": "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-msvc": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.4.tgz",+ "integrity": "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@shikijs/core": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.1.0.tgz",+ "integrity": "sha512-jLJtSJeuFffqX6/inRE1zqU5aFv2hrszvYgq3OjbAgFRZiWv7abKMDdQzYxuSDfmUPQozZvI/kuy6VMTvnvqTQ==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/primitive": "4.1.0",+ "@shikijs/types": "4.1.0",+ "@shikijs/vscode-textmate": "^10.0.2",+ "@types/hast": "^3.0.4",+ "hast-util-to-html": "^9.0.5"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/engine-javascript": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.1.0.tgz",+ "integrity": "sha512-YquhawCUgaBfhsS72e2Y/dI59gCBNPHu3fEO/tvLaXrTssxZrY5ddjtNLTwndrMgPo8b3IscE+xoICDzpTmlFQ==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/types": "4.1.0",+ "@shikijs/vscode-textmate": "^10.0.2",+ "oniguruma-to-es": "^4.3.6"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/engine-oniguruma": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.1.0.tgz",+ "integrity": "sha512-axLpjVs45YBvvINa+dJF+NPW+KtFkNXsFr4SDw2BMj9GdeMnGxVB9PQb2xXlJYovslt/nz6giedAyOANkfc7hg==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/types": "4.1.0",+ "@shikijs/vscode-textmate": "^10.0.2"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/langs": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.1.0.tgz",+ "integrity": "sha512-nwOMruEkbgdZfQ/b8CgpNBVOpvG1k0N5tbmgiFeqsan401+x3ILqlzZJowSla4Agmq4hG2Uf2wh5jLTEhR8VSg==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/types": "4.1.0"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/primitive": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.1.0.tgz",+ "integrity": "sha512-zx2/2Uwj2q9X3KSyYREEhXO23xBw5WUhP4orK2lE4r+t9JGITmEe0JH+wPmJhqHpOT2bRRs6lAL945+LDvOAGw==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/types": "4.1.0",+ "@shikijs/vscode-textmate": "^10.0.2",+ "@types/hast": "^3.0.4"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/themes": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.1.0.tgz",+ "integrity": "sha512-emCcTnUM7yO2wltYbaxm+yLvcCI4+h8XBKc4KmJ7EZUXoSGjcCHifkI//R4OFit9ewpg7H2/9tjOuXrT2v/Knw==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/types": "4.1.0"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/types": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.1.0.tgz",+ "integrity": "sha512-3EQWX54fMpniOrDblzAhiwiJwpiTMW6+B9DWyUd9ska483tbayFYuw47UxwuPknI31bKnySfVQ/QW+jFL4rFdA==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/vscode-textmate": "^10.0.2",+ "@types/hast": "^3.0.4"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@shikijs/vscode-textmate": {+ "version": "10.0.2",+ "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz",+ "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==",+ "license": "MIT"+ },+ "node_modules/@types/debug": {+ "version": "4.1.13",+ "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz",+ "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==",+ "license": "MIT",+ "dependencies": {+ "@types/ms": "*"+ }+ },+ "node_modules/@types/estree": {+ "version": "1.0.9",+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",+ "license": "MIT"+ },+ "node_modules/@types/estree-jsx": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz",+ "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "*"+ }+ },+ "node_modules/@types/hast": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "*"+ }+ },+ "node_modules/@types/js-yaml": {+ "version": "4.0.9",+ "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",+ "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==",+ "license": "MIT"+ },+ "node_modules/@types/mdast": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",+ "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "*"+ }+ },+ "node_modules/@types/mdx": {+ "version": "2.0.13",+ "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz",+ "integrity": "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==",+ "license": "MIT"+ },+ "node_modules/@types/ms": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",+ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",+ "license": "MIT"+ },+ "node_modules/@types/nlcst": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/@types/nlcst/-/nlcst-2.0.3.tgz",+ "integrity": "sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "*"+ }+ },+ "node_modules/@types/node": {+ "version": "24.12.4",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.4.tgz",+ "integrity": "sha512-GUUEShf+PBCGW2KaXwcIt3Yk+e3pkKwWKb9GSyM9WQVE+ep2jzmHdGsHzu4wgcZy5fN9FBdVzjpBQsYlpfpgLA==",+ "license": "MIT",+ "dependencies": {+ "undici-types": "~7.16.0"+ }+ },+ "node_modules/@types/sax": {+ "version": "1.2.7",+ "resolved": "https://registry.npmjs.org/@types/sax/-/sax-1.2.7.tgz",+ "integrity": "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/unist": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==",+ "license": "MIT"+ },+ "node_modules/@ungap/structured-clone": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz",+ "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==",+ "license": "ISC"+ },+ "node_modules/acorn": {+ "version": "8.16.0",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",+ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",+ "license": "MIT",+ "bin": {+ "acorn": "bin/acorn"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/acorn-jsx": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",+ "license": "MIT",+ "peerDependencies": {+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"+ }+ },+ "node_modules/anymatch": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",+ "license": "ISC",+ "dependencies": {+ "normalize-path": "^3.0.0",+ "picomatch": "^2.0.4"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/anymatch/node_modules/picomatch": {+ "version": "2.3.2",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/arg": {+ "version": "5.0.2",+ "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",+ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",+ "license": "MIT"+ },+ "node_modules/argparse": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",+ "license": "Python-2.0"+ },+ "node_modules/aria-query": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz",+ "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==",+ "license": "Apache-2.0",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/array-iterate": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-2.0.1.tgz",+ "integrity": "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/astring": {+ "version": "1.9.0",+ "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz",+ "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==",+ "license": "MIT",+ "bin": {+ "astring": "bin/astring"+ }+ },+ "node_modules/astro": {+ "version": "6.3.7",+ "resolved": "https://registry.npmjs.org/astro/-/astro-6.3.7.tgz",+ "integrity": "sha512-zIeDRrI0qNgN1lcCjNqt6/IVCVej7VwSa326cO8uP9BOk1cg4QuffhLnOn2gCgWQr32/wxpSRFfXiLKHglu1Tw==",+ "license": "MIT",+ "dependencies": {+ "@astrojs/compiler": "^4.0.0",+ "@astrojs/internal-helpers": "0.9.1",+ "@astrojs/markdown-remark": "7.1.2",+ "@astrojs/telemetry": "3.3.2",+ "@capsizecss/unpack": "^4.0.0",+ "@clack/prompts": "^1.1.0",+ "@oslojs/encoding": "^1.1.0",+ "@rollup/pluginutils": "^5.3.0",+ "aria-query": "^5.3.2",+ "axobject-query": "^4.1.0",+ "ci-info": "^4.4.0",+ "clsx": "^2.1.1",+ "common-ancestor-path": "^2.0.0",+ "cookie": "^1.1.1",+ "devalue": "^5.6.3",+ "diff": "^8.0.3",+ "dset": "^3.1.4",+ "es-module-lexer": "^2.0.0",+ "esbuild": "^0.27.3",+ "flattie": "^1.1.1",+ "fontace": "~0.4.1",+ "get-tsconfig": "5.0.0-beta.4",+ "github-slugger": "^2.0.0",+ "html-escaper": "3.0.3",+ "http-cache-semantics": "^4.2.0",+ "js-yaml": "^4.1.1",+ "jsonc-parser": "^3.3.1",+ "magic-string": "^0.30.21",+ "magicast": "^0.5.2",+ "mrmime": "^2.0.1",+ "neotraverse": "^0.6.18",+ "obug": "^2.1.1",+ "p-limit": "^7.3.0",+ "p-queue": "^9.1.0",+ "package-manager-detector": "^1.6.0",+ "piccolore": "^0.1.3",+ "picomatch": "^4.0.4",+ "rehype": "^13.0.2",+ "semver": "^7.7.4",+ "shiki": "^4.0.2",+ "smol-toml": "^1.6.0",+ "svgo": "^4.0.1",+ "tinyclip": "^0.1.12",+ "tinyexec": "^1.0.4",+ "tinyglobby": "^0.2.15",+ "ultrahtml": "^1.6.0",+ "unifont": "~0.7.4",+ "unist-util-visit": "^5.1.0",+ "unstorage": "^1.17.5",+ "vfile": "^6.0.3",+ "vite": "^7.3.2",+ "vitefu": "^1.1.2",+ "xxhash-wasm": "^1.1.0",+ "yargs-parser": "^22.0.0",+ "zod": "^4.3.6"+ },+ "bin": {+ "astro": "bin/astro.mjs"+ },+ "engines": {+ "node": ">=22.12.0",+ "npm": ">=9.6.5",+ "pnpm": ">=7.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/astrodotbuild"+ },+ "optionalDependencies": {+ "sharp": "^0.34.0"+ }+ },+ "node_modules/astro-expressive-code": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/astro-expressive-code/-/astro-expressive-code-0.42.0.tgz",+ "integrity": "sha512-aiTePi2Cn0mJPYWZSzP1GcxCinX9mNtJyCCshVVPSg1yRwM7ADvFJOx0FnS440M9t65hp8JH//dc2qr22Bm4ag==",+ "license": "MIT",+ "dependencies": {+ "rehype-expressive-code": "^0.42.0"+ },+ "peerDependencies": {+ "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0 || ^6.0.0-beta"+ }+ },+ "node_modules/axobject-query": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",+ "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==",+ "license": "Apache-2.0",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/bail": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",+ "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/bcp-47": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.0.tgz",+ "integrity": "sha512-9IIS3UPrvIa1Ej+lVDdDwO7zLehjqsaByECw0bu2RRGP73jALm6FYbzI5gWbgHLvNdkvfXB5YrSbocZdOS0c0w==",+ "license": "MIT",+ "dependencies": {+ "is-alphabetical": "^2.0.0",+ "is-alphanumerical": "^2.0.0",+ "is-decimal": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/bcp-47-match": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz",+ "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/boolbase": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",+ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",+ "license": "ISC"+ },+ "node_modules/ccount": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",+ "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/character-entities": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",+ "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/character-entities-html4": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",+ "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/character-entities-legacy": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",+ "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/character-reference-invalid": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz",+ "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/chokidar": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",+ "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",+ "license": "MIT",+ "dependencies": {+ "readdirp": "^5.0.0"+ },+ "engines": {+ "node": ">= 20.19.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/ci-info": {+ "version": "4.4.0",+ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz",+ "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/sibiraj-s"+ }+ ],+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/clsx": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/collapse-white-space": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz",+ "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/comma-separated-tokens": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",+ "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/commander": {+ "version": "11.1.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",+ "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",+ "license": "MIT",+ "engines": {+ "node": ">=16"+ }+ },+ "node_modules/common-ancestor-path": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz",+ "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==",+ "license": "BlueOak-1.0.0",+ "engines": {+ "node": ">= 18"+ }+ },+ "node_modules/cookie": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",+ "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/cookie-es": {+ "version": "1.2.3",+ "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz",+ "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==",+ "license": "MIT"+ },+ "node_modules/crossws": {+ "version": "0.3.5",+ "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.5.tgz",+ "integrity": "sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==",+ "license": "MIT",+ "dependencies": {+ "uncrypto": "^0.1.3"+ }+ },+ "node_modules/css-select": {+ "version": "5.2.2",+ "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz",+ "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "boolbase": "^1.0.0",+ "css-what": "^6.1.0",+ "domhandler": "^5.0.2",+ "domutils": "^3.0.1",+ "nth-check": "^2.0.1"+ },+ "funding": {+ "url": "https://github.com/sponsors/fb55"+ }+ },+ "node_modules/css-selector-parser": {+ "version": "3.3.0",+ "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-3.3.0.tgz",+ "integrity": "sha512-Y2asgMGFqJKF4fq4xHDSlFYIkeVfRsm69lQC1q9kbEsH5XtnINTMrweLkjYMeaUgiXBy/uvKeO/a1JHTNnmB2g==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/mdevils"+ },+ {+ "type": "patreon",+ "url": "https://patreon.com/mdevils"+ }+ ],+ "license": "MIT"+ },+ "node_modules/css-tree": {+ "version": "3.2.1",+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz",+ "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==",+ "license": "MIT",+ "dependencies": {+ "mdn-data": "2.27.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"+ }+ },+ "node_modules/css-what": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",+ "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">= 6"+ },+ "funding": {+ "url": "https://github.com/sponsors/fb55"+ }+ },+ "node_modules/cssesc": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",+ "license": "MIT",+ "bin": {+ "cssesc": "bin/cssesc"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/csso": {+ "version": "5.0.5",+ "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz",+ "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==",+ "license": "MIT",+ "dependencies": {+ "css-tree": "~2.2.0"+ },+ "engines": {+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0",+ "npm": ">=7.0.0"+ }+ },+ "node_modules/csso/node_modules/css-tree": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz",+ "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==",+ "license": "MIT",+ "dependencies": {+ "mdn-data": "2.0.28",+ "source-map-js": "^1.0.1"+ },+ "engines": {+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0",+ "npm": ">=7.0.0"+ }+ },+ "node_modules/csso/node_modules/mdn-data": {+ "version": "2.0.28",+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz",+ "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==",+ "license": "CC0-1.0"+ },+ "node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/decode-named-character-reference": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz",+ "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==",+ "license": "MIT",+ "dependencies": {+ "character-entities": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/defu": {+ "version": "6.1.7",+ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz",+ "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==",+ "license": "MIT"+ },+ "node_modules/dequal": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",+ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/destr": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",+ "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==",+ "license": "MIT"+ },+ "node_modules/detect-libc": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "license": "Apache-2.0",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/devalue": {+ "version": "5.8.1",+ "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz",+ "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==",+ "license": "MIT"+ },+ "node_modules/devlop": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz",+ "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==",+ "license": "MIT",+ "dependencies": {+ "dequal": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/diacritics": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/diacritics/-/diacritics-1.3.0.tgz",+ "integrity": "sha512-wlwEkqcsaxvPJML+rDh/2iS824jbREk6DUMUKkEaSlxdYHeS43cClJtsWglvw2RfeXGm6ohKDqsXteJ5sP5enA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/diff": {+ "version": "8.0.4",+ "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz",+ "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.3.1"+ }+ },+ "node_modules/direction": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/direction/-/direction-2.0.1.tgz",+ "integrity": "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==",+ "license": "MIT",+ "bin": {+ "direction": "cli.js"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/dom-serializer": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",+ "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",+ "license": "MIT",+ "dependencies": {+ "domelementtype": "^2.3.0",+ "domhandler": "^5.0.2",+ "entities": "^4.2.0"+ },+ "funding": {+ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"+ }+ },+ "node_modules/dom-serializer/node_modules/entities": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.12"+ },+ "funding": {+ "url": "https://github.com/fb55/entities?sponsor=1"+ }+ },+ "node_modules/domelementtype": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",+ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/fb55"+ }+ ],+ "license": "BSD-2-Clause"+ },+ "node_modules/domhandler": {+ "version": "5.0.3",+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",+ "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "domelementtype": "^2.3.0"+ },+ "engines": {+ "node": ">= 4"+ },+ "funding": {+ "url": "https://github.com/fb55/domhandler?sponsor=1"+ }+ },+ "node_modules/domutils": {+ "version": "3.2.2",+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz",+ "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "dom-serializer": "^2.0.0",+ "domelementtype": "^2.3.0",+ "domhandler": "^5.0.3"+ },+ "funding": {+ "url": "https://github.com/fb55/domutils?sponsor=1"+ }+ },+ "node_modules/dset": {+ "version": "3.1.4",+ "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz",+ "integrity": "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==",+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/entities": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",+ "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.12"+ },+ "funding": {+ "url": "https://github.com/fb55/entities?sponsor=1"+ }+ },+ "node_modules/es-module-lexer": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz",+ "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==",+ "license": "MIT"+ },+ "node_modules/esast-util-from-estree": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz",+ "integrity": "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "devlop": "^1.0.0",+ "estree-util-visit": "^2.0.0",+ "unist-util-position-from-estree": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/esast-util-from-js": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/esast-util-from-js/-/esast-util-from-js-2.0.1.tgz",+ "integrity": "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "acorn": "^8.0.0",+ "esast-util-from-estree": "^2.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/esbuild": {+ "version": "0.27.7",+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz",+ "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==",+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "esbuild": "bin/esbuild"+ },+ "engines": {+ "node": ">=18"+ },+ "optionalDependencies": {+ "@esbuild/aix-ppc64": "0.27.7",+ "@esbuild/android-arm": "0.27.7",+ "@esbuild/android-arm64": "0.27.7",+ "@esbuild/android-x64": "0.27.7",+ "@esbuild/darwin-arm64": "0.27.7",+ "@esbuild/darwin-x64": "0.27.7",+ "@esbuild/freebsd-arm64": "0.27.7",+ "@esbuild/freebsd-x64": "0.27.7",+ "@esbuild/linux-arm": "0.27.7",+ "@esbuild/linux-arm64": "0.27.7",+ "@esbuild/linux-ia32": "0.27.7",+ "@esbuild/linux-loong64": "0.27.7",+ "@esbuild/linux-mips64el": "0.27.7",+ "@esbuild/linux-ppc64": "0.27.7",+ "@esbuild/linux-riscv64": "0.27.7",+ "@esbuild/linux-s390x": "0.27.7",+ "@esbuild/linux-x64": "0.27.7",+ "@esbuild/netbsd-arm64": "0.27.7",+ "@esbuild/netbsd-x64": "0.27.7",+ "@esbuild/openbsd-arm64": "0.27.7",+ "@esbuild/openbsd-x64": "0.27.7",+ "@esbuild/openharmony-arm64": "0.27.7",+ "@esbuild/sunos-x64": "0.27.7",+ "@esbuild/win32-arm64": "0.27.7",+ "@esbuild/win32-ia32": "0.27.7",+ "@esbuild/win32-x64": "0.27.7"+ }+ },+ "node_modules/escape-string-regexp": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",+ "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/estree-util-attach-comments": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz",+ "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/estree-util-build-jsx": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz",+ "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "devlop": "^1.0.0",+ "estree-util-is-identifier-name": "^3.0.0",+ "estree-walker": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/estree-util-is-identifier-name": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz",+ "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/estree-util-scope": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz",+ "integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "devlop": "^1.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/estree-util-to-js": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz",+ "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "astring": "^1.8.0",+ "source-map": "^0.7.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/estree-util-visit": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz",+ "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/estree-walker": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ }+ },+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },+ "node_modules/expressive-code": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/expressive-code/-/expressive-code-0.42.0.tgz",+ "integrity": "sha512-V5DtJLEKuj4wf9O6IRtPtRObkMVy2ggR+S0MdjrTw6m58krZnDioyhW1si3Y04c5YPeooP4nd85Yq9NwEVHS4g==",+ "license": "MIT",+ "dependencies": {+ "@expressive-code/core": "^0.42.0",+ "@expressive-code/plugin-frames": "^0.42.0",+ "@expressive-code/plugin-shiki": "^0.42.0",+ "@expressive-code/plugin-text-markers": "^0.42.0"+ }+ },+ "node_modules/extend": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",+ "license": "MIT"+ },+ "node_modules/fast-string-truncated-width": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz",+ "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==",+ "license": "MIT"+ },+ "node_modules/fast-string-width": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz",+ "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==",+ "license": "MIT",+ "dependencies": {+ "fast-string-truncated-width": "^3.0.2"+ }+ },+ "node_modules/fast-wrap-ansi": {+ "version": "0.2.2",+ "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz",+ "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==",+ "license": "MIT",+ "dependencies": {+ "fast-string-width": "^3.0.2"+ }+ },+ "node_modules/fdir": {+ "version": "6.5.0",+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "license": "MIT",+ "engines": {+ "node": ">=12.0.0"+ },+ "peerDependencies": {+ "picomatch": "^3 || ^4"+ },+ "peerDependenciesMeta": {+ "picomatch": {+ "optional": true+ }+ }+ },+ "node_modules/flattie": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz",+ "integrity": "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/fontace": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/fontace/-/fontace-0.4.1.tgz",+ "integrity": "sha512-lDMvbAzSnHmbYMTEld5qdtvNH2/pWpICOqpean9IgC7vUbUJc3k+k5Dokp85CegamqQpFbXf0rAVkbzpyTA8aw==",+ "license": "MIT",+ "dependencies": {+ "fontkitten": "^1.0.2"+ }+ },+ "node_modules/fontkitten": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/fontkitten/-/fontkitten-1.0.3.tgz",+ "integrity": "sha512-Wp1zXWPVUPBmfoa3Cqc9ctaKuzKAV6uLstRqlR56kSjplf5uAce+qeyYym7F+PHbGTk+tCEdkCW6RD7DX/gBZw==",+ "license": "MIT",+ "dependencies": {+ "tiny-inflate": "^1.0.3"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/get-tsconfig": {+ "version": "5.0.0-beta.4",+ "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz",+ "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==",+ "license": "MIT",+ "dependencies": {+ "resolve-pkg-maps": "^1.0.0"+ },+ "engines": {+ "node": ">=20.20.0"+ },+ "funding": {+ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"+ }+ },+ "node_modules/github-slugger": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz",+ "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==",+ "license": "ISC"+ },+ "node_modules/h3": {+ "version": "1.15.11",+ "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz",+ "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==",+ "license": "MIT",+ "dependencies": {+ "cookie-es": "^1.2.3",+ "crossws": "^0.3.5",+ "defu": "^6.1.6",+ "destr": "^2.0.5",+ "iron-webcrypto": "^1.2.1",+ "node-mock-http": "^1.0.4",+ "radix3": "^1.1.2",+ "ufo": "^1.6.3",+ "uncrypto": "^0.1.3"+ }+ },+ "node_modules/hast-util-embedded": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-embedded/-/hast-util-embedded-3.0.0.tgz",+ "integrity": "sha512-naH8sld4Pe2ep03qqULEtvYr7EjrLK2QHY8KJR6RJkTUjPGObe1vnx585uzem2hGra+s1q08DZZpfgDVYRbaXA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-is-element": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-format": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/hast-util-format/-/hast-util-format-1.1.0.tgz",+ "integrity": "sha512-yY1UDz6bC9rDvCWHpx12aIBGRG7krurX0p0Fm6pT547LwDIZZiNr8a+IHDogorAdreULSEzP82Nlv5SZkHZcjA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-embedded": "^3.0.0",+ "hast-util-minify-whitespace": "^1.0.0",+ "hast-util-phrasing": "^3.0.0",+ "hast-util-whitespace": "^3.0.0",+ "html-whitespace-sensitive-tag-names": "^3.0.0",+ "unist-util-visit-parents": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-from-html": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz",+ "integrity": "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "devlop": "^1.1.0",+ "hast-util-from-parse5": "^8.0.0",+ "parse5": "^7.0.0",+ "vfile": "^6.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-from-parse5": {+ "version": "8.0.3",+ "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz",+ "integrity": "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "devlop": "^1.0.0",+ "hastscript": "^9.0.0",+ "property-information": "^7.0.0",+ "vfile": "^6.0.0",+ "vfile-location": "^5.0.0",+ "web-namespaces": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-has-property": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-3.0.0.tgz",+ "integrity": "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-is-body-ok-link": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/hast-util-is-body-ok-link/-/hast-util-is-body-ok-link-3.0.1.tgz",+ "integrity": "sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-is-element": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz",+ "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-minify-whitespace": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/hast-util-minify-whitespace/-/hast-util-minify-whitespace-1.0.1.tgz",+ "integrity": "sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-embedded": "^3.0.0",+ "hast-util-is-element": "^3.0.0",+ "hast-util-whitespace": "^3.0.0",+ "unist-util-is": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-parse-selector": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz",+ "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-phrasing": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/hast-util-phrasing/-/hast-util-phrasing-3.0.1.tgz",+ "integrity": "sha512-6h60VfI3uBQUxHqTyMymMZnEbNl1XmEGtOxxKYL7stY2o601COo62AWAYBQR9lZbYXYSBoxag8UpPRXK+9fqSQ==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-embedded": "^3.0.0",+ "hast-util-has-property": "^3.0.0",+ "hast-util-is-body-ok-link": "^3.0.0",+ "hast-util-is-element": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-raw": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.1.0.tgz",+ "integrity": "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "@ungap/structured-clone": "^1.0.0",+ "hast-util-from-parse5": "^8.0.0",+ "hast-util-to-parse5": "^8.0.0",+ "html-void-elements": "^3.0.0",+ "mdast-util-to-hast": "^13.0.0",+ "parse5": "^7.0.0",+ "unist-util-position": "^5.0.0",+ "unist-util-visit": "^5.0.0",+ "vfile": "^6.0.0",+ "web-namespaces": "^2.0.0",+ "zwitch": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-select": {+ "version": "6.0.4",+ "resolved": "https://registry.npmjs.org/hast-util-select/-/hast-util-select-6.0.4.tgz",+ "integrity": "sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "bcp-47-match": "^2.0.0",+ "comma-separated-tokens": "^2.0.0",+ "css-selector-parser": "^3.0.0",+ "devlop": "^1.0.0",+ "direction": "^2.0.0",+ "hast-util-has-property": "^3.0.0",+ "hast-util-to-string": "^3.0.0",+ "hast-util-whitespace": "^3.0.0",+ "nth-check": "^2.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0",+ "unist-util-visit": "^5.0.0",+ "zwitch": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-to-estree": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz",+ "integrity": "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "comma-separated-tokens": "^2.0.0",+ "devlop": "^1.0.0",+ "estree-util-attach-comments": "^3.0.0",+ "estree-util-is-identifier-name": "^3.0.0",+ "hast-util-whitespace": "^3.0.0",+ "mdast-util-mdx-expression": "^2.0.0",+ "mdast-util-mdx-jsx": "^3.0.0",+ "mdast-util-mdxjs-esm": "^2.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0",+ "style-to-js": "^1.0.0",+ "unist-util-position": "^5.0.0",+ "zwitch": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-to-html": {+ "version": "9.0.5",+ "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz",+ "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "ccount": "^2.0.0",+ "comma-separated-tokens": "^2.0.0",+ "hast-util-whitespace": "^3.0.0",+ "html-void-elements": "^3.0.0",+ "mdast-util-to-hast": "^13.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0",+ "stringify-entities": "^4.0.0",+ "zwitch": "^2.0.4"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-to-jsx-runtime": {+ "version": "2.3.6",+ "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz",+ "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "comma-separated-tokens": "^2.0.0",+ "devlop": "^1.0.0",+ "estree-util-is-identifier-name": "^3.0.0",+ "hast-util-whitespace": "^3.0.0",+ "mdast-util-mdx-expression": "^2.0.0",+ "mdast-util-mdx-jsx": "^3.0.0",+ "mdast-util-mdxjs-esm": "^2.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0",+ "style-to-js": "^1.0.0",+ "unist-util-position": "^5.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-to-parse5": {+ "version": "8.0.1",+ "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.1.tgz",+ "integrity": "sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "comma-separated-tokens": "^2.0.0",+ "devlop": "^1.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0",+ "web-namespaces": "^2.0.0",+ "zwitch": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-to-string": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.1.tgz",+ "integrity": "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-to-text": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz",+ "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "hast-util-is-element": "^3.0.0",+ "unist-util-find-after": "^5.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-whitespace": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",+ "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hastscript": {+ "version": "9.0.1",+ "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz",+ "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "comma-separated-tokens": "^2.0.0",+ "hast-util-parse-selector": "^4.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/html-escaper": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",+ "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==",+ "license": "MIT"+ },+ "node_modules/html-void-elements": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz",+ "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/html-whitespace-sensitive-tag-names": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/html-whitespace-sensitive-tag-names/-/html-whitespace-sensitive-tag-names-3.0.1.tgz",+ "integrity": "sha512-q+310vW8zmymYHALr1da4HyXUQ0zgiIwIicEfotYPWGN0OJVEN/58IJ3A4GBYcEq3LGAZqKb+ugvP0GNB9CEAA==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/http-cache-semantics": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz",+ "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==",+ "license": "BSD-2-Clause"+ },+ "node_modules/i18n-iso-countries": {+ "version": "7.14.0",+ "resolved": "https://registry.npmjs.org/i18n-iso-countries/-/i18n-iso-countries-7.14.0.tgz",+ "integrity": "sha512-nXHJZYtNrfsi1UQbyRqm3Gou431elgLjKl//CYlnBGt5aTWdRPH1PiS2T/p/n8Q8LnqYqzQJik3Q7mkwvLokeg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "diacritics": "1.3.0"+ },+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/i18next": {+ "version": "26.2.0",+ "resolved": "https://registry.npmjs.org/i18next/-/i18next-26.2.0.tgz",+ "integrity": "sha512-zwBHldHdTmwN7r6UNc7lC6GWNN+YYg3DrRSeHR5PRRBf5QnJZcYHrQc0uaU26qZeYxR7iFZD+Y315dPnKP47wA==",+ "funding": [+ {+ "type": "individual",+ "url": "https://www.locize.com/i18next"+ },+ {+ "type": "individual",+ "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"+ },+ {+ "type": "individual",+ "url": "https://www.locize.com"+ }+ ],+ "license": "MIT",+ "peerDependencies": {+ "typescript": "^5 || ^6"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/inline-style-parser": {+ "version": "0.2.7",+ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz",+ "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==",+ "license": "MIT"+ },+ "node_modules/iron-webcrypto": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz",+ "integrity": "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/brc-dd"+ }+ },+ "node_modules/is-alphabetical": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",+ "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/is-alphanumerical": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz",+ "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==",+ "license": "MIT",+ "dependencies": {+ "is-alphabetical": "^2.0.0",+ "is-decimal": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/is-decimal": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz",+ "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/is-docker": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz",+ "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==",+ "license": "MIT",+ "bin": {+ "is-docker": "cli.js"+ },+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-hexadecimal": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz",+ "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/is-inside-container": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",+ "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",+ "license": "MIT",+ "dependencies": {+ "is-docker": "^3.0.0"+ },+ "bin": {+ "is-inside-container": "cli.js"+ },+ "engines": {+ "node": ">=14.16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-inside-container/node_modules/is-docker": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",+ "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",+ "license": "MIT",+ "bin": {+ "is-docker": "cli.js"+ },+ "engines": {+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-plain-obj": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",+ "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-wsl": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz",+ "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==",+ "license": "MIT",+ "dependencies": {+ "is-inside-container": "^1.0.0"+ },+ "engines": {+ "node": ">=16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/js-yaml": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",+ "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",+ "license": "MIT",+ "dependencies": {+ "argparse": "^2.0.1"+ },+ "bin": {+ "js-yaml": "bin/js-yaml.js"+ }+ },+ "node_modules/jsonc-parser": {+ "version": "3.3.1",+ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz",+ "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==",+ "license": "MIT"+ },+ "node_modules/klona": {+ "version": "2.0.6",+ "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz",+ "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==",+ "license": "MIT",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/longest-streak": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",+ "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/lru-cache": {+ "version": "11.5.0",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.0.tgz",+ "integrity": "sha512-5YgH9UJd7wVb9hIouI2adWpgqrrICkt070Dnj8EUY1+B4B2P9eRLPAkAAo6NICA7CEhOIeBHl46u9zSNpNu7zA==",+ "license": "BlueOak-1.0.0",+ "engines": {+ "node": "20 || >=22"+ }+ },+ "node_modules/magic-string": {+ "version": "0.30.21",+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.5"+ }+ },+ "node_modules/magicast": {+ "version": "0.5.3",+ "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz",+ "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==",+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.29.3",+ "@babel/types": "^7.29.0",+ "source-map-js": "^1.2.1"+ }+ },+ "node_modules/markdown-extensions": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz",+ "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==",+ "license": "MIT",+ "engines": {+ "node": ">=16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/markdown-table": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz",+ "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/mdast-util-definitions": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz",+ "integrity": "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "@types/unist": "^3.0.0",+ "unist-util-visit": "^5.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-directive": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-3.1.0.tgz",+ "integrity": "sha512-I3fNFt+DHmpWCYAT7quoM6lHf9wuqtI+oCOfvILnoicNIqjh5E3dEJWiXuYME2gNe8vl1iMQwyUHa7bgFmak6Q==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "@types/unist": "^3.0.0",+ "ccount": "^2.0.0",+ "devlop": "^1.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0",+ "parse-entities": "^4.0.0",+ "stringify-entities": "^4.0.0",+ "unist-util-visit-parents": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-find-and-replace": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz",+ "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "escape-string-regexp": "^5.0.0",+ "unist-util-is": "^6.0.0",+ "unist-util-visit-parents": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-from-markdown": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz",+ "integrity": "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "@types/unist": "^3.0.0",+ "decode-named-character-reference": "^1.0.0",+ "devlop": "^1.0.0",+ "mdast-util-to-string": "^4.0.0",+ "micromark": "^4.0.0",+ "micromark-util-decode-numeric-character-reference": "^2.0.0",+ "micromark-util-decode-string": "^2.0.0",+ "micromark-util-normalize-identifier": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "unist-util-stringify-position": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-gfm": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz",+ "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==",+ "license": "MIT",+ "dependencies": {+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-gfm-autolink-literal": "^2.0.0",+ "mdast-util-gfm-footnote": "^2.0.0",+ "mdast-util-gfm-strikethrough": "^2.0.0",+ "mdast-util-gfm-table": "^2.0.0",+ "mdast-util-gfm-task-list-item": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-gfm-autolink-literal": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz",+ "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "ccount": "^2.0.0",+ "devlop": "^1.0.0",+ "mdast-util-find-and-replace": "^3.0.0",+ "micromark-util-character": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-gfm-footnote": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz",+ "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "devlop": "^1.1.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0",+ "micromark-util-normalize-identifier": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-gfm-strikethrough": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz",+ "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-gfm-table": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz",+ "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "markdown-table": "^3.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-gfm-task-list-item": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz",+ "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-mdx": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz",+ "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==",+ "license": "MIT",+ "dependencies": {+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-mdx-expression": "^2.0.0",+ "mdast-util-mdx-jsx": "^3.0.0",+ "mdast-util-mdxjs-esm": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-mdx-expression": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz",+ "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-mdx-jsx": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz",+ "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "@types/unist": "^3.0.0",+ "ccount": "^2.0.0",+ "devlop": "^1.1.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0",+ "parse-entities": "^4.0.0",+ "stringify-entities": "^4.0.0",+ "unist-util-stringify-position": "^4.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-mdxjs-esm": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz",+ "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-phrasing": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz",+ "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "unist-util-is": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-to-hast": {+ "version": "13.2.1",+ "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",+ "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "@ungap/structured-clone": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-util-sanitize-uri": "^2.0.0",+ "trim-lines": "^3.0.0",+ "unist-util-position": "^5.0.0",+ "unist-util-visit": "^5.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-to-markdown": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz",+ "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "@types/unist": "^3.0.0",+ "longest-streak": "^3.0.0",+ "mdast-util-phrasing": "^4.0.0",+ "mdast-util-to-string": "^4.0.0",+ "micromark-util-classify-character": "^2.0.0",+ "micromark-util-decode-string": "^2.0.0",+ "unist-util-visit": "^5.0.0",+ "zwitch": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-to-string": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz",+ "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdn-data": {+ "version": "2.27.1",+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz",+ "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==",+ "license": "CC0-1.0"+ },+ "node_modules/micromark": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz",+ "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@types/debug": "^4.0.0",+ "debug": "^4.0.0",+ "decode-named-character-reference": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-core-commonmark": "^2.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-chunked": "^2.0.0",+ "micromark-util-combine-extensions": "^2.0.0",+ "micromark-util-decode-numeric-character-reference": "^2.0.0",+ "micromark-util-encode": "^2.0.0",+ "micromark-util-normalize-identifier": "^2.0.0",+ "micromark-util-resolve-all": "^2.0.0",+ "micromark-util-sanitize-uri": "^2.0.0",+ "micromark-util-subtokenize": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-core-commonmark": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz",+ "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "decode-named-character-reference": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-factory-destination": "^2.0.0",+ "micromark-factory-label": "^2.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-factory-title": "^2.0.0",+ "micromark-factory-whitespace": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-chunked": "^2.0.0",+ "micromark-util-classify-character": "^2.0.0",+ "micromark-util-html-tag-name": "^2.0.0",+ "micromark-util-normalize-identifier": "^2.0.0",+ "micromark-util-resolve-all": "^2.0.0",+ "micromark-util-subtokenize": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-extension-directive": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-4.0.0.tgz",+ "integrity": "sha512-/C2nqVmXXmiseSSuCdItCMho7ybwwop6RrrRPk0KbOHW21JKoCldC+8rFOaundDoRBUWBnJJcxeA/Kvi34WQXg==",+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-factory-whitespace": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "parse-entities": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz",+ "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==",+ "license": "MIT",+ "dependencies": {+ "micromark-extension-gfm-autolink-literal": "^2.0.0",+ "micromark-extension-gfm-footnote": "^2.0.0",+ "micromark-extension-gfm-strikethrough": "^2.0.0",+ "micromark-extension-gfm-table": "^2.0.0",+ "micromark-extension-gfm-tagfilter": "^2.0.0",+ "micromark-extension-gfm-task-list-item": "^2.0.0",+ "micromark-util-combine-extensions": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm-autolink-literal": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz",+ "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==",+ "license": "MIT",+ "dependencies": {+ "micromark-util-character": "^2.0.0",+ "micromark-util-sanitize-uri": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm-footnote": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz",+ "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==",+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-core-commonmark": "^2.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-normalize-identifier": "^2.0.0",+ "micromark-util-sanitize-uri": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm-strikethrough": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz",+ "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==",+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-util-chunked": "^2.0.0",+ "micromark-util-classify-character": "^2.0.0",+ "micromark-util-resolve-all": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm-table": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz",+ "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==",+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm-tagfilter": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz",+ "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==",+ "license": "MIT",+ "dependencies": {+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-gfm-task-list-item": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz",+ "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==",+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-mdx-expression": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz",+ "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-factory-mdx-expression": "^2.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-events-to-acorn": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-extension-mdx-jsx": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz",+ "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "devlop": "^1.0.0",+ "estree-util-is-identifier-name": "^3.0.0",+ "micromark-factory-mdx-expression": "^2.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-events-to-acorn": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-mdx-md": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz",+ "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==",+ "license": "MIT",+ "dependencies": {+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-mdxjs": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz",+ "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==",+ "license": "MIT",+ "dependencies": {+ "acorn": "^8.0.0",+ "acorn-jsx": "^5.0.0",+ "micromark-extension-mdx-expression": "^3.0.0",+ "micromark-extension-mdx-jsx": "^3.0.0",+ "micromark-extension-mdx-md": "^2.0.0",+ "micromark-extension-mdxjs-esm": "^3.0.0",+ "micromark-util-combine-extensions": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-extension-mdxjs-esm": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz",+ "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-core-commonmark": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-events-to-acorn": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "unist-util-position-from-estree": "^2.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/micromark-factory-destination": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz",+ "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-factory-label": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz",+ "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-factory-mdx-expression": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz",+ "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-events-to-acorn": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "unist-util-position-from-estree": "^2.0.0",+ "vfile-message": "^4.0.0"+ }+ },+ "node_modules/micromark-factory-space": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz",+ "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-character": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-factory-title": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz",+ "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-factory-whitespace": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz",+ "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-factory-space": "^2.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-util-character": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz",+ "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-util-chunked": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz",+ "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-symbol": "^2.0.0"+ }+ },+ "node_modules/micromark-util-classify-character": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz",+ "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-character": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-util-combine-extensions": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz",+ "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-chunked": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-util-decode-numeric-character-reference": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz",+ "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-symbol": "^2.0.0"+ }+ },+ "node_modules/micromark-util-decode-string": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz",+ "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "decode-named-character-reference": "^1.0.0",+ "micromark-util-character": "^2.0.0",+ "micromark-util-decode-numeric-character-reference": "^2.0.0",+ "micromark-util-symbol": "^2.0.0"+ }+ },+ "node_modules/micromark-util-encode": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz",+ "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT"+ },+ "node_modules/micromark-util-events-to-acorn": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz",+ "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "@types/unist": "^3.0.0",+ "devlop": "^1.0.0",+ "estree-util-visit": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "vfile-message": "^4.0.0"+ }+ },+ "node_modules/micromark-util-html-tag-name": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz",+ "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT"+ },+ "node_modules/micromark-util-normalize-identifier": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz",+ "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-symbol": "^2.0.0"+ }+ },+ "node_modules/micromark-util-resolve-all": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz",+ "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-util-sanitize-uri": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz",+ "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "micromark-util-character": "^2.0.0",+ "micromark-util-encode": "^2.0.0",+ "micromark-util-symbol": "^2.0.0"+ }+ },+ "node_modules/micromark-util-subtokenize": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz",+ "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "devlop": "^1.0.0",+ "micromark-util-chunked": "^2.0.0",+ "micromark-util-symbol": "^2.0.0",+ "micromark-util-types": "^2.0.0"+ }+ },+ "node_modules/micromark-util-symbol": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz",+ "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT"+ },+ "node_modules/micromark-util-types": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz",+ "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==",+ "funding": [+ {+ "type": "GitHub Sponsors",+ "url": "https://github.com/sponsors/unifiedjs"+ },+ {+ "type": "OpenCollective",+ "url": "https://opencollective.com/unified"+ }+ ],+ "license": "MIT"+ },+ "node_modules/mrmime": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",+ "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/nanoid": {+ "version": "3.3.12",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",+ "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },+ "node_modules/neotraverse": {+ "version": "0.6.18",+ "resolved": "https://registry.npmjs.org/neotraverse/-/neotraverse-0.6.18.tgz",+ "integrity": "sha512-Z4SmBUweYa09+o6pG+eASabEpP6QkQ70yHj351pQoEXIs8uHbaU2DWVmzBANKgflPa47A50PtB2+NgRpQvr7vA==",+ "license": "MIT",+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/nlcst-to-string": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/nlcst-to-string/-/nlcst-to-string-4.0.0.tgz",+ "integrity": "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA==",+ "license": "MIT",+ "dependencies": {+ "@types/nlcst": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/node-fetch-native": {+ "version": "1.6.7",+ "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz",+ "integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==",+ "license": "MIT"+ },+ "node_modules/node-mock-http": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.4.tgz",+ "integrity": "sha512-8DY+kFsDkNXy1sJglUfuODx1/opAGJGyrTuFqEoN90oRc2Vk0ZbD4K2qmKXBBEhZQzdKHIVfEJpDU8Ak2NJEvQ==",+ "license": "MIT"+ },+ "node_modules/normalize-path": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/nth-check": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",+ "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "boolbase": "^1.0.0"+ },+ "funding": {+ "url": "https://github.com/fb55/nth-check?sponsor=1"+ }+ },+ "node_modules/obug": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz",+ "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==",+ "funding": [+ "https://github.com/sponsors/sxzz",+ "https://opencollective.com/debug"+ ],+ "license": "MIT"+ },+ "node_modules/ofetch": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz",+ "integrity": "sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==",+ "license": "MIT",+ "dependencies": {+ "destr": "^2.0.5",+ "node-fetch-native": "^1.6.7",+ "ufo": "^1.6.1"+ }+ },+ "node_modules/ohash": {+ "version": "2.0.11",+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz",+ "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==",+ "license": "MIT"+ },+ "node_modules/oniguruma-parser": {+ "version": "0.12.2",+ "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz",+ "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==",+ "license": "MIT"+ },+ "node_modules/oniguruma-to-es": {+ "version": "4.3.6",+ "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz",+ "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==",+ "license": "MIT",+ "dependencies": {+ "oniguruma-parser": "^0.12.2",+ "regex": "^6.1.0",+ "regex-recursion": "^6.0.2"+ }+ },+ "node_modules/p-limit": {+ "version": "7.3.0",+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz",+ "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==",+ "license": "MIT",+ "dependencies": {+ "yocto-queue": "^1.2.1"+ },+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-queue": {+ "version": "9.3.0",+ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz",+ "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==",+ "license": "MIT",+ "dependencies": {+ "eventemitter3": "^5.0.4",+ "p-timeout": "^7.0.0"+ },+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-timeout": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz",+ "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==",+ "license": "MIT",+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/package-manager-detector": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.6.0.tgz",+ "integrity": "sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==",+ "license": "MIT"+ },+ "node_modules/pagefind": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.5.2.tgz",+ "integrity": "sha512-XTUaK0hXMCu2jszWE584JGQT7y284TmMV9l/HX3rnG5uo3rHI/uHU56XTyyyPFjeWEBxECbAi0CaFDJOONtG0Q==",+ "license": "MIT",+ "bin": {+ "pagefind": "lib/runner/bin.cjs"+ },+ "optionalDependencies": {+ "@pagefind/darwin-arm64": "1.5.2",+ "@pagefind/darwin-x64": "1.5.2",+ "@pagefind/freebsd-x64": "1.5.2",+ "@pagefind/linux-arm64": "1.5.2",+ "@pagefind/linux-x64": "1.5.2",+ "@pagefind/windows-arm64": "1.5.2",+ "@pagefind/windows-x64": "1.5.2"+ }+ },+ "node_modules/parse-entities": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz",+ "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^2.0.0",+ "character-entities-legacy": "^3.0.0",+ "character-reference-invalid": "^2.0.0",+ "decode-named-character-reference": "^1.0.0",+ "is-alphanumerical": "^2.0.0",+ "is-decimal": "^2.0.0",+ "is-hexadecimal": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/parse-entities/node_modules/@types/unist": {+ "version": "2.0.11",+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",+ "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==",+ "license": "MIT"+ },+ "node_modules/parse-latin": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/parse-latin/-/parse-latin-7.0.0.tgz",+ "integrity": "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ==",+ "license": "MIT",+ "dependencies": {+ "@types/nlcst": "^2.0.0",+ "@types/unist": "^3.0.0",+ "nlcst-to-string": "^4.0.0",+ "unist-util-modify-children": "^4.0.0",+ "unist-util-visit-children": "^3.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/parse5": {+ "version": "7.3.0",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",+ "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",+ "license": "MIT",+ "dependencies": {+ "entities": "^6.0.0"+ },+ "funding": {+ "url": "https://github.com/inikulin/parse5?sponsor=1"+ }+ },+ "node_modules/piccolore": {+ "version": "0.1.3",+ "resolved": "https://registry.npmjs.org/piccolore/-/piccolore-0.1.3.tgz",+ "integrity": "sha512-o8bTeDWjE086iwKrROaDf31K0qC/BENdm15/uH9usSC/uZjJOKb2YGiVHfLY4GhwsERiPI1jmwI2XrA7ACOxVw==",+ "license": "ISC"+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "license": "ISC"+ },+ "node_modules/picomatch": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/postcss": {+ "version": "8.5.15",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",+ "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.12",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/postcss-nested": {+ "version": "6.2.0",+ "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz",+ "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "postcss-selector-parser": "^6.1.1"+ },+ "engines": {+ "node": ">=12.0"+ },+ "peerDependencies": {+ "postcss": "^8.2.14"+ }+ },+ "node_modules/postcss-selector-parser": {+ "version": "6.1.2",+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz",+ "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==",+ "license": "MIT",+ "dependencies": {+ "cssesc": "^3.0.0",+ "util-deprecate": "^1.0.2"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/prismjs": {+ "version": "1.30.0",+ "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz",+ "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/property-information": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz",+ "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/radix3": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz",+ "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==",+ "license": "MIT"+ },+ "node_modules/readdirp": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",+ "integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 20.19.0"+ },+ "funding": {+ "type": "individual",+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/recma-build-jsx": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz",+ "integrity": "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "estree-util-build-jsx": "^3.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/recma-jsx": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/recma-jsx/-/recma-jsx-1.0.1.tgz",+ "integrity": "sha512-huSIy7VU2Z5OLv6oFLosQGGDqPqdO1iq6bWNAdhzMxSJP7RAso4fCZ1cKu8j9YHCZf3TPrq4dw3okhrylgcd7w==",+ "license": "MIT",+ "dependencies": {+ "acorn-jsx": "^5.0.0",+ "estree-util-to-js": "^2.0.0",+ "recma-parse": "^1.0.0",+ "recma-stringify": "^1.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ },+ "peerDependencies": {+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"+ }+ },+ "node_modules/recma-parse": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/recma-parse/-/recma-parse-1.0.0.tgz",+ "integrity": "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "esast-util-from-js": "^2.0.0",+ "unified": "^11.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/recma-stringify": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/recma-stringify/-/recma-stringify-1.0.0.tgz",+ "integrity": "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "estree-util-to-js": "^2.0.0",+ "unified": "^11.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/regex": {+ "version": "6.1.0",+ "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz",+ "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==",+ "license": "MIT",+ "dependencies": {+ "regex-utilities": "^2.3.0"+ }+ },+ "node_modules/regex-recursion": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz",+ "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==",+ "license": "MIT",+ "dependencies": {+ "regex-utilities": "^2.3.0"+ }+ },+ "node_modules/regex-utilities": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz",+ "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==",+ "license": "MIT"+ },+ "node_modules/rehype": {+ "version": "13.0.2",+ "resolved": "https://registry.npmjs.org/rehype/-/rehype-13.0.2.tgz",+ "integrity": "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "rehype-parse": "^9.0.0",+ "rehype-stringify": "^10.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/rehype-expressive-code": {+ "version": "0.42.0",+ "resolved": "https://registry.npmjs.org/rehype-expressive-code/-/rehype-expressive-code-0.42.0.tgz",+ "integrity": "sha512-8rp/1YMEVVSYbtz+bFBx+uSx3vA4i4T8RwRm5Q/IWbucQnnQqQ0hDqtmKOr8tv+59Cik6cu5aH3WPo0I7csuTA==",+ "license": "MIT",+ "dependencies": {+ "expressive-code": "^0.42.0"+ }+ },+ "node_modules/rehype-format": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/rehype-format/-/rehype-format-5.0.1.tgz",+ "integrity": "sha512-zvmVru9uB0josBVpr946OR8ui7nJEdzZobwLOOqHb/OOD88W0Vk2SqLwoVOj0fM6IPCCO6TaV9CvQvJMWwukFQ==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-format": "^1.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/rehype-parse": {+ "version": "9.0.1",+ "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz",+ "integrity": "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-from-html": "^2.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/rehype-raw": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz",+ "integrity": "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-raw": "^9.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/rehype-recma": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz",+ "integrity": "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "@types/hast": "^3.0.0",+ "hast-util-to-estree": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/rehype-stringify": {+ "version": "10.0.1",+ "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.1.tgz",+ "integrity": "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-to-html": "^9.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/remark-directive": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-4.0.0.tgz",+ "integrity": "sha512-7sxn4RfF1o3izevPV1DheyGDD6X4c9hrGpfdUpm7uC++dqrnJxIZVkk7CoKqcLm0VUMAuOol7Mno3m6g8cfMuA==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "mdast-util-directive": "^3.0.0",+ "micromark-extension-directive": "^4.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/remark-gfm": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz",+ "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "mdast-util-gfm": "^3.0.0",+ "micromark-extension-gfm": "^3.0.0",+ "remark-parse": "^11.0.0",+ "remark-stringify": "^11.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/remark-mdx": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.1.tgz",+ "integrity": "sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg==",+ "license": "MIT",+ "dependencies": {+ "mdast-util-mdx": "^3.0.0",+ "micromark-extension-mdxjs": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/remark-parse": {+ "version": "11.0.0",+ "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz",+ "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "micromark-util-types": "^2.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/remark-rehype": {+ "version": "11.1.2",+ "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz",+ "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "mdast-util-to-hast": "^13.0.0",+ "unified": "^11.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/remark-smartypants": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-3.0.2.tgz",+ "integrity": "sha512-ILTWeOriIluwEvPjv67v7Blgrcx+LZOkAUVtKI3putuhlZm84FnqDORNXPPm+HY3NdZOMhyDwZ1E+eZB/Df5dA==",+ "license": "MIT",+ "dependencies": {+ "retext": "^9.0.0",+ "retext-smartypants": "^6.0.0",+ "unified": "^11.0.4",+ "unist-util-visit": "^5.0.0"+ },+ "engines": {+ "node": ">=16.0.0"+ }+ },+ "node_modules/remark-stringify": {+ "version": "11.0.0",+ "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz",+ "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==",+ "license": "MIT",+ "dependencies": {+ "@types/mdast": "^4.0.0",+ "mdast-util-to-markdown": "^2.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/resolve-pkg-maps": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",+ "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"+ }+ },+ "node_modules/retext": {+ "version": "9.0.0",+ "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz",+ "integrity": "sha512-sbMDcpHCNjvlheSgMfEcVrZko3cDzdbe1x/e7G66dFp0Ff7Mldvi2uv6JkJQzdRcvLYE8CA8Oe8siQx8ZOgTcA==",+ "license": "MIT",+ "dependencies": {+ "@types/nlcst": "^2.0.0",+ "retext-latin": "^4.0.0",+ "retext-stringify": "^4.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/retext-latin": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/retext-latin/-/retext-latin-4.0.0.tgz",+ "integrity": "sha512-hv9woG7Fy0M9IlRQloq/N6atV82NxLGveq+3H2WOi79dtIYWN8OaxogDm77f8YnVXJL2VD3bbqowu5E3EMhBYA==",+ "license": "MIT",+ "dependencies": {+ "@types/nlcst": "^2.0.0",+ "parse-latin": "^7.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/retext-smartypants": {+ "version": "6.2.0",+ "resolved": "https://registry.npmjs.org/retext-smartypants/-/retext-smartypants-6.2.0.tgz",+ "integrity": "sha512-kk0jOU7+zGv//kfjXEBjdIryL1Acl4i9XNkHxtM7Tm5lFiCog576fjNC9hjoR7LTKQ0DsPWy09JummSsH1uqfQ==",+ "license": "MIT",+ "dependencies": {+ "@types/nlcst": "^2.0.0",+ "nlcst-to-string": "^4.0.0",+ "unist-util-visit": "^5.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/retext-stringify": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/retext-stringify/-/retext-stringify-4.0.0.tgz",+ "integrity": "sha512-rtfN/0o8kL1e+78+uxPTqu1Klt0yPzKuQ2BfWwwfgIUSayyzxpM1PJzkKt4V8803uB9qSy32MvI7Xep9khTpiA==",+ "license": "MIT",+ "dependencies": {+ "@types/nlcst": "^2.0.0",+ "nlcst-to-string": "^4.0.0",+ "unified": "^11.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/rollup": {+ "version": "4.60.4",+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz",+ "integrity": "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "1.0.8"+ },+ "bin": {+ "rollup": "dist/bin/rollup"+ },+ "engines": {+ "node": ">=18.0.0",+ "npm": ">=8.0.0"+ },+ "optionalDependencies": {+ "@rollup/rollup-android-arm-eabi": "4.60.4",+ "@rollup/rollup-android-arm64": "4.60.4",+ "@rollup/rollup-darwin-arm64": "4.60.4",+ "@rollup/rollup-darwin-x64": "4.60.4",+ "@rollup/rollup-freebsd-arm64": "4.60.4",+ "@rollup/rollup-freebsd-x64": "4.60.4",+ "@rollup/rollup-linux-arm-gnueabihf": "4.60.4",+ "@rollup/rollup-linux-arm-musleabihf": "4.60.4",+ "@rollup/rollup-linux-arm64-gnu": "4.60.4",+ "@rollup/rollup-linux-arm64-musl": "4.60.4",+ "@rollup/rollup-linux-loong64-gnu": "4.60.4",+ "@rollup/rollup-linux-loong64-musl": "4.60.4",+ "@rollup/rollup-linux-ppc64-gnu": "4.60.4",+ "@rollup/rollup-linux-ppc64-musl": "4.60.4",+ "@rollup/rollup-linux-riscv64-gnu": "4.60.4",+ "@rollup/rollup-linux-riscv64-musl": "4.60.4",+ "@rollup/rollup-linux-s390x-gnu": "4.60.4",+ "@rollup/rollup-linux-x64-gnu": "4.60.4",+ "@rollup/rollup-linux-x64-musl": "4.60.4",+ "@rollup/rollup-openbsd-x64": "4.60.4",+ "@rollup/rollup-openharmony-arm64": "4.60.4",+ "@rollup/rollup-win32-arm64-msvc": "4.60.4",+ "@rollup/rollup-win32-ia32-msvc": "4.60.4",+ "@rollup/rollup-win32-x64-gnu": "4.60.4",+ "@rollup/rollup-win32-x64-msvc": "4.60.4",+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/rollup/node_modules/@types/estree": {+ "version": "1.0.8",+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",+ "license": "MIT"+ },+ "node_modules/sax": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",+ "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==",+ "license": "BlueOak-1.0.0",+ "engines": {+ "node": ">=11.0.0"+ }+ },+ "node_modules/semver": {+ "version": "7.8.0",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.0.tgz",+ "integrity": "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==",+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/sharp": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.5.tgz",+ "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@img/colour": "^1.0.0",+ "detect-libc": "^2.1.2",+ "semver": "^7.7.3"+ },+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-darwin-arm64": "0.34.5",+ "@img/sharp-darwin-x64": "0.34.5",+ "@img/sharp-libvips-darwin-arm64": "1.2.4",+ "@img/sharp-libvips-darwin-x64": "1.2.4",+ "@img/sharp-libvips-linux-arm": "1.2.4",+ "@img/sharp-libvips-linux-arm64": "1.2.4",+ "@img/sharp-libvips-linux-ppc64": "1.2.4",+ "@img/sharp-libvips-linux-riscv64": "1.2.4",+ "@img/sharp-libvips-linux-s390x": "1.2.4",+ "@img/sharp-libvips-linux-x64": "1.2.4",+ "@img/sharp-libvips-linuxmusl-arm64": "1.2.4",+ "@img/sharp-libvips-linuxmusl-x64": "1.2.4",+ "@img/sharp-linux-arm": "0.34.5",+ "@img/sharp-linux-arm64": "0.34.5",+ "@img/sharp-linux-ppc64": "0.34.5",+ "@img/sharp-linux-riscv64": "0.34.5",+ "@img/sharp-linux-s390x": "0.34.5",+ "@img/sharp-linux-x64": "0.34.5",+ "@img/sharp-linuxmusl-arm64": "0.34.5",+ "@img/sharp-linuxmusl-x64": "0.34.5",+ "@img/sharp-wasm32": "0.34.5",+ "@img/sharp-win32-arm64": "0.34.5",+ "@img/sharp-win32-ia32": "0.34.5",+ "@img/sharp-win32-x64": "0.34.5"+ }+ },+ "node_modules/shiki": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.1.0.tgz",+ "integrity": "sha512-l/ABZPUR5v70jI10EzqfMS/I96vjSGv2y0ihUV+WYFzv0EfvW4s54m0Lg8wCrrL+2IkwBzFTuxkZjPf8b2NX9Q==",+ "license": "MIT",+ "dependencies": {+ "@shikijs/core": "4.1.0",+ "@shikijs/engine-javascript": "4.1.0",+ "@shikijs/engine-oniguruma": "4.1.0",+ "@shikijs/langs": "4.1.0",+ "@shikijs/themes": "4.1.0",+ "@shikijs/types": "4.1.0",+ "@shikijs/vscode-textmate": "^10.0.2",+ "@types/hast": "^3.0.4"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/sisteransi": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",+ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",+ "license": "MIT"+ },+ "node_modules/sitemap": {+ "version": "9.0.1",+ "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-9.0.1.tgz",+ "integrity": "sha512-S6hzjGJSG3d6if0YoF5kTyeRJvia6FSTBroE5fQ0bu1QNxyJqhhinfUsXi9fH3MgtXODWvwo2BDyQSnhPQ88uQ==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "^24.9.2",+ "@types/sax": "^1.2.1",+ "arg": "^5.0.0",+ "sax": "^1.4.1"+ },+ "bin": {+ "sitemap": "dist/esm/cli.js"+ },+ "engines": {+ "node": ">=20.19.5",+ "npm": ">=10.8.2"+ }+ },+ "node_modules/smol-toml": {+ "version": "1.6.1",+ "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz",+ "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "url": "https://github.com/sponsors/cyyynthia"+ }+ },+ "node_modules/source-map": {+ "version": "0.7.6",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",+ "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/source-map-js": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/space-separated-tokens": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",+ "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/stream-replace-string": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/stream-replace-string/-/stream-replace-string-2.0.0.tgz",+ "integrity": "sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w==",+ "license": "MIT"+ },+ "node_modules/stringify-entities": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",+ "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",+ "license": "MIT",+ "dependencies": {+ "character-entities-html4": "^2.0.0",+ "character-entities-legacy": "^3.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/style-to-js": {+ "version": "1.1.21",+ "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz",+ "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==",+ "license": "MIT",+ "dependencies": {+ "style-to-object": "1.0.14"+ }+ },+ "node_modules/style-to-object": {+ "version": "1.0.14",+ "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz",+ "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==",+ "license": "MIT",+ "dependencies": {+ "inline-style-parser": "0.2.7"+ }+ },+ "node_modules/svgo": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz",+ "integrity": "sha512-XDpWUOPC6FEibaLzjfe0ucaV0YrOjYotGJO1WpF0Zd+n6ZGEQUsSugaoLq9QkEZtAfQIxT42UChcssDVPP3+/w==",+ "license": "MIT",+ "dependencies": {+ "commander": "^11.1.0",+ "css-select": "^5.1.0",+ "css-tree": "^3.0.1",+ "css-what": "^6.1.0",+ "csso": "^5.0.5",+ "picocolors": "^1.1.1",+ "sax": "^1.5.0"+ },+ "bin": {+ "svgo": "bin/svgo.js"+ },+ "engines": {+ "node": ">=16"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/svgo"+ }+ },+ "node_modules/tiny-inflate": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",+ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",+ "license": "MIT"+ },+ "node_modules/tinyclip": {+ "version": "0.1.12",+ "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.12.tgz",+ "integrity": "sha512-Ae3OVUqifDw0wBriIBS7yVaW44Dp6eSHQcyq4Igc7eN2TJH/2YsicswaW+J/OuMvhpDPOKEgpAZCjkb4hpoyeA==",+ "license": "MIT",+ "engines": {+ "node": "^16.14.0 || >= 17.3.0"+ }+ },+ "node_modules/tinyexec": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.1.2.tgz",+ "integrity": "sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/tinyglobby": {+ "version": "0.2.16",+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz",+ "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==",+ "license": "MIT",+ "dependencies": {+ "fdir": "^6.5.0",+ "picomatch": "^4.0.4"+ },+ "engines": {+ "node": ">=12.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/SuperchupuDev"+ }+ },+ "node_modules/trim-lines": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",+ "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/trough": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz",+ "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD",+ "optional": true+ },+ "node_modules/ufo": {+ "version": "1.6.4",+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz",+ "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==",+ "license": "MIT"+ },+ "node_modules/ultrahtml": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/ultrahtml/-/ultrahtml-1.6.0.tgz",+ "integrity": "sha512-R9fBn90VTJrqqLDwyMph+HGne8eqY1iPfYhPzZrvKpIfwkWZbcYlfpsb8B9dTvBfpy1/hqAD7Wi8EKfP9e8zdw==",+ "license": "MIT"+ },+ "node_modules/uncrypto": {+ "version": "0.1.3",+ "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz",+ "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",+ "license": "MIT"+ },+ "node_modules/undici-types": {+ "version": "7.16.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",+ "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",+ "license": "MIT"+ },+ "node_modules/unified": {+ "version": "11.0.5",+ "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",+ "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "bail": "^2.0.0",+ "devlop": "^1.0.0",+ "extend": "^3.0.0",+ "is-plain-obj": "^4.0.0",+ "trough": "^2.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unifont": {+ "version": "0.7.4",+ "resolved": "https://registry.npmjs.org/unifont/-/unifont-0.7.4.tgz",+ "integrity": "sha512-oHeis4/xl42HUIeHuNZRGEvxj5AaIKR+bHPNegRq5LV1gdc3jundpONbjglKpihmJf+dswygdMJn3eftGIMemg==",+ "license": "MIT",+ "dependencies": {+ "css-tree": "^3.1.0",+ "ofetch": "^1.5.1",+ "ohash": "^2.0.11"+ }+ },+ "node_modules/unist-util-find-after": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz",+ "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "unist-util-is": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-is": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz",+ "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-modify-children": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-4.0.0.tgz",+ "integrity": "sha512-+tdN5fGNddvsQdIzUF3Xx82CU9sMM+fA0dLgR9vOmT0oPT2jH+P1nd5lSqfCfXAw+93NhcXNY2qqvTUtE4cQkw==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "array-iterate": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-position": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz",+ "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-position-from-estree": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz",+ "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-remove-position": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz",+ "integrity": "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "unist-util-visit": "^5.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-stringify-position": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz",+ "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-visit": {+ "version": "5.1.0",+ "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz",+ "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "unist-util-is": "^6.0.0",+ "unist-util-visit-parents": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-visit-children": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-visit-children/-/unist-util-visit-children-3.0.0.tgz",+ "integrity": "sha512-RgmdTfSBOg04sdPcpTSD1jzoNBjt9a80/ZCzp5cI9n1qPzLZWF9YdvWGN2zmTumP1HWhXKdUWexjy/Wy/lJ7tA==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unist-util-visit-parents": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz",+ "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "unist-util-is": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/unstorage": {+ "version": "1.17.5",+ "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz",+ "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==",+ "license": "MIT",+ "dependencies": {+ "anymatch": "^3.1.3",+ "chokidar": "^5.0.0",+ "destr": "^2.0.5",+ "h3": "^1.15.10",+ "lru-cache": "^11.2.7",+ "node-fetch-native": "^1.6.7",+ "ofetch": "^1.5.1",+ "ufo": "^1.6.3"+ },+ "peerDependencies": {+ "@azure/app-configuration": "^1.8.0",+ "@azure/cosmos": "^4.2.0",+ "@azure/data-tables": "^13.3.0",+ "@azure/identity": "^4.6.0",+ "@azure/keyvault-secrets": "^4.9.0",+ "@azure/storage-blob": "^12.26.0",+ "@capacitor/preferences": "^6 || ^7 || ^8",+ "@deno/kv": ">=0.9.0",+ "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0",+ "@planetscale/database": "^1.19.0",+ "@upstash/redis": "^1.34.3",+ "@vercel/blob": ">=0.27.1",+ "@vercel/functions": "^2.2.12 || ^3.0.0",+ "@vercel/kv": "^1 || ^2 || ^3",+ "aws4fetch": "^1.0.20",+ "db0": ">=0.2.1",+ "idb-keyval": "^6.2.1",+ "ioredis": "^5.4.2",+ "uploadthing": "^7.4.4"+ },+ "peerDependenciesMeta": {+ "@azure/app-configuration": {+ "optional": true+ },+ "@azure/cosmos": {+ "optional": true+ },+ "@azure/data-tables": {+ "optional": true+ },+ "@azure/identity": {+ "optional": true+ },+ "@azure/keyvault-secrets": {+ "optional": true+ },+ "@azure/storage-blob": {+ "optional": true+ },+ "@capacitor/preferences": {+ "optional": true+ },+ "@deno/kv": {+ "optional": true+ },+ "@netlify/blobs": {+ "optional": true+ },+ "@planetscale/database": {+ "optional": true+ },+ "@upstash/redis": {+ "optional": true+ },+ "@vercel/blob": {+ "optional": true+ },+ "@vercel/functions": {+ "optional": true+ },+ "@vercel/kv": {+ "optional": true+ },+ "aws4fetch": {+ "optional": true+ },+ "db0": {+ "optional": true+ },+ "idb-keyval": {+ "optional": true+ },+ "ioredis": {+ "optional": true+ },+ "uploadthing": {+ "optional": true+ }+ }+ },+ "node_modules/util-deprecate": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",+ "license": "MIT"+ },+ "node_modules/vfile": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",+ "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/vfile-location": {+ "version": "5.0.3",+ "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz",+ "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/vfile-message": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz",+ "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "unist-util-stringify-position": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/vite": {+ "version": "7.3.3",+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.3.tgz",+ "integrity": "sha512-/4XH147Ui7OGTjg3HbdWe5arnZQSbfuRzdr9Ec7TQi5I7R+ir0Rlc9GIvD4v0XZurELqA035KVXJXpR61xhiTA==",+ "license": "MIT",+ "dependencies": {+ "esbuild": "^0.27.0",+ "fdir": "^6.5.0",+ "picomatch": "^4.0.3",+ "postcss": "^8.5.6",+ "rollup": "^4.43.0",+ "tinyglobby": "^0.2.15"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^20.19.0 || >=22.12.0",+ "jiti": ">=1.21.0",+ "less": "^4.0.0",+ "lightningcss": "^1.21.0",+ "sass": "^1.70.0",+ "sass-embedded": "^1.70.0",+ "stylus": ">=0.54.8",+ "sugarss": "^5.0.0",+ "terser": "^5.16.0",+ "tsx": "^4.8.1",+ "yaml": "^2.4.2"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "jiti": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "lightningcss": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ },+ "tsx": {+ "optional": true+ },+ "yaml": {+ "optional": true+ }+ }+ },+ "node_modules/vitefu": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz",+ "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==",+ "license": "MIT",+ "workspaces": [+ "tests/deps/*",+ "tests/projects/*",+ "tests/projects/workspace/packages/*"+ ],+ "peerDependencies": {+ "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/web-namespaces": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz",+ "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/which-pm-runs": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz",+ "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==",+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/xxhash-wasm": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz",+ "integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==",+ "license": "MIT"+ },+ "node_modules/yargs-parser": {+ "version": "22.0.0",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",+ "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",+ "license": "ISC",+ "engines": {+ "node": "^20.19.0 || ^22.12.0 || >=23"+ }+ },+ "node_modules/yocto-queue": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz",+ "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==",+ "license": "MIT",+ "engines": {+ "node": ">=12.20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/zod": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",+ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },+ "node_modules/zwitch": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",+ "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ }+ }+}diff --git a/site/package.json b/site/package.jsonnew file mode 100644index 000000000..3b8969396--- /dev/null+++ b/site/package.json@@ -0,0 +1,22 @@+{+ "name": "site",+ "type": "module",+ "version": "0.0.1",+ "scripts": {+ "dev": "astro dev",+ "start": "astro dev",+ "build": "astro build",+ "preview": "astro preview",+ "build:pages": "astro build && cp -R functions dist/functions",+ "deploy:pages": "npm run build:pages && npx wrangler pages deploy dist",+ "astro": "astro"+ },+ "dependencies": {+ "@astrojs/starlight": "^0.39.2",+ "astro": "^6.3.1",+ "sharp": "^0.34.5"+ },+ "devDependencies": {+ "i18n-iso-countries": "^7.14.0"+ }+}diff --git a/site/public/banner.png b/site/public/banner.pngnew file mode 100644index 000000000..4c3380d32Binary files /dev/null and b/site/public/banner.png differdiff --git a/site/public/favicon.svg b/site/public/favicon.svgnew file mode 100644index 000000000..707e172aa--- /dev/null+++ b/site/public/favicon.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M81 36 64 0 47 36l-1 2-9-10a6 6 0 0 0-9 9l10 10h-2L0 64l36 17h2L28 91a6 6 0 1 0 9 9l9-10 1 2 17 36 17-36v-2l9 10a6 6 0 1 0 9-9l-9-9 2-1 36-17-36-17-2-1 9-9a6 6 0 1 0-9-9l-9 10v-2Zm-17 2-2 5c-4 8-11 15-19 19l-5 2 5 2c8 4 15 11 19 19l2 5 2-5c4-8 11-15 19-19l5-2-5-2c-8-4-15-11-19-19l-2-5Z" clip-rule="evenodd"/><path d="M118 19a6 6 0 0 0-9-9l-3 3a6 6 0 1 0 9 9l3-3Zm-96 4c-2 2-6 2-9 0l-3-3a6 6 0 1 1 9-9l3 3c3 2 3 6 0 9Zm0 82c-2-2-6-2-9 0l-3 3a6 6 0 1 0 9 9l3-3c3-2 3-6 0-9Zm96 4a6 6 0 0 1-9 9l-3-3a6 6 0 1 1 9-9l3 3Z"/><style>path{fill:#000}@media (prefers-color-scheme:dark){path{fill:#fff}}</style></svg>diff --git a/site/public/images/cli-architecture.png b/site/public/images/cli-architecture.pngnew file mode 100644index 000000000..c59ba3478Binary files /dev/null and b/site/public/images/cli-architecture.png differdiff --git a/site/public/images/deeptutor-architecture.png b/site/public/images/deeptutor-architecture.pngnew file mode 100644index 000000000..0333bf239Binary files /dev/null and b/site/public/images/deeptutor-architecture.png differdiff --git a/site/public/images/dt-chat.png b/site/public/images/dt-chat.pngnew file mode 100644index 000000000..f2d5d7820Binary files /dev/null and b/site/public/images/dt-chat.png differdiff --git a/site/public/images/dt-cowriter.png b/site/public/images/dt-cowriter.pngnew file mode 100644index 000000000..b9b0710f3Binary files /dev/null and b/site/public/images/dt-cowriter.png differdiff --git a/site/public/images/dt-guide.png b/site/public/images/dt-guide.pngnew file mode 100644index 000000000..f82d022fdBinary files /dev/null and b/site/public/images/dt-guide.png differdiff --git a/site/public/images/dt-knowledge.png b/site/public/images/dt-knowledge.pngnew file mode 100644index 000000000..7dc88877fBinary files /dev/null and b/site/public/images/dt-knowledge.png differdiff --git a/site/public/images/dt-memgraph.png b/site/public/images/dt-memgraph.pngnew file mode 100644index 000000000..7047bb1f7Binary files /dev/null and b/site/public/images/dt-memgraph.png differdiff --git a/site/public/images/dt-memory.png b/site/public/images/dt-memory.pngnew file mode 100644index 000000000..128160168Binary files /dev/null and b/site/public/images/dt-memory.png differdiff --git a/site/public/images/tb.png b/site/public/images/tb.pngnew file mode 100644index 000000000..649c31928Binary files /dev/null and b/site/public/images/tb.png differdiff --git a/site/public/images/tutorbot-architecture.png b/site/public/images/tutorbot-architecture.pngnew file mode 100644index 000000000..db0a83dc5Binary files /dev/null and b/site/public/images/tutorbot-architecture.png differdiff --git a/site/public/logo.png b/site/public/logo.pngnew file mode 100644index 000000000..fc1a2abd1Binary files /dev/null and b/site/public/logo.png differdiff --git a/site/public/logo_black.png b/site/public/logo_black.pngnew file mode 100644index 000000000..67af9ff48Binary files /dev/null and b/site/public/logo_black.png differdiff --git a/site/public/screenshots/dt-agents.png b/site/public/screenshots/dt-agents.pngnew file mode 100644index 000000000..e660caf36Binary files /dev/null and b/site/public/screenshots/dt-agents.png differdiff --git a/site/public/screenshots/dt-book.png b/site/public/screenshots/dt-book.pngnew file mode 100644index 000000000..e1bd85230Binary files /dev/null and b/site/public/screenshots/dt-book.png differdiff --git a/site/public/screenshots/dt-chat.png b/site/public/screenshots/dt-chat.pngnew file mode 100644index 000000000..cad59979dBinary files /dev/null and b/site/public/screenshots/dt-chat.png differdiff --git a/site/public/screenshots/dt-co-writer.png b/site/public/screenshots/dt-co-writer.pngnew file mode 100644index 000000000..3b64e0bbcBinary files /dev/null and b/site/public/screenshots/dt-co-writer.png differdiff --git a/site/public/screenshots/dt-current-home.png b/site/public/screenshots/dt-current-home.pngnew file mode 100644index 000000000..aa1d3b6afBinary files /dev/null and b/site/public/screenshots/dt-current-home.png differdiff --git a/site/public/screenshots/dt-home.png b/site/public/screenshots/dt-home.pngnew file mode 100644index 000000000..bb50b07d8Binary files /dev/null and b/site/public/screenshots/dt-home.png differdiff --git a/site/public/screenshots/dt-knowledge.png b/site/public/screenshots/dt-knowledge.pngnew file mode 100644index 000000000..4e402c6a9Binary files /dev/null and b/site/public/screenshots/dt-knowledge.png differdiff --git a/site/public/screenshots/dt-memory-l1.png b/site/public/screenshots/dt-memory-l1.pngnew file mode 100644index 000000000..a219c586bBinary files /dev/null and b/site/public/screenshots/dt-memory-l1.png differdiff --git a/site/public/screenshots/dt-memory-l2.png b/site/public/screenshots/dt-memory-l2.pngnew file mode 100644index 000000000..ad8a31608Binary files /dev/null and b/site/public/screenshots/dt-memory-l2.png differdiff --git a/site/public/screenshots/dt-memory-l3.png b/site/public/screenshots/dt-memory-l3.pngnew file mode 100644index 000000000..c015ce2bfBinary files /dev/null and b/site/public/screenshots/dt-memory-l3.png differdiff --git a/site/public/screenshots/dt-memory.png b/site/public/screenshots/dt-memory.pngnew file mode 100644index 000000000..632bc5dfaBinary files /dev/null and b/site/public/screenshots/dt-memory.png differdiff --git a/site/public/screenshots/dt-playground.png b/site/public/screenshots/dt-playground.pngnew file mode 100644index 000000000..88a6cadaeBinary files /dev/null and b/site/public/screenshots/dt-playground.png differdiff --git a/site/public/screenshots/dt-settings-capabilities.png b/site/public/screenshots/dt-settings-capabilities.pngnew file mode 100644index 000000000..ed1b9dcd4Binary files /dev/null and b/site/public/screenshots/dt-settings-capabilities.png differdiff --git a/site/public/screenshots/dt-settings-llm.png b/site/public/screenshots/dt-settings-llm.pngnew file mode 100644index 000000000..4f6619721Binary files /dev/null and b/site/public/screenshots/dt-settings-llm.png differdiff --git a/site/public/screenshots/dt-settings-tools.png b/site/public/screenshots/dt-settings-tools.pngnew file mode 100644index 000000000..61e7df27aBinary files /dev/null and b/site/public/screenshots/dt-settings-tools.png differdiff --git a/site/public/screenshots/dt-settings.png b/site/public/screenshots/dt-settings.pngnew file mode 100644index 000000000..31ac1033eBinary files /dev/null and b/site/public/screenshots/dt-settings.png differdiff --git a/site/public/screenshots/dt-space.png b/site/public/screenshots/dt-space.pngnew file mode 100644index 000000000..b90c215adBinary files /dev/null and b/site/public/screenshots/dt-space.png differdiff --git a/site/src/assets/logo.png b/site/src/assets/logo.pngnew file mode 100644index 000000000..fc1a2abd1Binary files /dev/null and b/site/src/assets/logo.png differdiff --git a/site/src/components/SiteTitle.astro b/site/src/components/SiteTitle.astronew file mode 100644index 000000000..d0cb47ec5--- /dev/null+++ b/site/src/components/SiteTitle.astro@@ -0,0 +1,47 @@+---+import { logos } from "virtual:starlight/user-images";+import config from "virtual:starlight/user-config";++const { siteTitleHref } = Astro.locals.starlightRoute;+---++<a href={siteTitleHref} class="site-title sl-flex" aria-label="DeepTutor">+ {+ config.logo && logos.dark && (+ <img+ class="site-title-mark"+ alt=""+ aria-hidden="true"+ src={logos.dark.src}+ width={logos.dark.width}+ height={logos.dark.height}+ />+ )+ }+ <img class="site-title-wordmark" src="/banner.png" alt="DeepTutor" />+</a>++<style>+ .site-title {+ display: inline-flex;+ align-items: center;+ gap: 10px;+ text-decoration: none;+ min-width: 0;+ }+ .site-title-mark {+ height: 22px;+ width: auto;+ flex-shrink: 0;+ object-fit: contain;+ }+ .site-title-wordmark {+ height: 20px;+ width: auto;+ user-select: none;+ object-fit: contain;+ }+ [data-theme="dark"] .site-title-wordmark {+ filter: invert(1) hue-rotate(180deg) brightness(1.12);+ }+</style>diff --git a/site/src/components/SocialIcons.astro b/site/src/components/SocialIcons.astronew file mode 100644index 000000000..e33e401d2--- /dev/null+++ b/site/src/components/SocialIcons.astro@@ -0,0 +1,174 @@+---+import Default from "@astrojs/starlight/components/SocialIcons.astro";++const path = Astro.url.pathname;+const pageURL = `https://deeptutor.info${path}`;+const issueURL = `https://github.com/HKUDS/DeepTutor/issues/new?template=docs.yml&page=${encodeURIComponent(+ pageURL,+)}`;+// WeChat community lives in a pinned GitHub issue (current QR-code thread).+const wechatURL = "https://github.com/HKUDS/DeepTutor/issues/78";+---++<div class="dt-actions">+ <a+ class="dt-report"+ href={issueURL}+ target="_blank"+ rel="noopener"+ title="Report a docs issue on this page"+ >+ <svg+ width="13"+ height="13"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+ aria-hidden="true"+ >+ <circle cx="12" cy="12" r="10"></circle>+ <line x1="12" y1="8" x2="12" y2="12"></line>+ <line x1="12" y1="16" x2="12.01" y2="16"></line>+ </svg>+ <span>Report issue</span>+ </a>+ <Default><slot /></Default>+ <a+ class="sl-flex dt-wechat social-icons"+ href={wechatURL}+ target="_blank"+ rel="noopener"+ aria-label="WeChat community"+ title="WeChat community"+ >+ <svg+ width="16"+ height="16"+ viewBox="0 0 24 24"+ fill="currentColor"+ aria-hidden="true"+ >+ <path+ d="M8.69 4C4.55 4 1.2 6.68 1.2 10c0 1.86 1.04 3.51 2.69 4.61l-.7 2.4 2.79-1.5c.83.3 1.74.49 2.7.49.34 0 .67-.02 1-.06-.13-.46-.21-.94-.21-1.43 0-3.07 2.97-5.5 6.7-5.5.33 0 .67.02 1 .07C16.39 6.32 12.86 4 8.69 4ZM6.18 8.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5 1c-3.3 0-6 2.24-6 5s2.7 5 6 5c.74 0 1.45-.12 2.1-.34L20.2 20l-.7-2.05c1.07-.95 1.7-2.15 1.7-3.45 0-2.76-2.7-5-6-5Zm-2 4a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Zm4 0a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"+ />+ </svg>+ </a>+</div>++<script is:inline>+ (() => {+ if (window.__dtLocaleSwitcherPatched) return;+ window.__dtLocaleSwitcherPatched = true;++ const zhPrefix = "/zh-cn";+ const isZhPath = (path) => path === zhPrefix || path.startsWith(`${zhPrefix}/`);+ const toEnglishPath = (path) => {+ if (path === zhPrefix || path === `${zhPrefix}/`) return "/";+ return isZhPath(path) ? path.slice(zhPrefix.length) || "/" : path;+ };+ const toChinesePath = (path) => {+ if (isZhPath(path)) return path;+ return path === "/" ? `${zhPrefix}/` : `${zhPrefix}${path}`;+ };+ const withCurrentSuffix = (path) =>+ `${path}${window.location.search}${window.location.hash}`;++ const syncLanguageSelects = () => {+ const current = window.location.pathname;+ const englishPath = toEnglishPath(current);+ const chinesePath = toChinesePath(current);+ document.querySelectorAll("starlight-lang-select select").forEach((select) => {+ Array.from(select.options).forEach((option) => {+ const label = option.textContent?.trim();+ if (label === "English") option.value = englishPath;+ if (label === "简体中文") option.value = chinesePath;+ });+ select.value = isZhPath(current) ? chinesePath : englishPath;+ });+ };++ document.addEventListener(+ "change",+ (event) => {+ const target = event.target;+ if (!(target instanceof HTMLSelectElement)) return;+ if (!target.closest("starlight-lang-select")) return;+ event.preventDefault();+ event.stopImmediatePropagation();+ const nextPath = target.value;+ if (nextPath && nextPath !== window.location.pathname) {+ window.location.assign(withCurrentSuffix(nextPath));+ }+ },+ true,+ );++ if (document.readyState === "loading") {+ document.addEventListener("DOMContentLoaded", syncLanguageSelects);+ } else {+ syncLanguageSelects();+ }+ window.addEventListener("pageshow", syncLanguageSelects);+ })();+</script>++<style>+ .dt-actions {+ display: inline-flex;+ align-items: center;+ gap: 12px;+ }+ .dt-report {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 5px 12px;+ font-family:+ "Geist",+ -apple-system,+ sans-serif;+ font-size: 12.5px;+ font-weight: 500;+ line-height: 1;+ color: var(--sl-color-gray-2);+ text-decoration: none;+ border: 1px solid var(--sl-color-hairline);+ border-radius: 999px;+ transition:+ color 0.15s ease,+ border-color 0.15s ease,+ background 0.15s ease;+ white-space: nowrap;+ }+ .dt-report:hover {+ color: var(--sl-color-text);+ border-color: var(--sl-color-text);+ background: var(--sl-color-accent-low);+ }+ .dt-report svg {+ flex-shrink: 0;+ }+ /* Hide the "Report issue" label on narrow viewports, keep the icon */+ @media (max-width: 50rem) {+ .dt-report span {+ display: none;+ }+ .dt-report {+ padding: 5px 7px;+ }+ }+ /* WeChat icon — matches Starlight's other social icons (link color ++ same sizing). The .social-icons class taps into Starlight's existing+ hover/sizing rules; we just ensure consistent layout. */+ .dt-wechat {+ color: var(--sl-color-text);+ padding: 0.5em;+ margin: -0.5em;+ }+ .dt-wechat:hover {+ color: var(--sl-color-text);+ }+</style>diff --git a/site/src/content.config.ts b/site/src/content.config.tsnew file mode 100644index 000000000..d9ee8c9d1--- /dev/null+++ b/site/src/content.config.ts@@ -0,0 +1,7 @@+import { defineCollection } from 'astro:content';+import { docsLoader } from '@astrojs/starlight/loaders';+import { docsSchema } from '@astrojs/starlight/schema';++export const collections = {+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),+};diff --git a/site/src/content/docs/docs/cli/agent-handoff.md b/site/src/content/docs/docs/cli/agent-handoff.mdnew file mode 100644index 000000000..4df3075de--- /dev/null+++ b/site/src/content/docs/docs/cli/agent-handoff.md@@ -0,0 +1,263 @@+---+title: Agent Handoff+description: Hand the deeptutor CLI to Claude Code, Codex, OpenCode, Hermes, or any tool-using LLM — and let them drive.+---++DeepTutor was designed to be **driven by other agents**. Turn execution can emit structured JSON, sessions can be resumed across processes, and the supported surface is documented in a single skill file that any tool-using LLM can read and act on.++This page is the playbook for that.++## The fundamental pattern++The repo ships a [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) at its root. That file is the **canonical handover document**: it tells an agent what `deeptutor` is, how to invoke it, what the flag conventions are, and what JSON to expect back.++Hand `SKILL.md` to your agent of choice and it will be able to:++- Run capabilities (`deep_solve`, `deep_research`, `deep_question`, …)+- Manage Knowledge Bases (`kb create`, `kb search`, `kb add`)+- Drive long, multi-turn sessions with `--session` continuity+- Pipe JSON output into downstream tools+- Switch capabilities and tools mid-task++## Claude Code++[Claude Code](https://docs.claude.com/en/docs/claude-code) reads `SKILL.md` files automatically when they appear in the project root.++```bash+cd /your-project+# DeepTutor's SKILL.md lives in DeepTutor/SKILL.md; copy or symlink it:+ln -s /path/to/DeepTutor/SKILL.md ./SKILL.md++# Or, easier: include it via Claude Code's allowed-skills config+```++Once Claude Code sees `SKILL.md`, it understands the CLI. You can prompt it naturally:++```text+> Build me a study plan for the next two weeks on linear algebra. Use DeepTutor:+> create a KB from the PDFs in ./textbooks/, then generate 10 quiz questions+> spread across three difficulty levels.+```++Claude Code will translate that into:++```bash+deeptutor kb create linalg --docs-dir ./textbooks/++# First quiz call — start a new session and capture its id from the+# 'done' event so the next two turns can reuse it.+SESSION_ID=$(deeptutor run deep_question "Linear algebra fundamentals" \+ --kb linalg \+ --config num_questions=4 --config difficulty=easy \+ --format json | jq -r 'select(.type=="done") | .metadata.session_id')++deeptutor run deep_question "Linear algebra eigenvectors" \+ --kb linalg --session "$SESSION_ID" \+ --config num_questions=3 --config difficulty=medium++deeptutor run deep_question "Linear algebra advanced theorems" \+ --kb linalg --session "$SESSION_ID" \+ --config num_questions=3 --config difficulty=hard+```++It uses `--session` to keep all three quiz turns linked.++### Wiring the deeptutor CLI into a Claude Code subagent++If you want a dedicated "study agent" in Claude Code that always uses `deeptutor`:++```yaml+# .claude/agents/study-agent.yaml+name: study-agent+description: Use this agent for any learning, study planning, or quiz generation task. It drives DeepTutor.+tools: [Bash, Read, Write]+system_prompt: |+ You are a study planner. You have access to the `deeptutor` CLI via the Bash tool.+ Read SKILL.md before doing anything else. Then build study plans, generate quizzes,+ and run research turns by calling `deeptutor run <capability> "..."` with the right+ flags. Always pass `--format json` for parsing.+```++## Codex (OpenAI Codex CLI)++Codex follows a similar pattern. Drop `SKILL.md` in the project root and prompt:++```text+codex "Read SKILL.md, then run a deep research turn on transformer attention mechanisms. Use the 'papers' knowledge base if it exists; if not, just web search."+```++For OAuth-enabled providers (like OpenAI Codex itself), DeepTutor has a built-in login command:++```bash+deeptutor provider login openai-codex+# Opens a browser for OAuth, stores the token in workspace+```++After that, you can use OpenAI Codex via DeepTutor with the resulting token.++## OpenCode++[OpenCode](https://opencode.ai) works the same way. Add the project's `SKILL.md`:++```bash+opencode init+ln -s /path/to/DeepTutor/SKILL.md ./SKILL.md+opencode "Plan a study session on quantum mechanics using deeptutor"+```++## Hermes / generic agent frameworks++For agent frameworks that don't natively understand `SKILL.md` (LangChain agents, AutoGen, custom loops), expose `deeptutor` as a tool definition. A minimal LangChain wrapper:++```python+from langchain.tools import Tool+import subprocess+import json++def deeptutor_run(args_json: str) -> str:+ args = json.loads(args_json)+ cmd = [+ "deeptutor", "run",+ args["capability"],+ args["message"],+ "--format", "json",+ ]+ for tool in args.get("tools", []):+ cmd.extend(["--tool", tool])+ for kb in args.get("knowledge_bases", []):+ cmd.extend(["--kb", kb])+ if args.get("session_id"):+ cmd.extend(["--session", args["session_id"]])+ for key, value in args.get("config", {}).items():+ cmd.extend(["--config", f"{key}={json.dumps(value)}"])++ result = subprocess.run(cmd, capture_output=True, text=True)+ return result.stdout++deeptutor_tool = Tool(+ name="deeptutor_run",+ description=(+ "Run a DeepTutor capability. Args: JSON object with "+ "{capability, message, tools, knowledge_bases, session_id, config}. "+ "Returns one JSON event per line."+ ),+ func=deeptutor_run,+)+```++Then your agent loop can use it directly.++## The session-handoff pattern++The most powerful pattern: have an agent **chain capability calls within one session** so each new turn inherits the context of the previous one.++```bash+# Step 1 — research+SESSION_ID=$(deeptutor run deep_research "Survey 2026 papers on RAG" \+ --tool web_search --kb papers \+ --config mode=report --config depth=standard \+ --format json | \+ jq -r 'select(.type=="done") | .metadata.session_id')++# Step 2 — summarize (same session, different capability)+deeptutor run chat "Summarize the top three findings as bullet points" \+ --session "$SESSION_ID" --format json++# Step 3 — quiz (same session)+deeptutor run deep_question "The findings from this session" \+ --session "$SESSION_ID" \+ --config num_questions=5 \+ --format json+```++Each step inherits:++- The full chat history+- The attached KB+- The tool list+- User language preference+- Memory references++Agents using DeepTutor this way effectively have a **stateful working context** that carries across multiple tool invocations.++## JSON event parsing++When piping `--format json`, parse line-by-line. A minimal Python consumer:++```python+import json+import subprocess++proc = subprocess.Popen(+ ["deeptutor", "run", "deep_solve", "Find d/dx [sin(x²)]",+ "--tool", "reason", "--format", "json"],+ stdout=subprocess.PIPE,+ text=True,+)++final_content = []+for line in proc.stdout:+ event = json.loads(line)+ if event["type"] == "content":+ final_content.append(event["content"])+ elif event["type"] == "tool_call":+ print(f"→ Tool: {event['content']}({event['metadata']['args']})")+ elif event["type"] == "error":+ print(f"× Error: {event['content']}")+ break+ elif event["type"] == "done":+ session_id = event["metadata"]["session_id"]+ break++answer = "".join(final_content)+```++Or with `jq`:++```bash+# Get the final answer+deeptutor run chat "Hello" --format json | \+ jq -s 'map(select(.type=="content") | .content) | join("")'++# Get the session id+deeptutor run chat "Hello" --format json | \+ jq -r 'select(.type=="done") | .metadata.session_id'++# Stream stages as they finish+deeptutor run deep_research "..." \+ --config mode=report --config depth=quick \+ --format json | \+ jq -r 'select(.type=="stage_end") | "Stage finished: " + .stage'+```++## What goes in your SKILL.md, exactly++The shipped [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) covers:++1. **When to Use** — what kinds of user requests should trigger DeepTutor+2. **Prerequisites** — Python 3.11+, install path, `deeptutor init`+3. **Commands** — Chat & Capabilities, Knowledge Bases, TutorBot, Memory, Sessions, Notebooks, System+4. **REPL Slash Commands** — the commands available inside `deeptutor chat`+5. **Typical Workflows** — end-to-end recipes an agent can replay++It's ~150 lines and written for one-shot ingestion — most tool-using agents (Claude Sonnet/Opus, GPT-4/5, Gemini Pro) can absorb it in one read.++## Provider tokens for cloud agents++DeepTutor can run local CLI commands without a browser, but model/search features call out to the providers you configure. If your agent is running in a sandboxed environment, make sure these are reachable:++| Provider | Endpoint to allow |+|----------|-------------------|+| OpenAI | `api.openai.com:443` |+| Anthropic | `api.anthropic.com:443` |+| Google Gemini | `generativelanguage.googleapis.com:443` |+| Azure OpenAI | `<your-resource>.openai.azure.com:443` |+| Local Ollama / vLLM | The endpoint configured in `data/user/settings/model_catalog.json` or process env |++For RAG-heavy workflows, also allow whatever search provider you've configured (Tavily, Brave, Jina, Serper, Perplexity, SearXNG, or DuckDuckGo).++## See also++- [**Commands**](/docs/cli/commands/) — full CLI reference+- [**Interactive REPL**](/docs/cli/chat-repl/) — for human-driven sessions+- [**Memory**](/docs/explore/memory/) — how persistent state flows through sessionsdiff --git a/site/src/content/docs/docs/cli/chat-repl.md b/site/src/content/docs/docs/cli/chat-repl.mdnew file mode 100644index 000000000..6667ccc3d--- /dev/null+++ b/site/src/content/docs/docs/cli/chat-repl.md@@ -0,0 +1,267 @@+---+title: Interactive REPL+description: A long-running terminal chat session with inline /slash commands for switching capabilities, tools, KBs, and more.+---++`deeptutor chat` opens an interactive REPL — useful for **exploratory work**, **multi-turn debugging**, and **driving DeepTutor with your hands** instead of with `run` calls.++## Launching++```bash+# Default — chat capability, no KBs, no extra tools+deeptutor chat++# Pre-attach a KB and pre-enable a tool+deeptutor chat --kb physics --tool rag --tool reason++# Start in a specific capability (e.g., always use Deep Solve)+deeptutor chat --capability deep_solve++# Resume a prior session+deeptutor chat --session sess_abc123++# Hand it preferences via flags (same as run)+deeptutor chat --language zh --kb papers --history-ref sess_old_xyz+```++## What the REPL looks like++```text+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓+┃ DeepTutor CLI ┃+┃ Type a message to chat. Commands: ┃+┃ /quit /session /new ┃+┃ /regenerate (alias /retry) — re-run the last user message ┃+┃ /tool on|off <name> ┃+┃ /cap <name> ┃+┃ /kb <name>|none ┃+┃ /history add <id> | /history clear ┃+┃ /notebook add <ref> | /notebook clear ┃+┃ /show last|<n> — expand a truncated tool result ┃+┃ /refs /config show|set|clear ┃+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛+[dim]session=(new) capability=chat tools=[] kb=[] history=[] notebook_refs=[] language=en config={}[/]+You> _+```++The dimmed status line shows everything that will be sent on your next turn: session id, capability, tools, attached KBs, history references, notebook references, language, and config.++## A typical session++```text+You> What is the chain rule?++▶ thinking+ [dim]The user is asking about a foundational calculus concept...[/]++▶ responding+The **chain rule** says that to differentiate a composite function `f(g(x))`, you multiply...++[dim]session=sess_abc123 turn=turn_xyz789 capability=chat[/]++You> /tool on rag+[dim]session=sess_abc123 capability=chat tools=[rag] kb=[] ...[/]++You> /kb math+[dim]session=sess_abc123 capability=chat tools=[rag] kb=[math] ...[/]++You> Now with a worked example from chapter 3 of the textbook++▶ retrieving+ ● rag_search(query="chain rule worked example")+ │ Example: differentiate sin(x²) using the chain rule...+ └ #1 rag — +3 more lines++▶ responding+Here's the example from chapter 3:++Take `y = sin(x²)`. Let `u = x²`...++You> /quit+$+```++## All slash commands++### Session++| Command | Effect |+|---------|--------|+| `/quit` | Exit the REPL |+| `/session` | Print the current session id |+| `/new` | Start a fresh session, clearing the id |+| `/regenerate` (or `/retry`) | Re-run the last user message with the current config |++### Capability switching++| Command | Effect |+|---------|--------|+| `/cap <name>` | Switch to a different capability |++Valid names: `chat`, `deep_solve`, `deep_question`, `deep_research`, `math_animator`, `visualize`, `auto`. CLI aliases also work (e.g., `solve` → `deep_solve`, `quiz` → `deep_question`).++```text+You> /cap deep_solve+[dim]capability=deep_solve ...[/]+You> Find d/dx [sin(x²)]+```++### Tools++```text+/tool on <name> # Enable a tool for next turn+/tool off <name> # Disable it+```++Valid tool names: `rag`, `web_search`, `code_execution`, `reason`, `brainstorm`, `paper_search`. Some tools (like `read_memory`, `web_fetch`) are always-on and don't need to be explicitly toggled.++### Knowledge Bases++```text+/kb <name> # Attach a KB (replaces any current attachment)+/kb none # Detach+```++### History references++Tell the model about prior sessions it should treat as context (without copy-pasting):++```text+/history add sess_prior_xyz+/history clear+```++This is how you build cross-session context — perfect for "follow-up" research turns.++### Notebook references++Bring in specific records from your notebooks:++```text+/notebook add my-notes:rec_abc123,rec_def456+/notebook clear+```++### Config overrides++Per-capability config that applies to subsequent turns:++```text+/config show # Print current config+/config set num_questions 5+/config set difficulty=hard+/config set difficulty hard+/config clear # Reset to defaults+```++For example, with `--capability deep_question`:++```text+You> /config set num_questions 8+You> /config set question_types '["short_answer","mcq"]'+You> Generate questions on linear regression+```++### Inspecting tool results++Tool results in the REPL are truncated to first 10 lines / 240 chars per line to keep the display clean. To expand a specific one:++```text+/show last # Last tool result+/show 3 # The third tool result in this session+```++Up to 32 results are buffered in memory for expansion.++### `/refs`++Print everything that will go into the next turn:++```text+You> /refs+[bold]Current state:[/]+ session sess_abc123+ capability chat+ tools [rag, reason]+ kb [physics, math]+ history [sess_old_xyz]+ notebooks [my-notes:rec_abc123]+ language en+ config {"difficulty": "hard", "num_questions": 5}+```++## How streaming works in the REPL++Each turn is rendered stage by stage. You'll see, in order:++| Indicator | Meaning |+|-----------|---------|+| `▶ <stage>` | A new pipeline stage just started (e.g., `retrieving`, `reasoning`, `writing`) |+| ` [dim]…[/]` | Intermediate thinking — model's chain-of-thought-ish reasoning |+| ` ● <tool>(...)` | A tool was just invoked |+| ` │ <line>` | A line of tool output |+| ` └ #N <tool> — +M more lines; run /show N to expand` | Tool result was truncated |+| *plain text* | Final markdown response, rendered |++## Tips++### Multi-line input++For multi-line messages (code snippets, long prompts), end each line with a backslash `\` and press Enter:++```text+You> Please review this Python code:\+def fib(n):\+ if n < 2: return n\+ return fib(n-1) + fib(n-2)+```++### Switching capabilities mid-session++You can freely switch capabilities within a session — DeepTutor keeps the conversation context. A common pattern:++```text+You> /cap deep_research+You> /config set mode=report+You> /config set depth=standard+You> Survey recent papers on RAG (2024–2026)+[long research turn]++You> /cap chat+You> Now write a 3-paragraph summary suitable for a non-technical audience++You> /cap deep_question+You> /config set num_questions 5+You> Generate quiz questions about those papers+```++All three turns share the same memory and reference each other automatically.++### Saving the session log++Sessions are stored in the shared session database. To export a clean markdown transcript:++```bash+deeptutor session show sess_abc123 --format json | \+ jq -r '.messages[] | "**" + .role + "**: " + .content + "\n"' > transcript.md+```++### Going from REPL → notebook++Like a turn? Save it to a notebook:++```bash+# In the REPL+You> /quit++# Then from shell, capture the assistant's last message+deeptutor session show sess_abc123 --format json | \+ jq -r '.messages[-1].content' > my-answer.md++deeptutor notebook add-md my-notes my-answer.md --title "Chain rule explanation"+```++## See also++- [**Commands**](/docs/cli/commands/) — full reference for `run`, `kb`, `bot`, etc.+- [**Agent handoff**](/docs/cli/agent-handoff/) — letting an agent do this for youdiff --git a/site/src/content/docs/docs/cli/commands.md b/site/src/content/docs/docs/cli/commands.mdnew file mode 100644index 000000000..4b9909927--- /dev/null+++ b/site/src/content/docs/docs/cli/commands.md@@ -0,0 +1,464 @@+---+title: Command Reference+description: Every deeptutor command — flags, output schemas, examples.+---++This page documents every `deeptutor` subcommand and flag. For interactive REPL usage, see [**Interactive REPL**](/docs/cli/chat-repl/). For automation patterns, see [**Agent handoff**](/docs/cli/agent-handoff/).++## `deeptutor run` — single-turn capability execution++Run one capability turn and exit. The fundamental "do-something" command for agents and scripting.++```bash+deeptutor run <capability> "<message>" [options]+```++### Flags++| Flag | Type | Default | What it does |+|------|------|---------|--------------|+| `--session <id>` | string | *(new)* | Resume an existing session |+| `-t / --tool <name>` | repeatable | `[]` | Enable a tool (e.g., `rag`, `web_search`, `code_execution`, `reason`) |+| `--kb <name>` | repeatable | `[]` | Attach a Knowledge Base |+| `--notebook-ref <id[:record,...]>` | repeatable | `[]` | Attach notebook records |+| `--history-ref <session_id>` | repeatable | `[]` | Reference a prior session |+| `-l / --language <code>` | string | `en` | Response language |+| `--config <key=value>` | repeatable | `[]` | Per-capability config override |+| `--config-json <json>` | string | — | Base config as JSON; repeated `--config key=value` flags override matching keys |+| `-f / --format <rich\|json>` | enum | `rich` | Output mode |++### Examples++```bash+# Simple chat turn+deeptutor run chat "Explain quantum entanglement in plain English"++# Deep Solve with reasoning + RAG against a KB+deeptutor run deep_solve "Find d/dx [sin(x²)]" --tool reason --tool rag --kb math++# Generate 5 quiz questions+deeptutor run deep_question "Linear algebra eigenvectors" \+ --config num_questions=5 --config difficulty=hard++# Deep Research, JSON stream+deeptutor run deep_research "What's new in retrieval-augmented generation?" \+ --tool web_search --tool rag --kb papers \+ --config mode=report --config depth=standard \+ --format json++# Resume a session+deeptutor run chat "Continue from where we left off" --session sess_abc123+```++### Output — `--format rich` (default)++Rich-formatted Markdown rendering, one stage at a time. Sample:++```text+▶ retrieving+ ● rag_search(query="chain rule")+ │ Chain rule: d/dx[f(g(x))] = f'(g(x)) · g'(x)+ └ #1 rag — +5 more lines; run /show 1 to expand++▶ reasoning+ [dim]Applying chain rule with u = x², du/dx = 2x[/]+ [dim]d/dx[sin(u)] = cos(u) · du/dx[/]++▶ formulating++The derivative of sin(x²) is:++**2x · cos(x²)**++[dim]session=sess_abc123 turn=turn_xyz789 capability=deep_solve[/]+```++### Output — `--format json`++One JSON object per line. Useful for piping into other tools:++```text+{"type": "stage_start", "stage": "retrieving"}+{"type": "tool_call", "content": "rag_search", "metadata": {"args": {"query": "chain rule"}}}+{"type": "tool_result", "content": "Chain rule: ...", "metadata": {"tool": "rag"}}+{"type": "stage_end", "stage": "retrieving"}+{"type": "stage_start", "stage": "reasoning"}+{"type": "thinking", "content": "Applying chain rule..."}+{"type": "stage_end", "stage": "reasoning"}+{"type": "stage_start", "stage": "formulating"}+{"type": "content", "content": "The derivative of sin(x²) is **2x · cos(x²)**"}+{"type": "stage_end", "stage": "formulating"}+{"type": "done", "metadata": {"session_id": "sess_abc123", "turn_id": "turn_xyz789"}}+```++Event types: `stage_start`, `stage_end`, `content`, `thinking`, `progress`, `tool_call`, `tool_result`, `error`, `done`.++## `deeptutor chat` — interactive REPL++Drop into an interactive chat session with `/slash` commands for in-session configuration.++```bash+deeptutor chat [options]+```++Options mirror the turn-shaping flags from `run`: `--session`, `--tool`, `--capability`, `--kb`, `--notebook-ref`, `--history-ref`, `--language`, `--config`, and `--config-json`. Full walkthrough at [**Interactive REPL**](/docs/cli/chat-repl/).++## `deeptutor init` — guided setup wizard++```bash+deeptutor init # Full setup (asks ports + LLM + embedding + search)+deeptutor init --cli # CLI-only (skips port questions)+deeptutor init --home /path # Use a non-default workspace+```++See [**Get Started**](/docs/get-started/) for the full walkthrough.++## `deeptutor start` / `deeptutor serve`++```bash+# Launch both backend + frontend (blocking; Ctrl+C stops both)+deeptutor start+deeptutor start --home /path++# Backend only+deeptutor serve --host 0.0.0.0 --port 8001+deeptutor serve --reload # Hot reload on file changes (dev only)+```++## `deeptutor kb` — Knowledge Base management++### `kb list`++```bash+deeptutor kb list # Rich table+deeptutor kb list --format json+```++JSON output:++```json+[+ {+ "name": "physics",+ "status": "ready",+ "documents": 12,+ "rag_provider": "llamaindex",+ "is_default": true+ },+ {+ "name": "math",+ "status": "indexing",+ "documents": 4,+ "rag_provider": "llamaindex",+ "is_default": false+ }+]+```++### `kb info <name>`++```bash+deeptutor kb info physics+```++Returns the KB's metadata, document list, statistics, and indexing state.++### `kb create <name>`++```bash+# Single document+deeptutor kb create physics --doc chapter1.pdf++# Multiple documents+deeptutor kb create physics --doc chapter1.pdf --doc chapter2.pdf --doc exercises.docx++# Entire directory+deeptutor kb create textbooks --docs-dir ./my-pdfs+```++Supported formats: PDF, DOCX, XLSX, PPTX, TXT, MD, HTML.++### `kb add <name>`++Incrementally add documents to an existing KB:++```bash+deeptutor kb add physics --doc chapter3.pdf+```++### `kb delete <name>`++```bash+deeptutor kb delete physics # Asks for confirmation+deeptutor kb delete physics --force # Skip confirmation+```++### `kb set-default <name>`++```bash+deeptutor kb set-default physics+```++The default KB is what `deeptutor chat` and the Web UI attach automatically when none is specified.++### `kb search <name> <query>`++```bash+deeptutor kb search physics "What is angular momentum?"+deeptutor kb search physics "..." --mode hybrid --format json+```++Modes: `hybrid` (default; semantic + keyword), `vector` (semantic only), `keyword` (BM25).++### Re-indexing++Re-indexing isn't a CLI command — it's done from the **Web UI** (Knowledge → pick KB → **Index versions** tab → **Re-index now**). Useful after changing embedding models.++## `deeptutor session` — session inspection++### `session list`++```bash+deeptutor session list --limit 20+```++### `session show <id>`++```bash+deeptutor session show sess_abc123 # Rich+deeptutor session show sess_abc123 --format json # Full JSON+```++JSON output (truncated):++```json+{+ "id": "sess_abc123",+ "title": "Chain rule explanation",+ "capability": "chat",+ "status": "completed",+ "messages": [+ {"role": "user", "content": "..."},+ {"role": "assistant", "content": "..."}+ ],+ "preferences": {+ "tools": ["rag", "reason"],+ "knowledge_bases": ["math"],+ "language": "en"+ },+ "created_at": "2026-05-21T14:23:01Z",+ "updated_at": "2026-05-21T14:24:38Z"+}+```++### `session open <id>` / `session delete <id>` / `session rename <id> --title <title>`++```bash+deeptutor session open sess_abc123 # Resume in REPL+deeptutor session rename sess_abc123 --title "Calculus review"+deeptutor session delete sess_abc123+```++## `deeptutor notebook` — notebook records++```bash+# Create a notebook+deeptutor notebook create research-notes --description "Daily reading log"++# Add a markdown record+deeptutor notebook add-md research-notes paper-summary.md \+ --title "Attention is all you need" --type research++# Replace a record's content+deeptutor notebook replace-md research-notes rec_abc123 updated-summary.md++# Remove a record+deeptutor notebook remove-record research-notes rec_abc123++# Inspect+deeptutor notebook list+deeptutor notebook show research-notes+```++Record types: `chat`, `question`, `research`, `solve`.++## `deeptutor memory` — three-layer memory++DeepTutor stores user memory in three layers (see [**Memory**](/docs/explore/memory/) for the deep dive):++- **L1** — raw event trace per surface (chat, notebook, quiz, etc.)+- **L2** — per-surface curated markdown summaries+- **L3** — cross-surface profile (recent, profile, scope, preferences)++### `memory show [target]`++```bash+deeptutor memory show # Default: L3 concatenated+deeptutor memory show L3+deeptutor memory show L2 # List all L2 surfaces+deeptutor memory show profile # A specific L3 doc+deeptutor memory show chat # A specific L2 surface doc+```++### `memory clear [target]`++```bash+deeptutor memory clear all --force # ⚠️ wipes L1+L2+L3+deeptutor memory clear trace # Only L1+deeptutor memory clear chat # Only L1 trace for the chat surface+```++### Forcing a consolidation pass++Manual consolidation isn't a CLI command — fire it from the **Memory Workbench** in the Web UI (`/memory` → **Run consolidator**), or from the HTTP API:++```bash+curl -X POST http://localhost:8001/api/v1/memory/runs/start+```++## `deeptutor bot` — TutorBot lifecycle++```bash+deeptutor bot list++deeptutor bot create my-bot \+ --name "Math Mentor" \+ --persona "Socratic tutor specializing in algebra and calculus" \+ --model gpt-4o++# `create` starts the bot immediately. Use start later if it was stopped.+deeptutor bot stop my-bot+```++Subcommands: `list`, `create`, `start`, `stop`. `create` writes the bot config and starts it in one step. Delete a bot by removing its workspace directory at `data/tutorbot/<bot_id>/` while it's stopped.++Channel configs (Telegram, Slack, etc.) live in the bot's YAML under `data/tutorbot/<bot_id>/`. See [**Explore TutorBot**](/docs/tutorbot/) for per-channel setup.++## `deeptutor config show`++```bash+deeptutor config show+```++Sample output:++```json+{+ "ports": {+ "backend": 8001,+ "frontend": 3782+ },+ "llm": {+ "provider": "openai",+ "model": "gpt-4o",+ "base_url": "https://api.openai.com/v1",+ "api_key": "***"+ },+ "embedding": {+ "status": "configured",+ "provider": "openai",+ "model": "text-embedding-3-large",+ "dimension": 3072,+ "api_key": "***"+ },+ "search": {+ "provider": "tavily",+ "status": "enabled",+ "api_key": "***"+ },+ "language": "en",+ "tools": ["rag", "web_search", "code_execution", "reason"]+}+```++Secrets are masked with `***`.++## `deeptutor plugin` — registry inspection++```bash+deeptutor plugin list # All capabilities + tools+deeptutor plugin info deep_solve # Single capability+deeptutor plugin info rag # Single tool+```++`plugin info <capability>` returns:++```json+{+ "name": "deep_solve",+ "description": "Multi-step agentic problem-solving",+ "cli_aliases": ["solve"],+ "stages": ["planning", "reasoning", "writing"],+ "tools_used": ["rag", "web_search", "code_execution", "reason"],+ "config_defaults": {+ "max_steps": 8+ },+ "availability": {+ "available": true,+ "install_hint": ""+ }+}+```++## `deeptutor provider` — auth flows++For providers that use OAuth or special token flows:++```bash+deeptutor provider login openai-codex # OAuth via oauth-cli-kit+deeptutor provider login github-copilot # GitHub auth validation+```++## `deeptutor book` — Knowledge Books (Guided Learning)++```bash+deeptutor book list++# Health-check a book (KB drift + log staleness)+deeptutor book health book_abc123++# Re-snapshot fingerprints to clear "stale page" warnings+deeptutor book refresh-fingerprints book_abc123+```++Books are the storage layer for **Guided Learning** journeys. See [**Book Engine**](/docs/explore/book/).++## Common output schemas++### TurnRequest (what `run` sends internally)++```python+@dataclass(slots=True)+class TurnRequest:+ content: str+ capability: str = "chat"+ session_id: str | None = None+ tools: list[str] = field(default_factory=list)+ knowledge_bases: list[str] = field(default_factory=list)+ language: str = "en"+ config: dict[str, Any] = field(default_factory=dict)+ notebook_references: list[dict[str, Any]] = field(default_factory=list)+ history_references: list[str] = field(default_factory=list)+ attachments: list[dict[str, Any]] = field(default_factory=list)+ skills: list[str] = field(default_factory=list)+```++### Stream event types++| Event | When | Fields |+|-------|------|--------|+| `stage_start` | A pipeline stage begins | `stage`, `metadata` |+| `stage_end` | Stage finishes | `stage` |+| `content` | User-facing markdown chunk | `content` |+| `thinking` | Intermediate reasoning | `content` |+| `progress` | Status update | `content` |+| `tool_call` | A tool is being invoked | `content` (tool name), `metadata.args` |+| `tool_result` | A tool returned | `content`, `metadata.tool` |+| `error` | Something went wrong | `content` |+| `done` | Turn complete | `metadata.session_id`, `metadata.turn_id` |++## See also++- [**Interactive REPL**](/docs/cli/chat-repl/) — using `deeptutor chat` day-to-day+- [**Agent handoff**](/docs/cli/agent-handoff/) — letting Claude Code / Codex drive the CLI+- [**Server API**](/docs/cli/server-api/) — the HTTP / WebSocket surface from `deeptutor serve`diff --git a/site/src/content/docs/docs/cli/index.md b/site/src/content/docs/docs/cli/index.mdnew file mode 100644index 000000000..cdde8c077--- /dev/null+++ b/site/src/content/docs/docs/cli/index.md@@ -0,0 +1,144 @@+---+title: DeepTutor CLI+description: Drive every DeepTutor capability from the terminal — interactive REPL, single-turn execution, agent handoff.+---++DeepTutor is built around an **agent-native CLI**: core runtime surfaces have terminal mirrors, turn execution can stream JSON for machine consumers, and the supported automation surface is documented in a single skill file that AI agents can read and drive autonomously. Some browser-first workflows (for example rich Co-Writer editing and Memory Workbench review) still live in the Web UI or HTTP API.++This section covers:++- [**Commands**](/docs/cli/commands/) — every top-level command and subcommand group with flags, schemas, and examples+- [**Interactive REPL**](/docs/cli/chat-repl/) — drive a long chat session with `/slash` commands inline+- [**Agent handoff**](/docs/cli/agent-handoff/) — let Claude Code, Codex, OpenCode, or Hermes drive `deeptutor` for you+- [**Server API**](/docs/cli/server-api/) — the HTTP / WebSocket surface that `deeptutor serve` exposes++## Quick tour++```bash+# Install (one of the paths from Get Started)+pip install deeptutor++# Configure+deeptutor init++# Interactive chat+deeptutor chat++# Single-turn, agent-style+deeptutor run deep_solve "Find the derivative of sin(x²)" --tool reason --format json++# Manage knowledge bases+deeptutor kb create physics --doc chapter1.pdf+deeptutor kb search physics "What is angular momentum?"++# Run a TutorBot+deeptutor bot create my-bot --persona "Socratic math tutor"++# Inspect three-layer memory+deeptutor memory show L3+```++## Why CLI-first?++The terminal experience is **the same experience an AI agent gets**. When you write a turn in `deeptutor chat`, the underlying turn schema (`TurnRequest`) is identical to what Claude Code or Codex would send if you handed them `SKILL.md`.++This means:++- Core learning flows can be driven from the terminal; browser-only editing and admin screens expose their state through the Web UI / API+- `deeptutor run --format json` emits one JSON event per line; data-inspection commands such as `kb list`, `kb search`, `session show`, and `notebook show` also expose JSON where implemented+- Sessions persist across turns — you can switch between Web, REPL, and one-shot `run` calls and resume where you left off+- The CLI is the best automation entry point for turns, KBs, sessions, notebooks, memory, TutorBots, config inspection, plugins, providers, and Books++## Top-level command map++| Group | What it does | Most-used |+|-------|--------------|-----------|+| `deeptutor init` | Guided setup wizard | `deeptutor init --cli` |+| `deeptutor start` | Launch backend + frontend together | `deeptutor start` |+| `deeptutor serve` | Backend only (FastAPI on `:8001`) | `deeptutor serve --host 0.0.0.0` |+| `deeptutor chat` | Interactive REPL | `deeptutor chat --kb physics` |+| `deeptutor run` | One-shot capability turn | `deeptutor run deep_solve "..."` |+| `deeptutor kb` | Knowledge Base management | `deeptutor kb create / list / search` |+| `deeptutor session` | Session inspection | `deeptutor session list / show <id>` |+| `deeptutor notebook` | Notebook records | `deeptutor notebook create / add-md` |+| `deeptutor memory` | Three-layer memory store | `deeptutor memory show L3` |+| `deeptutor bot` | TutorBot lifecycle | `deeptutor bot create / start / stop` (`create` starts the bot immediately) |+| `deeptutor config` | View runtime configuration | `deeptutor config show` |+| `deeptutor plugin` | Capability / tool registry | `deeptutor plugin list` |+| `deeptutor provider` | Provider auth flows | `deeptutor provider login openai-codex` |+| `deeptutor book` | Knowledge Books (Guided Learning) | `deeptutor book list / health` |++See [**Commands**](/docs/cli/commands/) for the full reference.++## Two modes of use++### Mode 1 — Interactive++For exploratory, multi-turn work, drop into the REPL:++```text+$ deeptutor chat --kb physics+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓+┃ DeepTutor CLI ┃+┃ Type a message. /quit /tool /cap /kb /history /show /refs ┃+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛+[dim]session=(new) capability=chat tools=[] kb=[physics] history=[] notebook_refs=[] language=en config={}[/]+You> Explain the chain rule with a worked example+```++Full guide: [**Interactive REPL**](/docs/cli/chat-repl/).++### Mode 2 — Agent-style one-shot++For automation, CI, or AI-agent harnesses, use `deeptutor run`:++```bash+deeptutor run deep_solve "Find the eigenvalues of [[4,1],[2,3]]" \+ --tool reason --tool code_execution \+ --format json | jq -r '.content // empty'+```++Each JSON line is one event — `stage_start`, `content`, `tool_call`, `tool_result`, `thinking`, `done`. You can pipe these into a downstream agent or extract the final answer with `jq`.++Full guide: [**Agent handoff**](/docs/cli/agent-handoff/).++## Where state lives++Every CLI command operates against the same workspace as the Web UI. By default, runtime data lives under `data/` in the directory where you launch DeepTutor. Override the workspace root with `DEEPTUTOR_HOME=/path`, `deeptutor init --home /path`, or `deeptutor start --home /path`.++## Help is always one flag away++Every command supports `--help`:++```text+$ deeptutor --help++ Usage: deeptutor [OPTIONS] COMMAND [ARGS]...++ DeepTutor — agent-native, open-source personalized tutoring.++╭─ Commands ───────────────────────────────────────────────────────────────────╮+│ init Guided setup wizard. │+│ start Launch backend + frontend together. │+│ serve Backend only. │+│ chat Interactive REPL. │+│ run One-shot capability turn. │+│ kb Knowledge base management. │+│ session Session inspection. │+│ notebook Notebook records. │+│ memory Three-layer memory store. │+│ bot TutorBot lifecycle. │+│ config View runtime configuration. │+│ plugin Capability / tool registry. │+│ provider Provider auth flows. │+│ book Knowledge Books (Guided Learning). │+╰──────────────────────────────────────────────────────────────────────────────╯+```++And every subcommand:++```text+$ deeptutor run --help+$ deeptutor kb create --help+$ deeptutor bot start --help+```diff --git a/site/src/content/docs/docs/cli/server-api.md b/site/src/content/docs/docs/cli/server-api.mdnew file mode 100644index 000000000..8a3cfe5da--- /dev/null+++ b/site/src/content/docs/docs/cli/server-api.md@@ -0,0 +1,254 @@+---+title: Server API+description: The HTTP and WebSocket surface exposed by deeptutor serve -- for custom frontends and integrations.+---++`deeptutor serve` exposes a FastAPI backend at `http://localhost:8001/` unless you configured a different backend port. This page gives the high-signal map for custom frontends, mobile apps, and service-to-service integrations.++For the exhaustive, always-current schema, start the server and open:++```text+GET /openapi.json # Full OpenAPI 3.1 spec+GET /docs # Interactive Swagger UI+GET /redoc # Alternative ReDoc UI+```++## Starting the server++```bash+# Backend only. Port comes from data/user/settings/system.json, default 8001.+deeptutor serve++# Custom host/port for this process+deeptutor serve --host 127.0.0.1 --port 18001++# Development: hot reload on Python file changes+deeptutor serve --reload+```++## Authentication++If auth is enabled in `data/user/settings/auth.json`, every endpoint except `/api/v1/auth/*` requires a valid JWT in the `Authorization: Bearer <token>` header or a session cookie.++```bash+# Login+curl -X POST http://localhost:8001/api/v1/auth/login \+ -H "Content-Type: application/json" \+ -d '{"username":"alice","password":"..."}'++# Response includes an access_token.++# Use the token+curl http://localhost:8001/api/v1/sessions \+ -H "Authorization: Bearer eyJ..."+```++If auth is disabled, auth dependencies are no-ops and local single-user requests do not need a token.++## Turn execution WebSocket++```text+WS /api/v1/ws+```++This is the unified turn WebSocket used by the Web UI. It supports every capability uniformly and streams the same event family that `deeptutor run --format json` prints.++Start a turn by sending a `type: "start_turn"` or `type: "message"` payload:++```json+{+ "type": "start_turn",+ "content": "Find d/dx [sin(x^2)]",+ "capability": "deep_solve",+ "session_id": null,+ "tools": ["rag", "reason"],+ "knowledge_bases": ["math"],+ "language": "en",+ "config": {"max_steps": 6},+ "notebook_references": [],+ "history_references": [],+ "attachments": [],+ "skills": []+}+```++Other supported client message types include `subscribe_turn`, `subscribe_session`, `resume_from`, `unsubscribe`, `cancel_turn`, `submit_user_reply`, `regenerate`, and `ping`.++Typical received events:++```json+{"type":"stage_start","stage":"retrieving"}+{"type":"tool_call","content":"rag_search","metadata":{"args":{"query":"chain rule"}}}+{"type":"tool_result","content":"...","metadata":{"tool":"rag"}}+{"type":"stage_end","stage":"retrieving"}+{"type":"content","content":"## Solution\n\nThe derivative..."}+{"type":"done","metadata":{"session_id":"sess_abc123","turn_id":"turn_xyz789"}}+```++## Legacy chat WebSocket++```text+WS /api/v1/chat+```++This legacy endpoint is still present for simple chat clients. Prefer `/api/v1/ws` for new integrations because it supports all capabilities, replay, cancellation, regeneration, and `ask_user` replies.++## Sessions++```text+GET /api/v1/sessions List sessions+GET /api/v1/sessions/{session_id} Get a session + messages+PATCH /api/v1/sessions/{session_id} Rename (body: {"title":"..."})+DELETE /api/v1/sessions/{session_id} Delete+PUT /api/v1/sessions/{session_id}/branch-selection+DELETE /api/v1/sessions/{session_id}/messages/{message_id}+POST /api/v1/sessions/{session_id}/quiz-results+```++Legacy chat-session aliases also exist:++```text+GET /api/v1/chat/sessions+GET /api/v1/chat/sessions/{session_id}+DELETE /api/v1/chat/sessions/{session_id}+```++## Knowledge Bases++```text+GET /api/v1/knowledge/list List KBs+GET /api/v1/knowledge/{kb_name} KB info+DELETE /api/v1/knowledge/{kb_name} Delete+POST /api/v1/knowledge/create Create a KB+POST /api/v1/knowledge/{kb_name}/upload Add documents+POST /api/v1/knowledge/{kb_name}/reindex Re-embed docs+GET /api/v1/knowledge/default Get default KB+PUT /api/v1/knowledge/default/{kb_name} Set default KB+GET /api/v1/knowledge/supported-file-types Supported uploads+GET /api/v1/knowledge/{kb_name}/files List source files+GET /api/v1/knowledge/{kb_name}/progress Indexing progress+WS /api/v1/knowledge/{kb_name}/progress/ws Progress stream+```++Ad-hoc KB search is exposed through the RAG runtime/tool path rather than a dedicated `POST /knowledge/{name}/search` route in the current API. From CLI, use `deeptutor kb search <name> <query>`.++## Notebook++```text+GET /api/v1/notebook/list+GET /api/v1/notebook/statistics+POST /api/v1/notebook/create+GET /api/v1/notebook/{notebook_id}+PUT /api/v1/notebook/{notebook_id}+DELETE /api/v1/notebook/{notebook_id}+POST /api/v1/notebook/add_record+POST /api/v1/notebook/add_record_with_summary+DELETE /api/v1/notebook/{notebook_id}/records/{record_id}+PUT /api/v1/notebook/{notebook_id}/records/{record_id}+```++## Memory++```text+GET /api/v1/memory/overview+GET /api/v1/memory/doc/{layer}/{key}+PUT /api/v1/memory/doc/{layer}/{key}+POST /api/v1/memory/doc/{layer}/{key}/reset+POST /api/v1/memory/doc/{layer}/{key}/update+POST /api/v1/memory/doc/{layer}/{key}/audit+POST /api/v1/memory/doc/{layer}/{key}/dedup+POST /api/v1/memory/runs/start+GET /api/v1/memory/runs+GET /api/v1/memory/runs/{run_id}+GET /api/v1/memory/runs/{run_id}/events+POST /api/v1/memory/runs/{run_id}/cancel+POST /api/v1/memory/runs/{run_id}/undo+GET /api/v1/memory/trace/{surface}+DELETE /api/v1/memory/trace/{surface}+GET /api/v1/memory/settings+PUT /api/v1/memory/settings+```++Layers are `L2` and `L3`; examples: `/api/v1/memory/doc/L3/profile` and `/api/v1/memory/doc/L2/chat`.++## Settings, tools, plugins, and system++```text+GET /api/v1/settings+GET /api/v1/settings/catalog+PUT /api/v1/settings/catalog+POST /api/v1/settings/apply+PUT /api/v1/settings/enabled-tools+GET /api/v1/tools+GET /api/v1/plugins/list+POST /api/v1/plugins/tools/{tool_name}/execute+POST /api/v1/plugins/tools/{tool_name}/execute-stream+POST /api/v1/plugins/capabilities/{capability_name}/execute-stream+GET /api/v1/system/status+GET /api/v1/system/runtime-topology+POST /api/v1/system/test/llm+POST /api/v1/system/test/embeddings+POST /api/v1/system/test/search+```++Provider profiles are edited through the catalog endpoints; there are not separate `/settings/llm` or `/settings/embedding` routes in the current API.++## TutorBot Manager++```text+GET /api/v1/tutorbot+POST /api/v1/tutorbot+GET /api/v1/tutorbot/recent+GET /api/v1/tutorbot/channels/schema+GET /api/v1/tutorbot/{bot_id}+PATCH /api/v1/tutorbot/{bot_id}+DELETE /api/v1/tutorbot/{bot_id}+DELETE /api/v1/tutorbot/{bot_id}/destroy+GET /api/v1/tutorbot/{bot_id}/files+PUT /api/v1/tutorbot/{bot_id}/files/{filename}+GET /api/v1/tutorbot/{bot_id}/history+WS /api/v1/tutorbot/{bot_id}/ws+```++## Book Engine++```text+GET /api/v1/book/books+POST /api/v1/book/books+GET /api/v1/book/books/{book_id}+GET /api/v1/book/books/{book_id}/spine+GET /api/v1/book/books/{book_id}/pages/{page_id}+DELETE /api/v1/book/books/{book_id}+POST /api/v1/book/books/confirm-proposal+POST /api/v1/book/books/confirm-spine+POST /api/v1/book/books/compile-page+POST /api/v1/book/books/{book_id}/refresh-fingerprints+WS /api/v1/book/ws+```++## Outputs and attachments++User-generated artifacts are served from a read-only static mount:++```text+GET /api/outputs/<path>+```++Only paths whitelisted via `SafeOutputStaticFiles` are accessible; directory traversal is blocked. Original chat attachments are served under:++```text+GET /api/attachments/{session_id}/{attachment_id}/{filename}+```++## Generate a typed client++```bash+curl http://localhost:8001/openapi.json > deeptutor.openapi.json++# TypeScript client+npx openapi-typescript deeptutor.openapi.json -o deeptutor.d.ts++# Python client+pip install openapi-python-client+openapi-python-client generate --path deeptutor.openapi.json+```diff --git a/site/src/content/docs/docs/contributing.md b/site/src/content/docs/docs/contributing.mdnew file mode 100644index 000000000..ff6187786--- /dev/null+++ b/site/src/content/docs/docs/contributing.md@@ -0,0 +1,95 @@+---+title: Contributing+description: How to contribute code, docs, or bug fixes to DeepTutor — branching, setup, and the PR checklist.+---++Thanks for your interest in contributing to DeepTutor. This page is the short version; the canonical document is [`CONTRIBUTING.md`](https://github.com/HKUDS/DeepTutor/blob/main/CONTRIBUTING.md) at the repo root.++## Roadmap++DeepTutor's roadmap is tracked in the open at [`HKUDS/DeepTutor#498`](https://github.com/HKUDS/DeepTutor/issues/498). Use that issue to see what is planned, vote on priorities, or propose new work before starting a larger contribution.++## Where to target your PR++DeepTutor uses a multi-branch model. **Do not open PRs against `main`.**++| Branch | Use for |+|--------|---------|+| `dev` | Default target — features, refactors, bug fixes, API/config changes |+| `multi-user` | Multi-tenant / session-isolation / shared-workspace work only |++When in doubt, target `dev`.++## Quick start++```bash+# 1. Fork and clone, then sync with the target branch+git checkout dev && git pull origin dev++# 2. Branch off+git checkout -b feature/your-feature-name++# 3. Install in editable mode with everything+pip install -e ".[all]"++# 4. Wire up pre-commit (once per machine)+pip install pre-commit+pre-commit install++# 5. Make your changes, then validate locally+pre-commit run --all-files++# 6. Open the PR against dev (or multi-user)+```++Browse [`good first issue`](https://github.com/HKUDS/DeepTutor/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) labels for an entry point. Comment on the issue first so others know you're on it.++## Coding standards++We enforce these in CI; running `pre-commit run --all-files` catches the common ones locally.++| Area | Rule |+|------|------|+| Python | Type hints on all signatures; PEP 8 (Ruff); f-strings; small focused functions |+| Docstrings | Google-style for new modules, classes, and public functions |+| Secrets | Never commit; `detect-secrets` runs on every PR |+| Subprocesses | Always `shell=False` |+| Paths | `pathlib.Path` over string concatenation |++Tooling under the hood: **Ruff** (lint + format), **Prettier** (frontend / config), **detect-secrets**, **pip-audit**, **Bandit**, **MyPy**, **Interrogate**.++## Commit messages++```+<type>: <short description>++[optional body]+```++| Type | When |+|------|------|+| `feat` | New feature (MINOR bump) |+| `fix` | Bug fix (PATCH bump) |+| `docs` | Documentation only |+| `style` | Formatting, no logic |+| `refactor` | Restructuring, no behavior change |+| `test` | Adding or correcting tests |+| `chore` | Build / tooling / deps |++## What gets reviewed++- **Correctness** — does it solve the stated problem and not introduce regressions?+- **Scope** — small focused changes get merged faster than sprawling ones; split when in doubt.+- **Tests** — new behavior needs new coverage; bug fixes need a regression test where reasonable.+- **Docs** — user-facing changes update the relevant page in `site/src/content/docs/`.++## Help++- [Discord](https://discord.gg/eRsjPgMU4t) — fastest place to ask+- [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — long-form Q&A+- [WeChat community](https://github.com/HKUDS/DeepTutor/issues/78) — Chinese-speaking contributors+- [Issues](https://github.com/HKUDS/DeepTutor/issues) — bug reports and feature requests++## See also++- [`CONTRIBUTING.md`](https://github.com/HKUDS/DeepTutor/blob/main/CONTRIBUTING.md) — full document (branching policy, security practices, maintainer)diff --git a/site/src/content/docs/docs/explore/book.md b/site/src/content/docs/docs/explore/book.mdnew file mode 100644index 000000000..eb675bcd1--- /dev/null+++ b/site/src/content/docs/docs/explore/book.md@@ -0,0 +1,93 @@+---+title: Book Engine+description: A multi-agent pipeline that compiles your materials into interactive "living books" with 13 block types.+---++Give DeepTutor a topic, point it at your knowledge base, and **Book Engine** produces a structured, interactive book — not a static export, but a living document you can read, quiz yourself on, and discuss in context.++## How it works++Behind the scenes, a multi-agent pipeline handles the heavy lifting:++1. **Outline proposal** — given your topic + KB, propose chapter structure+2. **Source retrieval** — pull relevant passages from the KB+3. **Chapter tree synthesis** — assemble a hierarchical chapter outline+4. **Page planning** — for each page, plan which blocks go where+5. **Block compilation** — generate each block (text, quiz, code, figure, …)++You stay in control: review the proposal, reorder chapters, and chat alongside any page.++## The 13 block types++Pages are assembled from 13 block types, each rendered with its own interactive component:++| Block | What it is |+|-------|-----------|+| **Text** | Standard prose paragraphs |+| **Callout** | Tip / Warning / Note / Important — colored sidebar boxes |+| **Quiz** | Inline interactive question; answers checked against an expected response |+| **Flash cards** | Front / back flipping cards for spaced repetition |+| **Code** | Syntax-highlighted snippet with optional executable runtime |+| **Figure** | Image with caption + alt text |+| **Deep dive** | Collapsible section for advanced / optional material |+| **Animation** | Manim-rendered video |+| **Interactive demo** | Embedded interactive HTML (including a **GeoGebra viewer** for math) |+| **Timeline** | Vertical event timeline |+| **Concept graph** | Mini knowledge graph showing relationships between concepts |+| **Section** | A grouping container for nested blocks |+| **User note** | Editable rich-text area for the reader's own notes |++## KB fingerprinting and drift detection++Book pages are **fingerprinted against their source KB**. When source documents change:++- `deeptutor book health <book_id>` reports drift (which pages are stale)+- `deeptutor book refresh-fingerprints <book_id>` clears stale-page flags when you've acknowledged the changes++This makes it safe to use Book Engine on KBs that evolve — you'll know when a page is no longer in sync.++## Working with a book++In the Web UI:++1. Navigate to **Book** in the left sidebar+2. **+ New book** → pick a topic, attach a KB+3. Review and edit the proposed outline+4. Confirm — the pipeline compiles each page+5. Open a page to read, quiz yourself, or chat alongside++## From the CLI++```bash+deeptutor book list # all books in the workspace+deeptutor book health <book_id> # KB drift report+deeptutor book refresh-fingerprints <book_id> # mark stale pages as acknowledged+```++JSON output for health:++```json+{+ "kb_drift": {+ "kb_name": "physics",+ "stale_pages": ["page_abc", "page_def"],+ "drift_ratio": 0.12+ },+ "log_health": {+ "last_compile": "2026-05-20T14:23:01Z",+ "errors": []+ }+}+```++## Pairs well with++- **Knowledge** — A book is only as good as its KB. Start there.+- **Chat alongside the page** — Each page has its own chat composer pinned to it; ask follow-ups grounded in the page content.+- **Notebooks** — Save chat takeaways from book reading into a notebook for later review.++## See also++- [**Knowledge**](/docs/explore/knowledge/) — build the KB that backs a book+- [**Space → Notebooks**](/docs/explore/space/) — save book discussions+- [**CLI → book commands**](/docs/cli/commands/)diff --git a/site/src/content/docs/docs/explore/chat-workspace.md b/site/src/content/docs/docs/explore/chat-workspace.mdnew file mode 100644index 000000000..9f2e49791--- /dev/null+++ b/site/src/content/docs/docs/explore/chat-workspace.md@@ -0,0 +1,162 @@+---+title: Chat Workspace+description: One thread, five modes, any tool. The unified intelligent workspace at the heart of DeepTutor.+---++The Chat Workspace is where most users spend their time. It's a single conversation surface that hosts **five modes** sharing one session, knowledge base, attachments, and references.++Switch mid-thread from a casual question into multi-agent solving, into a quiz, into a full research report — without losing context.++++## Anatomy of the screen++| Region | What it does |+|--------|--------------|+| **Left sidebar** | Navigation across all surfaces; chat history at the top |+| **Top toolbar** | Save current turn to a Notebook, download as Markdown, start a new chat, open Activity / Viewer side panels |+| **Composer** (center) | Where you type — mode selector, attach, Knowledge picker, Space picker, model selector |+| **Activity panel** *(right, toggle)* | Real-time stream of pipeline stages, tool calls, timings |+| **Viewer panel** *(right, toggle)* | Renders generated artifacts: SVG, Mermaid, Chart.js, HTML, Manim video |++## The five modes++The capability picker is in the composer. Switch any time — the conversation context persists.++### Chat++Flexible conversation with any tool. The default mode — covers about 80% of questions.++The chat pipeline runs an **agentic loop**: LLM call → parse protocol labels (THINK / TOOL / FINISH) → dispatch tool calls in parallel → feed results back → iterate until FINISH or context guard.++**Tools available in Chat mode** (composed per-turn based on context):++| Tool | Mounted when… |+|------|---------------|+| `rag` | A KB is attached |+| `read_source` | Any non-image source attached |+| `read_memory` / `write_memory` | Always |+| `web_search` | Toggled in Settings → Tools |+| `web_fetch` | Always |+| `code_execution` | Toggled in Settings |+| `reason` | Toggled in Settings |+| `brainstorm` | Toggled in Settings |+| `paper_search` | Toggled in Settings |+| `geogebra_analysis` | When math image attached |+| `list_notebook` / `write_note` | ≥1 notebook exists |+| `github_query` | Always |+| `ask_user` | Always |++### Solve++Multi-step problem-solving: plan → investigate → solve → verify, with precise source citations. Built on the `deep_solve` agentic engine.++When to use: math problems that need step-by-step work, physics with multiple subproblems, algorithm questions where reasoning should be explicit.++Tools commonly enabled: `rag`, `reason`, `code_execution`, `web_search`.++### Quiz++Auto-validated question generation grounded in your KB. Spawns a follow-up chat composer per question for discussion / hints / grading. Built on the `deep_question` agentic engine.++Three modes inside Quiz:++- **Custom** *(default)* — generate from a topic+- **Mimic** — upload a past exam paper, generate new questions in the same style+- **Followup** — discuss prior quiz questions without generating new ones++Configurable: `num_questions`, `difficulty`, `question_types` (short_answer / mcq / numerical / code), `per_type_counts`.++### Research++Decomposes a topic into subtopics, dispatches **parallel agents** across RAG / web / arXiv, produces a cited report with iterative append-mode revisions.++Flow:++1. **Rephrasing** — restates your question precisely+2. **Decomposing** — proposes a 3–7 sub-topic outline ★ (you confirm / edit here)+3. **Researching** — parallel agentic loops per sub-topic+4. **Reporting** — synthesizes structured Markdown report with citations++The outline confirmation step is the killer UX feature: you steer the research before the expensive work runs.++### Visualize++The unified visualization capability — analyzer picks `render_type` based on intent:++| Render type | Best for | Output |+|-------------|----------|--------|+| `svg` | Static diagrams, icons | Inline SVG |+| `chartjs` | Bar / line / pie / scatter charts | Interactive canvas |+| `mermaid` | Flowcharts, sequence diagrams, state machines | Mermaid SVG |+| `html` | Interactive demos, mini-apps | Sandboxed iframe |+| `manim_video` | Math animations | MP4 (requires `[math-animator]` extra) |+| `manim_image` | Math storyboards | PNG |++> Math Animator is **not a separate capability** — it's just two of Visualize's six render types (`manim_video` / `manim_image`).++## Cumulative source inventory++A session carries citations across turns. RAG / web hits from earlier turns remain reusable later in the same conversation — the model can reference them by index.++## Attachments++Click **Attach** to bring files into the turn:++| Type | Sources |+|------|---------|+| **PDFs, DOCX, XLSX, PPTX** | Direct upload — routed through the appropriate extractor |+| **Images** | Direct upload — vision models OCR / interpret |+| **Notebook records** | Space → Notebooks picker |+| **History sessions** | Space → Chat History picker |+| **Question Bank entries** | Space → Question Bank picker |+| **Book references** | Book Engine pages |++Attachments don't go into the system prompt — they show up as **tool-readable sources**. The model uses `read_source` to load full content when needed.++## Top-right actions++| Button | What it does |+|--------|--------------|+| **Save to Notebook** | Save the current turn as a record in a notebook |+| **Download Markdown** | Export the current turn as `.md` |+| **New chat** | Start a fresh session |+| **Activity** | Real-time stream of pipeline events (stages, tool calls, timings) |+| **Viewer** | Renders generated artifacts (SVG, Mermaid, Chart.js, HTML, Manim) |++## `ask_user` mid-turn++If the model needs clarification, it can call the `ask_user` tool, which **pauses the turn** and renders 1–3 structured questions in the chat. Answer them, click Submit, and the turn resumes with your answers in context.++## Session continuity++Every conversation has a session id. Sessions persist across:++- Browser refreshes / restarts+- Mode switches within the same session+- Web UI ↔ CLI boundary++```bash+# Resume a Web session from CLI+deeptutor chat --session sess_abc123+```++Sessions started in CLI show up in the Web sidebar (and vice versa).++## Memory awareness++The model has built-in access to your L3 memory via the `read_memory` tool. After a few sessions, it knows:++- Your background (`profile.md`)+- Your knowledge scope (`scope.md`)+- Your explicit preferences (`preferences.md`)+- Recent learnings (`recent.md`)++See [**Memory**](/docs/explore/memory/) for the full three-layer architecture.++## See also++- [**Memory**](/docs/explore/memory/) — three-layer persistent memory + Memory Graph+- [**Knowledge**](/docs/explore/knowledge/) — RAG-ready Knowledge Bases+- [**Space**](/docs/explore/space/) — read / review hub+- [**Settings**](/docs/explore/settings/) — providers, tools, capabilitiesdiff --git a/site/src/content/docs/docs/explore/co-writer.md b/site/src/content/docs/docs/explore/co-writer.mdnew file mode 100644index 000000000..25fb160ad--- /dev/null+++ b/site/src/content/docs/docs/explore/co-writer.md@@ -0,0 +1,125 @@+---+title: Co-Writer+description: A Markdown editor where AI is a first-class collaborator — Edit Agent, Narrator Agent, document templates.+---++**Co-Writer** is DeepTutor's Markdown editor designed around AI collaboration. It has two integrated AI agents:++- **Edit Agent** — refines selected text (rewrite, expand, condense, change tone)+- **Narrator Agent** — generates new content (continue writing, fill outline, explain concept)++Plus document templates, version history, and integration with Knowledge Bases.++## Opening Co-Writer++Click **Co-Writer** in the left navigation, or open `/co-writer`. The first time you visit, you'll see the document picker. Pick **+ New document** to start fresh, or open a recent one.++## The editor++A standard Markdown editor with two panes:++| Pane | What |+|------|------|+| **Left** | Source Markdown — type, edit, format |+| **Right** | Rendered preview (toggle off if you want full-width source) |++Keyboard shortcuts:++| Key | Action |+|-----|--------|+| `⌘B` / `Ctrl+B` | Bold |+| `⌘I` / `Ctrl+I` | Italic |+| `⌘K` / `Ctrl+K` | Insert link |+| `⌘S` / `Ctrl+S` | Save (autosaves anyway) |+| `⌘/` / `Ctrl+/` | Toggle AI sidebar |++## The AI sidebar++Open with `⌘/`. Two tabs:++### Edit (selection-based)++Select text in the editor, then pick an Edit action:++| Action | What it does |+|--------|--------------|+| Rewrite | Same meaning, different words |+| Expand | Add detail, context, examples |+| Condense | Shorten while keeping the key points |+| Change tone | Formal / casual / academic / friendly |+| Fix grammar | Light edits only |+| Translate | To another language |++The Edit Agent replaces the selected text with the result. Undo with `⌘Z`.++### Narrator (cursor-based)++Place your cursor where you want new content, then:++| Action | What it does |+|--------|--------------|+| Continue | Continue writing from this point |+| Fill outline | Convert your bullet outline into prose |+| Explain | Add an explanation of the previous paragraph |+| Cite from KB | Look up something in an attached KB and add a citation |++The Narrator Agent inserts at the cursor.++## Attaching context++Just like Chat, you can attach context to Co-Writer:++- **Knowledge Base** — Narrator can pull from your KB when generating+- **History session** — Reference a prior Chat / Research turn+- **Notebook records** — Pull from saved snippets++Click the paperclip icon in the AI sidebar.++## Templates++DeepTutor ships sample templates:++| Template | Good for |+|----------|---------|+| Research memo | Multi-source synthesis with citations |+| Lecture notes | Outline + filled sections |+| Problem set solutions | Worked solutions with code blocks |+| Reading log | One entry per paper / chapter |++Pick one when creating a new document. Templates pre-fill structure and prompts the agents understand contextually.++## Embedding capability outputs++You can embed results from other DeepTutor capabilities directly into a document:++- **Deep Solve output** → drag the solution into Co-Writer+- **Visualize artifact** → embedded as an inline SVG / Mermaid block+- **Quiz** → embedded as expandable details block++## Saving and exporting++Documents are auto-saved every few seconds. Manual export options:++- **Download .md** — raw Markdown+- **Download .pdf** — rendered via Pandoc+- **Copy to clipboard** — for pasting into other tools++## Version history++Click the clock icon in the top-right to see version history. Co-Writer keeps:++- All saves from the last 24 hours+- Hourly snapshots for the last 7 days+- Daily snapshots indefinitely++Revert to a prior version with one click.++## Multi-user notes++In multi-user mode, each user has their own Co-Writer document space. Sharing is on the roadmap (track [issue #498](https://github.com/HKUDS/DeepTutor/issues/498)).++## See also++- [**Knowledge Bases**](/docs/explore/knowledge/) — attach KBs for ground-truth citations+- [**Chat Workspace**](/docs/explore/chat-workspace/) — run Visualize / Research and bring outputs into documents+- [**Space**](/docs/explore/space/) — save and reuse durable outputsdiff --git a/site/src/content/docs/docs/explore/index.md b/site/src/content/docs/docs/explore/index.mdnew file mode 100644index 000000000..d26bfaa56--- /dev/null+++ b/site/src/content/docs/docs/explore/index.md@@ -0,0 +1,36 @@+---+title: Overview+description: A map of the Explore section — five core surfaces, three-layer Memory, and a unified Settings workbench.+---++DeepTutor is organised around **five core surfaces**, a **three-layer Memory** that sits underneath them, and a unified **Settings** workbench. This section walks each one; the table below is the map.++++## The five surfaces++| # | Surface | One-liner | Page |+|---|---------|-----------|------|+| 1 | **Chat** | One thread, five modes (Chat / Solve / Quiz / Research / Visualize), any tool | [**Chat Workspace**](/docs/explore/chat-workspace/) |+| 2 | **Co-Writer** | Split-view Markdown workbench where AI is a first-class collaborator | [**Co-Writer**](/docs/explore/co-writer/) |+| 3 | **Book** | Multi-agent pipeline that compiles your materials into interactive "living books" | [**Book Engine**](/docs/explore/book/) |+| 4 | **Knowledge** | Versioned RAG-ready document libraries (LlamaIndex end-to-end) | [**Knowledge Bases**](/docs/explore/knowledge/) |+| 5 | **Space** | Read / review hub: Chat History, Notebooks, Question Bank, Skills | [**Space**](/docs/explore/space/) |++## Plus++| Surface | One-liner | Page |+|---------|-----------|------|+| **Memory** | Three-layer pipeline (L1 trace / L2 per-surface / L3 cross-surface) + Memory Graph | [**Memory**](/docs/explore/memory/) |+| **Settings** | Unified control center — Models, Embedding, Search, Capabilities, Tools, Memory, MCP, Appearance, Status | [**Settings**](/docs/explore/settings/) |++## How they fit together++- **Capabilities live inside Chat.** Solve / Quiz / Research / Visualize are not separate top-level tabs — they're modes you switch into mid-thread, sharing the session, knowledge base, attachments, and citation history of the surrounding chat.+- **Tools stay decoupled from workflows.** Built-in tools (RAG, web search, code execution, reason, brainstorm, paper search, `ask_user`, `web_fetch`, `write_note`, `list_notebook`, `github_query`) compose freely on top of every mode. Add MCP servers in Settings to extend.+- **Memory is the substrate.** Every surface reads from and writes to the same three-layer Memory store, so what you learn in Chat surfaces in Co-Writer, in a TutorBot conversation, or in a Book reading session.+- **Sessions cross surfaces.** A session started in the Web UI shows up in the CLI (and vice versa); a chat session can be saved into a Notebook, attached to a Book page, or referenced from Co-Writer.++## Next++Start with [**Chat Workspace**](/docs/explore/chat-workspace/) — most users spend ~80% of their time there. From the CLI side, see the [**CLI overview**](/docs/cli/).diff --git a/site/src/content/docs/docs/explore/knowledge.md b/site/src/content/docs/docs/explore/knowledge.mdnew file mode 100644index 000000000..724de5230--- /dev/null+++ b/site/src/content/docs/docs/explore/knowledge.md@@ -0,0 +1,131 @@+---+title: Knowledge Bases+description: A dedicated workspace for the document collections that power RAG. LlamaIndex end-to-end, versioned indexes, drift-resistant.+---++A dedicated workspace for the document collections that power RAG. Each knowledge base is a versioned, searchable index over your documents — attach it to any chat turn, Co-Writer document, or Book.++++## Four tabs per KB++| Tab | What |+|-----|------|+| **Files** | Browse uploaded sources, preview PDFs inline, see per-file size / status |+| **Add documents** | Drop in PDFs, Office files (DOCX / XLSX / PPTX), Markdown, plain text, and a wide range of code / data file types — routed through the appropriate extractor automatically |+| **Index versions** | Every (re-)index is a tracked version. Roll back to an earlier index, compare embedding models, or inspect chunking stats without losing the previous build |+| **Settings** | Pick the embedding provider / model, chunking parameters, and reranker. Defaults inherit from your global LLM and embedding profiles |++## Built on LlamaIndex end-to-end++Indexing is built on **LlamaIndex** end-to-end. The previous dual-pipeline split was consolidated in the v1.4 refactor. Features:++- **Retry-safe re-index** — partial failures don't lose progress+- **Embedding-mismatch detection** — if you change embedders, you're warned before silently producing bad results+- **Resilient persisted-vector handling** — corrupt vectors are quarantined, not catastrophic+- **Versioned indexes** — every re-index is a new version, comparable and rollback-able++## Supported document types++| Type | Notes |+|------|-------|+| **PDF** | Text extraction; OCR for scanned pages on a best-effort basis |+| **DOCX** | Native Word documents |+| **XLSX** | Spreadsheets — each sheet as a chunk batch |+| **PPTX** | PowerPoint — each slide as a chunk |+| **TXT / MD / HTML** | Cleaned and chunked |+| **Code files** | Python / JS / TS / Go / Rust / many others |++## Creating a KB++In the UI:++1. **Knowledge** in the left sidebar → **+ New knowledge base**+2. Name it, pick a RAG provider *(defaults to LlamaIndex)*+3. Upload documents — drag-and-drop or file picker+4. **Create**++DeepTutor extracts, chunks, embeds each chunk, and stores the vector index. For a 200-page PDF, this typically takes 1–3 minutes.++## Default KB++The KB with a ⭐ star is the **default** — auto-attached when you start a new chat. Click the star to change it.++## Index versions++Every (re-)index is tracked:++- **Roll back** — restore a prior version if a re-index degraded retrieval quality+- **Compare** — A/B different embedding models / chunking strategies on the same source documents+- **Inspect** — chunking stats, embedding dimension, indexing duration++## Searching from the UI++Inside a KB, the search box runs an ad-hoc query. Three modes:++| Mode | Algorithm |+|------|-----------|+| **Hybrid** *(default)* | Semantic embedding + BM25 keyword reranking |+| **Vector** | Pure embedding |+| **Keyword** | Pure BM25 |++## Searching from chat++Attach the KB in the composer and ask naturally — the model decides when to call `rag`:++```text+You> [KB: physics attached] What's the relationship between kinetic energy and momentum?++Model> [calls rag tool]+ ● rag_search(query="kinetic energy momentum relationship", kb_name="physics")+ │ KE = p²/(2m), where p is momentum and m is mass...+ └ #1 rag++Model> [synthesizes a reply citing the retrieved passages]+```++## Multi-KB workflows++Attach multiple KBs to one turn. The model can query them in parallel. Useful for "compare two textbooks", "find the same concept across papers", etc.++## CLI mirror++```bash+deeptutor kb list # all KBs+deeptutor kb info physics # KB details+deeptutor kb create physics --doc chapter1.pdf # create+deeptutor kb create textbooks --docs-dir ./pdfs/ # from a directory+deeptutor kb add physics --doc chapter3.pdf # incremental add+deeptutor kb search physics "What is angular momentum?" # ad-hoc search+deeptutor kb set-default physics # set as default+deeptutor kb delete physics --force # delete+```++See [**Commands**](/docs/cli/commands/) for full flag reference.++## Embedding provider++The embedder is configured globally in **Settings → Embedding**. New KBs inherit it. Existing KBs keep their original embedder until re-indexed.++| Provider | Notes |+|----------|-------|+| OpenAI | `text-embedding-3-small` (1536d) / `-large` (3072d) |+| Cohere | `embed-v4.0` |+| Jina | `jina-embeddings-v3` |+| Gemini | `gemini-embedding-001` |+| SiliconFlow | `Qwen/Qwen3-Embedding-8B` |+| Aliyun DashScope | `qwen3-vl-embedding` |+| Ollama | Local embedding models |+| vLLM / LM Studio / OpenAI-compatible | Custom embedding endpoints |++Full provider matrix: [**Providers**](/docs/get-started/providers/).++## Multi-user++In multi-user deployments, KBs are scoped per user. Admins can grant cross-user access (read / read+search / read+search+modify) at `/admin/grants` — see [**Multi-User Deployment**](/docs/get-started/multi-user/).++## See also++- [**Chat Workspace**](/docs/explore/chat-workspace/) — attaching KBs to chat turns+- [**Book Engine**](/docs/explore/book/) — books compile from a KB+- [**Memory**](/docs/explore/memory/) — KBs are for documents; memory is for conversationsdiff --git a/site/src/content/docs/docs/explore/memory.md b/site/src/content/docs/docs/explore/memory.mdnew file mode 100644index 000000000..a3dfdac00--- /dev/null+++ b/site/src/content/docs/docs/explore/memory.md@@ -0,0 +1,172 @@+---+title: Memory+description: Three-layer pipeline (L1 / L2 / L3), an inspectable workbench, and the Memory Graph — audit *why* DeepTutor knows what it knows.+---++DeepTutor's memory is a **three-layer pipeline** with an inspectable workbench at `/memory`. The two-file v1 `SUMMARY.md` / `PROFILE.md` model is gone; everything is migrated into the new layout on first boot.++++## The three layers++| Layer | Role | Storage |+|-------|------|---------|+| **L1 · Workspace mirror** *(LIVE)* | Append-only trace of every interaction, per surface, per day. The lossless record of what actually happened. | `trace/<surface>/<YYYY-MM-DD>.jsonl` |+| **L2 · Per-surface summaries** *(CURATED)* | Surface-specific facts extracted by the consolidator. Each fact carries footnote citations back to L1 traces. Supports per-doc **Update / Audit / Dedup** runs. | `L2/<surface>.md` |+| **L3 · Cross-surface knowledge** *(SYNTHESIS)* | Cross-surface synthesis: your `profile`, `recent` timeline, `scope` of knowledge, and `preferences`. Hedged claims, each backed by L2 evidence. | `L3/{recent,profile,scope,preferences}.md` |++## Seven surfaces feed the pipeline++| Surface | What L1 captures |+|---------|------------------|+| `chat` | Every chat turn (input, tool calls, output) |+| `notebook` | Notebook creates / edits / deletes |+| `quiz` | Quiz generations + your answers + grading results |+| `kb` | KB creates / queries / indexing events |+| `book` | Book reading sessions, page-level interactions |+| `tutorbot` | TutorBot messages (across all channels) |+| `cowriter` | Co-Writer document edits |++## The consolidator++The consolidator is **LLM-driven** and runs asynchronously (`POST /memory/runs/start` — also reachable from the workbench). You can:++- **Fire it manually** — from the workbench, click "Run consolidator"+- **Watch L1 → L2 → L3 propagate** — live progress stream+- **Edit any layer by hand** — your edits are merged on the next run++Default cadence (tunable in **Settings → Memory**):++| Pass | When |+|------|------|+| L1 → L2 (per surface) | Every N turns on that surface, or when triggered |+| L2 → L3 cross-surface | First turn each day, or on demand |++## The Memory Workbench (Web UI)++Open `/memory`. Five sub-views:++| Tab | Route | What |+|-----|-------|------|+| **L3** | `/memory/l3` *(default)* | The four cross-surface docs |+| **L2** | `/memory/l2` | Seven per-surface docs |+| **L1** | `/memory/l1` | Raw event traces per surface, per day |+| **Graph** | `/memory/graph` | The Memory Graph (see below) |+| **Resolve** | `/memory/resolve` | Look up a footnote id → originating event |++## L3 in detail++Four markdown files:++| File | Contents |+|------|----------|+| `recent.md` | A rolling summary of recent learning (last few days/weeks) — what you've been studying, what's open |+| `profile.md` | Who you are: background, goals, role, learning style |+| `scope.md` | Topics you've engaged with and a rough mastery indicator |+| `preferences.md` | Explicit preferences: language for replies, depth, format, examples-first vs theory-first |++**Only `preferences.md` is written by the model directly** (via the `write_memory` tool). The other three are managed by the consolidator agent; your manual edits get merged on the next pass.++## L2 in detail++Seven documents, one per surface. Each is a structured markdown file with **footnote-style citations** like `[^abc123]` that link back to specific L1 events.++Per-doc actions in the workbench:++- **Update** — re-run consolidation on this surface's recent L1 events+- **Audit** — LLM checks the L2 for stale, contradictory, or unsupported claims+- **Dedup** — merge near-duplicate bullet points++## L1 in detail++Per-surface daily JSONL:++```jsonl+{"id":"evt_001","timestamp":"2026-05-21T14:23:01Z","surface":"chat","kind":"turn","content":"User asked about the chain rule"}+{"id":"evt_002","timestamp":"2026-05-21T14:23:18Z","surface":"chat","kind":"tool_call","content":"rag_search"}+{"id":"evt_003","timestamp":"2026-05-21T14:24:38Z","surface":"chat","kind":"turn_complete","content":"Explained with worked example"}+```++L1 is rarely useful directly — but L2 footnotes reference these ids, and the **Resolve** view lets you trace a footnote back to its source.++## The Memory Graph++++The **Memory Graph** at `/memory/graph` renders **all three layers at once**:++- **Center** — L3 synthesis nodes (`profile`, `recent`, `scope`, `preferences`)+- **Middle ring** — L2 facts per surface+- **Outer ring** — L1 traces, grouped by surface++Hover any node for an inline preview. Click to **lock the highlight** and trace the L3 → L2 → L1 references inward — so you can audit *why* DeepTutor "knows" something about you.++This is the killer feature: **transparent provenance**. Every claim DeepTutor makes about you, you can drill into.++## How chat reads memory++At the start of each chat turn, the system prompt includes concatenated L3 docs:++```text+─── User profile (from memory) ─────────────────────────────────────+[recent.md content]++[profile.md content]++[scope.md content]++[preferences.md content]+─────────────────────────────────────────────────────────────────────+```++The model also has the `read_memory` tool for mid-turn lookups, and `write_memory` for persisting explicit preferences (≤240 chars, content-safety filtered, auto-linked to the triggering L1 event).++## File layout++```text+data/user/memory/+├── trace/+│ ├── chat/2026-05-21.jsonl ← L1+│ ├── chat/2026-05-22.jsonl+│ ├── notebook/2026-05-22.jsonl+│ ├── quiz/2026-05-22.jsonl+│ ├── kb/2026-05-22.jsonl+│ ├── book/2026-05-22.jsonl+│ ├── tutorbot/2026-05-22.jsonl+│ └── cowriter/2026-05-22.jsonl+├── L2/+│ ├── chat.md+│ ├── notebook.md+│ ├── quiz.md+│ ├── kb.md+│ ├── book.md+│ ├── tutorbot.md+│ └── cowriter.md+└── L3/+ ├── recent.md+ ├── profile.md+ ├── scope.md+ └── preferences.md+```++In multi-user mode this lives under `multi-user/<uid>/memory/`.++## CLI mirror++```bash+deeptutor memory show # L3 concatenated (default)+deeptutor memory show chat # an L2 surface doc+deeptutor memory show profile # an L3 doc+deeptutor memory clear all --force # wipe all layers (destructive)+deeptutor memory clear chat # L1 for one surface+```++## Multi-user memory++Each user has their own memory under `multi-user/<uid>/memory/`. Memory is **not shared across users** — even admins can't read another user's memory.++## See also++- [**Chat Workspace**](/docs/explore/chat-workspace/) — how chat consumes / writes memory+- [**Space → Notebooks**](/docs/explore/space/) — notebooks feed the `notebook` surface+- [**Settings → Memory**](/docs/explore/settings/) — tune consolidation cadencediff --git a/site/src/content/docs/docs/explore/settings.md b/site/src/content/docs/docs/explore/settings.mdnew file mode 100644index 000000000..a880539f5--- /dev/null+++ b/site/src/content/docs/docs/explore/settings.md@@ -0,0 +1,149 @@+---+title: Settings+description: The unified control center - Appearance, Status, Network, LLM / Embedding / Search, Capabilities, Memory, MCP, Tools.+---++The settings surface was unified in v1.4 and split by concern, with a **draft / Apply** model so changes are atomic and can be reverted before save.++++## Tabs++In the order they appear in the left navigation:++| Tab | What it controls |+|-----|------------------|+| **Appearance** | UI language and theme (Cream, Snow, Dark, Glass) |+| **Status** | Live health probe across LLM, embedding, search, and storage backends |+| **Network** | Backend/frontend ports, browser API base, CORS origins, and deployment hints |+| **LLM** | Provider catalog, base URLs, API keys, active model selection |+| **Embedding** | Same shape as LLM, but for the embedder |+| **Search** | Web search provider (Tavily / Brave / Jina / Serper / SearXNG / DuckDuckGo / Perplexity) |+| **Capabilities** | Per-capability tunables (chunking, LLM budget, dedup, max iterations) |+| **Memory** | Toggle consolidator runs, configure cadence and budget |+| **MCP servers** | Register external Model Context Protocol servers |+| **Tools** | Inspect every built-in tool, parameters, status, i18n status copy |++A **Tour** launcher walks new users through the page.++## Appearance++| Setting | Options |+|---------|---------|+| Language | English, 简体中文 |+| Theme | Cream *(default)* / Snow / Dark / Glass |+| Sidebar density | Compact / Comfortable |++## Status++A live health probe:++- LLM provider — connection OK / failing / not configured+- Embedding provider — same+- Search provider — same+- Storage backends — connection state, latency+- Last health-check time per provider++Use this to **debug "the model isn't responding"** issues fast.++## Network++Network settings are startup settings stored in+`data/user/settings/system.json`. Use this page for Docker, LAN, and+reverse-proxy deployments:++- **Backend / frontend ports** control what DeepTutor starts on. Docker port+ mappings must match the container-side ports.+- **Public API base** maps to `next_public_api_base_external`. It is the URL the+ browser uses for HTTP and WebSocket API calls.+- **CORS origins** are frontend page origins allowed to call the backend. They+ are only required for authenticated cross-origin deployments.+- `public_api_base` is accepted as a compatibility alias and normalized on save.++With auth disabled, DeepTutor permits normal HTTP/HTTPS browser origins by+default. With auth enabled, set exact frontend origins and use+`auth.json: cookie_secure=true` for HTTPS cross-site cookies.++## LLM / Embedding / Search++All three share the same **profile** model:++- You can configure **multiple profiles** (e.g., `openai-gpt-4o`, `anthropic-sonnet-4`, `local-ollama`)+- Pick **one active model** per service from the catalog+- Per-turn overrides happen in the chat composer's model selector++Test connection with the **Test** button — it issues a small probe call and reports latency.++Full provider matrix: [**Providers**](/docs/get-started/providers/).++## Capabilities++Per-capability tunables for Chat, Solve, Quiz, Research, Visualize, and Co-Writer:++| Setting | What |+|---------|------|+| **Chunking** | How retrieved KB content is chunked into the context window |+| **LLM budget** | Max tokens / max iterations per capability run |+| **Dedup policy** | How duplicate sources are handled |+| **Reference policy** | When to insert citations |+| **Max iterations** | Hard guard on agentic loops |++Backed by a unified `emit_capability_result` envelope and a shared `UsageTracker` that surfaces **per-call cost**.++## Memory++| Setting | Effect |+|---------|--------|+| **Toggle consolidator** | Pause / resume the L1 → L2 → L3 pipeline |+| **Cadence** | How often each consolidation pass runs |+| **Budget** | Token budget per consolidation pass |+| **Jump to workbench** | Opens `/memory` directly |++See [**Memory**](/docs/explore/memory/) for the full three-layer architecture.++## MCP servers++The **Model Context Protocol** integration lets you plug in external MCP servers as additional tools. Add server configs here; their tools surface alongside built-ins.++Example:++```yaml+servers:+ filesystem:+ command: npx+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/Users/frank/docs"]+ github:+ command: npx+ args: ["-y", "@modelcontextprotocol/server-github"]+ env:+ GITHUB_PERSONAL_ACCESS_TOKEN: ${GITHUB_TOKEN}+```++## Tools++Inspect every built-in tool:++- Name, description, parameters+- Status (enabled / coming-soon)+- i18n status copy (how the tool's progress messages appear in English / 中文)+- Whether it's user-toggleable++Five tools are user-toggleable globally: `brainstorm`, `web_search`, `paper_search`, `code_execution`, `reason`. Context-mounted tools (`rag`, `read_memory`, `write_memory`, etc.) can't be toggled here — they appear automatically based on what's attached to the turn.++## i18n++Every capability ships a canonical `capabilities/prompts/{en,zh}/<name>.yaml` so status messages stay consistent in both English and 中文.++## CLI mirror++```bash+deeptutor config show # Print current configuration (secrets masked)+deeptutor init # Re-run wizard, re-prompt every value+$EDITOR data/user/settings/model_catalog.json # direct edit+```++## See also++- [**Providers**](/docs/get-started/providers/) — full LLM / embedding / search provider matrix+- [**Memory**](/docs/explore/memory/) — what the consolidator actually does+- [**Multi-User Deployment**](/docs/get-started/multi-user/) — auth-related settingsdiff --git a/site/src/content/docs/docs/explore/space.md b/site/src/content/docs/docs/explore/space.mdnew file mode 100644index 000000000..8fff3d057--- /dev/null+++ b/site/src/content/docs/docs/explore/space.md@@ -0,0 +1,119 @@+---+title: Space+description: Your personal learning library — Chat History, Notebooks, Question Bank, and Skills, all in one place.+---++Space is the **read / review** counterpart to the active surfaces. Where Chat / Co-Writer / Book are where you *produce*, Space is where everything you produce lives — searchable and replayable.++## What lives in Space++Space bundles four sub-surfaces under one navigation:++| Sub-surface | What's in it |+|-------------|--------------|+| **Chat History** | Every conversation across every mode (Chat / Solve / Quiz / Research / Visualize) |+| **Notebooks** | Categorised, colour-coded notebooks holding records from Chat, Research, and Co-Writer |+| **Question Bank** | Every auto-generated quiz question — bookmarkable, @-mention-able in chat |+| **Skills** | User-authored `SKILL.md` files that define teaching personas |++## Chat History++Every conversation, with:++- **Title rename** — edit the auto-generated title to something searchable+- **Delete** — drop a session (also removes its memory traces)+- **Resume** — open the session in a new tab or reattach to the active tab+- **Per-turn delete** — supported on every entry point (chat, solve, quiz, research, visualize)++The browser search box at the top filters across all titles and bodies — useful when you can't remember which session covered something.++## Notebooks++Notebooks are the **persistent storage for outputs you want to keep**. A notebook is:++- A name + description + color tag+- A list of records (each record is a Markdown document)+- Cross-linked back to the originating chat session / Co-Writer document++### Saving to a notebook++Most surfaces have a **Save to Notebook** action:++| Surface | What gets saved |+|---------|-----------------|+| **Chat** *(any mode)* | The current turn + its citations |+| **Co-Writer** | The current document |+| **Quiz** | The question + your answer + grading result |+| **Research** | The full report + outline + citations |++### Using a notebook in chat++Notebooks are queryable from chat via the `list_notebook` and `write_note` tools (auto-mounted when ≥1 notebook exists). You can also attach specific records to a turn via the composer's Space picker.++### CLI mirror++```bash+deeptutor notebook list+deeptutor notebook create research-notes --description "Daily reading log"+deeptutor notebook show research-notes+deeptutor notebook add-md research-notes ./paper-summary.md+deeptutor notebook replace-md research-notes <record_id> ./updated.md+deeptutor notebook remove-record research-notes <record_id>+```++## Question Bank++Every auto-validated quiz question generated by **Quiz** mode lands here:++- **Bookmark** — flag a question for later review+- **Categories** — questions inherit a topic tag based on the source+- **@-mention in chat** — reference past questions in a new chat turn ("@question 47, why is option B correct?")++The Question Bank is how spaced repetition becomes a real workflow: regenerate yesterday's wrong answers, get explanations, re-quiz.++## Skills++Skills are **user-authored persona definitions** — `SKILL.md` files following a specific schema. When a skill is active:++- Its persona is **injected into the chat system prompt** for the duration+- The skill's triggers can auto-activate it (e.g., when you mention specific topics)++### Skill schema++```markdown+---+name: socratic-tutor+description: Teach by asking probing questions instead of giving direct answers+triggers:+ - "explain"+ - "what is"+ - "teach me"+---++You are a Socratic tutor. Instead of giving direct answers:++1. Ask probing questions that reveal what the student already knows.+2. Guide them to discover the answer themselves.+3. Confirm understanding with a follow-up question.++Use clear, encouraging language. Never lecture.+```++DeepTutor ships built-in archetypes — Socratic, encouraging, rigorous — and you can author your own from the Skills tab.++### Where skills live++- **Personal skills** — `data/user/workspace/skills/*.md`+- **Project-scoped skills** — `.deeptutor/skills/*.md` *(if you're using a project workspace)*++## Pairs well with++- **Chat** — Pull a notebook record / past session into the current turn for context+- **TutorBot** — Bots can also use Skills (per-bot configuration)+- **Memory** — Notebooks become L1 traces in the `notebook` surface, eventually consolidated into L3++## See also++- [**Chat Workspace**](/docs/explore/chat-workspace/) — produces what Space stores+- [**Memory**](/docs/explore/memory/) — how Space content feeds the memory pipeline+- [**Explore TutorBot**](/docs/tutorbot/) — bots also use Skillsdiff --git a/site/src/content/docs/docs/get-started/cli-only.md b/site/src/content/docs/docs/get-started/cli-only.mdnew file mode 100644index 000000000..db29e2ca2--- /dev/null+++ b/site/src/content/docs/docs/get-started/cli-only.md@@ -0,0 +1,116 @@+---+title: CLI-Only Install+description: Option 4 — the lightweight install for headless servers, agent harnesses, and Claude Code / Codex / Hermes setups.+---++When you don't need the Web UI. The CLI-only package is installed from a **source checkout**, not from PyPI.++## Install++```bash+git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++# Create a venv (macOS / Linux)+# Windows PowerShell:+# py -3.11 -m venv .venv-cli ; .\.venv-cli\Scripts\Activate.ps1+python3 -m venv .venv-cli && source .venv-cli/bin/activate+python -m pip install --upgrade pip++python -m pip install -e ./packaging/deeptutor-cli+deeptutor init --cli+deeptutor chat+```++`deeptutor init --cli` shares the same `data/user/settings/` layout as the full app but:++- **Skips** the backend / frontend port prompts+- **Defaults embeddings to off** (choose `Yes` if you plan to use `deeptutor kb …` or RAG tools)+- Still writes the complete runtime layout (`system.json`, `auth.json`, `integrations.json`, `model_catalog.json`, `main.yaml`, `agents.yaml`)+- Still prompts for the active LLM provider and model++## When to use this++- You're running DeepTutor as a tool inside another agent's harness (Claude Code, Codex, OpenCode, etc.)+- Headless server / VM with no browser+- You want a fast install with no Node.js toolchain++## Common commands++```bash+deeptutor chat # interactive REPL+deeptutor chat --capability deep_solve --tool rag --kb my-kb+deeptutor run chat "Explain Fourier transform"+deeptutor run deep_solve "Solve x^2 = 4" --tool rag --kb my-kb+deeptutor kb create my-kb --doc textbook.pdf+deeptutor memory show+deeptutor config show+```++Full surface: [**DeepTutor CLI**](/docs/cli/).++## What's available and what isn't++The local `deeptutor-cli` install ships **no Web assets or server dependencies**. Keep the source checkout around — the editable install points to it.++| Surface | CLI-Only | Full install |+|---------|----------|--------------|+| `deeptutor chat` interactive REPL | ✅ | ✅ |+| `deeptutor run` capabilities | ✅ | ✅ |+| `deeptutor kb` (Knowledge Bases) | ✅ *(opt in during init)* | ✅ |+| `deeptutor notebook` | ✅ | ✅ |+| `deeptutor memory` | ✅ | ✅ |+| `deeptutor bot` (TutorBot) | ✅ *(if `[tutorbot]` extra installed)* | ✅ |+| `deeptutor config show` | ✅ | ✅ |+| `deeptutor provider login` | ✅ | ✅ |+| `deeptutor serve` (FastAPI) | ❌ | ✅ |+| `deeptutor start` (Web UI) | ❌ | ✅ |+| Co-Writer UI | ❌ | ✅ |+| Memory Workbench UI | ❌ | ✅ |+| Book Engine UI | ❌ | ✅ |++To add the Web app later, install the PyPI package (Option 1) and run `deeptutor init` + `deeptutor start` from the same workspace.++## Use it from another agent++The CLI is **agent-native**. `deeptutor run --format json` emits one JSON event per line, and data-inspection commands such as `kb list`, `kb search`, `session show`, and `notebook show` expose JSON where implemented — useful for piping into another agent's harness.++Hand the [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) at the project root to any tool-using LLM and it can drive DeepTutor on its own. See [**Agent handoff**](/docs/cli/agent-handoff/) for the patterns.++## Updating++```bash+cd DeepTutor+git pull+pip install -e ./packaging/deeptutor-cli --upgrade+```++## Common errors++### `deeptutor: command not found` after install++The console script wasn't placed on PATH. Verify the venv is activated, or call it directly:++```bash+python -m deeptutor_cli.main chat+```++### `ModuleNotFoundError: No module named 'fastapi'` when running `deeptutor serve`++`deeptutor serve` is **unavailable** in the CLI-only install. Use [**PyPI**](/docs/get-started/pypi/) or [**From Source**](/docs/get-started/from-source/) instead.++### TutorBot commands say SDK missing++Channel SDKs (python-telegram-bot, slack-sdk, etc.) are only included with the `[tutorbot]` extra:++```bash+pip install -e "./packaging/deeptutor-cli[tutorbot]"+```++More: [**Troubleshooting**](/docs/get-started/troubleshooting/).++## Next++- [**DeepTutor CLI**](/docs/cli/) — full CLI reference+- [**Agent handoff**](/docs/cli/agent-handoff/) — let your agent drive+- [**Explore TutorBot**](/docs/tutorbot/) — run a bot from CLIdiff --git a/site/src/content/docs/docs/get-started/docker.md b/site/src/content/docs/docs/get-started/docker.mdnew file mode 100644index 000000000..c4f51ed2f--- /dev/null+++ b/site/src/content/docs/docs/get-started/docker.md@@ -0,0 +1,182 @@+---+title: Docker+description: Option 3 — one container for the full Web app, from the GHCR image.+---++One container for the full Web app. Images on GitHub Container Registry:++- `ghcr.io/hkuds/deeptutor:latest` — stable release+- `ghcr.io/hkuds/deeptutor:pre` — pre-release, when available++## Run++```bash+docker run --rm --name deeptutor \+ -p 127.0.0.1:3782:3782 \+ -p 127.0.0.1:8001:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++> ⚠️ **Map both `3782` and `8001`.** Port `3782` serves the Web UI; port `8001` is the FastAPI backend that your browser calls directly — there is no in-container proxy. Skip the `8001` mapping and the page still loads, but **Settings** shows "Backend unreachable" and stays unusable.++Open <http://127.0.0.1:3782>. The container creates `/app/data/user/settings/*.json` on first boot; configure model providers from the Web Settings page. Config, API keys, logs, workspace files, memory, and knowledge bases all persist in the `deeptutor-data` volume.++## Detached mode++Add `-d` to run in the background:++```bash+docker run -d --name deeptutor \+ -p 127.0.0.1:3782:3782 -p 127.0.0.1:8001:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest++docker logs -f deeptutor # follow logs+docker stop deeptutor # stop+docker rm deeptutor # remove (volume persists)+```++The `deeptutor-data` volume keeps your settings and workspace across `stop` / `rm` cycles. To truly start over: `docker volume rm deeptutor-data`.++## Remote Docker / reverse proxy++The Web UI runs in the user's browser, not inside the container. If someone+opens DeepTutor through a remote hostname, the browser needs a backend URL it+can reach.++For remote servers, open **Settings -> Network** or edit+`data/user/settings/system.json` in the mounted volume:++```json+{+ "next_public_api_base_external": "https://deeptutor.example.com"+}+```++`public_api_base` is accepted as a compatibility alias and is normalized into+`next_public_api_base_external` on save. Leave the field blank for local Docker+on the same machine.++CORS is separate from the API base:++- `next_public_api_base_external` tells the browser where to send API and+ WebSocket calls.+- `cors_origins` lists the frontend page origins allowed to call the backend.+- With auth disabled, DeepTutor permits normal HTTP/HTTPS browser origins by+ default.+- With auth enabled, set exact frontend origins such as+ `https://deeptutor.example.com`.++```json+{+ "cors_origins": ["https://deeptutor.example.com"]+}+```++## Different host ports++Change the left side of each `-p host:container` mapping:++```bash+docker run --rm --name deeptutor \+ -p 127.0.0.1:8088:3782 \+ -p 127.0.0.1:8089:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++If you change container-side ports in `/app/data/user/settings/system.json`, restart and update the right side of each mapping to match.++## Connecting to a local LLM (Ollama / LM Studio / llama.cpp / vLLM)++Inside Docker, `localhost` is the container itself, not your host machine. To reach a model service running on the host, use the host gateway:++```bash+docker run --rm --name deeptutor \+ -p 127.0.0.1:3782:3782 -p 127.0.0.1:8001:8001 \+ --add-host=host.docker.internal:host-gateway \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++Then in **Settings → LLM** (or **Embedding**), point the provider Base URL at `host.docker.internal`:++| Service | Base URL |+|---------|----------|+| Ollama LLM | `http://host.docker.internal:11434/v1` |+| Ollama embedding | `http://host.docker.internal:11434/api/embed` |+| LM Studio | `http://host.docker.internal:1234/v1` |+| llama.cpp | `http://host.docker.internal:8080/v1` |++Docker Desktop (macOS / Windows) usually resolves `host.docker.internal` **without** `--add-host`. On Linux, the flag is the portable way to create that hostname on modern Docker Engine.++### Linux alternative — host networking++Add `--network=host` and drop the `-p` flags:++```bash+docker run --rm --name deeptutor \+ --network=host \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++The container shares the host network directly, so open <http://127.0.0.1:3782> (or the `frontend_port` in `system.json`), and host services can be reached with normal localhost URLs like `http://127.0.0.1:11434/v1`.++> Host networking exposes container ports directly on the host and may conflict with existing services.++## Updating++```bash+docker pull ghcr.io/hkuds/deeptutor:latest+docker rm -f deeptutor 2>/dev/null+docker run --rm --name deeptutor \+ -p 127.0.0.1:3782:3782 -p 127.0.0.1:8001:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++The volume persists — your settings, KBs, memory all survive the upgrade.++## Common errors++### `Bind for 0.0.0.0:3782 failed: port is already allocated`++```bash+lsof -i :3782 # macOS+ss -ltnp | grep :3782 # Linux+```++Kill the conflicting process, or choose different host ports in your `-p` mapping.++### Container exits immediately++```bash+docker logs deeptutor | tail -30+```++Most common: bad LLM API key on first boot (the backend fails fast). Open **Settings → LLM** in the Web UI before configuring an LLM, or remove the bad credential from the volume:++```bash+docker run --rm -v deeptutor-data:/app/data alpine \+ sh -c 'rm /app/data/user/settings/model_catalog.json'+docker run ... ghcr.io/hkuds/deeptutor:latest # restart with clean catalog+```++### Frontend loads but API calls 404 (remote / behind a reverse proxy)++Set the explicit external API base. In `data/user/settings/system.json` inside+the volume, set `next_public_api_base_external` to the externally-reachable URL+and restart. `public_api_base` is still accepted as a compatibility alias.++### Multi-user mode in Docker++Just toggle auth in the volume's `data/user/settings/auth.json` (`"enabled": true`) and restart. The container picks it up. See [**Multi-User Deployment**](/docs/get-started/multi-user/) for the full setup.++More: [**Troubleshooting**](/docs/get-started/troubleshooting/).++## Next++- [**Multi-User Deployment**](/docs/get-started/multi-user/) — team setup+- [**Explore DeepTutor**](/docs/explore/) — tour the running appdiff --git a/site/src/content/docs/docs/get-started/from-source.md b/site/src/content/docs/docs/get-started/from-source.mdnew file mode 100644index 000000000..580bfa886--- /dev/null+++ b/site/src/content/docs/docs/get-started/from-source.md@@ -0,0 +1,139 @@+---+title: Install from Source+description: Option 2 — clone, install editable, hot-reload the frontend. For contributors and power users.+---++For development against a checkout. Use **Python 3.11+** and **Node.js 22 LTS** to match CI and Docker.++## Install++```bash+git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++# Create a venv (macOS / Linux)+# Windows PowerShell:+# py -3.11 -m venv .venv ; .\.venv\Scripts\Activate.ps1+python3 -m venv .venv && source .venv/bin/activate+python -m pip install --upgrade pip++# Install backend + frontend deps+python -m pip install -e .+( cd web && npm ci --legacy-peer-deps )++deeptutor init+deeptutor start+```++Source installs run Next.js in dev mode against the local `web/` directory; everything else (config layout, ports, stop with `Ctrl+C`) matches the [**PyPI install**](/docs/get-started/pypi/).++## Conda instead of venv++```bash+conda create -n deeptutor python=3.11+conda activate deeptutor+python -m pip install --upgrade pip+# ...then continue with `pip install -e .` and `npm ci`+```++## Optional install extras++`pyproject.toml` exposes layered extras:++```bash+pip install -e ".[dev]" # tests / lint tools+pip install -e ".[tutorbot]" # TutorBot engine + channel SDKs+pip install -e ".[matrix]" # Matrix channel without E2EE / libolm+pip install -e ".[matrix-e2e]" # Matrix E2EE; requires libolm+pip install -e ".[math-animator]" # Manim addon; requires LaTeX / ffmpeg / system libs+```++Compose them: `pip install -e ".[dev,tutorbot,math-animator]"`.++### System dependencies for some extras++| Extra | System library |+|-------|----------------|+| `matrix-e2e` | **libolm**: `brew install libolm` (macOS) / `sudo apt install libolm-dev` (Debian) |+| `math-animator` | **LaTeX + ffmpeg**: `brew install --cask mactex && brew install ffmpeg` (macOS) / `sudo apt install texlive-full ffmpeg` (Linux) |++## Frontend dependency tweaks++When you add or upgrade a frontend dependency:++```bash+cd web+npm install --legacy-peer-deps+# commit both web/package.json and web/package-lock.json+```++## Dev-server troubleshooting++**Stuck dev server:** if `deeptutor start` reports an existing frontend that isn't responding, stop the PID it prints. If no Next.js process is actually running, the lock files are stale — remove them and retry:++```bash+rm -f web/.next/dev/lock web/.next/lock+deeptutor start+```++## Hot reload++The backend supports `--reload`. Start backend and frontend in separate terminals for the best dev loop:++```bash+# Terminal A — backend with hot reload+python -m uvicorn deeptutor.api.main:app \+ --host 0.0.0.0 --port 8001 \+ --reload --reload-exclude "web/*" --reload-exclude "data/*"++# Terminal B — frontend dev server+cd web && npm run dev -- -p 3782+```++## Updating++```bash+git pull+pip install -e . --upgrade+cd web && npm ci --legacy-peer-deps+```++If a release bumped settings schema, also re-run `deeptutor init` to fill in newly-introduced fields. Existing config is preserved.++## Common errors++### `error: Microsoft Visual C++ 14.0 is required` (Windows)++Some Python deps compile C extensions. Install [**Build Tools for Visual Studio**](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with "Desktop development with C++".++### `libolm` not found (when `matrix-e2e` is installed)++```bash+brew install libolm # macOS+sudo apt install libolm-dev # Debian / Ubuntu+pip install -e ".[matrix-e2e]" --force-reinstall+```++### `npm ci` slow or times out++```bash+npm config set fetch-timeout 600000+cd web && npm ci --legacy-peer-deps+```++### Backend `--reload` thrashes on every save++You forgot the `--reload-exclude` flags. Restart with:++```bash+python -m uvicorn deeptutor.api.main:app \+ --host 0.0.0.0 --port 8001 \+ --reload --reload-exclude "web/*" --reload-exclude "data/*"+```++More fixes: [**Troubleshooting**](/docs/get-started/troubleshooting/).++## Next++- [**DeepTutor CLI**](/docs/cli/) — drive the CLI from the same workspace+- [**Explore DeepTutor**](/docs/explore/) — tour the running appdiff --git a/site/src/content/docs/docs/get-started/index.md b/site/src/content/docs/docs/get-started/index.mdnew file mode 100644index 000000000..720fa12c2--- /dev/null+++ b/site/src/content/docs/docs/get-started/index.md@@ -0,0 +1,52 @@+---+title: Get Started+description: DeepTutor ships four install paths — PyPI, From Source, Docker, and CLI-Only. Pick the one that fits.+---++DeepTutor ships **four installation paths**. They all share one workspace layout: settings live in `data/user/settings/` under the directory you launch from (or under `DEEPTUTOR_HOME` / `deeptutor start --home` if you set one explicitly).++For the full app, the recommended flow is **pick a workspace directory → install → `deeptutor init` → `deeptutor start`**.++## Pick a path++| Option | When to use | Page |+|--------|-------------|------|+| **PyPI** | First-time users, want the smoothest path, no clone | [**Install from PyPI**](/docs/get-started/pypi/) |+| **From Source** | Hacking on the codebase, want hot reload | [**Install from Source**](/docs/get-started/from-source/) |+| **Docker** | Production deployments, hosted hosts, persistent volumes | [**Docker**](/docs/get-started/docker/) |+| **CLI Only** | Headless server, agent harness, no Web UI needed | [**CLI-Only Install**](/docs/get-started/cli-only/) |++> 🧪 **Trying the v1.4.0 beta?** PyPI normalizes `1.4.0-beta` to `1.4.0b0`, so plain `pip install -U deeptutor` stays on stable. Opt in with `pip install --pre -U deeptutor`, or pin exactly with `pip install -U deeptutor==1.4.0b0`.++## Minimum requirements++| Component | Version |+|-----------|---------|+| Python | **3.11+** |+| Node.js | **20+** (PyPI) / **22 LTS** (from source, matches CI + Docker) |+| RAM | 4 GB free |+| Disk | 2 GB free |++You'll also need an **LLM API key** (OpenAI, Anthropic, Gemini, DeepSeek, Azure, Ollama, LM Studio, llama.cpp, vLLM, or any OpenAI-compatible endpoint) and ideally an **embedding API key** if you plan to use Knowledge Bases.++## What gets bound++After `deeptutor start`, two services come up:++| Service | Default port |+|---------|--------------|+| FastAPI backend | `8001` |+| Next.js frontend | `3782` |++Both are overridable via `data/user/settings/system.json` or during `deeptutor init`.++## After install++Once you can reach `http://localhost:3782/`:++- [**Explore DeepTutor**](/docs/explore/) — a tour of the five core surfaces (Chat, Co-Writer, Book, Knowledge, Space) plus Memory and Settings+- [**DeepTutor CLI**](/docs/cli/) — drive everything from the terminal+- [**Explore TutorBot**](/docs/tutorbot/) — connect autonomous tutors to Telegram, Slack, Feishu, and more+- [**Multi-User Deployment**](/docs/get-started/multi-user/) — host DeepTutor for a team++If something breaks, jump to [**Troubleshooting**](/docs/get-started/troubleshooting/).diff --git a/site/src/content/docs/docs/get-started/multi-user.md b/site/src/content/docs/docs/get-started/multi-user.mdnew file mode 100644index 000000000..d60036274--- /dev/null+++ b/site/src/content/docs/docs/get-started/multi-user.md@@ -0,0 +1,153 @@+---+title: Multi-User Deployment+description: Flip on authentication and DeepTutor turns into a multi-tenant deployment with per-user isolated workspaces and admin-curated resources.+---++Flip on authentication and DeepTutor turns into a multi-tenant deployment with **per-user isolated workspaces** and **admin-curated resources**. The first person to register becomes the admin and configures models, API keys, and knowledge bases on behalf of everyone else. Subsequent accounts are created by the admin (invite-only), each gets their own scoped chat history / memory / notebooks / knowledge bases, and they only see the LLMs, KBs, and skills the admin assigned to them.++## Quick start (5 steps)++```bash+# 1. Enable auth in data/user/settings/auth.json:+# {"enabled": true, "token_expire_hours": 24, "cookie_secure": false}+# Use cookie_secure=true for HTTPS deployments where Web and API are cross-site.++# 2. Restart the web stack.+deeptutor start++# 3. Open http://localhost:3782/register and create the first account.+# The first registration is the only public one; that user becomes admin+# and the /register endpoint is closed automatically afterward.++# 4. As admin, navigate to /admin/users → "Add user" to provision teammates.++# 5. For each user, click the slider icon → assign LLM profiles, knowledge+# bases, and skills. Save. The user can now sign in and start working.+```++## What the admin sees++- **Full Settings page** at `/settings` — manage LLM / embedding / search providers, API keys, model catalogs, and runtime "Apply".+- **User management** at `/admin/users` — create, promote, demote, and delete accounts. The public `/register` endpoint is automatically closed once the first admin exists; further accounts go through `POST /api/v1/auth/users` (admin-only).+- **Grant editor** — for each non-admin user, pick the model profiles, knowledge bases, and skills they may use. Grants carry **logical IDs only**; API keys never cross the grant boundary.+- **Audit trail** — every grant change and assigned-resource access is appended to `multi-user/_system/audit/usage.jsonl`.++## What ordinary users get++- **Isolated workspace** under `multi-user/<uid>/` — their own chat history (`chat_history.db`), memory, notebooks, and personal knowledge bases. Nothing is shared by default.+- **Read-only access** to admin-assigned knowledge bases and skills, surfaced inline next to their own resources with an "Assigned by admin" badge.+- **Redacted Settings page** — only theme, language, and a summary of granted models. API keys, base URLs, and provider endpoints are never returned for non-admin requests.+- **Scoped LLM** — chat turns are routed through the admin-assigned model. If no LLM is granted, the turn is rejected up-front (no silent fallback to the admin's keys).++## Workspace layout++```text+multi-user/+├── _system/+│ ├── auth/users.json # Hashed credentials, roles+│ ├── auth/auth_secret # JWT signing secret (auto-generated)+│ ├── grants/<uid>.json # Per-user resource grants (admin-managed)+│ └── audit/usage.jsonl # Audit trail+└── <uid>/+ ├── user/+ │ ├── chat_history.db+ │ ├── settings/interface.json+ │ └── workspace/{chat,co-writer,book,...}+ ├── memory/+ └── knowledge_bases/...+```++## Configuration reference++| Setting | Required | Description |+|---------|----------|-------------|+| `data/user/settings/auth.json: enabled` | Yes | Set to `true` to enable multi-user auth. Default `false` (single-user mode — admin paths everywhere). |+| `multi-user/_system/auth/auth_secret` | Recommended | JWT signing secret. Auto-generated on first authenticated boot if missing. |+| `data/user/settings/auth.json: token_expire_hours` | No | JWT lifetime; defaults to `24`. |+| `data/user/settings/auth.json: cookie_secure` | HTTPS / cross-site auth | Set `true` to use `SameSite=None; Secure` cookies. Keep `false` for local HTTP. |+| `data/user/settings/auth.json: username` / `password_hash` | No | Optional headless single-user bootstrap credential. Leave blank when using browser registration. |+| `data/user/settings/system.json` | No | `deeptutor start` derives frontend auth flags, public API base, and CORS origins from runtime settings. |++## Important caveats++> ⚠️ **PocketBase mode (`integrations.pocketbase_url` set) is single-user only.** The default PocketBase schema has no `role` field on `users` (every login resolves to `role=user`, no admin can be created), and `sessions` / `messages` / `turns` queries are not filtered by `user_id`. Multi-user deployments must keep `integrations.pocketbase_url` blank and use the default JSON/SQLite backend.++> ⚠️ **Single-process recommendation.** The first-user-becomes-admin promotion is protected by an in-process `threading.Lock`. Multi-worker deployments should provision the first admin offline (start with `auth.json.enabled=false`, register the admin via the bootstrap flow, then set `auth.json.enabled=true`) or back the user store with an external system.++## Production checklist++- ✅ Set a strong `auth_secret` and back it up+- ✅ Set `cookie_secure: true` in `auth.json` to require HTTPS for the session cookie+- ✅ Put DeepTutor behind a reverse proxy (Caddy, nginx, Traefik) with TLS termination+- ✅ Set `next_public_api_base_external` in `system.json` so the frontend bundle knows where to find the backend+- ✅ Set `cors_origins` to the exact frontend origin when auth is enabled and Web/API are cross-origin+- ✅ Back up `multi-user/` regularly++## Caddyfile example++```caddyfile+deeptutor.example.com {+ reverse_proxy /api/* localhost:8001+ reverse_proxy localhost:3782+}+```++Then in `data/user/settings/system.json`:++```json+{+ "next_public_api_base_external": "https://deeptutor.example.com",+ "cors_origins": ["https://deeptutor.example.com"]+}+```++`public_api_base` is accepted as a compatibility alias and is normalized into+`next_public_api_base_external` on save.++And in `data/user/settings/auth.json`:++```json+{+ "enabled": true,+ "token_expire_hours": 24,+ "cookie_secure": true+}+```++## Common errors++### `404 /register` after enabling auth++The frontend bundle may be cached. With Docker, recreate the container. From source, restart `deeptutor start` after editing `auth.json`.++### First login works but no admin link++Confirm `multi-user/_system/auth/users.json` has `"role": "admin"` on the first user. If not, manually set it and restart.++### `Cannot decode JWT` after restart++`auth_secret` was lost or regenerated. Restore from backup, or accept the regenerated secret and ask all users to log in again.++## Headless single-user bootstrap++For automation where no human can register in a browser, set credentials directly in `auth.json`:++```json+{+ "enabled": true,+ "username": "alice",+ "password_hash": "<bcrypt-hash>",+ "token_expire_hours": 24+}+```++Generate the hash:++```python+import bcrypt+print(bcrypt.hashpw(b"your-password", bcrypt.gensalt()).decode())+```++Then `deeptutor start` and log in with `alice` + your-password.++More fixes: [**Troubleshooting**](/docs/get-started/troubleshooting/).diff --git a/site/src/content/docs/docs/get-started/providers.md b/site/src/content/docs/docs/get-started/providers.mdnew file mode 100644index 000000000..b5183e0cf--- /dev/null+++ b/site/src/content/docs/docs/get-started/providers.md@@ -0,0 +1,157 @@+---+title: Provider Configuration+---+++DeepTutor currently ships 32 LLM provider bindings, 12 embedding provider bindings, and 7 active search providers (plus an explicit `none` option). Configure them through the Web Settings page, `deeptutor init`, `data/user/settings/model_catalog.json`, or process environment variables. Project-root `.env` files are not auto-loaded by the runtime.++## LLM Providers++| Provider | Binding | Default Base URL |+| :---------------------- | :-------------------- | :-------------------------------------------------------- |+| AiHubMix | `aihubmix` | `https://aihubmix.com/v1` |+| Anthropic | `anthropic` | `https://api.anthropic.com/v1` |+| Azure OpenAI | `azure_openai` | — |+| BytePlus | `byteplus` | `https://ark.ap-southeast.bytepluses.com/api/v3` |+| BytePlus Coding Plan | `byteplus_coding_plan`| `https://ark.ap-southeast.bytepluses.com/api/coding/v3` |+| Custom (OpenAI-compat) | `custom` | — |+| Custom Anthropic | `custom_anthropic` | — |+| DashScope (Qwen) | `dashscope` | `https://dashscope.aliyuncs.com/compatible-mode/v1` |+| DeepSeek | `deepseek` | `https://api.deepseek.com` |+| Gemini | `gemini` | `https://generativelanguage.googleapis.com/v1beta/openai/`|+| GitHub Copilot | `github_copilot` | `https://api.githubcopilot.com` |+| Groq | `groq` | `https://api.groq.com/openai/v1` |+| llama.cpp | `llama_cpp` | `http://localhost:8080/v1` |+| LM Studio | `lm_studio` | `http://localhost:1234/v1` |+| MiniMax | `minimax` | `https://api.minimax.io/v1` |+| MiniMax Anthropic | `minimax_anthropic` | `https://api.minimax.io/v1` |+| Mistral | `mistral` | `https://api.mistral.ai/v1` |+| Moonshot (Kimi) | `moonshot` | `https://api.moonshot.ai/v1` |+| Ollama | `ollama` | `http://localhost:11434/v1` |+| NVIDIA NIM | `nvidia_nim` | — |+| OpenAI | `openai` | `https://api.openai.com/v1` |+| OpenAI Codex | `openai_codex` | `https://chatgpt.com/backend-api` |+| OpenRouter | `openrouter` | `https://openrouter.ai/api/v1` |+| OpenVINO Model Server | `ovms` | `http://localhost:8000/v3` |+| Qianfan (Ernie) | `qianfan` | `https://qianfan.baidubce.com/v2` |+| SiliconFlow | `siliconflow` | `https://api.siliconflow.cn/v1` |+| Step Fun | `stepfun` | `https://api.stepfun.com/v1` |+| vLLM | `vllm` | `http://localhost:8000/v1` |+| VolcEngine | `volcengine` | `https://ark.cn-beijing.volces.com/api/v3` |+| VolcEngine Coding Plan | `volcengine_coding_plan`| `https://ark.cn-beijing.volces.com/api/coding/v3` |+| Xiaomi MIMO | `xiaomi_mimo` | `https://api.xiaomimimo.com/v1` |+| Zhipu AI (GLM) | `zhipu` | `https://open.bigmodel.cn/api/paas/v4` |++### Configuration++```dotenv+LLM_BINDING=openai+LLM_MODEL=gpt-4o-mini+LLM_API_KEY=sk-xxx+LLM_HOST=https://api.openai.com/v1+```++::: tip+Any OpenAI-compatible API works with the `openai` or `custom` binding. Set `LLM_HOST` to your provider's base URL.+:::++## Embedding Providers++| Provider | Binding | Model Example | Default Dim |+| :------------------- | :------------ | :------------------------ | :---------: |+| OpenAI | `openai` | `text-embedding-3-large` | 3072 |+| Gemini | `gemini` | `gemini-embedding-001` | 3072 |+| Azure OpenAI | `azure_openai`| deployment name | — |+| Cohere | `cohere` | `embed-v4.0` | 1024 |+| Jina | `jina` | `jina-embeddings-v3` | 1024 |+| Ollama | `ollama` | `nomic-embed-text` | 768 |+| vLLM / LM Studio | `vllm` | Any embedding model | — |+| SiliconFlow | `siliconflow` | `Qwen/Qwen3-Embedding-8B` | 4096 |+| Aliyun DashScope | `aliyun` | `qwen3-vl-embedding` | 2560 |+| OpenRouter | `openrouter` | provider-dependent | — |+| Any OpenAI-compatible| `custom` | — | — |+| Custom OpenAI SDK | `custom_openai_sdk` | — | — |++### Configuration++`EMBEDDING_HOST` must be the full embedding endpoint URL, not just the provider base URL.++```dotenv+EMBEDDING_BINDING=openai+EMBEDDING_MODEL=text-embedding-3-large+EMBEDDING_API_KEY=sk-xxx+EMBEDDING_HOST=https://api.openai.com/v1/embeddings+EMBEDDING_DIMENSION=+```++::: warning+Changing the embedding model after creating a knowledge base will cause a mismatch. DeepTutor detects this and warns you — rebuild the knowledge base if you switch models.+:::++## Search Providers++| Provider | Env Key | Notes |+| :---------- | :------------------- | :------------------------------- |+| Brave | `BRAVE_API_KEY` | Recommended, free tier available |+| Tavily | `TAVILY_API_KEY` | |+| Serper | `SERPER_API_KEY` | |+| Jina | `JINA_API_KEY` | |+| SearXNG | — | Self-hosted, no API key needed |+| DuckDuckGo | — | No API key needed |+| Perplexity | `PERPLEXITY_API_KEY` | Requires API key |+| None | — | Explicitly disables web search |++### Configuration++```dotenv+SEARCH_PROVIDER=brave+SEARCH_API_KEY=your-api-key+```++Search is optional — DeepTutor works without it. When configured, the `web_search` tool becomes available in Chat and other capabilities. Older `exa`, `baidu`, and `openrouter` search settings are treated as deprecated compatibility values rather than recommended new choices.++## Local Models++DeepTutor works with locally-hosted models through several providers:++### Ollama++```dotenv+LLM_BINDING=ollama+LLM_MODEL=llama3.1+LLM_HOST=http://localhost:11434/v1+LLM_API_KEY=ollama++EMBEDDING_BINDING=ollama+EMBEDDING_MODEL=nomic-embed-text+EMBEDDING_HOST=http://localhost:11434/v1+EMBEDDING_API_KEY=ollama+EMBEDDING_DIMENSION=768+```++### LM Studio++```dotenv+LLM_BINDING=lm_studio+LLM_MODEL=your-model-name+LLM_HOST=http://localhost:1234/v1+LLM_API_KEY=lm-studio+```++### vLLM++```dotenv+LLM_BINDING=vllm+LLM_MODEL=your-model-name+LLM_HOST=http://localhost:8000/v1+LLM_API_KEY=token-abc123+```++### llama.cpp++```dotenv+LLM_BINDING=llama_cpp+LLM_MODEL=your-model-name+LLM_HOST=http://localhost:8080/v1+LLM_API_KEY=not-needed+```diff --git a/site/src/content/docs/docs/get-started/pypi.md b/site/src/content/docs/docs/get-started/pypi.mdnew file mode 100644index 000000000..53c694e78--- /dev/null+++ b/site/src/content/docs/docs/get-started/pypi.md@@ -0,0 +1,142 @@+---+title: Install from PyPI+description: Option 1 — the smoothest path. pip install deeptutor, init, start.+---++The PyPI install is the smoothest path. **Full local Web app + CLI, no clone required.** Needs **Python 3.11+** and a **Node.js 20+** runtime on PATH — the packaged Next.js standalone server is spawned by `deeptutor start`.++## Install++```bash+mkdir -p my-deeptutor && cd my-deeptutor+pip install -U deeptutor+deeptutor init # prompts for ports + LLM provider + optional embedding+deeptutor start # starts backend + frontend; keep the terminal open+```++`deeptutor init` prompts for:++- **Backend port** (default `8001`)+- **Frontend port** (default `3782`)+- **LLM provider** / base URL / API key / model+- **Optional embedding provider** for Knowledge Base / RAG++After `deeptutor start`, open the frontend URL printed in the terminal — by default <http://127.0.0.1:3782>. Press `Ctrl+C` in that terminal to stop both backend and frontend.++> Skipping `deeptutor init` is fine for a quick trial; the app boots with default ports and empty model settings. Configure them later in **Settings → LLM**.++## Trying the v1.4.0 beta++PyPI normalizes `1.4.0-beta` → `1.4.0b0`, so plain `pip install -U deeptutor` stays on stable. To opt in:++```bash+pip install --pre -U deeptutor+# or pin exactly:+pip install -U deeptutor==1.4.0b0+```++## Where things live++The workspace lives under the directory you launched from (the `data/` folder appears there on first start). Override with:++```bash+DEEPTUTOR_HOME=/opt/deeptutor deeptutor start+# or+deeptutor start --home /opt/deeptutor+```++Layout (created on first init):++```text+my-deeptutor/+└── data/+ └── user/+ ├── settings/+ │ ├── system.json+ │ ├── auth.json+ │ ├── integrations.json+ │ ├── interface.json+ │ ├── model_catalog.json+ │ ├── main.yaml+ │ └── agents.yaml+ ├── memory/+ └── workspace/+```++See [**Configuration Reference**](#config-files-under-datausersettings) below for what each file controls.++## What `deeptutor` can do once installed++Pop into the CLI any time without leaving the workspace:++```bash+deeptutor chat # interactive REPL+deeptutor run chat "Explain the Fourier transform" # one-shot+deeptutor kb create my-kb --doc textbook.pdf # build a KB+deeptutor memory show # inspect memory+deeptutor config show # current config+```++Full surface: [**DeepTutor CLI**](/docs/cli/).++## Updating++```bash+pip install --upgrade deeptutor+deeptutor start+```++Workspace is preserved across upgrades.++## Config files under `data/user/settings/`++Everything under `data/user/settings/` is plain JSON / YAML. The **Settings** page in the browser is the recommended editor.++| File | Purpose |+|------|---------|+| `model_catalog.json` | LLM, embedding, and search provider profiles; API keys; active models |+| `system.json` | Backend / frontend ports, public API base, CORS, SSL verification, attachment directory |+| `auth.json` | Optional auth toggle, username, password hash, token / cookie settings |+| `integrations.json` | Optional PocketBase and sidecar integration settings |+| `interface.json` | UI language / theme / sidebar preferences |+| `main.yaml` | Runtime behavior defaults and path injection |+| `agents.yaml` | Capability / tool temperature and token settings |++> Project-root `.env` is **not** read as an application config file. Configure providers from **Settings → LLM** in the browser, or by editing `model_catalog.json` directly.++## Common errors++### `python: command not found` on macOS++```bash+python3 -m pip install -U deeptutor+python3 -m deeptutor init # or just `deeptutor init` if entry point is on PATH+```++### Node.js not on PATH++`deeptutor start` spawns the packaged Next.js server, which needs `node` on PATH. Install Node 20+ from <https://nodejs.org> or via `brew install node@22`.++### Port `3782` (or `8001`) already in use++```bash+lsof -i :3782 # macOS+ss -ltnp | grep :3782 # Linux+```++Kill it or change the port via `deeptutor init` re-run.++### LLM provider 401 Unauthorized++API key was rejected. Re-enter it in **Settings → LLM**, or:++```bash+deeptutor init # re-runs the wizard, preserves the workspace+```++For more, see [**Troubleshooting**](/docs/get-started/troubleshooting/).++## Next++- [**Explore DeepTutor**](/docs/explore/) — tour the running app+- [**Multi-User Deployment**](/docs/get-started/multi-user/) — turn it into a team serverdiff --git a/site/src/content/docs/docs/get-started/troubleshooting.md b/site/src/content/docs/docs/get-started/troubleshooting.mdnew file mode 100644index 000000000..b8b49fd0f--- /dev/null+++ b/site/src/content/docs/docs/get-started/troubleshooting.md@@ -0,0 +1,337 @@+---+title: Troubleshooting+description: Common errors across install paths, with copy-pasteable fixes.+---++If your install isn't behaving, find your symptom below. Errors are grouped by category. The fixes are tested against the current `main` branch.++## Ports and processes++### `Address already in use :3782` (or :8001)++Something else is bound to the port. Find it:++```bash+# macOS+lsof -i :3782++# Linux+ss -ltnp | grep :3782++# Windows PowerShell+Get-NetTCPConnection -LocalPort 3782+```++Kill it, or change the DeepTutor port by re-running the setup wizard or editing `data/user/settings/system.json`:++```bash+deeptutor init+```++```json+{+ "backend_port": 18001,+ "frontend_port": 4000+}+```++For a one-off process override, export environment variables in the shell before starting DeepTutor: `BACKEND_PORT=18001 FRONTEND_PORT=4000 deeptutor start`.++If you're using Docker, override the docker-specific ports instead:++```bash+DEEPTUTOR_DOCKER_FRONTEND_PORT=4000+DEEPTUTOR_DOCKER_BACKEND_PORT=18001+```++### Backend starts but frontend can't reach it++When you serve DeepTutor under a different hostname (cloud deployment, LAN+access, reverse proxy), the browser needs a backend URL it can reach.++Fix: open **Settings -> Network** or set `next_public_api_base_external` in+`data/user/settings/system.json` to the externally-reachable backend URL:++```json+{+ "next_public_api_base_external": "https://deeptutor.example.com:8001"+}+```++Then restart DeepTutor. `public_api_base` is accepted as a compatibility alias+and normalized into `next_public_api_base_external` on save.++If auth is enabled and the frontend origin differs from the API origin, also+set exact CORS origins:++```json+{+ "cors_origins": ["https://deeptutor.example.com"]+}+```++## LLM / Embedding providers++### `HTTPError 401 Unauthorized` during provider probe++The provider rejected your API key. Common gotchas:++- **OpenAI**: starts with `sk-` (project keys start with `sk-proj-`)+- **Anthropic**: starts with `sk-ant-`+- **Azure OpenAI**: also requires `LLM_API_VERSION` (set in Settings → LLM)+- **Google Gemini**: starts with `AIza`+- **Ollama / local OpenAI-compatible**: leave the API key blank or use `none`, set the base URL like `http://localhost:11434/v1`++Re-run `deeptutor init` to re-enter the key, or edit `data/user/settings/model_catalog.json` directly.++### `Failed to fetch /models` during setup++DeepTutor pings the provider's model-list endpoint to populate the model dropdown. If your network blocks it, you'll see this warning — it's **non-fatal**. The wizard falls back to a hardcoded list of common models and continues.++### `host.docker.internal` not resolving (Docker + local Ollama)++| Host OS | Use |+|---------|-----|+| macOS, Windows | `http://host.docker.internal:11434/v1` |+| Linux | `http://172.17.0.1:11434/v1` *(docker0 bridge)* or the host's LAN IP |++Linux users can also add `host.docker.internal` manually:++```yaml+# docker-compose.ghcr.yml+services:+ deeptutor:+ extra_hosts:+ - "host.docker.internal:host-gateway"+```++### `Embedding dimension mismatch` when querying a KB++You re-indexed a KB with a different embedding model. The cached dimension no longer matches.++Fix: in the Web UI, navigate to **Knowledge → select KB → Index versions → Re-index now**. Re-indexing isn't exposed as a CLI command.++### Embedding endpoint URL keeps coming back wrong++Some providers expect the **full embeddings path** in `EMBEDDING_HOST`, not the API root:++| Provider | Wrong | Right |+|----------|-------|-------|+| OpenAI | `https://api.openai.com/v1` | `https://api.openai.com/v1/embeddings` |+| Cohere | `https://api.cohere.ai` | `https://api.cohere.ai/v1/embed` |+| Voyage | `https://api.voyageai.com/v1` | `https://api.voyageai.com/v1/embeddings` |++## Knowledge Bases++### KB stuck in `indexing` state++Indexing happens in a background task. Check logs:++```bash+tail -f data/user/logs/ai_tutor_*.log | grep -i kb+```++Common causes: embedding provider returned 429 (rate limit — retry with smaller batches), embedding host unreachable (check connection), or PDF parser failed (check the file isn't password-protected).++### Reindex doesn't fix dimension mismatch++If the dimension mismatch error persists after reindex, the KB store may have a stale config file. From the CLI:++```bash+deeptutor kb delete physics --force+deeptutor kb create physics --doc chapter1.pdf+```++## Multi-user++### `401 Unauthorized` on every API call after restart++`AUTH_SECRET` was regenerated, invalidating every JWT.++Fix: pin `AUTH_SECRET` in `.env` so it persists across restarts:++```bash+AUTH_SECRET=$(openssl rand -hex 32)+```++### First user wasn't promoted to admin++Edit `multi-user/_system/auth/users.json`, set `"role": "admin"` for the user, restart.++### Login works but redirects back to `/login`++The auth cookie isn't being set, usually because:++1. `AUTH_COOKIE_SECURE=true` but you're not on HTTPS — set it `false` for local testing+2. `auth.json: cookie_secure=false` on a cross-site HTTPS deployment — set it `true` and restart so the cookie uses `SameSite=None; Secure`+3. The browser blocks third-party cookies and you're on a subdomain — serve frontend and API from the same hostname (e.g., both at `deeptutor.example.com`, frontend on `/`, API proxied at `/api/`)++## Docker++### Container exits immediately++```bash+docker logs deeptutor | tail -30+```++Most common: the host folders aren't pre-created.++```bash+mkdir -p data/user data/memory data/knowledge_bases+python scripts/docker_compose.py up -d+```++### Container is `Running` but `unhealthy`++Healthcheck calls `curl http://localhost:8001/` from inside the container. If backend startup is slow (~30s for first run, downloading model metadata), the healthcheck may flap.++Wait 60 seconds. If still unhealthy, check the supervisord state:++```bash+docker exec deeptutor supervisorctl status+docker exec deeptutor tail -40 /app/data/user/logs/ai_tutor_$(date +%Y%m%d).log+```++### npm install times out during build++The Next.js dep tree is large. Bump npm's network timeout:++```bash+npm config set fetch-timeout 600000+```++The official `Dockerfile` already sets this — only matters if you're building locally.++## Python install++### `Microsoft Visual C++ 14.0 is required` (Windows)++`tiktoken`, `chroma-hnswlib`, and a couple of other deps compile C extensions on Windows. Install [**Build Tools for Visual Studio**](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with the "Desktop development with C++" workload.++### `libolm not found` (Matrix E2EE only)++```bash+# macOS+brew install libolm++# Debian / Ubuntu+sudo apt install libolm-dev++# Reinstall the matrix-e2e extra+pip install -e ".[matrix-e2e]" --force-reinstall+```++### `pip install` is glacially slow++Use a local PyPI mirror or wheelhouse if you're on a slow connection. For China-based users:++```bash+pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple+```++### Conda environment activated but `python` still points elsewhere++PATH ordering can shadow conda's python. Verify:++```bash+which python+# /Users/you/miniconda3/envs/deeptutor/bin/python+```++If not, run `conda activate deeptutor` in a fresh shell.++## Frontend++### Frontend shows a blank page++Open the browser dev tools (⌥⌘I) and check the Console tab. Common causes:++- **CORS errors** — frontend at one origin, backend at another, and the backend isn't on the allowed-origins list. Edit `data/user/settings/system.json` and add your frontend origin to `cors_origins`.+- **404 on `/_next/...`** — the static bundle wasn't built. From source: `cd web && npm run build`.+- **Backend not reachable** — verify `curl http://localhost:8001/` returns JSON.++### "Failed to fetch" toast on every page++Same as above — usually backend isn't running or CORS / API base URL mismatch. Check the Network tab to see what URL the request goes to.++## TutorBot++### Bot says "missing SDK" on start++The gateway-specific SDK wasn't installed. The error message tells you which one. Install:++```bash+# Generic+pip install -e ".[tutorbot]"++# Or one specific (rarely needed)+pip install python-telegram-bot # Telegram+pip install slack-sdk # Slack+pip install zulip # Zulip+pip install matrix-nio # Matrix (no E2EE)+```++### Bot connects but doesn't respond++Check `allow_from` in the bot's channel config:++```yaml+telegram:+ enabled: true+ token: "..."+ allow_from: # empty = deny everyone+ - "*" # allow all+ # - "12345678" # or specific Telegram user IDs+```++By default `allow_from: []` denies everyone — you have to explicitly opt users in.++### Bot disconnects after a few minutes++Long-poll / WebSocket connections drop occasionally. The channel manager auto-reconnects with backoff, but if you see frequent drops:++- Check network stability between the host and the gateway provider+- For Telegram polling, increase `timeout` to 60 seconds+- For Matrix, verify the homeserver isn't aggressively timing out++See [**Explore TutorBot**](/docs/tutorbot/) for per-gateway debugging.++## Memory / RAG accuracy++### Chat ignores the attached KB++Make sure:++1. The KB is **attached** to the turn (not just listed in the picker — actually clicked into the active set)+2. The `rag` tool is **enabled** in Settings → Tools, or auto-enabled because a KB is attached+3. The KB has `status: ready` (not still indexing) — check via `deeptutor kb list`++### `read_memory` returns empty++L3 memory is empty until the consolidator has run at least once. Memory is consolidated:++- Every N turns (configurable in Settings → Memory)+- On user request via the Memory Workbench++Force a consolidation from the **Memory Workbench** (`/memory` → **Run consolidator**), or via the HTTP API:++```bash+curl -X POST http://localhost:8001/api/v1/memory/runs/start+```++### Memory writes are getting flagged as `unsafe_text`++The `write_memory` tool has a 240-char limit and content-safety filter. Trim your preference text or rephrase.++## Still stuck?++- Ask on [Discord](https://discord.gg/eRsjPgMU4t) — fastest channel+- File a bug at [github.com/HKUDS/DeepTutor/issues](https://github.com/HKUDS/DeepTutor/issues)+- Long-form question? Open a [Discussion](https://github.com/HKUDS/DeepTutor/discussions)++When asking for help, include:++- Your install path (PyPI / From Source / Docker / CLI-Only)+- Output of `deeptutor config show`+- Last 40 lines of `data/user/logs/ai_tutor_*.log`+- For Docker: `docker logs deeptutor | tail -40`diff --git a/site/src/content/docs/docs/index.md b/site/src/content/docs/docs/index.mdnew file mode 100644index 000000000..16179ad42--- /dev/null+++ b/site/src/content/docs/docs/index.md@@ -0,0 +1,27 @@+---+title: Documentation+description: Agent-native, open-source personalized tutoring — install paths, surfaces, TutorBot gateways, and CLI reference.+---++Welcome to the DeepTutor documentation. Pick a path below, or use the left sidebar.++## Where to start++- **[Get Started](/docs/get-started/)** — Four install paths: PyPI, From Source, Docker, CLI-Only.+- **[Explore DeepTutor](/docs/explore/)** — Tour the five core surfaces (Chat, Co-Writer, Book, Knowledge, Space) plus Memory and Settings.+- **[Explore TutorBot](/docs/tutorbot/)** — Connect persistent AI tutors to Telegram, Slack, Feishu, Matrix, and more.+- **[DeepTutor CLI](/docs/cli/)** — Drive every capability from the terminal, or hand it to an AI agent.+- **[Providers](/docs/get-started/providers/)** — Set up LLM, embedding, and search providers.++## What is DeepTutor++An open-source, agent-native learning companion. **Five modes** (Chat, Solve, Quiz, Research, Visualize) share one session, knowledge base, and citation history. **TutorBots** carry your context out to Telegram, Slack, Feishu, and other channels. A **three-layer Memory** with an inspectable workbench and a Memory Graph lets you audit *why* the system knows what it knows.++Built at HKU Data Intelligence Lab. Apache 2.0 license.++## Help & community++- [Discord](https://discord.gg/eRsjPgMU4t) — fastest place to ask questions+- [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — long-form Q&A and design proposals+- [Issue tracker](https://github.com/HKUDS/DeepTutor/issues) — bug reports and feature requests+- [SKILL.md](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) — the canonical handover document for AI agents driving DeepTutordiff --git a/site/src/content/docs/docs/tutorbot/dingtalk.md b/site/src/content/docs/docs/tutorbot/dingtalk.mdnew file mode 100644index 000000000..8aa63ec08--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/dingtalk.md@@ -0,0 +1,97 @@+---+title: DingTalk (钉钉)+description: TutorBot on DingTalk — Alibaba's enterprise chat, Stream Mode connection.+---++DingTalk (钉钉) is Alibaba's enterprise messaging product. DeepTutor uses the official `dingtalk-stream` SDK in **Stream Mode** — no public webhook needed.++## What you need++- A DingTalk organization with admin access+- Access to the [**DingTalk Open Platform**](https://open.dingtalk.com/)++## Step 1 — Create an app++1. Sign in to <https://open.dingtalk.com/>+2. **App Development** → **Create Application**+3. Pick **Internal Robot** (机器人) type+4. Fill in name, description, icon+5. Once created, copy **AppKey (Client ID)** and **AppSecret (Client Secret)** from the Credentials page++## Step 2 — Enable Stream Mode++1. In the app settings → **Stream Mode** → **Enable**+2. This avoids needing a public webhook URL++## Step 3 — Permissions++Request these scopes:+- Send messages+- Read message content+- (Optional) Voice-to-text for transcription++## Step 4 — Configure++```yaml+channels:+ dingtalk:+ enabled: true+ client_id: "dingxxxxxxxxxxxxxxxx"+ client_secret: "YOUR_CLIENT_SECRET"+ allow_from: []+```++## Step 5 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:dingtalk → connecting (stream mode)+[bot:my-math-tutor] channel:dingtalk → ready+```++## Config reference++| Field | Type | Required | Notes |+|-------|------|----------|-------|+| `enabled` | bool | yes | |+| `client_id` | string | yes | AppKey from DingTalk |+| `client_secret` | string | yes | AppSecret |+| `allow_from` | list[string] | optional | DingTalk user ids |++## Capabilities on DingTalk++| Feature | Supported |+|---------|-----------|+| DMs | ✅ |+| Group chats | ✅ |+| Markdown / rich text | ✅ |+| Action cards (interactive buttons) | ✅ |+| File uploads | ✅ |+| **Voice → text transcription** | ✅ *(built into DingTalk's speech-to-text)* |+| Mention routing | ✅ |++## Keep-alive specifics++The dingtalk-stream SDK manages the long-poll callback connection. On disconnect, it auto-reconnects.++## Common issues++### "Invalid client_secret"++Check DingTalk Open Platform → your app → Credentials. The secret can be rotated.++### Bot is "online" but doesn't respond++Confirm the bot is installed for the target users / departments. In DingTalk, robots have to be explicitly added to an organization before they can chat.++### Stream mode not connecting++Stream Mode requires the bot to be released (not just in draft). Click **Release** in the DingTalk app page.++## See also++- [**Feishu**](/docs/tutorbot/feishu/) — China's other major enterprise chat+- [**WeCom**](/docs/tutorbot/wecom/) — Tencent's enterprise messengerdiff --git a/site/src/content/docs/docs/tutorbot/discord.md b/site/src/content/docs/docs/tutorbot/discord.mdnew file mode 100644index 000000000..d3ea1a23d--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/discord.md@@ -0,0 +1,140 @@+---+title: Discord+description: TutorBot on Discord — Developer Portal registration, Gateway WebSocket connection, group policies.+---++Discord uses a **Gateway WebSocket** rather than polling. DeepTutor implements the gateway protocol directly (no `discord.py` dependency), with automatic reconnect on disconnect.++## What you need++- A Discord account+- A server you control (for testing the bot)+- 5 minutes on the Discord Developer Portal++## Step 1 — Create a Discord Application++1. Open <https://discord.com/developers/applications>+2. Click **New Application**+3. Give it a name (e.g., "Math Mentor")+4. Save++## Step 2 — Create a Bot user++1. In the left sidebar of your application: **Bot**+2. Click **Add Bot** → confirm+3. Under **TOKEN**, click **Reset Token**, then **Copy** — this is your `token`+4. Under **Privileged Gateway Intents**, enable:+ - **Message Content Intent** *(required to read message text)*+ - **Server Members Intent** *(recommended)*++## Step 3 — Invite the bot to your server++1. Left sidebar → **OAuth2** → **URL Generator**+2. Scopes: check `bot`+3. Bot Permissions: check `Send Messages`, `Read Message History`, `Attach Files`, `Embed Links`, `Add Reactions`+4. Copy the generated URL, open it in a new tab, pick a server, **Authorize**++## Step 4 — Configure++Edit `data/tutorbot/<bot_id>/agents.yaml`:++```yaml+channels:+ discord:+ enabled: true+ token: "YOUR_BOT_TOKEN"+ allow_from:+ - "USER_ID_1" # right-click user in Discord → Copy User ID (Dev Mode required)+ # - "*" # open+ group_policy: "mention" # or "open"+ intents: 37377 # default — covers messages + guilds+```++> **Dev Mode for User IDs:** In Discord settings → **Advanced** → enable **Developer Mode**. Then right-click any user → Copy User ID.++## Step 5 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:discord → connecting (gateway wss://...)+[bot:my-math-tutor] channel:discord → ready (heartbeat 41250ms)+```++## Config reference++| Field | Type | Required | Default | Notes |+|-------|------|----------|---------|-------|+| `enabled` | bool | yes | `false` | |+| `token` | string | yes | — | Bot token from the Developer Portal |+| `allow_from` | list[string] | yes | `[]` | User ids or `"*"` |+| `group_policy` | `"mention" \| "open"` | optional | `"mention"` | Group chat behavior |+| `gateway_url` | string | optional | `wss://gateway.discord.gg/?v=10&encoding=json` | Override only if you proxy |+| `intents` | int | optional | `37377` | Bitfield; default covers messages + guilds + members |++## Capabilities on Discord++| Feature | Supported |+|---------|-----------|+| DMs | ✅ |+| Guild text channels | ✅ |+| Threads | ⚠️ partial — bot replies in the parent channel for now |+| File uploads | ✅ *(up to 20 MB)* |+| File downloads | ✅ |+| Markdown / mention rendering | ✅ *(Discord's flavored markdown)* |+| Typing indicator | ✅ |+| Reactions | ⚠️ only outbound (bot adds reactions, doesn't respond to user reactions) |++## Group policy++| Policy | Behavior |+|--------|----------|+| `mention` | Bot only replies to messages that @mention it |+| `open` | Bot replies to every message in the channel *(loud — only for dedicated bot channels)* |++In DMs, the bot always responds regardless of policy.++## Keep-alive specifics++DeepTutor's Discord channel maintains the gateway WebSocket with a **heartbeat every ~41 seconds** (per Discord's protocol). On disconnect:++- Auto-reconnect after 5 seconds+- Session resume attempted first (no rejoining channels)+- Falls back to full reconnect if resume fails++You shouldn't need any external supervision — the channel manager handles all reconnection.++## Common issues++### `4014: Disallowed intent`++You requested an intent in the config that you didn't enable in the Developer Portal. Most common: Message Content Intent.++Fix: Developer Portal → your app → **Bot** → enable **Message Content Intent**.++### Bot is online but doesn't respond++Check `allow_from`. The same rule as Telegram: empty list denies everyone.++Also confirm Message Content Intent is enabled — without it, the bot sees messages with empty `content`.++### Messages > 2000 chars get cut off++Discord's per-message limit is 2000 chars. The bot auto-splits longer responses. For Deep Research outputs, consider sending the long response as a file:++```yaml+channels:+ discord:+ send_long_as_file: true # attach .md when response > 2000 chars+```++### 429 rate limits++Discord rate-limits per channel. If your bot sends many messages quickly (e.g., a chatty `open` policy in a busy channel), you'll see 429s. The channel auto-retries with backoff but consider switching to `mention`.++## See also++- [**Telegram**](/docs/tutorbot/telegram/) — simpler gateway model for comparison+- [**Slack**](/docs/tutorbot/slack/) — also socket-mode, similar setup feeldiff --git a/site/src/content/docs/docs/tutorbot/email.md b/site/src/content/docs/docs/tutorbot/email.mdnew file mode 100644index 000000000..11dbc81bf--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/email.md@@ -0,0 +1,166 @@+---+title: Email+description: TutorBot over email — IMAP polling + SMTP replies, with explicit consent and full body parsing.+---++The Email channel turns your TutorBot into an asynchronous email correspondent. Users send mail to a configured inbox, the bot reads via IMAP, replies via SMTP. Useful for **async help desks** and for users who prefer email.++## What you need++- An email account (Gmail, Outlook, your own SMTP/IMAP server, etc.)+- App-password access *(or OAuth, see below)*+- 5 minutes of config++## Step 1 — Configure mail credentials++For **Gmail**:++1. Enable 2FA on the account+2. Create an [**App Password**](https://myaccount.google.com/apppasswords) (16-character single-use password)+3. Use that as the password in the config below++For **Outlook / Office 365**: Either an App Password (with 2FA enabled) or OAuth. App Passwords are simpler for personal use.++For **self-hosted** (Postfix, Maddy, etc.): use the account credentials directly.++## Step 2 — Configure++```yaml+channels:+ email:+ enabled: true+ consent_granted: true # MUST be explicit — privacy safeguard++ # IMAP (inbound)+ imap_host: "imap.gmail.com"+ imap_port: 993+ imap_username: "[email protected]"+ imap_password: "YOUR_APP_PASSWORD"+ imap_mailbox: "INBOX"+ imap_use_ssl: true++ # SMTP (outbound)+ smtp_host: "smtp.gmail.com"+ smtp_port: 587+ smtp_username: "[email protected]"+ smtp_password: "YOUR_APP_PASSWORD"+ smtp_use_tls: true+ smtp_use_ssl: false+ from_address: "[email protected]"++ # Behavior+ auto_reply_enabled: true+ poll_interval_seconds: 30 # IMAP check frequency+ mark_seen: true # mark messages as read after processing+ max_body_chars: 12000+ subject_prefix: "Re: "+ allow_from: # email addresses; [] = open, ["x@..."] = allowlist+ - "[email protected]"+```++## Step 3 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:email → connecting (imap.gmail.com:993)+[bot:my-math-tutor] channel:email → ready, polling every 30s+```++Send an email to `[email protected]` from your allowed address — within 30 seconds (or the next poll), you get an automated reply.++## Why `consent_granted` is required++Reading email is sensitive. The channel **refuses to start** unless `consent_granted: true` is set explicitly — a hard gate to prevent accidental email reading. This is a deliberate privacy safeguard.++## Config reference++| Field | Type | Required | Default |+|-------|------|----------|---------|+| `enabled` | bool | yes | `false` |+| `consent_granted` | bool | yes | `false` — must explicitly set `true` |+| `imap_host` | string | yes | — |+| `imap_port` | int | yes | `993` |+| `imap_username` | string | yes | — |+| `imap_password` | string | yes | — |+| `imap_mailbox` | string | optional | `"INBOX"` |+| `imap_use_ssl` | bool | optional | `true` |+| `smtp_host` | string | yes | — |+| `smtp_port` | int | yes | `587` |+| `smtp_username` | string | yes | — |+| `smtp_password` | string | yes | — |+| `smtp_use_tls` | bool | optional | `true` |+| `smtp_use_ssl` | bool | optional | `false` |+| `from_address` | string | optional | = `smtp_username` |+| `auto_reply_enabled` | bool | optional | `true` |+| `poll_interval_seconds` | int | optional | `30` |+| `mark_seen` | bool | optional | `true` |+| `max_body_chars` | int | optional | `12000` |+| `subject_prefix` | string | optional | `"Re: "` |+| `allow_from` | list[string] | optional | `[]` (open to anyone) |++## Capabilities on Email++| Feature | Supported |+|---------|-----------|+| Plain text bodies | ✅ |+| HTML bodies | ✅ *(converted to markdown)* |+| Attachments inbound | ✅ *(PDFs, images, text files)* |+| Attachments outbound | ✅ *(reply with files via SMTP)* |+| Threading | ✅ *(via `In-Reply-To` headers)* |+| Subject prefixing | ✅ *(`Re: ` by default)* |+| LaTeX in body | ⚠️ rendered as plain text; consider converting to PDF for math-heavy responses |++## Session model++Each unique sender email is treated as a separate session. Replies in the same email thread (matched by `In-Reply-To`) continue the same session.++This means a single user emailing from `[email protected]` always lands in the same DeepTutor session — perfect for ongoing async help.++## Keep-alive specifics++The Email channel uses a **background polling loop**:++- Every `poll_interval_seconds`, the channel logs in via IMAP, fetches unseen messages, processes them, marks them seen+- On IMAP disconnect, auto-reconnects on next poll+- SMTP connection is opened per-send (no persistent connection)++For high-volume use, set `poll_interval_seconds: 15` or lower. Below 10 seconds you may hit your provider's rate limits.++## Common issues++### Won't start — "consent_granted is required"++You forgot to set:++```yaml+consent_granted: true+```++This is intentional friction. Set it consciously.++### "Authentication failed" on Gmail / Outlook++You used your account password instead of an App Password. With 2FA enabled, regular passwords are blocked for IMAP/SMTP — must use a 16-char App Password.++### Too many replies / loop with another auto-responder++If two auto-responders email each other, you get a feedback loop. The channel detects loops by checking the `Auto-Submitted:` header — but if the other side doesn't set it, loops are possible. Defensive measures:++- Use `allow_from` to restrict who the bot replies to+- Set `auto_reply_enabled: false` and manually trigger replies from CLI++### IMAP folder not found++Some providers use different mailbox names (`INBOX` vs `Inbox` vs `[Gmail]/All Mail`). Check via the provider's webmail and update `imap_mailbox`.++### Replies marked as spam++Add a proper `from_address`, set up SPF/DKIM/DMARC records for your domain if self-hosted, or use a trusted SMTP relay (SendGrid, Mailgun) for outbound only.++## See also++- [**WhatsApp**](/docs/tutorbot/whatsapp/) — another bridge-style channel+- [**Explore TutorBot**](/docs/tutorbot/) — architecturediff --git a/site/src/content/docs/docs/tutorbot/feishu.md b/site/src/content/docs/docs/tutorbot/feishu.mdnew file mode 100644index 000000000..8a965d39a--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/feishu.md@@ -0,0 +1,145 @@+---+title: Feishu / Lark+description: TutorBot on Feishu (国内) / Lark (international) — WebSocket long-connection via lark-oapi SDK.+---++Feishu (飞书) is the most popular workplace chat in mainland China; Lark is its international counterpart. They share the same API. DeepTutor supports both via the official `lark-oapi` SDK over a long-lived WebSocket.++## What you need++- A Feishu / Lark developer account+- Access to the [**Feishu Open Platform**](https://open.feishu.cn/) (mainland) or [**Lark Open Platform**](https://open.larksuite.com/) (international)+- Optionally: a Feishu/Lark organization where you can install the bot++## Step 1 — Create an app++1. Open the relevant platform → **Create App** → **Custom App**+2. Fill in basic info (name, description, icon)+3. Once created, copy these from the **Credentials & Basic Info** page:+ - **App ID**+ - **App Secret**+ - **Verification Token**+ - **Encrypt Key**++## Step 2 — Enable bot capability++1. Left sidebar → **Features** → **Bot** → **Enable**+2. Configure the bot's display name and avatar++## Step 3 — Configure event subscription++1. Left sidebar → **Event Subscriptions** → **Subscribe to events**+2. Add events you care about:+ - `im.message.receive_v1` — receive direct messages+ - `im.message.message_read_v1` — track read receipts (optional)+3. **Enable Long Connection Mode** so you don't need a public webhook URL. This makes the bot use WebSocket instead of webhooks.++## Step 4 — Add permissions++Left sidebar → **Permissions & Scopes**:++- `im:message:send_as_bot` — send messages+- `im:resource` — read media attachments+- `contact:user.id:readonly` — resolve user ids++Then **Release** the version *(internal release for internal apps)*.++## Step 5 — Configure DeepTutor++```yaml+channels:+ feishu:+ enabled: true+ app_id: "cli_xxxxxxxxxxxxxxxx"+ app_secret: "YOUR_APP_SECRET"+ verification_token: "YOUR_VERIFICATION_TOKEN"+ encrypt_key: "YOUR_ENCRYPT_KEY"+ allow_from: []+ group_policy: "mention"+```++## Step 6 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:feishu → connecting (long-connection)+[bot:my-math-tutor] channel:feishu → ready (app_id=cli_xxx)+```++## Config reference++| Field | Type | Required | Notes |+|-------|------|----------|-------|+| `enabled` | bool | yes | |+| `app_id` | string | yes | `cli_...` |+| `app_secret` | string | yes | |+| `verification_token` | string | yes | Used for event signature verification |+| `encrypt_key` | string | yes | Used to decrypt incoming events |+| `allow_from` | list[string] | optional | User ids; `["*"]` open |+| `group_policy` | `"mention" \| "open"` | optional | Default `"mention"` |++## Capabilities on Feishu++| Feature | Supported |+|---------|-----------|+| DMs | ✅ |+| Group chats | ✅ |+| **Interactive cards** | ✅ *(rich Feishu card messages with buttons)* |+| Markdown | ✅ |+| File / image uploads / downloads | ✅ |+| Audio transcription | ✅ *(if `transcription_api_key` set)* |+| Reactions | ⚠️ outbound only |+| Mention routing | ✅ |++## Long-connection vs webhook mode++Feishu supports two delivery modes:++| Mode | Pros | Cons |+|------|------|------|+| **Long connection** *(recommended)* | No public IP needed; works from anywhere | One DeepTutor instance per app |+| Webhook | Multiple endpoints possible; standard request/response | Needs a publicly reachable URL with HTTPS |++DeepTutor uses long connection by default. To switch to webhooks (if you have load-balancing needs), you'd run a separate webhook receiver — not currently supported in stock DeepTutor.++## Keep-alive specifics++The lark-oapi SDK manages the WebSocket with auto-reconnect. A background thread runs the WebSocket listener and forwards events to DeepTutor's async bus.++If the bot disappears from Feishu (status shows offline):++```bash+deeptutor bot stop my-math-tutor+deeptutor bot start my-math-tutor+```++For persistent uptime, use systemd or Docker `restart: unless-stopped`.++## Common issues++### "Invalid app_secret" on startup++Double-check **App Secret** in Feishu's Credentials page — it can rotate. Also confirm you're on the right platform (`open.feishu.cn` for mainland, `open.larksuite.com` for international — secrets aren't transferable).++### Bot says it's online but no messages received++Two checks:++1. **Permissions** — `im:message:send_as_bot` and event subscriptions are added AND **released** (new version)+2. **Long connection mode** is enabled in Event Subscriptions++### Verification token mismatch++If you regenerated the verification token in Feishu, update the config and restart the bot. The token is signed into every incoming event for integrity.++### Encrypt key mismatch++Same as above — if you regenerated the encrypt key in Feishu (Settings → Event Subscriptions), update config + restart.++## See also++- [**WeCom**](/docs/tutorbot/wecom/) — Tencent's enterprise chat platform, similar registration UX+- [**DingTalk**](/docs/tutorbot/dingtalk/) — Alibaba's equivalent in enterprise chatdiff --git a/site/src/content/docs/docs/tutorbot/index.md b/site/src/content/docs/docs/tutorbot/index.mdnew file mode 100644index 000000000..9d418b920--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/index.md@@ -0,0 +1,274 @@+---+title: Explore TutorBot+description: TutorBot — persistent, multi-channel autonomous tutors. Architecture, lifecycle, keep-alive strategies, and a dedicated page per gateway.+---++A **TutorBot** is a persistent, autonomous AI tutor that lives in DeepTutor and connects to one or more **external chat gateways** (Telegram, Slack, Feishu, etc.) so your users can interact with it from wherever they already are.++This section is the operator's guide: how the system works, how to keep bots alive, and a **dedicated page for every gateway** with registration steps, config keys, and troubleshooting.++## Architecture in one diagram++```text+┌─────────────────────────────────────────────────────────────────────┐+│ DeepTutor server │+│ │+│ ┌─────────────────────────────────────────────────────────────┐ │+│ │ Bot orchestrator │ │+│ │ (agent loop powered by nanobot reasoning engine) │ │+│ └──────────┬──────────────────────────────────────────────────┘ │+│ │ │+│ ┌─────────┼─────────┐ │+│ ▼ ▼ ▼ │+│ ┌───┐ ┌─────┐ ┌───────┐ each bot is its own asyncio task │+│ │bot│ │ bot │ │ bot │ isolated workspace at │+│ │ A │ │ B │ │ C │ data/tutorbot/<bot_id>/ │+│ └─┬─┘ └──┬──┘ └───┬───┘ │+│ │ │ │ │+│ │ ┌───────┼──────────┼───────────────────────────────────┐ │+│ ▼ ▼ ▼ ▼ ▼ │+│ ┌──────────────────────────────────────────────────┐ │+│ │ Channel registry (12 gateways) │ │+│ └──────────────────────────────────────────────────┘ │+└────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬──┬──┬───┘+ │ │ │ │ │ │ │ │ │ │ │ │+ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼+ Telegram Discord Slack Matrix Zulip Feishu WeCom DingTalk QQ WA Email Mochat+```++Key properties:++- **One process** — Bots run as asyncio tasks inside the DeepTutor server. No separate process, no docker sidecar, no systemd unit per bot.+- **Many gateways per bot** — One bot can speak on Telegram **and** Slack **and** Matrix simultaneously.+- **Isolated workspaces** — Each bot has its own `agents.yaml`, soul template, skills, cron jobs, and local sessions database under `data/tutorbot/<bot_id>/`.+- **Shared memory** — All bots see the same user's L3 memory (`data/memory/L3/`), with per-channel L1 trace for source separation.+- **No restart required for channel reconnects** — Channel-level disconnects (e.g., transient network blip) auto-recover.++## Lifecycle++```bash+# Create+deeptutor bot create my-math-tutor \+ --name "Math Mentor" \+ --persona "Socratic tutor specializing in calculus and linear algebra" \+ --model gpt-4o++# Configure channels (edit data/tutorbot/my-math-tutor/agents.yaml)++# Start (forks into asyncio tasks for each enabled channel)+deeptutor bot start my-math-tutor++# Stop+deeptutor bot stop my-math-tutor++# List+deeptutor bot list+```++To delete a bot: stop it first, then remove its workspace directory at `data/tutorbot/<bot_id>/`.++You can also start/stop bots from the **`/agents`** Web UI route.++## Keeping bots alive++TutorBots live inside the DeepTutor server process. So **the question of "keeping the bot alive" reduces to "keeping the server alive"**.++| Deployment | How to keep it up |+|------------|-------------------|+| Local development | Just run `deeptutor start` in a terminal. Ctrl+C stops everything. |+| Docker | `docker compose up -d` (restart policy is `unless-stopped`). Auto-recovers on host reboot. |+| systemd / bare metal | Wrap `deeptutor serve` in a unit file. See [example below](#systemd-unit-example). |+| Kubernetes | Standard Deployment with a liveness probe on `/api/v1/system/info`. |++### systemd unit example++```ini+# /etc/systemd/system/deeptutor.service+[Unit]+Description=DeepTutor+After=network.target++[Service]+Type=simple+User=deeptutor+Group=deeptutor+WorkingDirectory=/opt/deeptutor+EnvironmentFile=/opt/deeptutor/.env+ExecStart=/opt/deeptutor/.venv/bin/deeptutor start+Restart=always+RestartSec=10++[Install]+WantedBy=multi-user.target+```++```bash+sudo systemctl enable deeptutor+sudo systemctl start deeptutor+sudo journalctl -fu deeptutor # follow logs+```++### Per-bot health monitoring++Bot status surfaces in two places:++- **`deeptutor bot list`** — shows running / stopped state for every bot+- **The Web UI's `/agents` page** — per-bot status panel with per-channel connection state++Channels report a heartbeat to the orchestrator internally; the Heartbeat system also drives proactive check-ins and scheduled tasks. If a channel goes offline for more than a few minutes, check the channel-specific page below for that gateway.++## The 12 supported gateways++Each gateway has its own dedicated page below with **registration**, **config keys**, **launch**, and **keep-alive specifics**:++| Gateway | Status | Connection model | Page |+|---------|--------|------------------|------|+| Telegram | ✅ Stable | Polling | [**Telegram**](/docs/tutorbot/telegram/) |+| Discord | ✅ Stable | WebSocket Gateway | [**Discord**](/docs/tutorbot/discord/) |+| Slack | ✅ Stable | Socket Mode | [**Slack**](/docs/tutorbot/slack/) |+| Matrix | ✅ Stable | HTTP Sync | [**Matrix**](/docs/tutorbot/matrix/) |+| Zulip | ✅ v1.3.9+ | Event Queue | [**Zulip**](/docs/tutorbot/zulip/) |+| Feishu (飞书) / Lark | ✅ Stable | WebSocket | [**Feishu**](/docs/tutorbot/feishu/) |+| WeCom (企业微信) | ✅ Stable | WebSocket | [**WeCom**](/docs/tutorbot/wecom/) |+| DingTalk (钉钉) | ✅ Stable | Stream Mode | [**DingTalk**](/docs/tutorbot/dingtalk/) |+| QQ | ✅ Stable | WebSocket | [**QQ**](/docs/tutorbot/qq/) |+| WhatsApp | ⚠️ Via Node.js bridge | WebSocket to bridge | [**WhatsApp**](/docs/tutorbot/whatsapp/) |+| Email | ✅ Stable | IMAP poll + SMTP | [**Email**](/docs/tutorbot/email/) |+| Mochat | ✅ Stable | Socket.IO / HTTP poll | [**Mochat**](/docs/tutorbot/mochat/) |++## Universal config shape++Every gateway uses the same outer schema in the bot's `agents.yaml`:++```yaml+agent:+ id: my-math-tutor+ name: Math Mentor+ persona: "Socratic tutor specializing in calculus..."+ model: gpt-4o++channels:+ telegram:+ enabled: true+ token: "..."+ allow_from: ["*"]++ slack:+ enabled: true+ bot_token: "xoxb-..."+ app_token: "xapp-..."+ reply_in_thread: true++ email:+ enabled: false+ # ... per-gateway fields+```++**Common fields** across all gateways:++| Field | Type | Required | Effect |+|-------|------|----------|--------|+| `enabled` | bool | yes | Whether to start this channel |+| `allow_from` | list[string] | yes | User-id / email allowlist (`["*"]` = open, `[]` = deny all) |+| `group_policy` | `"mention"` \| `"open"` | optional | For group chats: only respond to mentions vs every message |++Per-gateway fields are documented on their dedicated pages.++## Bot capabilities++Inside a bot conversation, the bot has access to:++- The same **seven capabilities** as the Web UI (Chat, Deep Solve, Quiz, Research, Animator, Visualize, Auto)+- All **tools** (RAG, web search, code execution, reasoning, paper search, etc.)+- **Attached Knowledge Bases** (configurable per-bot)+- **Skills** — reusable system-prompt fragments+- **Cron jobs** — scheduled tasks (e.g., "send a daily summary at 9 AM")+- **Memory** — L3 cross-surface profile++This means a TutorBot on Telegram can do everything you can do in the Web UI — research, quiz generation, code execution, etc. — without the user ever leaving Telegram.++## When to use TutorBot vs Web UI++| Use case | Surface |+|----------|---------|+| Solo deep-dive learning | Web UI |+| Quick on-the-go questions | TutorBot on Telegram / Slack |+| Team Q&A in a shared channel | TutorBot on Feishu / Slack / Discord channel |+| Async help via email | TutorBot on Email |+| Scheduled daily nudges / digests | TutorBot with cron jobs |+| Programmatic integration | DeepTutor [CLI](/docs/cli/) or [API](/docs/cli/server-api/) |++## Where state lives++```text+data/+├── tutorbot/+│ ├── my-math-tutor/+│ │ ├── agents.yaml # Channels + persona+│ │ ├── souls/ # Soul / personality templates+│ │ ├── skills/ # User-authored skill fragments+│ │ ├── cron/ # Scheduled task definitions+│ │ ├── media/ # Cached inbound/outbound attachments+│ │ ├── logs/ # Per-bot logs+│ │ └── sessions.db # Local chat session cache+│ └── helpdesk-bot/+│ └── ...+└── memory/ # Shared across all bots + Web UI+ ├── L1/+ ├── L2/+ └── L3/+```++## Required Python extras++Bots require the `[tutorbot]` extra (or the equivalent in `packaging/deeptutor-cli`):++```bash+# Full server + TutorBot+pip install -e ".[tutorbot]"++# CLI-only + TutorBot+pip install -e "./packaging/deeptutor-cli[tutorbot]"++# From PyPI (already includes tutorbot)+pip install deeptutor+```++Some specific gateways need extra system dependencies:++| Gateway | Extra needed |+|---------|--------------|+| Matrix (E2EE) | `[matrix-e2e]` + libolm system library |+| WhatsApp | Separate Node.js bridge (not Python) |++Check each gateway's page for details.++## Common patterns++### Pattern: study group on Slack++1. Create a bot: `deeptutor bot create study-helper --persona "Patient study group facilitator"`+2. Enable Slack with `group_policy: "mention"` so it only responds when @mentioned+3. Attach the course KB to the bot's config+4. Invite the bot to a Slack channel+5. Students ask questions — the bot retrieves from the KB and answers, citing sources++### Pattern: solo TG tutor++1. `deeptutor bot create my-tutor --persona "Personal calculus tutor"`+2. Enable Telegram with `allow_from: ["123456789"]` (your TG user id)+3. Optional cron: "every weekday at 8 AM, ask me what I want to work on today"+4. Chat normally on Telegram — gets the same memory / context as Web UI++### Pattern: enterprise helpdesk on Feishu++1. `deeptutor bot create helpdesk --persona "Friendly first-line IT helpdesk"`+2. Attach the internal docs KB+3. Enable Feishu with `group_policy: "open"` in the help channel, `mention` everywhere else+4. Configure `allow_from` to your org's verified user list++## See also++- [**DeepTutor CLI → bot**](/docs/cli/commands/#deeptutor-bot--tutorbot-lifecycle) — lifecycle commands+- [**Memory**](/docs/explore/memory/) — how bots share user memory+- Any gateway page above for setup detailsdiff --git a/site/src/content/docs/docs/tutorbot/matrix.md b/site/src/content/docs/docs/tutorbot/matrix.mdnew file mode 100644index 000000000..0e16e6703--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/matrix.md@@ -0,0 +1,187 @@+---+title: Matrix+description: TutorBot on Matrix — decentralized chat, with optional end-to-end encryption.+---++Matrix is the decentralized chat option. DeepTutor talks to any Matrix homeserver (matrix.org, your self-hosted Synapse, Conduit, Dendrite) via the standard client-server API.++End-to-end encryption is **optional** and split into its own install extra so most users don't pay the libolm dependency cost.++## What you need++- A Matrix account (on matrix.org or any homeserver)+- The bot's `access_token` from that account+- *(For E2EE)* `libolm` installed on your system++## Step 1 — Create a Matrix account for the bot++The bot needs its own Matrix account. Use any homeserver:++- **Public**: Element web app → matrix.org → Create Account+- **Self-hosted**: `register_new_matrix_user` (Synapse) or the equivalent for your server++For testing, matrix.org's public homeserver is fine.++## Step 2 — Get the access token++### Option A — From Element++1. Sign into Element as the bot user+2. **Settings** → **Help & About** → scroll to **Advanced**+3. Reveal **Access Token** and copy it++### Option B — From the REST API++```bash+curl -X POST https://matrix.org/_matrix/client/r0/login \+ -H "Content-Type: application/json" \+ -d '{+ "type": "m.login.password",+ "user": "math-bot",+ "password": "your-password"+ }'++# Response includes "access_token": "syt_..."+```++## Step 3 — Configure++```yaml+channels:+ matrix:+ enabled: true+ homeserver: "https://matrix.org" # or your self-hosted URL+ user_id: "@math-bot:matrix.org"+ access_token: "syt_xxxxxxxxxxxxxxxxxxxx"+ encryption_enabled: false # set true after installing matrix-e2e extra+ allow_from: [] # empty = anyone in joined rooms can talk to bot+ rooms: [] # specific room ids the bot should join, or [] = listen everywhere+```++## Step 4 — Install dependencies++Matrix support is in an optional install extra. Three layers:++| Goal | Install |+|------|---------|+| Base Matrix (no E2EE) | `pip install -e ".[matrix]"` |+| Matrix with E2EE | `pip install -e ".[matrix-e2e]"` *(also needs libolm)* |+| All TutorBot gateways including Matrix | `pip install -e ".[tutorbot]"` |++For E2EE, install **libolm** first:++```bash+# macOS+brew install libolm++# Debian / Ubuntu+sudo apt install libolm-dev++# Then the Python extra+pip install -e ".[matrix-e2e]"+```++## Step 5 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:matrix → connecting (homeserver=matrix.org)+[bot:my-math-tutor] channel:matrix → sync ok (next_batch=...)+[bot:my-math-tutor] channel:matrix → joined 3 rooms+```++## Inviting the bot to a room++Once the bot is running, invite it from any Matrix client:++```text+/invite @math-bot:matrix.org+```++The bot auto-accepts invitations and starts listening for messages in that room. To restrict which rooms the bot joins:++```yaml+channels:+ matrix:+ rooms:+ - "!abc123:matrix.org" # only auto-join these specific rooms+```++## Config reference++| Field | Type | Required | Default | Notes |+|-------|------|----------|---------|-------|+| `enabled` | bool | yes | `false` | |+| `homeserver` | url | yes | — | e.g., `https://matrix.org` |+| `user_id` | string | yes | — | `@bot:matrix.org` |+| `access_token` | string | yes | — | From login or Element |+| `encryption_enabled` | bool | optional | `false` | Requires `[matrix-e2e]` extra + libolm |+| `allow_from` | list[string] | optional | `[]` | Matrix user ids; `[]` = anyone in joined rooms |+| `rooms` | list[string] | optional | `[]` | Specific room ids; `[]` = listen in any room the bot is in |++## Capabilities on Matrix++| Feature | Supported |+|---------|-----------|+| Direct (1:1) chat | ✅ |+| Group rooms | ✅ |+| Markdown → HTML | ✅ *(rendered correctly in Element, Cinny, etc.)* |+| LaTeX math | ⚠️ requires `mathjs` client plugin in your Matrix client |+| File uploads | ✅ |+| File downloads | ✅ |+| End-to-end encryption | ✅ *(opt-in)* |+| Typing indicators | ✅ |+| Reactions | ⚠️ outbound only |++## End-to-end encryption++Once `encryption_enabled: true` + libolm + `[matrix-e2e]` extra:++- The bot generates its own device key on first launch+- For each E2EE room, the bot participates in key exchange via Megolm+- All messages are end-to-end encrypted including attachments++**Caveat**: the bot's reasoning still happens server-side in DeepTutor. The encryption is between the Matrix client (user) and the bot's Matrix process, but the message text reaches the LLM provider unencrypted (unless you've configured a local LLM).++If end-to-end-to-LLM privacy matters, use a local Ollama / vLLM with the bot.++## Keep-alive specifics++The Matrix channel uses the **`/sync` long-poll endpoint** with a 30-second timeout. The pattern:++1. Open `/sync?since=<last_batch>` with timeout=30000+2. Receive new events (or empty response after 30s)+3. Update `last_batch`, immediately re-poll++On disconnect:++- Network drops are transparent — the next `/sync` retries+- Auth errors (401) require manual intervention (token expired or invalidated)++For high uptime, run the DeepTutor server under a process supervisor (systemd, docker restart-policy). The channel itself handles transient failures.++## Common issues++### `M_UNKNOWN_TOKEN`++Your `access_token` was invalidated (logged out from another client, or the server rotated keys). Get a fresh token via Element settings or the REST login.++### Bot joins but doesn't respond in E2EE rooms++You enabled `encryption_enabled: true` without installing `[matrix-e2e]` extra. The bot connects but can't decrypt — install libolm + reinstall.++### Federation lag++If your bot is on `matrix.org` and you're chatting on a small self-hosted server, messages can take a few seconds to federate. Not a bug — federation latency.++### "User not in room" error sending replies++The bot was kicked or left the room. Re-invite from your Matrix client.++## See also++- [**Explore TutorBot**](/docs/tutorbot/) — overall architecture+- [Matrix specification](https://spec.matrix.org/) — the underlying protocoldiff --git a/site/src/content/docs/docs/tutorbot/mochat.md b/site/src/content/docs/docs/tutorbot/mochat.mdnew file mode 100644index 000000000..c41386c2d--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/mochat.md@@ -0,0 +1,103 @@+---+title: Mochat+description: TutorBot on Mochat — customer-support style chat panel with Socket.IO or HTTP polling.+---++[Mochat](https://github.com/microsoft/mochat) is an open-source customer-support / chat panel. DeepTutor's Mochat channel connects via **Socket.IO** (preferred) or **HTTP polling** as a fallback. Useful when you want a tutor bot embedded in your existing website's support widget.++## What you need++- A running Mochat instance (self-hosted or managed)+- A bot account with an access token (Claw Token)++## Step 1 — Create a bot in Mochat++1. Sign in to your Mochat admin panel+2. **Bots** → **Create**+3. Copy the bot's **Claw Token**++## Step 2 — Configure++```yaml+channels:+ mochat:+ enabled: true+ service_url: "https://mochat.example.com"+ claw_token: "YOUR_BOT_TOKEN"+ allow_from: [] # user ids; [] = open+ use_http_polling: false # fallback if Socket.IO unavailable+ polling_interval_ms: 1000+ delayed_message_timeout_s: 5+```++## Step 3 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:mochat → connecting (socket.io to mochat.example.com)+[bot:my-math-tutor] channel:mochat → ready+```++## Config reference++| Field | Type | Required | Default |+|-------|------|----------|---------|+| `enabled` | bool | yes | `false` |+| `service_url` | url | yes | — |+| `claw_token` | string | yes | — |+| `allow_from` | list[string] | optional | `[]` (open) |+| `use_http_polling` | bool | optional | `false` |+| `polling_interval_ms` | int | optional | `1000` |+| `delayed_message_timeout_s` | int | optional | `5` |++## Capabilities on Mochat++| Feature | Supported |+|---------|-----------|+| Customer chat panel messaging | ✅ |+| Group / room messaging | ✅ |+| Markdown | ✅ |+| File uploads | ✅ |+| Delayed message batching | ✅ *(for efficiency on fast user input)* |++## Delayed message batching++Mochat users often type messages in bursts (e.g., "Hi!\nQuick question.\nIs the bot online?"). To avoid generating one bot reply per fragment, the channel **batches messages** received within `delayed_message_timeout_s` (default 5s):++- First message arrives → start a timer+- More messages within timeout → append, restart timer+- Timer expires → bundle all messages into one user turn++Adjust `delayed_message_timeout_s` based on how chatty your users are.++## Keep-alive specifics++The Socket.IO connection auto-reconnects on drop. If Socket.IO repeatedly fails, the channel falls back to HTTP polling:++```yaml+use_http_polling: true+polling_interval_ms: 2000 # poll every 2 seconds+```++This trades latency for robustness — useful behind picky corporate proxies.++## Common issues++### "Cannot connect" but Mochat is up++Mochat sometimes requires the bot to be **approved** in the admin panel before its token is active. Check the bot status.++### Replies arrive but users don't see them++Mochat has channel-level visibility settings. Ensure the bot is added to the channels where users are chatting.++### Socket.IO version mismatch++If your Mochat is on an older Socket.IO version, force HTTP polling instead of debugging the version mismatch — `use_http_polling: true`.++## See also++- [**Explore TutorBot**](/docs/tutorbot/) — overall architecturediff --git a/site/src/content/docs/docs/tutorbot/qq.md b/site/src/content/docs/docs/tutorbot/qq.mdnew file mode 100644index 000000000..2e12a342f--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/qq.md@@ -0,0 +1,75 @@+---+title: QQ+description: TutorBot on QQ — Tencent's consumer messenger, via the official botpy SDK.+---++QQ is Tencent's flagship consumer messenger. DeepTutor uses Tencent's official **botpy** SDK over a WebSocket connection.++## What you need++- A [**QQ Bot Development Platform**](https://bot.q.qq.com/) account+- Tencent Cloud account (for some advanced features)++## Step 1 — Register a QQ bot++1. Sign in to <https://bot.q.qq.com/>+2. **Create New Bot** → fill in name and description+3. Copy **App ID** and **Secret**+4. Enable the message types you need: C2C (direct messages) and group messages++## Step 2 — Configure++```yaml+channels:+ qq:+ enabled: true+ app_id: "YOUR_APP_ID"+ secret: "YOUR_SECRET"+ allow_from: []+ msg_format: "plain" # or "markdown"+```++## Step 3 — Start++```bash+deeptutor bot start my-math-tutor+```++## Config reference++| Field | Type | Required | Notes |+|-------|------|----------|-------|+| `enabled` | bool | yes | |+| `app_id` | string | yes | From bot platform |+| `secret` | string | yes | From bot platform |+| `allow_from` | list[string] | optional | QQ user ids |+| `msg_format` | `"plain" \| "markdown"` | optional | Reply formatting style |++## Capabilities on QQ++| Feature | Supported |+|---------|-----------|+| C2C (direct) messages | ✅ |+| Group messages | ✅ |+| Markdown | ✅ *(if `msg_format: "markdown"`)* |+| File / image attachments | ✅ |+| Image generation in replies | ✅ |+| Mention routing | ✅ |++## Common issues++### Duplicate message handling++QQ's gateway occasionally redelivers messages. The channel keeps a deque of the last 1000 message ids and silently drops duplicates. If you see duplicates, the deque may have wrapped — restart the bot.++### "Auth failed" on connect++Wrong `app_id` / `secret`, or your bot wasn't approved for the requested message types. Check the QQ Bot platform.++### Markdown not rendering++QQ's markdown rendering varies by client version. Some clients render `**bold**`, others want `<b>bold</b>`. If users complain, try setting `msg_format: "plain"`.++## See also++- [**Explore TutorBot**](/docs/tutorbot/) — overall architecturediff --git a/site/src/content/docs/docs/tutorbot/slack.md b/site/src/content/docs/docs/tutorbot/slack.mdnew file mode 100644index 000000000..858bb2f21--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/slack.md@@ -0,0 +1,185 @@+---+title: Slack+description: TutorBot on Slack — Socket Mode app, thread-scoped sessions, channel and DM policies.+---++Slack is the most full-featured gateway: DMs, channel mentions, **thread-scoped sessions** (each thread becomes its own DeepTutor session), Slack-flavored markdown, file uploads, and acknowledgement reactions.++Connection is **Socket Mode** — no public IP or webhook required.++## What you need++- A Slack workspace where you can install apps (own or admin-blessed)+- 5 minutes at <https://api.slack.com/apps>++## Step 1 — Create the Slack app++1. Go to <https://api.slack.com/apps> → **Create New App** → **From scratch**+2. Name it (e.g., "Math Mentor"), pick the workspace+3. Once created, go to **Socket Mode** (left sidebar) → **Enable Socket Mode** *(toggle on)*+4. When prompted, generate an App-Level Token with `connections:write` scope and copy it — this is your **`app_token`** (starts with `xapp-`)++## Step 2 — Configure OAuth scopes++Still in your app:++1. Left sidebar → **OAuth & Permissions**+2. Under **Scopes** → **Bot Token Scopes**, add:+ - `chat:write` — send messages+ - `chat:write.public` — send to channels without joining+ - `files:write` — upload files+ - `reactions:write` — add reactions (`:eyes:` acknowledgement)+ - `users:read` — resolve user ids to names+ - `app_mentions:read` — receive @mentions+ - `im:history` — read DM history+ - `im:read` — read DM channel info+ - `channels:history` — read public channel history+ - `groups:history` — *(optional)* private channels+3. Click **Install to Workspace** → authorize+4. Copy the **Bot User OAuth Token** (starts with `xoxb-`) — this is your **`bot_token`**++## Step 3 — Subscribe to events++1. Left sidebar → **Event Subscriptions**+2. **Subscribe to bot events**:+ - `app_mention`+ - `message.im`+ - `message.channels` *(only if you want channel listening; otherwise skip)*++## Step 4 — Configure++```yaml+channels:+ slack:+ enabled: true+ mode: "socket" # the only mode supported+ bot_token: "xoxb-XXX..." # from OAuth & Permissions+ app_token: "xapp-XXX..." # from Socket Mode+ reply_in_thread: true # keep replies in the message thread+ react_emoji: "eyes" # reaction to acknowledge receipt+ allow_from: ["*"] # user ids; "*" = open+ group_policy: "mention" # in channels: only respond to mentions+ group_allow_from: [] # specific channel ids if group_policy=mention+ dm:+ enabled: true+ policy: "open" # in DMs: always respond, or "allowlist"+ allow_from: []+```++## Step 5 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:slack → connecting (socket mode)+[bot:my-math-tutor] channel:slack → ready+```++In Slack, DM the bot or @mention it in a channel.++## Config reference++| Field | Type | Required | Default | Notes |+|-------|------|----------|---------|-------|+| `enabled` | bool | yes | `false` | |+| `mode` | string | yes | `"socket"` | Only `socket` is supported |+| `bot_token` | string | yes | — | `xoxb-…` |+| `app_token` | string | yes | — | `xapp-…` (Socket Mode token) |+| `reply_in_thread` | bool | optional | `true` | Reply in thread vs new message |+| `react_emoji` | string | optional | `"eyes"` | Emoji name for ack reaction |+| `allow_from` | list[string] | yes | `[]` | User ids or `"*"` |+| `group_policy` | `"mention" \| "open"` | optional | `"mention"` | In channels |+| `group_allow_from` | list[string] | optional | `[]` | Channel ids (if you want to restrict to specific channels) |+| `dm.enabled` | bool | optional | `true` | |+| `dm.policy` | `"open" \| "allowlist"` | optional | `"open"` | |+| `dm.allow_from` | list[string] | optional | `[]` | Used when `policy=allowlist` |++## Thread-scoped sessions++This is the killer Slack feature: **each Slack thread becomes its own DeepTutor session**. When you @mention the bot in a channel:++1. Bot replies, opening a new thread+2. Subsequent replies in that thread feed into the same session (with all its history, attached KB, etc.)+3. Threads in different channels are different sessions+4. DMs are their own sessions (one per user)++This means a team can have many parallel ongoing tutor conversations in one channel without context bleed.++To turn this off (force every reply to start fresh):++```yaml+channels:+ slack:+ reply_in_thread: false+ # bonus: makes the bot reply directly in the channel, not in a thread+```++## Capabilities on Slack++| Feature | Supported |+|---------|-----------|+| DMs | ✅ |+| Channel mentions | ✅ |+| Threads (session-scoped) | ✅ |+| File uploads | ✅ |+| File downloads | ✅ |+| Markdown → mrkdwn | ✅ *(auto-converted by the channel)* |+| Code blocks | ✅ |+| LaTeX math | ⚠️ rendered as code blocks (Slack doesn't render LaTeX) |+| Reactions outbound | ✅ *(via `react_emoji`)* |+| Slash commands | ⚠️ not yet — use DMs/mentions |++## Markdown to mrkdwn++Slack uses its own flavored markdown ("mrkdwn"). DeepTutor's Slack channel auto-converts:++| Standard markdown | mrkdwn output |+|-------------------|---------------|+| `**bold**` | `*bold*` |+| `*italic*` | `_italic_` |+| `# heading` | `*heading*` (bold) |+| `` `code` `` | `` `code` `` |+| ` ```code``` ` | ` ```code``` ` |+| `[link](url)` | `<url|link>` |+| `- bullet` | `• bullet` |+| `> quote` | `> quote` |++## Common issues++### Bot says hi but never responds to followups++Check `reply_in_thread`:++```yaml+reply_in_thread: true+```++If true, the bot only listens in threads it started (the `thread_ts` matches). If you DM in a non-thread message after the initial response, the bot won't see it.++### "Not authorized" / 401 from Slack API++Token mismatch — make sure you put `xoxb-` token in `bot_token` and `xapp-` token in `app_token`. Easy to swap by accident.++### Bot doesn't respond in channels++Two requirements:+1. The bot must be **invited to the channel** (`/invite @bot`)+2. Your message must @mention the bot (`@math-mentor what is...`) if `group_policy: mention`++### Long messages get truncated++Slack messages cap at 40,000 chars (much longer than Telegram/Discord). DeepTutor doesn't split — but extremely long responses (e.g., 50+ page Deep Research outputs) should be sent as files instead.++## Keep-alive specifics++Socket Mode opens a single WebSocket to Slack. The channel:+- Sends pings every 30 seconds+- Auto-reconnects on drop, with backoff+- No external supervision needed++## See also++- [**Discord**](/docs/tutorbot/discord/) — similar developer-portal model+- [**Explore TutorBot**](/docs/tutorbot/) — overall architecturediff --git a/site/src/content/docs/docs/tutorbot/telegram.md b/site/src/content/docs/docs/tutorbot/telegram.mdnew file mode 100644index 000000000..16839a16b--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/telegram.md@@ -0,0 +1,193 @@+---+title: Telegram+description: Run a TutorBot on Telegram — registration via BotFather, config keys, and operational notes.+---++Telegram is the easiest gateway to wire up — there's no public IP requirement, no webhook signing, and the BotFather registration takes about a minute.++## What you need++- A Telegram account+- A chat with [@BotFather](https://t.me/BotFather)++That's it. No business verification, no developer console signup.++## Step 1 — Register a bot with BotFather++Open Telegram, search for `@BotFather`, start a chat. Then:++```text+You> /newbot++BotFather> Alright, a new bot. How are we going to call it?+ Please choose a name for your bot.++You> Math Mentor++BotFather> Good. Now let's choose a username for your bot.+ It must end in 'bot'. Like this, for example: TetrisBot.++You> hku_math_mentor_bot++BotFather> Done! Congratulations on your new bot.+ You will find it at t.me/hku_math_mentor_bot.++ Use this token to access the HTTP API:+ 123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11+```++**Copy that token.** You'll paste it into `agents.yaml` in a moment.++## Step 2 — Find your Telegram user id++You need your own user id to put in `allow_from` (otherwise the bot won't respond to anyone). The simplest way: chat with [@userinfobot](https://t.me/userinfobot), which replies with your id.++```text+You> hi++userinfobot> Id: 123456789+ First: Frank+ Last:+ Username: @frank+ Language: zh+```++## Step 3 — Configure your bot++Edit `data/tutorbot/<bot_id>/agents.yaml`:++```yaml+agent:+ id: my-math-tutor+ name: Math Mentor+ persona: "Socratic math tutor specializing in calculus and linear algebra."+ model: gpt-4o++channels:+ telegram:+ enabled: true+ token: "123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"+ allow_from:+ - "123456789" # your Telegram user id+ # - "*" # uncomment to open the bot to everyone (careful)+```++## Step 4 — Start the bot++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] starting...+[bot:my-math-tutor] channel:telegram → connecting+[bot:my-math-tutor] channel:telegram → ok (long-polling)+[bot:my-math-tutor] running.+```++Now open Telegram, search for `@hku_math_mentor_bot`, send `/start` — and you're talking to the bot.++## Config reference++| Field | Type | Required | Default | Notes |+|-------|------|----------|---------|-------|+| `enabled` | bool | yes | `false` | Start the channel |+| `token` | string | yes | — | HTTP API token from BotFather |+| `allow_from` | list[string] | yes | `[]` *(denies all)* | User ids or `"*"` for open |++## Capabilities on Telegram++| Feature | Supported |+|---------|-----------|+| Direct messages | ✅ |+| Group chats | ✅ *(bot must be added to the group + group_policy applies)* |+| Markdown rendering | ✅ *(via Telegram's markdown_v2 parser)* |+| LaTeX math | ⚠️ rendered as plain text — Telegram doesn't render `$...$` |+| File uploads | ✅ *(up to Telegram's 20 MB / 2 GB limit)* |+| File downloads | ✅ *(the bot can receive PDFs, images, voice messages)* |+| Audio transcription | ✅ *(if `transcription_api_key` is configured globally)* |+| Reply-in-thread | ⚠️ partial — Telegram has reply-to-message, not threads |++## Groups++To use the bot in a Telegram group:++1. Add the bot to the group (Add Member → search for `@your_bot`)+2. Disable **Group Privacy** in BotFather: `/mybots` → select bot → **Bot Settings** → **Group Privacy** → **Turn OFF**+3. Mention the bot to address it (`@hku_math_mentor_bot question?`)++Set `group_policy` in the config:++```yaml+channels:+ telegram:+ group_policy: "mention" # only respond when @mentioned+ # group_policy: "open" # respond to every message (chatty!)+```++## Keep-alive specifics++The Telegram connection uses **long polling** by default — the bot pulls updates from Telegram's servers in a long-lived loop. This is robust to network blips:++- A network drop just makes the next `getUpdates` call fail+- The channel retries with exponential backoff+- When connectivity returns, polling resumes++You don't need a public IP, webhook, or reverse proxy. Telegram's BotFather doesn't require any URL configuration on your end.++## Common issues++### Bot doesn't respond to my messages++99% of the time it's `allow_from`:++```yaml+allow_from:+ - "123456789" # your actual id, in quotes (it's a string field)+```++Empty `allow_from: []` means "deny everyone" — even you. Use `["*"]` to allow all.++### Bot doesn't respond in groups++Two things to check:++1. BotFather → `/mybots` → your bot → Group Privacy → **Disabled**+2. In config: `group_policy: "mention"` (set) and you actually `@mentioned` the bot in your message++### "Conflict: terminated by other getUpdates request"++You started the same bot in two places at once (e.g., `deeptutor bot start` twice, or two DeepTutor instances). Telegram allows only one polling client per token. Stop the duplicate.++### Messages > 4096 chars get cut off++Telegram messages are capped at 4096 chars. The bot auto-splits longer messages into multiple sends. For very long responses (e.g., Deep Research reports), prefer sending a file:++```yaml+channels:+ telegram:+ send_long_as_file: true # auto-attach .md when response > 4096 chars+```++## Audio messages++If you've set `TRANSCRIPTION_API_KEY` (and a transcription provider like Groq Whisper) in `.env`, the bot transcribes voice messages and treats them like text input. Otherwise voice messages are ignored.++## Files and images++When a user uploads a file or image:++- **Image** → Sent to the model as a vision input+- **PDF / DOCX** → Parsed and treated as an attachment (full text available via `read_source` tool)+- **Other** → Acknowledged but ignored++## Multi-tenant deployments++In multi-user mode, each user can have their own Telegram bot. Bot ids are scoped per user, so `alice` and `bob` can each have a `my-tutor` without collision.++For organization-wide bots (one bot shared by many users), keep the bot under the admin account but configure `allow_from` to a long list, or use `["*"]` with care.++## See also++- [**Explore TutorBot**](/docs/tutorbot/) — architecture and lifecycle+- [**CLI → bot commands**](/docs/cli/commands/#deeptutor-bot--tutorbot-lifecycle)diff --git a/site/src/content/docs/docs/tutorbot/wecom.md b/site/src/content/docs/docs/tutorbot/wecom.mdnew file mode 100644index 000000000..1adf55330--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/wecom.md@@ -0,0 +1,110 @@+---+title: WeCom (WeChat Work)+description: TutorBot on WeCom (企业微信) — enterprise messaging via the WebSocket AI Bot platform.+---++WeCom (企业微信 / WeChat Work) is Tencent's enterprise messaging product. DeepTutor integrates via the **AI Bot** platform with a WebSocket long-connection.++## What you need++- A WeCom organization with admin access+- The [`wecom-aibot-sdk`](https://pypi.org/project/wecom-aibot-sdk/) Python package+- 10 minutes in the WeCom admin console++## Step 1 — Install the SDK++WeCom support uses an optional Python package:++```bash+pip install wecom-aibot-sdk+```++If you started with `pip install -e ".[tutorbot]"`, this may already be in. Verify:++```bash+python -c "import wecom_aibot_sdk; print('ok')"+```++## Step 2 — Create the AI Bot++1. Sign in to <https://work.weixin.qq.com/>+2. **Applications & Mini Programs** → **AI Bot Platform**+3. **Create New Application** → select **AI Bot** type+4. Fill in name, description, departments allowed to use it+5. Copy **Bot ID** and **Secret**++## Step 3 — Configure++```yaml+channels:+ wecom:+ enabled: true+ bot_id: "YOUR_BOT_ID"+ secret: "YOUR_SECRET"+ allow_from: [] # optional restriction by user id+ welcome_message: "Hi! I'm your math tutor. Ask me anything."+```++## Step 4 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:wecom → connecting (ws://wecom...)+[bot:my-math-tutor] channel:wecom → ready+```++## Config reference++| Field | Type | Required | Notes |+|-------|------|----------|-------|+| `enabled` | bool | yes | |+| `bot_id` | string | yes | From AI Bot platform |+| `secret` | string | yes | From AI Bot platform |+| `allow_from` | list[string] | optional | WeCom user ids; `[]` allows anyone in your org |+| `welcome_message` | string | optional | Sent on first message from a new user |++## Capabilities on WeCom++| Feature | Supported |+|---------|-----------|+| Direct messages within enterprise | ✅ |+| Group chats | ✅ |+| Markdown | ✅ |+| File / image / voice | ✅ |+| External contacts (customers) | ⚠️ via WeCom's external contacts feature |+| Mention routing | ✅ |++## Keep-alive specifics++A background thread maintains the WebSocket. Reconnection is automatic on transient failures.++If the bot stays offline:++1. Check the AI Bot platform — has the bot been disabled?+2. Verify your DeepTutor server has outbound TLS access to WeCom servers+3. Restart: `deeptutor bot stop my-math-tutor && deeptutor bot start my-math-tutor`++## Common issues++### `ImportError: wecom_aibot_sdk`++```bash+pip install wecom-aibot-sdk+deeptutor bot start my-math-tutor+```++### Bot connects but doesn't respond++`allow_from` is the usual suspect. Also confirm the user sending messages is in the departments you granted access to in the AI Bot config.++### Multiple bots in same org++Each bot needs its own `bot_id` + `secret`. You can run multiple TutorBots in one DeepTutor server, each connecting to a different WeCom bot.++## See also++- [**Feishu**](/docs/tutorbot/feishu/) — ByteDance's enterprise chat platform+- [**Explore TutorBot**](/docs/tutorbot/) — overall architecturediff --git a/site/src/content/docs/docs/tutorbot/whatsapp.md b/site/src/content/docs/docs/tutorbot/whatsapp.mdnew file mode 100644index 000000000..41db10a60--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/whatsapp.md@@ -0,0 +1,152 @@+---+title: WhatsApp+description: TutorBot on WhatsApp — requires a separate Node.js bridge running Baileys (WhatsApp Web protocol).+---++WhatsApp is the odd one out. The official WhatsApp Business API has substantial friction (verified business, monthly fees, application process). Instead, DeepTutor's WhatsApp channel connects to a **separate Node.js bridge** that speaks WhatsApp Web's protocol — fast to set up, free, and doesn't require business verification.++## What you need++- A Node.js 18+ host (can be the same machine as DeepTutor, or separate)+- A WhatsApp account on a real phone+- ~5 minutes for the QR-code pairing flow++## Step 1 — Run the bridge++DeepTutor's repo includes a sample bridge under `multi-user/whatsapp-bridge/` using [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys). Or run any compatible bridge that exposes a WebSocket on a known port.++A minimal bridge looks like:++```javascript+// bridge.js+const { default: makeWASocket, useMultiFileAuthState } = require('@whiskeysockets/baileys')+const WebSocket = require('ws')++const wss = new WebSocket.Server({ port: 3001 })+let waSocket = null++async function start() {+ const { state, saveCreds } = await useMultiFileAuthState('./auth')+ waSocket = makeWASocket({ auth: state, printQRInTerminal: true })+ waSocket.ev.on('creds.update', saveCreds)+ waSocket.ev.on('messages.upsert', ({ messages }) => {+ wss.clients.forEach(client => client.send(JSON.stringify(messages[0])))+ })+}++wss.on('connection', (ws) => {+ ws.on('message', (raw) => {+ const { jid, text } = JSON.parse(raw)+ waSocket?.sendMessage(jid, { text })+ })+})++start()+```++Start it:++```bash+cd multi-user/whatsapp-bridge+npm install+node bridge.js+```++A QR code appears in the terminal. Open WhatsApp on your phone → **Settings → Linked devices → Link a device** → scan. Done.++## Step 2 — Configure DeepTutor++```yaml+channels:+ whatsapp:+ enabled: true+ bridge_url: "ws://localhost:3001" # where the bridge listens+ bridge_token: "" # optional, if your bridge requires auth+ allow_from: # phone numbers in E.164 format+ - "+85291234567"+```++## Step 3 — Start the bot++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:whatsapp → connecting (ws://localhost:3001)+[bot:my-math-tutor] channel:whatsapp → ready+```++Send a message to the **same phone number** that's logged into the bridge — the bridge relays it to DeepTutor, the bot replies through the bridge, the reply lands in WhatsApp.++## Config reference++| Field | Type | Required | Notes |+|-------|------|----------|-------|+| `enabled` | bool | yes | |+| `bridge_url` | url | yes | WebSocket URL of the bridge |+| `bridge_token` | string | optional | Auth token if your bridge requires it |+| `allow_from` | list[string] | optional | Phone numbers (E.164); `["*"]` = open |++## Capabilities on WhatsApp++| Feature | Supported |+|---------|-----------|+| Direct messages | ✅ |+| Group messages | ✅ *(bridge must support group routing)* |+| Markdown | ⚠️ basic — WhatsApp only renders `*bold*`, `_italic_`, `~strike~`, `` ` ` `` |+| File / image / audio | ✅ *(via bridge)* |+| LaTeX math | ❌ rendered as plain text |+| Voice notes | ✅ *(transcribed if `TRANSCRIPTION_API_KEY` is set)* |++## Keep-alive specifics++WhatsApp Web tokens expire periodically — typically when the phone is offline for ~2 weeks. When that happens:++- The bridge prints a new QR code+- You re-scan from your phone+- Sessions resume++Run the bridge as a managed process (`pm2`, systemd, supervisor) so it restarts on crash. The DeepTutor side auto-reconnects to the bridge's WebSocket if it drops.++## Why a bridge instead of the official API?++| Option | Friction | Cost | Restrictions |+|--------|----------|------|--------------|+| WhatsApp Business API (official) | Verified business + Meta approval | $0.005–0.10 per message | Template-only outbound outside 24h windows |+| WhatsApp Web bridge (this) | One QR scan | Free | Phone must stay online ~weekly |++The bridge is great for personal use and small teams. For production-grade business messaging, consider Twilio or 360dialog (official API resellers).++## Risks and policy++WhatsApp Web's terms allow automation of your own account, but they technically frown on bot-like usage. Practical risks:++- **Account ban** — rare for low-volume use; common if you spam+- **Rate limits** — WhatsApp may flag accounts sending too many messages per minute++If you're using DeepTutor's WhatsApp channel for any non-trivial deployment, use a dedicated phone number you control, not your personal one.++## Common issues++### Bridge keeps printing QR codes++The auth state isn't being persisted. Check that `./auth` directory is writable and isn't being wiped between restarts.++### "Bridge unreachable"++```bash+curl http://localhost:3001 2>&1 | head -1+# Should at least respond, even with 400 (it's a WS endpoint)+```++If `connection refused`, the bridge isn't running. If `cannot resolve host`, your `bridge_url` is wrong.++### Messages send but never arrive++Check the bridge's logs (`node bridge.js` stdout). WhatsApp Web sometimes silently drops messages when the bridge sends them too fast — add throttling in the bridge.++## See also++- [**Email**](/docs/tutorbot/email/) — another bridge-style integration (IMAP/SMTP)+- [Baileys docs](https://github.com/WhiskeySockets/Baileys) — bridge library referencediff --git a/site/src/content/docs/docs/tutorbot/zulip.md b/site/src/content/docs/docs/tutorbot/zulip.mdnew file mode 100644index 000000000..6412b1281--- /dev/null+++ b/site/src/content/docs/docs/tutorbot/zulip.md@@ -0,0 +1,131 @@+---+title: Zulip+description: TutorBot on Zulip — stream + topic addressing, KaTeX math rendering, since v1.3.9.+---++Zulip was added in **v1.3.9** (2026-05-09). It uses Zulip's event-queue long-polling and supports Zulip's distinctive **stream + topic** addressing.++## What you need++- A Zulip server (any version — Zulip Cloud or self-hosted)+- Admin access to create bots in your organization++## Step 1 — Create a bot++1. In Zulip, click the ⚙️ icon (top right) → **Organization** → **Bots & integrations**+2. Click **Add a new bot**+3. Bot type: **Generic bot**+4. Name: "Math Mentor"+5. Bot email: auto-generated, e.g., `[email protected]`+6. Click **Create bot**+7. **Download API key** or **Show API key** and copy++## Step 2 — Subscribe the bot to streams++By default, generic bots can be sent direct messages but won't see public streams unless you subscribe them. In the bot's settings: **Streams subscribed** → add the streams you want the bot to watch.++You can also do this from the config (the `subscribe_streams` field).++## Step 3 — Configure++```yaml+channels:+ zulip:+ enabled: true+ site: "https://your-zulip.example.com"+ email: "[email protected]"+ api_key: "YOUR_API_KEY"+ allow_from: ["*"]+ group_policy: "mention" # mention vs open in subscribed streams+ subscribe_streams:+ - "study-help"+ - "homework"+ timeout: 60.0 # event queue poll timeout, seconds+```++## Step 4 — Start++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:zulip → register event queue+[bot:my-math-tutor] channel:zulip → subscribed: [study-help, homework]+[bot:my-math-tutor] channel:zulip → ready (queue_id=q_abc)+```++## Config reference++| Field | Type | Required | Default | Notes |+|-------|------|----------|---------|-------|+| `enabled` | bool | yes | `false` | |+| `site` | url | yes | — | Your Zulip server |+| `email` | string | yes | — | Bot email from Zulip |+| `api_key` | string | yes | — | From bot creation page |+| `allow_from` | list[string] | optional | `[]` | User ids or emails; `["*"]` open |+| `group_policy` | `"mention" \| "open"` | optional | `"mention"` | In streams |+| `subscribe_streams` | list[string] | optional | `[]` | Streams to auto-subscribe |+| `timeout` | float | optional | `60.0` | Event-queue poll timeout (seconds) |++## Stream + topic addressing (Zulip-specific)++Zulip splits messages into **streams** (like channels) and **topics** (subjects within a stream). DeepTutor scopes sessions to **(stream, topic)** pairs:++- A new topic = a new DeepTutor session+- Same topic across days = same session, persistent memory+- Different topics in the same stream = different sessions++This is great for classroom use: each homework problem can have its own topic, the bot tracks each independently.++## Capabilities on Zulip++| Feature | Supported |+|---------|-----------|+| Direct messages | ✅ |+| Stream messages + topics | ✅ *(topic-scoped sessions)* |+| Markdown | ✅ |+| **LaTeX / KaTeX math** | ✅ *(Zulip renders `$$...$$` natively)* |+| File uploads/downloads | ✅ |+| Mention or open mode | ✅ |+| Reactions | ⚠️ outbound only |++## Keep-alive specifics++Zulip's **event-queue API** is a long-poll with auto-recovery:++- The bot calls `/api/v1/events?queue_id=...` with `timeout=60s`+- New events come back as JSON; empty response after timeout+- If `queue_id` expires (server restarts, idle too long), the bot auto-registers a new one++A background thread runs the listener and bridges events to DeepTutor's async bus. The thread runs until the bot is stopped.++## Common issues++### "Bad event queue id"++The queue expired (server restart or > 10 min idle). The channel auto-recovers — no action needed. If it keeps happening, your Zulip server might be unhealthy.++### Bot doesn't see stream messages++Did you subscribe it? Either via the Zulip UI (bot settings → Streams) or via the `subscribe_streams` config.++### Math doesn't render++The bot has to output math in Zulip's expected format:++```text+Inline: $x^2$++Display:+```math+\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}+```+```++DeepTutor's Zulip channel auto-converts standard `$...$` and `$$...$$` to Zulip's format.++## See also++- [**Explore TutorBot**](/docs/tutorbot/) — overall architecture+- [Zulip Bot API docs](https://zulip.com/api/) — referencediff --git a/site/src/content/docs/zh-cn/docs/cli/agent-handoff.md b/site/src/content/docs/zh-cn/docs/cli/agent-handoff.mdnew file mode 100644index 000000000..f52e17290--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/cli/agent-handoff.md@@ -0,0 +1,263 @@+---+title: 代理交接+description: 把 deeptutor CLI 交给 Claude Code、Codex、OpenCode、Hermes 或任何会用 tool 的 LLM —— 让它们来驱动。+---++DeepTutor 从设计之初就是为了 **被其他 agent 驱动** 的:turn 执行可以输出结构化 JSON,session 能跨进程恢复,受支持的 surface 都集中在一个 skill 文件里 —— 任何会用 tool 的 LLM 读完就能直接上手。++这一页就是那套 playbook。++## 基本套路++仓库根目录有一个 [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md)。这个文件是 **正式的交接文档**:它告诉 agent `deeptutor` 是什么、怎么调用、flag 怎么传、返回什么 JSON。++把 `SKILL.md` 丢给你选的 agent,它就能:++- 跑 capability(`deep_solve`、`deep_research`、`deep_question`、……)+- 管理知识库(`kb create`、`kb search`、`kb add`)+- 用 `--session` 跑长程多轮会话+- 把 JSON 输出管道给下游工具+- 在一个任务中途切换 capability 和 tool++## Claude Code++[Claude Code](https://docs.claude.com/en/docs/claude-code) 看到项目根目录有 `SKILL.md` 时会自动读它。++```bash+cd /your-project+# DeepTutor 的 SKILL.md 在 DeepTutor/SKILL.md;复制或软链过来:+ln -s /path/to/DeepTutor/SKILL.md ./SKILL.md++# 或者更简单:通过 Claude Code 的 allowed-skills 配置带进来+```++一旦 Claude Code 看到 `SKILL.md`,它就理解 CLI 了。你可以自然语言提示:++```text+> 给我做一个未来两周关于线性代数的学习计划。用 DeepTutor:+> 从 ./textbooks/ 里的 PDF 创建一个 KB,然后出 10 道测验题,+> 分布在三个难度上。+```++Claude Code 会把它翻译成:++```bash+deeptutor kb create linalg --docs-dir ./textbooks/++# 第一次出题 —— 开一个新 session,从 'done' 事件里抓 session id,+# 后两轮复用它。+SESSION_ID=$(deeptutor run deep_question "Linear algebra fundamentals" \+ --kb linalg \+ --config num_questions=4 --config difficulty=easy \+ --format json | jq -r 'select(.type=="done") | .metadata.session_id')++deeptutor run deep_question "Linear algebra eigenvectors" \+ --kb linalg --session "$SESSION_ID" \+ --config num_questions=3 --config difficulty=medium++deeptutor run deep_question "Linear algebra advanced theorems" \+ --kb linalg --session "$SESSION_ID" \+ --config num_questions=3 --config difficulty=hard+```++它用 `--session` 把三轮出题串在一起。++### 把 deeptutor CLI 接成 Claude Code 的 subagent++如果你想在 Claude Code 里有一个固定的 "学习 agent",永远走 `deeptutor`:++```yaml+# .claude/agents/study-agent.yaml+name: study-agent+description: Use this agent for any learning, study planning, or quiz generation task. It drives DeepTutor.+tools: [Bash, Read, Write]+system_prompt: |+ You are a study planner. You have access to the `deeptutor` CLI via the Bash tool.+ Read SKILL.md before doing anything else. Then build study plans, generate quizzes,+ and run research turns by calling `deeptutor run <capability> "..."` with the right+ flags. Always pass `--format json` for parsing.+```++## Codex(OpenAI Codex CLI)++Codex 走类似的套路。把 `SKILL.md` 放到项目根目录,然后提示:++```text+codex "Read SKILL.md, then run a deep research turn on transformer attention mechanisms. Use the 'papers' knowledge base if it exists; if not, just web search."+```++对于走 OAuth 的 provider(比如 OpenAI Codex 自己),DeepTutor 内置了登录命令:++```bash+deeptutor provider login openai-codex+# 浏览器打开做 OAuth,token 存到工作区+```++之后就可以用拿到的 token 通过 DeepTutor 使用 OpenAI Codex。++## OpenCode++[OpenCode](https://opencode.ai) 同样的玩法。把项目的 `SKILL.md` 加进来:++```bash+opencode init+ln -s /path/to/DeepTutor/SKILL.md ./SKILL.md+opencode "Plan a study session on quantum mechanics using deeptutor"+```++## Hermes / 通用 agent 框架++对于原生不认 `SKILL.md` 的 agent 框架(LangChain agent、AutoGen、自定义 loop),把 `deeptutor` 包成一个 tool 定义就行。一个最小化的 LangChain 封装:++```python+from langchain.tools import Tool+import subprocess+import json++def deeptutor_run(args_json: str) -> str:+ args = json.loads(args_json)+ cmd = [+ "deeptutor", "run",+ args["capability"],+ args["message"],+ "--format", "json",+ ]+ for tool in args.get("tools", []):+ cmd.extend(["--tool", tool])+ for kb in args.get("knowledge_bases", []):+ cmd.extend(["--kb", kb])+ if args.get("session_id"):+ cmd.extend(["--session", args["session_id"]])+ for key, value in args.get("config", {}).items():+ cmd.extend(["--config", f"{key}={json.dumps(value)}"])++ result = subprocess.run(cmd, capture_output=True, text=True)+ return result.stdout++deeptutor_tool = Tool(+ name="deeptutor_run",+ description=(+ "Run a DeepTutor capability. Args: JSON object with "+ "{capability, message, tools, knowledge_bases, session_id, config}. "+ "Returns one JSON event per line."+ ),+ func=deeptutor_run,+)+```++然后你的 agent loop 就可以直接用了。++## Session 交接 pattern++最强的一种用法:让 agent **在同一个 session 里串起多次 capability 调用**,让每个新的 turn 继承前一个的上下文。++```bash+# Step 1 —— 研究+SESSION_ID=$(deeptutor run deep_research "Survey 2026 papers on RAG" \+ --tool web_search --kb papers \+ --config mode=report --config depth=standard \+ --format json | \+ jq -r 'select(.type=="done") | .metadata.session_id')++# Step 2 —— 总结(同一 session,不同 capability)+deeptutor run chat "Summarize the top three findings as bullet points" \+ --session "$SESSION_ID" --format json++# Step 3 —— 出题(同一 session)+deeptutor run deep_question "The findings from this session" \+ --session "$SESSION_ID" \+ --config num_questions=5 \+ --format json+```++每一步都会继承:++- 完整对话历史+- 挂载的 KB+- tool 列表+- 用户语言偏好+- 记忆引用++这样使用 DeepTutor 的 agent 相当于拥有一个 **有状态的工作上下文**,可以横跨多次 tool 调用。++## JSON 事件解析++用 `--format json` 时,按行解析。一个最小化的 Python 消费者:++```python+import json+import subprocess++proc = subprocess.Popen(+ ["deeptutor", "run", "deep_solve", "Find d/dx [sin(x²)]",+ "--tool", "reason", "--format", "json"],+ stdout=subprocess.PIPE,+ text=True,+)++final_content = []+for line in proc.stdout:+ event = json.loads(line)+ if event["type"] == "content":+ final_content.append(event["content"])+ elif event["type"] == "tool_call":+ print(f"→ Tool: {event['content']}({event['metadata']['args']})")+ elif event["type"] == "error":+ print(f"× Error: {event['content']}")+ break+ elif event["type"] == "done":+ session_id = event["metadata"]["session_id"]+ break++answer = "".join(final_content)+```++或者用 `jq`:++```bash+# 拿到最终答案+deeptutor run chat "Hello" --format json | \+ jq -s 'map(select(.type=="content") | .content) | join("")'++# 拿到 session id+deeptutor run chat "Hello" --format json | \+ jq -r 'select(.type=="done") | .metadata.session_id'++# 流式打印每个 stage 完成的瞬间+deeptutor run deep_research "..." \+ --config mode=report --config depth=quick \+ --format json | \+ jq -r 'select(.type=="stage_end") | "Stage finished: " + .stage'+```++## 你的 SKILL.md 里到底放什么++仓库内置的 [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) 覆盖:++1. **When to Use** —— 哪些用户请求应该触发 DeepTutor+2. **Prerequisites** —— Python 3.11+、安装方式、`deeptutor init`+3. **Commands** —— Chat & Capabilities、Knowledge Bases、TutorBot、Memory、Sessions、Notebooks、System+4. **REPL Slash Commands** —— `deeptutor chat` 内部可用的命令+5. **Typical Workflows** —— 一组 agent 可以照着复刻的端到端 recipe++整份大约 150 行,按 "一次吞下去" 写的 —— 主流会用 tool 的 agent(Claude Sonnet/Opus、GPT-4/5、Gemini Pro)读一遍就能上手。++## 给云端 agent 准备的 provider token++DeepTutor 本地 CLI 命令不需要浏览器,但模型 / 搜索功能会去访问你配的 provider。如果你的 agent 跑在沙箱环境里,确认下面这些是可达的:++| Provider | 需要放行的 endpoint |+|----------|---------------------|+| OpenAI | `api.openai.com:443` |+| Anthropic | `api.anthropic.com:443` |+| Google Gemini | `generativelanguage.googleapis.com:443` |+| Azure OpenAI | `<your-resource>.openai.azure.com:443` |+| 本地 Ollama / vLLM | `data/user/settings/model_catalog.json` 或进程环境变量里配的 endpoint |++如果是 RAG 密集型工作流,还要放行你配置的搜索 provider(Tavily、Brave、Jina、Serper、Perplexity、SearXNG 或 DuckDuckGo)。++## 另见++- [**命令参考**](/zh-cn/docs/cli/commands/) —— 完整 CLI 参考+- [**交互式 REPL**](/zh-cn/docs/cli/chat-repl/) —— 人工驱动的会话+- [**Memory**](/zh-cn/docs/explore/memory/) —— 持久状态怎么在 session 之间流动diff --git a/site/src/content/docs/zh-cn/docs/cli/chat-repl.md b/site/src/content/docs/zh-cn/docs/cli/chat-repl.mdnew file mode 100644index 000000000..954f5f8c0--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/cli/chat-repl.md@@ -0,0 +1,267 @@+---+title: 交互式 REPL+description: 一个长时间运行的终端 chat 会话,内嵌 /slash 命令用于切换 capability、tool、KB 等。+---++`deeptutor chat` 进入一个交互式 REPL —— 适合 **探索性工作**、**多轮调试** 以及 **手动驱动 DeepTutor**(而不是用 `run` 一条条发命令)。++## 启动++```bash+# 默认 —— chat capability,无 KB,无额外 tool+deeptutor chat++# 预挂载一个 KB 并预开一个 tool+deeptutor chat --kb physics --tool rag --tool reason++# 以特定 capability 启动(比如固定用 Deep Solve)+deeptutor chat --capability deep_solve++# 续上一个旧 session+deeptutor chat --session sess_abc123++# 通过 flag 传偏好(和 run 一样)+deeptutor chat --language zh --kb papers --history-ref sess_old_xyz+```++## REPL 长什么样++```text+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓+┃ DeepTutor CLI ┃+┃ Type a message to chat. Commands: ┃+┃ /quit /session /new ┃+┃ /regenerate (alias /retry) — re-run the last user message ┃+┃ /tool on|off <name> ┃+┃ /cap <name> ┃+┃ /kb <name>|none ┃+┃ /history add <id> | /history clear ┃+┃ /notebook add <ref> | /notebook clear ┃+┃ /show last|<n> — expand a truncated tool result ┃+┃ /refs /config show|set|clear ┃+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛+[dim]session=(new) capability=chat tools=[] kb=[] history=[] notebook_refs=[] language=en config={}[/]+You> _+```++底部那行灰色状态显示下一轮 turn 会带过去的所有东西:session id、capability、tools、挂载的 KB、history reference、notebook reference、语言和 config。++## 一个典型会话++```text+You> 什么是链式法则?++▶ thinking+ [dim]The user is asking about a foundational calculus concept...[/]++▶ responding+**链式法则** 说的是:对一个复合函数 `f(g(x))` 求导时,你需要把……相乘++[dim]session=sess_abc123 turn=turn_xyz789 capability=chat[/]++You> /tool on rag+[dim]session=sess_abc123 capability=chat tools=[rag] kb=[] ...[/]++You> /kb math+[dim]session=sess_abc123 capability=chat tools=[rag] kb=[math] ...[/]++You> 用教材第 3 章的一个例题讲讲++▶ retrieving+ ● rag_search(query="chain rule worked example")+ │ Example: differentiate sin(x²) using the chain rule...+ └ #1 rag — +3 more lines++▶ responding+教材第 3 章里的例子:++设 `y = sin(x²)`。令 `u = x²`……++You> /quit+$+```++## 所有 slash 命令++### Session++| 命令 | 作用 |+|------|------|+| `/quit` | 退出 REPL |+| `/session` | 打印当前 session id |+| `/new` | 开一个新 session,清掉当前 id |+| `/regenerate`(或 `/retry`) | 用当前配置重新跑最后一条 user 消息 |++### Capability 切换++| 命令 | 作用 |+|------|------|+| `/cap <name>` | 切到另一个 capability |++合法名称:`chat`、`deep_solve`、`deep_question`、`deep_research`、`math_animator`、`visualize`、`auto`。CLI 别名也认(如 `solve` → `deep_solve`、`quiz` → `deep_question`)。++```text+You> /cap deep_solve+[dim]capability=deep_solve ...[/]+You> 求 d/dx [sin(x²)]+```++### Tool++```text+/tool on <name> # 下一轮开启某个 tool+/tool off <name> # 关掉+```++合法 tool 名:`rag`、`web_search`、`code_execution`、`reason`、`brainstorm`、`paper_search`。有些 tool(比如 `read_memory`、`web_fetch`)是常驻的,不需要显式开关。++### 知识库++```text+/kb <name> # 挂载一个 KB(替换当前挂载)+/kb none # 卸载+```++### History reference++告诉模型有哪些历史 session 应该当作上下文(不用复制粘贴):++```text+/history add sess_prior_xyz+/history clear+```++这是搭建跨 session 上下文的方式 —— 做 "接着上次的研究继续" 类的 turn 非常合适。++### Notebook reference++从你的 notebook 里带入特定记录:++```text+/notebook add my-notes:rec_abc123,rec_def456+/notebook clear+```++### Config 覆盖++对后续 turn 生效的 per-capability config:++```text+/config show # 打印当前 config+/config set num_questions 5+/config set difficulty=hard+/config set difficulty hard+/config clear # 重置为默认值+```++举例,以 `--capability deep_question` 启动:++```text+You> /config set num_questions 8+You> /config set question_types '["short_answer","mcq"]'+You> 出几道关于线性回归的题+```++### 查看 tool 结果++REPL 里 tool 结果被截断到前 10 行 / 每行 240 字符,避免界面被刷屏。要展开某条:++```text+/show last # 最后一条 tool 结果+/show 3 # 本 session 的第 3 条 tool 结果+```++最多缓存 32 条结果可供展开。++### `/refs`++打印下一轮 turn 会带过去的所有内容:++```text+You> /refs+[bold]Current state:[/]+ session sess_abc123+ capability chat+ tools [rag, reason]+ kb [physics, math]+ history [sess_old_xyz]+ notebooks [my-notes:rec_abc123]+ language en+ config {"difficulty": "hard", "num_questions": 5}+```++## REPL 里的流式渲染怎么工作++每一轮 turn 按 stage 渲染。你会按顺序看到:++| 标记 | 含义 |+|------|------|+| `▶ <stage>` | 新的 pipeline stage 开始(如 `retrieving`、`reasoning`、`writing`) |+| ` [dim]…[/]` | 中间思考 —— 模型类似 CoT 的推理 |+| ` ● <tool>(...)` | 正在调用某个 tool |+| ` │ <line>` | 一行 tool 输出 |+| ` └ #N <tool> — +M more lines; run /show N to expand` | tool 结果被截断 |+| *普通文本* | 渲染后的最终 markdown 回复 |++## 小贴士++### 多行输入++要发多行消息(代码片段、长 prompt),每行末尾加一个反斜杠 `\` 再回车:++```text+You> Please review this Python code:\+def fib(n):\+ if n < 2: return n\+ return fib(n-1) + fib(n-2)+```++### 会话中途切 capability++一个 session 内可以自由切换 capability —— DeepTutor 会保留对话上下文。一种常见 pattern:++```text+You> /cap deep_research+You> /config set mode=report+You> /config set depth=standard+You> 调研一下 2024–2026 年关于 RAG 的论文+[一个很长的研究 turn]++You> /cap chat+You> 现在写一个 3 段总结,目标读者是非技术背景的人++You> /cap deep_question+You> /config set num_questions 5+You> 基于这些论文出几道测验题+```++这三个 turn 共享同一份记忆,会自动互相引用。++### 导出会话日志++Session 存在共享的 session 数据库里。要导出一份干净的 markdown 文字稿:++```bash+deeptutor session show sess_abc123 --format json | \+ jq -r '.messages[] | "**" + .role + "**: " + .content + "\n"' > transcript.md+```++### 从 REPL → notebook++某个 turn 觉得不错?存进 notebook:++```bash+# REPL 里+You> /quit++# 然后在 shell 里把 assistant 最后一条消息抓出来+deeptutor session show sess_abc123 --format json | \+ jq -r '.messages[-1].content' > my-answer.md++deeptutor notebook add-md my-notes my-answer.md --title "Chain rule explanation"+```++## 另见++- [**命令参考**](/zh-cn/docs/cli/commands/) —— `run`、`kb`、`bot` 等完整参考+- [**代理交接**](/zh-cn/docs/cli/agent-handoff/) —— 让 agent 替你来做这些diff --git a/site/src/content/docs/zh-cn/docs/cli/commands.md b/site/src/content/docs/zh-cn/docs/cli/commands.mdnew file mode 100644index 000000000..cfc93d27c--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/cli/commands.md@@ -0,0 +1,464 @@+---+title: 命令参考+description: 每个 deeptutor 命令 —— flag、输出 schema、示例。+---++本页列出每个 `deeptutor` 子命令和 flag。交互式 REPL 用法见 [**交互式 REPL**](/zh-cn/docs/cli/chat-repl/)。自动化模式见 [**代理交接**](/zh-cn/docs/cli/agent-handoff/)。++## `deeptutor run` —— 单次 capability 执行++执行一次 capability turn 然后退出。这是 agent 和脚本最基础的 "干活" 命令。++```bash+deeptutor run <capability> "<message>" [options]+```++### Flag++| Flag | 类型 | 默认值 | 作用 |+|------|------|--------|------|+| `--session <id>` | string | *(新建)* | 续上一个已有 session |+| `-t / --tool <name>` | 可重复 | `[]` | 启用某个 tool(如 `rag`、`web_search`、`code_execution`、`reason`) |+| `--kb <name>` | 可重复 | `[]` | 挂载一个知识库 |+| `--notebook-ref <id[:record,...]>` | 可重复 | `[]` | 挂载 notebook 记录 |+| `--history-ref <session_id>` | 可重复 | `[]` | 引用一个历史 session |+| `-l / --language <code>` | string | `en` | 回复语言 |+| `--config <key=value>` | 可重复 | `[]` | 单个 capability 的 config 覆盖 |+| `--config-json <json>` | string | —— | 以 JSON 形式提供 base config;后续 `--config key=value` 会覆盖同名 key |+| `-f / --format <rich\|json>` | enum | `rich` | 输出模式 |++### 示例++```bash+# 简单 chat turn+deeptutor run chat "用大白话解释量子纠缠"++# Deep Solve,带 reasoning + 针对某个 KB 的 RAG+deeptutor run deep_solve "求 d/dx [sin(x²)]" --tool reason --tool rag --kb math++# 生成 5 道测验题+deeptutor run deep_question "线性代数的特征向量" \+ --config num_questions=5 --config difficulty=hard++# Deep Research,JSON 流+deeptutor run deep_research "检索增强生成最近有什么新进展?" \+ --tool web_search --tool rag --kb papers \+ --config mode=report --config depth=standard \+ --format json++# 续上一个 session+deeptutor run chat "接着刚才的继续" --session sess_abc123+```++### 输出 —— `--format rich`(默认)++按 stage 渲染 Markdown 富文本。示例:++```text+▶ retrieving+ ● rag_search(query="chain rule")+ │ Chain rule: d/dx[f(g(x))] = f'(g(x)) · g'(x)+ └ #1 rag — +5 more lines; run /show 1 to expand++▶ reasoning+ [dim]Applying chain rule with u = x², du/dx = 2x[/]+ [dim]d/dx[sin(u)] = cos(u) · du/dx[/]++▶ formulating++The derivative of sin(x²) is:++**2x · cos(x²)**++[dim]session=sess_abc123 turn=turn_xyz789 capability=deep_solve[/]+```++### 输出 —— `--format json`++每行一个 JSON 对象。方便管道给其他工具:++```text+{"type": "stage_start", "stage": "retrieving"}+{"type": "tool_call", "content": "rag_search", "metadata": {"args": {"query": "chain rule"}}}+{"type": "tool_result", "content": "Chain rule: ...", "metadata": {"tool": "rag"}}+{"type": "stage_end", "stage": "retrieving"}+{"type": "stage_start", "stage": "reasoning"}+{"type": "thinking", "content": "Applying chain rule..."}+{"type": "stage_end", "stage": "reasoning"}+{"type": "stage_start", "stage": "formulating"}+{"type": "content", "content": "The derivative of sin(x²) is **2x · cos(x²)**"}+{"type": "stage_end", "stage": "formulating"}+{"type": "done", "metadata": {"session_id": "sess_abc123", "turn_id": "turn_xyz789"}}+```++事件类型:`stage_start`、`stage_end`、`content`、`thinking`、`progress`、`tool_call`、`tool_result`、`error`、`done`。++## `deeptutor chat` —— 交互式 REPL++进入一个交互式 chat session,用 `/slash` 命令在会话内做配置。++```bash+deeptutor chat [options]+```++flag 和 `run` 里塑形 turn 的那一组一样:`--session`、`--tool`、`--capability`、`--kb`、`--notebook-ref`、`--history-ref`、`--language`、`--config`、`--config-json`。完整说明见 [**交互式 REPL**](/zh-cn/docs/cli/chat-repl/)。++## `deeptutor init` —— 引导式初始化向导++```bash+deeptutor init # 完整配置(询问端口 + LLM + embedding + 搜索)+deeptutor init --cli # 仅 CLI(跳过端口问题)+deeptutor init --home /path # 使用非默认工作区+```++完整流程见 [**Get Started**](/zh-cn/docs/get-started/)。++## `deeptutor start` / `deeptutor serve`++```bash+# 同时启动后端 + 前端(阻塞;Ctrl+C 同时停掉)+deeptutor start+deeptutor start --home /path++# 仅后端+deeptutor serve --host 0.0.0.0 --port 8001+deeptutor serve --reload # 文件变动时热重载(仅开发用)+```++## `deeptutor kb` —— 知识库管理++### `kb list`++```bash+deeptutor kb list # Rich 表格+deeptutor kb list --format json+```++JSON 输出:++```json+[+ {+ "name": "physics",+ "status": "ready",+ "documents": 12,+ "rag_provider": "llamaindex",+ "is_default": true+ },+ {+ "name": "math",+ "status": "indexing",+ "documents": 4,+ "rag_provider": "llamaindex",+ "is_default": false+ }+]+```++### `kb info <name>`++```bash+deeptutor kb info physics+```++返回这个 KB 的元数据、文档列表、统计信息和索引状态。++### `kb create <name>`++```bash+# 单个文档+deeptutor kb create physics --doc chapter1.pdf++# 多个文档+deeptutor kb create physics --doc chapter1.pdf --doc chapter2.pdf --doc exercises.docx++# 整个目录+deeptutor kb create textbooks --docs-dir ./my-pdfs+```++支持格式:PDF、DOCX、XLSX、PPTX、TXT、MD、HTML。++### `kb add <name>`++往已有 KB 里增量添加文档:++```bash+deeptutor kb add physics --doc chapter3.pdf+```++### `kb delete <name>`++```bash+deeptutor kb delete physics # 要求确认+deeptutor kb delete physics --force # 跳过确认+```++### `kb set-default <name>`++```bash+deeptutor kb set-default physics+```++默认 KB 是指当没有显式指定时,`deeptutor chat` 和 Web UI 会自动挂载的那个。++### `kb search <name> <query>`++```bash+deeptutor kb search physics "什么是角动量?"+deeptutor kb search physics "..." --mode hybrid --format json+```++模式:`hybrid`(默认;语义 + 关键词)、`vector`(仅语义)、`keyword`(BM25)。++### 重新索引++重新索引不是一个 CLI 命令 —— 要从 **Web UI**(Knowledge → 选 KB → **Index versions** 标签页 → **Re-index now**)触发。换了 embedding 模型后通常需要这一步。++## `deeptutor session` —— session 查看++### `session list`++```bash+deeptutor session list --limit 20+```++### `session show <id>`++```bash+deeptutor session show sess_abc123 # Rich+deeptutor session show sess_abc123 --format json # 完整 JSON+```++JSON 输出(截断版):++```json+{+ "id": "sess_abc123",+ "title": "Chain rule explanation",+ "capability": "chat",+ "status": "completed",+ "messages": [+ {"role": "user", "content": "..."},+ {"role": "assistant", "content": "..."}+ ],+ "preferences": {+ "tools": ["rag", "reason"],+ "knowledge_bases": ["math"],+ "language": "en"+ },+ "created_at": "2026-05-21T14:23:01Z",+ "updated_at": "2026-05-21T14:24:38Z"+}+```++### `session open <id>` / `session delete <id>` / `session rename <id> --title <title>`++```bash+deeptutor session open sess_abc123 # 在 REPL 里续上+deeptutor session rename sess_abc123 --title "Calculus review"+deeptutor session delete sess_abc123+```++## `deeptutor notebook` —— notebook 记录++```bash+# 创建 notebook+deeptutor notebook create research-notes --description "Daily reading log"++# 添加 markdown 记录+deeptutor notebook add-md research-notes paper-summary.md \+ --title "Attention is all you need" --type research++# 替换某条记录的内容+deeptutor notebook replace-md research-notes rec_abc123 updated-summary.md++# 删除一条记录+deeptutor notebook remove-record research-notes rec_abc123++# 查看+deeptutor notebook list+deeptutor notebook show research-notes+```++记录类型:`chat`、`question`、`research`、`solve`。++## `deeptutor memory` —— 三层记忆++DeepTutor 把用户记忆按三层存(深入说明见 [**Memory**](/zh-cn/docs/explore/memory/)):++- **L1** —— 每个 surface(chat、notebook、quiz 等)的原始事件轨迹+- **L2** —— 每个 surface 整理过的 markdown 摘要+- **L3** —— 跨 surface 的整体画像(recent、profile、scope、preferences)++### `memory show [target]`++```bash+deeptutor memory show # 默认:L3 拼接+deeptutor memory show L3+deeptutor memory show L2 # 列出所有 L2 surface+deeptutor memory show profile # 某个具体的 L3 doc+deeptutor memory show chat # 某个具体的 L2 surface doc+```++### `memory clear [target]`++```bash+deeptutor memory clear all --force # ⚠️ 清空 L1+L2+L3+deeptutor memory clear trace # 仅 L1+deeptutor memory clear chat # 仅 chat surface 的 L1 轨迹+```++### 强制触发一次整理++手动整理不是一个 CLI 命令 —— 从 Web UI 的 **Memory Workbench**(`/memory` → **Run consolidator**)触发,或者通过 HTTP API:++```bash+curl -X POST http://localhost:8001/api/v1/memory/runs/start+```++## `deeptutor bot` —— TutorBot 生命周期++```bash+deeptutor bot list++deeptutor bot create my-bot \+ --name "Math Mentor" \+ --persona "Socratic tutor specializing in algebra and calculus" \+ --model gpt-4o++# `create` 会立即启动 bot。如果之前停过,再 start 即可。+deeptutor bot stop my-bot+```++子命令:`list`、`create`、`start`、`stop`。`create` 会一步写好 bot 配置并启动它。删除一个 bot 就在它停止时删掉它的工作区目录 `data/tutorbot/<bot_id>/`。++各通道配置(Telegram、Slack 等)放在 bot 的 YAML 里,位于 `data/tutorbot/<bot_id>/`。各通道接入说明见 [**Explore TutorBot**](/zh-cn/docs/tutorbot/)。++## `deeptutor config show`++```bash+deeptutor config show+```++示例输出:++```json+{+ "ports": {+ "backend": 8001,+ "frontend": 3782+ },+ "llm": {+ "provider": "openai",+ "model": "gpt-4o",+ "base_url": "https://api.openai.com/v1",+ "api_key": "***"+ },+ "embedding": {+ "status": "configured",+ "provider": "openai",+ "model": "text-embedding-3-large",+ "dimension": 3072,+ "api_key": "***"+ },+ "search": {+ "provider": "tavily",+ "status": "enabled",+ "api_key": "***"+ },+ "language": "en",+ "tools": ["rag", "web_search", "code_execution", "reason"]+}+```++密钥用 `***` 打码。++## `deeptutor plugin` —— 注册表查看++```bash+deeptutor plugin list # 所有 capability + tool+deeptutor plugin info deep_solve # 单个 capability+deeptutor plugin info rag # 单个 tool+```++`plugin info <capability>` 返回:++```json+{+ "name": "deep_solve",+ "description": "Multi-step agentic problem-solving",+ "cli_aliases": ["solve"],+ "stages": ["planning", "reasoning", "writing"],+ "tools_used": ["rag", "web_search", "code_execution", "reason"],+ "config_defaults": {+ "max_steps": 8+ },+ "availability": {+ "available": true,+ "install_hint": ""+ }+}+```++## `deeptutor provider` —— 认证流程++对于走 OAuth 或特殊 token 流程的 provider:++```bash+deeptutor provider login openai-codex # 走 oauth-cli-kit 的 OAuth+deeptutor provider login github-copilot # GitHub 认证校验+```++## `deeptutor book` —— Knowledge Books(引导式学习)++```bash+deeptutor book list++# 给一本 book 做健康检查(KB 漂移 + log 过期检测)+deeptutor book health book_abc123++# 重新快照 fingerprint,消除 "stale page" 警告+deeptutor book refresh-fingerprints book_abc123+```++Book 是 **Guided Learning** 学习路径的存储层。详见 [**Book Engine**](/zh-cn/docs/explore/book/)。++## 常见输出 schema++### TurnRequest(`run` 内部发送的对象)++```python+@dataclass(slots=True)+class TurnRequest:+ content: str+ capability: str = "chat"+ session_id: str | None = None+ tools: list[str] = field(default_factory=list)+ knowledge_bases: list[str] = field(default_factory=list)+ language: str = "en"+ config: dict[str, Any] = field(default_factory=dict)+ notebook_references: list[dict[str, Any]] = field(default_factory=list)+ history_references: list[str] = field(default_factory=list)+ attachments: list[dict[str, Any]] = field(default_factory=list)+ skills: list[str] = field(default_factory=list)+```++### 流事件类型++| 事件 | 触发时机 | 字段 |+|------|----------|------|+| `stage_start` | 进入一个 pipeline stage | `stage`、`metadata` |+| `stage_end` | stage 结束 | `stage` |+| `content` | 面向用户的 markdown 片段 | `content` |+| `thinking` | 中间推理 | `content` |+| `progress` | 状态更新 | `content` |+| `tool_call` | 正在调用某个 tool | `content`(tool 名)、`metadata.args` |+| `tool_result` | tool 返回结果 | `content`、`metadata.tool` |+| `error` | 出错 | `content` |+| `done` | turn 完成 | `metadata.session_id`、`metadata.turn_id` |++## 另见++- [**交互式 REPL**](/zh-cn/docs/cli/chat-repl/) —— 日常使用 `deeptutor chat`+- [**代理交接**](/zh-cn/docs/cli/agent-handoff/) —— 让 Claude Code / Codex 来驱动 CLI+- [**服务端 API**](/zh-cn/docs/cli/server-api/) —— `deeptutor serve` 暴露的 HTTP / WebSocket 表面diff --git a/site/src/content/docs/zh-cn/docs/cli/index.md b/site/src/content/docs/zh-cn/docs/cli/index.mdnew file mode 100644index 000000000..b1d94da8f--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/cli/index.md@@ -0,0 +1,117 @@+---+title: DeepTutor CLI+description: 在终端里驱动 DeepTutor 的所有能力 —— 交互式 REPL、单次执行、Agent 交接。+---++DeepTutor 是围绕 **agent-native CLI** 设计的:核心运行时在终端里都有对应入口,turn 执行可以流式输出 JSON 给程序消费,自动化 surface 集中在一份 skill 文档里,AI 代理读完就能自驱。部分浏览器优先的工作流(比如 Co-Writer 富文本编辑、Memory Workbench)仍然在 Web UI 或 HTTP API 里。++本章节包括:++- [**命令参考**](/zh-cn/docs/cli/commands/) —— 每个顶层命令和子命令的 flag、schema、示例+- [**交互式 REPL**](/zh-cn/docs/cli/chat-repl/) —— 在长会话里用 `/slash` 命令操作+- [**代理交接**](/zh-cn/docs/cli/agent-handoff/) —— 让 Claude Code / Codex / OpenCode / Hermes 来驱动 `deeptutor`+- [**服务端 API**](/zh-cn/docs/cli/server-api/) —— `deeptutor serve` 暴露的 HTTP / WebSocket 表面++## 快速一览++```bash+# 装包(从 Get Started 选一种路径)+pip install deeptutor++# 配置+deeptutor init++# 交互式 chat+deeptutor chat++# 单次执行,agent 风格+deeptutor run deep_solve "求 sin(x²) 的导数" --tool reason --format json++# 管理知识库+deeptutor kb create physics --doc chapter1.pdf+deeptutor kb search physics "什么是角动量?"++# 跑一个 TutorBot+deeptutor bot create my-bot --persona "Socratic 数学导师"++# 看三层记忆+deeptutor memory show L3+```++## 为什么是 CLI 优先++终端体验 **和 AI 代理拿到的体验是同一份**。你在 `deeptutor chat` 里写一条 turn,背后的 `TurnRequest` schema 和你把 `SKILL.md` 丢给 Claude Code / Codex 后他们发出的请求是一模一样的。++这意味着:++- 核心学习流程都可以在终端里驱动;浏览器独占的编辑和管理面板通过 Web UI / API 暴露状态+- `deeptutor run --format json` 每行一个 JSON 事件;数据检查类命令 `kb list`、`kb search`、`session show`、`notebook show` 等也都能输出 JSON+- Session 跨 turn 持久化 —— 你可以在 Web、REPL、单次 `run` 之间切换并续上之前的上下文+- 自动化进入点(turns / KB / session / notebook / memory / TutorBot / config / plugin / provider / book)都在 CLI 上++## 顶层命令地图++| 组 | 用途 | 最常用 |+|----|------|--------|+| `deeptutor init` | 引导式初始化向导 | `deeptutor init --cli` |+| `deeptutor start` | 同时启动后端 + 前端 | `deeptutor start` |+| `deeptutor serve` | 仅启动后端(`:8001` 上的 FastAPI) | `deeptutor serve --host 0.0.0.0` |+| `deeptutor chat` | 交互式 REPL | `deeptutor chat --kb physics` |+| `deeptutor run` | 单次 capability 执行 | `deeptutor run deep_solve "..."` |+| `deeptutor kb` | 知识库管理 | `deeptutor kb create / list / search` |+| `deeptutor session` | session 查看 | `deeptutor session list / show <id>` |+| `deeptutor notebook` | notebook 记录 | `deeptutor notebook create / add-md` |+| `deeptutor memory` | 三层记忆存储 | `deeptutor memory show L3` |+| `deeptutor bot` | TutorBot 生命周期 | `deeptutor bot create / start / stop`(`create` 会立刻启动) |+| `deeptutor config` | 查看运行时配置 | `deeptutor config show` |+| `deeptutor plugin` | capability / tool 注册表 | `deeptutor plugin list` |+| `deeptutor provider` | provider 认证流程 | `deeptutor provider login openai-codex` |+| `deeptutor book` | Knowledge Books(引导式学习) | `deeptutor book list / health` |++完整参考见 [**命令参考**](/zh-cn/docs/cli/commands/)。++## 两种使用方式++### 方式 1 —— 交互式++适合探索性的、多轮的工作:++```text+$ deeptutor chat --kb physics+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓+┃ DeepTutor CLI ┃+┃ Type a message. /quit /tool /cap /kb /history /show /refs ┃+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛+You> 用一个具体例子讲一下链式法则+```++完整说明:[**交互式 REPL**](/zh-cn/docs/cli/chat-repl/)。++### 方式 2 —— Agent 风格单次执行++适合自动化、CI、AI 代理 harness:++```bash+deeptutor run deep_solve "求 [[4,1],[2,3]] 的特征值" \+ --tool reason --tool code_execution \+ --format json | jq -r '.content // empty'+```++每行 JSON 是一个事件 —— `stage_start`、`content`、`tool_call`、`tool_result`、`thinking`、`done`。可以管道给下游 agent,或者用 `jq` 提取最终答案。++完整说明:[**代理交接**](/zh-cn/docs/cli/agent-handoff/)。++## 状态存在哪里++所有 CLI 命令操作的是 **和 Web UI 同一个工作区**。默认情况下,运行时数据存在你启动 DeepTutor 时所在目录下的 `data/` 里。可以用 `DEEPTUTOR_HOME=/path`、`deeptutor init --home /path` 或 `deeptutor start --home /path` 覆盖。++## `--help` 永远在一个 flag 之外++每个命令都支持 `--help`:++```text+$ deeptutor --help+$ deeptutor run --help+$ deeptutor kb create --help+$ deeptutor bot start --help+```diff --git a/site/src/content/docs/zh-cn/docs/cli/server-api.md b/site/src/content/docs/zh-cn/docs/cli/server-api.mdnew file mode 100644index 000000000..3e0a7f5ef--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/cli/server-api.md@@ -0,0 +1,254 @@+---+title: 服务端 API+description: deeptutor serve 暴露的 HTTP 和 WebSocket 表面 —— 用于自定义前端和集成。+---++`deeptutor serve` 在 `http://localhost:8001/` 上启动 FastAPI 后端(除非你改了后端端口)。本页是给自定义前端、移动 App 和服务间集成准备的高密度地图。++要看穷尽且永远最新的 schema,启动服务后打开:++```text+GET /openapi.json # 完整 OpenAPI 3.1 spec+GET /docs # 交互式 Swagger UI+GET /redoc # 备选的 ReDoc UI+```++## 启动服务++```bash+# 仅后端。端口取自 data/user/settings/system.json,默认 8001。+deeptutor serve++# 给本次进程指定自定义 host/port+deeptutor serve --host 127.0.0.1 --port 18001++# 开发模式:Python 文件变动时热重载+deeptutor serve --reload+```++## 鉴权++如果 `data/user/settings/auth.json` 里开启了鉴权,除 `/api/v1/auth/*` 之外的每个 endpoint 都要求 `Authorization: Bearer <token>` header 携带有效 JWT,或者带 session cookie。++```bash+# 登录+curl -X POST http://localhost:8001/api/v1/auth/login \+ -H "Content-Type: application/json" \+ -d '{"username":"alice","password":"..."}'++# 响应里包含 access_token。++# 用 token 调用+curl http://localhost:8001/api/v1/sessions \+ -H "Authorization: Bearer eyJ..."+```++如果鉴权没开,认证依赖就是 no-op,本地单用户请求不需要带 token。++## Turn 执行 WebSocket++```text+WS /api/v1/ws+```++这是 Web UI 在用的统一 turn WebSocket。它对所有 capability 一视同仁,输出的事件和 `deeptutor run --format json` 打印的是同一族。++发一个 `type: "start_turn"` 或 `type: "message"` 载荷启动 turn:++```json+{+ "type": "start_turn",+ "content": "Find d/dx [sin(x^2)]",+ "capability": "deep_solve",+ "session_id": null,+ "tools": ["rag", "reason"],+ "knowledge_bases": ["math"],+ "language": "en",+ "config": {"max_steps": 6},+ "notebook_references": [],+ "history_references": [],+ "attachments": [],+ "skills": []+}+```++其他支持的 client 消息类型包括 `subscribe_turn`、`subscribe_session`、`resume_from`、`unsubscribe`、`cancel_turn`、`submit_user_reply`、`regenerate`、`ping`。++典型收到的事件:++```json+{"type":"stage_start","stage":"retrieving"}+{"type":"tool_call","content":"rag_search","metadata":{"args":{"query":"chain rule"}}}+{"type":"tool_result","content":"...","metadata":{"tool":"rag"}}+{"type":"stage_end","stage":"retrieving"}+{"type":"content","content":"## Solution\n\nThe derivative..."}+{"type":"done","metadata":{"session_id":"sess_abc123","turn_id":"turn_xyz789"}}+```++## Legacy chat WebSocket++```text+WS /api/v1/chat+```++这个旧 endpoint 还留着,给简单 chat 客户端用。新集成建议直接走 `/api/v1/ws`,因为它支持所有 capability、replay、cancel、regenerate 和 `ask_user` 回复。++## Session++```text+GET /api/v1/sessions 列 session+GET /api/v1/sessions/{session_id} 拿到一个 session + 消息+PATCH /api/v1/sessions/{session_id} 重命名(body: {"title":"..."})+DELETE /api/v1/sessions/{session_id} 删除+PUT /api/v1/sessions/{session_id}/branch-selection+DELETE /api/v1/sessions/{session_id}/messages/{message_id}+POST /api/v1/sessions/{session_id}/quiz-results+```++旧版 chat-session 别名也仍然存在:++```text+GET /api/v1/chat/sessions+GET /api/v1/chat/sessions/{session_id}+DELETE /api/v1/chat/sessions/{session_id}+```++## 知识库++```text+GET /api/v1/knowledge/list 列 KB+GET /api/v1/knowledge/{kb_name} KB 信息+DELETE /api/v1/knowledge/{kb_name} 删除+POST /api/v1/knowledge/create 创建 KB+POST /api/v1/knowledge/{kb_name}/upload 添加文档+POST /api/v1/knowledge/{kb_name}/reindex 重新 embed 文档+GET /api/v1/knowledge/default 获取默认 KB+PUT /api/v1/knowledge/default/{kb_name} 设置默认 KB+GET /api/v1/knowledge/supported-file-types 支持的上传格式+GET /api/v1/knowledge/{kb_name}/files 列源文件+GET /api/v1/knowledge/{kb_name}/progress 索引进度+WS /api/v1/knowledge/{kb_name}/progress/ws 进度流+```++临时的 KB 搜索目前是通过 RAG 运行时 / tool 路径暴露的,当前 API 里没有专门的 `POST /knowledge/{name}/search` 路由。从 CLI 走,用 `deeptutor kb search <name> <query>`。++## Notebook++```text+GET /api/v1/notebook/list+GET /api/v1/notebook/statistics+POST /api/v1/notebook/create+GET /api/v1/notebook/{notebook_id}+PUT /api/v1/notebook/{notebook_id}+DELETE /api/v1/notebook/{notebook_id}+POST /api/v1/notebook/add_record+POST /api/v1/notebook/add_record_with_summary+DELETE /api/v1/notebook/{notebook_id}/records/{record_id}+PUT /api/v1/notebook/{notebook_id}/records/{record_id}+```++## Memory++```text+GET /api/v1/memory/overview+GET /api/v1/memory/doc/{layer}/{key}+PUT /api/v1/memory/doc/{layer}/{key}+POST /api/v1/memory/doc/{layer}/{key}/reset+POST /api/v1/memory/doc/{layer}/{key}/update+POST /api/v1/memory/doc/{layer}/{key}/audit+POST /api/v1/memory/doc/{layer}/{key}/dedup+POST /api/v1/memory/runs/start+GET /api/v1/memory/runs+GET /api/v1/memory/runs/{run_id}+GET /api/v1/memory/runs/{run_id}/events+POST /api/v1/memory/runs/{run_id}/cancel+POST /api/v1/memory/runs/{run_id}/undo+GET /api/v1/memory/trace/{surface}+DELETE /api/v1/memory/trace/{surface}+GET /api/v1/memory/settings+PUT /api/v1/memory/settings+```++层级是 `L2` 和 `L3`;例:`/api/v1/memory/doc/L3/profile` 和 `/api/v1/memory/doc/L2/chat`。++## Settings、tools、plugins 和 system++```text+GET /api/v1/settings+GET /api/v1/settings/catalog+PUT /api/v1/settings/catalog+POST /api/v1/settings/apply+PUT /api/v1/settings/enabled-tools+GET /api/v1/tools+GET /api/v1/plugins/list+POST /api/v1/plugins/tools/{tool_name}/execute+POST /api/v1/plugins/tools/{tool_name}/execute-stream+POST /api/v1/plugins/capabilities/{capability_name}/execute-stream+GET /api/v1/system/status+GET /api/v1/system/runtime-topology+POST /api/v1/system/test/llm+POST /api/v1/system/test/embeddings+POST /api/v1/system/test/search+```++Provider profile 通过 catalog endpoint 编辑;当前 API 里没有单独的 `/settings/llm` 或 `/settings/embedding` 路由。++## TutorBot Manager++```text+GET /api/v1/tutorbot+POST /api/v1/tutorbot+GET /api/v1/tutorbot/recent+GET /api/v1/tutorbot/channels/schema+GET /api/v1/tutorbot/{bot_id}+PATCH /api/v1/tutorbot/{bot_id}+DELETE /api/v1/tutorbot/{bot_id}+DELETE /api/v1/tutorbot/{bot_id}/destroy+GET /api/v1/tutorbot/{bot_id}/files+PUT /api/v1/tutorbot/{bot_id}/files/{filename}+GET /api/v1/tutorbot/{bot_id}/history+WS /api/v1/tutorbot/{bot_id}/ws+```++## Book Engine++```text+GET /api/v1/book/books+POST /api/v1/book/books+GET /api/v1/book/books/{book_id}+GET /api/v1/book/books/{book_id}/spine+GET /api/v1/book/books/{book_id}/pages/{page_id}+DELETE /api/v1/book/books/{book_id}+POST /api/v1/book/books/confirm-proposal+POST /api/v1/book/books/confirm-spine+POST /api/v1/book/books/compile-page+POST /api/v1/book/books/{book_id}/refresh-fingerprints+WS /api/v1/book/ws+```++## 输出和附件++用户生成的产物通过一个只读静态挂载提供:++```text+GET /api/outputs/<path>+```++只有通过 `SafeOutputStaticFiles` 白名单的路径才能访问;目录穿越被拦掉了。原始 chat 附件挂在:++```text+GET /api/attachments/{session_id}/{attachment_id}/{filename}+```++## 生成 typed client++```bash+curl http://localhost:8001/openapi.json > deeptutor.openapi.json++# TypeScript client+npx openapi-typescript deeptutor.openapi.json -o deeptutor.d.ts++# Python client+pip install openapi-python-client+openapi-python-client generate --path deeptutor.openapi.json+```diff --git a/site/src/content/docs/zh-cn/docs/contributing.md b/site/src/content/docs/zh-cn/docs/contributing.mdnew file mode 100644index 000000000..bb45ad2b6--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/contributing.md@@ -0,0 +1,95 @@+---+title: 参与贡献+description: 如何为 DeepTutor 贡献代码、文档或修复 bug —— 分支策略、环境搭建、PR 检查清单。+---++感谢你对 DeepTutor 的兴趣。本页是简短版本;完整文档在仓库根目录的 [`CONTRIBUTING.md`](https://github.com/HKUDS/DeepTutor/blob/main/CONTRIBUTING.md)。++## 路线图++DeepTutor 的公开路线图维护在 [`HKUDS/DeepTutor#498`](https://github.com/HKUDS/DeepTutor/issues/498)。你可以在那里查看计划中的工作、表达优先级、或在开始较大的贡献前提出新方向。++## PR 应该提到哪个分支++DeepTutor 使用多分支模型。**不要把 PR 提到 `main`。**++| 分支 | 适合 |+|------|------|+| `dev` | 默认目标 —— 新功能、重构、bug 修复、API / 配置改动 |+| `multi-user` | 仅限多租户 / session 隔离 / 共享工作区相关工作 |++拿不准就提到 `dev`。++## 快速上手++```bash+# 1. Fork + clone,先与目标分支同步+git checkout dev && git pull origin dev++# 2. 拉新分支+git checkout -b feature/your-feature-name++# 3. 编辑模式安装全套+pip install -e ".[all]"++# 4. 配置 pre-commit(每台机器一次)+pip install pre-commit+pre-commit install++# 5. 改完跑一遍校验+pre-commit run --all-files++# 6. 把 PR 提到 dev(或 multi-user)+```++可以从 [`good first issue`](https://github.com/HKUDS/DeepTutor/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) 标签找入手点。开工前先在 issue 下留言,避免重复劳动。++## 编码规范++CI 会强制检查;`pre-commit run --all-files` 在本地能查出大部分问题。++| 范畴 | 规则 |+|------|------|+| Python | 所有函数签名加 type hint;遵循 PEP 8(Ruff 强制);用 f-string;保持函数小而专一 |+| Docstring | 新模块 / 类 / public 函数使用 Google 风格 docstring |+| Secrets | 严禁提交;每个 PR 上 `detect-secrets` 都会跑 |+| Subprocess | 永远用 `shell=False` |+| 路径 | `pathlib.Path` 优于字符串拼接 |++底层工具链:**Ruff**(lint + format)、**Prettier**(前端 / 配置)、**detect-secrets**、**pip-audit**、**Bandit**、**MyPy**、**Interrogate**。++## Commit message 格式++```+<type>: <short description>++[optional body]+```++| Type | 用法 |+|------|------|+| `feat` | 新功能(MINOR 版本跳一格) |+| `fix` | bug 修复(PATCH 版本跳一格) |+| `docs` | 仅文档 |+| `style` | 仅格式化 |+| `refactor` | 重构,无行为变化 |+| `test` | 增 / 改测试 |+| `chore` | 构建 / 工具链 / 依赖 |++## 评审会看什么++- **正确性** —— 是否真的解决了问题?是否引入回归?+- **范围** —— 小而聚焦的 PR 比庞大杂烩 PR 合得快;拿不准就拆。+- **测试** —— 新行为要有对应覆盖;bug 修复尽量带回归测试。+- **文档** —— 影响用户的改动要同步更新 `site/src/content/docs/` 下的相关页面。++## 寻求帮助++- [Discord](https://discord.gg/eRsjPgMU4t) —— 提问最快的地方+- [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) —— 长篇问答+- [微信社区](https://github.com/HKUDS/DeepTutor/issues/78) —— 中文贡献者群+- [Issues](https://github.com/HKUDS/DeepTutor/issues) —— bug 反馈与功能建议++## 参考++- [`CONTRIBUTING.md`](https://github.com/HKUDS/DeepTutor/blob/main/CONTRIBUTING.md) —— 完整文档(分支策略、安全实践、维护者)diff --git a/site/src/content/docs/zh-cn/docs/explore/book.md b/site/src/content/docs/zh-cn/docs/explore/book.mdnew file mode 100644index 000000000..9f26f2e97--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/book.md@@ -0,0 +1,91 @@+---+title: Book Engine+description: 多 agent 流水线把你的材料编译成可交互的「活书」,13 种 block 类型。+---++给 DeepTutor 一个主题,让它指向你的知识库,**Book Engine** 就会产出一本结构化、可交互的书 —— 不是一份静态导出,而是一本可读、可自测、可在上下文里讨论的活书。++## 工作原理++幕后是一条多 agent 流水线在干重活:++1. **Outline proposal** —— 给定主题 + KB,提出章节结构+2. **Source retrieval** —— 从 KB 中拉相关段落+3. **Chapter tree synthesis** —— 装配层级化的章节提纲+4. **Page planning** —— 给每页规划放哪些 block+5. **Block compilation** —— 逐个生成 block(正文、quiz、代码、figure、……)++你始终掌控全局:review 提案、重排章节、在任意页面旁边开聊天。++## 13 种 block 类型++页面由 13 种 block 装配而成,每种用自己的交互组件渲染:++| Block | 说明 |+|-------|------|+| **Text** | 标准散文段落 |+| **Callout** | Tip / Warning / Note / Important —— 带色边的提示框 |+| **Quiz** | 内嵌交互题;答案与期望答复校验 |+| **Flash cards** | 正反翻转卡,用于间隔重复 |+| **Code** | 语法高亮的代码片段,可选可执行运行时 |+| **Figure** | 带 caption 和 alt text 的图片 |+| **Deep dive** | 可折叠区块,用于进阶 / 可选材料 |+| **Animation** | Manim 渲染的视频 |+| **Interactive demo** | 内嵌的交互式 HTML(包括用于数学的 **GeoGebra viewer**) |+| **Timeline** | 纵向事件时间线 |+| **Concept graph** | 展示概念间关系的迷你知识图谱 |+| **Section** | 用于嵌套 block 的分组容器 |+| **User note** | 给读者自己记笔记用的可编辑富文本 |++## KB 指纹与漂移检测++Book 的每一页都会 **对其源 KB 做指纹**。当源文档变了:++- `deeptutor book health <book_id>` 会报告漂移(哪些页面已经过期)+- `deeptutor book refresh-fingerprints <book_id>` 在你确认过变更之后清掉 stale-page 标记++所以即便 KB 在持续演化,用 Book Engine 也是安全的 —— 你会知道哪一页已经和源不同步。++## 在 Web UI 里使用++1. 左侧栏点 **Book**+2. **+ New book** → 选主题、挂 KB+3. Review 并编辑生成的提纲+4. 确认 —— 流水线开始逐页编译+5. 打开页面,可阅读、可自测、可旁边聊天++## 在 CLI 里++```bash+deeptutor book list # 工作区里所有的 book+deeptutor book health <book_id> # KB 漂移报告+deeptutor book refresh-fingerprints <book_id> # 把 stale 页面标记为已确认+```++health 的 JSON 输出:++```json+{+ "kb_drift": {+ "kb_name": "physics",+ "stale_pages": ["page_abc", "page_def"],+ "drift_ratio": 0.12+ },+ "log_health": {+ "last_compile": "2026-05-20T14:23:01Z",+ "errors": []+ }+}+```++## 与之搭配的++- **Knowledge** —— 一本书的质量取决于其 KB 的质量。从这里开始。+- **Page 旁边的聊天** —— 每一页都有一个绑定到它的聊天 composer;可以基于页面内容追问。+- **Notebooks** —— 把阅读 book 时的聊天要点存到 notebook,方便日后回顾。++## 另见++- [**知识库**](/zh-cn/docs/explore/knowledge/) —— 搭好支撑一本书的 KB+- [**Space → Notebooks**](/zh-cn/docs/explore/space/) —— 把 book 的讨论存下来+- [**CLI → book commands**](/zh-cn/docs/cli/commands/)diff --git a/site/src/content/docs/zh-cn/docs/explore/chat-workspace.md b/site/src/content/docs/zh-cn/docs/explore/chat-workspace.mdnew file mode 100644index 000000000..91fac0ac9--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/chat-workspace.md@@ -0,0 +1,162 @@+---+title: 聊天工作台+description: 一个对话线程,五种模式,任意工具组合。DeepTutor 核心的统一智能工作台。+---++聊天工作台是大多数用户花时间最多的地方。它是单一的对话界面,承载 **五种模式**,共享同一个 session、知识库、附件和引用历史。++可以在对话中途从一个随手问的小问题切到多 agent 解题、切到 quiz、切到完整的研究报告 —— 上下文不会丢。++++## 界面拆解++| 区域 | 作用 |+|------|------|+| **左侧边栏** | 所有界面之间的导航;顶部是聊天历史 |+| **顶部工具栏** | 把当前回合存到 Notebook、导出 Markdown、新建聊天、打开右侧的 Activity / Viewer 面板 |+| **Composer**(中间) | 输入区 —— 模式选择器、附件、知识库选择器、Space 选择器、模型选择器 |+| **Activity 面板** *(右侧,可切换)* | 实时流式展示流水线阶段、工具调用、耗时 |+| **Viewer 面板** *(右侧,可切换)* | 渲染生成产物:SVG、Mermaid、Chart.js、HTML、Manim 视频 |++## 五种模式++能力选择器在 composer 里。随时可以切 —— 对话上下文会保留。++### Chat++任意工具的自由对话。默认模式 —— 大约能覆盖 80% 的问题。++Chat 流水线跑的是 **agentic loop**:LLM 调用 → 解析协议标签(THINK / TOOL / FINISH)→ 并行派发工具调用 → 把结果回喂 → 迭代直到 FINISH 或触发上下文守护。++**Chat 模式下可用的工具**(按当前上下文逐回合组装):++| 工具 | 挂载时机 |+|------|----------|+| `rag` | 挂载了 KB |+| `read_source` | 有任意非图片类源 |+| `read_memory` / `write_memory` | 始终可用 |+| `web_search` | 在 设置 → 工具 里开启 |+| `web_fetch` | 始终可用 |+| `code_execution` | 在设置里开启 |+| `reason` | 在设置里开启 |+| `brainstorm` | 在设置里开启 |+| `paper_search` | 在设置里开启 |+| `geogebra_analysis` | 挂载了数学图片 |+| `list_notebook` / `write_note` | 至少存在 1 个 notebook |+| `github_query` | 始终可用 |+| `ask_user` | 始终可用 |++### Solve++多步解题:plan → investigate → solve → verify,并附精确的来源引用。基于 `deep_solve` agentic 引擎。++适用场景:需要分步演算的数学题、有多个子问题的物理题、推理过程需要显式展开的算法题。++常开工具:`rag`、`reason`、`code_execution`、`web_search`。++### Quiz++基于 KB 自动校验的出题。会为每道题派生一个聊天 composer,用于讨论 / 提示 / 评分。基于 `deep_question` agentic 引擎。++Quiz 内部三种子模式:++- **Custom** *(默认)* —— 按主题生成+- **Mimic** —— 上传一份历史试卷,按同样风格生成新题+- **Followup** —— 围绕之前的 quiz 题讨论,不生成新题++可配置:`num_questions`、`difficulty`、`question_types`(short_answer / mcq / numerical / code)、`per_type_counts`。++### Research++把一个主题分解成子主题,跨 RAG / web / arXiv **并行派发 agent**,产出一份带引用的报告,并支持增量 append 模式的迭代修订。++流程:++1. **Rephrasing** —— 精确复述你的问题+2. **Decomposing** —— 给出一个 3–7 子主题的提纲 ★(你在这一步确认 / 修改)+3. **Researching** —— 每个子主题跑并行 agentic loop+4. **Reporting** —— 合成结构化、带引用的 Markdown 报告++提纲确认这一步是最关键的 UX 设计:在昂贵的检索 / 推理跑起来之前,你有机会先把方向定准。++### Visualize++统一的可视化能力 —— analyzer 根据意图选 `render_type`:++| Render type | 适用 | 输出 |+|-------------|------|------|+| `svg` | 静态图、图标 | 内嵌 SVG |+| `chartjs` | 柱状 / 折线 / 饼 / 散点 | 可交互 canvas |+| `mermaid` | 流程图、序列图、状态机 | Mermaid SVG |+| `html` | 交互演示、小应用 | 沙箱化 iframe |+| `manim_video` | 数学动画 | MP4(需要 `[math-animator]` extra) |+| `manim_image` | 数学分镜 | PNG |++> Math Animator **不是独立的 capability** —— 它就是 Visualize 六种 render type 里的两种(`manim_video` / `manim_image`)。++## 累积的来源清单++一个 session 会跨回合累积引用。早些回合的 RAG / web 检索结果在同一段对话里后续依然可复用 —— 模型可以按编号引用。++## 附件++点 **Attach** 把文件带进当前回合:++| 类型 | 来源 |+|------|------|+| **PDF、DOCX、XLSX、PPTX** | 直接上传 —— 走对应的 extractor |+| **图片** | 直接上传 —— vision 模型 OCR / 解读 |+| **Notebook 记录** | Space → Notebooks 选择器 |+| **历史 session** | Space → Chat History 选择器 |+| **Question Bank 条目** | Space → Question Bank 选择器 |+| **Book 引用** | Book Engine 页面 |++附件 **不会** 塞进 system prompt —— 它们以 **工具可读的源** 的形式出现。需要时模型用 `read_source` 拉全文。++## 右上角动作++| 按钮 | 作用 |+|------|------|+| **Save to Notebook** | 把当前回合作为一条记录存到某个 notebook |+| **Download Markdown** | 把当前回合导出为 `.md` |+| **New chat** | 新建一个 session |+| **Activity** | 实时流式展示流水线事件(阶段、工具调用、耗时) |+| **Viewer** | 渲染生成产物(SVG、Mermaid、Chart.js、HTML、Manim) |++## 回合中的 `ask_user`++如果模型需要澄清,它会调 `ask_user` 工具,**暂停当前回合**,在聊天里渲染 1–3 个结构化问题。回答后点提交,回合带着你的回答继续。++## Session 连续性++每段对话都有 session id。Session 会跨:++- 浏览器刷新 / 重启+- 同一 session 内的模式切换+- Web UI ↔ CLI 边界++```bash+# 在 CLI 里继续 Web 端的 session+deeptutor chat --session sess_abc123+```++CLI 里起的 session 也会出现在 Web 侧边栏(反之亦然)。++## 记忆感知++模型通过 `read_memory` 工具内置访问你的 L3 记忆。几次 session 之后,它就会知道:++- 你的背景(`profile.md`)+- 你的知识范围(`scope.md`)+- 你明确表达过的偏好(`preferences.md`)+- 最近学了什么(`recent.md`)++完整的三层架构看 [**记忆系统**](/zh-cn/docs/explore/memory/)。++## 另见++- [**记忆系统**](/zh-cn/docs/explore/memory/) —— 三层持久化记忆 + Memory Graph+- [**知识库**](/zh-cn/docs/explore/knowledge/) —— 可直接被 RAG 使用的 Knowledge Base+- [**Space**](/zh-cn/docs/explore/space/) —— 阅读 / 回顾 中心+- [**设置**](/zh-cn/docs/explore/settings/) —— provider、工具、capabilitydiff --git a/site/src/content/docs/zh-cn/docs/explore/co-writer.md b/site/src/content/docs/zh-cn/docs/explore/co-writer.mdnew file mode 100644index 000000000..02db8cc96--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/co-writer.md@@ -0,0 +1,125 @@+---+title: Co-Writer 协同写作+description: AI 作为一等公民协作者的 Markdown 编辑器 —— Edit Agent、Narrator Agent、文档模板。+---++**Co-Writer** 是 DeepTutor 围绕 AI 协作设计的 Markdown 编辑器。内置两个 AI agent:++- **Edit Agent** —— 改写选中文本(rewrite、扩写、压缩、改风格)+- **Narrator Agent** —— 生成新内容(接着写、把提纲填成正文、解释某个概念)++外加文档模板、版本历史,以及与知识库的集成。++## 打开 Co-Writer++点左侧导航的 **Co-Writer**,或访问 `/co-writer`。第一次进来会看到文档选择器。选 **+ New document** 从零开始,或打开一个最近的。++## 编辑器++标准 Markdown 编辑器,双栏:++| 栏 | 内容 |+|----|------|+| **左** | Markdown 源码 —— 输入、编辑、格式化 |+| **右** | 渲染预览(可关掉以全宽看源码) |++快捷键:++| 键 | 动作 |+|----|------|+| `⌘B` / `Ctrl+B` | 加粗 |+| `⌘I` / `Ctrl+I` | 斜体 |+| `⌘K` / `Ctrl+K` | 插入链接 |+| `⌘S` / `Ctrl+S` | 保存(其实一直在自动保存) |+| `⌘/` / `Ctrl+/` | 切换 AI 侧栏 |++## AI 侧栏++用 `⌘/` 打开。两个 tab:++### Edit(基于选区)++在编辑器里选中文本,挑一个 Edit 动作:++| 动作 | 作用 |+|------|------|+| Rewrite | 同义改写 |+| Expand | 补细节、补背景、补例子 |+| Condense | 压缩,但保留要点 |+| Change tone | 正式 / 口语 / 学术 / 友好 |+| Fix grammar | 仅做轻微润色 |+| Translate | 翻译成另一种语言 |++Edit Agent 会用结果替换选中文本。`⌘Z` 可撤销。++### Narrator(基于光标)++把光标放到你想生成新内容的位置,然后:++| 动作 | 作用 |+|------|------|+| Continue | 从这里接着写 |+| Fill outline | 把你的项目符号提纲展开成正文 |+| Explain | 给上一段加一段解释 |+| Cite from KB | 去挂载的 KB 里查点东西并附引用 |++Narrator Agent 会在光标处插入内容。++## 挂载上下文++和 Chat 一样,Co-Writer 也能挂上下文:++- **知识库** —— Narrator 生成时可以从你的 KB 里取材+- **历史 session** —— 引用之前的 Chat / Research 回合+- **Notebook 记录** —— 从存好的片段里取++点 AI 侧栏的回形针图标。++## 模板++DeepTutor 自带几个示例模板:++| 模板 | 适用 |+|------|------|+| Research memo | 多源综合写作,带引用 |+| Lecture notes | 提纲 + 展开的小节 |+| Problem set solutions | 带代码块的题解 |+| Reading log | 一篇 paper / 一章一条记录 |++新建文档时挑一个。模板会预填好结构,里面的 prompt 提示也是 agent 能上下文理解的。++## 嵌入其他 capability 的产物++可以直接把 DeepTutor 其他 capability 的结果嵌进文档:++- **Deep Solve 结果** → 把解答拖到 Co-Writer+- **Visualize 产物** → 内嵌为 SVG / Mermaid 块+- **Quiz** → 内嵌为可展开的 details 块++## 保存与导出++文档每几秒自动保存。手动导出选项:++- **Download .md** —— 原始 Markdown+- **Download .pdf** —— 通过 Pandoc 渲染+- **Copy to clipboard** —— 粘到其他工具里++## 版本历史++点右上的时钟图标看版本历史。Co-Writer 会保留:++- 最近 24 小时的全部保存+- 最近 7 天的小时级快照+- 永久保留的天级快照++一键回滚到任意历史版本。++## 多用户须知++多用户模式下,每位用户有自己独立的 Co-Writer 文档空间。共享功能在路线图上(关注 [issue #498](https://github.com/HKUDS/DeepTutor/issues/498))。++## 另见++- [**知识库**](/zh-cn/docs/explore/knowledge/) —— 挂 KB 拿到 ground-truth 引用+- [**聊天工作台**](/zh-cn/docs/explore/chat-workspace/) —— 跑 Visualize / Research,把产物带进文档+- [**Space**](/zh-cn/docs/explore/space/) —— 保存并复用持久化产物diff --git a/site/src/content/docs/zh-cn/docs/explore/index.md b/site/src/content/docs/zh-cn/docs/explore/index.mdnew file mode 100644index 000000000..abfe35ac2--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/index.md@@ -0,0 +1,36 @@+---+title: 概览+description: 探索章节的地图 —— 五大核心界面、三层记忆系统、统一的设置中心。+---++DeepTutor 围绕 **五大核心界面**、贯穿底层的 **三层记忆系统**,以及统一的 **设置中心** 组织。本章节会逐个介绍;下表是地图。++++## 五大核心界面++| # | 界面 | 一句话 | 页面 |+|---|------|--------|------|+| 1 | **Chat** | 一个对话线程,五种模式(Chat / Solve / Quiz / Research / Visualize),任意工具组合 | [**聊天工作台**](/zh-cn/docs/explore/chat-workspace/) |+| 2 | **Co-Writer** | 双栏 Markdown 工作台,AI 作为一等公民协作者 | [**Co-Writer**](/zh-cn/docs/explore/co-writer/) |+| 3 | **Book** | 多 agent 流水线把你的材料编成可交互的「活书」 | [**Book Engine**](/zh-cn/docs/explore/book/) |+| 4 | **Knowledge** | 带版本管理的、可直接被 RAG 使用的文档库(端到端 LlamaIndex 实现) | [**知识库**](/zh-cn/docs/explore/knowledge/) |+| 5 | **Space** | 阅读 / 回顾 中心:Chat History、Notebook、Question Bank、Skills | [**Space**](/zh-cn/docs/explore/space/) |++## 此外++| 界面 | 一句话 | 页面 |+|------|--------|------|+| **Memory** | 三层流水线(L1 trace / L2 per-surface / L3 cross-surface)+ Memory Graph | [**记忆系统**](/zh-cn/docs/explore/memory/) |+| **Settings** | 统一控制台 —— 模型、Embedding、搜索、Capability、工具、记忆、MCP、外观、状态 | [**设置**](/zh-cn/docs/explore/settings/) |++## 它们如何组合++- **能力住在 Chat 里**:Solve / Quiz / Research / Visualize 不是单独的顶层 Tab,而是你在 Chat 里随时切换的「模式」,共享同一个 session、知识库、附件和引用历史。+- **工具与流程解耦**:内置工具(RAG、网页搜索、代码执行、reason、brainstorm、paper 搜索、`ask_user`、`web_fetch`、`write_note`、`list_notebook`、`github_query`)可以叠加在任何模式之上。在设置里加 MCP server 还能继续扩展。+- **Memory 是底层 Substrate**:每个界面都读写同一份三层记忆,所以你在 Chat 里学到的东西也会出现在 Co-Writer、TutorBot 对话、Book 阅读里。+- **Session 横跨界面**:Web 启动的 session 在 CLI 里看得到(反之亦然);一段聊天可以存到 Notebook、挂在 Book 页面下,或者被 Co-Writer 引用。++## 下一步++从 [**聊天工作台**](/zh-cn/docs/explore/chat-workspace/) 开始 —— 多数用户大约 80% 的时间花在这里。从命令行角度,看 [**CLI 概览**](/zh-cn/docs/cli/)。diff --git a/site/src/content/docs/zh-cn/docs/explore/knowledge.md b/site/src/content/docs/zh-cn/docs/explore/knowledge.mdnew file mode 100644index 000000000..71d878bb8--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/knowledge.md@@ -0,0 +1,131 @@+---+title: 知识库+description: 专为驱动 RAG 的文档集合而设的工作区。端到端 LlamaIndex 实现,版本化索引,抗漂移。+---++一个专门管理驱动 RAG 的文档集合的工作区。每个 KB 是一份对你文档的版本化、可检索的索引 —— 可挂到任意聊天回合、Co-Writer 文档或 Book。++++## 每个 KB 四个 tab++| Tab | 内容 |+|-----|------|+| **Files** | 浏览已上传的源、在线预览 PDF、看每个文件的大小 / 状态 |+| **Add documents** | 拖入 PDF、Office 文件(DOCX / XLSX / PPTX)、Markdown、纯文本以及一大票代码 / 数据格式 —— 自动走对应的 extractor |+| **Index versions** | 每次(重新)建索引都是一个被追踪的版本。可以回滚到旧版、对比不同 embedding 模型、查看 chunking 统计 —— 不会丢掉之前的 build |+| **Settings** | 选 embedding provider / 模型、chunking 参数、reranker。默认值从全局 LLM 和 embedding profile 继承 |++## 端到端基于 LlamaIndex++索引部分端到端基于 **LlamaIndex**。之前的双流水线拆分在 v1.4 refactor 中合并掉了。特性:++- **可重试的 re-index** —— 部分失败不会丢进度+- **Embedding 不匹配检测** —— 换了 embedder 时会先警告,避免静默产出坏结果+- **健壮的持久化向量处理** —— 损坏向量会被隔离,而不是整体崩+- **版本化索引** —— 每次重建都是新版本,可对比、可回滚++## 支持的文档类型++| 类型 | 说明 |+|------|------|+| **PDF** | 文本抽取;扫描页尽力 OCR |+| **DOCX** | 原生 Word 文档 |+| **XLSX** | 表格 —— 每个 sheet 作为一个 chunk batch |+| **PPTX** | PowerPoint —— 每张幻灯片作为一个 chunk |+| **TXT / MD / HTML** | 清洗并切片 |+| **代码文件** | Python / JS / TS / Go / Rust 及大量其他语言 |++## 创建一个 KB++在 UI 里:++1. 左侧栏 **Knowledge** → **+ New knowledge base**+2. 起名,选 RAG provider *(默认 LlamaIndex)*+3. 上传文档 —— 拖拽或文件选择器+4. **Create**++DeepTutor 会抽取、切片、对每个 chunk 做 embedding,并存好向量索引。一个 200 页的 PDF 通常 1–3 分钟。++## 默认 KB++打了 ⭐ 的 KB 是 **默认 KB** —— 新建聊天时会自动挂上。点星号可切换默认 KB。++## 索引版本++每次(重新)建索引都会被追踪:++- **回滚** —— 重建后检索质量变差时可以还原旧版+- **对比** —— 对同样的源文档做不同 embedding 模型 / chunking 策略的 A/B+- **检查** —— chunking 统计、embedding 维度、建索引耗时++## 在 UI 里搜索++KB 内部的搜索框跑的是临时 query。三种模式:++| 模式 | 算法 |+|------|------|+| **Hybrid** *(默认)* | 语义 embedding + BM25 关键词重排 |+| **Vector** | 纯 embedding |+| **Keyword** | 纯 BM25 |++## 在聊天里搜索++在 composer 里挂上 KB,自然提问就行 —— 模型自己决定要不要调 `rag`:++```text+You> [KB: physics attached] What's the relationship between kinetic energy and momentum?++Model> [calls rag tool]+ ● rag_search(query="kinetic energy momentum relationship", kb_name="physics")+ │ KE = p²/(2m), where p is momentum and m is mass...+ └ #1 rag++Model> [synthesizes a reply citing the retrieved passages]+```++## 多 KB 工作流++一个回合可以挂多个 KB。模型会并行查询。适合「对比两本教材」「在多篇 paper 里找同一概念」之类的任务。++## CLI 镜像++```bash+deeptutor kb list # 所有 KB+deeptutor kb info physics # KB 详情+deeptutor kb create physics --doc chapter1.pdf # 创建+deeptutor kb create textbooks --docs-dir ./pdfs/ # 从目录创建+deeptutor kb add physics --doc chapter3.pdf # 增量添加+deeptutor kb search physics "What is angular momentum?" # 临时检索+deeptutor kb set-default physics # 设为默认+deeptutor kb delete physics --force # 删除+```++完整 flag 参考看 [**Commands**](/zh-cn/docs/cli/commands/)。++## Embedding provider++Embedder 在 **设置 → Embedding** 里全局配置。新 KB 会继承当前值;已有的 KB 会保留它创建时的 embedder,直到被重新索引。++| Provider | 说明 |+|----------|------|+| OpenAI | `text-embedding-3-small`(1536d) / `-large`(3072d) |+| Cohere | `embed-v4.0` |+| Jina | `jina-embeddings-v3` |+| Gemini | `gemini-embedding-001` |+| SiliconFlow | `Qwen/Qwen3-Embedding-8B` |+| Aliyun DashScope | `qwen3-vl-embedding` |+| Ollama | 本地 embedding 模型 |+| vLLM / LM Studio / OpenAI 兼容 | 自定义 embedding endpoint |++完整 provider 矩阵:[**Providers**](/zh-cn/docs/get-started/providers/)。++## 多用户++多用户部署下,KB 按用户隔离。管理员可以在 `/admin/grants` 授予跨用户访问权限(read / read+search / read+search+modify)—— 见 [**多用户部署**](/zh-cn/docs/get-started/multi-user/)。++## 另见++- [**聊天工作台**](/zh-cn/docs/explore/chat-workspace/) —— 把 KB 挂到聊天回合+- [**Book Engine**](/zh-cn/docs/explore/book/) —— 书是从 KB 编译出来的+- [**记忆系统**](/zh-cn/docs/explore/memory/) —— KB 装的是文档,memory 装的是对话diff --git a/site/src/content/docs/zh-cn/docs/explore/memory.md b/site/src/content/docs/zh-cn/docs/explore/memory.mdnew file mode 100644index 000000000..9a9507890--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/memory.md@@ -0,0 +1,172 @@+---+title: 记忆系统+description: 三层流水线(L1 / L2 / L3)、一个可审视的 workbench,以及 Memory Graph —— 审计 DeepTutor 「为什么知道它知道的事」。+---++DeepTutor 的记忆是一条 **三层流水线**,在 `/memory` 配套一个可审视的 workbench。v1 的双文件 `SUMMARY.md` / `PROFILE.md` 模型已经退役;所有内容会在首次启动时迁移到新结构。++++## 三层++| 层 | 角色 | 存储 |+|----|------|------|+| **L1 · 工作区镜像** *(LIVE)* | 按 surface、按天的 append-only 交互轨迹。真实发生过什么的无损记录。 | `trace/<surface>/<YYYY-MM-DD>.jsonl` |+| **L2 · 按 surface 摘要** *(CURATED)* | 由 consolidator 抽取出的、surface 专属的事实。每条事实都带 footnote 引用回到 L1 trace。支持按文档的 **Update / Audit / Dedup** 操作。 | `L2/<surface>.md` |+| **L3 · 跨 surface 知识** *(SYNTHESIS)* | 跨 surface 合成:你的 `profile`、`recent` 时间线、`scope` 知识范围、`preferences` 偏好。每条带保留态度(hedged)的陈述都有 L2 证据支撑。 | `L3/{recent,profile,scope,preferences}.md` |++## 七个 surface 喂养这条流水线++| Surface | L1 捕获什么 |+|---------|-------------|+| `chat` | 每个聊天回合(输入、工具调用、输出) |+| `notebook` | Notebook 的增 / 改 / 删 |+| `quiz` | Quiz 生成 + 你的答案 + 评分结果 |+| `kb` | KB 的创建 / 查询 / 索引事件 |+| `book` | Book 阅读 session、页面级交互 |+| `tutorbot` | TutorBot 消息(跨所有 channel) |+| `cowriter` | Co-Writer 的文档编辑 |++## Consolidator++Consolidator 是 **LLM 驱动** 的,异步运行(`POST /memory/runs/start` —— 也可从 workbench 触发)。你可以:++- **手动触发** —— 在 workbench 点 "Run consolidator"+- **看着 L1 → L2 → L3 流动** —— 实时进度流+- **手动编辑任意层** —— 你的编辑在下一次运行时会被合并++默认节奏(可在 **设置 → 记忆** 里调):++| Pass | 触发时机 |+|------|----------|+| L1 → L2(按 surface) | 该 surface 每 N 个回合,或被触发时 |+| L2 → L3 跨 surface | 每天的第一个回合,或按需 |++## Memory Workbench(Web UI)++打开 `/memory`。五个子视图:++| Tab | 路由 | 内容 |+|-----|------|------|+| **L3** | `/memory/l3` *(默认)* | 四份跨 surface 文档 |+| **L2** | `/memory/l2` | 七份按 surface 文档 |+| **L1** | `/memory/l1` | 按 surface、按天的原始事件轨迹 |+| **Graph** | `/memory/graph` | Memory Graph(见下文) |+| **Resolve** | `/memory/resolve` | 通过 footnote id 反查源事件 |++## L3 详解++四份 markdown:++| 文件 | 内容 |+|------|------|+| `recent.md` | 近期学习的滚动摘要(最近几天 / 几周)—— 你在学什么、还有什么悬而未决 |+| `profile.md` | 你是谁:背景、目标、角色、学习风格 |+| `scope.md` | 你接触过的主题以及大致的掌握度 |+| `preferences.md` | 明确偏好:回复用什么语言、深度、格式、先举例还是先讲理论 |++**只有 `preferences.md` 由模型直接写**(通过 `write_memory` 工具)。另外三份由 consolidator agent 维护;你的手动编辑会在下一次 pass 时被合并进来。++## L2 详解++七份文档,每个 surface 一份。每份都是带 **footnote 风格引用** 的结构化 markdown,比如 `[^abc123]`,会链回具体的 L1 事件。++Workbench 中每份文档支持:++- **Update** —— 对该 surface 最近的 L1 事件重跑一次 consolidation+- **Audit** —— LLM 检查 L2 中过期、相互矛盾或没有依据的陈述+- **Dedup** —— 合并近似重复的要点++## L1 详解++按 surface、按天的 JSONL:++```jsonl+{"id":"evt_001","timestamp":"2026-05-21T14:23:01Z","surface":"chat","kind":"turn","content":"User asked about the chain rule"}+{"id":"evt_002","timestamp":"2026-05-21T14:23:18Z","surface":"chat","kind":"tool_call","content":"rag_search"}+{"id":"evt_003","timestamp":"2026-05-21T14:24:38Z","surface":"chat","kind":"turn_complete","content":"Explained with worked example"}+```++L1 直接看通常用处不大 —— 但 L2 的 footnote 会引用这些 id,而 **Resolve** 视图能让你从 footnote 反查到源。++## Memory Graph++++`/memory/graph` 上的 **Memory Graph** 把 **三层一次性渲染** 出来:++- **中心** —— L3 合成节点(`profile`、`recent`、`scope`、`preferences`)+- **中圈** —— 按 surface 的 L2 事实+- **外圈** —— 按 surface 分组的 L1 trace++悬停任意节点会有内联预览。点击 **锁定高亮**,然后沿 L3 → L2 → L1 一路向内追引用 —— 这样你就能审计 DeepTutor「为什么知道」关于你的某件事。++这是杀手特性:**透明可追溯**。DeepTutor 关于你的每一条断言,你都能钻进去看依据。++## 聊天怎么读 memory++每个聊天回合开始时,system prompt 里会拼接 L3 的几份文档:++```text+─── User profile (from memory) ─────────────────────────────────────+[recent.md content]++[profile.md content]++[scope.md content]++[preferences.md content]+─────────────────────────────────────────────────────────────────────+```++模型也有 `read_memory` 工具可在回合中查询,以及 `write_memory` 用于持久化明确偏好(≤240 字符、过内容安全过滤、自动链接到触发的 L1 事件)。++## 文件布局++```text+data/user/memory/+├── trace/+│ ├── chat/2026-05-21.jsonl ← L1+│ ├── chat/2026-05-22.jsonl+│ ├── notebook/2026-05-22.jsonl+│ ├── quiz/2026-05-22.jsonl+│ ├── kb/2026-05-22.jsonl+│ ├── book/2026-05-22.jsonl+│ ├── tutorbot/2026-05-22.jsonl+│ └── cowriter/2026-05-22.jsonl+├── L2/+│ ├── chat.md+│ ├── notebook.md+│ ├── quiz.md+│ ├── kb.md+│ ├── book.md+│ ├── tutorbot.md+│ └── cowriter.md+└── L3/+ ├── recent.md+ ├── profile.md+ ├── scope.md+ └── preferences.md+```++多用户模式下,这些位于 `multi-user/<uid>/memory/` 下。++## CLI 镜像++```bash+deeptutor memory show # L3 拼接(默认)+deeptutor memory show chat # 某个 L2 surface 文档+deeptutor memory show profile # 某个 L3 文档+deeptutor memory clear all --force # 清空所有层(破坏性操作)+deeptutor memory clear chat # 清掉某 surface 的 L1+```++## 多用户记忆++每位用户有自己独立的 memory,位于 `multi-user/<uid>/memory/`。Memory **不会跨用户共享** —— 即便是管理员也读不到别人的 memory。++## 另见++- [**聊天工作台**](/zh-cn/docs/explore/chat-workspace/) —— 聊天怎么消费 / 写入 memory+- [**Space → Notebooks**](/zh-cn/docs/explore/space/) —— notebook 喂养 `notebook` surface+- [**设置 → 记忆**](/zh-cn/docs/explore/settings/) —— 调整 consolidation 节奏diff --git a/site/src/content/docs/zh-cn/docs/explore/settings.md b/site/src/content/docs/zh-cn/docs/explore/settings.mdnew file mode 100644index 000000000..b7986e632--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/settings.md@@ -0,0 +1,130 @@+---+title: 设置+description: 统一控制中心 —— 外观、状态、LLM / Embedding / Search、Capabilities、记忆、MCP、工具。+---++设置界面在 v1.4 里被统一并按关注点拆分,采用 **草稿 / Apply** 模型 —— 改动是原子的,存之前可以回退。++++## Tab 列表++按左侧导航的顺序:++| Tab | 控制什么 |+|-----|----------|+| **Appearance** | UI 语言和主题(Cream、Snow、Dark、Glass) |+| **Status** | LLM、embedding、search、存储后端的实时健康探测 |+| **LLM** | Provider 目录、base URL、API key、当前激活模型 |+| **Embedding** | 形态同 LLM,但作用于 embedder |+| **Search** | Web 搜索 provider(Tavily / Brave / Jina / Serper / SearXNG / DuckDuckGo / Perplexity) |+| **Capabilities** | 各 capability 可调参数(chunking、LLM 预算、dedup、最大迭代) |+| **Memory** | 开关 consolidator、配置节奏与预算 |+| **MCP servers** | 注册外部 Model Context Protocol server |+| **Tools** | 查看每个内置工具的参数、状态、i18n 状态文案 |++页面顶部有一个 **Tour** 启动器,带新用户走一遍。++## Appearance++| 设置项 | 选项 |+|--------|------|+| 语言 | English、简体中文 |+| 主题 | Cream *(默认)* / Snow / Dark / Glass |+| 侧边栏密度 | Compact / Comfortable |++## Status++一份实时健康探测:++- LLM provider —— 连接 OK / 失败 / 未配置+- Embedding provider —— 同上+- Search provider —— 同上+- 存储后端 —— 连接状态、延迟+- 每个 provider 的上次健康检查时间++排查「模型不回我」类问题时,先看这里。++## LLM / Embedding / Search++三者共享相同的 **profile** 模型:++- 可以配 **多个 profile**(比如 `openai-gpt-4o`、`anthropic-sonnet-4`、`local-ollama`)+- 在每项服务里从目录中选 **一个激活模型**+- 单回合的临时覆盖发生在聊天 composer 的模型选择器里++用 **Test** 按钮测连接 —— 它会发一个小探测请求并报延迟。++完整 provider 矩阵:[**Providers**](/zh-cn/docs/get-started/providers/)。++## Capabilities++针对 Chat、Solve、Quiz、Research、Visualize、Co-Writer 的每 capability 可调参数:++| 设置项 | 含义 |+|--------|------|+| **Chunking** | 检索到的 KB 内容如何切分进上下文窗口 |+| **LLM budget** | 单次 capability 运行的最大 token / 最大迭代 |+| **Dedup policy** | 重复源如何处理 |+| **Reference policy** | 何时插入引用 |+| **Max iterations** | agentic loop 的硬性上限 |++底层是统一的 `emit_capability_result` 信封和共享的 `UsageTracker`,会暴露 **每次调用的成本**。++## Memory++| 设置项 | 效果 |+|--------|------|+| **开关 consolidator** | 暂停 / 恢复 L1 → L2 → L3 流水线 |+| **节奏** | 每个 consolidation pass 的运行频率 |+| **预算** | 每个 consolidation pass 的 token 预算 |+| **跳转到 workbench** | 直接打开 `/memory` |++完整三层架构看 [**记忆系统**](/zh-cn/docs/explore/memory/)。++## MCP servers++**Model Context Protocol** 集成让你可以把外部 MCP server 挂成额外工具。在这里加 server 配置;它们的工具会和内置工具并列出现。++示例:++```yaml+servers:+ filesystem:+ command: npx+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/Users/frank/docs"]+ github:+ command: npx+ args: ["-y", "@modelcontextprotocol/server-github"]+ env:+ GITHUB_PERSONAL_ACCESS_TOKEN: ${GITHUB_TOKEN}+```++## Tools++逐个查看每个内置工具:++- 名称、描述、参数+- 状态(启用 / 即将推出)+- i18n 状态文案(工具的进度消息在英文 / 中文下分别长什么样)+- 是否允许用户切换++五个工具支持用户全局开关:`brainstorm`、`web_search`、`paper_search`、`code_execution`、`reason`。基于上下文挂载的工具(`rag`、`read_memory`、`write_memory` 等)不能在这里切换 —— 它们会根据当前回合挂了什么自动出现。++## i18n++每个 capability 都自带一份标准的 `capabilities/prompts/{en,zh}/<name>.yaml`,保证状态消息在英文和中文下都一致。++## CLI 镜像++```bash+deeptutor config show # 打印当前配置(secret 已脱敏)+deeptutor init # 重跑向导,重新逐项提示+$EDITOR data/user/settings/model_catalog.json # 直接编辑+```++## 另见++- [**Providers**](/zh-cn/docs/get-started/providers/) —— 完整的 LLM / embedding / search provider 矩阵+- [**记忆系统**](/zh-cn/docs/explore/memory/) —— consolidator 到底干了什么+- [**多用户部署**](/zh-cn/docs/get-started/multi-user/) —— 与认证相关的设置diff --git a/site/src/content/docs/zh-cn/docs/explore/space.md b/site/src/content/docs/zh-cn/docs/explore/space.mdnew file mode 100644index 000000000..284a0e5b7--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/explore/space.md@@ -0,0 +1,119 @@+---+title: Space 空间+description: 你的个人学习资料库 —— Chat History、Notebooks、Question Bank、Skills,全在一个地方。+---++Space 是与活跃界面相对的 **阅读 / 回顾** 端。Chat / Co-Writer / Book 是你 *产出* 的地方,Space 则是你产出的所有东西的归宿 —— 可搜索、可回放。++## Space 里有什么++Space 在一套导航下集成了四个子界面:++| 子界面 | 内容 |+|--------|------|+| **Chat History** | 所有模式下的每段对话(Chat / Solve / Quiz / Research / Visualize) |+| **Notebooks** | 分类、配色的 notebook,承载来自 Chat、Research、Co-Writer 的记录 |+| **Question Bank** | 自动生成过的全部 quiz 题 —— 可收藏,可在聊天里 @ 引用 |+| **Skills** | 用户自己编写的 `SKILL.md` 文件,定义教学人设 |++## Chat History++每一段对话,支持:++- **标题重命名** —— 把自动生成的标题改成你能搜到的样子+- **删除** —— 删掉一个 session(连同它的 memory trace)+- **继续** —— 在新 tab 打开 session,或附加到当前 tab+- **逐回合删除** —— 每个入口都支持(chat、solve、quiz、research、visualize)++顶部浏览器搜索框会跨所有标题和正文做过滤 —— 想不起来某事是在哪个 session 里聊的时候很有用。++## Notebooks++Notebook 是 **你想留存的产出的持久化存储**。一个 notebook 包含:++- 一个名字 + 描述 + 颜色标签+- 一组记录(每条记录是一份 Markdown 文档)+- 反向链接到来源的聊天 session / Co-Writer 文档++### 存到 notebook++大部分界面都有 **Save to Notebook** 动作:++| 界面 | 存下的内容 |+|------|------------|+| **Chat** *(任意模式)* | 当前回合 + 其引用 |+| **Co-Writer** | 当前文档 |+| **Quiz** | 题目 + 你的答案 + 评分结果 |+| **Research** | 完整报告 + 提纲 + 引用 |++### 在聊天里用 notebook++Notebook 可以通过 `list_notebook` 和 `write_note` 工具在聊天里查询(至少存在 1 个 notebook 时会自动挂上)。也可以通过 composer 的 Space 选择器把具体记录挂到某个回合。++### CLI 镜像++```bash+deeptutor notebook list+deeptutor notebook create research-notes --description "Daily reading log"+deeptutor notebook show research-notes+deeptutor notebook add-md research-notes ./paper-summary.md+deeptutor notebook replace-md research-notes <record_id> ./updated.md+deeptutor notebook remove-record research-notes <record_id>+```++## Question Bank++**Quiz** 模式生成的每道自动校验题都会落到这里:++- **收藏** —— 标记一道题以便日后复习+- **分类** —— 题目会按来源继承一个主题标签+- **在聊天里 @ 引用** —— 在新回合里引用过去的题(「@question 47,为什么 B 是对的?」)++Question Bank 让间隔重复成为一个真实可用的工作流:把昨天做错的题重新生成、获取讲解、再做一次。++## Skills++Skills 是 **用户编写的人设定义** —— 按特定 schema 写的 `SKILL.md` 文件。当一个 skill 激活时:++- 它的人设会在生效期间 **注入聊天 system prompt**+- 它的 trigger 可以让它自动激活(比如你提到特定主题时)++### Skill schema++```markdown+---+name: socratic-tutor+description: Teach by asking probing questions instead of giving direct answers+triggers:+ - "explain"+ - "what is"+ - "teach me"+---++You are a Socratic tutor. Instead of giving direct answers:++1. Ask probing questions that reveal what the student already knows.+2. Guide them to discover the answer themselves.+3. Confirm understanding with a follow-up question.++Use clear, encouraging language. Never lecture.+```++DeepTutor 自带几个原型 —— Socratic、鼓励型、严格型 —— 你也可以在 Skills 这个 tab 里写自己的。++### Skill 存在哪里++- **个人 skills** —— `data/user/workspace/skills/*.md`+- **项目作用域 skills** —— `.deeptutor/skills/*.md` *(如果你在用项目工作区)*++## 与之搭配的++- **Chat** —— 把 notebook 记录 / 过去的 session 拉进当前回合做上下文+- **TutorBot** —— Bot 同样能使用 Skills(按 bot 单独配置)+- **Memory** —— Notebook 会成为 `notebook` surface 下的 L1 trace,最终被合并进 L3++## 另见++- [**聊天工作台**](/zh-cn/docs/explore/chat-workspace/) —— 产出 Space 所存的内容+- [**记忆系统**](/zh-cn/docs/explore/memory/) —— Space 的内容如何喂给记忆流水线+- [**探索 TutorBot**](/zh-cn/docs/tutorbot/) —— bot 同样使用 Skillsdiff --git a/site/src/content/docs/zh-cn/docs/get-started/cli-only.md b/site/src/content/docs/zh-cn/docs/get-started/cli-only.mdnew file mode 100644index 000000000..7f63ed9bf--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/cli-only.md@@ -0,0 +1,116 @@+---+title: 仅 CLI 安装+description: 选项 4 —— 给 headless 服务器、agent harness 以及 Claude Code / Codex / Hermes 用的轻量安装方式。+---++不需要 Web UI 时用这个。仅 CLI 的包从**源码 checkout** 安装,不走 PyPI。++## 安装++```bash+git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++# 创建 venv(macOS / Linux)+# Windows PowerShell:+# py -3.11 -m venv .venv-cli ; .\.venv-cli\Scripts\Activate.ps1+python3 -m venv .venv-cli && source .venv-cli/bin/activate+python -m pip install --upgrade pip++python -m pip install -e ./packaging/deeptutor-cli+deeptutor init --cli+deeptutor chat+```++`deeptutor init --cli` 和完整版应用共享同一份 `data/user/settings/` 目录结构,但是:++- **跳过**后端 / 前端端口的询问+- **embeddings 默认关闭**(如果打算用 `deeptutor kb …` 或 RAG 工具,选 `Yes`)+- 仍然会写完整的运行时布局(`system.json`、`auth.json`、`integrations.json`、`model_catalog.json`、`main.yaml`、`agents.yaml`)+- 仍然会询问当前激活的 LLM 提供商和模型++## 什么场景用它++- 把 DeepTutor 当作工具,挂在另一个 agent 的 harness 里跑(Claude Code、Codex、OpenCode 等)+- 没有浏览器的 headless 服务器 / VM+- 想要不带 Node.js toolchain 的快速安装++## 常用命令++```bash+deeptutor chat # 交互式 REPL+deeptutor chat --capability deep_solve --tool rag --kb my-kb+deeptutor run chat "解释一下傅里叶变换"+deeptutor run deep_solve "解 x^2 = 4" --tool rag --kb my-kb+deeptutor kb create my-kb --doc textbook.pdf+deeptutor memory show+deeptutor config show+```++完整命令面:[**DeepTutor CLI**](/zh-cn/docs/cli/)。++## 哪些能用、哪些不能++本地 `deeptutor-cli` 安装**不含任何 Web 资源或服务器依赖**。保留源码 checkout —— editable 安装是指向它的。++| 功能 | 仅 CLI | 完整安装 |+|------|--------|----------|+| `deeptutor chat` 交互式 REPL | ✅ | ✅ |+| `deeptutor run` capabilities | ✅ | ✅ |+| `deeptutor kb`(知识库) | ✅ *(init 时选择启用)* | ✅ |+| `deeptutor notebook` | ✅ | ✅ |+| `deeptutor memory` | ✅ | ✅ |+| `deeptutor bot`(TutorBot) | ✅ *(装了 `[tutorbot]` extra 时)* | ✅ |+| `deeptutor config show` | ✅ | ✅ |+| `deeptutor provider login` | ✅ | ✅ |+| `deeptutor serve`(FastAPI) | ❌ | ✅ |+| `deeptutor start`(Web UI) | ❌ | ✅ |+| Co-Writer UI | ❌ | ✅ |+| Memory Workbench UI | ❌ | ✅ |+| Book Engine UI | ❌ | ✅ |++后续要加 Web 应用,装 PyPI 包(选项 1),然后在同一工作区跑 `deeptutor init` + `deeptutor start`。++## 让另一个 agent 来调用++CLI 是 **agent-native** 的。`deeptutor run --format json` 每行输出一个 JSON 事件,`kb list`、`kb search`、`session show`、`notebook show` 等数据查询命令在已实现的地方都暴露 JSON —— 方便接到另一个 agent 的 harness 里。++把项目根目录的 [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) 丢给任何会调工具的 LLM,它就能自己驱动 DeepTutor。具体模式见 [**Agent handoff**](/zh-cn/docs/cli/agent-handoff/)。++## 升级++```bash+cd DeepTutor+git pull+pip install -e ./packaging/deeptutor-cli --upgrade+```++## 常见错误++### 装完之后 `deeptutor: command not found`++console script 没装到 PATH 上。确认 venv 已激活,或直接调用:++```bash+python -m deeptutor_cli.main chat+```++### 跑 `deeptutor serve` 时报 `ModuleNotFoundError: No module named 'fastapi'`++`deeptutor serve` 在仅 CLI 安装里**不可用**。请用 [**PyPI**](/zh-cn/docs/get-started/pypi/) 或 [**从源码安装**](/zh-cn/docs/get-started/from-source/)。++### TutorBot 命令提示 SDK 缺失++Channel SDKs(python-telegram-bot、slack-sdk 等)只在 `[tutorbot]` extra 里:++```bash+pip install -e "./packaging/deeptutor-cli[tutorbot]"+```++更多:[**故障排查**](/zh-cn/docs/get-started/troubleshooting/)。++## 下一步++- [**DeepTutor CLI**](/zh-cn/docs/cli/) —— 完整 CLI 参考+- [**Agent handoff**](/zh-cn/docs/cli/agent-handoff/) —— 让你的 agent 来驱动+- [**探索 TutorBot**](/zh-cn/docs/tutorbot/) —— 从 CLI 跑一个 botdiff --git a/site/src/content/docs/zh-cn/docs/get-started/docker.md b/site/src/content/docs/zh-cn/docs/get-started/docker.mdnew file mode 100644index 000000000..51e8e0a76--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/docker.md@@ -0,0 +1,145 @@+---+title: Docker+description: 选项 3 —— 一个容器跑完整 Web 应用,镜像来自 GHCR。+---++一个容器跑完整 Web 应用。镜像在 GitHub Container Registry 上:++- `ghcr.io/hkuds/deeptutor:latest` —— 稳定版+- `ghcr.io/hkuds/deeptutor:pre` —— 预发布版(如有)++## 运行++```bash+docker run --rm --name deeptutor \+ -p 127.0.0.1:3782:3782 \+ -p 127.0.0.1:8001:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++> ⚠️ **`3782` 和 `8001` 都要映射。** 端口 `3782` 提供 Web UI;端口 `8001` 是 FastAPI 后端,浏览器会直接调它 —— 容器里没有 in-container proxy。漏掉 `8001` 的映射,页面依然能加载,但 **设置** 会显示 "Backend unreachable" 然后没法用。++打开 <http://127.0.0.1:3782>。容器首次启动时会创建 `/app/data/user/settings/*.json`;从 Web 的设置页面里配置模型 provider。配置、API key、日志、工作区文件、记忆、知识库全部持久化在 `deeptutor-data` volume 里。++## 后台模式++加 `-d` 让它在后台跑:++```bash+docker run -d --name deeptutor \+ -p 127.0.0.1:3782:3782 -p 127.0.0.1:8001:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest++docker logs -f deeptutor # 跟踪日志+docker stop deeptutor # 停止+docker rm deeptutor # 删除(volume 仍保留)+```++`deeptutor-data` volume 会在 `stop` / `rm` 之间保留设置和工作区。如果真要从头来:`docker volume rm deeptutor-data`。++## 改宿主机端口++改 `-p host:container` 映射的左边即可:++```bash+docker run --rm --name deeptutor \+ -p 127.0.0.1:8088:3782 \+ -p 127.0.0.1:8089:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++如果你在 `/app/data/user/settings/system.json` 里改了容器侧端口,重启并把每条映射右侧同步改掉。++## 连本地 LLM(Ollama / LM Studio / llama.cpp / vLLM)++Docker 里的 `localhost` 指的是容器本身,不是宿主机。要访问宿主机上跑的模型服务,用 host gateway:++```bash+docker run --rm --name deeptutor \+ -p 127.0.0.1:3782:3782 -p 127.0.0.1:8001:8001 \+ --add-host=host.docker.internal:host-gateway \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++然后在 **设置 → LLM**(或 **Embedding**)里,把 provider Base URL 指到 `host.docker.internal`:++| 服务 | Base URL |+|------|----------|+| Ollama LLM | `http://host.docker.internal:11434/v1` |+| Ollama embedding | `http://host.docker.internal:11434/api/embed` |+| LM Studio | `http://host.docker.internal:1234/v1` |+| llama.cpp | `http://host.docker.internal:8080/v1` |++Docker Desktop(macOS / Windows)通常**不需要** `--add-host` 就能解析 `host.docker.internal`。Linux 上,这个 flag 是在现代 Docker Engine 上创建这个 hostname 的可移植方式。++### Linux 替代方案 —— host networking++加 `--network=host`,去掉 `-p` flags:++```bash+docker run --rm --name deeptutor \+ --network=host \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++容器直接共享宿主机网络,所以打开 <http://127.0.0.1:3782>(或 `system.json` 里的 `frontend_port`),宿主机服务也能用普通的 localhost URL 访问,比如 `http://127.0.0.1:11434/v1`。++> Host networking 把容器端口直接暴露在宿主机上,可能跟已有服务冲突。++## 升级++```bash+docker pull ghcr.io/hkuds/deeptutor:latest+docker rm -f deeptutor 2>/dev/null+docker run --rm --name deeptutor \+ -p 127.0.0.1:3782:3782 -p 127.0.0.1:8001:8001 \+ -v deeptutor-data:/app/data \+ ghcr.io/hkuds/deeptutor:latest+```++volume 会保留 —— 你的设置、KB、记忆都能撑过升级。++## 常见错误++### `Bind for 0.0.0.0:3782 failed: port is already allocated`++```bash+lsof -i :3782 # macOS+ss -ltnp | grep :3782 # Linux+```++干掉冲突进程,或者在 `-p` 映射里换一个宿主机端口。++### 容器立刻退出++```bash+docker logs deeptutor | tail -30+```++最常见原因:首次启动时 LLM API key 配错(后端会 fail fast)。先在 Web UI 的 **设置 → LLM** 里把 LLM 配好再说,或者从 volume 里删掉错的凭证:++```bash+docker run --rm -v deeptutor-data:/app/data alpine \+ sh -c 'rm /app/data/user/settings/model_catalog.json'+docker run ... ghcr.io/hkuds/deeptutor:latest # 用干净的 catalog 重启+```++### 前端能加载但 API 调用 404(远程 / 在反向代理后)++显式设置外部 API base。在 volume 里的 `data/user/settings/system.json`,把 `public_api_base` 设成对外可达的 URL。重启。++### Docker 里的多用户模式++直接在 volume 的 `data/user/settings/auth.json` 里把 auth 开关打开(`"enabled": true`),然后重启。容器会自动 pick up。完整配置见 [**多用户部署**](/zh-cn/docs/get-started/multi-user/)。++更多:[**故障排查**](/zh-cn/docs/get-started/troubleshooting/)。++## 下一步++- [**多用户部署**](/zh-cn/docs/get-started/multi-user/) —— 团队配置+- [**探索 DeepTutor**](/zh-cn/docs/explore/) —— 看看跑起来的应用diff --git a/site/src/content/docs/zh-cn/docs/get-started/from-source.md b/site/src/content/docs/zh-cn/docs/get-started/from-source.mdnew file mode 100644index 000000000..122ee2be7--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/from-source.md@@ -0,0 +1,139 @@+---+title: 从源码安装+description: 选项 2 —— clone 仓库、editable 安装、前端热重载。适合贡献者和高阶用户。+---++适合基于 checkout 做开发。使用 **Python 3.11+** 和 **Node.js 22 LTS**,与 CI 和 Docker 保持一致。++## 安装++```bash+git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++# 创建 venv(macOS / Linux)+# Windows PowerShell:+# py -3.11 -m venv .venv ; .\.venv\Scripts\Activate.ps1+python3 -m venv .venv && source .venv/bin/activate+python -m pip install --upgrade pip++# 安装后端 + 前端依赖+python -m pip install -e .+( cd web && npm ci --legacy-peer-deps )++deeptutor init+deeptutor start+```++源码安装会以 dev 模式跑 Next.js,指向本地 `web/` 目录;其它行为(配置目录结构、端口、`Ctrl+C` 停止)和 [**PyPI 安装**](/zh-cn/docs/get-started/pypi/) 一致。++## 用 Conda 代替 venv++```bash+conda create -n deeptutor python=3.11+conda activate deeptutor+python -m pip install --upgrade pip+# ...然后继续 `pip install -e .` 和 `npm ci`+```++## 可选的安装 extras++`pyproject.toml` 暴露了分层的 extras:++```bash+pip install -e ".[dev]" # 测试 / lint 工具+pip install -e ".[tutorbot]" # TutorBot 引擎 + channel SDKs+pip install -e ".[matrix]" # 不带 E2EE / libolm 的 Matrix channel+pip install -e ".[matrix-e2e]" # 带 E2EE 的 Matrix;需要 libolm+pip install -e ".[math-animator]" # Manim 插件;需要 LaTeX / ffmpeg / 系统库+```++也可以组合:`pip install -e ".[dev,tutorbot,math-animator]"`。++### 部分 extras 需要的系统依赖++| Extra | 系统库 |+|-------|--------|+| `matrix-e2e` | **libolm**:`brew install libolm`(macOS)/ `sudo apt install libolm-dev`(Debian) |+| `math-animator` | **LaTeX + ffmpeg**:`brew install --cask mactex && brew install ffmpeg`(macOS)/ `sudo apt install texlive-full ffmpeg`(Linux) |++## 前端依赖调整++新增或升级前端依赖时:++```bash+cd web+npm install --legacy-peer-deps+# 同时提交 web/package.json 和 web/package-lock.json+```++## Dev server 故障排查++**dev server 卡住**:如果 `deeptutor start` 报告已有前端但实际无响应,先停掉它打印出的 PID。如果根本没有 Next.js 进程在跑,那是 lock 文件过期了 —— 删掉重试:++```bash+rm -f web/.next/dev/lock web/.next/lock+deeptutor start+```++## 热重载++后端支持 `--reload`。在两个独立终端里分别启后端和前端,开发体验最好:++```bash+# 终端 A —— 带热重载的后端+python -m uvicorn deeptutor.api.main:app \+ --host 0.0.0.0 --port 8001 \+ --reload --reload-exclude "web/*" --reload-exclude "data/*"++# 终端 B —— 前端 dev server+cd web && npm run dev -- -p 3782+```++## 升级++```bash+git pull+pip install -e . --upgrade+cd web && npm ci --legacy-peer-deps+```++如果某次发布动了配置 schema,再跑一次 `deeptutor init` 把新增字段补上。已有配置会保留。++## 常见错误++### `error: Microsoft Visual C++ 14.0 is required`(Windows)++部分 Python 依赖会编译 C 扩展。装 [**Build Tools for Visual Studio**](https://visualstudio.microsoft.com/visual-cpp-build-tools/),勾选 "Desktop development with C++"。++### 找不到 `libolm`(装了 `matrix-e2e` 时)++```bash+brew install libolm # macOS+sudo apt install libolm-dev # Debian / Ubuntu+pip install -e ".[matrix-e2e]" --force-reinstall+```++### `npm ci` 慢或超时++```bash+npm config set fetch-timeout 600000+cd web && npm ci --legacy-peer-deps+```++### 后端 `--reload` 每次保存都疯狂重启++`--reload-exclude` 漏了。用下面命令重启:++```bash+python -m uvicorn deeptutor.api.main:app \+ --host 0.0.0.0 --port 8001 \+ --reload --reload-exclude "web/*" --reload-exclude "data/*"+```++更多修复方法:[**故障排查**](/zh-cn/docs/get-started/troubleshooting/)。++## 下一步++- [**DeepTutor CLI**](/zh-cn/docs/cli/) —— 在同一个工作区里使用 CLI+- [**探索 DeepTutor**](/zh-cn/docs/explore/) —— 看看跑起来的应用diff --git a/site/src/content/docs/zh-cn/docs/get-started/index.md b/site/src/content/docs/zh-cn/docs/get-started/index.mdnew file mode 100644index 000000000..16912c76a--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/index.md@@ -0,0 +1,52 @@+---+title: 快速上手+description: DeepTutor 提供四种安装方式 —— PyPI、源码、Docker、纯 CLI。挑一个适合你的。+---++DeepTutor 提供 **四种安装路径**,全部使用同一份工作区布局:设置文件位于运行命令所在目录下的 `data/user/settings/`(或者你显式指定的 `DEEPTUTOR_HOME` / `deeptutor start --home` 位置)。++对完整 Web 应用,推荐流程是:**挑一个工作区目录 → 安装 → `deeptutor init` → `deeptutor start`**。++## 选择安装路径++| 方式 | 适用场景 | 页面 |+|------|---------|------|+| **PyPI** | 新手、追求最顺滑流程、不想 clone | [**PyPI 安装**](/zh-cn/docs/get-started/pypi/) |+| **源码** | 开发者、需要热重载 | [**源码安装**](/zh-cn/docs/get-started/from-source/) |+| **Docker** | 生产部署、托管主机、需要持久化卷 | [**Docker**](/zh-cn/docs/get-started/docker/) |+| **纯 CLI** | 无界面服务器、被其他 agent 调度、不需要 Web UI | [**纯 CLI 安装**](/zh-cn/docs/get-started/cli-only/) |++> 🧪 **试用 v1.4.0 beta?** PyPI 会把 `1.4.0-beta` 规范化成 `1.4.0b0`,所以 `pip install -U deeptutor` 仍然停在稳定版。要切到 beta:`pip install --pre -U deeptutor`,或精准锁定:`pip install -U deeptutor==1.4.0b0`。++## 最低环境要求++| 组件 | 版本 |+|------|------|+| Python | **3.11+** |+| Node.js | **20+**(PyPI 安装) / **22 LTS**(源码安装,对齐 CI 与 Docker) |+| 内存 | 空闲 4 GB |+| 磁盘 | 空闲 2 GB |++还需要一个 **LLM API 密钥**(OpenAI / Anthropic / Gemini / DeepSeek / Azure / Ollama / LM Studio / llama.cpp / vLLM,或任何 OpenAI 兼容端点);如果要使用知识库(Knowledge Base),最好再准备一个 **Embedding API 密钥**。++## 启动后会监听什么++执行 `deeptutor start` 之后会起两个服务:++| 服务 | 默认端口 |+|------|---------|+| FastAPI 后端 | `8001` |+| Next.js 前端 | `3782` |++两个端口都可以在 `data/user/settings/system.json` 中改,或在 `deeptutor init` 向导里现场指定。++## 装好之后++只要你能打开 `http://localhost:3782/`:++- [**探索 DeepTutor**](/zh-cn/docs/explore/) —— 五大核心界面 + 记忆系统 + 设置中心的总览+- [**DeepTutor CLI**](/zh-cn/docs/cli/) —— 在终端里驱动一切+- [**TutorBot 渠道**](/zh-cn/docs/tutorbot/) —— 把持久化的 AI 导师连到 Telegram、Slack、飞书+- [**多用户部署**](/zh-cn/docs/get-started/multi-user/) —— 部署给一个团队++如果遇到问题,跳到 [**故障排查**](/zh-cn/docs/get-started/troubleshooting/)。diff --git a/site/src/content/docs/zh-cn/docs/get-started/multi-user.md b/site/src/content/docs/zh-cn/docs/get-started/multi-user.mdnew file mode 100644index 000000000..dae45a18b--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/multi-user.md@@ -0,0 +1,146 @@+---+title: 多用户部署+description: 打开认证开关,DeepTutor 就变成多租户部署 —— 每个用户拥有独立的工作区,资源由管理员统一编排。+---++打开认证开关,DeepTutor 就变成多租户部署 —— **每个用户拥有独立的工作区**,**资源由管理员统一编排**。第一个注册的人成为 admin,代表所有其他人配置模型、API key 和知识库。后续账号由 admin 创建(邀请制),每个人有自己作用域内的对话历史 / 记忆 / 笔记本 / 知识库,并且只能看到 admin 分配给他们的 LLM、KB 和 skill。++## 快速上手(5 步)++```bash+# 1. 在 data/user/settings/auth.json 里开启 auth:+# {"enabled": true, "token_expire_hours": 24, "cookie_secure": false}++# 2. 重启 web 栈。+deeptutor start++# 3. 打开 http://localhost:3782/register 并创建第一个账号。+# 第一次注册是唯一一次公开注册;那个用户成为 admin,之后+# /register 端点会自动关闭。++# 4. 以 admin 身份进入 /admin/users → "Add user" 给团队成员开账号。++# 5. 对每个用户,点击 slider 图标 → 分配 LLM profile、知识库和 skill。+# 保存。用户现在就能登录开干了。+```++## admin 能看到什么++- **完整的设置页面**,在 `/settings` —— 管理 LLM / embedding / 搜索 provider、API key、模型 catalog,以及运行时 "Apply"。+- **用户管理**,在 `/admin/users` —— 创建、提升、降级、删除账号。一旦有了第一个 admin,公开的 `/register` 端点会自动关闭;后续账号走 `POST /api/v1/auth/users`(admin-only)。+- **授权编辑器** —— 对每个非 admin 用户,挑选他们可用的模型 profile、知识库和 skill。授权只带**逻辑 ID**;API key 永远不会越过授权边界。+- **审计追踪** —— 每次授权变更和被授权资源的访问都会追加到 `multi-user/_system/audit/usage.jsonl`。++## 普通用户得到什么++- **独立工作区**,在 `multi-user/<uid>/` 下 —— 自己的对话历史(`chat_history.db`)、记忆、笔记本和个人知识库。默认什么都不共享。+- **只读访问** admin 分配的知识库和 skill,在他们自己的资源旁边以 "Assigned by admin" 徽章并列展示。+- **删减版设置页面** —— 只展示主题、语言以及已授权模型的摘要。API key、base URL 和 provider endpoint 不会返回给非 admin 请求。+- **作用域内的 LLM** —— 对话轮次通过 admin 分配的模型走。如果没有授权的 LLM,那一轮会被直接拒绝(不会偷偷 fallback 到 admin 的 key)。++## 工作区布局++```text+multi-user/+├── _system/+│ ├── auth/users.json # 凭证哈希、角色+│ ├── auth/auth_secret # JWT 签名密钥(自动生成)+│ ├── grants/<uid>.json # 每个用户的资源授权(admin 管理)+│ └── audit/usage.jsonl # 审计追踪+└── <uid>/+ ├── user/+ │ ├── chat_history.db+ │ ├── settings/interface.json+ │ └── workspace/{chat,co-writer,book,...}+ ├── memory/+ └── knowledge_bases/...+```++## 配置参考++| 设置 | 必填 | 说明 |+|------|------|------|+| `data/user/settings/auth.json: enabled` | 是 | 设为 `true` 开启多用户 auth。默认 `false`(单用户模式 —— 各处都走 admin 路径)。 |+| `multi-user/_system/auth/auth_secret` | 推荐 | JWT 签名密钥。首次带认证启动时,若缺失会自动生成。 |+| `data/user/settings/auth.json: token_expire_hours` | 否 | JWT 寿命;默认 `24`。 |+| `data/user/settings/auth.json: username` / `password_hash` | 否 | 可选的 headless 单用户引导凭证。用浏览器注册时留空。 |+| `data/user/settings/system.json` | 否 | `deeptutor start` 会从运行时设置推导前端 auth flag 和 API base。 |++## 重要注意事项++> ⚠️ **PocketBase 模式(设置了 `integrations.pocketbase_url`)只支持单用户。** 默认 PocketBase schema 在 `users` 上没有 `role` 字段(每次登录解析为 `role=user`,无法创建 admin),并且 `sessions` / `messages` / `turns` 查询不会按 `user_id` 过滤。多用户部署必须把 `integrations.pocketbase_url` 留空,使用默认的 JSON/SQLite 后端。++> ⚠️ **建议单进程部署。** "第一个用户自动提升为 admin" 这个机制由进程内的 `threading.Lock` 保护。多 worker 部署应当离线 provision 第一个 admin(先以 `auth.json.enabled=false` 启动,通过引导流程注册 admin,再把 `auth.json.enabled=true` 打开),或者把用户存储换成外部系统。++## 生产 checklist++- ✅ 设置一个强 `auth_secret` 并备份+- ✅ 在 `auth.json` 里设 `cookie_secure: true`,让 session cookie 必须走 HTTPS+- ✅ 把 DeepTutor 放在反向代理后面(Caddy、nginx、Traefik),用 TLS termination+- ✅ 在 `system.json` 里设 `public_api_base`,让前端 bundle 知道去哪儿找后端+- ✅ 定期备份 `multi-user/`++## Caddyfile 示例++```caddyfile+deeptutor.example.com {+ reverse_proxy /api/* localhost:8001+ reverse_proxy localhost:3782+}+```++然后在 `data/user/settings/system.json` 里:++```json+{+ "public_api_base": "https://deeptutor.example.com"+}+```++在 `data/user/settings/auth.json` 里:++```json+{+ "enabled": true,+ "token_expire_hours": 24,+ "cookie_secure": true+}+```++## 常见错误++### 开启 auth 后 `404 /register`++前端 bundle 可能被缓存了。用 Docker 的话,重新创建容器。从源码起的话,编辑完 `auth.json` 后重启 `deeptutor start`。++### 第一次登录能进但没有 admin 链接++确认 `multi-user/_system/auth/users.json` 里第一个用户的 `"role": "admin"`。如果不是,手动改掉并重启。++### 重启后 `Cannot decode JWT`++`auth_secret` 丢了或被重新生成。从备份恢复,或者接受新的 secret 然后要求所有用户重新登录。++## headless 单用户引导++对于没人能在浏览器里注册的自动化场景,直接在 `auth.json` 里设凭证:++```json+{+ "enabled": true,+ "username": "alice",+ "password_hash": "<bcrypt-hash>",+ "token_expire_hours": 24+}+```++生成 hash:++```python+import bcrypt+print(bcrypt.hashpw(b"your-password", bcrypt.gensalt()).decode())+```++然后 `deeptutor start`,用 `alice` + your-password 登录。++更多修复方法:[**故障排查**](/zh-cn/docs/get-started/troubleshooting/)。diff --git a/site/src/content/docs/zh-cn/docs/get-started/providers.md b/site/src/content/docs/zh-cn/docs/get-started/providers.mdnew file mode 100644index 000000000..d50fbb049--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/providers.md@@ -0,0 +1,157 @@+---+title: Provider 配置+---+++DeepTutor 当前内置 32 个 LLM provider 绑定、12 个 embedding provider 绑定和 7 个激活的搜索 provider(外加显式的 `none` 选项)。可以通过 Web 设置页面、`deeptutor init`、`data/user/settings/model_catalog.json` 或进程环境变量来配置。项目根目录的 `.env` 文件**不会**被运行时自动加载。++## LLM Providers++| Provider | Binding | 默认 Base URL |+| :---------------------- | :-------------------- | :-------------------------------------------------------- |+| AiHubMix | `aihubmix` | `https://aihubmix.com/v1` |+| Anthropic | `anthropic` | `https://api.anthropic.com/v1` |+| Azure OpenAI | `azure_openai` | — |+| BytePlus | `byteplus` | `https://ark.ap-southeast.bytepluses.com/api/v3` |+| BytePlus Coding Plan | `byteplus_coding_plan`| `https://ark.ap-southeast.bytepluses.com/api/coding/v3` |+| Custom (OpenAI-compat) | `custom` | — |+| Custom Anthropic | `custom_anthropic` | — |+| DashScope (Qwen) | `dashscope` | `https://dashscope.aliyuncs.com/compatible-mode/v1` |+| DeepSeek | `deepseek` | `https://api.deepseek.com` |+| Gemini | `gemini` | `https://generativelanguage.googleapis.com/v1beta/openai/`|+| GitHub Copilot | `github_copilot` | `https://api.githubcopilot.com` |+| Groq | `groq` | `https://api.groq.com/openai/v1` |+| llama.cpp | `llama_cpp` | `http://localhost:8080/v1` |+| LM Studio | `lm_studio` | `http://localhost:1234/v1` |+| MiniMax | `minimax` | `https://api.minimax.io/v1` |+| MiniMax Anthropic | `minimax_anthropic` | `https://api.minimax.io/v1` |+| Mistral | `mistral` | `https://api.mistral.ai/v1` |+| Moonshot (Kimi) | `moonshot` | `https://api.moonshot.ai/v1` |+| Ollama | `ollama` | `http://localhost:11434/v1` |+| NVIDIA NIM | `nvidia_nim` | — |+| OpenAI | `openai` | `https://api.openai.com/v1` |+| OpenAI Codex | `openai_codex` | `https://chatgpt.com/backend-api` |+| OpenRouter | `openrouter` | `https://openrouter.ai/api/v1` |+| OpenVINO Model Server | `ovms` | `http://localhost:8000/v3` |+| Qianfan (Ernie) | `qianfan` | `https://qianfan.baidubce.com/v2` |+| SiliconFlow | `siliconflow` | `https://api.siliconflow.cn/v1` |+| Step Fun | `stepfun` | `https://api.stepfun.com/v1` |+| vLLM | `vllm` | `http://localhost:8000/v1` |+| VolcEngine | `volcengine` | `https://ark.cn-beijing.volces.com/api/v3` |+| VolcEngine Coding Plan | `volcengine_coding_plan`| `https://ark.cn-beijing.volces.com/api/coding/v3` |+| Xiaomi MIMO | `xiaomi_mimo` | `https://api.xiaomimimo.com/v1` |+| Zhipu AI (GLM) | `zhipu` | `https://open.bigmodel.cn/api/paas/v4` |++### 配置++```dotenv+LLM_BINDING=openai+LLM_MODEL=gpt-4o-mini+LLM_API_KEY=sk-xxx+LLM_HOST=https://api.openai.com/v1+```++::: tip+任何 OpenAI 兼容的 API 都能配合 `openai` 或 `custom` binding 使用。把 `LLM_HOST` 设成你 provider 的 base URL 即可。+:::++## Embedding Providers++| Provider | Binding | 模型示例 | 默认维度 |+| :------------------- | :------------ | :------------------------ | :---------: |+| OpenAI | `openai` | `text-embedding-3-large` | 3072 |+| Gemini | `gemini` | `gemini-embedding-001` | 3072 |+| Azure OpenAI | `azure_openai`| 部署名称 | — |+| Cohere | `cohere` | `embed-v4.0` | 1024 |+| Jina | `jina` | `jina-embeddings-v3` | 1024 |+| Ollama | `ollama` | `nomic-embed-text` | 768 |+| vLLM / LM Studio | `vllm` | 任意 embedding 模型 | — |+| SiliconFlow | `siliconflow` | `Qwen/Qwen3-Embedding-8B` | 4096 |+| Aliyun DashScope | `aliyun` | `qwen3-vl-embedding` | 2560 |+| OpenRouter | `openrouter` | 取决于 provider | — |+| 任意 OpenAI 兼容 | `custom` | — | — |+| Custom OpenAI SDK | `custom_openai_sdk` | — | — |++### 配置++`EMBEDDING_HOST` 必须是完整的 embedding endpoint URL,而不仅仅是 provider 的 base URL。++```dotenv+EMBEDDING_BINDING=openai+EMBEDDING_MODEL=text-embedding-3-large+EMBEDDING_API_KEY=sk-xxx+EMBEDDING_HOST=https://api.openai.com/v1/embeddings+EMBEDDING_DIMENSION=+```++::: warning+建好知识库之后再换 embedding 模型会引发维度不匹配。DeepTutor 会检测到并提醒你 —— 换了模型就要把知识库重建。+:::++## 搜索 Providers++| Provider | 环境变量 Key | 备注 |+| :---------- | :------------------- | :------------------------------- |+| Brave | `BRAVE_API_KEY` | 推荐,有免费额度 |+| Tavily | `TAVILY_API_KEY` | |+| Serper | `SERPER_API_KEY` | |+| Jina | `JINA_API_KEY` | |+| SearXNG | — | 自部署,不需要 API key |+| DuckDuckGo | — | 不需要 API key |+| Perplexity | `PERPLEXITY_API_KEY` | 需要 API key |+| None | — | 显式关闭网页搜索 |++### 配置++```dotenv+SEARCH_PROVIDER=brave+SEARCH_API_KEY=your-api-key+```++搜索是可选的 —— DeepTutor 不配搜索也能跑。配了之后,`web_search` 工具会在 Chat 和其他 capability 里可用。旧的 `exa`、`baidu`、`openrouter` 搜索设置只作为弃用的兼容值保留,不推荐作为新选择。++## 本地模型++DeepTutor 通过若干 provider 支持本地托管的模型:++### Ollama++```dotenv+LLM_BINDING=ollama+LLM_MODEL=llama3.1+LLM_HOST=http://localhost:11434/v1+LLM_API_KEY=ollama++EMBEDDING_BINDING=ollama+EMBEDDING_MODEL=nomic-embed-text+EMBEDDING_HOST=http://localhost:11434/v1+EMBEDDING_API_KEY=ollama+EMBEDDING_DIMENSION=768+```++### LM Studio++```dotenv+LLM_BINDING=lm_studio+LLM_MODEL=your-model-name+LLM_HOST=http://localhost:1234/v1+LLM_API_KEY=lm-studio+```++### vLLM++```dotenv+LLM_BINDING=vllm+LLM_MODEL=your-model-name+LLM_HOST=http://localhost:8000/v1+LLM_API_KEY=token-abc123+```++### llama.cpp++```dotenv+LLM_BINDING=llama_cpp+LLM_MODEL=your-model-name+LLM_HOST=http://localhost:8080/v1+LLM_API_KEY=not-needed+```diff --git a/site/src/content/docs/zh-cn/docs/get-started/pypi.md b/site/src/content/docs/zh-cn/docs/get-started/pypi.mdnew file mode 100644index 000000000..84e550207--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/pypi.md@@ -0,0 +1,142 @@+---+title: 从 PyPI 安装+description: 选项 1 —— 最顺滑的安装方式。pip install deeptutor,然后 init、start。+---++PyPI 安装是最顺滑的路径:**完整本地 Web 应用 + CLI,无需 clone**。需要 **Python 3.11+** 以及 PATH 上的 **Node.js 20+** —— `deeptutor start` 会拉起内置的 Next.js standalone 服务器。++## 安装++```bash+mkdir -p my-deeptutor && cd my-deeptutor+pip install -U deeptutor+deeptutor init # 提示输入端口 + LLM 提供商 + 可选 embedding+deeptutor start # 同时启动后端 + 前端;保持终端开着+```++`deeptutor init` 会询问:++- **后端端口**(默认 `8001`)+- **前端端口**(默认 `3782`)+- **LLM 提供商** / base URL / API key / 模型+- **可选 embedding 提供商**(用于 RAG / 知识库)++`deeptutor start` 之后,打开终端里打印的前端地址 —— 默认是 <http://127.0.0.1:3782>。按 `Ctrl+C` 同时停掉后端和前端。++> 跳过 `deeptutor init` 也行,应用会以默认端口和空配置启动,进 **设置 → LLM** 再配也可以。++## 试用 v1.4.0 beta++PyPI 把 `1.4.0-beta` 规范化为 `1.4.0b0`,所以普通 `pip install -U deeptutor` 不会跳到 beta:++```bash+pip install --pre -U deeptutor+# 或精确锁定:+pip install -U deeptutor==1.4.0b0+```++## 文件存在哪里++工作区位于运行命令时所在的目录(首次启动会在那里创建 `data/` 目录)。覆盖位置:++```bash+DEEPTUTOR_HOME=/opt/deeptutor deeptutor start+# 或:+deeptutor start --home /opt/deeptutor+```++首次 init 后的目录结构:++```text+my-deeptutor/+└── data/+ └── user/+ ├── settings/+ │ ├── system.json+ │ ├── auth.json+ │ ├── integrations.json+ │ ├── interface.json+ │ ├── model_catalog.json+ │ ├── main.yaml+ │ └── agents.yaml+ ├── memory/+ └── workspace/+```++各配置文件的含义在下面 [**配置参考**](#datausersettings-配置文件) 一节。++## 安装之后能直接用什么++不用离开工作区,随时进 CLI:++```bash+deeptutor chat # 交互式 REPL+deeptutor run chat "解释一下傅里叶变换" # 单次执行+deeptutor kb create my-kb --doc textbook.pdf # 建一个知识库+deeptutor memory show # 查看记忆+deeptutor config show # 查看当前配置+```++完整命令面:[**DeepTutor CLI**](/zh-cn/docs/cli/)。++## 升级++```bash+pip install --upgrade deeptutor+deeptutor start+```++工作区会在升级中保留。++## `data/user/settings/` 配置文件++`data/user/settings/` 下的所有文件都是纯 JSON / YAML。浏览器里的 **设置** 页是推荐的编辑入口。++| 文件 | 用途 |+|------|------|+| `model_catalog.json` | LLM / embedding / 搜索 provider 配置;API key;当前激活模型 |+| `system.json` | 后端 / 前端端口、对外 API base、CORS、SSL 校验、附件目录 |+| `auth.json` | 可选的认证开关、用户名、密码哈希、token / cookie 设置 |+| `integrations.json` | 可选的 PocketBase 与 sidecar 集成设置 |+| `interface.json` | UI 语言 / 主题 / 侧边栏偏好 |+| `main.yaml` | 运行时默认行为与路径注入 |+| `agents.yaml` | 各 capability / 工具的温度和 token 设置 |++> 项目根目录的 `.env` **不会** 被当作应用配置加载。建议从浏览器里 **设置 → LLM** 配置,或直接编辑 `model_catalog.json`。++## 常见错误++### macOS 上 `python: command not found`++```bash+python3 -m pip install -U deeptutor+python3 -m deeptutor init # 或者,如果 entry point 在 PATH 上,直接 `deeptutor init`+```++### Node.js 不在 PATH 上++`deeptutor start` 会拉起内置 Next.js 服务器,需要 PATH 上有 `node`。从 <https://nodejs.org> 装 Node 20+,或 `brew install node@22`。++### 端口 `3782` 或 `8001` 被占用++```bash+lsof -i :3782 # macOS+ss -ltnp | grep :3782 # Linux+```++杀掉占用进程,或重跑 `deeptutor init` 改端口。++### LLM provider 401 Unauthorized++API key 被 provider 拒绝。在 **设置 → LLM** 重新输入,或:++```bash+deeptutor init # 重跑向导,工作区会保留+```++更多问题:[**故障排查**](/zh-cn/docs/get-started/troubleshooting/)。++## 下一步++- [**探索 DeepTutor**](/zh-cn/docs/explore/) —— 看看跑起来的应用+- [**多用户部署**](/zh-cn/docs/get-started/multi-user/) —— 部署成团队服务器diff --git a/site/src/content/docs/zh-cn/docs/get-started/troubleshooting.md b/site/src/content/docs/zh-cn/docs/get-started/troubleshooting.mdnew file mode 100644index 000000000..b160c23c3--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/get-started/troubleshooting.md@@ -0,0 +1,332 @@+---+title: 故障排查+description: 各种安装路径下的常见错误,以及可以直接复制粘贴的修复方法。+---++如果你的安装行为不太对劲,在下面找到对应的症状。错误按类别分组。修复方法在当前 `main` 分支上验证过。++## 端口与进程++### `Address already in use :3782`(或 :8001)++有别的东西绑定到这个端口了。找出来:++```bash+# macOS+lsof -i :3782++# Linux+ss -ltnp | grep :3782++# Windows PowerShell+Get-NetTCPConnection -LocalPort 3782+```++干掉它,或者通过重跑 setup 向导或编辑 `data/user/settings/system.json` 改 DeepTutor 端口:++```bash+deeptutor init+```++```json+{+ "backend_port": 18001,+ "frontend_port": 4000+}+```++如果只是一次性进程级覆盖,启动 DeepTutor 之前在 shell 里 export 环境变量即可:`BACKEND_PORT=18001 FRONTEND_PORT=4000 deeptutor start`。++如果在用 Docker,改 docker 专用的端口变量:++```bash+DEEPTUTOR_DOCKER_FRONTEND_PORT=4000+DEEPTUTOR_DOCKER_BACKEND_PORT=18001+```++### 后端起来了但前端连不上++Next.js 前端在构建时把 API base 锁成了 `http://localhost:8001`。当你以另一个 hostname 提供 DeepTutor 服务时(云部署、局域网访问、反向代理),bundle 里仍然指向 `localhost`,从远端浏览器看就是错的。++修复:把 `data/user/settings/system.json` 里的 `next_public_api_base_external` 设成对外可达的 URL,或者在重新构建前端之前 export `NEXT_PUBLIC_API_BASE_EXTERNAL`:++```json+{+ "next_public_api_base_external": "https://deeptutor.example.com:8001"+}+```++然后重新构建:++```bash+# Docker+python scripts/docker_compose.py up -d --build++# 手动安装+cd web && npm run build && cd ..+```++## LLM / Embedding providers++### provider probe 时报 `HTTPError 401 Unauthorized`++provider 拒绝了你的 API key。常见坑:++- **OpenAI**:以 `sk-` 开头(project key 以 `sk-proj-` 开头)+- **Anthropic**:以 `sk-ant-` 开头+- **Azure OpenAI**:还需要 `LLM_API_VERSION`(在 设置 → LLM 里设置)+- **Google Gemini**:以 `AIza` 开头+- **Ollama / 本地 OpenAI 兼容**:API key 留空或用 `none`,base URL 设成像 `http://localhost:11434/v1`++重跑 `deeptutor init` 重新输入 key,或者直接编辑 `data/user/settings/model_catalog.json`。++### 配置时 `Failed to fetch /models`++DeepTutor 会 ping provider 的 model-list 端点来填充模型下拉框。如果你的网络把它挡了,会出现这个警告 —— 这是**非致命**的。向导会 fallback 到一份硬编码的常见模型列表然后继续。++### `host.docker.internal` 解析不了(Docker + 本地 Ollama)++| 宿主系统 | 用 |+|----------|-----|+| macOS、Windows | `http://host.docker.internal:11434/v1` |+| Linux | `http://172.17.0.1:11434/v1` *(docker0 网桥)* 或宿主机的 LAN IP |++Linux 用户也可以手动加 `host.docker.internal`:++```yaml+# docker-compose.ghcr.yml+services:+ deeptutor:+ extra_hosts:+ - "host.docker.internal:host-gateway"+```++### 查询 KB 时报 `Embedding dimension mismatch`++你用不同的 embedding 模型重建了 KB。缓存里的维度对不上了。++修复:在 Web UI 里,**Knowledge → 选 KB → Index versions → Re-index now**。重建索引没有暴露成 CLI 命令。++### Embedding endpoint URL 老是出错++某些 provider 在 `EMBEDDING_HOST` 里要的是**完整的 embeddings 路径**,不是 API 根路径:++| Provider | 错误 | 正确 |+|----------|------|------|+| OpenAI | `https://api.openai.com/v1` | `https://api.openai.com/v1/embeddings` |+| Cohere | `https://api.cohere.ai` | `https://api.cohere.ai/v1/embed` |+| Voyage | `https://api.voyageai.com/v1` | `https://api.voyageai.com/v1/embeddings` |++## 知识库++### KB 卡在 `indexing` 状态++索引是后台任务跑的。看日志:++```bash+tail -f data/user/logs/ai_tutor_*.log | grep -i kb+```++常见原因:embedding provider 返回 429(限流 —— 用更小的 batch 重试)、embedding host 不可达(检查网络)、或者 PDF parser 失败(确认文件没有密码保护)。++### 重建索引修不了维度不匹配++如果重建索引之后维度不匹配仍然存在,KB store 里可能有过期的配置文件。从 CLI:++```bash+deeptutor kb delete physics --force+deeptutor kb create physics --doc chapter1.pdf+```++## 多用户++### 重启之后每个 API 调用都报 `401 Unauthorized`++`AUTH_SECRET` 被重新生成了,所有 JWT 都失效了。++修复:把 `AUTH_SECRET` 在 `.env` 里 pin 住,让它跨重启保持不变:++```bash+AUTH_SECRET=$(openssl rand -hex 32)+```++### 第一个用户没被提升为 admin++编辑 `multi-user/_system/auth/users.json`,把那个用户的 `"role": "admin"` 设好,然后重启。++### 登录成功但又跳回 `/login`++auth cookie 没被设置上,通常因为:++1. `AUTH_COOKIE_SECURE=true` 但你不在 HTTPS 上 —— 本地测试时设成 `false`+2. 浏览器拦了第三方 cookie,而你在子域上 —— 把前端和 API 部署在同一个 hostname 下(比如都在 `deeptutor.example.com`,前端在 `/`,API 通过 `/api/` 代理)++## Docker++### 容器立刻退出++```bash+docker logs deeptutor | tail -30+```++最常见:宿主机文件夹没预先创建。++```bash+mkdir -p data/user data/memory data/knowledge_bases+python scripts/docker_compose.py up -d+```++### 容器是 `Running` 但是 `unhealthy`++健康检查在容器内调用 `curl http://localhost:8001/`。如果后端启动慢(首次约 30 秒,下载模型元数据),健康检查可能会抖动。++等 60 秒。如果还是 unhealthy,看 supervisord 状态:++```bash+docker exec deeptutor supervisorctl status+docker exec deeptutor tail -40 /app/data/user/logs/ai_tutor_$(date +%Y%m%d).log+```++### 构建时 npm install 超时++Next.js 依赖树很大。调大 npm 的网络超时:++```bash+npm config set fetch-timeout 600000+```++官方 `Dockerfile` 已经设了 —— 只在本地构建时才需要管。++## Python 安装++### `Microsoft Visual C++ 14.0 is required`(Windows)++`tiktoken`、`chroma-hnswlib` 等几个依赖在 Windows 上要编译 C 扩展。装 [**Build Tools for Visual Studio**](https://visualstudio.microsoft.com/visual-cpp-build-tools/),勾选 "Desktop development with C++" workload。++### `libolm not found`(仅 Matrix E2EE 需要)++```bash+# macOS+brew install libolm++# Debian / Ubuntu+sudo apt install libolm-dev++# 重装 matrix-e2e extra+pip install -e ".[matrix-e2e]" --force-reinstall+```++### `pip install` 慢到爆++网络慢的话,用本地 PyPI 镜像或 wheelhouse。中国大陆用户:++```bash+pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple+```++### Conda 环境已激活但 `python` 仍然指向别处++PATH 顺序可能盖住了 conda 的 python。验证:++```bash+which python+# /Users/you/miniconda3/envs/deeptutor/bin/python+```++如果不是,在一个新 shell 里跑 `conda activate deeptutor`。++## 前端++### 前端显示空白页++打开浏览器开发者工具(⌥⌘I),看 Console 标签页。常见原因:++- **CORS errors** —— 前端一个 origin,后端另一个 origin,而后端没把这个前端 origin 加进允许列表。编辑 `data/user/settings/system.json`,把你的前端 origin 加进 `cors_origins`。+- **`/_next/...` 404** —— 静态 bundle 没构建。从源码起的话:`cd web && npm run build`。+- **后端连不上** —— 验证 `curl http://localhost:8001/` 是否返回 JSON。++### 每个页面都弹 "Failed to fetch" toast++跟上面一样 —— 通常是后端没起来或者 CORS / API base URL 对不上。看 Network 标签页确认请求实际去了哪个 URL。++## TutorBot++### bot 启动时报 "missing SDK"++对应 gateway 的 SDK 没装。报错信息会告诉你是哪一个。装上:++```bash+# 通用+pip install -e ".[tutorbot]"++# 或者装某一个(很少需要)+pip install python-telegram-bot # Telegram+pip install slack-sdk # Slack+pip install zulip # Zulip+pip install matrix-nio # Matrix(不带 E2EE)+```++### bot 连上了但不响应++检查 bot channel 配置里的 `allow_from`:++```yaml+telegram:+ enabled: true+ token: "..."+ allow_from: # 空 = 全部拒绝+ - "*" # 允许所有人+ # - "12345678" # 或具体的 Telegram user ID+```++默认 `allow_from: []` 拒绝所有人 —— 你必须显式 opt in。++### bot 跑几分钟就掉线++Long-poll / WebSocket 连接偶尔会掉。channel manager 会带退避自动重连,但如果你看到频繁掉线:++- 检查宿主机和 gateway provider 之间的网络稳定性+- Telegram polling 把 `timeout` 调到 60 秒+- Matrix 的话,确认 homeserver 没有过于激进的超时++针对每个 gateway 的调试方法见 [**探索 TutorBot**](/zh-cn/docs/tutorbot/)。++## 记忆 / RAG 精度++### Chat 忽略了挂上的 KB++确认:++1. KB **挂上了**这一轮(不只是在选择器里出现 —— 真的点进了激活集)+2. `rag` 工具**已启用**,在 设置 → 工具,或者因为挂了 KB 而自动启用+3. KB 是 `status: ready`(不是还在索引)—— 通过 `deeptutor kb list` 检查++### `read_memory` 返回空++L3 记忆在 consolidator 至少跑过一次之前是空的。记忆的整合发生在:++- 每 N 轮(在 设置 → 记忆 里可配置)+- 用户在 Memory Workbench 里主动请求++可以从 **Memory Workbench**(`/memory` → **Run consolidator**)强制整合一次,或者走 HTTP API:++```bash+curl -X POST http://localhost:8001/api/v1/memory/runs/start+```++### Memory writes 被标成 `unsafe_text`++`write_memory` 工具有 240 字符限制和内容安全过滤。把偏好文本缩短一下,或者换种说法。++## 还卡着?++- 在 [Discord](https://discord.gg/eRsjPgMU4t) 上问 —— 最快的渠道+- 在 [github.com/HKUDS/DeepTutor/issues](https://github.com/HKUDS/DeepTutor/issues) 报 bug+- 长篇问题?开一个 [Discussion](https://github.com/HKUDS/DeepTutor/discussions)++求助时请附上:++- 你的安装路径(PyPI / 从源码 / Docker / 仅 CLI)+- `deeptutor config show` 的输出+- `data/user/logs/ai_tutor_*.log` 的最后 40 行+- Docker 的话:`docker logs deeptutor | tail -40`diff --git a/site/src/content/docs/zh-cn/docs/index.md b/site/src/content/docs/zh-cn/docs/index.mdnew file mode 100644index 000000000..f5e25587e--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/index.md@@ -0,0 +1,29 @@+---+title: 文档主页+description: Agent-native 的开源个性化学习伴侣 —— 安装路径、产品形态、TutorBot 渠道与 CLI 参考。+---++欢迎来到 DeepTutor 中文文档。从下方任选一条路径,或使用左侧边栏导航。++## 从哪里开始++- **[快速上手](/zh-cn/docs/get-started/)** —— 四种安装路径:PyPI、源码、Docker、纯 CLI。+- **[探索 DeepTutor](/zh-cn/docs/explore/)** —— 五大核心界面(Chat / Co-Writer / Book / Knowledge / Space)以及记忆系统与设置中心。+- **[TutorBot 渠道](/zh-cn/docs/tutorbot/)** —— 把持久化的 AI 导师接到 Telegram、Slack、飞书、Matrix 等通道。+- **[DeepTutor CLI](/zh-cn/docs/cli/)** —— 在终端里驱动所有能力,或把它交给 AI 代理。+- **[模型与搜索提供商](/zh-cn/docs/get-started/providers/)** —— 配置 LLM、Embedding、搜索引擎。++## DeepTutor 是什么++一个开源、agent-native 的学习伴侣。**五种模式**(Chat / Solve / Quiz / Research / Visualize)共享同一个 session、知识库和引用历史。**TutorBot** 把你的上下文带到 Telegram、Slack、飞书等渠道。**三层记忆系统**(含可审查的 Memory Workbench 和 Memory Graph)让你随时审计 *为什么* 系统会记住某件事。++由香港大学数据智能实验室构建。Apache 2.0 协议。++## 帮助与社区++- [Discord](https://discord.gg/eRsjPgMU4t) —— 提问最快的地方+- [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) —— 长篇问答和设计讨论+- [Issue Tracker](https://github.com/HKUDS/DeepTutor/issues) —— Bug 反馈与功能建议+- [SKILL.md](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) —— 写给驱动 DeepTutor 的 AI 代理的规范化交接文档++> 提示:未翻译的页面会自动回落到英文版本。diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/dingtalk.md b/site/src/content/docs/zh-cn/docs/tutorbot/dingtalk.mdnew file mode 100644index 000000000..5d775445a--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/dingtalk.md@@ -0,0 +1,97 @@+---+title: 钉钉+description: 在钉钉上跑 TutorBot —— 阿里的企业聊天,走 Stream Mode 连接。+---++钉钉是阿里的企业即时通信产品。DeepTutor 通过官方 `dingtalk-stream` SDK 走 **Stream Mode** —— 不需要公网 webhook。++## 你需要准备++- 一个有管理员权限的钉钉组织+- 访问 [**钉钉开放平台**](https://open.dingtalk.com/)++## Step 1 —— 创建应用++1. 登录 <https://open.dingtalk.com/>+2. **应用开发** → **创建应用**+3. 选 **企业内部机器人** 类型+4. 填名字、描述、图标+5. 创建后在凭证页复制 **AppKey(Client ID)** 和 **AppSecret(Client Secret)**++## Step 2 —— 启用 Stream Mode++1. 在应用设置 → **Stream 模式** → **启用**+2. 这样就不需要公网 webhook URL 了++## Step 3 —— 权限++申请这些权限:+- 发消息+- 读消息内容+- (可选)语音转文字++## Step 4 —— 配置++```yaml+channels:+ dingtalk:+ enabled: true+ client_id: "dingxxxxxxxxxxxxxxxx"+ client_secret: "YOUR_CLIENT_SECRET"+ allow_from: []+```++## Step 5 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:dingtalk → connecting (stream mode)+[bot:my-math-tutor] channel:dingtalk → ready+```++## 配置参考++| 字段 | 类型 | 必填 | 说明 |+|------|------|------|------|+| `enabled` | bool | 是 | |+| `client_id` | string | 是 | 钉钉的 AppKey |+| `client_secret` | string | 是 | AppSecret |+| `allow_from` | list[string] | 可选 | 钉钉 user id |++## 钉钉上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 私聊 | ✅ |+| 群聊 | ✅ |+| Markdown / 富文本 | ✅ |+| 动作卡片(可交互按钮) | ✅ |+| 文件上传 | ✅ |+| **语音 → 文字转写** | ✅ *(内置钉钉的语音识别)* |+| @ 寻址 | ✅ |++## 保活机制++dingtalk-stream SDK 负责 long-poll 回调连接。断线时自动重连。++## 常见问题++### "Invalid client_secret"++去钉钉开放平台 → 你的应用 → 凭证 核对。Secret 可以被轮换。++### Bot 在线但不回复++确认 bot 已经为目标用户 / 部门安装。在钉钉里,机器人必须先被显式加到组织里才能聊天。++### Stream 模式连不上++Stream 模式要求 bot 已发布(不是 draft 状态)。在钉钉应用页点 **发布**。++## 另请参阅++- [**飞书**](/zh-cn/docs/tutorbot/feishu/) —— 国内另一个主流企业聊天+- [**企业微信**](/zh-cn/docs/tutorbot/wecom/) —— 腾讯的企业即时通信diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/discord.md b/site/src/content/docs/zh-cn/docs/tutorbot/discord.mdnew file mode 100644index 000000000..50dd91048--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/discord.md@@ -0,0 +1,140 @@+---+title: Discord+description: 在 Discord 上跑 TutorBot —— Developer Portal 注册、Gateway WebSocket 连接、群组策略。+---++Discord 走 **Gateway WebSocket**,不是 polling。DeepTutor 直接实现了 gateway 协议(不依赖 `discord.py`),断线自动重连。++## 你需要准备++- 一个 Discord 账号+- 一个你能管理的 server(用来测试 bot)+- 5 分钟在 Discord Developer Portal 上++## Step 1 —— 创建一个 Discord Application++1. 打开 <https://discord.com/developers/applications>+2. 点 **New Application**+3. 起个名字(比如 "Math Mentor")+4. Save++## Step 2 —— 创建 Bot 用户++1. 应用左侧栏选 **Bot**+2. 点 **Add Bot** → 确认+3. 在 **TOKEN** 下点 **Reset Token**,然后 **Copy** —— 这就是你的 `token`+4. 在 **Privileged Gateway Intents** 下打开:+ - **Message Content Intent** *(必须,才能读消息正文)*+ - **Server Members Intent** *(推荐)*++## Step 3 —— 把 bot 邀请进 server++1. 左侧栏 → **OAuth2** → **URL Generator**+2. Scopes:勾 `bot`+3. Bot Permissions:勾 `Send Messages`、`Read Message History`、`Attach Files`、`Embed Links`、`Add Reactions`+4. 复制生成的 URL,新标签页打开,选一个 server,**Authorize**++## Step 4 —— 配置++编辑 `data/tutorbot/<bot_id>/agents.yaml`:++```yaml+channels:+ discord:+ enabled: true+ token: "YOUR_BOT_TOKEN"+ allow_from:+ - "USER_ID_1" # 在 Discord 里右键用户 → Copy User ID(需要先开 Dev Mode)+ # - "*" # 全开+ group_policy: "mention" # 或 "open"+ intents: 37377 # 默认 —— 涵盖 messages + guilds+```++> **拿 User ID 的 Dev Mode:** Discord 设置 → **Advanced** → 打开 **Developer Mode**。之后右键任意用户 → Copy User ID。++## Step 5 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:discord → connecting (gateway wss://...)+[bot:my-math-tutor] channel:discord → ready (heartbeat 41250ms)+```++## 配置参考++| 字段 | 类型 | 必填 | 默认值 | 说明 |+|------|------|------|--------|------|+| `enabled` | bool | 是 | `false` | |+| `token` | string | 是 | —— | Developer Portal 里的 Bot token |+| `allow_from` | list[string] | 是 | `[]` | User id 列表,或 `"*"` |+| `group_policy` | `"mention" \| "open"` | 可选 | `"mention"` | 群聊行为 |+| `gateway_url` | string | 可选 | `wss://gateway.discord.gg/?v=10&encoding=json` | 只有走代理时才需要改 |+| `intents` | int | 可选 | `37377` | 位字段;默认涵盖 messages + guilds + members |++## Discord 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| DM 私聊 | ✅ |+| Guild 文字频道 | ✅ |+| Thread | ⚠️ 部分支持 —— bot 目前是在父频道回复 |+| 文件上传 | ✅ *(20 MB 以内)* |+| 文件下载 | ✅ |+| Markdown / mention 渲染 | ✅ *(Discord flavored markdown)* |+| 正在输入指示 | ✅ |+| 表情反应 | ⚠️ 只支持发出方向(bot 加 reaction,但不会响应用户的 reaction) |++## 群组策略++| 策略 | 行为 |+|------|------|+| `mention` | Bot 只回复 @ 它的消息 |+| `open` | Bot 回频道里的每条消息 *(很吵 —— 只适合专门的 bot 频道)* |++DM 里不管什么策略 bot 都会回。++## 保活机制++DeepTutor 的 Discord 渠道维护 gateway WebSocket,**每 ~41 秒发一次 heartbeat**(按 Discord 协议)。断线时:++- 5 秒后自动重连+- 先试 session resume(不用重新加入频道)+- resume 失败则走完整重连++你不需要任何外部守护进程 —— 渠道管理器搞定所有重连。++## 常见问题++### `4014: Disallowed intent`++你在配置里申请了一个 intent,但 Developer Portal 没启用。最常见就是 Message Content Intent。++修复:Developer Portal → 你的 app → **Bot** → 启用 **Message Content Intent**。++### Bot 在线但是不回复++检查 `allow_from`。规则和 Telegram 一样:空列表拒所有人。++再确认 Message Content Intent 是开的 —— 不开的话,bot 收到的消息 `content` 是空的。++### 超过 2000 字的消息被截断++Discord 单条消息上限 2000 字。Bot 会自动拆长回复。Deep Research 这类输出建议直接发文件:++```yaml+channels:+ discord:+ send_long_as_file: true # 超 2000 字时附 .md+```++### 429 限流++Discord 按频道限流。如果你的 bot 短时间发很多消息(比如繁忙频道里跑 `open` 策略),就会撞到 429。渠道层会指数退避重试,但更建议切到 `mention`。++## 另请参阅++- [**Telegram**](/zh-cn/docs/tutorbot/telegram/) —— 更简单的 gateway 模型,可以对比着看+- [**Slack**](/zh-cn/docs/tutorbot/slack/) —— 也是 socket-mode,配置感觉类似diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/email.md b/site/src/content/docs/zh-cn/docs/tutorbot/email.mdnew file mode 100644index 000000000..3ad0f3a3b--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/email.md@@ -0,0 +1,166 @@+---+title: 电子邮件+description: 通过邮件跑 TutorBot —— IMAP 轮询 + SMTP 回信,显式授权与完整正文解析。+---++Email 渠道把你的 TutorBot 变成一个异步的邮件对话方。用户给指定邮箱发信,bot 通过 IMAP 读取,通过 SMTP 回信。适合 **异步答疑** 以及更偏好邮件的用户群体。++## 你需要准备++- 一个邮箱账号(Gmail、Outlook、你自建的 SMTP/IMAP 服务器等)+- App-password 访问 *(或 OAuth,见下文)*+- 5 分钟配置++## Step 1 —— 准备邮箱凭证++**Gmail**:++1. 在账号上启用 2FA+2. 创建 [**App Password**](https://myaccount.google.com/apppasswords)(16 字符一次性密码)+3. 把它作为下面配置里的密码++**Outlook / Office 365**:要么 App Password(启用 2FA)要么 OAuth。个人用 App Password 更简单。++**自建**(Postfix、Maddy 等):直接用账号密码。++## Step 2 —— 配置++```yaml+channels:+ email:+ enabled: true+ consent_granted: true # 必须显式 —— 隐私保护++ # IMAP(入站)+ imap_host: "imap.gmail.com"+ imap_port: 993+ imap_username: "[email protected]"+ imap_password: "YOUR_APP_PASSWORD"+ imap_mailbox: "INBOX"+ imap_use_ssl: true++ # SMTP(出站)+ smtp_host: "smtp.gmail.com"+ smtp_port: 587+ smtp_username: "[email protected]"+ smtp_password: "YOUR_APP_PASSWORD"+ smtp_use_tls: true+ smtp_use_ssl: false+ from_address: "[email protected]"++ # 行为+ auto_reply_enabled: true+ poll_interval_seconds: 30 # IMAP 检查频率+ mark_seen: true # 处理后标记为已读+ max_body_chars: 12000+ subject_prefix: "Re: "+ allow_from: # 邮箱地址;[] = 全开;["x@..."] = 白名单+ - "[email protected]"+```++## Step 3 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:email → connecting (imap.gmail.com:993)+[bot:my-math-tutor] channel:email → ready, polling every 30s+```++从你允许的地址给 `[email protected]` 发邮件 —— 30 秒内(或下一次 poll),你会收到自动回复。++## 为什么 `consent_granted` 必须设++读邮件很敏感。渠道在没有显式 `consent_granted: true` 的情况下 **拒绝启动** —— 一个硬卡点,防止误读邮件。这是有意为之的隐私保护。++## 配置参考++| 字段 | 类型 | 必填 | 默认值 |+|------|------|------|--------|+| `enabled` | bool | 是 | `false` |+| `consent_granted` | bool | 是 | `false` —— 必须显式设为 `true` |+| `imap_host` | string | 是 | —— |+| `imap_port` | int | 是 | `993` |+| `imap_username` | string | 是 | —— |+| `imap_password` | string | 是 | —— |+| `imap_mailbox` | string | 可选 | `"INBOX"` |+| `imap_use_ssl` | bool | 可选 | `true` |+| `smtp_host` | string | 是 | —— |+| `smtp_port` | int | 是 | `587` |+| `smtp_username` | string | 是 | —— |+| `smtp_password` | string | 是 | —— |+| `smtp_use_tls` | bool | 可选 | `true` |+| `smtp_use_ssl` | bool | 可选 | `false` |+| `from_address` | string | 可选 | = `smtp_username` |+| `auto_reply_enabled` | bool | 可选 | `true` |+| `poll_interval_seconds` | int | 可选 | `30` |+| `mark_seen` | bool | 可选 | `true` |+| `max_body_chars` | int | 可选 | `12000` |+| `subject_prefix` | string | 可选 | `"Re: "` |+| `allow_from` | list[string] | 可选 | `[]`(对所有人开放) |++## 邮件上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 纯文本正文 | ✅ |+| HTML 正文 | ✅ *(转成 markdown)* |+| 入站附件 | ✅ *(PDF、图片、文本文件)* |+| 出站附件 | ✅ *(通过 SMTP 带附件回复)* |+| 邮件 thread | ✅ *(通过 `In-Reply-To` header)* |+| 主题前缀 | ✅ *(默认 `Re: `)* |+| 正文里的 LaTeX | ⚠️ 当纯文本渲染;数学密集的回复考虑转 PDF |++## 会话模型++每个独立的发件人邮箱被视为一个独立 session。同一邮件 thread 内的回复(按 `In-Reply-To` 匹配)继续同一 session。++意思就是 `[email protected]` 发的所有邮件总会落到同一个 DeepTutor session —— 非常适合持续的异步答疑。++## 保活机制++Email 渠道用一个 **后台轮询循环**:++- 每 `poll_interval_seconds` 秒,渠道通过 IMAP 登录、拉未读邮件、处理、标已读+- IMAP 掉线时,下一次 poll 自动重连+- SMTP 是每次发信开新连接(不维持长连接)++高量使用就把 `poll_interval_seconds: 15` 或更低。低于 10 秒可能撞 provider 限流。++## 常见问题++### 启动失败 —— "consent_granted is required"++你忘了设:++```yaml+consent_granted: true+```++这是有意的摩擦。请有意识地打开。++### Gmail / Outlook "Authentication failed"++你用了账号密码而不是 App Password。启用 2FA 后,IMAP/SMTP 是不接收常规密码的 —— 必须用 16 字符的 App Password。++### 和另一个自动回复器互相循环++两个自动回复器互发邮件就会陷入回环。渠道通过检查 `Auto-Submitted:` header 来检测回环 —— 但如果对方不设这个 header,回环还是可能。防御措施:++- 用 `allow_from` 限制 bot 回复的对象+- 设 `auto_reply_enabled: false`,从 CLI 手动触发回复++### IMAP 文件夹找不到++有些 provider mailbox 名字不一样(`INBOX` vs `Inbox` vs `[Gmail]/All Mail`)。在 provider 的 webmail 里查清楚,改 `imap_mailbox`。++### 回复被标垃圾邮件++填一个像样的 `from_address`;自建邮件服务器记得配 SPF/DKIM/DMARC;或者出站用受信的 SMTP relay(SendGrid、Mailgun)。++## 另请参阅++- [**WhatsApp**](/zh-cn/docs/tutorbot/whatsapp/) —— 另一个桥接式渠道+- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 架构diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/feishu.md b/site/src/content/docs/zh-cn/docs/tutorbot/feishu.mdnew file mode 100644index 000000000..da2bc6794--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/feishu.md@@ -0,0 +1,145 @@+---+title: 飞书 / Lark+description: 在飞书(国内)/ Lark(海外)上跑 TutorBot —— 走 lark-oapi SDK 的 WebSocket 长连。+---++飞书是国内最流行的办公聊天工具;Lark 是它的海外对应版本。两者 API 一致。DeepTutor 通过官方 `lark-oapi` SDK,用一条长连 WebSocket 同时支持。++## 你需要准备++- 飞书 / Lark 开发者账号+- 访问 [**飞书开放平台**](https://open.feishu.cn/)(国内)或 [**Lark Open Platform**](https://open.larksuite.com/)(海外)+- 可选:一个你能装 bot 的飞书 / Lark 组织++## Step 1 —— 创建应用++1. 打开对应平台 → **创建应用** → **自建应用**+2. 填基本信息(名称、描述、图标)+3. 创建后在 **凭证与基础信息** 页复制:+ - **App ID**+ - **App Secret**+ - **Verification Token**+ - **Encrypt Key**++## Step 2 —— 开启机器人能力++1. 左侧栏 → **应用能力** → **机器人** → **启用**+2. 配置机器人的显示名和头像++## Step 3 —— 配置事件订阅++1. 左侧栏 → **事件订阅** → **订阅事件**+2. 添加你关心的事件:+ - `im.message.receive_v1` —— 接收消息+ - `im.message.message_read_v1` —— 已读回执(可选)+3. **启用长连接模式**,这样就不用公网 webhook URL 了。打开后 bot 走 WebSocket 而不是 webhook。++## Step 4 —— 加权限++左侧栏 → **权限管理**:++- `im:message:send_as_bot` —— 发消息+- `im:resource` —— 读多媒体附件+- `contact:user.id:readonly` —— 解析 user id++然后 **发布** 版本 *(自建应用走内部发布)*。++## Step 5 —— 配置 DeepTutor++```yaml+channels:+ feishu:+ enabled: true+ app_id: "cli_xxxxxxxxxxxxxxxx"+ app_secret: "YOUR_APP_SECRET"+ verification_token: "YOUR_VERIFICATION_TOKEN"+ encrypt_key: "YOUR_ENCRYPT_KEY"+ allow_from: []+ group_policy: "mention"+```++## Step 6 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:feishu → connecting (long-connection)+[bot:my-math-tutor] channel:feishu → ready (app_id=cli_xxx)+```++## 配置参考++| 字段 | 类型 | 必填 | 说明 |+|------|------|------|------|+| `enabled` | bool | 是 | |+| `app_id` | string | 是 | `cli_...` |+| `app_secret` | string | 是 | |+| `verification_token` | string | 是 | 用于事件签名校验 |+| `encrypt_key` | string | 是 | 用于解密入站事件 |+| `allow_from` | list[string] | 可选 | User id 列表;`["*"]` 全开 |+| `group_policy` | `"mention" \| "open"` | 可选 | 默认 `"mention"` |++## 飞书上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 私聊 | ✅ |+| 群聊 | ✅ |+| **交互卡片** | ✅ *(带按钮的飞书富卡片消息)* |+| Markdown | ✅ |+| 文件 / 图片上传 / 下载 | ✅ |+| 语音转写 | ✅ *(设了 `transcription_api_key`)* |+| 表情反应 | ⚠️ 只支持发出方向 |+| @ 寻址 | ✅ |++## 长连模式 vs webhook 模式++飞书支持两种投递方式:++| 模式 | 优点 | 缺点 |+|------|------|------|+| **长连接** *(推荐)* | 不需要公网 IP;哪都能用 | 一个 app 对一个 DeepTutor 实例 |+| Webhook | 多个端点;标准请求/响应 | 需要 HTTPS 公网 URL |++DeepTutor 默认走长连。要切到 webhook(有负载均衡需求时),需要自己跑一个 webhook 接收器 —— 目前 DeepTutor 内置不支持。++## 保活机制++lark-oapi SDK 负责 WebSocket 自动重连。后台线程跑 WebSocket 监听器,把事件转给 DeepTutor 的 async 总线。++如果 bot 在飞书里掉线了(状态显示 offline):++```bash+deeptutor bot stop my-math-tutor+deeptutor bot start my-math-tutor+```++要长期稳定,配 systemd 或 Docker `restart: unless-stopped`。++## 常见问题++### 启动报 "Invalid app_secret"++去飞书凭证页核对 **App Secret** —— 它可以被轮换。也确认你在正确的平台(国内是 `open.feishu.cn`,海外是 `open.larksuite.com` —— 两边的 secret 不通用)。++### Bot 说自己在线但收不到消息++两件事检查:++1. **权限** —— `im:message:send_as_bot` 和事件订阅都加了,并且 **发布** 了新版本+2. 事件订阅里 **长连接模式** 开了++### Verification token 不匹配++如果你在飞书里重新生成了 verification token,更新配置并重启 bot。这个 token 被签到每个入站事件里做完整性校验。++### Encrypt key 不匹配++同上 —— 你在飞书(设置 → 事件订阅)重新生成 encrypt key 后,要更新配置并重启。++## 另请参阅++- [**企业微信**](/zh-cn/docs/tutorbot/wecom/) —— 腾讯的企业聊天平台,注册 UX 类似+- [**钉钉**](/zh-cn/docs/tutorbot/dingtalk/) —— 阿里在企业聊天领域的对位产品diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/index.md b/site/src/content/docs/zh-cn/docs/tutorbot/index.mdnew file mode 100644index 000000000..b0e31704b--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/index.md@@ -0,0 +1,85 @@+---+title: TutorBot 概览+description: TutorBot —— 持久化、多渠道的自主导师。架构、生命周期、保活策略,以及每个渠道一页文档。+---++**TutorBot** 是一个住在 DeepTutor 里的持久化、自主 AI 导师,可以同时连到一个或多个 **外部聊天渠道**(Telegram、Slack、飞书 等),让你的用户在他们已有的工具里和它对话。++本章节是运维指南:系统怎么工作、怎么保活,以及 **每个渠道一页专属文档**(注册流程、配置项、故障排查)。++## 架构图++```text+┌─────────────────────────────────────────────────────────────────────┐+│ DeepTutor server │+│ │+│ ┌─────────────────────────────────────────────────────────────┐ │+│ │ Bot orchestrator │ │+│ │ (nanobot 推理引擎驱动的 agent loop) │ │+│ └──────────┬──────────────────────────────────────────────────┘ │+│ │ │+│ ┌─────────┼─────────┐ │+│ ▼ ▼ ▼ │+│ ┌───┐ ┌─────┐ ┌───────┐ 每个 bot 是一个独立的 asyncio task │+│ │bot│ │ bot │ │ bot │ 独立工作区位于 │+│ │ A │ │ B │ │ C │ data/tutorbot/<bot_id>/ │+│ └─┬─┘ └──┬──┘ └───┬───┘ │+│ │ │ │ │+│ │ ┌───────┼──────────┼───────────────────────────────────┐ │+│ ▼ ▼ ▼ ▼ ▼ │+│ ┌──────────────────────────────────────────────────┐ │+│ │ Channel registry (12 个渠道) │ │+│ └──────────────────────────────────────────────────┘ │+└────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬──┬──┬───┘+ │ │ │ │ │ │ │ │ │ │ │ │+ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼+ Telegram Discord Slack Matrix Zulip 飞书 企业微信 钉钉 QQ WhatsApp 邮件 Mochat+```++关键特性:++- **同进程**:所有 bot 都是 DeepTutor server 进程里的 asyncio task。不需要单独的进程、Docker sidecar 或 systemd unit。+- **一个 bot 多渠道**:一个 bot 可以同时在 Telegram **和** Slack **和** Matrix 上对话。+- **隔离的工作区**:每个 bot 都有自己的 `agents.yaml`、soul 模板、skills、cron 任务和本地 session 库,存在 `data/tutorbot/<bot_id>/` 下。+- **共享 Memory**:所有 bot 看的是 **同一个用户的 L3 记忆**(`data/memory/L3/`),通过 per-channel L1 trace 来分辨来源。+- **渠道重连不用重启**:渠道层级的断线(比如临时网络抖动)会自动恢复。++## 生命周期++```bash+# 创建+deeptutor bot create my-math-tutor \+ --name "Math Mentor" \+ --persona "专注于微积分和线性代数的 Socratic 导师" \+ --model gpt-4o++# 配置渠道(编辑 data/tutorbot/my-math-tutor/agents.yaml)++# 启动(为每个启用的渠道 fork 出 asyncio task)+deeptutor bot start my-math-tutor++# 查看状态+deeptutor bot list++# 停止+deeptutor bot stop my-math-tutor+```++## 渠道一览++| 渠道 | 页面 |+|------|------|+| Telegram | [docs/tutorbot/telegram](/zh-cn/docs/tutorbot/telegram/) |+| Discord | [docs/tutorbot/discord](/zh-cn/docs/tutorbot/discord/) |+| Slack | [docs/tutorbot/slack](/zh-cn/docs/tutorbot/slack/) |+| Matrix | [docs/tutorbot/matrix](/zh-cn/docs/tutorbot/matrix/) |+| Zulip | [docs/tutorbot/zulip](/zh-cn/docs/tutorbot/zulip/) |+| 飞书 / Lark | [docs/tutorbot/feishu](/zh-cn/docs/tutorbot/feishu/) |+| 企业微信 | [docs/tutorbot/wecom](/zh-cn/docs/tutorbot/wecom/) |+| 钉钉 | [docs/tutorbot/dingtalk](/zh-cn/docs/tutorbot/dingtalk/) |+| QQ | [docs/tutorbot/qq](/zh-cn/docs/tutorbot/qq/) |+| WhatsApp | [docs/tutorbot/whatsapp](/zh-cn/docs/tutorbot/whatsapp/) |+| 邮件 | [docs/tutorbot/email](/zh-cn/docs/tutorbot/email/) |+| Mochat | [docs/tutorbot/mochat](/zh-cn/docs/tutorbot/mochat/) |++> 各渠道页面目前仍为英文版(已为中文站点准备好链接结构)。diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/matrix.md b/site/src/content/docs/zh-cn/docs/tutorbot/matrix.mdnew file mode 100644index 000000000..72b13af92--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/matrix.md@@ -0,0 +1,187 @@+---+title: Matrix+description: 在 Matrix 上跑 TutorBot —— 去中心化聊天,端到端加密可选。+---++Matrix 是去中心化聊天的选项。DeepTutor 通过标准的 client-server API 和任何 Matrix homeserver 通信(matrix.org、你自己跑的 Synapse、Conduit、Dendrite 都行)。++端到端加密是 **可选的**,独立成一个 install extra,所以大多数用户不用承担 libolm 依赖的代价。++## 你需要准备++- 一个 Matrix 账号(matrix.org 或任意 homeserver)+- 那个账号的 `access_token`+- *(如果要 E2EE)* 系统里装好 `libolm`++## Step 1 —— 给 bot 注册一个 Matrix 账号++Bot 需要自己独立的 Matrix 账号。任意 homeserver 都行:++- **公共的**:Element web 应用 → matrix.org → Create Account+- **自建**:`register_new_matrix_user`(Synapse)或对应你服务器的等价工具++测试用的话,matrix.org 的公共 homeserver 就够了。++## Step 2 —— 拿 access token++### 方案 A —— 从 Element 拿++1. 用 bot 账号登 Element+2. **Settings** → **Help & About** → 滚到 **Advanced**+3. 展开 **Access Token** 复制++### 方案 B —— 从 REST API 拿++```bash+curl -X POST https://matrix.org/_matrix/client/r0/login \+ -H "Content-Type: application/json" \+ -d '{+ "type": "m.login.password",+ "user": "math-bot",+ "password": "your-password"+ }'++# 返回里有 "access_token": "syt_..."+```++## Step 3 —— 配置++```yaml+channels:+ matrix:+ enabled: true+ homeserver: "https://matrix.org" # 或你自建 homeserver 的 URL+ user_id: "@math-bot:matrix.org"+ access_token: "syt_xxxxxxxxxxxxxxxxxxxx"+ encryption_enabled: false # 装了 matrix-e2e extra 后再设 true+ allow_from: [] # 空 = bot 在加入的房间里谁都能聊+ rooms: [] # 指定 bot 加入的 room id,或 [] = 任何房间都监听+```++## Step 4 —— 装依赖++Matrix 支持放在一个可选 install extra 里。三档:++| 目标 | 安装命令 |+|------|----------|+| 基础 Matrix(无 E2EE) | `pip install -e ".[matrix]"` |+| Matrix + E2EE | `pip install -e ".[matrix-e2e]"` *(还得装 libolm)* |+| 所有 TutorBot 渠道(含 Matrix) | `pip install -e ".[tutorbot]"` |++要 E2EE 的话先装 **libolm**:++```bash+# macOS+brew install libolm++# Debian / Ubuntu+sudo apt install libolm-dev++# 然后装 Python extra+pip install -e ".[matrix-e2e]"+```++## Step 5 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:matrix → connecting (homeserver=matrix.org)+[bot:my-math-tutor] channel:matrix → sync ok (next_batch=...)+[bot:my-math-tutor] channel:matrix → joined 3 rooms+```++## 邀请 bot 进房间++Bot 跑起来之后,从任意 Matrix 客户端邀请:++```text+/invite @math-bot:matrix.org+```++Bot 会自动接受邀请并开始监听该房间的消息。要限制 bot 加入哪些房间:++```yaml+channels:+ matrix:+ rooms:+ - "!abc123:matrix.org" # 只自动加入这些指定的房间+```++## 配置参考++| 字段 | 类型 | 必填 | 默认值 | 说明 |+|------|------|------|--------|------|+| `enabled` | bool | 是 | `false` | |+| `homeserver` | url | 是 | —— | 比如 `https://matrix.org` |+| `user_id` | string | 是 | —— | `@bot:matrix.org` |+| `access_token` | string | 是 | —— | 来自 login 或 Element |+| `encryption_enabled` | bool | 可选 | `false` | 需要 `[matrix-e2e]` extra + libolm |+| `allow_from` | list[string] | 可选 | `[]` | Matrix user id 列表;`[]` = bot 加入的房间里谁都能聊 |+| `rooms` | list[string] | 可选 | `[]` | 指定 room id 列表;`[]` = bot 在任意房间都监听 |++## Matrix 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 1:1 私聊 | ✅ |+| 群组房间 | ✅ |+| Markdown → HTML | ✅ *(在 Element、Cinny 等里渲染正确)* |+| LaTeX 数学公式 | ⚠️ 需要 Matrix 客户端装 `mathjs` 插件 |+| 文件上传 | ✅ |+| 文件下载 | ✅ |+| 端到端加密 | ✅ *(按需开启)* |+| 正在输入指示 | ✅ |+| 表情反应 | ⚠️ 只支持发出方向 |++## 端到端加密++`encryption_enabled: true` + libolm + `[matrix-e2e]` extra 都齐了之后:++- Bot 首次启动时生成自己的设备密钥+- 对每个 E2EE 房间,bot 通过 Megolm 参与密钥交换+- 所有消息(含附件)都是端到端加密++**注意**:bot 的推理仍然在 DeepTutor 服务端发生。加密只是在 Matrix 客户端(用户)和 bot 的 Matrix 进程之间,但消息文本到达 LLM provider 时是未加密的(除非你配了本地 LLM)。++如果想做到「端到端到 LLM」的隐私,配本地 Ollama / vLLM 跟 bot 一起用。++## 保活机制++Matrix 渠道用 **`/sync` 长轮询接口**,30 秒超时。模式:++1. 用 `since=<last_batch>` 调 `/sync`,超时 30000+2. 收到新事件(或 30 秒后空响应)+3. 更新 `last_batch`,立即重新 poll++断线时:++- 网络中断是透明的 —— 下一次 `/sync` 重试+- 认证错误(401)需要人工介入(token 过期或被撤销)++想要高可用就把 DeepTutor server 放在进程守护下(systemd、docker restart-policy)。渠道自身处理瞬时故障。++## 常见问题++### `M_UNKNOWN_TOKEN`++你的 `access_token` 被撤了(从其他客户端登出、或服务器轮换密钥)。通过 Element 设置或 REST login 重新拿一个 token。++### Bot 进了房间但 E2EE 房间里不回复++你开了 `encryption_enabled: true` 但没装 `[matrix-e2e]` extra。Bot 连得上但解不开密 —— 装 libolm 后重装。++### 联邦延迟++如果 bot 在 `matrix.org` 而你在一个小的自建服务器聊,消息可能要几秒才联邦过来。不是 bug —— 联邦延迟。++### "User not in room" 发回复时报错++Bot 被踢了或退群了。从你的 Matrix 客户端重新邀请。++## 另请参阅++- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 整体架构+- [Matrix 规范](https://spec.matrix.org/) —— 底层协议diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/mochat.md b/site/src/content/docs/zh-cn/docs/tutorbot/mochat.mdnew file mode 100644index 000000000..1b0836d0e--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/mochat.md@@ -0,0 +1,103 @@+---+title: Mochat+description: 在 Mochat 上跑 TutorBot —— 客服式聊天面板,走 Socket.IO 或 HTTP 轮询。+---++[Mochat](https://github.com/microsoft/mochat) 是一个开源的客服 / 聊天面板。DeepTutor 的 Mochat 渠道通过 **Socket.IO**(首选)或 **HTTP 轮询**(fallback)接入。适合把导师 bot 嵌到你已有网站的客服 widget 里。++## 你需要准备++- 一个运行中的 Mochat 实例(自建或托管)+- 一个带 access token(Claw Token)的 bot 账号++## Step 1 —— 在 Mochat 里创建 bot++1. 登录你的 Mochat 管理面板+2. **Bots** → **Create**+3. 复制 bot 的 **Claw Token**++## Step 2 —— 配置++```yaml+channels:+ mochat:+ enabled: true+ service_url: "https://mochat.example.com"+ claw_token: "YOUR_BOT_TOKEN"+ allow_from: [] # User id 列表;[] = 全开+ use_http_polling: false # Socket.IO 不可用时的 fallback+ polling_interval_ms: 1000+ delayed_message_timeout_s: 5+```++## Step 3 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:mochat → connecting (socket.io to mochat.example.com)+[bot:my-math-tutor] channel:mochat → ready+```++## 配置参考++| 字段 | 类型 | 必填 | 默认值 |+|------|------|------|--------|+| `enabled` | bool | 是 | `false` |+| `service_url` | url | 是 | —— |+| `claw_token` | string | 是 | —— |+| `allow_from` | list[string] | 可选 | `[]`(全开) |+| `use_http_polling` | bool | 可选 | `false` |+| `polling_interval_ms` | int | 可选 | `1000` |+| `delayed_message_timeout_s` | int | 可选 | `5` |++## Mochat 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 客户聊天面板消息 | ✅ |+| 群 / 房间消息 | ✅ |+| Markdown | ✅ |+| 文件上传 | ✅ |+| 延迟消息打包 | ✅ *(高频输入下提升效率)* |++## 延迟消息打包++Mochat 用户经常会一连发好几条(比如 "Hi!\n快问一下\nbot 在不在线?")。为了避免每条都触发一次 bot 回复,渠道会把 `delayed_message_timeout_s`(默认 5s)内收到的消息 **打包**:++- 第一条消息到达 → 启动计时器+- 超时内收到更多消息 → 追加,重置计时器+- 计时器到期 → 把所有消息打包成一个用户回合++根据你的用户聊天节奏调整 `delayed_message_timeout_s`。++## 保活机制++Socket.IO 连接断线自动重连。如果 Socket.IO 反复失败,渠道会 fallback 到 HTTP 轮询:++```yaml+use_http_polling: true+polling_interval_ms: 2000 # 每 2 秒 poll 一次+```++这是用延迟换鲁棒性 —— 在挑剔的企业代理后面很有用。++## 常见问题++### "Cannot connect" 但 Mochat 是开着的++Mochat 有时要求 bot 在管理面板里 **被审核通过** 后 token 才生效。检查 bot 状态。++### 回复发出了但用户看不到++Mochat 有频道级可见性设置。确保 bot 被加进了用户聊天的频道。++### Socket.IO 版本不匹配++如果你的 Mochat 用的是较老的 Socket.IO 版本,与其调版本匹配,不如直接走 HTTP 轮询 —— `use_http_polling: true`。++## 另请参阅++- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 整体架构diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/qq.md b/site/src/content/docs/zh-cn/docs/tutorbot/qq.mdnew file mode 100644index 000000000..39747281a--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/qq.md@@ -0,0 +1,75 @@+---+title: QQ+description: 在 QQ 上跑 TutorBot —— 腾讯的国民即时通讯,走官方 botpy SDK。+---++QQ 是腾讯的旗舰国民即时通讯。DeepTutor 通过腾讯官方的 **botpy** SDK 走 WebSocket 连接。++## 你需要准备++- 一个 [**QQ 开放平台**](https://bot.q.qq.com/) 账号+- 腾讯云账号(某些进阶能力需要)++## Step 1 —— 注册 QQ bot++1. 登录 <https://bot.q.qq.com/>+2. **新建机器人** → 填名字和描述+3. 复制 **App ID** 和 **Secret**+4. 启用你需要的消息类型:C2C(私信)和群消息++## Step 2 —— 配置++```yaml+channels:+ qq:+ enabled: true+ app_id: "YOUR_APP_ID"+ secret: "YOUR_SECRET"+ allow_from: []+ msg_format: "plain" # 或 "markdown"+```++## Step 3 —— 启动++```bash+deeptutor bot start my-math-tutor+```++## 配置参考++| 字段 | 类型 | 必填 | 说明 |+|------|------|------|------|+| `enabled` | bool | 是 | |+| `app_id` | string | 是 | 来自 bot 平台 |+| `secret` | string | 是 | 来自 bot 平台 |+| `allow_from` | list[string] | 可选 | QQ user id |+| `msg_format` | `"plain" \| "markdown"` | 可选 | 回复格式 |++## QQ 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| C2C(私信) | ✅ |+| 群消息 | ✅ |+| Markdown | ✅ *(要 `msg_format: "markdown"`)* |+| 文件 / 图片附件 | ✅ |+| 回复里的图片生成 | ✅ |+| @ 寻址 | ✅ |++## 常见问题++### 重复消息++QQ 的 gateway 偶尔会重发消息。渠道层维护一个最近 1000 条 message id 的 deque,静默丢弃重复消息。如果你仍然看到重复,可能 deque 已经回绕 —— 重启 bot。++### 连接时报 "Auth failed"++`app_id` / `secret` 错了,或者你的 bot 没有被审核通过相应的消息类型。去 QQ Bot 平台检查。++### Markdown 不渲染++QQ 各客户端版本对 markdown 的渲染参差不齐。有些客户端识别 `**bold**`,有些要 `<b>bold</b>`。如果用户反馈渲染异常,试试 `msg_format: "plain"`。++## 另请参阅++- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 整体架构diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/slack.md b/site/src/content/docs/zh-cn/docs/tutorbot/slack.mdnew file mode 100644index 000000000..500cc79a0--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/slack.md@@ -0,0 +1,185 @@+---+title: Slack+description: 在 Slack 上跑 TutorBot —— Socket Mode 应用、按 thread 分会话、频道与 DM 策略。+---++Slack 是功能最完整的渠道:DM、频道 @、**按 thread 分会话**(每条 thread 就是一个独立的 DeepTutor session)、Slack 风味的 markdown、文件上传、确认 reaction。++连接走 **Socket Mode** —— 不需要公网 IP 或 webhook。++## 你需要准备++- 一个你可以装应用的 Slack workspace(自己的或管理员授权的)+- 5 分钟在 <https://api.slack.com/apps>++## Step 1 —— 创建 Slack app++1. 去 <https://api.slack.com/apps> → **Create New App** → **From scratch**+2. 起名(比如 "Math Mentor"),选 workspace+3. 创建后进 **Socket Mode**(左侧栏)→ **Enable Socket Mode** *(开关打开)*+4. 提示你生成 App-Level Token 时,给 `connections:write` 权限并复制 —— 这就是你的 **`app_token`**(`xapp-` 开头)++## Step 2 —— 配置 OAuth scopes++还在你的 app 里:++1. 左侧栏 → **OAuth & Permissions**+2. **Scopes** → **Bot Token Scopes** 加上:+ - `chat:write` —— 发消息+ - `chat:write.public` —— 不入群也能发到频道+ - `files:write` —— 上传文件+ - `reactions:write` —— 加 reaction(`:eyes:` 确认)+ - `users:read` —— 解析 user id 到名字+ - `app_mentions:read` —— 接收 @+ - `im:history` —— 读 DM 历史+ - `im:read` —— 读 DM 频道信息+ - `channels:history` —— 读公开频道历史+ - `groups:history` —— *(可选)* 私有频道+3. 点 **Install to Workspace** → 授权+4. 复制 **Bot User OAuth Token**(`xoxb-` 开头)—— 这是你的 **`bot_token`**++## Step 3 —— 订阅事件++1. 左侧栏 → **Event Subscriptions**+2. **Subscribe to bot events** 加上:+ - `app_mention`+ - `message.im`+ - `message.channels` *(只在你想监听频道时才加;否则跳过)*++## Step 4 —— 配置++```yaml+channels:+ slack:+ enabled: true+ mode: "socket" # 只支持 socket 一种+ bot_token: "xoxb-XXX..." # 来自 OAuth & Permissions+ app_token: "xapp-XXX..." # 来自 Socket Mode+ reply_in_thread: true # 回复留在 thread 内+ react_emoji: "eyes" # 用来确认收到的 reaction+ allow_from: ["*"] # User id 列表;"*" = 全开+ group_policy: "mention" # 频道里只回 @ 消息+ group_allow_from: [] # 限制到特定频道 id(如果用 mention)+ dm:+ enabled: true+ policy: "open" # DM 全回,或 "allowlist"+ allow_from: []+```++## Step 5 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:slack → connecting (socket mode)+[bot:my-math-tutor] channel:slack → ready+```++在 Slack 里 DM bot,或者在频道 @ 它。++## 配置参考++| 字段 | 类型 | 必填 | 默认值 | 说明 |+|------|------|------|--------|------|+| `enabled` | bool | 是 | `false` | |+| `mode` | string | 是 | `"socket"` | 只支持 `socket` |+| `bot_token` | string | 是 | —— | `xoxb-…` |+| `app_token` | string | 是 | —— | `xapp-…`(Socket Mode token) |+| `reply_in_thread` | bool | 可选 | `true` | 在 thread 内回复 vs 发新消息 |+| `react_emoji` | string | 可选 | `"eyes"` | 确认 reaction 用的 emoji 名 |+| `allow_from` | list[string] | 是 | `[]` | User id 列表,或 `"*"` |+| `group_policy` | `"mention" \| "open"` | 可选 | `"mention"` | 频道内 |+| `group_allow_from` | list[string] | 可选 | `[]` | 频道 id 列表(想限定到特定频道时) |+| `dm.enabled` | bool | 可选 | `true` | |+| `dm.policy` | `"open" \| "allowlist"` | 可选 | `"open"` | |+| `dm.allow_from` | list[string] | 可选 | `[]` | `policy=allowlist` 时生效 |++## 按 thread 分会话++这是 Slack 上最爽的一个特性:**每条 Slack thread 都是独立的 DeepTutor session**。当你在频道 @ bot:++1. Bot 回复,开启一条新 thread+2. 在那条 thread 里的后续回复都进同一个 session(带它全部历史、挂载的 KB 等)+3. 不同频道里的 thread 是不同 session+4. DM 自己一个 session(每个用户一个)++这意味着一个团队可以在同一个频道里并行开多个导师对话而不互相串扰。++如果想关掉这个(每次回复都从头开始):++```yaml+channels:+ slack:+ reply_in_thread: false+ # 附带效果:bot 直接在频道里回,不开 thread+```++## Slack 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| DM | ✅ |+| 频道 @ | ✅ |+| Thread(会话隔离) | ✅ |+| 文件上传 | ✅ |+| 文件下载 | ✅ |+| Markdown → mrkdwn | ✅ *(渠道自动转换)* |+| 代码块 | ✅ |+| LaTeX 数学公式 | ⚠️ 当代码块渲染(Slack 不支持 LaTeX) |+| 发送 reaction | ✅ *(通过 `react_emoji`)* |+| Slash 命令 | ⚠️ 暂不支持 —— 用 DM/@ 寻址 |++## Markdown 到 mrkdwn++Slack 用自己的 markdown 方言("mrkdwn")。DeepTutor 的 Slack 渠道会自动转换:++| 标准 markdown | mrkdwn 输出 |+|---------------|-------------|+| `**bold**` | `*bold*` |+| `*italic*` | `_italic_` |+| `# heading` | `*heading*`(加粗) |+| `` `code` `` | `` `code` `` |+| ` ```code``` ` | ` ```code``` ` |+| `[link](url)` | `<url|link>` |+| `- bullet` | `• bullet` |+| `> quote` | `> quote` |++## 常见问题++### Bot 说了 hi 但后面就不回了++检查 `reply_in_thread`:++```yaml+reply_in_thread: true+```++如果是 true,bot 只监听它自己开的 thread(`thread_ts` 要匹配)。如果你在它首次回复之后又在非 thread 消息里发,bot 看不到。++### "Not authorized" / Slack API 401++Token 弄反了 —— 确认 `bot_token` 填的是 `xoxb-` 开头的,`app_token` 填的是 `xapp-` 开头的。很容易顺手填反。++### Bot 在频道里不回复++两个前提:+1. Bot 要被 **邀请到频道**(`/invite @bot`)+2. 如果 `group_policy: mention`,你的消息必须 @ bot(`@math-mentor what is...`)++### 长消息被截断++Slack 单条消息上限 40000 字(比 Telegram/Discord 长得多)。DeepTutor 不会主动拆 —— 但极长的回复(比如 50+ 页的 Deep Research 报告)建议直接发文件。++## 保活机制++Socket Mode 是一条 WebSocket 长连。渠道层:+- 每 30 秒发 ping+- 断线自动指数退避重连+- 不需要任何外部守护++## 另请参阅++- [**Discord**](/zh-cn/docs/tutorbot/discord/) —— 类似的 developer portal 模型+- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 整体架构diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/telegram.md b/site/src/content/docs/zh-cn/docs/tutorbot/telegram.mdnew file mode 100644index 000000000..f1802f590--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/telegram.md@@ -0,0 +1,193 @@+---+title: Telegram+description: 在 Telegram 上跑 TutorBot —— 通过 BotFather 注册、配置项与运维要点。+---++Telegram 是最容易接入的渠道 —— 不用公网 IP、不用 webhook 签名,BotFather 注册大概一分钟搞定。++## 你需要准备++- 一个 Telegram 账号+- 和 [@BotFather](https://t.me/BotFather) 的一段对话++就这些。不用企业认证、不用开发者控制台注册。++## Step 1 —— 在 BotFather 注册一个 bot++打开 Telegram,搜 `@BotFather`,开个聊天。然后:++```text+You> /newbot++BotFather> Alright, a new bot. How are we going to call it?+ Please choose a name for your bot.++You> Math Mentor++BotFather> Good. Now let's choose a username for your bot.+ It must end in 'bot'. Like this, for example: TetrisBot.++You> hku_math_mentor_bot++BotFather> Done! Congratulations on your new bot.+ You will find it at t.me/hku_math_mentor_bot.++ Use this token to access the HTTP API:+ 123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11+```++**把这个 token 复制下来。** 稍后要粘进 `agents.yaml`。++## Step 2 —— 找到你自己的 Telegram user id++你得把自己的 user id 填到 `allow_from` 里(否则 bot 谁都不会理)。最简单的办法:和 [@userinfobot](https://t.me/userinfobot) 聊一句,它会回你 id。++```text+You> hi++userinfobot> Id: 123456789+ First: Frank+ Last:+ Username: @frank+ Language: zh+```++## Step 3 —— 配置你的 bot++编辑 `data/tutorbot/<bot_id>/agents.yaml`:++```yaml+agent:+ id: my-math-tutor+ name: Math Mentor+ persona: "Socratic math tutor specializing in calculus and linear algebra."+ model: gpt-4o++channels:+ telegram:+ enabled: true+ token: "123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"+ allow_from:+ - "123456789" # 你的 Telegram user id+ # - "*" # 取消注释即对所有人开放(谨慎)+```++## Step 4 —— 启动 bot++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] starting...+[bot:my-math-tutor] channel:telegram → connecting+[bot:my-math-tutor] channel:telegram → ok (long-polling)+[bot:my-math-tutor] running.+```++然后打开 Telegram,搜 `@hku_math_mentor_bot`,发 `/start` —— 你就在和 bot 对话了。++## 配置参考++| 字段 | 类型 | 必填 | 默认值 | 说明 |+|------|------|------|--------|------|+| `enabled` | bool | 是 | `false` | 启用该渠道 |+| `token` | string | 是 | —— | BotFather 给的 HTTP API token |+| `allow_from` | list[string] | 是 | `[]` *(默认拒所有)* | User id 列表,或 `"*"` 全开 |++## Telegram 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 私聊 | ✅ |+| 群聊 | ✅ *(bot 要被加进群,并且 `group_policy` 配合)* |+| Markdown 渲染 | ✅ *(走 Telegram 的 markdown_v2 解析器)* |+| LaTeX 数学公式 | ⚠️ 当纯文本渲染 —— Telegram 不识别 `$...$` |+| 文件上传 | ✅ *(在 Telegram 的 20 MB / 2 GB 限制内)* |+| 文件下载 | ✅ *(bot 可以接收 PDF、图片、语音)* |+| 语音转写 | ✅ *(如果全局配置了 `transcription_api_key`)* |+| 线程内回复 | ⚠️ 部分支持 —— Telegram 只有 reply-to-message,没有真正的 thread |++## 群聊++在 Telegram 群里使用 bot:++1. 把 bot 加入群(Add Member → 搜 `@your_bot`)+2. 在 BotFather 里关掉 **Group Privacy**:`/mybots` → 选 bot → **Bot Settings** → **Group Privacy** → **Turn OFF**+3. 在消息里 @ 它来寻址(`@hku_math_mentor_bot question?`)++在配置里设 `group_policy`:++```yaml+channels:+ telegram:+ group_policy: "mention" # 只在被 @ 时回复+ # group_policy: "open" # 每条消息都回(很吵!)+```++## 保活机制++Telegram 渠道默认走 **long polling** —— bot 用一个长连接循环从 Telegram 服务器拉更新。对网络抖动很鲁棒:++- 断网就是下一次 `getUpdates` 调用失败+- 渠道层会指数退避重试+- 网络恢复后 polling 继续++不需要公网 IP、webhook 或反向代理。Telegram 的 BotFather 也不要求你这边配置任何 URL。++## 常见问题++### Bot 不回我消息++99% 是 `allow_from` 的问题:++```yaml+allow_from:+ - "123456789" # 你真实的 id,用引号包起来(这是 string 字段)+```++空的 `allow_from: []` 表示「拒所有人」—— 包括你自己。用 `["*"]` 表示全开。++### Bot 在群里不回复++两件事要检查:++1. BotFather → `/mybots` → 你的 bot → Group Privacy → **Disabled**+2. 配置里 `group_policy: "mention"` 设了,并且你确实在消息里 `@` 了 bot++### "Conflict: terminated by other getUpdates request"++同一个 bot 你启动了两份(比如 `deeptutor bot start` 跑了两次,或者两个 DeepTutor 实例)。Telegram 一个 token 只允许一个 polling 客户端。把多余的停掉。++### 超过 4096 字的消息被截断++Telegram 单条消息上限 4096 字。Bot 会自动把过长的消息拆成多条发。如果回复非常长(比如 Deep Research 报告),更建议发文件:++```yaml+channels:+ telegram:+ send_long_as_file: true # 回复超 4096 字时自动附 .md+```++## 语音消息++如果你在 `.env` 里配了 `TRANSCRIPTION_API_KEY`(以及 Groq Whisper 之类的转写 provider),bot 会把语音转成文字当成文本输入处理。否则语音会被忽略。++## 文件和图片++用户上传文件或图片时:++- **图片** → 作为视觉输入发给模型+- **PDF / DOCX** → 解析后作为附件(通过 `read_source` 工具可读全文)+- **其他** → 收到但忽略++## 多租户部署++多用户模式下,每个用户都可以有自己的 Telegram bot。Bot id 是按用户隔离的,所以 `alice` 和 `bob` 都可以叫 `my-tutor` 而不冲突。++如果想要组织级共享的 bot(一个 bot 给很多人用),把 bot 挂在管理员账号下,再把 `allow_from` 配一个长名单,或者直接 `["*"]`(小心)。++## 另请参阅++- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 架构和生命周期+- [**CLI → bot 命令**](/zh-cn/docs/cli/commands/#deeptutor-bot--tutorbot-lifecycle)diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/wecom.md b/site/src/content/docs/zh-cn/docs/tutorbot/wecom.mdnew file mode 100644index 000000000..11f916f34--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/wecom.md@@ -0,0 +1,110 @@+---+title: 企业微信+description: 在企业微信上跑 TutorBot —— 通过 AI Bot 平台的 WebSocket 长连。+---++企业微信是腾讯的企业即时通信产品。DeepTutor 通过 **AI Bot** 平台用一条 WebSocket 长连接入。++## 你需要准备++- 一个有管理员权限的企业微信组织+- [`wecom-aibot-sdk`](https://pypi.org/project/wecom-aibot-sdk/) Python 包+- 10 分钟在企业微信管理后台++## Step 1 —— 装 SDK++企业微信支持依赖一个可选 Python 包:++```bash+pip install wecom-aibot-sdk+```++如果你用 `pip install -e ".[tutorbot]"` 装的,可能已经带了。验证一下:++```bash+python -c "import wecom_aibot_sdk; print('ok')"+```++## Step 2 —— 创建 AI Bot++1. 登录 <https://work.weixin.qq.com/>+2. **应用与小程序** → **AI 机器人平台**+3. **新建应用** → 选 **AI 机器人** 类型+4. 填名字、描述、允许使用的部门+5. 复制 **Bot ID** 和 **Secret**++## Step 3 —— 配置++```yaml+channels:+ wecom:+ enabled: true+ bot_id: "YOUR_BOT_ID"+ secret: "YOUR_SECRET"+ allow_from: [] # 可选,按 user id 做限制+ welcome_message: "Hi! 我是你的数学导师,有什么问题尽管问。"+```++## Step 4 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:wecom → connecting (ws://wecom...)+[bot:my-math-tutor] channel:wecom → ready+```++## 配置参考++| 字段 | 类型 | 必填 | 说明 |+|------|------|------|------|+| `enabled` | bool | 是 | |+| `bot_id` | string | 是 | 来自 AI Bot 平台 |+| `secret` | string | 是 | 来自 AI Bot 平台 |+| `allow_from` | list[string] | 可选 | 企业微信 user id;`[]` 允许组织内所有人 |+| `welcome_message` | string | 可选 | 新用户首次发消息时回的欢迎语 |++## 企业微信上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 企业内私聊 | ✅ |+| 群聊 | ✅ |+| Markdown | ✅ |+| 文件 / 图片 / 语音 | ✅ |+| 外部联系人(客户) | ⚠️ 通过企业微信的外部联系人能力 |+| @ 寻址 | ✅ |++## 保活机制++后台线程维护 WebSocket,瞬时故障自动重连。++如果 bot 持续掉线:++1. 检查 AI Bot 平台 —— bot 是不是被停用了?+2. 确认你的 DeepTutor server 能正常向企业微信服务器发出 TLS 出站+3. 重启:`deeptutor bot stop my-math-tutor && deeptutor bot start my-math-tutor`++## 常见问题++### `ImportError: wecom_aibot_sdk`++```bash+pip install wecom-aibot-sdk+deeptutor bot start my-math-tutor+```++### Bot 连上了但不回复++`allow_from` 是常见嫌疑人。也确认发消息的用户在你 AI Bot 配置允许的部门里。++### 同一个组织里跑多个 bot++每个 bot 都要自己独立的 `bot_id` + `secret`。你可以在同一个 DeepTutor server 里跑多个 TutorBot,各连各的企业微信 bot。++## 另请参阅++- [**飞书**](/zh-cn/docs/tutorbot/feishu/) —— 字节的企业聊天平台+- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 整体架构diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/whatsapp.md b/site/src/content/docs/zh-cn/docs/tutorbot/whatsapp.mdnew file mode 100644index 000000000..0a8edd6e0--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/whatsapp.md@@ -0,0 +1,152 @@+---+title: WhatsApp+description: 在 WhatsApp 上跑 TutorBot —— 需要单独跑一个 Node.js 桥接器(基于 Baileys,走 WhatsApp Web 协议)。+---++WhatsApp 是个特殊存在。官方的 WhatsApp Business API 摩擦不小(企业认证、月费、申请流程)。所以 DeepTutor 的 WhatsApp 渠道连的是一个 **独立的 Node.js 桥接器**,桥接器讲 WhatsApp Web 的协议 —— 上手快、免费、不用做企业认证。++## 你需要准备++- 一台跑 Node.js 18+ 的机器(可以和 DeepTutor 同一台,也可以分开)+- 一个真实手机上的 WhatsApp 账号+- ~5 分钟扫码配对++## Step 1 —— 跑桥接器++DeepTutor 仓库里在 `multi-user/whatsapp-bridge/` 下有一个示例桥接器,用的是 [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys)。或者你也可以跑任何兼容的桥接器,只要它在已知端口上暴露一个 WebSocket。++最小桥接器长这样:++```javascript+// bridge.js+const { default: makeWASocket, useMultiFileAuthState } = require('@whiskeysockets/baileys')+const WebSocket = require('ws')++const wss = new WebSocket.Server({ port: 3001 })+let waSocket = null++async function start() {+ const { state, saveCreds } = await useMultiFileAuthState('./auth')+ waSocket = makeWASocket({ auth: state, printQRInTerminal: true })+ waSocket.ev.on('creds.update', saveCreds)+ waSocket.ev.on('messages.upsert', ({ messages }) => {+ wss.clients.forEach(client => client.send(JSON.stringify(messages[0])))+ })+}++wss.on('connection', (ws) => {+ ws.on('message', (raw) => {+ const { jid, text } = JSON.parse(raw)+ waSocket?.sendMessage(jid, { text })+ })+})++start()+```++启动:++```bash+cd multi-user/whatsapp-bridge+npm install+node bridge.js+```++终端会出一个二维码。在手机上打开 WhatsApp → **设置 → 已链接的设备 → 链接设备** → 扫码。搞定。++## Step 2 —— 配置 DeepTutor++```yaml+channels:+ whatsapp:+ enabled: true+ bridge_url: "ws://localhost:3001" # 桥接器监听地址+ bridge_token: "" # 可选,桥接器要求鉴权时用+ allow_from: # 手机号,E.164 格式+ - "+85291234567"+```++## Step 3 —— 启动 bot++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:whatsapp → connecting (ws://localhost:3001)+[bot:my-math-tutor] channel:whatsapp → ready+```++发消息给 **桥接器登录的那个手机号** —— 桥接器把消息转给 DeepTutor,bot 通过桥接器回,回复落到 WhatsApp。++## 配置参考++| 字段 | 类型 | 必填 | 说明 |+|------|------|------|------|+| `enabled` | bool | 是 | |+| `bridge_url` | url | 是 | 桥接器的 WebSocket URL |+| `bridge_token` | string | 可选 | 桥接器要求鉴权时用 |+| `allow_from` | list[string] | 可选 | 手机号(E.164);`["*"]` 全开 |++## WhatsApp 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 私聊 | ✅ |+| 群消息 | ✅ *(桥接器要支持群路由)* |+| Markdown | ⚠️ 基础 —— WhatsApp 只渲染 `*bold*`、`_italic_`、`~strike~`、`` ` ` `` |+| 文件 / 图片 / 音频 | ✅ *(通过桥接器)* |+| LaTeX 数学公式 | ❌ 当纯文本渲染 |+| 语音 | ✅ *(设了 `TRANSCRIPTION_API_KEY` 就转写)* |++## 保活机制++WhatsApp Web 的 token 会定期失效 —— 一般是手机离线 ~2 周。失效时:++- 桥接器会打印新的二维码+- 你用手机重新扫+- 会话恢复++把桥接器跑在受管的进程下(`pm2`、systemd、supervisor),crash 时自动重启。DeepTutor 这边在桥接器 WebSocket 断开时会自动重连。++## 为什么用桥接器而不是官方 API?++| 方案 | 摩擦 | 成本 | 限制 |+|------|------|------|------|+| WhatsApp Business API(官方) | 企业认证 + Meta 审批 | 每条消息 $0.005–0.10 | 24 小时窗口外只能发模板消息 |+| WhatsApp Web 桥接器(这个) | 扫一次码 | 免费 | 手机要 ~每周保持在线 |++桥接器很适合个人和小团队用。生产级的商用消息,考虑 Twilio 或 360dialog(官方 API 的代理商)。++## 风险与政策++WhatsApp Web 的条款允许自动化自己的账号,但严格说不太欢迎类 bot 的用法。实际风险:++- **封号** —— 低量使用很少;刷消息容易踩+- **限流** —— WhatsApp 会标记每分钟发消息过多的账号++如果你要把 DeepTutor 的 WhatsApp 渠道用在任何非玩具部署,请用你掌控的专属手机号,不要用个人号。++## 常见问题++### 桥接器一直打印二维码++auth state 没有被持久化。检查 `./auth` 目录可写、并且不会在重启时被清掉。++### "Bridge unreachable"++```bash+curl http://localhost:3001 2>&1 | head -1+# 至少应该有响应,哪怕是 400(这是 WS 端点)+```++如果是 `connection refused`,桥接器没跑。如果是 `cannot resolve host`,你的 `bridge_url` 写错了。++### 消息发出去但对方收不到++看桥接器日志(`node bridge.js` 的 stdout)。WhatsApp Web 有时候在桥接器发太快时会静默丢消息 —— 在桥接器里加节流。++## 另请参阅++- [**电子邮件**](/zh-cn/docs/tutorbot/email/) —— 另一种桥接式集成(IMAP/SMTP)+- [Baileys 文档](https://github.com/WhiskeySockets/Baileys) —— 桥接库参考diff --git a/site/src/content/docs/zh-cn/docs/tutorbot/zulip.md b/site/src/content/docs/zh-cn/docs/tutorbot/zulip.mdnew file mode 100644index 000000000..1e91461e7--- /dev/null+++ b/site/src/content/docs/zh-cn/docs/tutorbot/zulip.md@@ -0,0 +1,131 @@+---+title: Zulip+description: 在 Zulip 上跑 TutorBot —— stream + topic 寻址、KaTeX 数学渲染,自 v1.3.9 起支持。+---++Zulip 在 **v1.3.9**(2026-05-09)加入。它用 Zulip 的 event-queue 长轮询,并支持 Zulip 独有的 **stream + topic** 寻址方式。++## 你需要准备++- 一个 Zulip 服务器(任意版本 —— Zulip Cloud 或自建)+- 在你的组织里创建 bot 的管理员权限++## Step 1 —— 创建 bot++1. 在 Zulip 里点 ⚙️ 图标(右上角)→ **Organization** → **Bots & integrations**+2. 点 **Add a new bot**+3. Bot 类型:**Generic bot**+4. 名字:"Math Mentor"+5. Bot 邮箱:自动生成,比如 `[email protected]`+6. 点 **Create bot**+7. **Download API key** 或 **Show API key** 然后复制++## Step 2 —— 把 bot 订阅到 stream++默认情况下,generic bot 能收到私信,但不会看到公开 stream,除非你订阅它。在 bot 设置里:**Streams subscribed** → 添加你希望 bot 关注的 stream。++也可以通过配置完成(`subscribe_streams` 字段)。++## Step 3 —— 配置++```yaml+channels:+ zulip:+ enabled: true+ site: "https://your-zulip.example.com"+ email: "[email protected]"+ api_key: "YOUR_API_KEY"+ allow_from: ["*"]+ group_policy: "mention" # 订阅的 stream 内:mention vs open+ subscribe_streams:+ - "study-help"+ - "homework"+ timeout: 60.0 # 事件队列 poll 超时,秒+```++## Step 4 —— 启动++```bash+deeptutor bot start my-math-tutor+```++```text+[bot:my-math-tutor] channel:zulip → register event queue+[bot:my-math-tutor] channel:zulip → subscribed: [study-help, homework]+[bot:my-math-tutor] channel:zulip → ready (queue_id=q_abc)+```++## 配置参考++| 字段 | 类型 | 必填 | 默认值 | 说明 |+|------|------|------|--------|------|+| `enabled` | bool | 是 | `false` | |+| `site` | url | 是 | —— | 你的 Zulip 服务器 |+| `email` | string | 是 | —— | Zulip 给的 bot 邮箱 |+| `api_key` | string | 是 | —— | 来自 bot 创建页 |+| `allow_from` | list[string] | 可选 | `[]` | User id 或 email;`["*"]` 全开 |+| `group_policy` | `"mention" \| "open"` | 可选 | `"mention"` | stream 内 |+| `subscribe_streams` | list[string] | 可选 | `[]` | 要自动订阅的 stream |+| `timeout` | float | 可选 | `60.0` | 事件队列 poll 超时(秒) |++## Stream + topic 寻址(Zulip 特色)++Zulip 把消息按 **stream**(像频道)和 **topic**(stream 内的话题)切分。DeepTutor 按 **(stream, topic)** 对来划分 session:++- 新 topic = 新的 DeepTutor session+- 同一 topic 跨天 = 同一 session,记忆持久化+- 同 stream 里不同 topic = 不同 session++这对课堂使用非常合适:每道作业题一个独立 topic,bot 各自独立跟踪。++## Zulip 上支持的能力++| 特性 | 支持情况 |+|------|----------|+| 私信 | ✅ |+| Stream 消息 + topic | ✅ *(按 topic 隔离 session)* |+| Markdown | ✅ |+| **LaTeX / KaTeX 数学公式** | ✅ *(Zulip 原生渲染 `$$...$$`)* |+| 文件上传/下载 | ✅ |+| Mention 或 open 模式 | ✅ |+| 表情反应 | ⚠️ 只支持发出方向 |++## 保活机制++Zulip 的 **event-queue API** 是带自动恢复的长轮询:++- Bot 用 `timeout=60s` 调 `/api/v1/events?queue_id=...`+- 新事件以 JSON 返回;超时后返回空响应+- 如果 `queue_id` 过期(服务器重启、闲置太久),bot 自动注册一个新的++后台线程跑监听器,把事件桥接到 DeepTutor 的 async 总线。线程一直跑直到 bot 被停掉。++## 常见问题++### "Bad event queue id"++队列过期了(服务器重启或闲置 > 10 分钟)。渠道会自动恢复 —— 不用处理。如果反复发生,可能是 Zulip 服务器状态不太对。++### Bot 看不到 stream 消息++订阅了吗?要么在 Zulip UI(bot 设置 → Streams)做,要么通过 `subscribe_streams` 配置。++### 数学公式不渲染++Bot 输出的数学要符合 Zulip 期望的格式:++```text+行内:$x^2$++块级:+```math+\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}+```+```++DeepTutor 的 Zulip 渠道会自动把标准 `$...$` 和 `$$...$$` 转成 Zulip 格式。++## 另请参阅++- [**TutorBot 概览**](/zh-cn/docs/tutorbot/) —— 整体架构+- [Zulip Bot API 文档](https://zulip.com/api/) —— 参考资料diff --git a/site/src/pages/index.astro b/site/src/pages/index.astronew file mode 100644index 000000000..d2efcf280--- /dev/null+++ b/site/src/pages/index.astro@@ -0,0 +1,2028 @@+---+import "../styles/global.css";++const features = [+ {+ chapter: "I",+ title: "Chat Workspace",+ body: "Five modes — Chat, Solve, Quiz, Research, Visualize — share one session, knowledge base, and citation history. Escalate mid-thread without losing context.",+ href: "/docs/explore/chat-workspace/",+ },+ {+ chapter: "II",+ title: "Co-Writer",+ body: "A split-view Markdown workbench where AI is a first-class collaborator. Select, rewrite, expand — grounded in your knowledge base.",+ href: "/docs/explore/co-writer/",+ },+ {+ chapter: "III",+ title: "Book Engine",+ body: "A multi-agent pipeline compiles your materials into interactive living books — 13 block types, including a GeoGebra viewer and animations.",+ href: "/docs/explore/book/",+ },+ {+ chapter: "IV",+ title: "Knowledge",+ body: "Versioned RAG-ready document libraries on LlamaIndex end-to-end. Every (re-)index is tracked, comparable, and rollback-able.",+ href: "/docs/explore/knowledge/",+ },+ {+ chapter: "V",+ title: "Space",+ body: "Your personal library — chat history, notebooks, question bank, and authored skills. The read-and-review counterpart to every active surface.",+ href: "/docs/explore/space/",+ },+ {+ chapter: "VI",+ title: "Memory",+ body: "Append-only L1 traces, L2 curated facts with citations, L3 cross-surface synthesis. A Memory Graph lets you audit why DeepTutor knows what it knows.",+ href: "/docs/explore/memory/",+ },+];++const installs = [+ {+ id: "pypi",+ label: "PyPI",+ tag: "Recommended",+ cmd: "pip install -U deeptutor",+ blurb: "Smoothest path. Full local Web app + CLI, no clone required.",+ code: `# 1. Create a workspace directory+mkdir -p my-deeptutor && cd my-deeptutor++# 2. Install, configure, launch+pip install -U deeptutor+deeptutor init+deeptutor start`,+ foot: "Then open 127.0.0.1:3782",+ href: "/docs/get-started/pypi/",+ },+ {+ id: "docker",+ label: "Docker",+ tag: "One container",+ cmd: "docker run … ghcr.io/hkuds/deeptutor",+ blurb: "One container for the full Web app, from GitHub Container Registry.",+ code: `docker run --rm --name deeptutor \\+ -p 127.0.0.1:3782:3782 \\+ -p 127.0.0.1:8001:8001 \\+ -v deeptutor-data:/app/data \\+ ghcr.io/hkuds/deeptutor:latest`,+ foot: "Map both 3782 (UI) and 8001 (API). Data persists in the named volume.",+ href: "/docs/get-started/docker/",+ },+ {+ id: "source",+ label: "Source",+ tag: "Contributors",+ cmd: "git clone … && pip install -e .",+ blurb: "Hot-reload the frontend, hack on the backend, match CI exactly.",+ code: `git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++python3 -m venv .venv && source .venv/bin/activate+pip install -e .+( cd web && npm ci --legacy-peer-deps )++deeptutor init && deeptutor start`,+ foot: "Python 3.11+ · Node.js 22 LTS. Next.js runs in dev mode against ./web.",+ href: "/docs/get-started/from-source/",+ },+ {+ id: "cli",+ label: "CLI",+ tag: "Headless",+ cmd: "pip install -e ./packaging/deeptutor-cli",+ blurb: "Lightweight install for servers, agent harnesses, Claude Code / Codex setups.",+ code: `git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++python3 -m venv .venv-cli && source .venv-cli/bin/activate+pip install -e ./packaging/deeptutor-cli++deeptutor init --cli+deeptutor chat`,+ foot: "No backend / frontend ports. Embeddings off by default — opt in for RAG.",+ href: "/docs/get-started/cli-only/",+ },+];++---++<!doctype html>+<html lang="en" data-theme="light">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>DeepTutor — Agent-native, open-source personalized tutoring</title>+ <meta+ name="description"+ content="An open-source AI learning companion. Five modes, one workspace. Personal TutorBots. Knowledge-driven learning."+ />+ <link rel="icon" type="image/png" href="/logo.png" />+ <script is:inline>+ (() => {+ const key = "starlight-theme";+ const resolve = (preference) =>+ preference === "light" || preference === "dark"+ ? preference+ : window.matchMedia("(prefers-color-scheme: light)").matches+ ? "light"+ : "dark";+ let stored = "auto";+ try {+ const value = localStorage.getItem(key);+ stored = value === "light" || value === "dark" ? value : "auto";+ } catch {}+ document.documentElement.dataset.theme = resolve(stored);+ })();+ </script>+ </head>+ <body>+ <header class="nav">+ <div class="nav-inner">+ <a class="nav-brand" href="/" aria-label="DeepTutor">+ <img src="/logo.png" alt="DeepTutor" />+ </a>+ <nav class="nav-links">+ <a+ class="nav-icon"+ href="https://github.com/HKUDS/DeepTutor"+ target="_blank"+ rel="noopener"+ aria-label="GitHub"+ title="GitHub"+ >+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>+ </svg>+ </a>+ <a+ class="nav-icon"+ href="https://discord.gg/eRsjPgMU4t"+ target="_blank"+ rel="noopener"+ aria-label="Discord"+ title="Discord"+ >+ <svg width="17" height="17" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.09.09 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.09 16.09 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09-.01-.02-.04-.03-.07-.03-1.5.26-2.93.71-4.27 1.33-.01 0-.02.01-.03.02-2.72 4.07-3.47 8.03-3.1 11.95 0 .02.01.04.03.05 1.8 1.32 3.53 2.12 5.24 2.65.03.01.06 0 .07-.02.4-.55.76-1.13 1.07-1.74.02-.04 0-.08-.04-.09-.57-.22-1.11-.48-1.64-.78-.04-.02-.04-.08-.01-.11.11-.08.22-.17.33-.25.02-.02.05-.02.07-.01 3.44 1.57 7.15 1.57 10.55 0 .02-.01.05-.01.07.01.11.09.22.17.33.26.04.03.04.09-.01.11-.52.31-1.07.56-1.64.78-.04.01-.05.06-.04.09.32.61.68 1.19 1.07 1.74.03.01.06.02.09.01 1.72-.53 3.45-1.33 5.25-2.65.02-.01.03-.03.03-.05.44-4.53-.73-8.46-3.1-11.95-.01-.01-.02-.02-.04-.02zM8.52 14.91c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12 0 1.17-.84 2.12-1.89 2.12zm6.97 0c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12 0 1.17-.83 2.12-1.89 2.12z"/>+ </svg>+ </a>+ <a+ class="nav-icon"+ href="https://github.com/HKUDS/DeepTutor/issues/78"+ target="_blank"+ rel="noopener"+ aria-label="WeChat community"+ title="WeChat community"+ >+ <svg width="17" height="17" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M8.69 4C4.55 4 1.2 6.68 1.2 10c0 1.86 1.04 3.51 2.69 4.61l-.7 2.4 2.79-1.5c.83.3 1.74.49 2.7.49.34 0 .67-.02 1-.06-.13-.46-.21-.94-.21-1.43 0-3.07 2.97-5.5 6.7-5.5.33 0 .67.02 1 .07C16.39 6.32 12.86 4 8.69 4ZM6.18 8.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5 1c-3.3 0-6 2.24-6 5s2.7 5 6 5c.74 0 1.45-.12 2.1-.34L20.2 20l-.7-2.05c1.07-.95 1.7-2.15 1.7-3.45 0-2.76-2.7-5-6-5Zm-2 4a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Zm4 0a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"/>+ </svg>+ </a>+ <span class="nav-tool-divider nav-links-divider" aria-hidden="true"></span>+ <a class="nav-text" href="/docs/">Docs</a>+ </nav>+ <div class="nav-tools" aria-label="Preferences">+ <label class="nav-tool" aria-label="Theme">+ <svg class="nav-tool-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <rect x="2.5" y="4" width="19" height="13" rx="2"/>+ <path d="M8 21h8M12 17v4"/>+ </svg>+ <select class="nav-select" data-theme-select aria-label="Theme">+ <option value="auto">Auto</option>+ <option value="light">Light</option>+ <option value="dark">Dark</option>+ </select>+ <svg class="nav-tool-caret" width="10" height="10" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <polyline points="3 4.5 6 7.5 9 4.5"/>+ </svg>+ </label>+ <span class="nav-tool-divider" aria-hidden="true"></span>+ <label class="nav-tool" aria-label="Language">+ <svg class="nav-tool-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <circle cx="12" cy="12" r="9.5"/>+ <path d="M2.5 12h19"/>+ <path d="M12 2.5a14 14 0 0 1 4 9.5 14 14 0 0 1-4 9.5 14 14 0 0 1-4-9.5 14 14 0 0 1 4-9.5z"/>+ </svg>+ <select class="nav-select" data-locale-select aria-label="Language">+ <option value="/" selected>English</option>+ <option value="/zh-cn/">简体中文</option>+ </select>+ <svg class="nav-tool-caret" width="10" height="10" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <polyline points="3 4.5 6 7.5 9 4.5"/>+ </svg>+ </label>+ </div>+ </div>+ </header>++ <main>+ <section class="hero">+ <div class="hero-bg" aria-hidden="true"></div>+ <img class="hero-wordmark" src="/banner.png" alt="DeepTutor" />+ <h1 class="hero-tagline">+ Personal tutoring,<br />+ <em>reimagined.</em>+ </h1>+ <p class="hero-sub">+ Agent-native Learning Companion that grows with you.<br />+ Fully Open-Sourced.+ </p>+ <div class="hero-actions">+ <a class="btn btn-primary" href="/docs/">Docs</a>+ <a+ class="btn btn-ghost btn-gh"+ href="https://github.com/HKUDS/DeepTutor"+ target="_blank"+ rel="noopener"+ aria-label="DeepTutor on GitHub"+ >+ <svg width="15" height="15" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>+ </svg>+ <span>GitHub</span>+ <span class="btn-gh-sep" aria-hidden="true"></span>+ <span class="btn-gh-count" data-gh-stars>—</span>+ <span class="btn-gh-label">Stars</span>+ </a>+ </div>+ <div class="hero-meta">+ <span><strong>Apache 2.0</strong></span>+ <span class="sep">·</span>+ <span>From <strong>HKU Data Intelligence Lab</strong></span>+ </div>+ </section>++ <section class="showcase">+ <div class="showcase-frame">+ <div class="showcase-chrome">+ <span class="dot red"></span>+ <span class="dot amber"></span>+ <span class="dot green"></span>+ <span class="showcase-title">DeepTutor — Chat Workspace</span>+ </div>+ <img+ class="showcase-shot"+ src="/screenshots/dt-home.png"+ alt="DeepTutor chat workspace — Chat / TutorBot / Co-Writer / Book / Knowledge / Space / Memory in the sidebar; greeting and composer in the main area."+ loading="eager"+ decoding="async"+ />+ </div>+ </section>++ <section class="section">+ <header class="section-head">+ <span class="section-eyebrow">What's inside</span>+ <h2>Six pillars, <em>one</em> running context.</h2>+ <p>+ Every surface reads from — and writes back to — the same memory, knowledge base, and tutor.+ Switching contexts no longer means losing your place.+ </p>+ </header>+ <div class="feature-grid">+ {+ features.map((f) => (+ <a class="feature" href={f.href}>+ <span class="feature-mark">{f.chapter}</span>+ <h3>{f.title}</h3>+ <p>{f.body}</p>+ <span class="feature-arrow">+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none">+ <path+ d="M3 11L11 3M11 3H5M11 3V9"+ stroke="currentColor"+ stroke-width="1.5"+ stroke-linecap="round"+ stroke-linejoin="round"+ />+ </svg>+ </span>+ </a>+ ))+ }+ </div>+ </section>++ <section class="section section-quiet">+ <header class="section-head">+ <span class="section-eyebrow">Install</span>+ <h2>Up and running in <em>minutes</em>.</h2>+ <p>+ Four ways to install — pick the one that fits.+ Every path lands at the same configured workspace.+ </p>+ </header>+ <div class="install" id="install" data-active="pypi">+ <div class="install-tabs" role="tablist">+ {+ installs.map((opt, i) => (+ <button+ class={`install-tab${i === 0 ? " is-active" : ""}`}+ role="tab"+ aria-selected={i === 0 ? "true" : "false"}+ data-target={opt.id}+ >+ <span class="install-tab-label">{opt.label}</span>+ </button>+ ))+ }+ </div>+ <div class="install-body">+ {+ installs.map((opt, i) => (+ <div+ class={`install-panel${i === 0 ? " is-active" : ""}`}+ role="tabpanel"+ data-panel={opt.id}+ >+ <p class="install-blurb">{opt.blurb}</p>+ <pre class="install-code"><code>{opt.code}</code></pre>+ <div class="install-foot">+ <span class="install-foot-note">{opt.foot}</span>+ <a class="install-foot-link" href={opt.href}>+ Full guide+ <svg width="12" height="12" viewBox="0 0 14 14" fill="none" aria-hidden="true">+ <path d="M3 11L11 3M11 3H5M11 3V9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+ </svg>+ </a>+ </div>+ </div>+ ))+ }+ </div>+ </div>+ </section>++ <footer class="footer">+ <div class="footer-inner">+ <a class="footer-brand" href="/">+ <img src="/logo.png" alt="" />+ <span>DeepTutor</span>+ </a>+ <div class="footer-cols">+ <div class="footer-col">+ <h4>Docs</h4>+ <a href="/docs/get-started/">Get Started</a>+ <a href="/docs/explore/">Explore DeepTutor</a>+ <a href="/docs/tutorbot/">Explore TutorBot</a>+ <a href="/docs/cli/">CLI</a>+ </div>+ <div class="footer-col">+ <h4>Community</h4>+ <a href="https://discord.gg/eRsjPgMU4t" target="_blank" rel="noopener">Discord</a>+ <a href="https://github.com/HKUDS/DeepTutor/issues/78" target="_blank" rel="noopener">+ </a>+ <a href="https://github.com/HKUDS/DeepTutor/discussions" target="_blank" rel="noopener">+ Discussions+ </a>+ <a href="https://github.com/HKUDS/DeepTutor/issues" target="_blank" rel="noopener">+ Issues+ </a>+ </div>+ <div class="footer-col">+ <h4>Project</h4>+ <a href="https://github.com/HKUDS/DeepTutor" target="_blank" rel="noopener">+ GitHub+ </a>+ <a+ href="https://github.com/HKUDS/DeepTutor/blob/main/LICENSE"+ target="_blank"+ rel="noopener">License</a+ >+ <a href="https://arxiv.org/abs/2604.26962" target="_blank" rel="noopener">arXiv</a>+ </div>+ </div>+ </div>+ <div class="footer-rule"></div>++ <div class="footer-credo">+ <p class="footer-tagline">+ From the <em>community</em>, to <em>the world</em>.+ </p>+ <div class="footer-pulse" id="footer-pulse" data-hidden="true" aria-live="polite">+ <span class="footer-pulse-dot" aria-hidden="true"></span>+ Latest:+ <a class="footer-pulse-tag" data-pulse="release-link" href="https://github.com/HKUDS/DeepTutor/releases" target="_blank" rel="noopener">+ <span data-pulse="release-tag">—</span>+ </a>+ <span class="sep">·</span>+ <span class="num"><span data-pulse="requests">—</span> Page Views</span>+ </div>+ </div>++ <div class="footer-fine">+ <span class="footer-fine-credit">+ © 2026 <a href="https://github.com/HKUDS" target="_blank" rel="noopener">+ Data Intelligence Lab @ HKU+ </a>+ </span>+ <span class="footer-fine-license">Released under the Apache 2.0 License</span>+ </div>+ </footer>++ <script is:inline>+ (async () => {+ const pulse = document.getElementById("footer-pulse");+ if (!pulse) return;++ // Number formatters.+ const fmtNum = (n) => {+ if (n == null) return "0";+ if (n >= 1e9) return (n / 1e9).toFixed(2).replace(/\.?0+$/, "") + "B";+ if (n >= 1e6) return (n / 1e6).toFixed(2).replace(/\.?0+$/, "") + "M";+ if (n >= 1e3) return (n / 1e3).toFixed(2).replace(/\.?0+$/, "") + "k";+ return String(n);+ };+ const fmtBytes = (b) => {+ if (b == null) return "0 B";+ const KB = 1024, MB = KB * 1024, GB = MB * 1024, TB = GB * 1024;+ if (b >= TB) return (b / TB).toFixed(2) + " TB";+ if (b >= GB) return (b / GB).toFixed(2) + " GB";+ if (b >= MB) return (b / MB).toFixed(2) + " MB";+ if (b >= KB) return (b / KB).toFixed(2) + " KB";+ return b + " B";+ };+ const setText = (key, value) => {+ const el = pulse.querySelector('[data-pulse="' + key + '"]');+ if (el) el.textContent = value;+ };++ // On localhost (astro preview / dev), Pages Functions are not+ // available — substitute a sample so the heartbeat is visible.+ // Production fetches the real APIs.+ const isLocal =+ location.hostname === "localhost" ||+ location.hostname === "127.0.0.1" ||+ location.hostname === "0.0.0.0";++ const sample = isLocal+ ? {+ traffic: {+ window: "total",+ requests: 78400,+ bytes: 1530000000,+ uniques: 18200,+ },+ release: {+ tag: "v1.4.0-beta",+ name: "v1.4.0-beta",+ url: "https://github.com/HKUDS/DeepTutor/releases/tag/v1.4.0-beta",+ published_at: "2026-05-21T00:00:00Z",+ prerelease: true,+ },+ }+ : null;++ const [traffic, release] = await Promise.allSettled([+ isLocal+ ? Promise.resolve(sample.traffic)+ : fetch("/api/traffic", { cache: "no-store" }).then((r) =>+ r.ok ? r.json() : Promise.reject(new Error("status=" + r.status)),+ ),+ isLocal+ ? Promise.resolve(sample.release)+ : fetch("/api/release", { cache: "no-store" }).then((r) =>+ r.ok ? r.json() : Promise.reject(new Error("status=" + r.status)),+ ),+ ]);++ let trafficOK = false;+ let releaseOK = false;++ if (traffic.status === "fulfilled" && traffic.value && !traffic.value.error) {+ setText("requests", fmtNum(traffic.value.requests));+ setText("bytes", fmtBytes(traffic.value.bytes));+ trafficOK = true;+ }+ if (release.status === "fulfilled" && release.value && !release.value.error) {+ setText("release-tag", release.value.tag);+ const link = pulse.querySelector('[data-pulse="release-link"]');+ if (link && release.value.url) link.setAttribute("href", release.value.url);+ releaseOK = true;+ }++ if (releaseOK || trafficOK) {+ pulse.setAttribute("data-hidden", "false");+ }+ })();+ </script>+ </main>++ <style>+ /* ───────── Nav ───────── */+ .nav {+ position: sticky;+ top: 0;+ z-index: 50;+ background: rgba(250, 248, 243, 0.78);+ backdrop-filter: saturate(180%) blur(14px);+ -webkit-backdrop-filter: saturate(180%) blur(14px);+ border-bottom: 1px solid var(--rule);+ }+ .nav-inner {+ max-width: 1280px;+ margin: 0 auto;+ padding: 3px 32px;+ display: flex;+ align-items: center;+ gap: 10px;+ }+ .nav-brand {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 30px;+ height: 30px;+ text-decoration: none;+ color: var(--ink);+ }+ .nav-brand img {+ width: 22px;+ height: 22px;+ display: block;+ object-fit: contain;+ }+ .nav-links {+ display: flex;+ align-items: center;+ gap: 2px;+ margin-left: 6px;+ }+ .nav-icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 30px;+ height: 30px;+ color: var(--ink-soft);+ border-radius: 8px;+ text-decoration: none;+ transition: color 0.15s ease, background 0.15s ease;+ }+ .nav-icon svg {+ width: 17px;+ height: 17px;+ }+ .nav-icon:hover {+ color: var(--ink);+ background: rgba(24, 24, 28, 0.05);+ }+ .nav-text {+ text-decoration: none;+ color: var(--ink-soft);+ font-size: 14px;+ font-weight: 500;+ padding: 0 6px;+ transition: color 0.15s ease;+ }+ .nav-text:hover {+ color: var(--ink);+ }+ .nav-links-divider {+ margin: 0 8px;+ }+ .nav-tools {+ margin-left: auto;+ display: flex;+ align-items: center;+ gap: 12px;+ }+ .nav-tool {+ position: relative;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ color: var(--ink-soft);+ font-size: 13.5px;+ font-weight: 500;+ cursor: pointer;+ transition: color 0.15s ease;+ }+ .nav-tool:hover {+ color: var(--ink);+ }+ .nav-tool-icon {+ flex-shrink: 0;+ color: var(--ink-faint);+ transition: color 0.15s ease;+ }+ .nav-tool:hover .nav-tool-icon {+ color: var(--ink-soft);+ }+ .nav-select {+ appearance: none;+ -webkit-appearance: none;+ border: 0;+ background: transparent;+ color: inherit;+ font: inherit;+ cursor: pointer;+ padding: 4px 16px 4px 0;+ outline: none;+ line-height: 1;+ }+ .nav-tool-caret {+ position: absolute;+ right: 0;+ pointer-events: none;+ opacity: 0.5;+ }+ .nav-tool-divider {+ width: 1px;+ height: 14px;+ background: var(--rule-strong);+ opacity: 0.6;+ }+ @media (max-width: 900px) {+ .nav-links {+ display: none;+ }+ }+ @media (max-width: 620px) {+ .nav-inner {+ padding: 3px 16px;+ gap: 8px;+ }+ }+++ /* ───────── Hero ───────── */+ .hero {+ position: relative;+ max-width: 1280px;+ margin: 0 auto;+ padding: 96px 32px 80px;+ text-align: center;+ overflow: hidden;+ }+ .hero-bg {+ position: absolute;+ top: 60px;+ left: 50%;+ transform: translateX(-50%);+ width: 760px;+ height: 380px;+ background: var(--warm-glow);+ filter: blur(40px);+ z-index: -1;+ pointer-events: none;+ }+ .eyebrow {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ margin-bottom: 36px;+ padding: 6px 14px;+ border: 1px solid var(--rule);+ background: rgba(250, 248, 243, 0.6);+ border-radius: 999px;+ font-family: var(--font-mono);+ font-size: 11.5px;+ font-weight: 500;+ letter-spacing: 0.04em;+ color: var(--ink-soft);+ }+ .eyebrow .dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--accent);+ box-shadow: 0 0 0 3px var(--accent-soft);+ }+ .hero-wordmark {+ display: block;+ max-width: 380px;+ width: min(72%, 380px);+ height: auto;+ margin: 0 auto 32px;+ user-select: none;+ }+ .hero-tagline {+ font-family: var(--font-display);+ font-weight: 500;+ font-size: clamp(36px, 5.4vw, 60px);+ line-height: 1.05;+ letter-spacing: -0.03em;+ color: var(--ink);+ margin: 0 auto 24px;+ max-width: 760px;+ font-variation-settings: "opsz" 72, "SOFT" 30;+ }+ .hero-tagline em {+ font-style: italic;+ font-weight: 400;+ color: var(--accent);+ font-variation-settings: "opsz" 72, "SOFT" 100;+ }+ .hero-sub {+ font-size: 17px;+ line-height: 1.55;+ color: var(--ink-soft);+ margin: 0 auto 40px;+ max-width: 560px;+ font-weight: 400;+ }+ .hero-actions {+ display: flex;+ gap: 10px;+ justify-content: center;+ flex-wrap: wrap;+ margin-bottom: 56px;+ }+ .btn {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ height: 46px;+ padding: 0 22px;+ border-radius: 999px;+ font-size: 14.5px;+ font-weight: 500;+ text-decoration: none;+ transition: transform 0.15s ease, background 0.15s ease,+ border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;+ border: 1px solid transparent;+ }+ .btn-primary {+ background: var(--ink);+ color: var(--paper);+ }+ .btn-primary:hover {+ background: #000;+ transform: translateY(-1px);+ box-shadow: 0 10px 28px -10px rgba(24, 24, 28, 0.5);+ }+ .btn-ghost {+ background: transparent;+ border-color: var(--rule-strong);+ color: var(--ink);+ }+ .btn-ghost:hover {+ border-color: var(--ink);+ transform: translateY(-1px);+ }+ .btn-gh {+ gap: 9px;+ padding: 0 18px;+ font-family: var(--font-mono);+ font-size: 13.5px;+ }+ .btn-gh svg {+ flex-shrink: 0;+ }+ .btn-gh-sep {+ width: 1px;+ height: 18px;+ background: var(--rule-strong);+ opacity: 0.8;+ }+ .btn-gh-count {+ font-family: var(--font-mono);+ font-weight: 600;+ font-size: 13.5px;+ letter-spacing: 0.01em;+ color: var(--ink);+ min-width: 1.5ch;+ text-align: right;+ }+ .btn-gh-label {+ font-family: var(--font-mono);+ color: var(--ink-soft);+ font-weight: 500;+ }+ .btn-gh:hover .btn-gh-count {+ color: var(--ink);+ }+ .hero-meta {+ font-family: var(--font-mono);+ font-size: 11.5px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ display: inline-flex;+ flex-wrap: wrap;+ justify-content: center;+ gap: 8px;+ }+ .hero-meta strong {+ color: var(--ink-soft);+ font-weight: 600;+ }+ .hero-meta .sep {+ opacity: 0.4;+ }++ /* ───────── Product showcase ───────── */+ .showcase {+ max-width: 1180px;+ margin: 0 auto 16px;+ padding: 0 32px;+ }+ .showcase-frame {+ border-radius: 20px;+ overflow: hidden;+ border: 1px solid var(--rule-strong);+ background: var(--paper-soft);+ box-shadow:+ 0 1px 0 rgba(255, 255, 255, 0.6) inset,+ 0 40px 80px -40px rgba(24, 24, 28, 0.22),+ 0 16px 32px -20px rgba(24, 24, 28, 0.1);+ }+ .showcase-chrome {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 11px 16px;+ border-bottom: 1px solid var(--rule);+ background: rgba(250, 248, 243, 0.7);+ }+ .showcase-chrome .dot {+ width: 11px;+ height: 11px;+ border-radius: 50%;+ }+ .showcase-chrome .dot.red {+ background: #f15a55;+ }+ .showcase-chrome .dot.amber {+ background: #f9bb3f;+ }+ .showcase-chrome .dot.green {+ background: #4dc44d;+ }+ .showcase-title {+ margin-left: 12px;+ font-family: var(--font-mono);+ font-size: 11.5px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ }+ .showcase-frame img {+ width: 100%;+ display: block;+ }++ /* ───────── Section ───────── */+ .section {+ position: relative;+ max-width: 1180px;+ margin: 0 auto;+ padding: 128px 32px;+ }+ .section-quiet {+ background: var(--paper-soft);+ max-width: none;+ margin: 96px 0 0;+ padding-left: 32px;+ padding-right: 32px;+ }+ .section-quiet > .chapter-mark,+ .section-quiet > .section-head,+ .section-quiet > .install {+ max-width: 1180px;+ margin-left: auto;+ margin-right: auto;+ }+ .chapter-mark {+ font-family: var(--font-display);+ font-style: italic;+ font-size: 14px;+ font-weight: 500;+ color: var(--ink-faint);+ text-align: center;+ letter-spacing: 0.04em;+ margin-bottom: 24px;+ font-variation-settings: "opsz" 24;+ }+ .section-head {+ text-align: center;+ margin-bottom: 72px;+ max-width: 720px;+ margin-left: auto;+ margin-right: auto;+ }+ .section-eyebrow {+ display: inline-block;+ margin-bottom: 18px;+ font-family: var(--font-mono);+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.18em;+ text-transform: uppercase;+ color: var(--accent);+ }+ .section-head h2 {+ font-family: var(--font-display);+ margin: 0 0 16px;+ font-size: clamp(34px, 4.4vw, 52px);+ font-weight: 500;+ letter-spacing: -0.032em;+ line-height: 1.05;+ color: var(--ink);+ font-variation-settings: "opsz" 56, "SOFT" 30;+ }+ .section-head h2 em {+ font-style: italic;+ font-weight: 400;+ color: var(--ink-soft);+ font-variation-settings: "opsz" 56, "SOFT" 100;+ }+ .section-head p {+ margin: 0 auto;+ max-width: 580px;+ font-size: 17px;+ color: var(--ink-soft);+ line-height: 1.55;+ }++ /* ───────── Feature grid ───────── */+ .feature-grid {+ display: grid;+ grid-template-columns: repeat(3, 1fr);+ border: 1px solid var(--rule);+ border-radius: 16px;+ overflow: hidden;+ background: var(--paper-soft);+ gap: 1px;+ }+ .feature {+ position: relative;+ display: flex;+ flex-direction: column;+ padding: 44px 36px 48px;+ background: var(--paper);+ text-decoration: none;+ color: var(--ink);+ transition: background 0.25s ease, transform 0.2s ease;+ }+ .feature:hover {+ background: rgba(77, 143, 191, 0.04);+ }+ .feature-mark {+ font-family: var(--font-display);+ font-style: italic;+ font-size: 26px;+ font-weight: 400;+ line-height: 1;+ color: var(--accent);+ margin-bottom: 28px;+ font-variation-settings: "opsz" 36;+ }+ .feature h3 {+ font-family: var(--font-display);+ margin: 0 0 12px;+ font-size: 22px;+ font-weight: 500;+ letter-spacing: -0.02em;+ color: var(--ink);+ font-variation-settings: "opsz" 28;+ }+ .feature p {+ margin: 0;+ font-size: 14.5px;+ line-height: 1.65;+ color: var(--ink-soft);+ flex: 1;+ }+ .feature-arrow {+ opacity: 0;+ transform: translate(-4px, 4px);+ transition: opacity 0.2s ease, transform 0.25s ease;+ margin-top: 24px;+ color: var(--accent);+ }+ .feature:hover .feature-arrow {+ opacity: 1;+ transform: translate(0, 0);+ }+ @media (max-width: 980px) {+ .feature-grid {+ grid-template-columns: repeat(2, 1fr);+ }+ }+ @media (max-width: 640px) {+ .feature-grid {+ grid-template-columns: 1fr;+ }+ }++ /* ───────── Install (editorial inline tabs) ───────── */+ .install {+ max-width: 820px;+ margin: 0 auto;+ }+ .install-tabs {+ display: flex;+ align-items: center;+ gap: 2px;+ padding: 4px;+ margin: 0 auto 28px;+ width: fit-content;+ border-radius: 999px;+ background: rgba(24, 24, 28, 0.045);+ border: 1px solid rgba(24, 24, 28, 0.04);+ }+ .install-tab {+ appearance: none;+ background: transparent;+ border: 0;+ cursor: pointer;+ padding: 7px 16px;+ border-radius: 999px;+ font-family: inherit;+ font-size: 13px;+ font-weight: 500;+ letter-spacing: -0.005em;+ color: var(--ink-soft);+ transition:+ color 0.18s ease,+ background 0.22s ease,+ box-shadow 0.22s ease;+ }+ .install-tab:hover {+ color: var(--ink);+ }+ .install-tab.is-active {+ background: var(--paper);+ color: var(--ink);+ box-shadow:+ 0 1px 1px rgba(24, 24, 28, 0.04),+ 0 2px 8px -2px rgba(24, 24, 28, 0.08);+ }+ .install-tab-label {+ display: inline-block;+ }+ .install-body {+ background: var(--paper);+ border: 1px solid var(--rule);+ border-radius: 14px;+ padding: 28px 30px 24px;+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;+ }+ .install-panel {+ display: none;+ animation: install-fade 0.25s ease;+ }+ .install-panel.is-active {+ display: block;+ }+ @keyframes install-fade {+ from { opacity: 0; transform: translateY(2px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .install-blurb {+ margin: 0 0 18px;+ font-size: 14px;+ color: var(--ink-soft);+ line-height: 1.55;+ }+ .install-code {+ margin: 0;+ padding: 20px 22px;+ background: rgba(244, 240, 232, 0.55);+ border: 1px solid var(--rule);+ border-radius: 10px;+ font-family: var(--font-mono);+ font-size: 13px;+ line-height: 1.78;+ color: var(--ink);+ overflow-x: auto;+ white-space: pre;+ }+ .install-code code {+ font-family: inherit;+ font-size: inherit;+ color: inherit;+ background: transparent;+ padding: 0;+ }+ .install-foot {+ margin: 16px 2px 0;+ display: flex;+ flex-wrap: wrap;+ justify-content: space-between;+ align-items: center;+ gap: 12px;+ font-size: 13.5px;+ color: var(--ink-soft);+ }+ .install-foot-note {+ font-family: var(--font-mono);+ font-size: 12px;+ color: var(--ink-faint);+ letter-spacing: 0.01em;+ }+ .install-foot-link {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ color: var(--ink);+ text-decoration: none;+ font-weight: 500;+ font-size: 13.5px;+ border-bottom: 1px solid var(--rule-strong);+ padding-bottom: 1px;+ transition: border-color 0.15s ease, color 0.15s ease;+ }+ .install-foot-link:hover {+ border-color: var(--ink);+ }+ .install-foot-link svg {+ transition: transform 0.2s ease;+ }+ .install-foot-link:hover svg {+ transform: translate(1px, -1px);+ }+ @media (max-width: 760px) {+ .install-tab {+ flex: 1;+ min-width: 0;+ padding: 9px 8px 11px;+ }+ }++ /* ───────── Ecosystem ───────── */+ .section-eco {+ padding-top: 96px;+ padding-bottom: 64px;+ }+ .section-eco .section-head {+ margin-bottom: 48px;+ }+ .eco-list {+ max-width: 820px;+ margin: 0 auto;+ border-top: 1px solid var(--rule);+ }+ .eco-row {+ display: grid;+ grid-template-columns: 180px 1fr auto;+ align-items: center;+ gap: 24px;+ padding: 18px 8px;+ border-bottom: 1px solid var(--rule);+ text-decoration: none;+ color: var(--ink);+ transition: padding 0.2s ease, background 0.18s ease;+ }+ .eco-row:hover {+ padding-left: 16px;+ background: rgba(77, 143, 191, 0.025);+ }+ .eco-name {+ font-family: var(--font-display);+ font-style: italic;+ font-size: 19px;+ font-weight: 500;+ letter-spacing: -0.014em;+ color: var(--ink);+ font-variation-settings: "opsz" 24;+ }+ .eco-desc {+ font-size: 14px;+ color: var(--ink-soft);+ line-height: 1.5;+ }+ .eco-arrow {+ color: var(--ink-faint);+ transition: color 0.18s ease, transform 0.22s ease;+ display: inline-flex;+ }+ .eco-row:hover .eco-arrow {+ color: var(--accent);+ transform: translate(2px, -2px);+ }+ @media (max-width: 720px) {+ .eco-row {+ grid-template-columns: 1fr auto;+ gap: 6px 12px;+ padding: 16px 8px;+ }+ .eco-desc {+ grid-column: 1 / -1;+ }+ }++ /* ───────── Footer credo — tagline + heartbeat, centered ───────── */+ .footer-credo {+ text-align: center;+ margin: 0 0 32px;+ }+ .footer-tagline {+ font-family: var(--font-display);+ font-size: 22px;+ font-weight: 500;+ letter-spacing: -0.02em;+ line-height: 1.25;+ color: var(--ink);+ margin: 0 0 14px;+ font-variation-settings: "opsz" 32;+ }+ .footer-tagline em {+ font-style: italic;+ font-weight: 400;+ color: var(--ink-soft);+ }++ /* ───────── Interactive app mock ───────── */+ .dt-app {+ display: grid;+ grid-template-columns: 220px 1fr;+ background: var(--paper);+ height: 620px;+ max-height: 78vh;+ font-size: 13.5px;+ color: var(--ink);+ }++ /* sidebar */+ .dt-side {+ display: flex;+ flex-direction: column;+ background: #f1ece1;+ border-right: 1px solid var(--rule);+ min-width: 0;+ }+ .dt-side-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0 14px;+ height: 56px;+ }+ .dt-side-brand {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ text-decoration: none;+ }+ .dt-side-logo {+ width: 22px;+ height: 22px;+ }+ .dt-side-banner {+ height: 22px;+ width: auto;+ }+ .dt-side-collapse {+ appearance: none;+ background: transparent;+ border: 0;+ padding: 4px;+ border-radius: 6px;+ color: var(--ink-faint);+ cursor: pointer;+ transition: background 0.15s ease, color 0.15s ease;+ }+ .dt-side-collapse svg {+ width: 15px;+ height: 15px;+ }+ .dt-side-collapse:hover {+ background: rgba(24, 24, 28, 0.06);+ color: var(--ink);+ }+ .dt-side-nav {+ padding: 4px 8px;+ display: flex;+ flex-direction: column;+ gap: 1px;+ min-height: 0;+ overflow-y: auto;+ }+ .dt-side-nav::-webkit-scrollbar {+ width: 6px;+ }+ .dt-side-nav::-webkit-scrollbar-thumb {+ background: rgba(24, 24, 28, 0.1);+ border-radius: 3px;+ }+ .dt-side-item {+ appearance: none;+ background: transparent;+ border: 0;+ font: inherit;+ text-align: left;+ text-decoration: none;+ display: flex;+ align-items: center;+ gap: 10px;+ padding: 7px 12px;+ border-radius: 8px;+ color: var(--ink-soft);+ cursor: pointer;+ transition: background 0.15s ease, color 0.15s ease;+ font-size: 13.5px;+ }+ .dt-side-item:hover {+ background: rgba(255, 252, 247, 0.65);+ color: var(--ink);+ }+ .dt-side-item.is-active {+ background: rgba(255, 252, 247, 0.85);+ color: var(--ink);+ font-weight: 500;+ }+ .dt-side-icon {+ width: 16px;+ height: 16px;+ flex-shrink: 0;+ color: currentColor;+ }+ .dt-side-newchat {+ color: var(--ink-soft);+ }+ .dt-side-sublist {+ margin: 2px 0 6px 18px;+ padding-left: 8px;+ border-left: 1px solid rgba(24, 24, 28, 0.08);+ display: flex;+ flex-direction: column;+ gap: 1px;+ }+ .dt-side-sub-label {+ font-family: var(--font-mono);+ font-size: 10.5px;+ font-weight: 600;+ letter-spacing: 0.1em;+ text-transform: uppercase;+ color: var(--ink-faint);+ padding: 6px 6px 2px;+ }+ .dt-side-sub-item {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 4px 6px;+ border-radius: 6px;+ color: var(--ink-soft);+ text-decoration: none;+ font-size: 12.5px;+ transition: background 0.15s ease, color 0.15s ease;+ }+ .dt-side-sub-item:hover {+ background: rgba(255, 252, 247, 0.7);+ color: var(--ink);+ }+ .dt-side-dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: #5ec48a;+ box-shadow: 0 0 0 2px rgba(94, 196, 138, 0.18);+ flex-shrink: 0;+ }+ .dt-side-sub-text {+ flex: 1;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+ .dt-side-sub-flat {+ justify-content: space-between;+ padding-left: 10px;+ }+ .dt-side-sub-meta {+ font-family: var(--font-mono);+ font-size: 10.5px;+ color: var(--ink-faint);+ margin-left: 8px;+ }+ .dt-side-foot {+ margin-top: auto;+ border-top: 1px solid rgba(24, 24, 28, 0.06);+ padding: 8px;+ display: flex;+ flex-direction: column;+ gap: 4px;+ }+ .dt-side-version {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 4px 12px 2px;+ }+ .dt-side-version-tag {+ font-family: var(--font-mono);+ font-size: 11px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ }+ .dt-side-gh {+ display: inline-flex;+ width: 22px;+ height: 22px;+ align-items: center;+ justify-content: center;+ border-radius: 6px;+ color: rgba(24, 24, 28, 0.4);+ transition: color 0.15s ease, background 0.15s ease;+ }+ .dt-side-gh:hover {+ color: var(--ink);+ background: rgba(255, 252, 247, 0.7);+ }+ .dt-side-gh svg {+ width: 13px;+ height: 13px;+ }++ /* main column */+ .dt-main {+ display: flex;+ flex-direction: column;+ min-width: 0;+ background: var(--paper);+ }+ .dt-topbar {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 13px 24px;+ border-bottom: 1px solid var(--rule);+ gap: 16px;+ }+ .dt-thread-title {+ font-size: 14px;+ font-weight: 600;+ color: var(--ink);+ }+ .dt-topbar-actions {+ display: flex;+ gap: 6px;+ flex-wrap: wrap;+ }+ .dt-act {+ appearance: none;+ background: transparent;+ border: 1px solid rgba(24, 24, 28, 0.1);+ color: var(--ink-soft);+ font-family: inherit;+ font-size: 12px;+ font-weight: 500;+ padding: 6px 11px;+ border-radius: 8px;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ cursor: pointer;+ transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;+ }+ .dt-act svg {+ width: 13px;+ height: 13px;+ }+ .dt-act:hover {+ border-color: rgba(24, 24, 28, 0.22);+ color: var(--ink);+ }+ .dt-act.is-muted {+ color: var(--ink-faint);+ cursor: not-allowed;+ border-color: rgba(24, 24, 28, 0.08);+ }+ .dt-act.is-muted:hover {+ border-color: rgba(24, 24, 28, 0.08);+ color: var(--ink-faint);+ }+ .dt-canvas {+ flex: 1;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ padding: 24px 24px 48px;+ gap: 30px;+ }+ .dt-greeting {+ display: inline-flex;+ align-items: center;+ gap: 14px;+ }+ .dt-greeting-mark {+ width: 36px;+ height: 36px;+ user-select: none;+ }+ .dt-greeting h1 {+ margin: 0;+ font-family: var(--font-display);+ font-size: clamp(26px, 3.4vw, 40px);+ font-weight: 500;+ letter-spacing: -0.018em;+ line-height: 1.1;+ color: var(--ink);+ font-variation-settings: "opsz" 44;+ }++ /* composer */+ .dt-composer {+ width: 100%;+ max-width: 640px;+ background: var(--paper);+ border: 1px solid rgba(24, 24, 28, 0.1);+ border-radius: 26px;+ padding: 14px 18px 10px;+ box-shadow:+ 0 1px 2px rgba(24, 24, 28, 0.025),+ 0 10px 28px -10px rgba(24, 24, 28, 0.08);+ transition: border-color 0.18s ease, box-shadow 0.18s ease;+ }+ .dt-composer:focus-within {+ border-color: var(--accent);+ box-shadow: 0 0 0 4px var(--accent-soft);+ }+ .dt-composer-input {+ width: 100%;+ border: 0;+ outline: 0;+ resize: none;+ background: transparent;+ font-family: inherit;+ font-size: 15px;+ line-height: 1.55;+ color: var(--ink);+ padding: 4px 0 6px;+ }+ .dt-composer-input::placeholder {+ color: var(--ink-faint);+ }+ .dt-composer-row {+ display: flex;+ align-items: center;+ gap: 6px;+ margin-top: 4px;+ flex-wrap: nowrap;+ }+ .dt-composer-spacer {+ flex: 1;+ }+ /* "Chat ▼" capability pill — bordered, full pill with label and caret */+ .dt-pill {+ appearance: none;+ background: var(--paper);+ border: 1px solid rgba(24, 24, 28, 0.12);+ border-radius: 999px;+ height: 28px;+ padding: 0 10px 0 11px;+ display: inline-flex;+ align-items: center;+ gap: 10px;+ font-size: 13px;+ font-weight: 500;+ color: var(--ink);+ cursor: pointer;+ transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;+ box-shadow: 0 1px 2px rgba(24, 24, 28, 0.03);+ }+ .dt-pill:hover {+ border-color: rgba(24, 24, 28, 0.22);+ }+ .dt-pill-left {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ min-width: 0;+ }+ .dt-pill-icon,+ .dt-pill svg {+ width: 13px;+ height: 13px;+ color: var(--ink-soft);+ flex-shrink: 0;+ }+ .dt-pill-caret {+ opacity: 0.55;+ }+ .dt-pill-mode {+ min-width: 110px;+ justify-content: space-between;+ }+ .dt-pill-mode.is-pulsing {+ animation: dt-pulse 0.45s ease;+ }+ @keyframes dt-pulse {+ 0% { transform: scale(1); }+ 50% { transform: scale(1.03); }+ 100% { transform: scale(1); }+ }+ .dt-pill-model {+ gap: 8px;+ max-width: 160px;+ }+ .dt-pill-model .dt-pill-label {+ max-width: 110px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .dt-model-dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: linear-gradient(135deg, #d8a974, #c8865e);+ box-shadow: 0 0 0 2px rgba(216, 169, 116, 0.18);+ flex-shrink: 0;+ }+ /* "Attach", "Knowledge ▼", "Space ▼" — ghost tools */+ .dt-tool {+ appearance: none;+ background: transparent;+ border: 0;+ color: var(--ink-soft);+ font: inherit;+ font-size: 12.5px;+ font-weight: 500;+ padding: 6px 8px;+ border-radius: 8px;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ cursor: pointer;+ transition: background 0.15s ease, color 0.15s ease;+ }+ .dt-tool:hover {+ background: rgba(24, 24, 28, 0.04);+ color: var(--ink);+ }+ .dt-tool svg {+ width: 13px;+ height: 13px;+ }+ .dt-tool-caret {+ opacity: 0.55;+ }+ /* send button — peach until input, then ink */+ .dt-send {+ width: 28px;+ height: 28px;+ border-radius: 50%;+ border: 0;+ background: rgba(216, 169, 116, 0.35);+ color: var(--paper);+ display: inline-flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;+ box-shadow: 0 4px 12px rgba(216, 169, 116, 0.18);+ }+ .dt-send svg {+ width: 14px;+ height: 14px;+ }+ .dt-send:hover {+ background: rgba(216, 169, 116, 0.55);+ }+ .dt-send.is-active {+ background: var(--ink);+ box-shadow: 0 4px 14px rgba(24, 24, 28, 0.25);+ }+ .dt-send.is-active:hover {+ background: #000;+ transform: translateY(-1px);+ }++ @media (max-width: 880px) {+ .dt-app {+ grid-template-columns: 1fr;+ height: auto;+ max-height: none;+ }+ .dt-side {+ display: none;+ }+ }+ @media (max-width: 640px) {+ .dt-topbar-actions .dt-act:nth-child(-n + 2) {+ display: none;+ }+ .dt-act span:not(.dt-act-glyph) {+ display: none;+ }+ .dt-tool span {+ display: none;+ }+ .dt-pill-model {+ max-width: 120px;+ }+ .dt-pill-model .dt-pill-label {+ max-width: 70px;+ }+ }++ /* ───────── Dark theme polish ───────── */+ [data-theme="dark"] .nav {+ background: rgba(13, 13, 16, 0.78);+ }+ [data-theme="dark"] .showcase-chrome {+ background: rgba(22, 22, 26, 0.7);+ }+ [data-theme="dark"] .hero-wordmark {+ filter: invert(1) hue-rotate(180deg) brightness(1.12);+ }+ [data-theme="dark"] .showcase-frame {+ box-shadow:+ 0 1px 0 rgba(255, 255, 255, 0.04) inset,+ 0 40px 80px -44px rgba(0, 0, 0, 0.7);+ }+ [data-theme="dark"] .btn-primary:hover,+ [data-theme="dark"] .dt-send.is-active:hover {+ background: #f1ede4;+ color: #0d0d10;+ }+ [data-theme="dark"] .feature:hover,+ [data-theme="dark"] .eco-row:hover,+ [data-theme="dark"] .dt-tool:hover {+ background: rgba(123, 190, 234, 0.08);+ }+ [data-theme="dark"] .install-code {+ background: rgba(22, 22, 26, 0.74);+ }+ [data-theme="dark"] .install-tabs {+ background: rgba(241, 237, 228, 0.045);+ border-color: rgba(241, 237, 228, 0.06);+ }+ [data-theme="dark"] .install-tab.is-active {+ background: rgba(241, 237, 228, 0.1);+ box-shadow:+ 0 1px 1px rgba(0, 0, 0, 0.2),+ 0 2px 8px -2px rgba(0, 0, 0, 0.3);+ }+ [data-theme="dark"] .dt-side {+ background: #141418;+ }+ [data-theme="dark"] .dt-side-item:hover,+ [data-theme="dark"] .dt-side-item.is-active,+ [data-theme="dark"] .dt-side-sub-item:hover,+ [data-theme="dark"] .dt-side-gh:hover {+ background: rgba(241, 237, 228, 0.06);+ }+ [data-theme="dark"] .dt-act,+ [data-theme="dark"] .dt-composer,+ [data-theme="dark"] .dt-pill {+ border-color: var(--rule);+ }++ /* ───────── Footer ───────── */+ .footer {+ max-width: 1280px;+ margin: 96px auto 0;+ padding: 64px 32px 48px;+ }+ .footer-inner {+ display: grid;+ grid-template-columns: 260px 1fr;+ gap: 48px;+ margin-bottom: 64px;+ }+ .footer-brand {+ display: inline-flex;+ align-items: center;+ gap: 10px;+ text-decoration: none;+ color: var(--ink);+ align-self: start;+ }+ .footer-brand img {+ width: 32px;+ height: 32px;+ }+ .footer-brand span {+ font-family: var(--font-display);+ font-style: italic;+ font-weight: 500;+ font-size: 22px;+ }+ .footer-cols {+ display: grid;+ grid-template-columns: repeat(3, 1fr);+ gap: 40px;+ }+ .footer-col h4 {+ margin: 0 0 16px;+ font-family: var(--font-mono);+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.18em;+ text-transform: uppercase;+ color: var(--ink-faint);+ }+ .footer-col a {+ display: block;+ margin-bottom: 10px;+ text-decoration: none;+ color: var(--ink-soft);+ font-size: 14px;+ transition: color 0.15s ease;+ }+ .footer-col a:hover {+ color: var(--ink);+ }+ .footer-rule {+ height: 1px;+ background: var(--rule);+ margin-bottom: 28px;+ }++ /* ───────── Heartbeat (single editorial line, mono) ───────── */+ .footer-pulse {+ margin: 0 0 24px;+ display: inline-flex;+ align-items: center;+ flex-wrap: wrap;+ gap: 7px;+ font-family: var(--font-mono);+ font-size: 11.5px;+ letter-spacing: 0.02em;+ color: var(--ink-faint);+ opacity: 1;+ transition: opacity 0.35s ease;+ }+ .footer-pulse[data-hidden="true"] {+ opacity: 0;+ pointer-events: none;+ position: absolute;+ }+ .footer-pulse-dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--accent);+ box-shadow: 0 0 0 3px var(--accent-soft);+ animation: dtPulse 2.4s ease-in-out infinite;+ }+ @keyframes dtPulse {+ 0%, 100% { opacity: 1; transform: scale(1); }+ 50% { opacity: 0.45; transform: scale(0.85); }+ }+ .footer-pulse .sep {+ color: var(--ink-faint);+ opacity: 0.5;+ }+ .footer-pulse .num {+ color: var(--ink-soft);+ font-weight: 600;+ font-variant-numeric: tabular-nums;+ }+ .footer-pulse .num > [data-pulse] {+ color: var(--ink);+ }+ .footer-pulse-tag {+ color: var(--ink) !important;+ font-weight: 600;+ text-decoration: none !important;+ border-bottom: 1px solid var(--rule);+ padding-bottom: 1px;+ transition: border-color 0.15s ease;+ }+ .footer-pulse-tag:hover {+ border-color: var(--ink);+ }++ .footer-fine {+ display: flex;+ justify-content: space-between;+ font-family: var(--font-mono);+ font-size: 11.5px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ }+ .footer-fine a {+ color: var(--ink-soft);+ text-decoration: none;+ }+ .footer-fine a:hover {+ color: var(--ink);+ }+ @media (max-width: 720px) {+ .footer-inner {+ grid-template-columns: 1fr;+ gap: 32px;+ }+ .footer-cols {+ grid-template-columns: repeat(2, 1fr);+ gap: 24px;+ }+ .footer-fine {+ flex-direction: column;+ gap: 8px;+ }+ }+ </style>++ <script>+ // ───────── GitHub star count ─────────+ (() => {+ const targets = document.querySelectorAll<HTMLElement>("[data-gh-stars]");+ if (!targets.length) return;+ const cacheKey = "deeptutor-gh-stars";+ const ttl = 60 * 60 * 1000; // 1h+ const format = (n: number) =>+ n >= 1000 ? (n / 1000).toFixed(n >= 10000 ? 1 : 2).replace(/\.?0+$/, "") + "k" : String(n);+ const paint = (n: number) => {+ const text = format(n);+ targets.forEach((el) => (el.textContent = text));+ };+ try {+ const raw = localStorage.getItem(cacheKey);+ if (raw) {+ const cached = JSON.parse(raw);+ if (cached && typeof cached.n === "number" && Date.now() - cached.t < ttl) {+ paint(cached.n);+ }+ }+ } catch {}+ fetch("https://api.github.com/repos/HKUDS/DeepTutor")+ .then((r) => (r.ok ? r.json() : null))+ .then((data) => {+ if (!data || typeof data.stargazers_count !== "number") return;+ paint(data.stargazers_count);+ try {+ localStorage.setItem(+ cacheKey,+ JSON.stringify({ n: data.stargazers_count, t: Date.now() }),+ );+ } catch {}+ })+ .catch(() => {});+ })();++ // ───────── Install tabs ─────────+ const installRoot = document.getElementById("install");+ if (installRoot) {+ const tabs = installRoot.querySelectorAll<HTMLButtonElement>(".install-tab");+ const panels = installRoot.querySelectorAll<HTMLElement>(".install-panel");+ tabs.forEach((tab) => {+ tab.addEventListener("click", () => {+ const target = tab.dataset.target;+ tabs.forEach((t) => {+ const on = t === tab;+ t.classList.toggle("is-active", on);+ t.setAttribute("aria-selected", on ? "true" : "false");+ });+ panels.forEach((p) => {+ p.classList.toggle("is-active", p.dataset.panel === target);+ });+ });+ });+ }++ // ───────── Landing preferences ─────────+ const themeKey = "starlight-theme";+ const themeQuery = "(prefers-color-scheme: light)";+ const readThemePreference = () => {+ try {+ const stored = localStorage.getItem(themeKey);+ return stored === "light" || stored === "dark" ? stored : "auto";+ } catch {+ return "auto";+ }+ };+ const resolvedTheme = (preference: string) => {+ if (preference === "light" || preference === "dark") return preference;+ return window.matchMedia(themeQuery).matches ? "light" : "dark";+ };+ const applyThemePreference = (preference: string) => {+ document.documentElement.dataset.theme = resolvedTheme(preference);+ document.querySelectorAll<HTMLSelectElement>("[data-theme-select]").forEach((select) => {+ select.value = preference;+ });+ };+ const persistThemePreference = (preference: string) => {+ try {+ if (preference === "light" || preference === "dark") {+ localStorage.setItem(themeKey, preference);+ } else {+ localStorage.setItem(themeKey, "");+ }+ } catch {}+ };++ applyThemePreference(readThemePreference());++ document.querySelectorAll<HTMLSelectElement>("[data-theme-select]").forEach((select) => {+ select.addEventListener("change", () => {+ persistThemePreference(select.value);+ applyThemePreference(select.value);+ });+ });++ window.matchMedia(themeQuery).addEventListener("change", () => {+ if (readThemePreference() === "auto") applyThemePreference("auto");+ });++ document.querySelectorAll<HTMLSelectElement>("[data-locale-select]").forEach((select) => {+ select.addEventListener("change", () => {+ const nextPath = select.value;+ if (nextPath && nextPath !== window.location.pathname) {+ window.location.assign(`${nextPath}${window.location.search}${window.location.hash}`);+ }+ });+ });+ </script>+ </body>+</html>diff --git a/site/src/pages/zh-cn/index.astro b/site/src/pages/zh-cn/index.astronew file mode 100644index 000000000..58c5523e5--- /dev/null+++ b/site/src/pages/zh-cn/index.astro@@ -0,0 +1,1839 @@+---+import "../../styles/global.css";++const features = [+ {+ chapter: "I",+ title: "聊天工作台",+ body: "五种模式 —— Chat / Solve / Quiz / Research / Visualize —— 共享同一个 session、知识库和引用历史,对话中段切换不丢上下文。",+ href: "/zh-cn/docs/explore/chat-workspace/",+ },+ {+ chapter: "II",+ title: "Co-Writer",+ body: "双栏 Markdown 工作台,AI 是一等公民协作者。选中、改写、扩展,全部基于你的知识库。",+ href: "/zh-cn/docs/explore/co-writer/",+ },+ {+ chapter: "III",+ title: "Book Engine",+ body: "多 agent 流水线把你的材料编成可交互的「活书」—— 13 种 block,含 GeoGebra viewer 和动画。",+ href: "/zh-cn/docs/explore/book/",+ },+ {+ chapter: "IV",+ title: "知识库",+ body: "端到端 LlamaIndex 的带版本管理 RAG 文档库。每一次(重新)索引都可追溯、可对比、可回滚。",+ href: "/zh-cn/docs/explore/knowledge/",+ },+ {+ chapter: "V",+ title: "Space",+ body: "你的个人图书馆 —— chat history、notebook、question bank、自定义 skill。每个活跃界面的「阅读 / 回顾」对偶面。",+ href: "/zh-cn/docs/explore/space/",+ },+ {+ chapter: "VI",+ title: "记忆系统",+ body: "Append-only 的 L1 trace、带引用的 L2 精炼事实、跨界面综合的 L3。Memory Graph 让你随时审计 DeepTutor 为什么知道某件事。",+ href: "/zh-cn/docs/explore/memory/",+ },+];++const installs = [+ {+ id: "pypi",+ label: "PyPI",+ tag: "推荐",+ cmd: "pip install -U deeptutor",+ blurb: "最顺滑的路径:完整本地 Web 应用 + CLI,无需 clone。",+ code: `# 1. 准备一个工作区目录+mkdir -p my-deeptutor && cd my-deeptutor++# 2. 安装、配置、启动+pip install -U deeptutor+deeptutor init+deeptutor start`,+ foot: "然后打开 127.0.0.1:3782",+ href: "/zh-cn/docs/get-started/pypi/",+ },+ {+ id: "docker",+ label: "Docker",+ tag: "单容器",+ cmd: "docker run … ghcr.io/hkuds/deeptutor",+ blurb: "单容器跑完整 Web 应用,镜像来自 GitHub Container Registry。",+ code: `docker run --rm --name deeptutor \\+ -p 127.0.0.1:3782:3782 \\+ -p 127.0.0.1:8001:8001 \\+ -v deeptutor-data:/app/data \\+ ghcr.io/hkuds/deeptutor:latest`,+ foot: "记得同时映射 3782(UI)和 8001(API)。数据持久化在命名 volume 里。",+ href: "/zh-cn/docs/get-started/docker/",+ },+ {+ id: "source",+ label: "源码",+ tag: "贡献者",+ cmd: "git clone … && pip install -e .",+ blurb: "前端热重载、后端可改、完全对齐 CI。",+ code: `git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++python3 -m venv .venv && source .venv/bin/activate+pip install -e .+( cd web && npm ci --legacy-peer-deps )++deeptutor init && deeptutor start`,+ foot: "Python 3.11+ · Node.js 22 LTS。Next.js 以 dev 模式运行 ./web。",+ href: "/zh-cn/docs/get-started/from-source/",+ },+ {+ id: "cli",+ label: "CLI",+ tag: "无头",+ cmd: "pip install -e ./packaging/deeptutor-cli",+ blurb: "面向无界面服务器、agent harness、Claude Code / Codex 等场景的轻量安装。",+ code: `git clone https://github.com/HKUDS/DeepTutor.git+cd DeepTutor++python3 -m venv .venv-cli && source .venv-cli/bin/activate+pip install -e ./packaging/deeptutor-cli++deeptutor init --cli+deeptutor chat`,+ foot: "没有后端 / 前端端口。Embedding 默认关闭 —— 用 RAG 时再开启。",+ href: "/zh-cn/docs/get-started/cli-only/",+ },+];++---++<!doctype html>+<html lang="zh-CN" data-theme="light">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>DeepTutor —— Agent-native 的开源个性化学习伴侣</title>+ <meta+ name="description"+ content="开源 AI 学习伴侣。五种模式,一个工作区。专属 TutorBot。知识驱动的学习。"+ />+ <link rel="icon" type="image/png" href="/logo.png" />+ <script is:inline>+ (() => {+ const key = "starlight-theme";+ const resolve = (preference) =>+ preference === "light" || preference === "dark"+ ? preference+ : window.matchMedia("(prefers-color-scheme: light)").matches+ ? "light"+ : "dark";+ let stored = "auto";+ try {+ const value = localStorage.getItem(key);+ stored = value === "light" || value === "dark" ? value : "auto";+ } catch {}+ document.documentElement.dataset.theme = resolve(stored);+ })();+ </script>+ </head>+ <body>+ <header class="nav">+ <div class="nav-inner">+ <a class="nav-brand" href="/zh-cn/" aria-label="DeepTutor">+ <img src="/logo.png" alt="DeepTutor" />+ </a>+ <nav class="nav-links">+ <a+ class="nav-icon"+ href="https://github.com/HKUDS/DeepTutor"+ target="_blank"+ rel="noopener"+ aria-label="GitHub"+ title="GitHub"+ >+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>+ </svg>+ </a>+ <a+ class="nav-icon"+ href="https://discord.gg/eRsjPgMU4t"+ target="_blank"+ rel="noopener"+ aria-label="Discord"+ title="Discord"+ >+ <svg width="17" height="17" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.09.09 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.09 16.09 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09-.01-.02-.04-.03-.07-.03-1.5.26-2.93.71-4.27 1.33-.01 0-.02.01-.03.02-2.72 4.07-3.47 8.03-3.1 11.95 0 .02.01.04.03.05 1.8 1.32 3.53 2.12 5.24 2.65.03.01.06 0 .07-.02.4-.55.76-1.13 1.07-1.74.02-.04 0-.08-.04-.09-.57-.22-1.11-.48-1.64-.78-.04-.02-.04-.08-.01-.11.11-.08.22-.17.33-.25.02-.02.05-.02.07-.01 3.44 1.57 7.15 1.57 10.55 0 .02-.01.05-.01.07.01.11.09.22.17.33.26.04.03.04.09-.01.11-.52.31-1.07.56-1.64.78-.04.01-.05.06-.04.09.32.61.68 1.19 1.07 1.74.03.01.06.02.09.01 1.72-.53 3.45-1.33 5.25-2.65.02-.01.03-.03.03-.05.44-4.53-.73-8.46-3.1-11.95-.01-.01-.02-.02-.04-.02zM8.52 14.91c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12 0 1.17-.84 2.12-1.89 2.12zm6.97 0c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12 0 1.17-.83 2.12-1.89 2.12z"/>+ </svg>+ </a>+ <a+ class="nav-icon"+ href="https://github.com/HKUDS/DeepTutor/issues/78"+ target="_blank"+ rel="noopener"+ aria-label="微信社区"+ title="微信社区"+ >+ <svg width="17" height="17" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M8.69 4C4.55 4 1.2 6.68 1.2 10c0 1.86 1.04 3.51 2.69 4.61l-.7 2.4 2.79-1.5c.83.3 1.74.49 2.7.49.34 0 .67-.02 1-.06-.13-.46-.21-.94-.21-1.43 0-3.07 2.97-5.5 6.7-5.5.33 0 .67.02 1 .07C16.39 6.32 12.86 4 8.69 4ZM6.18 8.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5 1c-3.3 0-6 2.24-6 5s2.7 5 6 5c.74 0 1.45-.12 2.1-.34L20.2 20l-.7-2.05c1.07-.95 1.7-2.15 1.7-3.45 0-2.76-2.7-5-6-5Zm-2 4a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Zm4 0a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"/>+ </svg>+ </a>+ <span class="nav-tool-divider nav-links-divider" aria-hidden="true"></span>+ <a class="nav-text" href="/zh-cn/docs/">文档</a>+ </nav>+ <div class="nav-tools" aria-label="偏好设置">+ <label class="nav-tool" aria-label="主题">+ <svg class="nav-tool-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <rect x="2.5" y="4" width="19" height="13" rx="2"/>+ <path d="M8 21h8M12 17v4"/>+ </svg>+ <select class="nav-select" data-theme-select aria-label="主题">+ <option value="auto">自动</option>+ <option value="light">浅色</option>+ <option value="dark">深色</option>+ </select>+ <svg class="nav-tool-caret" width="10" height="10" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <polyline points="3 4.5 6 7.5 9 4.5"/>+ </svg>+ </label>+ <span class="nav-tool-divider" aria-hidden="true"></span>+ <label class="nav-tool" aria-label="语言">+ <svg class="nav-tool-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <circle cx="12" cy="12" r="9.5"/>+ <path d="M2.5 12h19"/>+ <path d="M12 2.5a14 14 0 0 1 4 9.5 14 14 0 0 1-4 9.5 14 14 0 0 1-4-9.5 14 14 0 0 1 4-9.5z"/>+ </svg>+ <select class="nav-select" data-locale-select aria-label="语言">+ <option value="/">English</option>+ <option value="/zh-cn/" selected>简体中文</option>+ </select>+ <svg class="nav-tool-caret" width="10" height="10" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <polyline points="3 4.5 6 7.5 9 4.5"/>+ </svg>+ </label>+ </div>+ </div>+ </header>++ <main>+ <section class="hero">+ <div class="hero-bg" aria-hidden="true"></div>+ <img class="hero-wordmark" src="/banner.png" alt="DeepTutor" />+ <h1 class="hero-tagline">+ 个性化学习,<br />+ <em>重新想象。</em>+ </h1>+ <p class="hero-sub">+ Agent-native 学习伴侣,与你一起成长。<br />+ 完全开源。+ </p>+ <div class="hero-actions">+ <a class="btn btn-primary" href="/zh-cn/docs/">文档</a>+ <a+ class="btn btn-ghost btn-gh"+ href="https://github.com/HKUDS/DeepTutor"+ target="_blank"+ rel="noopener"+ aria-label="DeepTutor on GitHub"+ >+ <svg width="15" height="15" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>+ </svg>+ <span>GitHub</span>+ <span class="btn-gh-sep" aria-hidden="true"></span>+ <span class="btn-gh-count" data-gh-stars>—</span>+ <span class="btn-gh-label">Stars</span>+ </a>+ </div>+ <div class="hero-meta">+ <span><strong>Apache 2.0</strong></span>+ <span class="sep">·</span>+ <span>来自 <strong>香港大学数据智能实验室</strong></span>+ </div>+ </section>++ <section class="showcase">+ <div class="showcase-frame">+ <div class="showcase-chrome">+ <span class="dot red"></span>+ <span class="dot amber"></span>+ <span class="dot green"></span>+ <span class="showcase-title">DeepTutor —— 聊天工作台</span>+ </div>+ <img+ class="showcase-shot"+ src="/screenshots/dt-home.png"+ alt="DeepTutor 聊天工作台 —— 侧栏 Chat / TutorBot / Co-Writer / Book / 知识库 / Space / 记忆;主区域显示问候语和输入框。"+ loading="eager"+ decoding="async"+ />+ </div>+ </section>++ <section class="section">+ <header class="section-head">+ <span class="section-eyebrow">里面是什么</span>+ <h2>六根支柱,<em>同一份</em>运行时上下文。</h2>+ <p>+ 每个界面都从同一份记忆、知识库、导师那里读写。+ 切换上下文不再意味着丢失当前位置。+ </p>+ </header>+ <div class="feature-grid">+ {+ features.map((f) => (+ <a class="feature" href={f.href}>+ <span class="feature-mark">{f.chapter}</span>+ <h3>{f.title}</h3>+ <p>{f.body}</p>+ <span class="feature-arrow">+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none">+ <path+ d="M3 11L11 3M11 3H5M11 3V9"+ stroke="currentColor"+ stroke-width="1.5"+ stroke-linecap="round"+ stroke-linejoin="round"+ />+ </svg>+ </span>+ </a>+ ))+ }+ </div>+ </section>++ <section class="section section-quiet">+ <header class="section-head">+ <span class="section-eyebrow">安装</span>+ <h2>几<em>分钟</em>就能跑起来。</h2>+ <p>+ 四种安装方式 —— 挑一个适合你的。+ 最终都落到同一个配置好的工作区。+ </p>+ </header>+ <div class="install" id="install" data-active="pypi">+ <div class="install-tabs" role="tablist">+ {+ installs.map((opt, i) => (+ <button+ class={`install-tab${i === 0 ? " is-active" : ""}`}+ role="tab"+ aria-selected={i === 0 ? "true" : "false"}+ data-target={opt.id}+ >+ <span class="install-tab-label">{opt.label}</span>+ </button>+ ))+ }+ </div>+ <div class="install-body">+ {+ installs.map((opt, i) => (+ <div+ class={`install-panel${i === 0 ? " is-active" : ""}`}+ role="tabpanel"+ data-panel={opt.id}+ >+ <p class="install-blurb">{opt.blurb}</p>+ <pre class="install-code"><code>{opt.code}</code></pre>+ <div class="install-foot">+ <span class="install-foot-note">{opt.foot}</span>+ <a class="install-foot-link" href={opt.href}>+ 完整指南+ <svg width="12" height="12" viewBox="0 0 14 14" fill="none" aria-hidden="true">+ <path d="M3 11L11 3M11 3H5M11 3V9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+ </svg>+ </a>+ </div>+ </div>+ ))+ }+ </div>+ </div>+ </section>++ <footer class="footer">+ <div class="footer-inner">+ <a class="footer-brand" href="/zh-cn/">+ <img src="/logo.png" alt="" />+ <span>DeepTutor</span>+ </a>+ <div class="footer-cols">+ <div class="footer-col">+ <h4>文档</h4>+ <a href="/zh-cn/docs/get-started/">快速上手</a>+ <a href="/zh-cn/docs/explore/">探索 DeepTutor</a>+ <a href="/zh-cn/docs/tutorbot/">TutorBot 渠道</a>+ <a href="/zh-cn/docs/cli/">CLI</a>+ </div>+ <div class="footer-col">+ <h4>社区</h4>+ <a href="https://discord.gg/eRsjPgMU4t" target="_blank" rel="noopener">Discord</a>+ <a href="https://github.com/HKUDS/DeepTutor/issues/78" target="_blank" rel="noopener">+ 微信社区+ </a>+ <a href="https://github.com/HKUDS/DeepTutor/discussions" target="_blank" rel="noopener">+ 讨论区+ </a>+ <a href="https://github.com/HKUDS/DeepTutor/issues" target="_blank" rel="noopener">+ Issues+ </a>+ </div>+ <div class="footer-col">+ <h4>项目</h4>+ <a href="https://github.com/HKUDS/DeepTutor" target="_blank" rel="noopener">+ GitHub+ </a>+ <a+ href="https://github.com/HKUDS/DeepTutor/blob/main/LICENSE"+ target="_blank"+ rel="noopener">协议</a+ >+ <a href="https://arxiv.org/abs/2604.26962" target="_blank" rel="noopener">arXiv</a>+ </div>+ </div>+ </div>+ <div class="footer-rule"></div>++ <div class="footer-credo">+ <p class="footer-tagline">+ 源自<em>社区</em>,连接<em>世界</em>。+ </p>+ <div class="footer-pulse" id="footer-pulse" data-hidden="true" aria-live="polite">+ <span class="footer-pulse-dot" aria-hidden="true"></span>+ 最新:+ <a class="footer-pulse-tag" data-pulse="release-link" href="https://github.com/HKUDS/DeepTutor/releases" target="_blank" rel="noopener">+ <span data-pulse="release-tag">—</span>+ </a>+ <span class="sep">·</span>+ <span class="num"><span data-pulse="requests">—</span> 次浏览</span>+ </div>+ </div>++ <div class="footer-fine">+ <span>+ © 2026 <a href="https://github.com/HKUDS" target="_blank" rel="noopener">+ 港大数据智能实验室+ </a>+ </span>+ <span>基于 Apache 2.0 协议发布</span>+ </div>+ </footer>++ <script is:inline>+ (async () => {+ const pulse = document.getElementById("footer-pulse");+ if (!pulse) return;++ const fmtNum = (n) => {+ if (n == null) return "0";+ if (n >= 1e9) return (n / 1e9).toFixed(2).replace(/\.?0+$/, "") + "B";+ if (n >= 1e6) return (n / 1e6).toFixed(2).replace(/\.?0+$/, "") + "M";+ if (n >= 1e3) return (n / 1e3).toFixed(2).replace(/\.?0+$/, "") + "k";+ return String(n);+ };+ const fmtBytes = (b) => {+ if (b == null) return "0 B";+ const KB = 1024, MB = KB * 1024, GB = MB * 1024, TB = GB * 1024;+ if (b >= TB) return (b / TB).toFixed(2) + " TB";+ if (b >= GB) return (b / GB).toFixed(2) + " GB";+ if (b >= MB) return (b / MB).toFixed(2) + " MB";+ if (b >= KB) return (b / KB).toFixed(2) + " KB";+ return b + " B";+ };+ const setText = (key, value) => {+ const el = pulse.querySelector('[data-pulse="' + key + '"]');+ if (el) el.textContent = value;+ };++ const isLocal =+ location.hostname === "localhost" ||+ location.hostname === "127.0.0.1" ||+ location.hostname === "0.0.0.0";++ const sample = isLocal+ ? {+ traffic: {+ window: "total",+ requests: 78400,+ bytes: 1530000000,+ uniques: 18200,+ },+ release: {+ tag: "v1.4.0-beta",+ name: "v1.4.0-beta",+ url: "https://github.com/HKUDS/DeepTutor/releases/tag/v1.4.0-beta",+ published_at: "2026-05-21T00:00:00Z",+ prerelease: true,+ },+ }+ : null;++ const [traffic, release] = await Promise.allSettled([+ isLocal+ ? Promise.resolve(sample.traffic)+ : fetch("/api/traffic", { cache: "no-store" }).then((r) =>+ r.ok ? r.json() : Promise.reject(new Error("status=" + r.status)),+ ),+ isLocal+ ? Promise.resolve(sample.release)+ : fetch("/api/release", { cache: "no-store" }).then((r) =>+ r.ok ? r.json() : Promise.reject(new Error("status=" + r.status)),+ ),+ ]);++ let trafficOK = false;+ let releaseOK = false;++ if (traffic.status === "fulfilled" && traffic.value && !traffic.value.error) {+ setText("requests", fmtNum(traffic.value.requests));+ setText("bytes", fmtBytes(traffic.value.bytes));+ trafficOK = true;+ }+ if (release.status === "fulfilled" && release.value && !release.value.error) {+ setText("release-tag", release.value.tag);+ const link = pulse.querySelector('[data-pulse="release-link"]');+ if (link && release.value.url) link.setAttribute("href", release.value.url);+ releaseOK = true;+ }++ if (releaseOK || trafficOK) {+ pulse.setAttribute("data-hidden", "false");+ }+ })();+ </script>+ </main>++ <style>+ /* ───────── Nav ───────── */+ .nav {+ position: sticky;+ top: 0;+ z-index: 50;+ background: rgba(250, 248, 243, 0.78);+ backdrop-filter: saturate(180%) blur(14px);+ -webkit-backdrop-filter: saturate(180%) blur(14px);+ border-bottom: 1px solid var(--rule);+ }+ .nav-inner {+ max-width: 1280px;+ margin: 0 auto;+ padding: 3px 32px;+ display: flex;+ align-items: center;+ gap: 10px;+ }+ .nav-brand {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 30px;+ height: 30px;+ text-decoration: none;+ color: var(--ink);+ }+ .nav-brand img {+ width: 22px;+ height: 22px;+ display: block;+ object-fit: contain;+ }+ .nav-links {+ display: flex;+ align-items: center;+ gap: 2px;+ margin-left: 6px;+ }+ .nav-icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 30px;+ height: 30px;+ color: var(--ink-soft);+ border-radius: 8px;+ text-decoration: none;+ transition: color 0.15s ease, background 0.15s ease;+ }+ .nav-icon svg {+ width: 17px;+ height: 17px;+ }+ .nav-icon:hover {+ color: var(--ink);+ background: rgba(24, 24, 28, 0.05);+ }+ .nav-text {+ text-decoration: none;+ color: var(--ink-soft);+ font-size: 14px;+ font-weight: 500;+ padding: 0 6px;+ transition: color 0.15s ease;+ }+ .nav-text:hover {+ color: var(--ink);+ }+ .nav-links-divider {+ margin: 0 8px;+ }+ .nav-tools {+ margin-left: auto;+ display: flex;+ align-items: center;+ gap: 12px;+ }+ .nav-tool {+ position: relative;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ color: var(--ink-soft);+ font-size: 13.5px;+ font-weight: 500;+ cursor: pointer;+ transition: color 0.15s ease;+ }+ .nav-tool:hover {+ color: var(--ink);+ }+ .nav-tool-icon {+ flex-shrink: 0;+ color: var(--ink-faint);+ transition: color 0.15s ease;+ }+ .nav-tool:hover .nav-tool-icon {+ color: var(--ink-soft);+ }+ .nav-select {+ appearance: none;+ -webkit-appearance: none;+ border: 0;+ background: transparent;+ color: inherit;+ font: inherit;+ cursor: pointer;+ padding: 4px 16px 4px 0;+ outline: none;+ line-height: 1;+ }+ .nav-tool-caret {+ position: absolute;+ right: 0;+ pointer-events: none;+ opacity: 0.5;+ }+ .nav-tool-divider {+ width: 1px;+ height: 14px;+ background: var(--rule-strong);+ opacity: 0.6;+ }+ @media (max-width: 900px) {+ .nav-links {+ display: none;+ }+ }+ @media (max-width: 620px) {+ .nav-inner {+ padding: 3px 16px;+ gap: 8px;+ }+ }++ /* ───────── Hero ───────── */+ .hero {+ position: relative;+ max-width: 1280px;+ margin: 0 auto;+ padding: 96px 32px 80px;+ text-align: center;+ overflow: hidden;+ }+ .hero-bg {+ position: absolute;+ top: 60px;+ left: 50%;+ transform: translateX(-50%);+ width: 760px;+ height: 380px;+ background: var(--warm-glow);+ filter: blur(40px);+ z-index: -1;+ pointer-events: none;+ }+ .eyebrow {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ margin-bottom: 36px;+ padding: 6px 14px;+ border: 1px solid var(--rule);+ background: rgba(250, 248, 243, 0.6);+ border-radius: 999px;+ font-family: var(--font-mono);+ font-size: 11.5px;+ font-weight: 500;+ letter-spacing: 0.04em;+ color: var(--ink-soft);+ }+ .eyebrow .dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--accent);+ box-shadow: 0 0 0 3px var(--accent-soft);+ }+ .hero-wordmark {+ display: block;+ max-width: 380px;+ width: min(72%, 380px);+ height: auto;+ margin: 0 auto 32px;+ user-select: none;+ }+ .hero-tagline {+ font-family: var(--font-display);+ font-weight: 500;+ font-size: clamp(36px, 5.4vw, 60px);+ line-height: 1.05;+ letter-spacing: -0.03em;+ color: var(--ink);+ margin: 0 auto 24px;+ max-width: 760px;+ font-variation-settings: "opsz" 72, "SOFT" 30;+ }+ .hero-tagline em {+ font-style: italic;+ font-weight: 400;+ color: var(--accent);+ font-variation-settings: "opsz" 72, "SOFT" 100;+ }+ .hero-sub {+ font-size: 17px;+ line-height: 1.55;+ color: var(--ink-soft);+ margin: 0 auto 40px;+ max-width: 560px;+ font-weight: 400;+ }+ .hero-actions {+ display: flex;+ gap: 10px;+ justify-content: center;+ flex-wrap: wrap;+ margin-bottom: 56px;+ }+ .btn {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ height: 46px;+ padding: 0 22px;+ border-radius: 999px;+ font-size: 14.5px;+ font-weight: 500;+ text-decoration: none;+ transition: transform 0.15s ease, background 0.15s ease,+ border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;+ border: 1px solid transparent;+ }+ .btn-primary {+ background: var(--ink);+ color: var(--paper);+ }+ .btn-primary:hover {+ background: #000;+ transform: translateY(-1px);+ box-shadow: 0 10px 28px -10px rgba(24, 24, 28, 0.5);+ }+ .btn-ghost {+ background: transparent;+ border-color: var(--rule-strong);+ color: var(--ink);+ }+ .btn-ghost:hover {+ border-color: var(--ink);+ transform: translateY(-1px);+ }+ .btn-gh {+ gap: 9px;+ padding: 0 18px;+ font-family: var(--font-mono);+ font-size: 13.5px;+ }+ .btn-gh svg {+ flex-shrink: 0;+ }+ .btn-gh-sep {+ width: 1px;+ height: 18px;+ background: var(--rule-strong);+ opacity: 0.8;+ }+ .btn-gh-count {+ font-family: var(--font-mono);+ font-weight: 600;+ font-size: 13.5px;+ letter-spacing: 0.01em;+ color: var(--ink);+ min-width: 1.5ch;+ text-align: right;+ }+ .btn-gh-label {+ font-family: var(--font-mono);+ color: var(--ink-soft);+ font-weight: 500;+ }+ .btn-gh:hover .btn-gh-count {+ color: var(--ink);+ }+ .hero-meta {+ font-family: var(--font-mono);+ font-size: 11.5px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ display: inline-flex;+ flex-wrap: wrap;+ justify-content: center;+ gap: 8px;+ }+ .hero-meta strong {+ color: var(--ink-soft);+ font-weight: 600;+ }+ .hero-meta .sep {+ opacity: 0.4;+ }++ /* ───────── Product showcase ───────── */+ .showcase {+ max-width: 1180px;+ margin: 0 auto 16px;+ padding: 0 32px;+ }+ .showcase-frame {+ border-radius: 20px;+ overflow: hidden;+ border: 1px solid var(--rule-strong);+ background: var(--paper-soft);+ box-shadow:+ 0 1px 0 rgba(255, 255, 255, 0.6) inset,+ 0 40px 80px -40px rgba(24, 24, 28, 0.22),+ 0 16px 32px -20px rgba(24, 24, 28, 0.1);+ }+ .showcase-chrome {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 11px 16px;+ border-bottom: 1px solid var(--rule);+ background: rgba(250, 248, 243, 0.7);+ }+ .showcase-chrome .dot {+ width: 11px;+ height: 11px;+ border-radius: 50%;+ }+ .showcase-chrome .dot.red {+ background: #f15a55;+ }+ .showcase-chrome .dot.amber {+ background: #f9bb3f;+ }+ .showcase-chrome .dot.green {+ background: #4dc44d;+ }+ .showcase-title {+ margin-left: 12px;+ font-family: var(--font-mono);+ font-size: 11.5px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ }+ .showcase-frame img {+ width: 100%;+ display: block;+ }++ /* ───────── Section ───────── */+ .section {+ position: relative;+ max-width: 1180px;+ margin: 0 auto;+ padding: 128px 32px;+ }+ .section-quiet {+ background: var(--paper-soft);+ max-width: none;+ margin: 96px 0 0;+ padding-left: 32px;+ padding-right: 32px;+ }+ .section-quiet > .chapter-mark,+ .section-quiet > .section-head,+ .section-quiet > .install {+ max-width: 1180px;+ margin-left: auto;+ margin-right: auto;+ }+ .chapter-mark {+ font-family: var(--font-display);+ font-style: italic;+ font-size: 14px;+ font-weight: 500;+ color: var(--ink-faint);+ text-align: center;+ letter-spacing: 0.04em;+ margin-bottom: 24px;+ font-variation-settings: "opsz" 24;+ }+ .section-head {+ text-align: center;+ margin-bottom: 72px;+ max-width: 720px;+ margin-left: auto;+ margin-right: auto;+ }+ .section-eyebrow {+ display: inline-block;+ margin-bottom: 18px;+ font-family: var(--font-mono);+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.18em;+ text-transform: uppercase;+ color: var(--accent);+ }+ .section-head h2 {+ font-family: var(--font-display);+ margin: 0 0 16px;+ font-size: clamp(34px, 4.4vw, 52px);+ font-weight: 500;+ letter-spacing: -0.032em;+ line-height: 1.05;+ color: var(--ink);+ font-variation-settings: "opsz" 56, "SOFT" 30;+ }+ .section-head h2 em {+ font-style: italic;+ font-weight: 400;+ color: var(--ink-soft);+ font-variation-settings: "opsz" 56, "SOFT" 100;+ }+ .section-head p {+ margin: 0 auto;+ max-width: 580px;+ font-size: 17px;+ color: var(--ink-soft);+ line-height: 1.55;+ }++ /* ───────── Feature grid ───────── */+ .feature-grid {+ display: grid;+ grid-template-columns: repeat(3, 1fr);+ border: 1px solid var(--rule);+ border-radius: 16px;+ overflow: hidden;+ background: var(--paper-soft);+ gap: 1px;+ }+ .feature {+ position: relative;+ display: flex;+ flex-direction: column;+ padding: 44px 36px 48px;+ background: var(--paper);+ text-decoration: none;+ color: var(--ink);+ transition: background 0.25s ease, transform 0.2s ease;+ }+ .feature:hover {+ background: rgba(77, 143, 191, 0.04);+ }+ .feature-mark {+ font-family: var(--font-display);+ font-style: italic;+ font-size: 26px;+ font-weight: 400;+ line-height: 1;+ color: var(--accent);+ margin-bottom: 28px;+ font-variation-settings: "opsz" 36;+ }+ .feature h3 {+ font-family: var(--font-display);+ margin: 0 0 12px;+ font-size: 22px;+ font-weight: 500;+ letter-spacing: -0.02em;+ color: var(--ink);+ font-variation-settings: "opsz" 28;+ }+ .feature p {+ margin: 0;+ font-size: 14.5px;+ line-height: 1.65;+ color: var(--ink-soft);+ flex: 1;+ }+ .feature-arrow {+ opacity: 0;+ transform: translate(-4px, 4px);+ transition: opacity 0.2s ease, transform 0.25s ease;+ margin-top: 24px;+ color: var(--accent);+ }+ .feature:hover .feature-arrow {+ opacity: 1;+ transform: translate(0, 0);+ }+ @media (max-width: 980px) {+ .feature-grid {+ grid-template-columns: repeat(2, 1fr);+ }+ }+ @media (max-width: 640px) {+ .feature-grid {+ grid-template-columns: 1fr;+ }+ }++ /* ───────── Install (integrated tabs) ───────── */+ .install {+ max-width: 820px;+ margin: 0 auto;+ }+ .install-tabs {+ display: flex;+ align-items: center;+ gap: 2px;+ padding: 4px;+ margin: 0 auto 28px;+ width: fit-content;+ border-radius: 999px;+ background: rgba(24, 24, 28, 0.045);+ border: 1px solid rgba(24, 24, 28, 0.04);+ }+ .install-tab {+ appearance: none;+ background: transparent;+ border: 0;+ cursor: pointer;+ padding: 7px 16px;+ border-radius: 999px;+ font-family: inherit;+ font-size: 13px;+ font-weight: 500;+ letter-spacing: -0.005em;+ color: var(--ink-soft);+ transition:+ color 0.18s ease,+ background 0.22s ease,+ box-shadow 0.22s ease;+ }+ .install-tab:hover {+ color: var(--ink);+ }+ .install-tab.is-active {+ background: var(--paper);+ color: var(--ink);+ box-shadow:+ 0 1px 1px rgba(24, 24, 28, 0.04),+ 0 2px 8px -2px rgba(24, 24, 28, 0.08);+ }+ .install-tab-label {+ display: inline-block;+ }+ .install-body {+ background: var(--paper);+ border: 1px solid var(--rule);+ border-radius: 14px;+ padding: 28px 30px 24px;+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;+ }+ .install-panel {+ display: none;+ animation: install-fade 0.25s ease;+ }+ .install-panel.is-active {+ display: block;+ }+ @keyframes install-fade {+ from { opacity: 0; transform: translateY(2px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .install-blurb {+ margin: 0 0 18px;+ font-size: 14px;+ color: var(--ink-soft);+ line-height: 1.55;+ }+ .install-code {+ margin: 0;+ padding: 20px 22px;+ background: rgba(244, 240, 232, 0.55);+ border: 1px solid var(--rule);+ border-radius: 10px;+ font-family: var(--font-mono);+ font-size: 13px;+ line-height: 1.78;+ color: var(--ink);+ overflow-x: auto;+ white-space: pre;+ }+ .install-code code {+ font-family: inherit;+ font-size: inherit;+ color: inherit;+ background: transparent;+ padding: 0;+ }+ .install-foot {+ margin: 16px 2px 0;+ display: flex;+ flex-wrap: wrap;+ justify-content: space-between;+ align-items: center;+ gap: 12px;+ font-size: 13.5px;+ color: var(--ink-soft);+ }+ .install-foot-note {+ font-family: var(--font-mono);+ font-size: 12px;+ color: var(--ink-faint);+ letter-spacing: 0.01em;+ }+ .install-foot-link {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ color: var(--ink);+ text-decoration: none;+ font-weight: 500;+ font-size: 13.5px;+ border-bottom: 1px solid var(--rule-strong);+ padding-bottom: 1px;+ transition: border-color 0.15s ease, color 0.15s ease;+ }+ .install-foot-link:hover {+ border-color: var(--ink);+ }+ .install-foot-link svg {+ transition: transform 0.2s ease;+ }+ .install-foot-link:hover svg {+ transform: translate(1px, -1px);+ }+ @media (max-width: 760px) {+ .install-tab {+ flex: 1;+ min-width: 0;+ padding: 9px 8px 11px;+ }+ }++ /* ───────── Ecosystem ───────── */+ .section-eco {+ padding-top: 96px;+ padding-bottom: 64px;+ }+ .section-eco .section-head {+ margin-bottom: 48px;+ }+ .eco-list {+ max-width: 820px;+ margin: 0 auto;+ border-top: 1px solid var(--rule);+ }+ .eco-row {+ display: grid;+ grid-template-columns: 180px 1fr auto;+ align-items: center;+ gap: 24px;+ padding: 18px 8px;+ border-bottom: 1px solid var(--rule);+ text-decoration: none;+ color: var(--ink);+ transition: padding 0.2s ease, background 0.18s ease;+ }+ .eco-row:hover {+ padding-left: 16px;+ background: rgba(77, 143, 191, 0.025);+ }+ .eco-name {+ font-family: var(--font-display);+ font-style: italic;+ font-size: 19px;+ font-weight: 500;+ letter-spacing: -0.014em;+ color: var(--ink);+ font-variation-settings: "opsz" 24;+ }+ .eco-desc {+ font-size: 14px;+ color: var(--ink-soft);+ line-height: 1.5;+ }+ .eco-arrow {+ color: var(--ink-faint);+ transition: color 0.18s ease, transform 0.22s ease;+ display: inline-flex;+ }+ .eco-row:hover .eco-arrow {+ color: var(--accent);+ transform: translate(2px, -2px);+ }+ @media (max-width: 720px) {+ .eco-row {+ grid-template-columns: 1fr auto;+ gap: 6px 12px;+ padding: 16px 8px;+ }+ .eco-desc {+ grid-column: 1 / -1;+ }+ }++ /* ───────── Interactive app mock ───────── */+ .dt-app {+ display: grid;+ grid-template-columns: 56px 1fr;+ background: var(--paper);+ height: 560px;+ max-height: 70vh;+ }+ .dt-rail {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 8px;+ padding: 14px 0;+ border-right: 1px solid var(--rule);+ background: rgba(244, 240, 232, 0.4);+ }+ .dt-rail-brand img {+ width: 22px;+ height: 22px;+ }+ .dt-rail-brand {+ margin-bottom: 6px;+ text-decoration: none;+ display: inline-flex;+ }+ .dt-rail-btn {+ appearance: none;+ background: transparent;+ border: 0;+ width: 34px;+ height: 34px;+ border-radius: 9px;+ color: var(--ink-soft);+ display: inline-flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ transition: background 0.15s ease, color 0.15s ease;+ }+ .dt-rail-btn svg {+ width: 16px;+ height: 16px;+ }+ .dt-rail-btn:hover {+ background: rgba(24, 24, 28, 0.06);+ color: var(--ink);+ }+ .dt-rail-btn.is-active {+ background: rgba(77, 143, 191, 0.14);+ color: var(--accent);+ }+ .dt-rail-new {+ border: 1px dashed var(--rule-strong);+ }+ .dt-rail-group {+ display: flex;+ flex-direction: column;+ gap: 2px;+ margin-top: 6px;+ }+ .dt-rail-foot {+ margin-top: auto;+ display: flex;+ flex-direction: column;+ gap: 6px;+ align-items: center;+ }+ .dt-rail-avatar {+ background: var(--ink);+ color: var(--paper);+ font-family: var(--font-display);+ font-style: italic;+ font-size: 13px;+ font-weight: 500;+ }+ .dt-rail-avatar:hover {+ background: #000;+ color: var(--paper);+ }+ .dt-main {+ display: flex;+ flex-direction: column;+ min-width: 0;+ }+ .dt-topbar {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 14px 22px;+ border-bottom: 1px solid var(--rule);+ gap: 16px;+ }+ .dt-thread-title {+ font-size: 13.5px;+ font-weight: 600;+ color: var(--ink);+ }+ .dt-topbar-actions {+ display: flex;+ gap: 4px;+ flex-wrap: wrap;+ }+ .dt-act {+ appearance: none;+ background: transparent;+ border: 1px solid transparent;+ color: var(--ink);+ font-family: inherit;+ font-size: 12px;+ font-weight: 500;+ padding: 6px 10px;+ border-radius: 8px;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ cursor: pointer;+ transition: background 0.15s ease, border-color 0.15s ease;+ }+ .dt-act:hover {+ background: rgba(24, 24, 28, 0.05);+ border-color: var(--rule);+ }+ .dt-act.is-muted {+ color: var(--ink-faint);+ cursor: not-allowed;+ }+ .dt-act.is-muted:hover {+ background: transparent;+ border-color: transparent;+ }+ .dt-act-glyph {+ font-size: 12px;+ opacity: 0.7;+ }+ .dt-canvas {+ flex: 1;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ padding: 32px 28px 28px;+ gap: 28px;+ }+ .dt-greeting {+ display: inline-flex;+ align-items: center;+ gap: 14px;+ }+ .dt-greeting-mark {+ width: 36px;+ height: 36px;+ }+ .dt-greeting h3 {+ margin: 0;+ font-family: var(--font-display);+ font-size: clamp(28px, 3.6vw, 38px);+ font-weight: 500;+ letter-spacing: -0.022em;+ color: var(--ink);+ font-variation-settings: "opsz" 36;+ }+ .dt-composer {+ width: 100%;+ max-width: 620px;+ background: var(--paper);+ border: 1px solid var(--rule-strong);+ border-radius: 14px;+ padding: 14px 16px 10px;+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 24px -16px rgba(24, 24, 28, 0.18);+ transition: border-color 0.18s ease, box-shadow 0.18s ease;+ }+ .dt-composer:focus-within {+ border-color: var(--accent);+ box-shadow: 0 0 0 4px var(--accent-soft);+ }+ .dt-composer-input {+ width: 100%;+ border: 0;+ outline: 0;+ resize: none;+ background: transparent;+ font-family: inherit;+ font-size: 14.5px;+ line-height: 1.5;+ color: var(--ink);+ padding: 4px 0 6px;+ }+ .dt-composer-input::placeholder {+ color: var(--ink-faint);+ }+ .dt-composer-row {+ display: flex;+ align-items: center;+ gap: 6px;+ margin-top: 4px;+ }+ .dt-composer-spacer {+ flex: 1;+ }+ .dt-pill {+ appearance: none;+ background: var(--paper);+ border: 1px solid var(--rule);+ border-radius: 999px;+ height: 28px;+ padding: 0 10px;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ font-size: 12px;+ font-weight: 500;+ color: var(--ink);+ cursor: pointer;+ transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;+ }+ .dt-pill svg {+ width: 12px;+ height: 12px;+ color: var(--ink-soft);+ }+ .dt-pill:hover {+ border-color: var(--rule-strong);+ }+ .dt-pill-caret {+ opacity: 0.6;+ }+ .dt-pill-mode {+ background: rgba(77, 143, 191, 0.08);+ border-color: rgba(77, 143, 191, 0.28);+ color: var(--accent);+ }+ .dt-pill-mode svg {+ color: var(--accent);+ }+ .dt-pill-mode:hover {+ background: rgba(77, 143, 191, 0.14);+ transform: translateY(-1px);+ }+ .dt-pill-mode.is-pulsing {+ animation: dt-pulse 0.45s ease;+ }+ @keyframes dt-pulse {+ 0% { transform: scale(1); }+ 50% { transform: scale(1.04); }+ 100% { transform: scale(1); }+ }+ .dt-model-dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: linear-gradient(135deg, #d8a974, #c8865e);+ box-shadow: 0 0 0 2px rgba(216, 169, 116, 0.18);+ }+ .dt-send {+ width: 28px;+ height: 28px;+ border-radius: 50%;+ border: 0;+ background: rgba(216, 169, 116, 0.35);+ color: var(--paper);+ display: inline-flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ transition: background 0.18s ease, transform 0.15s ease;+ }+ .dt-send svg {+ width: 13px;+ height: 13px;+ }+ .dt-send:hover {+ background: var(--accent);+ transform: translateY(-1px);+ }+ .dt-send.is-active {+ background: var(--ink);+ }+ .dt-mode-hint {+ font-family: var(--font-mono);+ font-size: 11px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ opacity: 0.7;+ }+ .dt-mode-hint strong {+ color: var(--accent);+ font-weight: 600;+ }+ @media (max-width: 760px) {+ .dt-app {+ height: 520px;+ }+ .dt-topbar-actions .dt-act:nth-child(-n + 2) {+ display: none;+ }+ }+ @media (max-width: 560px) {+ .dt-topbar-actions .dt-act span:not(.dt-act-glyph) {+ display: none;+ }+ .dt-pill .dt-pill-label {+ display: none;+ }+ .dt-pill {+ padding: 0 8px;+ }+ .dt-pill-mode .dt-pill-label {+ display: inline;+ }+ }++ /* ───────── Dark theme polish ───────── */+ [data-theme="dark"] .nav {+ background: rgba(13, 13, 16, 0.78);+ }+ [data-theme="dark"] .showcase-chrome {+ background: rgba(22, 22, 26, 0.7);+ }+ [data-theme="dark"] .hero-wordmark {+ filter: invert(1) hue-rotate(180deg) brightness(1.12);+ }+ [data-theme="dark"] .showcase-frame {+ box-shadow:+ 0 1px 0 rgba(255, 255, 255, 0.04) inset,+ 0 40px 80px -44px rgba(0, 0, 0, 0.7);+ }+ [data-theme="dark"] .btn-primary:hover,+ [data-theme="dark"] .dt-send.is-active:hover {+ background: #f1ede4;+ color: #0d0d10;+ }+ [data-theme="dark"] .feature:hover,+ [data-theme="dark"] .eco-row:hover,+ [data-theme="dark"] .dt-tool:hover {+ background: rgba(123, 190, 234, 0.08);+ }+ [data-theme="dark"] .install-code {+ background: rgba(22, 22, 26, 0.74);+ }+ [data-theme="dark"] .install-tabs {+ background: rgba(241, 237, 228, 0.045);+ border-color: rgba(241, 237, 228, 0.06);+ }+ [data-theme="dark"] .install-tab.is-active {+ background: rgba(241, 237, 228, 0.1);+ box-shadow:+ 0 1px 1px rgba(0, 0, 0, 0.2),+ 0 2px 8px -2px rgba(0, 0, 0, 0.3);+ }+ [data-theme="dark"] .dt-act,+ [data-theme="dark"] .dt-composer,+ [data-theme="dark"] .dt-pill {+ border-color: var(--rule);+ }++ /* ───────── Footer ───────── */+ .footer {+ max-width: 1280px;+ margin: 96px auto 0;+ padding: 64px 32px 48px;+ }+ .footer-inner {+ display: grid;+ grid-template-columns: 260px 1fr;+ gap: 48px;+ margin-bottom: 64px;+ }+ .footer-brand {+ display: inline-flex;+ align-items: center;+ gap: 10px;+ text-decoration: none;+ color: var(--ink);+ align-self: start;+ }+ .footer-brand img {+ width: 32px;+ height: 32px;+ }+ .footer-brand span {+ font-family: var(--font-display);+ font-style: italic;+ font-weight: 500;+ font-size: 22px;+ }+ .footer-cols {+ display: grid;+ grid-template-columns: repeat(3, 1fr);+ gap: 40px;+ }+ .footer-col h4 {+ margin: 0 0 16px;+ font-family: var(--font-mono);+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.18em;+ text-transform: uppercase;+ color: var(--ink-faint);+ }+ .footer-col a {+ display: block;+ margin-bottom: 10px;+ text-decoration: none;+ color: var(--ink-soft);+ font-size: 14px;+ transition: color 0.15s ease;+ }+ .footer-col a:hover {+ color: var(--ink);+ }+ .footer-rule {+ height: 1px;+ background: var(--rule);+ margin-bottom: 28px;+ }++ /* ───────── Footer credo — tagline + heartbeat, centered ───────── */+ .footer-credo {+ text-align: center;+ margin: 0 0 32px;+ }+ .footer-tagline {+ font-family: var(--font-display);+ font-size: 22px;+ font-weight: 500;+ letter-spacing: -0.02em;+ line-height: 1.25;+ color: var(--ink);+ margin: 0 0 14px;+ font-variation-settings: "opsz" 32;+ }+ .footer-tagline em {+ font-style: italic;+ font-weight: 400;+ color: var(--ink-soft);+ }++ /* ───────── Heartbeat (single editorial line, mono) ───────── */+ .footer-pulse {+ display: inline-flex;+ align-items: center;+ flex-wrap: wrap;+ justify-content: center;+ gap: 7px;+ font-family: var(--font-mono);+ font-size: 11.5px;+ letter-spacing: 0.02em;+ color: var(--ink-faint);+ opacity: 1;+ transition: opacity 0.35s ease;+ }+ .footer-pulse[data-hidden="true"] {+ opacity: 0;+ pointer-events: none;+ position: absolute;+ }+ .footer-pulse-dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--accent);+ box-shadow: 0 0 0 3px var(--accent-soft);+ animation: dtPulse 2.4s ease-in-out infinite;+ }+ @keyframes dtPulse {+ 0%, 100% { opacity: 1; transform: scale(1); }+ 50% { opacity: 0.45; transform: scale(0.85); }+ }+ .footer-pulse .sep {+ color: var(--ink-faint);+ opacity: 0.5;+ }+ .footer-pulse .num {+ color: var(--ink-soft);+ font-weight: 600;+ font-variant-numeric: tabular-nums;+ }+ .footer-pulse .num > [data-pulse] {+ color: var(--ink);+ }+ .footer-pulse-tag {+ color: var(--ink) !important;+ font-weight: 600;+ text-decoration: none !important;+ border-bottom: 1px solid var(--rule);+ padding-bottom: 1px;+ transition: border-color 0.15s ease;+ }+ .footer-pulse-tag:hover {+ border-color: var(--ink);+ }++ .footer-fine {+ display: flex;+ justify-content: space-between;+ font-family: var(--font-mono);+ font-size: 11.5px;+ color: var(--ink-faint);+ letter-spacing: 0.02em;+ }+ .footer-fine a {+ color: var(--ink-soft);+ text-decoration: none;+ }+ .footer-fine a:hover {+ color: var(--ink);+ }+ @media (max-width: 720px) {+ .footer-inner {+ grid-template-columns: 1fr;+ gap: 32px;+ }+ .footer-cols {+ grid-template-columns: repeat(2, 1fr);+ gap: 24px;+ }+ .footer-fine {+ flex-direction: column;+ gap: 8px;+ }+ }+ </style>++ <script>+ // ───────── GitHub star count ─────────+ (() => {+ const targets = document.querySelectorAll<HTMLElement>("[data-gh-stars]");+ if (!targets.length) return;+ const cacheKey = "deeptutor-gh-stars";+ const ttl = 60 * 60 * 1000; // 1h+ const format = (n: number) =>+ n >= 1000 ? (n / 1000).toFixed(n >= 10000 ? 1 : 2).replace(/\.?0+$/, "") + "k" : String(n);+ const paint = (n: number) => {+ const text = format(n);+ targets.forEach((el) => (el.textContent = text));+ };+ try {+ const raw = localStorage.getItem(cacheKey);+ if (raw) {+ const cached = JSON.parse(raw);+ if (cached && typeof cached.n === "number" && Date.now() - cached.t < ttl) {+ paint(cached.n);+ }+ }+ } catch {}+ fetch("https://api.github.com/repos/HKUDS/DeepTutor")+ .then((r) => (r.ok ? r.json() : null))+ .then((data) => {+ if (!data || typeof data.stargazers_count !== "number") return;+ paint(data.stargazers_count);+ try {+ localStorage.setItem(+ cacheKey,+ JSON.stringify({ n: data.stargazers_count, t: Date.now() }),+ );+ } catch {}+ })+ .catch(() => {});+ })();++ // ───────── Install tabs ─────────+ const installRoot = document.getElementById("install");+ if (installRoot) {+ const tabs = installRoot.querySelectorAll<HTMLButtonElement>(".install-tab");+ const panels = installRoot.querySelectorAll<HTMLElement>(".install-panel");+ tabs.forEach((tab) => {+ tab.addEventListener("click", () => {+ const target = tab.dataset.target;+ tabs.forEach((t) => {+ const on = t === tab;+ t.classList.toggle("is-active", on);+ t.setAttribute("aria-selected", on ? "true" : "false");+ });+ panels.forEach((p) => {+ p.classList.toggle("is-active", p.dataset.panel === target);+ });+ });+ });+ }++ // ───────── Landing preferences ─────────+ const themeKey = "starlight-theme";+ const themeQuery = "(prefers-color-scheme: light)";+ const readThemePreference = () => {+ try {+ const stored = localStorage.getItem(themeKey);+ return stored === "light" || stored === "dark" ? stored : "auto";+ } catch {+ return "auto";+ }+ };+ const resolvedTheme = (preference: string) => {+ if (preference === "light" || preference === "dark") return preference;+ return window.matchMedia(themeQuery).matches ? "light" : "dark";+ };+ const applyThemePreference = (preference: string) => {+ document.documentElement.dataset.theme = resolvedTheme(preference);+ document.querySelectorAll<HTMLSelectElement>("[data-theme-select]").forEach((select) => {+ select.value = preference;+ });+ };+ const persistThemePreference = (preference: string) => {+ try {+ if (preference === "light" || preference === "dark") {+ localStorage.setItem(themeKey, preference);+ } else {+ localStorage.setItem(themeKey, "");+ }+ } catch {}+ };++ applyThemePreference(readThemePreference());++ document.querySelectorAll<HTMLSelectElement>("[data-theme-select]").forEach((select) => {+ select.addEventListener("change", () => {+ persistThemePreference(select.value);+ applyThemePreference(select.value);+ });+ });++ window.matchMedia(themeQuery).addEventListener("change", () => {+ if (readThemePreference() === "auto") applyThemePreference("auto");+ });++ document.querySelectorAll<HTMLSelectElement>("[data-locale-select]").forEach((select) => {+ select.addEventListener("change", () => {+ const nextPath = select.value;+ if (nextPath && nextPath !== window.location.pathname) {+ window.location.assign(`${nextPath}${window.location.search}${window.location.hash}`);+ }+ });+ });+ </script>+ </body>+</html>diff --git a/site/src/styles/global.css b/site/src/styles/global.cssnew file mode 100644index 000000000..929ee3e27--- /dev/null+++ b/site/src/styles/global.css@@ -0,0 +1,69 @@+@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..600&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap");++:root {+ color-scheme: light;++ /* Palette — editorial scholarly */+ --paper: #faf8f3;+ --paper-soft: #f4f1ea;+ --ink: #18181c;+ --ink-soft: #5b5c64;+ --ink-faint: #9b9ca3;+ --rule: rgba(24, 24, 28, 0.09);+ --rule-strong: rgba(24, 24, 28, 0.16);+ --accent: #4d8fbf;+ --accent-soft: rgba(77, 143, 191, 0.1);+ --warm-glow: radial-gradient(+ ellipse at center,+ rgba(123, 190, 234, 0.14) 0%,+ rgba(245, 200, 160, 0.06) 50%,+ transparent 70%+ );++ --font-display: "Fraunces", "Iowan Old Style", "Charter", Georgia, serif;+ --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI",+ Helvetica, Arial, sans-serif;+ --font-mono: Monaco, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas,+ "Courier New", monospace;++ --content-width: 1180px;+ --reading-width: 720px;+}++[data-theme="dark"] {+ color-scheme: dark;++ --paper: #0d0d10;+ --paper-soft: #16161a;+ --ink: #f1ede4;+ --ink-soft: #a3a39b;+ --ink-faint: #61615b;+ --rule: rgba(241, 237, 228, 0.1);+ --rule-strong: rgba(241, 237, 228, 0.18);+ --accent: #7bbeea;+ --accent-soft: rgba(123, 190, 234, 0.12);+}++* {+ box-sizing: border-box;+}++html,+body {+ background: var(--paper);+ color: var(--ink);+ font-family: var(--font-body);+ font-feature-settings: "ss01", "ss03", "cv11";+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+ letter-spacing: -0.005em;+}++a {+ color: inherit;+}++::selection {+ background: var(--accent);+ color: var(--paper);+}diff --git a/site/src/styles/starlight.css b/site/src/styles/starlight.cssnew file mode 100644index 000000000..ffcd227cc--- /dev/null+++ b/site/src/styles/starlight.css@@ -0,0 +1,239 @@+/* Starlight theme overrides — tune Starlight to match the editorial brand */++:root {+ --sl-font: var(--font-body);+ --sl-font-mono: var(--font-mono);++ --sl-color-bg: var(--paper);+ --sl-color-bg-nav: rgba(250, 248, 243, 0.78);+ --sl-color-bg-sidebar: var(--paper);+ --sl-color-bg-inline-code: var(--paper-soft);+ --sl-color-bg-accent: var(--accent);++ --sl-color-text: var(--ink);+ --sl-color-text-accent: var(--accent);+ --sl-color-text-invert: var(--paper);+ --sl-color-gray-1: var(--ink);+ --sl-color-gray-2: var(--ink-soft);+ --sl-color-gray-3: var(--ink-soft);+ --sl-color-gray-4: var(--ink-faint);+ --sl-color-gray-5: var(--rule-strong);+ --sl-color-gray-6: var(--rule);+ --sl-color-gray-7: var(--paper-soft);++ --sl-color-accent: var(--accent);+ --sl-color-accent-low: var(--accent-soft);+ --sl-color-accent-high: #2d6b97;++ --sl-color-border: var(--rule);+ --sl-color-hairline: var(--rule);+ --sl-color-hairline-shade: var(--rule);++ --sl-text-h1: 2.6rem;+ --sl-text-h2: 1.8rem;+ --sl-text-h3: 1.3rem;+ --sl-text-h4: 1.1rem;++ --sl-content-width: 50rem;+ --sl-sidebar-width: 17rem;+ --sl-nav-height: 2.85rem;+ --sl-nav-pad-x: 1.25rem;+ --sl-nav-pad-y: 0.35rem;+}++[data-theme="dark"] {+ --sl-color-bg: var(--paper);+ --sl-color-bg-nav: rgba(13, 13, 16, 0.78);+ --sl-color-bg-sidebar: var(--paper);+ --sl-color-bg-inline-code: var(--paper-soft);+ --sl-color-text: var(--ink);+ --sl-color-text-invert: var(--paper);+}++body {+ font-family: var(--font-body);+}++header.header {+ backdrop-filter: saturate(180%) blur(14px);+ -webkit-backdrop-filter: saturate(180%) blur(14px);+}++/* Slim down the search-trigger button so it matches the compact nav row.+ Starlight's default is 2.5rem (40px) — too tall for our 2.85rem nav. */+header.header button[data-open-modal] {+ height: 1.875rem;+ font-size: 0.8125rem;+ padding-inline-start: 0.625rem;+ padding-inline-end: 0.4rem;+}+header.header button[data-open-modal] svg {+ width: 0.875rem;+ height: 0.875rem;+}+header.header button[data-open-modal] > kbd {+ font-size: 0.6875rem;+ padding-inline: 0.3rem;+}++/* Headings — editorial display feel */+.sl-markdown-content h1,+.sl-markdown-content h2,+.sl-markdown-content h3,+.sl-markdown-content h4 {+ font-family: var(--font-display);+ font-weight: 500;+ letter-spacing: -0.025em;+ font-variation-settings: "opsz" 36, "SOFT" 30;+}++.sl-markdown-content h1 em,+.sl-markdown-content h2 em,+.sl-markdown-content h3 em {+ font-style: italic;+ font-weight: 400;+ color: var(--ink-soft);+}++/* Sidebar refinement */+.sidebar-content nav ul li > details > summary,+.sidebar-content nav ul li > a,+.sidebar-content nav ul li > span {+ border-radius: 6px;+ font-size: 14px;+}++.sidebar-content nav .group-label .large {+ font-family: var(--font-mono);+ font-size: 10.5px;+ font-weight: 600;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ color: var(--ink-faint);+}++/* Page title */+.content-panel h1#_top {+ font-family: var(--font-display);+ font-weight: 500;+ letter-spacing: -0.03em;+ font-variation-settings: "opsz" 48;+}++/* Code blocks */+.expressive-code,+.sl-markdown-content pre {+ border-radius: 10px !important;+ border: 1px solid var(--rule) !important;+}++/* Drop the macOS-style "•••" terminal chrome from shell/bash code blocks.+ Expressive-code renders this title bar on terminal-language frames; we+ prefer a flat block that reads as content, not a fake window. */+.expressive-code .frame.is-terminal:not(.has-title) .header {+ display: none;+}+.expressive-code .frame.is-terminal:not(.has-title) figure.frame pre {+ border-top-left-radius: 10px;+ border-top-right-radius: 10px;+}+++/* Nav search */+site-search button[data-open-modal] {+ border-radius: 999px;+}++/* Prev / Next pagination — Starlight's default chunky bordered card looks+ heavy in our editorial layout. Flatten to a quiet, typographic row with+ a hairline divider above. Prev sits left, Next sits right; on narrow+ viewports they stack. */+.pagination-links {+ margin-top: 3rem;+ padding-top: 1.25rem;+ border-top: 1px solid var(--rule);+ gap: 1.5rem !important;+}++.pagination-links > a {+ border: none !important;+ box-shadow: none !important;+ background: transparent !important;+ padding: 0.5rem 0 !important;+ border-radius: 6px !important;+ flex: 1 1 0 !important;+ min-width: 0;+ font-weight: 400 !important;+ color: var(--ink-soft) !important;+ transition: color 120ms ease;+}++.pagination-links > a[rel="prev"] {+ text-align: left;+}++.pagination-links > a[rel="next"] {+ text-align: right;+}++.pagination-links > a:hover,+.pagination-links > a:focus-visible {+ color: var(--accent) !important;+}++.pagination-links > a > svg {+ display: none;+}++.pagination-links > a > span > br {+ display: none;+}++.pagination-links > a > span {+ display: flex;+ flex-direction: column;+ gap: 0.15rem;+}++/* The eyebrow "Previous" / "Next" — small, all caps, muted */+.pagination-links > a > span::first-line {+ font-size: 0.72rem;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ color: var(--ink-faint);+}++/* The page title — restrained body size, display face */+.pagination-links > a .link-title {+ font-family: var(--font-display);+ font-weight: 500;+ font-size: 1.05rem;+ letter-spacing: -0.01em;+ color: var(--ink);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.pagination-links > a:hover .link-title,+.pagination-links > a:focus-visible .link-title {+ color: var(--accent);+}++/* Subtle directional arrow via pseudo-element on the link-title */+.pagination-links > a[rel="prev"] .link-title::before {+ content: "← ";+ color: var(--ink-faint);+ margin-right: 0.1rem;+}++.pagination-links > a[rel="next"] .link-title::after {+ content: " →";+ color: var(--ink-faint);+ margin-left: 0.1rem;+}++.pagination-links > a:hover[rel="prev"] .link-title::before,+.pagination-links > a:hover[rel="next"] .link-title::after {+ color: var(--accent);+}diff --git a/site/tsconfig.json b/site/tsconfig.jsonnew file mode 100644index 000000000..8bf91d3bb--- /dev/null+++ b/site/tsconfig.json@@ -0,0 +1,5 @@+{+ "extends": "astro/tsconfigs/strict",+ "include": [".astro/types.d.ts", "**/*"],+ "exclude": ["dist"]+}diff --git a/tests/api/test_cors_settings.py b/tests/api/test_cors_settings.pyindex 72d64261d..b77ef9928 100644--- a/tests/api/test_cors_settings.py+++ b/tests/api/test_cors_settings.py@@ -35,3 +35,19 @@ def test_cors_requires_explicit_origins_when_auth_enabled(monkeypatch) -> None:assert "https://foo.example.com" in settings["allow_origins"]assert "https://bar.example.com" in settings["allow_origins"]assert settings["allow_origins"].count("https://foo.example.com") == 1+++def test_cors_normalizes_common_origin_input_mistakes(monkeypatch) -> None:+ monkeypatch.setenv("AUTH_ENABLED", "true")+ monkeypatch.setenv(+ "CORS_ORIGIN",+ "172.26.0.10:3782; https://learn.example.com/app/",+ )+ monkeypatch.setenv("CORS_ORIGINS", "http://localhost:3000;api.example.com")++ settings = api_main._build_cors_settings()++ assert settings["allow_origin_regex"] is None+ assert "http://172.26.0.10:3782" in settings["allow_origins"]+ assert "https://learn.example.com" in settings["allow_origins"]+ assert "http://api.example.com" in settings["allow_origins"]diff --git a/tests/api/test_knowledge_zip_upload.py b/tests/api/test_knowledge_zip_upload.pynew file mode 100644index 000000000..f48d50e61--- /dev/null+++ b/tests/api/test_knowledge_zip_upload.py@@ -0,0 +1,95 @@+"""Wiring tests for safe ``.zip`` upload handling in the knowledge router.++The deep security guards live in ``tests/utils/test_archive_extractor.py``;+these check that ``_save_uploaded_files`` routes ``.zip`` uploads through the+safe extractor, registers only supported members, and never persists the+archive itself.+"""++from __future__ import annotations++import io+from pathlib import Path+import zipfile++import pytest++pytest.importorskip("fastapi")+from fastapi import HTTPException, UploadFile++from deeptutor.api.routers.knowledge import _save_uploaded_files++ALLOWED = {".txt", ".md", ".pdf", ".zip"}++[email protected](autouse=True)+def _disable_pocketbase(monkeypatch):+ monkeypatch.setattr("deeptutor.services.pocketbase_client.is_pocketbase_enabled", lambda: False)+++def _zip_upload(filename: str, entries: list[tuple[str, bytes]]) -> UploadFile:+ buf = io.BytesIO()+ with zipfile.ZipFile(buf, "w") as zf:+ for name, data in entries:+ zf.writestr(name, data)+ buf.seek(0)+ return UploadFile(filename=filename, file=buf)+++def test_zip_upload_extracts_only_supported_members(tmp_path: Path) -> None:+ upload = _zip_upload(+ "bundle.zip",+ [+ ("notes.txt", b"hello"),+ ("paper.md", b"# title"),+ ("malware.exe", b"x"), # disallowed -> skipped+ ("inner.zip", b"PK\x03\x04"), # nested archive -> skipped+ ],+ )+ raw = tmp_path / "raw"+ raw.mkdir()++ names, paths = _save_uploaded_files([upload], raw, allowed_extensions=ALLOWED)++ assert sorted(names) == ["notes.txt", "paper.md"]+ assert (raw / "notes.txt").read_bytes() == b"hello"+ # The archive itself is never persisted or registered.+ assert not (raw / "bundle.zip").exists()+ assert all(not p.endswith(".zip") for p in paths)+++def test_zip_upload_with_zip_slip_member_stays_in_target(tmp_path: Path) -> None:+ buf = io.BytesIO()+ with zipfile.ZipFile(buf, "w") as zf:+ zf.writestr(zipfile.ZipInfo("../../escape.txt"), b"x")+ zf.writestr("safe.txt", b"y")+ buf.seek(0)+ upload = UploadFile(filename="evil.zip", file=buf)+ raw = tmp_path / "raw"+ raw.mkdir()++ names, _ = _save_uploaded_files([upload], raw, allowed_extensions=ALLOWED)++ assert sorted(names) == ["escape.txt", "safe.txt"]+ assert (raw / "escape.txt").exists()+ assert not (tmp_path / "escape.txt").exists() # did not escape+++def test_invalid_zip_is_rejected(tmp_path: Path) -> None:+ upload = UploadFile(filename="broken.zip", file=io.BytesIO(b"not a zip"))+ raw = tmp_path / "raw"+ raw.mkdir()++ with pytest.raises(HTTPException) as exc_info:+ _save_uploaded_files([upload], raw, allowed_extensions=ALLOWED)+ assert exc_info.value.status_code == 400+++def test_zip_with_no_supported_members_is_rejected(tmp_path: Path) -> None:+ upload = _zip_upload("only-junk.zip", [("a.exe", b"x"), ("b.sh", b"y")])+ raw = tmp_path / "raw"+ raw.mkdir()++ with pytest.raises(HTTPException) as exc_info:+ _save_uploaded_files([upload], raw, allowed_extensions=ALLOWED)+ assert exc_info.value.status_code == 400diff --git a/tests/api/test_notebook_router.py b/tests/api/test_notebook_router.pyindex a17a28dee..e95951744 100644--- a/tests/api/test_notebook_router.py+++ b/tests/api/test_notebook_router.py@@ -337,3 +337,26 @@ def test_lookup_without_turn_id_falls_back_to_latest(body = resp.json()assert body["turn_id"] == "turn_new"assert body["user_answer"] == "B"+++def test_lookup_missing_entry_returns_404_by_default(store: SQLiteSessionStore) -> None:+ session = asyncio.run(store.create_session())+ sid = session["id"]+ with TestClient(_build_app(store)) as client:+ resp = client.get(+ "/api/v1/question-notebook/entries/lookup/by-question",+ params={"session_id": sid, "question_id": "absent"},+ )+ assert resp.status_code == 404+++def test_lookup_missing_entry_returns_204_when_missing_ok(store: SQLiteSessionStore) -> None:+ session = asyncio.run(store.create_session())+ sid = session["id"]+ with TestClient(_build_app(store)) as client:+ resp = client.get(+ "/api/v1/question-notebook/entries/lookup/by-question",+ params={"session_id": sid, "question_id": "absent", "missing_ok": "true"},+ )+ assert resp.status_code == 204+ assert resp.content == b""diff --git a/tests/api/test_plugins_api_tutorbot.py b/tests/api/test_plugins_api_tutorbot.pynew file mode 100644index 000000000..7f75212c1--- /dev/null+++ b/tests/api/test_plugins_api_tutorbot.py@@ -0,0 +1,122 @@+"""Regression tests for TutorBot-compatible plugin capability streaming."""++from __future__ import annotations++import importlib+import json+import re+from typing import Any++import pytest++try:+ from fastapi import FastAPI+ from fastapi.testclient import TestClient+except Exception: # pragma: no cover+ FastAPI = None+ TestClient = None++pytestmark = pytest.mark.skipif(+ FastAPI is None or TestClient is None, reason="fastapi not installed"+)+++def _events(text: str) -> list[tuple[str, dict[str, Any]]]:+ events: list[tuple[str, dict[str, Any]]] = []+ for block in text.strip().split("\n\n"):+ event = ""+ data = "{}"+ for line in block.splitlines():+ if line.startswith("event: "):+ event = line[len("event: ") :]+ elif line.startswith("data: "):+ data = line[len("data: ") :]+ if event:+ events.append((event, json.loads(data)))+ return events+++def _client_with_fake_tutorbot(monkeypatch):+ from deeptutor.services.tutorbot.manager import BotConfig++ class FakeInstance:+ running = True++ class FakeMgr:+ def __init__(self):+ self.calls: list[dict[str, Any]] = []++ def get_bot(self, bot_id: str):+ return FakeInstance()++ def load_bot_config(self, bot_id: str):+ return BotConfig(name=bot_id)++ async def start_bot(self, bot_id: str, config: BotConfig):+ return FakeInstance()++ async def send_message(self, bot_id: str, content: str, **kwargs):+ self.calls.append({"bot_id": bot_id, "content": content, **kwargs})+ on_progress = kwargs.get("on_progress")+ if on_progress:+ await on_progress("thinking")+ return "streamed answer"++ mgr = FakeMgr()+ tutorbot_router_mod = importlib.import_module("deeptutor.api.routers.tutorbot")+ plugins_router_mod = importlib.import_module("deeptutor.api.routers.plugins_api")+ monkeypatch.setattr(tutorbot_router_mod, "get_tutorbot_manager", lambda: mgr)+ tutorbot_router_mod._start_locks.clear()++ app = FastAPI()+ app.include_router(plugins_router_mod.router, prefix="/api/v1/plugins")+ return TestClient(app), mgr+++def test_plugin_chat_stream_routes_to_specified_tutorbot_session(monkeypatch):+ client, mgr = _client_with_fake_tutorbot(monkeypatch)++ response = client.post(+ "/api/v1/plugins/capabilities/chat/execute-stream",+ json={+ "content": "hi",+ "bot_id": "math-bot",+ "session_id": "lesson-1",+ "enabledTools": [],+ "knowledgeBases": [],+ "language": "zh",+ "llmSelection": {"profile_id": "p-alt", "model_id": "m-alt"},+ },+ )++ assert response.status_code == 200+ events = _events(response.text)+ assert ("session", {"bot_id": "math-bot", "session_id": "lesson-1"}) in events+ assert ("thinking", {"content": "thinking"}) in events+ assert ("content", {"content": "streamed answer"}) in events+ assert ("done", {"bot_id": "math-bot", "session_id": "lesson-1"}) in events+ assert len(mgr.calls) == 1+ call = mgr.calls[0]+ assert call["bot_id"] == "math-bot"+ assert call["content"] == "hi"+ assert call["chat_id"] == "lesson-1"+ assert call["session_id"] == "lesson-1"+ assert callable(call["on_progress"])+++def test_plugin_chat_stream_creates_session_when_missing(monkeypatch):+ client, mgr = _client_with_fake_tutorbot(monkeypatch)++ response = client.post(+ "/api/v1/plugins/capabilities/chat/execute-stream",+ json={"content": "first message", "bot_id": "math-bot"},+ )++ assert response.status_code == 200+ assert "event: done" in response.text+ match = re.search(r'"session_id": "([^"]+)"', response.text)+ assert match is not None+ session_id = match.group(1)+ assert session_id != "web"+ assert mgr.calls[0]["session_id"] == session_id+ assert mgr.calls[0]["chat_id"] == session_iddiff --git a/tests/api/test_sessions_truncation.py b/tests/api/test_sessions_truncation.pynew file mode 100644index 000000000..4ab94ed24--- /dev/null+++ b/tests/api/test_sessions_truncation.py@@ -0,0 +1,84 @@+"""Tests for oversized event-payload truncation in the session GET response.++Covers ``_truncate_oversized_events`` (introduced via PR #524 and refactored to+operate directly on the store's parsed ``events`` list). The session store+returns each message with an ``events`` list and no ``events_json`` key, so the+helper mutates that list in place.+"""++from deeptutor.api.routers.sessions import (+ _TRUNCATION_NOTICE,+ MAX_EVENT_PAYLOAD,+ _truncate_oversized_events,+)+++def _big(n: int) -> str:+ return "x" * n+++def test_truncates_oversized_tool_result_content():+ big = _big(MAX_EVENT_PAYLOAD + 100)+ messages = [{"events": [{"type": "tool_result", "content": big}]}]++ _truncate_oversized_events(messages)++ event = messages[0]["events"][0]+ assert len(event["content"]) == MAX_EVENT_PAYLOAD + len(_TRUNCATION_NOTICE)+ assert event["content"].endswith(_TRUNCATION_NOTICE)+ assert event["_truncated"] is True+++def test_truncates_nested_tool_metadata_fields():+ big = _big(MAX_EVENT_PAYLOAD + 1)+ messages = [+ {+ "events": [+ {+ "type": "observation",+ "content": "short",+ "metadata": {"tool_metadata": {"content": big, "answer": big}},+ }+ ]+ }+ ]++ _truncate_oversized_events(messages)++ tm = messages[0]["events"][0]["metadata"]["tool_metadata"]+ assert tm["content"].endswith(_TRUNCATION_NOTICE)+ assert tm["answer"].endswith(_TRUNCATION_NOTICE)+ assert messages[0]["events"][0]["_truncated"] is True+ # Untouched short top-level content stays intact.+ assert messages[0]["events"][0]["content"] == "short"+++def test_small_payloads_are_left_untouched():+ messages = [+ {"events": [{"type": "tool_result", "content": "tiny"}]},+ {"events": [{"type": "thinking", "content": _big(MAX_EVENT_PAYLOAD + 5)}]},+ ]++ _truncate_oversized_events(messages)++ # Small payload unchanged, no truncation marker added.+ assert messages[0]["events"][0]["content"] == "tiny"+ assert "_truncated" not in messages[0]["events"][0]+ # Non-truncatable event type left alone even when oversized.+ assert "_truncated" not in messages[1]["events"][0]+ assert len(messages[1]["events"][0]["content"]) == MAX_EVENT_PAYLOAD + 5+++def test_handles_messages_without_events_or_malformed_events():+ messages = [+ {"role": "user", "content": "hi"}, # no events key+ {"events": None},+ {"events": "not-a-list"},+ {"events": ["not-a-dict", {"type": "tool_result"}]}, # missing content+ ]++ # Must not raise.+ _truncate_oversized_events(messages)++ # Event with no content gains no spurious content key.+ assert "content" not in messages[3]["events"][1]diff --git a/tests/api/test_settings_router.py b/tests/api/test_settings_router.pyindex 42c638245..d12fdabe0 100644--- a/tests/api/test_settings_router.py+++ b/tests/api/test_settings_router.py@@ -10,6 +10,7 @@ from deeptutor.services.config.provider_runtime import (ResolvedEmbeddingConfig,ResolvedLLMConfig,)+from deeptutor.services.config.runtime_settings import RuntimeSettingsServicefrom deeptutor.services.embedding import client as embedding_client_modulefrom deeptutor.services.embedding import config as embedding_config_modulefrom deeptutor.services.llm import client as llm_client_module@@ -169,6 +170,34 @@ def _patch_runtime()+async def test_network_settings_roundtrip_normalizes_cors_origins(+ monkeypatch: pytest.MonkeyPatch, tmp_path+) -> None:+ service = RuntimeSettingsService(tmp_path / "settings", process_env={})+ service.save_system({"backend_port": 8001, "frontend_port": 3782})+ service.save_auth({"enabled": True, "cookie_secure": True})+ monkeypatch.setattr(settings_router, "get_runtime_settings_service", lambda: service)++ payload = settings_router.NetworkSettingsUpdate(+ backend_port=8101,+ frontend_port=3882,+ public_api_base="https://api.example.com/deeptutor",+ cors_origins=["app.example.com; https://learn.example.com/path"],+ )++ response = await settings_router.update_network_settings(payload)++ assert response["settings"]["backend_port"] == 8101+ assert response["settings"]["public_api_base"] == "https://api.example.com/deeptutor"+ assert response["settings"]["cors_origins"] == [+ "http://app.example.com",+ "https://learn.example.com",+ ]+ assert response["effective"]["cors_mode"] == "explicit"+ assert response["auth"]["cross_site_cookie_ready"] is True++def test_embedding_provider_choices_use_full_endpoint_urls() -> None:embedding = {item["value"]: item for item in settings_router._provider_choices()["embedding"]}@@ -372,3 +401,58 @@ async def test_complete_tour_invalidates_runtime_caches(assert new_llm_client is not old_llm_clientassert new_embedding_client is not old_embedding_clientassert '"status": "completed"' in cache+++async def test_fetch_models_returns_picker_options(monkeypatch: pytest.MonkeyPatch) -> None:+ import deeptutor.services.llm.factory as factory_module++ async def _fake_fetch(binding: str, base_url: str, api_key: str | None = None):+ assert binding == "openai" # "OpenAI" is normalized to lowercase+ assert base_url == "https://api.example.com/v1"+ assert api_key == "sk-x"+ return ["gpt-4o", "gpt-4o-mini"]++ monkeypatch.setattr(factory_module, "fetch_models", _fake_fetch)++ response = await settings_router.fetch_models_from_provider(+ settings_router.FetchModelsPayload(+ binding="OpenAI", base_url="https://api.example.com/v1", api_key="sk-x"+ )+ )++ assert response == {+ "models": [+ {"id": "gpt-4o", "name": "gpt-4o"},+ {"id": "gpt-4o-mini", "name": "gpt-4o-mini"},+ ]+ }+++async def test_fetch_models_requires_base_url() -> None:+ from fastapi import HTTPException++ with pytest.raises(HTTPException) as exc_info:+ await settings_router.fetch_models_from_provider(+ settings_router.FetchModelsPayload(base_url=" ")+ )+ assert exc_info.value.status_code == 400+++async def test_fetch_models_maps_provider_error_to_502(monkeypatch: pytest.MonkeyPatch) -> None:+ from fastapi import HTTPException++ import deeptutor.services.llm.factory as factory_module++ async def _boom(binding: str, base_url: str, api_key: str | None = None):+ raise RuntimeError("connection refused")++ monkeypatch.setattr(factory_module, "fetch_models", _boom)++ with pytest.raises(HTTPException) as exc_info:+ await settings_router.fetch_models_from_provider(+ settings_router.FetchModelsPayload(binding="custom", base_url="https://x/v1")+ )+ assert exc_info.value.status_code == 502diff --git a/tests/api/test_tutorbot_router.py b/tests/api/test_tutorbot_router.pyindex fd1d8f40a..4732f61e9 100644--- a/tests/api/test_tutorbot_router.py+++ b/tests/api/test_tutorbot_router.py@@ -51,6 +51,7 @@ def _make_fake_manager(existing: dict | None = None):"channels": {},"model": None,"llm_selection": None,+ "allow_shell_exec": False,}defaults.update(existing)return BotConfig(**defaults)@@ -63,6 +64,7 @@ def _make_fake_manager(existing: dict | None = None):"channels","model","llm_selection",+ "allow_shell_exec",)def load_bot_config(self, bot_id: str) -> BotConfig | None:@@ -83,6 +85,7 @@ def _make_fake_manager(existing: dict | None = None):"name": config.name,"channels": config.channels,"llm_selection": config.llm_selection,+ "allow_shell_exec": config.allow_shell_exec,"running": True,}return instance@@ -102,6 +105,153 @@ def _make_client(monkeypatch, existing: dict | None = None):return TestClient(app), saved+class TestBotChatHttpApi:+ def test_http_chat_uses_specified_bot_and_session(self, monkeypatch):+ from deeptutor.services.tutorbot.manager import BotConfig++ class FakeInstance:+ running = True++ class FakeMgr:+ def __init__(self):+ self.calls: list[dict[str, Any]] = []++ def get_bot(self, bot_id: str):+ return FakeInstance()++ def load_bot_config(self, bot_id: str):+ return BotConfig(name=bot_id)++ async def start_bot(self, bot_id: str, config: BotConfig):+ return FakeInstance()++ async def send_message(self, bot_id: str, content: str, **kwargs):+ self.calls.append({"bot_id": bot_id, "content": content, **kwargs})+ return "answer"++ mgr = FakeMgr()+ tutorbot_router_mod = importlib.import_module("deeptutor.api.routers.tutorbot")+ monkeypatch.setattr(tutorbot_router_mod, "get_tutorbot_manager", lambda: mgr)+ tutorbot_router_mod._start_locks.clear()++ app = FastAPI()+ app.include_router(tutorbot_router_mod.router, prefix="/api/v1/tutorbot")+ client = TestClient(app)++ response = client.post(+ "/api/v1/tutorbot/math-bot/chat",+ json={"content": "hi", "session_id": "lesson-1"},+ )++ assert response.status_code == 200+ assert response.json() == {+ "bot_id": "math-bot",+ "session_id": "lesson-1",+ "content": "answer",+ }+ assert mgr.calls == [+ {+ "bot_id": "math-bot",+ "content": "hi",+ "chat_id": "lesson-1",+ "session_id": "lesson-1",+ }+ ]++ def test_http_chat_creates_session_when_omitted(self, monkeypatch):+ from deeptutor.services.tutorbot.manager import BotConfig++ class FakeInstance:+ running = True++ class FakeMgr:+ def __init__(self):+ self.calls: list[dict[str, Any]] = []++ def get_bot(self, bot_id: str):+ return FakeInstance()++ def load_bot_config(self, bot_id: str):+ return BotConfig(name=bot_id)++ async def start_bot(self, bot_id: str, config: BotConfig):+ return FakeInstance()++ async def send_message(self, bot_id: str, content: str, **kwargs):+ self.calls.append({"bot_id": bot_id, "content": content, **kwargs})+ return "answer"++ mgr = FakeMgr()+ tutorbot_router_mod = importlib.import_module("deeptutor.api.routers.tutorbot")+ monkeypatch.setattr(tutorbot_router_mod, "get_tutorbot_manager", lambda: mgr)+ tutorbot_router_mod._start_locks.clear()++ app = FastAPI()+ app.include_router(tutorbot_router_mod.router, prefix="/api/v1/tutorbot")+ client = TestClient(app)++ response = client.post("/api/v1/tutorbot/math-bot/chat", json={"content": "hi"})++ assert response.status_code == 200+ body = response.json()+ assert body["bot_id"] == "math-bot"+ assert body["content"] == "answer"+ assert body["session_id"]+ assert body["session_id"] != "web"+ assert mgr.calls == [+ {+ "bot_id": "math-bot",+ "content": "hi",+ "chat_id": body["session_id"],+ "session_id": body["session_id"],+ }+ ]++ def test_http_chat_stream_emits_sse_events(self, monkeypatch):+ from deeptutor.services.tutorbot.manager import BotConfig++ class FakeInstance:+ running = True++ class FakeMgr:+ def get_bot(self, bot_id: str):+ return FakeInstance()++ def load_bot_config(self, bot_id: str):+ return BotConfig(name=bot_id)++ async def start_bot(self, bot_id: str, config: BotConfig):+ return FakeInstance()++ async def send_message(self, bot_id: str, content: str, **kwargs):+ on_progress = kwargs.get("on_progress")+ if on_progress:+ await on_progress("thinking")+ return "streamed answer"++ tutorbot_router_mod = importlib.import_module("deeptutor.api.routers.tutorbot")+ monkeypatch.setattr(tutorbot_router_mod, "get_tutorbot_manager", lambda: FakeMgr())+ tutorbot_router_mod._start_locks.clear()++ app = FastAPI()+ app.include_router(tutorbot_router_mod.router, prefix="/api/v1/tutorbot")+ client = TestClient(app)++ response = client.post(+ "/api/v1/tutorbot/math-bot/chat/execute-stream",+ json={"content": "hi", "session_id": "lesson-1"},+ )++ assert response.status_code == 200+ body = response.text+ assert "event: session" in body+ assert '"session_id": "lesson-1"' in body+ assert "event: thinking" in body+ assert "event: content" in body+ assert "streamed answer" in body+ assert "event: done" in body++def _catalog_with_llm_options() -> dict[str, Any]:return {"version": 1,@@ -295,6 +445,28 @@ class TestCreateBotExplicitClearSemantics:assert cfg.model == "gpt-4o"assert cfg.llm_selection == {"profile_id": "p-default", "model_id": "m-default"}+ def test_shell_exec_setting_is_preserved_when_omitted(self, monkeypatch):+ client, saved = _make_client(+ monkeypatch,+ existing={"allow_shell_exec": True},+ )++ resp = client.post("/api/v1/tutorbot", json={"bot_id": "my-bot", "name": "New"})++ assert resp.status_code == 200+ assert saved["config"].allow_shell_exec is True++ def test_shell_exec_cannot_be_enabled_from_router_payload(self, monkeypatch):+ client, saved = _make_client(monkeypatch, existing=None)++ resp = client.post(+ "/api/v1/tutorbot",+ json={"bot_id": "my-bot", "allow_shell_exec": True},+ )++ assert resp.status_code == 200+ assert saved["config"].allow_shell_exec is False+def test_null_field_in_payload_falls_back_to_existing(self, monkeypatch):"""Explicit ``null`` for an optional field is treated as 'not provided'.diff --git a/tests/api/test_unified_ws_turn_runtime.py b/tests/api/test_unified_ws_turn_runtime.pyindex fb2fb83f3..f90513f82 100644--- a/tests/api/test_unified_ws_turn_runtime.py+++ b/tests/api/test_unified_ws_turn_runtime.py@@ -70,6 +70,15 @@ async def test_turn_runtime_replays_events_and_materializes_messages(store = SQLiteSessionStore(tmp_path / "chat_history.db")runtime = TurnRuntimeManager(store)captured: dict[str, object] = {}+ original_publish = runtime._publish_live_event++ async def publish_with_status_capture(execution, event):+ if event.type == StreamEventType.DONE:+ persisted_turn = await store.get_turn(execution.turn_id)+ captured["turn_status_when_done_published"] = (persisted_turn or {}).get("status")+ return await original_publish(execution, event)++ monkeypatch.setattr(runtime, "_publish_live_event", publish_with_status_capture)class FakeContextBuilder:def __init__(self, *_args, **_kwargs) -> None:@@ -163,6 +172,7 @@ async def test_turn_runtime_replays_events_and_materializes_messages(]done_event = next(e for e in events if e["type"] == "done")assert done_event["metadata"]["status"] == "completed"+ assert captured["turn_status_when_done_published"] == "completed"detail = await store.get_session_with_messages(session["id"])assert detail is not Nonediff --git a/tests/cli/test_init_wizard_probe.py b/tests/cli/test_init_wizard_probe.pynew file mode 100644index 000000000..b71ef907a--- /dev/null+++ b/tests/cli/test_init_wizard_probe.py@@ -0,0 +1,76 @@+from __future__ import annotations++from types import SimpleNamespace+++class _FakeClient:+ captured: list[dict] = []++ def __init__(self, *, timeout: float):+ self.timeout = timeout++ def __enter__(self):+ return self++ def __exit__(self, *_args):+ return None++ def post(self, url: str, *, headers: dict, json: dict):+ self.captured.append({"url": url, "headers": headers, "json": json})+ return SimpleNamespace(status_code=200, text="")+++def test_probe_llm_uses_max_completion_tokens_for_gpt5(monkeypatch) -> None:+ from deeptutor_cli import init_wizard++ _FakeClient.captured = []+ monkeypatch.setattr(init_wizard.httpx, "Client", _FakeClient)++ ok, _elapsed_ms, error = init_wizard.probe_llm(+ base_url="https://example.test/v1",+ api_key="sk-test",+ binding="openai",+ model="gpt-5-mini",+ )++ assert ok is True+ assert error == ""+ body = _FakeClient.captured[0]["json"]+ assert body["max_completion_tokens"] == 1+ assert "max_tokens" not in body+++def test_probe_llm_keeps_max_tokens_for_legacy_chat_models(monkeypatch) -> None:+ from deeptutor_cli import init_wizard++ _FakeClient.captured = []+ monkeypatch.setattr(init_wizard.httpx, "Client", _FakeClient)++ init_wizard.probe_llm(+ base_url="https://example.test/v1",+ api_key="sk-test",+ binding="openai",+ model="gpt-3.5-turbo",+ )++ body = _FakeClient.captured[0]["json"]+ assert body["max_tokens"] == 1+ assert "max_completion_tokens" not in body+++def test_probe_llm_keeps_anthropic_native_max_tokens(monkeypatch) -> None:+ from deeptutor_cli import init_wizard++ _FakeClient.captured = []+ monkeypatch.setattr(init_wizard.httpx, "Client", _FakeClient)++ init_wizard.probe_llm(+ base_url="https://api.anthropic.test/v1",+ api_key="sk-test",+ binding="anthropic",+ model="claude-sonnet-4",+ )++ body = _FakeClient.captured[0]["json"]+ assert body["max_tokens"] == 1+ assert "max_completion_tokens" not in bodydiff --git a/tests/core/test_agentic_client_provider_kwargs.py b/tests/core/test_agentic_client_provider_kwargs.pyindex 7088b895c..b9bebe53a 100644--- a/tests/core/test_agentic_client_provider_kwargs.py+++ b/tests/core/test_agentic_client_provider_kwargs.py@@ -1,6 +1,15 @@from __future__ import annotations-from deeptutor.core.agentic.client import build_completion_kwargs+import pytest++from deeptutor.core.agentic.client import (+ LLMClientConfig,+ _AnthropicOpenAIAdapter,+ build_completion_kwargs,+ build_openai_client,+ can_use_native_tool_calling,+)+from deeptutor.services.llm.provider_core.base import LLMResponse, ToolCallRequestdef test_agentic_kwargs_disable_deepseek_flash_thinking_by_default() -> None:@@ -41,6 +50,32 @@ def test_agentic_kwargs_use_provider_minimal_thinking_without_top_level_effort()assert kwargs["extra_body"] == {"thinking": {"type": "disabled"}}+def test_agentic_kwargs_enable_qwen_thinking_for_custom_binding() -> None:+ kwargs = build_completion_kwargs(+ temperature=0.7,+ model="qwen3.6-plus",+ max_tokens=1024,+ binding="custom",+ )++ assert kwargs["max_tokens"] == 1024+ assert "reasoning_effort" not in kwargs+ assert kwargs["extra_body"] == {"enable_thinking": True}+++def test_agentic_kwargs_disable_qwen_thinking_for_custom_minimal_reasoning() -> None:+ kwargs = build_completion_kwargs(+ temperature=0.7,+ model="Qwen/Qwen3-235B-A22B-Instruct",+ max_tokens=1024,+ binding="custom",+ reasoning_effort="minimal",+ )++ assert "reasoning_effort" not in kwargs+ assert kwargs["extra_body"] == {"enable_thinking": False}++def test_agentic_kwargs_preserve_legacy_shape_without_binding() -> None:kwargs = build_completion_kwargs(temperature=0.2,@@ -49,3 +84,120 @@ def test_agentic_kwargs_preserve_legacy_shape_without_binding() -> None:)assert kwargs == {"temperature": 0.2, "max_tokens": 256}+++def test_build_openai_client_routes_anthropic_backend_through_adapter(monkeypatch) -> None:+ captured = {}++ class FakeProvider:+ def __init__(self, **kwargs):+ captured.update(kwargs)++ monkeypatch.setattr(+ "deeptutor.services.llm.provider_core.AnthropicProvider",+ FakeProvider,+ )++ client = build_openai_client(+ LLMClientConfig(+ binding="custom_anthropic",+ model="claude-test",+ api_key="sk-test",+ base_url="https://anthropic.example/v1",+ extra_headers={"X-Test": "1"},+ )+ )++ assert isinstance(client, _AnthropicOpenAIAdapter)+ assert captured["api_key"] == "sk-test"+ assert captured["api_base"] == "https://anthropic.example/v1"+ assert captured["default_model"] == "claude-test"+ assert captured["extra_headers"] == {"X-Test": "1"}+++def test_anthropic_backend_can_use_native_tool_calling() -> None:+ assert can_use_native_tool_calling(binding="custom_anthropic", model="claude-test") is True+ assert can_use_native_tool_calling(binding="minimax_anthropic", model="MiniMax-M2") is True+++def test_custom_qwen_can_use_native_tool_calling() -> None:+ assert can_use_native_tool_calling(binding="custom", model="qwen3.6-plus") is True+ assert can_use_native_tool_calling(binding="dashscope", model="qwen-plus") is True+++async def test_anthropic_adapter_streams_openai_style_chunks() -> None:+ captured = {}++ class FakeProvider:+ async def chat_stream(self, **kwargs):+ captured.update(kwargs)+ await kwargs["on_content_delta"]("``FINISH``\n")+ await kwargs["on_content_delta"]("done")+ return LLMResponse(+ content="``FINISH``\ndone",+ finish_reason="stop",+ usage={"prompt_tokens": 2, "completion_tokens": 3, "total_tokens": 5},+ )++ client = _AnthropicOpenAIAdapter(FakeProvider())+ stream = await client.chat.completions.create(+ model="claude-test",+ messages=[{"role": "user", "content": "hello"}],+ stream=True,+ max_completion_tokens=12,+ temperature=0.2,+ )++ chunks = [chunk async for chunk in stream]++ assert [chunk.choices[0].delta.content for chunk in chunks[:2]] == [+ "``FINISH``\n",+ "done",+ ]+ assert chunks[-1].choices[0].finish_reason == "stop"+ assert chunks[-1].usage["total_tokens"] == 5+ assert captured["max_tokens"] == 12+ assert captured["temperature"] == 0.2+++async def test_anthropic_adapter_emits_final_tool_call_delta() -> None:+ class FakeProvider:+ async def chat_stream(self, **kwargs):+ return LLMResponse(+ content="``TOOL``",+ tool_calls=[+ ToolCallRequest(+ id="toolu_123",+ name="read_file",+ arguments={"path": "SOUL.md"},+ )+ ],+ finish_reason="tool_calls",+ )++ client = _AnthropicOpenAIAdapter(FakeProvider())+ stream = await client.chat.completions.create(+ model="claude-test",+ messages=[{"role": "user", "content": "read"}],+ stream=True,+ max_tokens=8,+ tools=[+ {+ "type": "function",+ "function": {+ "name": "read_file",+ "parameters": {"type": "object", "properties": {}},+ },+ }+ ],+ )++ chunks = [chunk async for chunk in stream]+ tool_delta = chunks[-2].choices[0].delta.tool_calls[0]++ assert tool_delta.id == "toolu_123"+ assert tool_delta.function.name == "read_file"+ assert '"SOUL.md"' in tool_delta.function.arguments+ assert chunks[-1].choices[0].finish_reason == "tool_calls"diff --git a/tests/core/test_labeled_step_image_fallback.py b/tests/core/test_labeled_step_image_fallback.pynew file mode 100644index 000000000..de00f025d--- /dev/null+++ b/tests/core/test_labeled_step_image_fallback.py@@ -0,0 +1,163 @@+"""Stage-2 image fallback on the chat agentic path (``run_labeled_step``).++When a model rejects image content and is not in the known-vision allowlist,+the labeled step strips the images in place and retries text-only instead of+hard-failing the turn. Known-vision models keep their images so the real error+propagates.+"""++from __future__ import annotations++import asyncio+from types import SimpleNamespace+from typing import Any++import pytest++from deeptutor.core.agentic.labeled_step import run_labeled_step+from deeptutor.core.stream import StreamEventType+from deeptutor.core.stream_bus import StreamBus+from deeptutor.services.llm.multimodal import has_image_parts+++def _chunk(content: str | None = None) -> SimpleNamespace:+ return SimpleNamespace(+ choices=[+ SimpleNamespace(+ delta=SimpleNamespace(content=content, tool_calls=None),+ finish_reason=None,+ )+ ],+ usage=None,+ )+++async def _async_stream(chunks: list[SimpleNamespace]):+ for chunk in chunks:+ yield chunk+++class _ImageRejectingClient:+ """Raises an image-rejection error whenever the request carries images."""++ def __init__(self, chunks: list[SimpleNamespace]) -> None:+ self.calls: list[dict[str, Any]] = []+ self._chunks = chunks++ class _Completions:+ def __init__(self, parent: _ImageRejectingClient) -> None:+ self.parent = parent++ async def create(self, **kwargs: Any):+ messages = kwargs.get("messages") or []+ had_image = has_image_parts(messages)+ self.parent.calls.append({"had_image": had_image})+ if had_image:+ raise RuntimeError("Provider error: this model does not support image input")+ return _async_stream(self.parent._chunks)++ class _Chat:+ def __init__(self, parent: _ImageRejectingClient) -> None:+ self.completions = _Completions(parent)++ self.chat = _Chat(self)+++def _image_messages() -> list[dict[str, Any]]:+ return [+ {+ "role": "user",+ "content": [+ {"type": "text", "text": "what is this"},+ {"type": "image_url", "image_url": {"url": "data:image/png;base64,QUJD"}},+ ],+ }+ ]+++async def _collect_events(bus: StreamBus, fn) -> tuple[list[Any], Any]:+ events: list[Any] = []++ async def _consume() -> None:+ async for event in bus.subscribe():+ events.append(event)++ consumer = asyncio.create_task(_consume())+ await asyncio.sleep(0)+ try:+ result = await fn()+ finally:+ await bus.close()+ await consumer+ return events, result+++async def test_retries_without_images_for_non_vision_model() -> None:+ client = _ImageRejectingClient([_chunk("``FINISH``\nOK")])+ bus = StreamBus()+ messages = _image_messages()++ async def _run():+ return await run_labeled_step(+ client=client,+ model="moonshot-v1-8k", # not in the known-vision allowlist+ binding="moonshot",+ messages=messages,+ completion_kwargs={},+ tool_schemas=None,+ allowed_labels=("FINISH", "TOOL", "THINK", "PAUSE"),+ final_labels=frozenset({"FINISH"}),+ tool_label="TOOL",+ stream=bus,+ source="chat",+ stage="responding",+ iter_meta={"label": "Reasoning", "trace_id": "iter-1"},+ )++ events, result = await _collect_events(bus, _run)++ assert result.label == "FINISH"+ assert result.text == "OK"+ # First attempt carried the image; the retry did not.+ assert [c["had_image"] for c in client.calls] == [True, False]+ # The strip persists on the shared message list (no re-send next iteration).+ assert has_image_parts(messages) is False+ warnings = [+ event+ for event in events+ if event.type == StreamEventType.PROGRESS+ and (event.metadata or {}).get("image_fallback") is True+ ]+ assert warnings+++async def test_known_vision_model_propagates_error_without_stripping() -> None:+ client = _ImageRejectingClient([_chunk("``FINISH``\nOK")])+ bus = StreamBus()+ messages = _image_messages()++ async def _run():+ return await run_labeled_step(+ client=client,+ model="gpt-4o", # known vision-capable → do not degrade+ binding="openai",+ messages=messages,+ completion_kwargs={},+ tool_schemas=None,+ allowed_labels=("FINISH", "TOOL", "THINK", "PAUSE"),+ final_labels=frozenset({"FINISH"}),+ tool_label="TOOL",+ stream=bus,+ source="chat",+ stage="responding",+ iter_meta={"label": "Reasoning", "trace_id": "iter-1"},+ )++ with pytest.raises(RuntimeError, match="image input"):+ await _collect_events(bus, _run)++ # Only one attempt; images were never stripped.+ assert [c["had_image"] for c in client.calls] == [True]+ assert has_image_parts(messages) is Truediff --git a/tests/multi_user/test_resource_isolation.py b/tests/multi_user/test_resource_isolation.pynew file mode 100644index 000000000..368ca308a--- /dev/null+++ b/tests/multi_user/test_resource_isolation.py@@ -0,0 +1,29 @@+from __future__ import annotations+++def test_book_session_and_tutorbot_ids_are_scoped_per_user(as_user) -> None:+ from deeptutor.book.storage import BookStorage+ from deeptutor.services.session import get_sqlite_session_store, get_turn_runtime_manager+ from deeptutor.services.tutorbot.manager import TutorBotManager++ tutorbot_manager = TutorBotManager()+ shared_book_id = "shared-book-id"++ with as_user("u_victim"):+ victim_book_root = BookStorage().book_root(shared_book_id)+ victim_session_db = get_sqlite_session_store().db_path+ victim_runtime_store_db = get_turn_runtime_manager().store.db_path+ victim_tutorbot_dir = tutorbot_manager._tutorbot_dir++ with as_user("u_attacker"):+ attacker_book_root = BookStorage().book_root(shared_book_id)+ attacker_session_db = get_sqlite_session_store().db_path+ attacker_runtime_store_db = get_turn_runtime_manager().store.db_path+ attacker_tutorbot_dir = tutorbot_manager._tutorbot_dir++ assert victim_book_root != attacker_book_root+ assert victim_session_db != attacker_session_db+ assert victim_runtime_store_db != attacker_runtime_store_db+ assert victim_tutorbot_dir != attacker_tutorbot_dir+ assert "u_victim" in str(victim_book_root)+ assert "u_attacker" in str(attacker_book_root)diff --git a/tests/services/config/test_runtime_settings.py b/tests/services/config/test_runtime_settings.pyindex 4cc84625e..59988430c 100644--- a/tests/services/config/test_runtime_settings.py+++ b/tests/services/config/test_runtime_settings.py@@ -12,6 +12,7 @@ RUNTIME_ENV_KEYS = ("BACKEND_PORT","FRONTEND_PORT","NEXT_PUBLIC_API_BASE_EXTERNAL",+ "PUBLIC_API_BASE","NEXT_PUBLIC_API_BASE","CORS_ORIGIN","CORS_ORIGINS",@@ -109,6 +110,27 @@ def test_render_environment_uses_json_backed_runtime_names(monkeypatch, tmp_pathassert "AUTH_SECRET" not in env+def test_system_settings_accept_public_api_base_alias_and_normalize_origins(+ monkeypatch, tmp_path: Path+) -> None:+ _clear_runtime_env(monkeypatch)+ service = RuntimeSettingsService(tmp_path / "settings")++ system = service.save_system(+ {+ "public_api_base": "https://api.example.com/base",+ "cors_origins": "app.example.com; https://learn.example.com/path",+ }+ )++ assert system["next_public_api_base_external"] == "https://api.example.com/base"+ assert system["cors_origins"] == [+ "http://app.example.com",+ "https://learn.example.com",+ ]+ assert "public_api_base" not in _read_json(service.path_for("system"))++def test_exported_environment_does_not_become_runtime_override(monkeypatch, tmp_path: Path) -> None:_clear_runtime_env(monkeypatch)diff --git a/tests/services/llm/test_capabilities.py b/tests/services/llm/test_capabilities.pyindex 2452b2a69..93296fbc5 100644--- a/tests/services/llm/test_capabilities.py+++ b/tests/services/llm/test_capabilities.py@@ -65,6 +65,12 @@ def test_minimax_openai_compat_supports_tools_without_response_format() -> None:assert supports_response_format("minimax", "MiniMax-M2.7-highspeed") is False+def test_custom_and_dashscope_openai_compat_support_native_tools_for_qwen() -> None:+ assert supports_tools("custom", "qwen3.6-plus") is True+ assert supports_tools("dashscope", "qwen-plus") is True+ assert has_thinking_tags("custom", "qwen3.6-plus") is True++def test_qwen_model_override_enables_vision() -> None:assert supports_vision("dashscope", "qwen-vl-plus") is Trueassert supports_vision("openai", "qwen2.5-vl-72b-instruct") is Truediff --git a/tests/services/llm/test_multimodal.py b/tests/services/llm/test_multimodal.pyindex 2fa6f37e7..deb68c303 100644--- a/tests/services/llm/test_multimodal.py+++ b/tests/services/llm/test_multimodal.py@@ -1,5 +1,14 @@-"""Tests for multimodal message preparation, including the-``vision_url_supported`` capability bit (Plan B).+"""Tests for the two-stage multimodal pipeline.++Stage 1 (:func:`prepare_multimodal_messages`) injects image attachments for+*every* provider/model — there is no ``supports_vision`` pre-flight gate. It+only resolves URL→base64 where the provider's *format* requires it and drops+url-only images it cannot encode (``url_images_dropped``).++Stage 2 (:func:`should_degrade_to_text` + :func:`strip_image_parts*`) is the+post-failure fallback: applied at each call site's retry seam, it strips images+and retries text-only only when the model is *not* in the known-vision+allowlist."""from __future__ import annotations@@ -10,8 +19,13 @@ from urllib.parse import quoteimport pytest-from deeptutor.services.llm import multimodal as mm-from deeptutor.services.llm.multimodal import prepare_multimodal_messages+from deeptutor.services.llm.multimodal import (+ has_image_parts,+ prepare_multimodal_messages,+ should_degrade_to_text,+ strip_image_parts,+ strip_image_parts_inplace,+)from deeptutor.services.storage import attachment_store@@ -25,12 +39,14 @@ def _img_part_url(message: dict) -> str:return img["image_url"]["url"]+# ---------------------------------------------------------------------------+# Stage 1: optimistic injection+# ---------------------------------------------------------------------------def test_openai_compat_passes_url_through() -> None:"""OpenAI-compatible providers (default vision_url_supported=True) acceptURL-form image_url blocks unchanged."""att = SimpleNamespace(type="image", url="https://example.com/cat.png", base64="")result = prepare_multimodal_messages(_msgs(), [att], binding="openai", model="gpt-4o")- assert result.images_stripped is Falseassert result.url_images_dropped == 0assert _img_part_url(result.messages[0]) == "https://example.com/cat.png"@@ -48,16 +64,35 @@ def test_openai_compat_prefers_base64_when_both_present() -> None:assert url.startswith("data:image/png;base64,QUJD")+def test_unknown_provider_still_injects_images() -> None:+ """Regression for the Doubao/VolcEngine bug: a provider with no capability+ entry (``supports_vision`` defaults False) must STILL receive the image —+ Stage 1 never gates on the capability flag."""+ att = SimpleNamespace(type="image", base64="QUJD", mime_type="image/png")+ result = prepare_multimodal_messages(+ _msgs(), [att], binding="some-unregistered-provider", model="doubao-1.5-vision-pro"+ )+ assert _img_part_url(result.messages[0]).startswith("data:image/png;base64,QUJD")+++def test_text_only_model_still_injects_images() -> None:+ """A plain Moonshot text model no longer strips images at Stage 1 — the+ image is injected optimistically; degrade happens later via Stage 2."""+ att = SimpleNamespace(type="image", base64="QUJD", mime_type="image/png")+ result = prepare_multimodal_messages(_msgs(), [att], binding="moonshot", model="moonshot-v1-8k")+ assert _img_part_url(result.messages[0]).startswith("data:image/png;base64,QUJD")+++# ---------------------------------------------------------------------------+# Stage 1: URL→base64 format resolution (unchanged behaviour)+# ---------------------------------------------------------------------------def test_moonshot_kimi_drops_external_url_only_attachment(caplog) -> None:"""Moonshot rejects URL-form image_url; an external url-only attachment- cannot be resolved locally and must be dropped."""+ cannot be resolved locally and must be dropped (a *format* drop, not a+ capability gate)."""att = SimpleNamespace(type="image", url="https://example.com/cat.png", base64="")with caplog.at_level("WARNING"):result = prepare_multimodal_messages(_msgs(), [att], binding="moonshot", model="kimi-k2.6")- # Vision is supported (k2.6 is a vision model), but the url couldn't be- # inlined → image part is omitted, drop counter increments.- assert result.vision_supported is True- assert result.images_stripped is Falseassert result.url_images_dropped == 1parts = result.messages[0]["content"]assert not any(p.get("type") == "image_url" for p in parts)@@ -91,7 +126,7 @@ def test_moonshot_kimi_resolves_local_attachment_url(tmp_path, monkeypatch) -> Ndef test_anthropic_url_only_attachment_is_dropped_not_sent_empty(caplog) -> None:"""Previously the Anthropic path silently emitted an empty base64 source.- Now url-only attachments without local resolution are dropped instead."""+ url-only attachments without local resolution are dropped instead."""att = SimpleNamespace(type="image", url="https://example.com/cat.png", base64="")with caplog.at_level("WARNING"):result = prepare_multimodal_messages(@@ -99,17 +134,59 @@ def test_anthropic_url_only_attachment_is_dropped_not_sent_empty(caplog) -> None)assert result.url_images_dropped == 1parts = result.messages[0]["content"]- # No "image" block with empty data leaked throughfor p in parts:if p.get("type") == "image":data = p.get("source", {}).get("data", "")assert data, "Anthropic image part must not have empty base64"-def test_text_only_moonshot_model_strips_images() -> None:- """A plain Moonshot text model still falls through the supports_vision- gate and strips images entirely, unaffected by vision_url_supported."""- att = SimpleNamespace(type="image", base64="QUJD", mime_type="image/png")- result = prepare_multimodal_messages(_msgs(), [att], binding="moonshot", model="moonshot-v1-8k")- assert result.images_stripped is True- assert result.vision_supported is False+# ---------------------------------------------------------------------------+# Stage 2: fallback decision + stripping+# ---------------------------------------------------------------------------+def _img_messages() -> list[dict]:+ return [+ {+ "role": "user",+ "content": [+ {"type": "text", "text": "what is this"},+ {"type": "image_url", "image_url": {"url": "data:image/png;base64,QUJD"}},+ ],+ }+ ]+++def test_should_degrade_only_for_non_vision_model_with_images() -> None:+ msgs = _img_messages()+ # Not in the known-vision allowlist → degrade to text on failure.+ assert should_degrade_to_text("moonshot", "moonshot-v1-8k", msgs) is True+ # Known vision-capable model → keep images, surface the real error.+ assert should_degrade_to_text("openai", "gpt-4o", msgs) is False+ # An allowlisted provider (VolcEngine) is trusted even for a model we have+ # no per-model entry for.+ assert should_degrade_to_text("volcengine", "doubao-1.5-vision-pro", msgs) is False+++def test_should_degrade_is_false_without_images() -> None:+ text_only = [{"role": "user", "content": "hi"}]+ assert should_degrade_to_text("moonshot", "moonshot-v1-8k", text_only) is False+++def test_strip_image_parts_inplace_mutates_and_reports() -> None:+ msgs = _img_messages()+ assert has_image_parts(msgs) is True+ changed = strip_image_parts_inplace(msgs)+ assert changed is True+ assert has_image_parts(msgs) is False+ # The text block survives; the image becomes a placeholder.+ types = [p["type"] for p in msgs[0]["content"]]+ assert types == ["text", "text"]+ # No-op on a message list without images.+ assert strip_image_parts_inplace([{"role": "user", "content": "hi"}]) is False+++def test_strip_image_parts_returns_new_list_without_mutating() -> None:+ msgs = _img_messages()+ stripped = strip_image_parts(msgs)+ assert has_image_parts(stripped) is False+ # Original is untouched (new-list variant).+ assert has_image_parts(msgs) is Truediff --git a/tests/services/llm/test_openai_compat_reasoning_content.py b/tests/services/llm/test_openai_compat_reasoning_content.pyindex b9e4320dc..e91725076 100644--- a/tests/services/llm/test_openai_compat_reasoning_content.py+++ b/tests/services/llm/test_openai_compat_reasoning_content.py@@ -136,6 +136,17 @@ def test_services_dashscope_minimal_reasoning_uses_enable_thinking_only() -> Nonassert kwargs["extra_body"] == {"enable_thinking": False}+def test_services_custom_qwen_enables_thinking_without_top_level_effort() -> None:+ kwargs = _build_services_kwargs(+ "custom",+ None,+ model="qwen3.6-plus",+ )++ assert "reasoning_effort" not in kwargs+ assert kwargs["extra_body"] == {"enable_thinking": True}++def test_tutorbot_provider_minimal_reasoning_uses_extra_body_only() -> None:kwargs = _build_tutorbot_kwargs("deepseek", "minimal")@@ -152,3 +163,14 @@ def test_tutorbot_deepseek_v4_flash_disables_thinking_by_default() -> None:assert "reasoning_effort" not in kwargsassert kwargs["extra_body"] == {"thinking": {"type": "disabled"}}+++def test_tutorbot_custom_qwen_enables_thinking_without_top_level_effort() -> None:+ kwargs = _build_tutorbot_kwargs(+ "custom",+ None,+ model="Qwen/Qwen3-235B-A22B-Instruct",+ )++ assert "reasoning_effort" not in kwargs+ assert kwargs["extra_body"] == {"enable_thinking": True}diff --git a/tests/services/llm/test_provider_core_image_fallback.py b/tests/services/llm/test_provider_core_image_fallback.pynew file mode 100644index 000000000..2d3f9d549--- /dev/null+++ b/tests/services/llm/test_provider_core_image_fallback.py@@ -0,0 +1,80 @@+"""Stage-2 image fallback gating in ``provider_core.base.LLMProvider``.++The factory passes ``allow_image_fallback = not supports_vision(...)``. When+True (model not in the known-vision allowlist) a non-transient failure that+carried images is retried text-only; when False (known vision-capable) the+images are kept and the real error surfaces.+"""++from __future__ import annotations++from typing import Any++import pytest++from deeptutor.services.llm.multimodal import has_image_parts+from deeptutor.services.llm.provider_core.base import LLMProvider, LLMResponse+++def _image_messages() -> list[dict[str, Any]]:+ return [+ {+ "role": "user",+ "content": [+ {"type": "text", "text": "what is this"},+ {"type": "image_url", "image_url": {"url": "data:image/png;base64,QUJD"}},+ ],+ }+ ]+++class _ScriptedProvider(LLMProvider):+ """Returns queued responses and records whether each call carried images."""++ def __init__(self, responses: list[LLMResponse]) -> None:+ super().__init__()+ self._responses = list(responses)+ self.calls_had_image: list[bool] = []++ async def chat(self, messages: list[dict[str, Any]], **kwargs: Any) -> LLMResponse:+ self.calls_had_image.append(has_image_parts(messages))+ return self._responses.pop(0)++ def get_default_model(self) -> str:+ return "test-model"+++async def test_strips_images_and_retries_when_fallback_allowed() -> None:+ provider = _ScriptedProvider(+ [+ LLMResponse(content="this model does not support images", finish_reason="error"),+ LLMResponse(content="ok", finish_reason="stop"),+ ]+ )+ messages = _image_messages()++ resp = await provider.chat_with_retry(+ messages=messages, model="m", retry_delays=(), allow_image_fallback=True+ )++ assert resp.content == "ok"+ # First attempt carried images; the retry was text-only.+ assert provider.calls_had_image == [True, False]+ # Success persists: the shared message list no longer carries images.+ assert has_image_parts(messages) is False+++async def test_keeps_images_and_surfaces_error_when_fallback_disabled() -> None:+ provider = _ScriptedProvider([LLMResponse(content="bad request (400)", finish_reason="error")])+ messages = _image_messages()++ resp = await provider.chat_with_retry(+ messages=messages, model="gpt-4o", retry_delays=(), allow_image_fallback=False+ )++ assert resp.finish_reason == "error"+ # Exactly one call — no strip-and-retry — and images are preserved.+ assert provider.calls_had_image == [True]+ assert has_image_parts(messages) is Truediff --git a/tests/services/rag/test_llamaindex_ingestion.py b/tests/services/rag/test_llamaindex_ingestion.pynew file mode 100644index 000000000..a24ad1280--- /dev/null+++ b/tests/services/rag/test_llamaindex_ingestion.py@@ -0,0 +1,31 @@+from __future__ import annotations++from llama_index.core import Document+from llama_index.core.schema import TextNode+++def test_documents_do_not_bypass_chunking_pipeline(monkeypatch) -> None:+ from deeptutor.services.rag.pipelines.llamaindex import ingestion++ captured: dict[str, object] = {}++ class FakePipeline:+ def run(self, *, documents, show_progress):+ captured["documents"] = list(documents)+ captured["show_progress"] = show_progress+ return [f"chunked:{type(item).__name__}" for item in documents]++ monkeypatch.setattr(ingestion, "build_ingestion_pipeline", lambda: FakePipeline())++ llama_document = Document(text="long document text")+ embedded_node = TextNode(text="already embedded", embedding=[0.1, 0.2])+ plain_node = TextNode(text="node without embedding")++ nodes = ingestion.documents_to_nodes(+ [llama_document, embedded_node, plain_node],+ show_progress=False,+ )++ assert captured["documents"] == [llama_document, plain_node]+ assert captured["show_progress"] is False+ assert nodes == ["chunked:Document", "chunked:TextNode", embedded_node]diff --git a/tests/services/tutorbot/test_manager_config.py b/tests/services/tutorbot/test_manager_config.pyindex b2b9c0509..0af0cdd9b 100644--- a/tests/services/tutorbot/test_manager_config.py+++ b/tests/services/tutorbot/test_manager_config.py@@ -15,15 +15,23 @@ from deeptutor.services.tutorbot.model_runtime import resolve_tutorbot_llm_confi@pytest.fixture-def manager(tmp_path: Path) -> TutorBotManager:- """Return a TutorBotManager whose data dir is a fresh temp directory."""- mgr = TutorBotManager()- # Replace the path service with a stub so reads/writes stay sandboxed.- mgr._path_service = SimpleNamespace( # type: ignore[assignment]+def manager(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> TutorBotManager:+ """Return a TutorBotManager whose data dir is a fresh temp directory.++ ``TutorBotManager._path_service`` is a read-only property that returns the+ global singleton, so reads/writes are sandboxed by patching the factory it+ reads from (mirrors tests/services/tutorbot/test_shell_exec_security.py).+ """+ path_service = SimpleNamespace(project_root=tmp_path,+ workspace_root=tmp_path,get_memory_dir=lambda: tmp_path / "memory",)- return mgr+ monkeypatch.setattr(+ "deeptutor.services.tutorbot.manager.get_path_service",+ lambda: path_service,+ )+ return TutorBotManager()def _append_session_line(manager: TutorBotManager, bot_id: str, payload: dict) -> None:@@ -162,6 +170,17 @@ class TestMessageHistory:assert recent[0]["last_message"] == "look [image]"+def test_web_session_key_preserves_default_and_supports_explicit_sessions() -> None:+ manager = TutorBotManager()++ assert manager.web_session_key("math-bot") == "bot:math-bot"+ assert manager.web_session_key("math-bot", chat_id="thread-1") == "web:thread-1"+ assert (+ manager.web_session_key("math-bot", chat_id="thread-1", session_id="lesson-1")+ == "web:lesson-1"+ )++# ---------------------------------------------------------------------------# Atomic write# ---------------------------------------------------------------------------diff --git a/tests/services/tutorbot/test_shell_exec_security.py b/tests/services/tutorbot/test_shell_exec_security.pynew file mode 100644index 000000000..89545a08b--- /dev/null+++ b/tests/services/tutorbot/test_shell_exec_security.py@@ -0,0 +1,134 @@+"""TutorBot shell execution security defaults."""++from __future__ import annotations++import asyncio+from pathlib import Path+from types import SimpleNamespace++import pytest++from deeptutor.services.tutorbot.manager import BotConfig, TutorBotManager+++def manager(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> TutorBotManager:+ path_service = SimpleNamespace(+ project_root=tmp_path,+ workspace_root=tmp_path,+ get_memory_dir=lambda: tmp_path / "memory",+ )+ monkeypatch.setattr(+ "deeptutor.services.tutorbot.manager.get_path_service",+ lambda: path_service,+ )+ return TutorBotManager()+++def _patch_start_bot_dependencies(+ monkeypatch: pytest.MonkeyPatch,+ captured: dict[str, object],+) -> None:+ class FakeAgentLoop:+ def __init__(self, *args, **kwargs) -> None:+ captured["exec_enabled"] = kwargs["exec_config"].enabled+ captured["restrict_to_workspace"] = kwargs.get("restrict_to_workspace")+ self.model = kwargs.get("model") or "fake-model"+ self.context_window_tokens = kwargs.get("context_window_tokens") or 65_536++ async def run(self) -> None:+ return None++ async def stop(self) -> None:+ return None++ class FakeHeartbeat:+ def __init__(self, *args, **kwargs) -> None:+ pass++ async def start(self) -> None:+ return None++ def stop(self) -> None:+ return None++ async def _done() -> None:+ return None++ monkeypatch.setattr("deeptutor.tutorbot.agent.loop.AgentLoop", FakeAgentLoop)+ monkeypatch.setattr(+ "deeptutor.tutorbot.providers.deeptutor_adapter.create_deeptutor_provider",+ lambda *_args, **_kwargs: object(),+ )+ monkeypatch.setattr(+ "deeptutor.services.tutorbot.model_runtime.resolve_tutorbot_llm_config",+ lambda _cfg: SimpleNamespace(model="selected-model", context_window=123456),+ )+ monkeypatch.setattr(+ "deeptutor.services.tutorbot.manager.TutorBotManager._build_channel_manager",+ lambda *_args, **_kwargs: None,+ )+ monkeypatch.setattr(+ "deeptutor.services.tutorbot.manager.TutorBotManager._outbound_router",+ lambda *_args, **_kwargs: _done(),+ )+ monkeypatch.setattr("deeptutor.tutorbot.heartbeat.HeartbeatService", FakeHeartbeat)+++def test_bot_config_persists_shell_exec_opt_in(manager: TutorBotManager) -> None:+ cfg = BotConfig(name="bot", allow_shell_exec=True)++ manager.save_bot_config("shell-bot", cfg)++ assert manager.load_bot_config("shell-bot") == cfg+++def test_shell_exec_config_uses_strict_bool_parsing(manager: TutorBotManager) -> None:+ bot_dir = manager._bot_dir("strict-bool-bot")+ bot_dir.mkdir(parents=True, exist_ok=True)+ (bot_dir / "config.yaml").write_text(+ "name: strict-bool\nallow_shell_exec: 'false'\n",+ encoding="utf-8",+ )++ cfg = manager.load_bot_config("strict-bool-bot")++ assert cfg is not None+ assert cfg.allow_shell_exec is False+++def test_start_bot_disables_shell_exec_by_default(+ manager: TutorBotManager,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ captured: dict[str, object] = {}+ _patch_start_bot_dependencies(monkeypatch, captured)++ async def run_start() -> None:+ instance = await manager.start_bot("safe-default-bot", BotConfig(name="bot"))+ for task in instance.tasks:+ task.cancel()++ asyncio.run(run_start())++ assert captured["exec_enabled"] is False+ assert captured["restrict_to_workspace"] is True+++def test_start_bot_shell_exec_requires_explicit_opt_in(+ manager: TutorBotManager,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ captured: dict[str, object] = {}+ _patch_start_bot_dependencies(monkeypatch, captured)++ async def run_start() -> None:+ cfg = BotConfig(name="bot", allow_shell_exec=True)+ instance = await manager.start_bot("shell-opt-in-bot", cfg)+ for task in instance.tasks:+ task.cancel()++ asyncio.run(run_start())++ assert captured["exec_enabled"] is True+ assert captured["restrict_to_workspace"] is Truediff --git a/tests/tools/test_shell.py b/tests/tools/test_shell.pyindex 9369ac3d6..880cfbbee 100644--- a/tests/tools/test_shell.py+++ b/tests/tools/test_shell.py@@ -121,9 +121,7 @@ class TestRestrictToWorkspace:assert result is Nonedef test_unrestricted_allows_absolute_paths(self, unrestricted_tool):- result = unrestricted_tool._guard_command(- "cat /etc/hostname", "/tmp/test-workspace"- )+ result = unrestricted_tool._guard_command("cat /etc/hostname", "/tmp/test-workspace")assert result is Nonediff --git a/tests/tools/test_tutorbot_tool_registry_security.py b/tests/tools/test_tutorbot_tool_registry_security.pynew file mode 100644index 000000000..343b7efbe--- /dev/null+++ b/tests/tools/test_tutorbot_tool_registry_security.py@@ -0,0 +1,99 @@+"""Security defaults for TutorBot tool registration."""++from __future__ import annotations++import asyncio+from pathlib import Path++from deeptutor.tutorbot.agent.tools.registry import build_base_tools+from deeptutor.tutorbot.config.schema import ExecToolConfig+++def test_exec_tool_is_not_registered_when_disabled(tmp_path: Path) -> None:+ tools = build_base_tools(+ tmp_path,+ ExecToolConfig(enabled=False),+ restrict_to_workspace=True,+ )++ assert not tools.has("exec")+ assert "exec" not in tools.tool_names+++def test_filesystem_tools_are_restricted_to_workspace(tmp_path: Path) -> None:+ outside = tmp_path.parent / "outside-secret.txt"+ outside.write_text("secret", encoding="utf-8")+ tools = build_base_tools(+ tmp_path,+ ExecToolConfig(enabled=False),+ restrict_to_workspace=True,+ )++ result = asyncio.run(tools.execute("read_file", {"path": str(outside)}))++ assert "outside allowed directory" in result+++def test_filesystem_write_edit_and_list_reject_paths_outside_workspace(tmp_path: Path) -> None:+ outside_dir = tmp_path.parent / "outside-tutorbot-tools"+ outside_dir.mkdir(exist_ok=True)+ outside_file = outside_dir / "secret.txt"+ outside_file.write_text("secret", encoding="utf-8")+ tools = build_base_tools(+ tmp_path,+ ExecToolConfig(enabled=False),+ restrict_to_workspace=True,+ )++ write_result = asyncio.run(+ tools.execute("write_file", {"path": str(outside_file), "content": "changed"})+ )+ edit_result = asyncio.run(+ tools.execute(+ "edit_file",+ {"path": str(outside_file), "old_text": "secret", "new_text": "changed"},+ )+ )+ list_result = asyncio.run(tools.execute("list_dir", {"path": str(outside_dir)}))++ assert "outside allowed directory" in write_result+ assert "outside allowed directory" in edit_result+ assert "outside allowed directory" in list_result+ assert outside_file.read_text(encoding="utf-8") == "secret"+++def test_opt_in_exec_tool_is_workspace_restricted(tmp_path: Path) -> None:+ tools = build_base_tools(+ tmp_path,+ ExecToolConfig(enabled=True),+ restrict_to_workspace=True,+ )+ exec_tool = tools.get("exec")++ assert exec_tool is not None+ assert exec_tool.restrict_to_workspace is True+ assert exec_tool._guard_command(f"cat {tmp_path.parent / 'outside-secret.txt'}", str(tmp_path))+++def test_opt_in_exec_tool_blocks_exfiltration_and_interpreter_one_liners(tmp_path: Path) -> None:+ tools = build_base_tools(+ tmp_path,+ ExecToolConfig(enabled=True),+ restrict_to_workspace=True,+ )+ exec_tool = tools.get("exec")++ assert exec_tool is not None+ blocked_commands = [+ "curl https://example.test/secret",+ "wget https://example.test/secret",+ "nc example.test 4444",+ "ssh [email protected]",+ "python -c 'print(1)'",+ "node -e 'console.log(1)'",+ "cat /etc/passwd",+ "chmod 777 shared.txt",+ ]++ for command in blocked_commands:+ assert exec_tool._guard_command(command, str(tmp_path))diff --git a/tests/utils/test_archive_extractor.py b/tests/utils/test_archive_extractor.pynew file mode 100644index 000000000..d5cc17894--- /dev/null+++ b/tests/utils/test_archive_extractor.py@@ -0,0 +1,162 @@+"""Tests for the safe ZIP extractor (``deeptutor.utils.archive_extractor``).++These lock in the security guards that a naive ``extractall`` lacks: Zip Slip+defusal, extension whitelisting, nested-archive rejection, duplicate handling,+and the zip-bomb size/count/ratio limits.+"""++from __future__ import annotations++from pathlib import Path+import zipfile++import pytest++from deeptutor.utils.archive_extractor import (+ ArchiveTooLargeError,+ ZipExtractionLimits,+ safe_extract_zip,+)++DOC_EXTS = {".txt", ".md", ".pdf", ".zip"} # .zip is intentionally never extracted+++def _make_zip(path: Path, entries: list[tuple[str, bytes]], *, deflate: bool = False) -> Path:+ mode = zipfile.ZIP_DEFLATED if deflate else zipfile.ZIP_STORED+ with zipfile.ZipFile(path, "w", compression=mode) as zf:+ for name, data in entries:+ # A ZipInfo carries its own compress_type, so set it explicitly —+ # otherwise writestr(ZipInfo, ...) ignores the archive's mode.+ info = zipfile.ZipInfo(name)+ info.compress_type = mode+ zf.writestr(info, data)+ return path+++def test_extracts_allowed_files_flat(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [("notes.txt", b"hello"), ("paper.md", b"# title")])+ out = tmp_path / "out"++ result = safe_extract_zip(src, out, allowed_extensions=DOC_EXTS)++ names = sorted(p.name for p in result.extracted)+ assert names == ["notes.txt", "paper.md"]+ assert (out / "notes.txt").read_bytes() == b"hello"+ assert result.skipped == []+++def test_zip_slip_is_defused(tmp_path: Path) -> None:+ # Member names that try to escape via traversal or absolute paths.+ src = _make_zip(+ tmp_path / "evil.zip",+ [("../../escape.txt", b"x"), ("/abs/secret.txt", b"y"), ("a/b/deep.txt", b"z")],+ )+ out = tmp_path / "out"++ result = safe_extract_zip(src, out, allowed_extensions=DOC_EXTS)++ # Everything is flattened into the target; nothing escapes it.+ for p in result.extracted:+ assert out.resolve() in p.resolve().parents+ assert not (tmp_path / "escape.txt").exists()+ assert not Path("/abs/secret.txt").exists()+ assert sorted(p.name for p in result.extracted) == ["deep.txt", "escape.txt", "secret.txt"]+++def test_disallowed_extension_is_skipped(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [("ok.txt", b"x"), ("malware.exe", b"x"), ("run.sh", b"x")])+ out = tmp_path / "out"++ result = safe_extract_zip(src, out, allowed_extensions=DOC_EXTS)++ assert [p.name for p in result.extracted] == ["ok.txt"]+ skipped_names = {member for member, _ in result.skipped}+ assert "malware.exe" in skipped_names+ assert "run.sh" in skipped_names+++def test_nested_zip_is_never_extracted(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [("inner.zip", b"PK\x03\x04"), ("ok.txt", b"x")])+ out = tmp_path / "out"++ result = safe_extract_zip(src, out, allowed_extensions=DOC_EXTS)++ assert [p.name for p in result.extracted] == ["ok.txt"]+ assert any(member == "inner.zip" for member, _ in result.skipped)+++def test_macosx_and_dotfiles_are_skipped(tmp_path: Path) -> None:+ src = _make_zip(+ tmp_path / "a.zip",+ [("__MACOSX/._notes.txt", b"junk"), (".hidden.txt", b"junk"), ("real.txt", b"ok")],+ )+ out = tmp_path / "out"++ result = safe_extract_zip(src, out, allowed_extensions=DOC_EXTS)++ assert [p.name for p in result.extracted] == ["real.txt"]+++def test_duplicate_basenames_after_flattening(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [("chap1/notes.txt", b"one"), ("chap2/notes.txt", b"two")])+ out = tmp_path / "out"++ result = safe_extract_zip(src, out, allowed_extensions=DOC_EXTS)++ assert [p.name for p in result.extracted] == ["notes.txt"]+ assert (out / "notes.txt").read_bytes() == b"one" # first wins+ assert any("duplicate" in reason for _, reason in result.skipped)+++def test_per_entry_size_cap_raises(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [("big.txt", b"x" * 100)])+ out = tmp_path / "out"++ with pytest.raises(ArchiveTooLargeError):+ safe_extract_zip(+ src, out, allowed_extensions=DOC_EXTS, limits=ZipExtractionLimits(max_entry_bytes=10)+ )+++def test_too_many_entries_raises(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [(f"f{i}.txt", b"x") for i in range(5)])+ out = tmp_path / "out"++ with pytest.raises(ArchiveTooLargeError):+ safe_extract_zip(+ src, out, allowed_extensions=DOC_EXTS, limits=ZipExtractionLimits(max_entries=3)+ )+++def test_total_size_cap_raises(tmp_path: Path) -> None:+ src = _make_zip(tmp_path / "a.zip", [("a.txt", b"x" * 60), ("b.txt", b"x" * 60)])+ out = tmp_path / "out"++ with pytest.raises(ArchiveTooLargeError):+ safe_extract_zip(+ src,+ out,+ allowed_extensions=DOC_EXTS,+ limits=ZipExtractionLimits(max_total_bytes=100, max_entry_bytes=100),+ )+++def test_compression_ratio_guard_raises(tmp_path: Path) -> None:+ # 50 KB of identical bytes compresses to a few hundred bytes -> very high ratio.+ src = _make_zip(tmp_path / "bomb.zip", [("a.txt", b"A" * 50_000)], deflate=True)+ out = tmp_path / "out"++ with pytest.raises(ArchiveTooLargeError):+ safe_extract_zip(+ src,+ out,+ allowed_extensions=DOC_EXTS,+ limits=ZipExtractionLimits(max_compression_ratio=10.0),+ )+++def test_bad_zip_raises(tmp_path: Path) -> None:+ bogus = tmp_path / "not.zip"+ bogus.write_bytes(b"this is not a zip")+ with pytest.raises(zipfile.BadZipFile):+ safe_extract_zip(bogus, tmp_path / "out", allowed_extensions=DOC_EXTS)diff --git a/web/app/(utility)/settings/network/page.tsx b/web/app/(utility)/settings/network/page.tsxnew file mode 100644index 000000000..8a8d0de87--- /dev/null+++ b/web/app/(utility)/settings/network/page.tsx@@ -0,0 +1,379 @@+"use client";++import { useEffect, useMemo, useState } from "react";+import { Loader2, Save } from "lucide-react";+import { useTranslation } from "react-i18next";++import {+ SettingRow,+ SettingSection,+ SettingsPageHeader,+ inputClass,+} from "@/components/settings/shared";+import { apiFetch, apiUrl } from "@/lib/api";++type NetworkSettings = {+ backend_port: number;+ frontend_port: number;+ public_api_base: string;+ cors_origins: string[];+};++type NetworkSettingsPayload = {+ settings: NetworkSettings;+ effective: {+ backend_url: string;+ frontend_url: string;+ browser_api_base: string;+ api_base_source: string;+ cors_mode: "explicit" | "permissive";+ cors_origins: string[];+ allow_remote_http_origins: boolean;+ };+ auth: {+ enabled: boolean;+ cookie_secure: boolean;+ cookie_samesite: string;+ cross_site_cookie_ready: boolean;+ };+ restart_required: boolean;+};++function splitOrigins(value: string): string[] {+ return value+ .split(/[,;\n]+/)+ .map((item) => item.trim())+ .filter(Boolean);+}++function normalizeDraft(payload: NetworkSettingsPayload): NetworkSettings {+ return {+ backend_port: payload.settings.backend_port,+ frontend_port: payload.settings.frontend_port,+ public_api_base: payload.settings.public_api_base || "",+ cors_origins: payload.settings.cors_origins || [],+ };+}++function DetailTile({+ label,+ value,+ tone = "neutral",+}: {+ label: string;+ value: string;+ tone?: "neutral" | "ok" | "warn";+}) {+ const dot =+ tone === "ok"+ ? "bg-emerald-500"+ : tone === "warn"+ ? "bg-amber-500"+ : "bg-[var(--border)]";+ return (+ <div className="rounded-xl border border-[var(--border)]/60 bg-[var(--card)] px-4 py-3">+ <div className="flex items-center gap-2 text-[11px] font-medium text-[var(--muted-foreground)]">+ <span className={`h-1.5 w-1.5 rounded-full ${dot}`} />+ {label}+ </div>+ <div+ className="mt-2 truncate text-[13px] font-medium text-[var(--foreground)]"+ title={value}+ >+ {value || "-"}+ </div>+ </div>+ );+}++export default function NetworkSettingsPage() {+ const { t } = useTranslation();+ const apiBasePlaceholder = "https://api.example.com";+ const corsPlaceholder = "https://learn.example.com\nhttp://10.0.0.5:3782";+ const [payload, setPayload] = useState<NetworkSettingsPayload | null>(null);+ const [draft, setDraft] = useState<NetworkSettings | null>(null);+ const [corsText, setCorsText] = useState("");+ const [loading, setLoading] = useState(true);+ const [saving, setSaving] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const [message, setMessage] = useState("");++ useEffect(() => {+ let cancelled = false;+ async function load() {+ setLoading(true);+ setError(null);+ try {+ const response = await apiFetch(apiUrl("/api/v1/settings/network"));+ const data = (await response.json().catch(() => ({}))) as+ | NetworkSettingsPayload+ | { detail?: string };+ if (!response.ok) {+ throw new Error(+ "detail" in data && data.detail+ ? data.detail+ : t("Failed to load network settings."),+ );+ }+ if (cancelled) return;+ const next = data as NetworkSettingsPayload;+ setPayload(next);+ setDraft(normalizeDraft(next));+ setCorsText((next.settings.cors_origins || []).join("\n"));+ } catch (err) {+ if (!cancelled) {+ setError(err instanceof Error ? err.message : String(err));+ }+ } finally {+ if (!cancelled) setLoading(false);+ }+ }+ load();+ return () => {+ cancelled = true;+ };+ }, [t]);++ const dirty = useMemo(() => {+ if (!payload || !draft) return false;+ const current = normalizeDraft(payload);+ return (+ current.backend_port !== draft.backend_port ||+ current.frontend_port !== draft.frontend_port ||+ current.public_api_base !== draft.public_api_base ||+ JSON.stringify(current.cors_origins) !==+ JSON.stringify(splitOrigins(corsText))+ );+ }, [corsText, draft, payload]);++ async function save() {+ if (!draft) return;+ setSaving(true);+ setError(null);+ setMessage("");+ try {+ const response = await apiFetch(apiUrl("/api/v1/settings/network"), {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({+ ...draft,+ cors_origins: splitOrigins(corsText),+ }),+ });+ const data = (await response.json().catch(() => ({}))) as+ | NetworkSettingsPayload+ | { detail?: string };+ if (!response.ok) {+ throw new Error(+ "detail" in data && data.detail+ ? data.detail+ : t("Failed to save network settings."),+ );+ }+ const next = data as NetworkSettingsPayload;+ setPayload(next);+ setDraft(normalizeDraft(next));+ setCorsText((next.settings.cors_origins || []).join("\n"));+ setMessage(t("Network settings saved. Restart DeepTutor to apply them."));+ } catch (err) {+ setError(err instanceof Error ? err.message : String(err));+ } finally {+ setSaving(false);+ }+ }++ return (+ <div data-tour="tour-network">+ <SettingsPageHeader+ title={t("Network")}+ description={t(+ "Control the browser-facing API URL and CORS origins used by Docker, LAN, and reverse-proxy deployments.",+ )}+ />++ {loading && (+ <div className="flex items-center gap-2 text-[13px] text-[var(--muted-foreground)]">+ <Loader2 className="h-4 w-4 animate-spin" />+ {t("Loading network settings...")}+ </div>+ )}++ {!loading && error && (+ <div className="rounded-xl border border-red-500/30 bg-red-500/10 px-4 py-3 text-[13px] text-red-600 dark:text-red-300">+ {error}+ </div>+ )}++ {!loading && payload && draft && (+ <>+ <div className="mb-7 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4">+ <DetailTile+ label={t("Browser API")}+ value={payload.effective.browser_api_base}+ tone="ok"+ />+ <DetailTile+ label={t("CORS mode")}+ value={+ payload.effective.cors_mode === "permissive"+ ? t("Permissive until auth is enabled")+ : t("Explicit origins required")+ }+ tone={+ payload.effective.cors_mode === "permissive" ? "ok" : "warn"+ }+ />+ <DetailTile+ label={t("Auth cookie")}+ value={`${payload.auth.cookie_samesite}${+ payload.auth.cookie_secure ? " + Secure" : ""+ }`}+ tone={+ !payload.auth.enabled || payload.auth.cross_site_cookie_ready+ ? "ok"+ : "warn"+ }+ />+ <DetailTile+ label={t("Restart")}+ value={t("Required after save")}+ tone="warn"+ />+ </div>++ <SettingSection+ title={t("Runtime ports")}+ description={t(+ "These ports are read during startup. Docker port mappings must match the container-side values.",+ )}+ >+ <SettingRow+ title={t("Backend port")}+ description={t("FastAPI listens on this port.")}+ control={+ <input+ className={`${inputClass} w-28`}+ type="number"+ min={1}+ max={65535}+ value={draft.backend_port}+ onChange={(event) =>+ setDraft((current) =>+ current+ ? {+ ...current,+ backend_port: Number(event.target.value),+ }+ : current,+ )+ }+ />+ }+ />+ <SettingRow+ title={t("Frontend port")}+ description={t("Next.js serves the Web UI on this port.")}+ control={+ <input+ className={`${inputClass} w-28`}+ type="number"+ min={1}+ max={65535}+ value={draft.frontend_port}+ onChange={(event) =>+ setDraft((current) =>+ current+ ? {+ ...current,+ frontend_port: Number(event.target.value),+ }+ : current,+ )+ }+ />+ }+ />+ </SettingSection>++ <SettingSection+ title={t("Browser API base")}+ description={t(+ "Set this when the browser cannot reach the backend through localhost, such as remote Docker or a reverse proxy.",+ )}+ >+ <SettingRow+ title={t("Public API base")}+ description={t(+ "Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.",+ )}+ control={+ <input+ className={`${inputClass} w-[360px] max-w-[48vw]`}+ placeholder={apiBasePlaceholder}+ value={draft.public_api_base}+ onChange={(event) =>+ setDraft((current) =>+ current+ ? { ...current, public_api_base: event.target.value }+ : current,+ )+ }+ />+ }+ />+ </SettingSection>++ <SettingSection+ title={t("CORS origins")}+ description={t(+ "Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.",+ )}+ >+ <div className="py-4">+ <textarea+ className={`${inputClass} min-h-28 resize-y font-mono text-[12.5px] leading-relaxed`}+ placeholder={corsPlaceholder}+ value={corsText}+ onChange={(event) => setCorsText(event.target.value)}+ />+ <p className="mt-2 text-[11.5px] leading-relaxed text-[var(--muted-foreground)]">+ {t(+ "Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.",+ )}+ </p>+ </div>+ </SettingSection>++ {payload.auth.enabled && !payload.auth.cookie_secure && (+ <div className="mb-5 rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-[12.5px] leading-relaxed text-amber-700 dark:text-amber-300">+ {t(+ "Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.",+ )}+ </div>+ )}++ <div className="flex items-center justify-between gap-3">+ <p className="text-[12px] text-[var(--muted-foreground)]">+ {message ||+ t(+ "Network changes are written to data/user/settings/system.json and take effect after restart.",+ )}+ </p>+ <button+ onClick={save}+ disabled={saving || !dirty}+ className="inline-flex items-center gap-1.5 rounded-lg bg-[var(--foreground)] px-3 py-1.5 text-[12px] font-medium text-[var(--background)] transition-opacity hover:opacity-80 disabled:opacity-40"+ >+ {saving ? (+ <Loader2 className="h-3 w-3 animate-spin" />+ ) : (+ <Save className="h-3 w-3" />+ )}+ {t("Save Network")}+ </button>+ </div>+ </>+ )}+ </div>+ );+}diff --git a/web/components/settings/ServiceConfigEditor.tsx b/web/components/settings/ServiceConfigEditor.tsxindex 9b638052d..b929f4b53 100644--- a/web/components/settings/ServiceConfigEditor.tsx+++ b/web/components/settings/ServiceConfigEditor.tsx@@ -573,8 +573,8 @@ export function ServiceConfigEditor({ service }: { service: ServiceName }) {</div></div>) : (- <div className="rounded-xl border border-dashed border-[var(--border)] py-12 text-center text-[13px] text-[var(--muted-foreground)]">- <p className="mb-4">{t("No profiles configured. Add a profile to start.")}</p>+ <div className="flex flex-col items-center gap-3 rounded-xl border border-dashed border-[var(--border)] px-5 py-12 text-center text-[13px] text-[var(--muted-foreground)]">+ <div>{t("No profiles configured. Add a profile to start.")}</div><buttontype="button"onClick={() => addProfile(service)}diff --git a/web/components/settings/SettingsContext.tsx b/web/components/settings/SettingsContext.tsxindex ddb31c4c7..a48c64999 100644--- a/web/components/settings/SettingsContext.tsx+++ b/web/components/settings/SettingsContext.tsx@@ -138,6 +138,12 @@ export const TOUR_STEPS: TourStep[] = [titleKey: "settingsTour.status.title",descKey: "settingsTour.status.desc",},+ {+ target: "tour-network",+ route: "/settings/network",+ titleKey: "settingsTour.network.title",+ descKey: "settingsTour.network.desc",+ },{target: "tour-llm",route: "/settings/llm",diff --git a/web/lib/notebook-api.ts b/web/lib/notebook-api.tsindex 818e4c076..b5735a10b 100644--- a/web/lib/notebook-api.ts+++ b/web/lib/notebook-api.ts@@ -217,12 +217,16 @@ export async function lookupNotebookEntry(const params = new URLSearchParams({session_id: sessionId,question_id: questionId,+ // Probe quietly: a not-yet-saved question returns 204 instead of 404, so+ // it stays out of the server error log and the browser network console.+ missing_ok: "true",});if (turnId) params.set("turn_id", turnId);const response = await apiFetch(apiUrl(`/api/v1/question-notebook/entries/lookup/by-question?${params}`),);- if (response.status === 404) return null;+ // 204 (missing_ok hit) and 404 (older servers) both mean "no entry yet".+ if (response.status === 204 || response.status === 404) return null;return expectJson<NotebookEntry>(response);}diff --git a/web/lib/settings-items.ts b/web/lib/settings-items.tsindex a70cca3bf..9a4477ddf 100644--- a/web/lib/settings-items.ts+++ b/web/lib/settings-items.ts@@ -5,6 +5,7 @@ import {BookMarked,Brain,Database,+ Network,Palette,Plug,Search,@@ -16,6 +17,7 @@ import {export type SettingsItemKey =| "appearance"| "status"+ | "network"| "tools"| "mcp"| "llm"@@ -47,6 +49,13 @@ export const SETTINGS_ITEMS: SettingsItem[] = [description: "Runtime status for backend and configured services.",icon: Activity,},+ {+ key: "network",+ href: "/settings/network",+ label: "Network",+ description: "Ports, browser API base, and CORS origins.",+ icon: Network,+ },{key: "llm",href: "/settings/llm",diff --git a/web/locales/en/app.json b/web/locales/en/app.jsonindex cabb89efd..c6192bd2c 100644--- a/web/locales/en/app.json+++ b/web/locales/en/app.json@@ -1124,6 +1124,8 @@"settingsTour.appearance.desc": "settingsTour.appearance.desc","settingsTour.status.title": "settingsTour.status.title","settingsTour.status.desc": "settingsTour.status.desc",+ "settingsTour.network.title": "Network",+ "settingsTour.network.desc": "Configure ports, the public API base used by browsers, and CORS origins for Docker or reverse-proxy deployments.","settingsTour.llm.title": "LLM","settingsTour.llm.desc": "Manage LLM profiles — provider, endpoint, and model. The active model powers chat and most agent reasoning.","settingsTour.embedding.title": "Embedding",@@ -1717,6 +1719,36 @@"Runtime status for backend and configured services.": "Runtime status for backend and configured services.","Live state of the backend and the model services your configuration applies to.": "Live state of the backend and the model services your configuration applies to.","Status reflects the runtime values after the last Apply. Draft changes only take effect once applied.": "Status reflects the runtime values after the last Apply. Draft changes only take effect once applied.",+ "Network": "Network",+ "Ports, browser API base, and CORS origins.": "Ports, browser API base, and CORS origins.",+ "Control the browser-facing API URL and CORS origins used by Docker, LAN, and reverse-proxy deployments.": "Control the browser-facing API URL and CORS origins used by Docker, LAN, and reverse-proxy deployments.",+ "Loading network settings...": "Loading network settings...",+ "Failed to load network settings.": "Failed to load network settings.",+ "Failed to save network settings.": "Failed to save network settings.",+ "Network settings saved. Restart DeepTutor to apply them.": "Network settings saved. Restart DeepTutor to apply them.",+ "Browser API": "Browser API",+ "CORS mode": "CORS mode",+ "Permissive until auth is enabled": "Permissive until auth is enabled",+ "Explicit origins required": "Explicit origins required",+ "Auth cookie": "Auth cookie",+ "Restart": "Restart",+ "Required after save": "Required after save",+ "Runtime ports": "Runtime ports",+ "These ports are read during startup. Docker port mappings must match the container-side values.": "These ports are read during startup. Docker port mappings must match the container-side values.",+ "Backend port": "Backend port",+ "FastAPI listens on this port.": "FastAPI listens on this port.",+ "Frontend port": "Frontend port",+ "Next.js serves the Web UI on this port.": "Next.js serves the Web UI on this port.",+ "Browser API base": "Browser API base",+ "Set this when the browser cannot reach the backend through localhost, such as remote Docker or a reverse proxy.": "Set this when the browser cannot reach the backend through localhost, such as remote Docker or a reverse proxy.",+ "Public API base": "Public API base",+ "Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.": "Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.",+ "CORS origins": "CORS origins",+ "Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.": "Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.",+ "Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.": "Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.",+ "Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.": "Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.",+ "Network changes are written to data/user/settings/system.json and take effect after restart.": "Network changes are written to data/user/settings/system.json and take effect after restart.",+ "Save Network": "Save Network","Built-in tools the chat agent can invoke.": "Built-in tools the chat agent can invoke.","Built-in tools the chat agent can invoke. Each shows its description, parameters, and prompt hints in your current language.": "Built-in tools the chat agent can invoke. Each shows its description, parameters, and prompt hints in your current language.","Failed to load tools": "Failed to load tools",diff --git a/web/locales/zh/app.json b/web/locales/zh/app.jsonindex 146c9f7d2..28f11e565 100644--- a/web/locales/zh/app.json+++ b/web/locales/zh/app.json@@ -735,6 +735,7 @@"Rename profile": "重命名配置文件","Double-click to rename": "双击重命名","Context Window": "上下文窗口",+ "Detected at": "检测时间","Source": "来源","Detected": "检测到","Detected context window written to draft": "检测到的上下文窗口已写入草稿",@@ -1155,6 +1156,8 @@"settingsTour.appearance.desc": "选择视觉主题和界面语言,改动立即生效。","settingsTour.status.title": "状态","settingsTour.status.desc": "一眼查看后端和各项服务的运行状态。草稿与运行时不一致时会显示 Pending。",+ "settingsTour.network.title": "网络",+ "settingsTour.network.desc": "配置端口、浏览器使用的公共 API base,以及 Docker 或反向代理部署需要的 CORS 来源。","settingsTour.llm.title": "LLM","settingsTour.llm.desc": "管理 LLM 配置文件——提供商、接口地址和可用模型。当前激活的模型用于聊天和大部分 agent 推理。","settingsTour.embedding.title": "嵌入模型",@@ -1193,6 +1196,36 @@"Runtime status for backend and configured services.": "后端与各模型服务的运行状态。","Live state of the backend and the model services your configuration applies to.": "后端和当前配置生效的模型服务的实时状态。","Status reflects the runtime values after the last Apply. Draft changes only take effect once applied.": "状态反映上一次 Apply 之后的运行时数值。草稿改动需要 Apply 才会生效。",+ "Network": "网络",+ "Ports, browser API base, and CORS origins.": "端口、浏览器 API base 与 CORS 来源。",+ "Control the browser-facing API URL and CORS origins used by Docker, LAN, and reverse-proxy deployments.": "配置 Docker、局域网和反向代理部署中浏览器访问后端的 API 地址与 CORS 来源。",+ "Loading network settings...": "正在加载网络设置...",+ "Failed to load network settings.": "加载网络设置失败。",+ "Failed to save network settings.": "保存网络设置失败。",+ "Network settings saved. Restart DeepTutor to apply them.": "网络设置已保存。重启 DeepTutor 后生效。",+ "Browser API": "浏览器 API",+ "CORS mode": "CORS 模式",+ "Permissive until auth is enabled": "未启用认证时自动放行",+ "Explicit origins required": "需要显式来源",+ "Auth cookie": "认证 Cookie",+ "Restart": "重启",+ "Required after save": "保存后需要重启",+ "Runtime ports": "运行端口",+ "These ports are read during startup. Docker port mappings must match the container-side values.": "这些端口在启动时读取。Docker 端口映射右侧必须与容器内端口一致。",+ "Backend port": "后端端口",+ "FastAPI listens on this port.": "FastAPI 监听这个端口。",+ "Frontend port": "前端端口",+ "Next.js serves the Web UI on this port.": "Next.js 在这个端口提供 Web UI。",+ "Browser API base": "浏览器 API base",+ "Set this when the browser cannot reach the backend through localhost, such as remote Docker or a reverse proxy.": "当浏览器不能通过 localhost 访问后端时填写,例如远程 Docker 或反向代理部署。",+ "Public API base": "公共 API base",+ "Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.": "本机 Docker 留空即可。远程部署填写浏览器可访问的后端 URL,可包含代理路径。",+ "CORS origins": "CORS 来源",+ "Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.": "仅认证跨域部署需要填写。这里填前端页面来源,不是 API URL。",+ "Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.": "支持逗号、分号和换行分隔。裸 host:port 会按 http://host:port 保存。",+ "Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.": "认证已启用,但安全 Cookie 未开启。跨站 HTTPS 部署应设置 auth.cookie_secure=true 并重启,使 SameSite=None Cookie 在现代浏览器中生效。",+ "Network changes are written to data/user/settings/system.json and take effect after restart.": "网络改动会写入 data/user/settings/system.json,并在重启后生效。",+ "Save Network": "保存网络设置","Built-in tools the chat agent can invoke.": "聊天 agent 可调用的内置工具。","Built-in tools the chat agent can invoke. Each shows its description, parameters, and prompt hints in your current language.": "聊天 agent 可调用的内置工具。每个工具列出当前语言下的描述、参数和提示。","Failed to load tools": "加载工具列表失败",@@ -1863,6 +1896,7 @@"Run": "运行","Preference": "偏好设置","Extra constraints, style, focus areas...": "额外约束、风格、关注点...",+ "Extra constraints...": "额外约束...","Failed to save to notebook.": "保存到 Notebook 失败。","Notebook save stream ended unexpectedly.": "Notebook 保存流意外中断。","Failed to edit selected text.": "编辑选中文本失败。",