#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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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.
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.
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.
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.
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>
A broad consolidation release across four product surfaces.
- Learning Space: Space becomes a learning dashboard; My Agents imports
local Claude Code / Codex chat history into resumable agents (with an
objective explore_context briefing so the tutor never role-plays the
user); Memory is promoted to a top-level /memory route; Partner
conversations flow into Memory; EduHub skills install inline.
- Knowledge Center: /knowledge rebuilt as a console with per-engine
detail pages; GraphRAG / PageIndex / LightRAG engines join LlamaIndex;
linked-KB read-only mounts; Obsidian live-vault capability.
- Settings: pluggable document parsing (MinerU / Docling / MarkItDown)
with a content-addressed cache and MinerU cloud/local backends; voice
TTS/STT; image & video generation; rebuilt settings navigation.
- Platform: per-user capability gating by assigned model; Solve rebuilt
on the chat loop with a per-step gate and mid-run failure fallback;
username login + inline errors; CLI skill publish/update; picker
polish; math-before-citation render fix.
Docs were split out to a standalone site, so site/ is now landing-page
only. Bumps __version__ to 1.4.6 and adds assets/releases/ver1-4-6.md.
Folds in mypy fixes surfaced by pre-commit (mineru/local Path typing,
knowledge/manager no-redef, explore_context token kwargs, CLI
set_dist_tag capability probe) plus prettier reformatting of
previously-committed web files.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The turn path (chat/partners/mastery via turn_runtime) already enforces
LLM-grant access at its single enforcement point and surfaces a clear
terminal "no model assigned" rejection — so require_llm_access was never
wired to any endpoint and only duplicated that logic. Drop it (and its
guard-only tests) and have turn_runtime reuse has_capability_access, giving
the gate one source of truth shared with the frontend lock.
Frontend fixes kept from the original PR plus two corrections:
- capabilityForPath now matches on a path-segment boundary, so a sibling
route like /booket can't be swallowed by the /book prefix (+ regression).
- fix the misleading Knowledge sidebar comment — Knowledge needs no
per-user grant and is never gated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>