Commit Graph

1001 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
8bced8eef1 docs: update readme 2026-06-23 23:46:36 +08:00
Bingxi Zhao (Frank)
34cdb925c4 docs(readme): note BACKEND_HOST/FRONTEND_HOST loopback knobs for host networking
The host-networking note already warns that --network=host exposes the
container ports on the host; point to the BACKEND_HOST/FRONTEND_HOST env vars
(added in #586) as the loopback-only mitigation, with details in
CONTAINERIZATION.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 23:22:41 +08:00
Bingxi Zhao (Frank)
61f9c66718 fix(llm): enable native tool calls for all registered cloud OpenAI-compatible providers
#584 fixed SiliconFlow by adding a PROVIDER_CAPABILITIES entry, but the same
class of bug affected every registered openai_compat cloud provider lacking an
explicit entry: get_capability fell to DEFAULT_CAPABILITIES (supports_tools=
False), so can_use_native_tool_calling() returned False and models emitted
textual <tool_calls> markup instead of executable tool calls. Affected:
gemini, zhipu, qianfan, stepfun, xiaomi_mimo, nvidia_nim, aihubmix, and the
volcengine/byteplus coding-plan variants.

Make the decision registry-backend-driven instead of per-provider data:
can_use_native_tool_calling now treats a registered, non-local openai_compat
provider as tool-capable by default (matching the catch-all 'custom' provider
and the OpenAI-compatible API contract). Anthropic backends stay always-on;
local servers (Ollama/vLLM/LM Studio/llama.cpp/Lemonade/OVMS) and bindings in
_NATIVE_TOOL_BLOCKED_BINDINGS stay opted out; an explicit supports_tools flag
still wins. This removes the registry/capabilities duplication for the tools
flag and prevents the gap from recurring when new cloud providers are added.

capabilities.py stays a pure static-data module (no registry coupling); the
policy lives in client.py, which already consults the registry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 21:35:12 +08:00
Bingxi Zhao (Frank)
50e71249b0 Merge pull request #584 from TyrionH-is-coding/fix/siliconflow-native-tools
fix(llm): enable native tool calls for SiliconFlow

SiliconFlow is a registered openai_compat provider but had no
PROVIDER_CAPABILITIES entry, so it fell to the default supports_tools=False
and can_use_native_tool_calling() disabled native tool schemas — models
emitted textual <tool_calls> markup instead of executable calls. Register
SiliconFlow with native tool support; per-model overrides (DeepSeek
response_format / thinking tags) still apply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 21:25:15 +08:00
Bingxi Zhao (Frank)
98805b46db refactor(chat): honest indeterminate session-loading overlay
Rework of the #578 loading overlay:
- Replace the simulated rAF percentage bar (which climbed to a fake 99%
  over ~24s, unrelated to real load progress) with an honest indeterminate
  spinner + 'Loading conversation…' message and an 8s 'Still loading…' hint.
- Collapse the null/loading/complete state machine to a single boolean and
  drop the artificial 400ms completion delay, so the conversation appears
  the moment the fetch resolves.
- Fix a stray ')' in the cancel button's className that voided its hover
  color, and remove the now-redundant width-transition/rAF conflict.
- Drop the dead 'server is taking too long' locale key (no timeout path
  uses it).

The AbortSignal plumbing (getSession/loadSession + cancel button) and the
Strict-Mode-safe initial-load ref are kept as-is.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 21:04:33 +08:00
Bingxi Zhao (Frank)
37283e9124 Merge pull request #578 from emmett001/feat/session-loading-overlay
feat: loading overlay for chat-history navigation

Shows a clear loading indicator (with cancel) while a session is fetched
from chat history, replacing the misleading welcome-screen flash. Threads
an AbortSignal through getSession/loadSession so the load is cancelable.
Followed by a rework that swaps the simulated progress bar for an honest
indeterminate spinner and drops the artificial completion delay.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:59:55 +08:00
Bingxi Zhao (Frank)
88868034ac docs(containerization): document BACKEND_HOST/FRONTEND_HOST host-mode knobs
Make the two env vars from #586 discoverable and scope-warn (host-mode
only) in the authoritative container doc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:57:46 +08:00
Bingxi Zhao (Frank)
950663878a Merge pull request #586 from enihcam/feature/bind-host-config
feat(docker): make BACKEND_HOST and FRONTEND_HOST env-configurable

Two opt-in env vars (default 0.0.0.0, non-breaking) let host-network
deployments pin uvicorn and Next.js to a specific bind address — e.g.
127.0.0.1 to keep both off the host LAN when running network_mode: host.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:57:11 +08:00
Bingxi Zhao (Frank)
8ad39f7038 chore(docker): drop now-dead gosu/libcap2-bin infra; align docs with root-supervisord model
#582 made supervisord run as root with per-program user=deeptutor, so the
gosu privilege-drop binary is no longer invoked. Remove the gosu and
libcap2-bin apt packages and the setcap step (a setuid-capable binary that
was left unused == needless attack surface), and refresh the Dockerfile
comments.

Realign the authoritative docs that still described the old gosu model:
- CONTAINERIZATION.md: supervisord runs as root and drops each program to
  deeptutor via user=; fix the verification snippet.
- compose.yaml: correct the (now wrong + dangerous) note that cap_drop ALL
  is safe — root supervisord NEEDS CAP_SETUID/CAP_SETGID to setuid its
  children, so cap_drop ALL would stop the backend/frontend from starting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:56:26 +08:00
Bingxi Zhao (Frank)
32a22e70bc Merge pull request #582 from IliaAvdeev/fix/docker-rootful-supervisord
fix: run supervisord as root so services start under rootful Docker

PR #577 dropped supervisord itself to UID 1000 via gosu; under a rootful
daemon (Docker Desktop / Docker Engine) the root-owned /dev/fd/1,2 and
pidfile become unopenable, so backend+frontend never spawn (EACCES). Run
supervisord as root and drop each child to deeptutor via per-program
user= instead — app processes stay non-root in both rootful Docker and
rootless podman.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:52:53 +08:00
Bingxi Zhao (Frank)
7caa0506a8 fix(quiz): wrap LaTeX option label in a div, not a span
MarkdownRenderer (with enableMath) renders a block-level <div><p> root;
nesting it in a <span> inside the option <button> is invalid HTML and
trips React's validateDOMNesting. Use a <div> to match the four sibling
MarkdownRenderer call sites in this file. The serif/prose option text is
intentional — it matches the question stem, which also renders via
MarkdownRenderer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:51:00 +08:00
Bingxi Zhao (Frank)
00829152e6 Merge pull request #588 from ZhouJ-sh/fix/587-quiz-option-latex
fix: render LaTeX in quiz multiple-choice options (#587)

Routes option labels through MarkdownRenderer + KaTeX, matching the
question stem. Followed by a fixup that wraps the renderer in a <div>
(not a <span>) to keep the block-level renderer output valid inside the
option button.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:50:21 +08:00
Bingxi Zhao (Frank)
ae570b41cd Merge pull request #583 from IliaAvdeev/feat/admin-users-redesign
feat: redesign admin User Management page (avatars, search, skeleton, confirm dialog)

Part 2 of #553. Adds per-row UserAvatar, live username search backed by a
pure filterUsersByQuery helper (unit-tested), skeleton loading, richer
empty/no-match states, and a focus-managed ConfirmDialog replacing the
window.confirm() prompts for delete/promote/demote. Frontend-only; no
auth/permission paths touched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:48:09 +08:00
Bingxi Zhao (Frank)
e8998ec7dd Merge pull request #585 from IliaAvdeev/refactor/profile-header
refactor: move Back link to its own row in the profile page header

Stacks the Back link above the title on /profile, matching the header
layout the admin Users page also adopts in #583.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:47:04 +08:00
Bingxi Zhao (Frank)
2dc4c7dd03 Merge pull request #543 from octo-patch/feature/upgrade-minimax-m3
feat: refresh MiniMax model identifiers in tests to M3

MiniMax-M3 is the current default on the MiniMax platform; refresh the
model-id strings used in the capability/runtime tests and add M3/M2.7
assertions. Provider capability resolution is keyed on the 'minimax'
prefix, so this is behavior-neutral (no production code changed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:46:01 +08:00
Zhou
ac0c348b9e fix: render latex in quiz options 2026-06-23 16:59:35 +08:00
nanw
fc70ede664 feat(docker): make BACKEND_HOST and FRONTEND_HOST env-configurable
The production image's start-backend.sh and start-frontend.sh previously
hard-coded --host 0.0.0.0 (uvicorn) and HOSTNAME (Next.js standalone
default). That's fine for bridge-mode deployments where the port
publish binds to the host, but in network_mode: host the container's
processes bind directly on the host's interfaces — exposing :8001 and
:3782 to the LAN.

This change makes both bind addresses env-configurable:

  start-backend.sh:  --host ${BACKEND_HOST:-0.0.0.0}
  start-frontend.sh: export HOSTNAME=${FRONTEND_HOST:-0.0.0.0}

Defaults preserve the current behavior. Setting
BACKEND_HOST=127.0.0.1 and FRONTEND_HOST=127.0.0.1 in compose.yaml
under a host-mode service gives loopback-only bindings.

Note: setting BACKEND_HOST=127.0.0.1 in bridge mode breaks the
port publish (uvicorn binds inside the container's loopback). Use
this env var only with network_mode: host.
2026-06-23 10:18:25 +08:00
Ilia Avdeev
5c0e057c27 refactor: move Back link to its own row in the page header 2026-06-22 17:37:57 +02:00
TyrionH-is-coding
effbb82798 fix(llm): enable SiliconFlow native tool calls 2026-06-22 22:48:42 +08:00
Ilia Avdeev
8e21c3c644 feat: redesign User Management page (avatars, search, skeleton, confirm dialog) 2026-06-22 15:22:53 +02:00
Ilia Avdeev
b41e6ee299 test: guard supervisord-as-root + non-root children invariant 2026-06-22 14:51:13 +02:00
Ilia Avdeev
bac6836421 fix: run supervisord as root so services start under rootful Docker 2026-06-22 14:51:13 +02:00
Bingxi Zhao (Frank)
59f499b2c3 docs(readme): correct Docker networking to the in-container proxy model
#577 moved /api and /ws behind a request-time Next.js proxy (web/proxy.ts),
so the browser only talks to :3782 and the frontend forwards to the backend
server-side. Update the Docker quickstart accordingly:

- drop the :8001 host mapping from the default `docker run`; publishing it is
  now optional (direct API access only)
- replace the "map both ports / no in-container proxy" warning with the
  single-port reality
- rewrite the reverse-proxy guidance: single-container needs no API base (point
  the proxy at :3782); only split deployments set next_public_api_base, which is
  read server-side and never sent to the browser

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v1.4.10
2026-06-21 15:00:56 +08:00
Bingxi Zhao (Frank)
42941faaff fix prs 2026-06-21 14:43:41 +08:00
Bingxi Zhao (Frank)
5eafa0c2fb refactor(multi-user): consolidate partner-turn detection + align MCP grant UI
Follow-up refinements on top of #579 (deny MCP tools until explicitly
granted), tightening decoupling and front/back consistency:

- Decouple: extract the duplicated `metadata.source == "partner"` check
  (deferred-tools, exec gate, tool composition, cron owner routing) into a
  single `AgenticChatPipeline._is_partner_turn` helper, so the partner
  authority-via-metadata contract has one definition instead of four
  inline copies.
- Frontend parity: the backend now denies MCP for non-admin users when the
  grant omits `mcp_tools`, but GrantEditor still showed `null` as
  "Default · all" / "all MCP". Make ModeSwitch's default-mode label
  caller-supplied, label the MCP section "Default · none" / "no MCP", and
  add a one-line rationale so admins are not misled into granting nothing.

Built-in optional tools keep `null = all`; only MCP tools fail closed.

Tests: ruff clean; pytest multi_user/mcp/partners/chat (545 passed);
web tsc + eslint clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 13:48:00 +08:00
Bingxi Zhao (Frank)
90046374b3 Merge pull request #579: deny MCP tools until explicitly granted 2026-06-21 13:44:42 +08:00
hinotoi-agent
dab6347e59 fix: deny ungranted MCP tools for non-admin users 2026-06-21 11:03:24 +08:00
Bingxi Zhao (Frank)
86ff120668 fix(profile): harden avatar fallback, admin ring in sidebar, dedupe auth-status fetch
Follow-up nits on the #573 profile/avatar work:
- UserAvatar: validate an icon marker's icon/color against the known sets and
  fall back to the deterministic avatar for unknown values. The backend
  _ICON_MARKER_RE accepts any [a-z0-9-] color, so a hand-set marker like
  "icon⭐bogus" previously rendered an invisible avatar
  (AVATAR_COLORS[unknown] === undefined).
- ProfileLink: pass role to UserAvatar so admins get the amber ring in the
  sidebar, matching the "amber ring at every size" intent.
- useAuthStatus: share one in-flight /api/v1/auth/status request across the
  hook's consumers (sidebar Admin/Logout/Profile links) so a page load makes a
  single call instead of one per consumer; cleared once settled so a later
  mount (after login/logout) refetches.

Verified: tsc, eslint, web node tests (142).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:11:48 +08:00
Bingxi Zhao (Frank)
2729b75dde Merge pull request #573: user profile page with avatar
Self-service /profile page (account info, icon/image avatar, sign out)
implementing the profile half of #553. Contributed by @IliaAvdeev.

Integration performed during merge onto current dev:
- Migrate ProfileLink and the profile page off the removed AUTH_ENABLED
  build-time export to runtime auth status (auth.ts was refactored on dev
  by #577). ProfileLink reads the full status via fetchAuthStatus (it needs
  username/avatar, which the useAuthStatus hook does not expose); the page
  gates on status.enabled.
- Resolve en/zh locale conflicts as a union of dev and PR keys.
- Honor EXIF orientation in createImageBitmap so the primary decode path
  matches the <img> fallback.
- Drop an unreachable AUTH_ENABLED render guard in the profile page.

Verified locally: tsc, eslint, ruff, web node tests (142), pytest
tests/multi_user (81 passed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 23:57:21 +08:00
LunaireReverie
ce188919d9 feat: 聊天历史加载动画支持
从聊天历史打开对话时添加加载过渡页:
- 模拟进度条(渐近99%,永久不停止,不设超时)
- 实时百分比显示
- 8秒后显示"仍在加载中…"提示
- 叉叉取消按钮(右上角)
- API 完成后跳转100%,400ms后淡出进入对话
- getSession / loadSession 支持 AbortSignal
- React Strict Mode 双挂载兼容

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 22:36:53 +08:00
Bingxi Zhao (Frank)
1d9a4a904d fix(logging): silence routine 200 access-log spam on all launch paths
The backend was logging every request (the chatty frontend polling of
/settings, /tools, /knowledge/list, /settings/llm-options, ...) as
`::1:0 - "GET ... 200 OK"`. uvicorn's per-request access log was only disabled
in run_server.py (access_log=False); the `deeptutor start` launcher and the
Docker entrypoints invoked uvicorn directly with it still on, so the 200s
leaked.

- launcher.py + Dockerfile (production start-backend.sh and the dev supervisord
  program): add `--no-access-log` so all launch paths match run_server.py.
- Funnel access logging through the existing selective_access_log middleware
  (non-200 only), but log via a `deeptutor.access` logger with its own INFO
  stdout handler (propagate=False). Previously it used `uvicorn.access`, which
  has no handler once uvicorn's access log is off, and the root console handler
  runs at WARNING — so non-200s were being silently dropped. Now 200s are quiet
  and 4xx/5xx still surface.
- Rewrite the middleware test to capture on the deeptutor.access logger directly
  (it no longer propagates to root).

Verified: live server with --no-access-log logs nothing for 200s and prints
`127.0.0.1 - "GET /api/v1/... HTTP/1.1" 404` for a 404. ruff + pytest (2447) green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:01:01 +08:00
Bingxi Zhao
7bbc4bbf83 Merge pull request #577: rootless-podman hardening + request-time proxy
Harden the published image for rootless podman with a read-only rootfs, and
move URL/auth knowledge from build-time sed to a request-time proxy (web/proxy.ts).
Includes follow-up fixes: JSON-backed DEEPTUTOR_* env wiring for both Docker and
the PyPI launcher (correct auth.json key), runtime client auth resolution,
100MB-safe upload proxy buffer, updated tests, and corrected docs.

Closes #576. Co-authored with @enihcam.
2026-06-20 21:15:17 +08:00
Bingxi Zhao (Frank)
8c4f394220 docs(containerization): correct proxy model (browser only needs :3782)
CONTAINERIZATION.md described the old browser-talks-to-:8001-directly model,
which contradicts the PR's own server-side proxy design. Clarify that the
browser only ever talks to the frontend origin (:3782); /api/* and /ws/* are
forwarded to the backend inside the container, so publishing :8001 is optional.
Rewrite the remote/reverse-proxy section (single-container needs no API base;
next_public_api_base is only for split deployments) and the troubleshooting note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 21:12:56 +08:00
Bingxi Zhao (Frank)
37049c3d33 fix(web): resolve client auth state at runtime; size proxy body for uploads
Two gaps in the PR's frontend changes:

1. Client auth awareness was permanently false. api.ts/auth.ts read
   process.env.DEEPTUTOR_AUTH_ENABLED in browser code, but Next.js only inlines
   NEXT_PUBLIC_ vars into the bundle — so the Sign-out / Admin affordances never
   rendered and apiFetch's 401 -> /login redirect never fired when auth was on.
   Resolve auth state at runtime from the backend instead: fetchAuthStatus()
   records it via setRuntimeAuthEnabled(), and components observe it through the
   new useAuthStatus() hook. Works on Docker (read-only rootfs), PyPI, and dev
   with no build-time baking. (The server-side gate in proxy.ts is unaffected.)

2. KB document uploads >10MB were truncated. All /api/* now flows through the
   proxy, whose body buffer defaults to 10MB while the backend accepts 100MB
   (DocumentValidator.MAX_FILE_SIZE). Raise experimental.proxyClientMaxBodySize
   to 110MB so uploads aren't silently cut off.

Adds a regression test that a 401 does NOT redirect when auth is disabled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 21:12:56 +08:00
Bingxi Zhao (Frank)
dfa0c9b1ea fix(deploy): wire DEEPTUTOR_* proxy env via single JSON-backed exporter
The PR's relative-path + proxy.ts rewrite design depends on two env vars
(DEEPTUTOR_API_BASE_URL, DEEPTUTOR_AUTH_ENABLED) read server-side by the
Next.js middleware. As submitted they were only set by the Docker entrypoint,
and the auth one read a non-existent auth.json key — so auth enforcement was
silently disabled and the PyPI `deeptutor start` path was unwired.

- Export both vars from render_environment() (the single JSON-backed source of
  truth), so the Docker entrypoint AND the `deeptutor start` launcher get them
  consistently. DEEPTUTOR_API_BASE_URL falls back to localhost:<backend_port>.
- launcher.py: set both in common_env using the resolved backend_url, so they
  track port-conflict reassignment.
- Dockerfile: drop the duplicated, buggy per-var heredocs (one read the wrong
  key `auth_enabled` instead of `enabled`, leaving the proxy auth gate always
  off); the export_runtime_settings_to_env eval now provides both. Add them to
  the env-unset list for hygiene.
- Update the two placeholder tests to assert the new proxy-based design instead
  of the removed build-time sed mechanism; add DEEPTUTOR_* coverage in
  test_runtime_settings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 21:12:40 +08:00
Bingxi Zhao (Frank)
dd47638133 Merge remote-tracking branch 'origin/dev' into feature/rootless-podman-hardening 2026-06-20 20:56:14 +08:00
Bingxi Zhao (Frank)
f8349fc1e5 Release v1.4.9
Settings polish and a Mastery -> Question Bank link:
- Search settings show only the connection fields the selected provider uses
- Connection profiles can be renamed and auto-name after their provider
- Graded Mastery Path questions sync into the session Question Bank
- Fix untranslated Settings-tour Tools step (en/zh) + guard test
- Refresh README / translated READMEs for the current v1.4.6+ UI

Bump __version__ to 1.4.9, add assets/releases/ver1-4-9.md, restore the
v1.4.7/v1.4.8 README rows dropped by an earlier docs-update commit, and
compress every README release row to <=30 words.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v1.4.9
2026-06-19 20:05:19 +08:00
Bingxi Zhao (Frank)
e7b47cfb55 update multi-language docs 2026-06-19 19:50:45 +08:00
Bingxi Zhao (Frank)
b364ffc593 minor fixes & docs update 2026-06-19 17:34:13 +08:00
Bingxi Zhao (Frank)
1db0abce8f Merge pull request #572 from HKUDS/fix/settings-tour-en-placeholders
# Conflicts:
#	web/locales/en/app.json
2026-06-19 17:06:39 +08:00
Bingxi Zhao (Frank)
0f25bdf38c Merge pull request #571 from HKUDS/feat/settings-profile-naming
# Conflicts:
#	web/components/settings/ServiceConfigEditor.tsx
2026-06-19 17:06:04 +08:00
Bingxi Zhao (Frank)
9710b9db9a Merge pull request #570 from HKUDS/fix/search-settings-conditional-fields 2026-06-19 17:05:29 +08:00
Bingxi Zhao (Frank)
88c2565389 release: v1.4.8
Partners become consultable agents and gain their own memory.

- My Agents now lists your Partners next to local Claude Code / Codex;
  connect one and the turn runs on `consult_subagent` against the
  partner's own chat loop, streaming its trace live. Every consult in a
  DeepTutor chat threads into one archived partner session.
- Partners get a split memory model via three always-on tools that
  replace chat's read_memory/write_memory on partner turns:
  partner_read (owner shared + own), partner_memorize (own only),
  partner_search (own history). The per-Partner memory toggles are gone.
- A `partner:` history reference resolves a partner transcript
  (admin-only) into a DeepTutor chat as third-party context.

Release-prep fixes for a clean CI parity run:
- partner.py: replace mypy-misparsed `# type:` dict-entry comments with
  a proper variable annotation.
- claude_models.py: `# nosec B606 B607` on the PATH-resolved `os.execvp`
  in the forked PTY child (no shell; pre-existed since v1.4.7).

Bump __version__ to 1.4.8, add assets/releases/ver1-4-8.md, README row.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v1.4.8
2026-06-18 22:16:31 +08:00
Bingxi Zhao (Frank)
7871955ab5 fix:partners & improve my agents 2026-06-18 22:00:59 +08:00
Bingxi Zhao (Frank)
1bf11d13e7 prepare 1.4.7 v1.4.7 2026-06-18 00:22:48 +08:00
enihcam
cd2621014a docs(containerization): add CONTAINERIZATION.md + README pointer
CONTAINERIZATION.md (7 sections):
  * Overview -- the architectural change (URL knowledge moves from
    build-time sed to request-time proxy rewriter) and the three
    deployment shapes that follow.
  * Docker (default) -- docker run with -p 3782/8001 and a
    deeptutor-data volume; remote / reverse-proxy deployment via
    system.json; host LLM providers (Ollama / LM Studio / etc.)
    via host.docker.internal.
  * Podman / rootless / read-only rootfs -- the compose.yaml walk-
    through, why each tmpfs/keep-id/read-only line is there, and a
    portable podman run equivalent. Notes the known
    /var/run/supervisord.pid follow-up.
  * Runtime configuration -- the data/user/settings/*.json layout
    and the no-compose-env-vars rule.
  * PocketBase -- the corrected mount path, single-user caveat.
  * Troubleshooting -- the four most likely first-boot issues.
  * Security notes -- non-root user, RO rootfs, keep-id, sandbox
    runner trade-off, CORS, auth gating.

README.md gets a one-line pointer in the 'Option 3 -- Docker'
section, right after the GHCR image list.
2026-06-17 21:41:01 +08:00
enihcam
90f2f6afee feat(deploy): add podman compose.yaml + .env.example for rootless
Tested rootless-podman deployment shape:

  * read_only: true on every service
  * userns_mode: keep-id (host UID 1000 -> container UID 1000)
  * tmpfs mounts for /tmp, /run, /var/run, /var/log, /root, /home
  * bind mounts on ./data (no named volumes: podman auto-creates
    them with the userns-mapped root UID 100000, which 755's
    incorrectly against the host)
  * loopback-only port bindings (drop the 127.0.0.1: prefix to
    expose on all interfaces)
  * PocketBase sidecar uses the corrected /pb_data, /pb_public,
    /pb_hooks mount paths from the docker-compose fix.

The entrypoint chowns /app/data and gosu-drops to the unprivileged
deeptutor user (UID 1000) before starting supervisord, so under
userns_mode: keep-id the running process is your host user.

.env.example carries only the host-side loopback bindings and TZ. URL
knowledge lives in data/user/settings/system.json (read by the
entrypoint on every start -> DEEPTUTOR_API_BASE_URL -> proxy.ts). No
compose env var for the API base.
2026-06-17 21:41:01 +08:00
enihcam
e7991d6056 fix(docker-compose): correct pocketbase mount path
The upstream ghcr.io/muchobien/pocketbase image's entrypoint uses
absolute paths (no /pb/ prefix): --dir=/pb_data --publicDir=/pb_public
--hooksDir=/pb_hooks. The previous example mounted at /pb/pb_data and
crashed on first start with 'mkdir /pb_data: read-only file system'.
Split the single mount into three matching the upstream entrypoint:
/pb_data, /pb_public, /pb_hooks.
2026-06-17 21:41:01 +08:00
enihcam
46681b572c feat(docker): harden image for rootless/RO rootfs + drop runtime sed
The frontend no longer bakes the backend URL into the bundle at build
time and mutates it with sed on every container start. Instead:

  * web/lib/api.ts: apiUrl and wsUrl become one-line pass-throughs, so
    the browser fetches relative paths through the frontend
    (:3782/api/...). All existing call sites keep working unchanged.
  * web/proxy.ts: catches /api/* and /ws/* and rewrites them to
    DEEPTUTOR_API_BASE_URL at request time, reading
    DEEPTUTOR_AUTH_ENABLED for the auth-redirect check.
  * web/lib/auth.ts: switches from NEXT_PUBLIC_AUTH_ENABLED (build-time)
    to DEEPTUTOR_AUTH_ENABLED (set by the entrypoint on every start).
  * Dockerfile: drops the .env.local placeholder block, the sed -i in
    start-frontend.sh, and the runtime API-base fallback chain. Adds
    gosu, bakes a non-root 'deeptutor' user (UID 1000), and has the
    entrypoint chown /app/data and export DEEPTUTOR_API_BASE_URL and
    DEEPTUTOR_AUTH_ENABLED from data/user/settings/*.json on every
    start. supervisord is now invoked under 'gosu deeptutor'.
  * web/tests/api-resolve-base.test.ts: deleted (its 8 tests reference
    resolveBase / isApiBasePlaceholder, both gone; apiUrl/wsUrl are
    now pass-throughs so the rest is meaningless). The auth-redirect
    test is updated to prime DEEPTUTOR_AUTH_ENABLED instead.
2026-06-17 21:40:58 +08:00
Bingxi Zhao (Frank)
7d3a06ca8f fix: repair v1.4.6 CI failures (lint + RAG/partner test isolation)
The v1.4.6 squash shipped three CI-red issues that the release pre-commit
gate could not see (ruff hook runs with --exit-zero; the release process
never runs pytest):

- partners WS chat referenced an undefined `mgr` (ruff F821, and a real
  runtime NameError on the partner WebSocket chat path) — bind
  `mgr = get_partner_manager()` in the handler, matching the file's idiom.
- GraphRAG initialize/search tests drove write_settings() through the real
  catalog, which has no active embedding model in CI — pin fake llm +
  embedding configs in `_stub_build`, the same way the LightRAG test does.
- PageIndex `test_factory_dispatches_by_provider` constructed a real
  LlamaIndexPipeline whose __init__ resolves the embedding catalog — stub
  `_configure_settings`, matching the LlamaIndex pipeline tests.
- New `test_chat_does_not_auto_start_stopped_partner` spawned a real
  PartnerRunner task and cancelled it across TestClient per-request event
  loops — drive the start/stop/chat sequence through one shared loop via a
  context-managed TestClient.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 11:28:18 +08:00