Commit Graph

37 Commits

Author SHA1 Message Date
evan188199-tech
4c2428db09 fix(api): preserve actual proxy peer identity (#1426) (#1427)
Co-authored-by: XZH <cto@xzh.ai>
2026-09-14 01:28:09 +08:00
Bingxi Zhao (Frank)
04040a2c06 release: v1.6.5
Ship a content workspace you choose, one exec tool for every language,
Mastery Path modes that gate its tools, and Settings that grades
readiness instead of listing faults.

Release notes: assets/releases/ver1-6-5.md
2026-09-06 13:46:29 +08:00
Bingxi Zhao (Frank)
02ba56793e chore: checkpoint backend stabilization workspace 2026-09-01 21:28:15 +08:00
Bingxi Zhao (Frank)
bd80a4d28a release: v1.5.17
Partners stop being a deployment-wide admin resource and become
per-user: three nested rights (manage / use / neither) replace the
blanket admin gate on the router, each member can build and own their
own, and every person's conversations with a partner stay private to
their account. Grants keep working and now offer only admin-managed
partners. Channel runtime state moves from one directory per channel to
one per partner — copied, not moved, and only when its owner is
unambiguous — so two partners can finally run the same channel.

Around that: a knowledge base can track GitHub repositories and re-sync
their Markdown (#903); Antigravity CLI joins My Agents now that Gemini
CLI is retired (#828); personal WeChat signs in from a QR code drawn in
the browser instead of the server log (#951); a chat account can be
linked to a DeepTutor account with /link; containers re-apply the extras
they declare instead of losing them at compose down (#762); and
`deeptutor doctor` answers whether a workspace is ready to run (#959).

Reliability, largely from community PRs: embeddings survive a
rate-limited provider through key rotation, a retry budget and a global
throttle (#962); MinerU parsing and code execution work on Windows
(#844, #964); indexing fails bounded instead of hanging (#946); MinerU
page-layout blocks stop being indexed as content (#949); voice uploads
carry a MIME the transcription API accepts (#945); and reasoning effort
can be overridden per conversation (#641).

Release plumbing: notes in assets/releases/ver1-5-17.md, v1.5.13
archived, __version__ 1.5.17, README Releases row and all eleven
translations synced.

Two defects found by the release gate and fixed here:

- Six partner routes — the four channel-onboarding endpoints and both
  WeChat QR endpoints — kept the _auth-only mount they had inherited
  from the blanket admin gate, so any signed-in account could start a
  QR login for someone else's partner and write a bot token into its
  channel config. All six now declare _MANAGEABLE, and a sweep test
  asserts no {partner_id} route is left ungated.
- A configured api_key became `str | list[str]` when key rotation
  landed, but ten call sites pass it somewhere that takes one key; a
  list would have rendered into an Authorization header verbatim.
  keypool.primary_api_key reduces at each boundary.

Gates: pre-commit (all 15 hooks), ruff check + format, pytest
5276 passed, web 605 node tests, docs build.
2026-08-25 02:24:35 +08:00
Bingxi Zhao (Frank)
083ff4fe3d fix(docker): give the development image the web source it compiles from
`docker compose -f docker-compose.dev.yml up` came up with a dead frontend:
the development stage's supervisor program runs `node scripts/dev.mjs`, and
that path does not exist in the image. The stage builds `FROM production`,
whose ./web is `.next/standalone/`, then cherry-picked three files on top.

Verified against a real standalone build — its root holds exactly
`server.js`, `package.json`, a traced `node_modules` and the dist dir. Every
source file and every config is absent, so `scripts/` was only the first
thing to fail; `tsconfig.json`, `tailwind.config.js`, `postcss.config.js`,
`features/`, `types/` and `proxy.ts` were missing too, and the compose mount
list covers none of them either.

So take the builder's web tree wholesale instead of naming files that keep
drifting as web/ grows top-level entries. `--chown` during the copy keeps
node_modules from being re-layered, and the inherited production build is
cleared so `next dev` starts from an empty cache rather than a half-valid
one.

#906 also reported this as two `[program:frontend]` blocks in one supervisor
config, with the fix being to delete the dev.mjs one. That reading is wrong:
the blocks are in different build stages (`FROM production AS development`),
the production image has exactly one and is unaffected, and deleting the dev
block would have made the development image serve a production build with no
hot reload. The production stage is untouched here.

Not build-verified — no Docker daemon available on this machine.
2026-08-21 16:29:06 +08:00
Bingxi Zhao (Frank)
ef5ce9f952 fix: RAM issues 2026-08-02 13:07:32 +08:00
Bingxi Zhao (Frank)
740ec413a0 release: v1.5.7
Per-account MCP Services and CLI Apps — the two ways a deployment plugs in
tools DeepTutor never shipped — plus the isolation that makes them safe on a
shared install.

- MCP Services: a 45-entry curated store of hosted servers each account
  installs for itself, OAuth 2.1 (PKCE + dynamic client registration) for the
  servers that require it, static keys held by reference and resolved in memory
  at connect time, stdio refused for self-service. Settings no longer
  configures MCP; /settings/mcp redirects to the store.
- CLI Apps: 101 tools snapshotted from the two CLI-Anything registries.
  Installs are admin-only, the registry's install_cmd is parsed into an argv we
  build rather than executed, npm install scripts are forced off, and 66
  first-party entries are pinned to one reviewed commit. Apps land in
  data/cli-apps, one environment each, mounted read-only into the runner.
- Credentials that authorise a person move to data/system, the one branch the
  exec sandbox never mounts: Codex tokens relocate themselves on first use
  (refusing to follow a symlink), per-user MCP configs and keys land beside
  them.
- Grants gain a cli_apps whitelist with the same deny-by-default posture as
  MCP tools; a per-turn registry view keeps one owner's provider tools out of
  the process-global registry and refuses an unauthorised tool at execute, not
  just in the manifest.
- The composer reports what filled this turn's context window, a gutter rail
  jumps back through long conversations, and the workspace collapses to a
  drawer on small screens.
- The composer keeps focus after sending and across tab switches (#720);
  released images carry provenance and SBOM attestations (#722).

README prose, all ten translated READMEs, and the docs-site pages that named
Settings → MCP are updated to match. Release notes:
assets/releases/ver1-5-7.md
2026-07-31 00:25:48 +08:00
Bingxi Zhao (Frank)
c0037dfb58 fix chat attatchments 2026-07-19 16:56:34 +08:00
Bingxi Zhao (Frank)
9983c0a3d1 fix: partners & multi-user 2026-06-27 18:27:16 +08:00
nanw
34fb3501b6 fix(docker): make supervisord config portable across rootful + rootless keep-id
Removes `user=root` from the [supervisord] section in both production and
development supervisord configs, and rewrites the entrypoint comment to
explain why.

Background: under rootless podman + userns_mode: keep-id, container PID 1
runs as the host user (UID 1000) instead of root. The previous design
explicitly forced supervisord to drop privileges to root (`user=root`),
which works under rootful daemons (PID 1 is root, has CAP_SETUID) but
fails under rootless + keep-id — supervisord sees `user=root` in its
config, tries to setuid(0), lacks CAP_SETUID, and exits with
"Error: Can't drop privilege as nonroot user" (per supervisord
options.py: refuses to drop privileges when not running as root).

Fix: omit `user=` from the [supervisord] section so supervisord inherits
PID 1's UID (root in rootful; UID 1000 in rootless + keep-id). The
backend and frontend programs still drop to the unprivileged deeptutor
user via per-program `user=deeptutor` — setuid(1000) works because
either PID 1 is root (rootful) or PID 1 is already UID 1000 (rootless
keep-id, where the setuid is a no-op). /dev/fd/1,2 ownership matches
PID 1's UID in both runtimes, so supervisord's stdout/stderr writes
succeed without an explicit setuid dance.

Verified locally: clean heredoc indentation; supervisord config parses;
both [supervisord] sections confirmed without `user=root`.

Closes the rootless-podman + read-only-rootfs follow-up to PR #577
(reported by the user after #577 + #586 merged).
2026-06-24 20:24:06 +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
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
bac6836421 fix: run supervisord as root so services start under rootful Docker 2026-06-22 14:51:13 +02: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 (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
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)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
3d5c3a1eb5 improve chat 2026-05-12 02:20:30 +08:00
Bingxi Zhao (Frank)
85779c846b refactor env settings and installation 2026-05-11 12:59:56 +08:00
Bingxi Zhao (Frank)
28e225ee0e chore: prepare v1.3.1 release
Stability release after v1.3.0 covering safer RAG/KB routing, stronger
embedding validation, more reliable Docker/TutorBot restarts, Web UX
fixes, and Windows/encoding hardening. See assets/releases/ver1-3-1.md
for the full notes.

Made-with: Cursor
2026-04-28 12:00:11 +08:00
Bingxi Zhao (Frank)
2f6ac5aa80 release: v1.2.2 — Skills system, input perf, response_format auto-fallback, version badge
- User-authored Skills system (CRUD backend + REST API + chat composer integration)
- Chat input performance overhaul: ComposerInput / SimpleComposerInput state colocation
- response_format auto-fallback & runtime cache for incompatible providers
- LAN remote access fix (resolveBase hostname swap)
- Sidebar version badge with GitHub release comparison + GitHub icon link
- Deep Solve image attachment support via unified Attachment pipeline
- Agentic chat pipeline attachment passthrough in responding + acting stages
- TutorBot WebSocket auto-start, _safe_send, graceful disconnect
- Settings page API key masking with Eye/EyeOff toggle
- Book Library UI with search, status cards, and simplified BookSidebar
- Visualization fullscreen mode for SVG/Mermaid/ChartJS
- Embedding ConnectError retry, RAG None-embedding hardening
- KB delete robustness for orphaned config entries
- CLI parse_json_object whitespace normalization
- answer_now response_format guard
- New tests: TutorBot WS, CLI helpers, route-params, api-resolve-base
- Release notes (ver1-2-2.md) and README update

Made-with: Cursor
2026-04-22 20:45:51 +08:00
Bingxi Zhao (Frank)
2745e8bde9 feat(book): introduce book capability and restructure guide/co_writer modules
- Add new `deeptutor/book/` module with multi-agent pipeline
  (ideation, spine, page planner, source explorer, synthesizer)
  and rich block system (text, code, figure, quiz, flash cards,
  callout, deep dive, timeline, animation, concept graph, etc.)
- Add `/api/routers/book.py` and `deeptutor_cli/book.py` entry points
- Add web UI under `web/app/(workspace)/book/` with sidebar,
  chat panel, page reader, spine editor, progress timeline, and
  block renderers
- Move `deeptutor/agents/co_writer` -> `deeptutor/co_writer` and
  `deeptutor/agents/guide` -> `deeptutor/guide` (then remove guide
  entirely now superseded by book)
- Remove legacy guide UI, hooks, types, and API router
- Update visualize agents/prompts, notebook service, prompt manager,
  session turn runtime, and shared services to support new flows
- Refresh chat composer, sidebar, notebook selector, and locales

Made-with: Cursor
2026-04-20 00:33:33 +08:00
Bingxi Zhao (Frank)
445e7622e9 fix: docker, chat with refs 2026-04-10 22:54:58 +08:00
zzhtx258
26a82e77d3 update 2026-03-29 12:45:37 +08:00
Bingxi Zhao (Frank)
9bd7d5fba7 update readme 2026-03-24 21:07:49 +08:00
Bingxi Zhao (Frank)
c15e22a4b3 chore: stable fix, add tutorbot 2026-03-20 20:27:17 +08:00
Bingxi Zhao (Frank)
f3779138ae fix: remove lightrag and unify llm & search config 2026-03-13 23:48:49 +08:00
scrrlt
8a9949cdea fix(docker): make Dockerfile portable (no heredoc COPY, ensure bash) 2026-01-14 23:29:02 +11:00
Bingxi Zhao
b6600ab32c fix & update docs 2026-01-09 01:34:36 +08:00
Pancake
efc2007911 Apply local configuration and UI enhancements after dev merge 2026-01-09 00:43:52 +08:00
Pancake
27712e1fe9 fix docker 2026-01-06 12:33:49 +08:00
Pancake
ad27643878 fix docker 2026-01-06 12:18:28 +08:00
dependabot[bot]
33b46d28a2 chore(deps): bump node from 20-slim to 25-slim
Bumps node from 20-slim to 25-slim.

---
updated-dependencies:
- dependency-name: node
  dependency-version: 25-slim
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-05 17:58:30 +00:00
Bingxi Zhao
c780afe0ea fix docker 2026-01-04 01:47:58 +08:00
Bingxi Zhao
76fbe29393 add docker 2026-01-03 04:01:06 +08:00
andres4budly
6fa86b1f6c Add Docker infrastructure for DeepTutor, including multi-stage Dockerfile, docker-compose configurations (dev/prod), .dockerignore, and environment documentation in README. 2025-12-31 13:32:46 -06:00