Commit Graph

93 Commits

Author SHA1 Message Date
AleFlyX
44a0558305 fix: export the socket namespace under the lazy router profile
`DEEPTUTOR_CHAT_ENGINE=typescript-native` builds the app with `lazy=True`, and
in that profile RouterLoader stores routing patterns on a DeferredRouter
instead of the routers themselves, so `_router_loader.records` stays empty.
collect_api() reads the socket routes from those records because OpenAPI has
no socket namespace, so under that profile the artifact would lose all nine
paths.

Pin the eager loader before anything imports the app, the way
scripts/build_router_index.py already does. Verified by running `--check` in
both profiles: without the pin the lazy profile reports drift, with it both
report the committed surface.
2026-11-26 21:35:51 +08:00
AleFlyX
d518a3c587 feat: export the CLI and API surface the docs are checked against
The doc contract checks need the truth about what the CLI and the backend
actually expose. Reconstructing that from source with `ast` cannot see
registration that only exists at runtime (the imperative
`for action in (...): app.command(action)(...)` loop in deeptutor_cli/module.py,
`add_typer` aliases), so it has to guess and the guesses rot.

Export the surface from the live objects instead:

- CLI: `typer.main.get_command(app)` walks the Click tree, so loop-registered
  commands, aliases and Typer's default naming all come out correctly.
- HTTP: `app.openapi()["paths"]`, which resolves include prefixes and expands
  the lazy router loader.
- WebSocket: FastAPI omits socket routes from OpenAPI, so they come from the
  repo's own `RouterLoader.records` joined with the manifest prefixes.

The artifact is committed at docs/tests/docs_surface.json and rendered
deterministically (sorted, indent=2, trailing newline), so `--check` is a
byte comparison. Nothing reads it yet; the next commits switch the tests over
and add the freshness gate.

20 CLI groups, 610 HTTP paths, 9 WebSocket paths as of this commit.
2026-11-26 21:35:16 +08:00
evan188199-tech
964e800582 fix(scripts): tolerate legacy output encodings in extras installer 2026-11-02 22:33:28 +08:00
wangkai
cbd925db0f fix(api,modules): read generated indexes as UTF-8
The lazy router index and pip --report plan.json are written as UTF-8,
but were read with the locale default; build_router_index.py now writes
UTF-8 explicitly so the read and write sides share one contract.
2026-10-29 13:33:14 +08:00
Bingxi Zhao (Frank)
e99d632de5 fix: prepare modular installs and align dev documentation 2026-10-28 19:02:44 +08:00
Bingxi Zhao (Frank)
fbab59acbf feat: modularize installation and enforce feature dependency boundaries 2026-10-28 01:02:29 +08:00
Bingxi Zhao (Frank)
399297e7f0 feat: preserve TypeScript engine migration and workspace updates 2026-10-18 23:09:10 +08:00
Bingxi Zhao (Frank)
1829ae23f0 Fix PDF image mapping, caption refresh, and Grok detection 2026-09-23 10:48:36 +08:00
flower-moon
465a49222b feat(reading): refresh figures on already-ingested materials
The extraction fix only helps material ingested after it lands, and the retry
endpoint covers web sources and media — an uploaded document cannot be
re-imported at all. scripts/reading_refresh_figures.py closes that gap:
--material/--all picks the PDFs, store.refresh_document re-extracts them in
place, and the same run can caption what the refresh produced.

--dry-run is strictly read-only (it works even when the store API is missing,
because the new calls are imported lazily), and any real run asks for
confirmation unless --yes is passed.
2026-09-17 18:46:28 +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
evan188199-tech
f9721b61c4 perf(session): lazily load turn event traces (#1191)
* perf(session): lazily load turn event traces

* fix(session): bound trace previews at the storage layer

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-09-03 15:46:04 +08:00
Bingxi Zhao (Frank)
fc39543bc0 feat: integrate frontend backend and canonical routes 2026-09-01 22:24:29 +08:00
Bingxi Zhao (Frank)
02ba56793e chore: checkpoint backend stabilization workspace 2026-09-01 21:28:15 +08:00
Bingxi Zhao (Frank)
3403f97b2a feat(contracts): export frontend REST and turn schemas 2026-09-01 16:48:55 +08:00
Bingxi Zhao (Frank)
bd9f6a7625 release: v1.6.0 — connected learning workspaces
Release notes: assets/releases/ver1-6-0.md

Ship source-faithful reading, Courses and Little Tutor, Ask Questions,
bounded web-source sync, and shared Books with private reader state.
2026-08-27 22:03:09 +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
evan188199-tech
920ebc830b chore(web): stop tracking Next build output and enforce repo hygiene (#865)
* chore: keep Next build output out of Git

* chore: enforce repository hygiene in CI

* chore: enforce clean primary workspaces

* chore: block accidental main commits

* fix: make repository hygiene hook fail fast

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-16 19:12:24 +08:00
Bingxi Zhao (Frank)
ef5ce9f952 fix: RAM issues 2026-08-02 13:07:32 +08:00
Bingxi Zhao (Frank)
3b823ae5f7 minor fixes 2026-06-29 23:06:30 +08:00
Bingxi Zhao (Frank)
069ba53a00 docs:update readme 2026-06-14 00:53:57 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
2c1b8e56b2 release(1.4.0-beta): docs, version bump, CLI init wizard, packaging
- __version__.py bumped to 1.4.0-beta; pyproject.toml adds the
  ``deeptutor`` package-data globs so prompt YAMLs / capability
  prompts / Markdown templates ship in the PyPI wheel.
- New assets/releases/ver1-4-0-beta.md covers Auto Mode, Memory v2,
  agentic-engine rewrite, chat + LlamaIndex RAG refactor, new chat
  tools, Visualize+Animator merge, settings split, capabilities
  unification, multi-user / Zulip fixes, env/launcher rewrite.
- README.md adds the v1.4.0-beta entry at the top of the release
  notes; v1.3.0 rolls into the collapsed past-releases block.
- deeptutor_cli gains init_wizard.py (interactive provider menu,
  env-var auto-detect, live model-list fetch with curated fallback,
  optional connectivity probe) and a shared _tool_result helper;
  chat / common / config_cmd / init_cmd / provider_cmd updated to
  match.
- Removed legacy scripts/ helpers (_cli_kit, audit_prompts,
  check_install, generate_roster, migrate_kb, migrate_user_data,
  sync_prompts_from_en, test_embedding, test_llm_api) -- replaced by
  CLI subcommands or no longer relevant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:08:50 +08:00
Bingxi Zhao (Frank)
1596807242 refactor chat capability & RAG pipeline(llamaindex) 2026-05-13 21:36:07 +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)
ac8f00bd65 prepare v1.3.10 release 2026-05-10 22:56:21 +08:00
Bingxi Zhao (Frank)
72bcdd77d8 prepare v1.3.9 release 2026-05-09 02:53:14 +08:00
Bingxi Zhao (Frank)
2c4769a96f prepare v1.3.8 release
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-08 02:36:24 +08:00
Bingxi Zhao (Frank)
5c31f0dee6 Merge remote-tracking branch 'origin/main' into multi-user
# Conflicts:
#	deeptutor/knowledge/manager.py
#	deeptutor/services/memory/service.py
#	pyproject.toml
#	requirements/server.txt
#	web/app/(workspace)/agents/page.tsx
2026-05-04 17:12:06 +08:00
Bingxi Zhao (Frank)
eff1c0dff6 prepare v1.3.6 release
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-03 16:35:52 +08:00
Bingxi Zhao (Frank)
49661211ce prepare v1.3.5 release
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-02 20:16:07 +08:00
Bingxi Zhao (Frank)
824bf778df fix: lint & logging system 2026-05-01 01:39:08 +08:00
Srini
957b3b099f feat(embedding): add Gemini embedding provider support across runtime and setup tour
Register Gemini as a first-class embedding provider with endpoint/env defaults, expose it in start_tour embedding selection, and add regression coverage for runtime resolution and wizard options
2026-04-29 12:35:36 -07: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
8594b46cf8 Merge pull request #391 from jonathanzhan1975/fix/server-deps-and-utf8-encoding
fix: server startup on Windows + missing runtime deps in server.txt
2026-04-27 10:32:56 +08:00
Bingxi Zhao (Frank)
e53985d7f0 Merge origin/main into multi-user 2026-04-26 11:45:57 +08:00
jonathanzhan1975
8e1ceba3aa fix: server startup on Windows + missing runtime deps
Two independent issues that block `python scripts/start_web.py` after a
clean install on Windows:

1. UnicodeDecodeError when streaming subprocess output

   `_spawn()` opened the backend / frontend stdout pipe with `text=True`
   but no explicit encoding. On Windows this defaults to the system
   ANSI codepage (e.g. `gbk` on Chinese Windows), which raises
   `UnicodeDecodeError` as soon as the child process emits a UTF-8 byte.

   Fix: pin `encoding="utf-8"` and `errors="replace"` so any locale
   produces clean, lossless output.

2. Missing runtime dependencies in requirements/server.txt

   `deeptutor/services/llm/provider_core/__init__.py` unconditionally
   imports `AnthropicProvider`, `OpenAICompatProvider`, and
   `OpenAIResponses`, which in turn import:

     - `loguru`        (provider_core/base.py, openai_codex_provider.py,
                        openai_responses/parsing.py)
     - `json_repair`   (anthropic_provider.py, openai_compat_provider.py,
                        openai_responses/parsing.py)

   These are declared only in `requirements/tutorbot.txt`, so
   `pip install -r requirements/server.txt && pip install -e .` followed
   by `python scripts/start_web.py` crashes with `ModuleNotFoundError`
   before the API server can serve a single request.

   Fix: declare both packages in `server.txt` with the same version
   bounds used by `tutorbot.txt`.

Reproduced and verified on Windows 11 + Python 3.12 + a fresh venv.
2026-04-26 09:16:06 +08:00
Bingxi Zhao (Frank)
6428458049 chore: prepare v1.2.5 release 2026-04-25 22:08:44 +08:00
Bingxi Zhao (Frank)
c89a3df8a5 chore: prepare v1.2.4 release 2026-04-25 15:10:55 +08:00
Bingxi Zhao
f2686c4820 Merge pull request #376 from rogercsi/fix/uv-pip-compat
fix(scripts): prefer uv pip over python -m pip in start_tour.py
2026-04-25 14:19:52 +08:00
jonathanzhan1975
5586b7861e fix: use npm.cmd for version detection on Windows
On Windows, npm is installed as npm.cmd rather than a plain executable.
subprocess.run(['npm', '--version']) without shell=True raises
FileNotFoundError, causing the Node.js detection step to always report
npm as missing even when it is properly installed.

Reuse the existing _get_npm_command() helper (which already returns
npm.cmd on Windows) for the version-detection call, consistent with
how npm is invoked later during npm install.
2026-04-25 08:59:12 +08:00
Bingxi Zhao (Frank)
b5eab8b67a fix: tour 2026-04-24 23:15:26 +08:00
zouchengfu
55e744ac63 fix(scripts): prefer uv pip over python -m pip in start_tour.py
uv-managed .venv environments may have pip disabled (PEP 668 / uv's
default hardening).  Running `python -m pip install` inside such a venv
raises a CalledProcessError even though uv itself is available.

Introduce `_resolve_pip_cmd()` which checks `shutil.which("uv")` at startup:

- uv found  → use ["uv", "pip"] (uv auto-detects the active venv)
- uv absent → fall back to [_PYTHON, "-m", "pip"] (no regression)

All pip invocations in `_bootstrap()` and `_install_commands()` now use
`_PIP_CMD` instead of the hard-coded `[_PYTHON, "-m", "pip"]` prefix.
2026-04-24 22:53:16 +08:00
Bingxi Zhao (Frank)
4b7d24d33e release: v1.2.3 — document attachments, thinking blocks, provider core refactor
- Chat document attachments (PDF/DOCX/XLSX/PPTX) with text extraction
- Reasoning model <think> block display as collapsible cards
- Tri-state send_dimensions toggle for embeddings (#368)
- LLM provider_core module refactor + context_window detection
- Soul template editor (PR #373), Co-Writer save-to-notebook
- Knowledge Base drag-and-drop upload, delete resilience (#370),
  progress persistence, supported-file-types endpoint
- Question generation language fidelity via shared prompt directives
- Settings tour redesign, CLI notebook add-md/replace-md
- Bug fixes: CJK bot name slug, I18nProvider init, Skills default off,
  Moonshot base URL, version badge
- Provider registry: custom_anthropic, thinking_style, alias expansion
- +1900 test lines across 15 new/expanded test files

Made-with: Cursor
2026-04-24 22:36:32 +08:00
Bingxi Zhao (Frank)
77f29cbcc7 fix lint 2026-04-23 19:29:16 +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
xor_xe
6ca2ecd64f feat: add optional PocketBase integration for auth and session storage
Introduces PocketBase as an optional sidecar for authentication and
session/KB storage, activated only when POCKETBASE_URL is set in .env.
Falls back to the existing SQLite/JSON backend when not configured.

Backend:
- SessionStoreProtocol (typing.Protocol) + get_session_store() factory
- PocketBaseSessionStore: JSONL write-ahead buffer, batch-flush on turn end
- pocketbase_client.py: singleton admin client, 60s in-memory token cache
- auth.py: additive PocketBase path (email-based login/register)
- CORS: explicit origins instead of wildcard (wildcard+credentials fails)
- WebSocket: validate token at connect time when AUTH_ENABLED

Infrastructure:
- docker-compose: pocketbase service with healthcheck + depends_on
- scripts/pb_setup.py: idempotent PocketBase collection bootstrap
- requirements/server.txt: pocketbase>=0.12.0

Frontend:
- Register/login: username field -> email field for PocketBase mode
- auth.ts: normalise FastAPI 422 errors to plain strings
- agents page: guard bots.map() against non-array responses
- settings page: graceful fetch error handling
- *.env.local added to .gitignore

Docs: README PocketBase sidecar setup section added
2026-04-17 21:42:29 +04:00
Bingxi Zhao (Frank)
9544075d60 v1.1.0-beta
URL-based chat routing, Snow theme, WebSocket heartbeat & auto-reconnect,
ChatComposer perf optimization, embedding provider registry overhaul,
Serper search provider, streaming idle timeout, and expanded test suite.

Made-with: Cursor
2026-04-14 22:11:48 +08:00
Bingxi Zhao
83e8b4a796 Merge pull request #309 from pietrondo/fix/windows-npm-cmd
fix: handle npm.cmd correctly on Windows
2026-04-14 20:20:08 +08:00
Mark Janzer
9010491bfd fix: prefer unresolved sys.executable to stay inside venv
On macOS with Homebrew Python, `Path(sys.executable).resolve()` follows
the venv symlink back to the system interpreter.  PEP 668 then blocks
pip installs with "externally-managed-environment", causing the setup
tour to fail.

Swap the check order so the unresolved venv path is preferred when it
exists, falling back to the resolved path only when necessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 11:36:05 -07:00