Commit Graph

99 Commits

Author SHA1 Message Date
evan188199-tech
a8d41bd4fa fix(api): return JSON for unhandled exceptions (#928)
A catch-all handler so 500s carry a JSON body instead of Starlette's plain-text default.
2026-08-19 23:36:18 +08:00
Bingxi Zhao (Frank)
7c6bcfaef7 release: v1.5.14
Immersive Reading, self-configuration, and a two-way IMA library.

- Immersive Reading: a new capability that opens a document beside the
  thread. New reading engine (PDF pages / slides / page-sized sections),
  five reading tools, a deterministic locate pre-pass that grounds the
  turn without a second LLM call, /api/v1/reading, and a reader pane with
  selection, highlights, notes, and export to an annotated PDF or Markdown.
- Setup capability: inspect the install, apply a setting, install a
  parsing engine, or request a credential from a chat turn. New settings
  spec table; a candidate value is probed before it is committed, and API
  keys never enter the model's context.
- Tencent IMA: pipeline split into transport/envelope/models/sources/
  notes/media/inventory, an additive capability with five tools, and
  connected libraries that can finally be enumerated (bounded listings
  are reported as a lower bound).
- Retrieval: supports_rag_retrieval() replaces is_connected_kb() for the
  "can I sweep this?" question, so linked / lightrag_server / ima sources
  stop being silently dropped from every book.
- Notebooks: their own console at /notebook, per-notebook locks and atomic
  writes, copy / move / export routes, damaged files surfaced instead of
  dropped, and renaming a record no longer clears its knowledge-base link.
- Settings persistence: one lock and one atomic replace shared by every
  writer of interface.json; the PUT endpoints stop writing the
  defaults-merged view back to disk.

Release notes: assets/releases/ver1-5-14.md
2026-08-19 17:34:52 +08:00
Bingxi Zhao (Frank)
96d6df9eb1 release: v1.5.13
Book is the bulk of this one. Compilation outlives the request that
started it, so a bus owned by that request dropped every background event
and "watch your book being written" degraded into a frozen page; the
stream is now owned per book by the process and survives a refresh or a
reconnect. Reading progress is finally recorded — `visited_page_ids` and
`bookmarked_page_ids` had been declared but never written for the life of
the feature — and rolls up into a completion score and weak chapters. A
book can also leave the app now, as one self-contained Markdown document,
with non-ASCII titles surviving the download.

Two scheduling defects that were invisible in production are fixed: the
same page compiled twice concurrently (billed twice, one result
discarded), and a book grinding on through a provider outage until every
chapter was half-generated. The source sweep is bounded and allocated
round-robin rather than spent on the first few knowledge bases, and
retrieval now tells indexed bases from connected pointers, so an Obsidian
vault or a remote IMA library no longer contributes zero while looking
like a source with nothing relevant. Confirming a spine shows a live
per-chapter estimate derived from the Section Architect's own templates.

Also here: three home starter suggestions built from memory recall,
mastery-path handoff moved into one module that changes lease, session
preference, and live turn together, and account-level Tencent IMA
credentials with the per-KB pair still winning.

Notes: assets/releases/ver1-5-13.md

This commit also carries the README prose sync, the eleven translated
READMEs, the release-notes archive sweep, and the version bump. Two gate
fixes ride along: the `Stamped` protocol is declared read-only so the
frozen `EntityStamp` satisfies it, and six GraphRAG adapter tests that
reached a deep `graphrag` import without guarding it now skip like their
four neighbours instead of failing where the extra is not installed.
2026-08-17 11:22:26 +08:00
Bingxi Zhao (Frank)
37723d1db3 feat(home): build the starting points from L3 plus the last k activities
Two inputs, which is what this always should have been.

**L3.** The consolidated read on the learner — and in particular the
familiar/practising/unsure split in ``scope`` — is the single most useful thing
to know when proposing what to look at next, and it was not being read at all.
Now rendered through the memory parser (so footnote markers and their HTML
comments never reach the prompt) and bounded, with each slot's unspent budget
carried to the next: ``preferences`` is two lines, and its leftover is what
lets ``scope`` be shown in full. Section names pass through untranslated
because the consolidator writes them in the deployment's own language
("不确定" / "Unsure") and reading them is exactly the model's job.

**The last k activities, flat.** The per-surface quota and round-robin are
gone. What someone touched most recently is the signal; which surface it
happened on says nothing about whether they are in the middle of it. Noise is
still dropped, but now *before* the cut rather than after — placeholder titles
are the newest rows by definition, so "take k then filter" returns nothing on
an install where someone just opened three blank chats.

k defaults to 20 and is adjustable in Settings → Chat → Starting points. Per
user, not admin-gated: it changes the size of one prompt built from the
caller's own memory, not a resource anyone else shares.

**Language comes from the setting, not the caller.** The endpoint no longer
takes a language parameter; the service reads the learner's model-output
setting (Settings → Appearance), the same one the chat agent answers in. The
UI locale could resolve before settings loaded, and with one cache per user the
two would overwrite each other on every visit. This also retires the
scope+language throttle key — there is one language now, so one key.

On a real install this took the material from 5 traces to 18 plus 6k of
profile, and the proposals from "DeepTutor 这种 AI 助教如何实现启发式引导" to
"LangGraph 状态共享与竞争条件处理".
2026-08-17 09:57:56 +08:00
Bingxi Zhao (Frank)
7229ef1d32 feat(home): generate starter suggestions from memory
Three chips for the home composer, each two strings doing different jobs:
``label`` is what the learner reads, sized for a chip; ``prompt`` is what gets
sent as their own message when they click, so it is first-person and complete
— "把我上次做错的那道链式法则的题再讲一遍", not "你上次在学链式法则", which a
model can only agree with.

Reads are stale-while-revalidate. The request path does exactly one thing:
read a small JSON file. Deciding whether the material changed means walking
seven surfaces, so that lives in the background task, throttled to once a
minute per user and deduped by an in-flight map — a burst of page loads must
not become a burst of LLM calls. Regeneration is due when the material's
fingerprint moves or the set is older than six hours; the reroll endpoint
bypasses both, because there a human is waiting.

Material comes from recall, capped per surface and interleaved so the three
chips differ in kind rather than being three chat sessions. No material means
no model call at all — a new learner gets an empty list, and the client shows
its own fixed starters, which is honest about knowing nothing yet.

Partial model output is discarded whole: one lonely chip under the composer
reads as a rendering bug.

The endpoints go above dashboard's ``/{entry_id}``, which matches any single
segment and would otherwise turn /suggestions into an activity lookup.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
94a6edd563 feat(mastery): harden path state and turn recovery 2026-08-17 09:57:55 +08:00
Lan-zk
3f1894e0c4 fix(knowledge): harden GraphRAG model and embedding compatibility (#747)
* fix(knowledge): add GraphRAG model compatibility layer

* fix(graphrag): harden compatibility preflight

* fix: align GraphRAG compatibility with current dev

* test: skip GraphRAG config test without optional extra

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-17 01:12:05 +08:00
HarryH
773ae04ce7 修复 IMA 只读连接与原文检索 (#873)
* 文档:明确 IMA 只读连接流程

* 文档:细化 IMA 连接状态与安全边界

* 文档:制定 IMA 只读连接实现计划

* 测试:固定 IMA 知识库列表协议

* 功能:支持枚举 IMA 知识库

* 功能:新增安全的 IMA 知识库列表接口

* 修复:说明 IMA 按知识库连接状态

* 功能:增加 IMA Web 连接接口

* 功能:接入 IMA 只读知识库连接表单

* 文案:补齐 IMA 连接流程中英文

* 修复:适配 IMA 知识库列表字段

* 修复:完善 IMA 认证与凭据清理

* 格式:统一 IMA 模块代码样式

* fix: load IMA source content safely

---------

Co-authored-by: TyrionH-is-coding <TyrionH-is-coding@users.noreply.github.com>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-17 00:34:04 +08:00
Bingxi Zhao
1cc27028f6 fix: isolate invalid Partner channel configs (#827)
Reject newly saved enabled channels with empty allow lists, and safely skip only legacy-invalid channels at startup while preserving deny-by-default behavior and all other Partner services.
2026-08-16 23:15:05 +08:00
Bingxi Zhao
caa566cf21 fix: protect model catalog secrets in settings API (#857)
Redact credentials from catalog responses and diagnostic streams, restore masked placeholders server-side, and resolve saved credentials for model discovery without returning them to the browser.
2026-08-16 22:43:40 +08:00
Npaobi
265ff083ce fix: sync partner tool list with global chat tool toggles (#850)
* fix: sync partner tool list with global chat tool toggles

When a user disables a toggleable tool (web_search, brainstorm,
paper_search, reason) in Settings → Chat → Tools, partners
must respect that choice in both the Mind tool picker and at
runtime. Previously the picker showed the full USER_TOGGLEABLE_TOOL_NAMES
pool and defaulted every tool to enabled, and the runtime intersected
only with the partner's own config — so a globally-disabled tool could
still be picked and executed inside a partner.

Changes:
- deeptutor/agents/_shared/tool_composition.py
  Add admin_enabled_optional_tools() that reads the admin's
  interface.json directly (partners run in a synthetic scope, so
  get_enabled_optional_tools() would read the wrong settings file).
  Fails open to the full toggleable set on missing/unreadable file.
- deeptutor/api/utils/tool_options.py
  build_tool_options() now filters the tools list against
  admin_enabled_optional_tools(), so globally-disabled tools do not
  appear in the Mind step picker and are excluded from the default
  'select all' set.
- deeptutor/services/partners/runtime.py
  _resolved_enabled_tools() intersects the partner's configured
  (or defaulted) whitelist with admin_enabled_optional_tools(), so a
  globally-disabled tool can never run inside a partner turn.
- tests/services/partners/test_partner_runtime.py
  Three new tests covering: explicit config intersection, default
  config intersection, and fail-open on missing admin settings.
- tests/api/test_partners_router.py
  New test verifying tool-options endpoint honors global chat toggles.

Closes: Partner tool picker and runtime drift from global chat tool switches

* fix(pre-commit): apply ruff import sorting

* fix: scope optional tool filtering to partner surfaces

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-16 19:21:33 +08:00
Ching Wing Kwok
8297fc7b7e feat(provider): add codebuddy as a LLM provider (#780)
* feat: add codebuddy provider

* fix: treat codebuddy as login-backed provider

* feat: sync codebuddy account models

* fix: ignore no-key placeholder for codebuddy

* feat: add codebuddy web login

* fix: streamline codebuddy settings and latency

* fix: support switching codebuddy accounts

* fix: preserve codebuddy sessions and tool calls

* feat: use CodeBuddy HTTP provider over Agent SDK

Chat with CodeBuddy over plain HTTP by reusing the login state that the
IDE plugin / CLI stores on disk, instead of bundling the ~130MB Agent SDK.

- add codebuddy_http_provider (OpenAI-compatible /chat/completions on
  <endpoint>/v2) with codebuddy_credentials for local OAuth session reuse
- provider_factory picks HTTP transport whenever a login state or API key
  is available; Agent SDK stays as fallback for CLI agent features
- demote codebuddy-agent-sdk from core deps to optional codebuddy extra
- default model codebuddy/default -> codebuddy/hy3
- update auth card UX and locales for SDK-less sign-in flow

* chore: label codebuddy provider as codebuddy/workbuddy in the dashboard

* style: apply pre-commit formatting after upstream merge

* chore: capitalise codebuddy provider label as CodeBuddy/WorkBuddy

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-13 00:02:42 +08:00
NoxsMedia
104e844b55 feat(codex): persist managed reasoning effort overrides (#789)
* feat(codex): persist managed reasoning effort overrides

* fix(codex): protect managed catalog refresh state

* feat(codex): allow user reasoning overrides

Expose only owner-scoped managed Codex model metadata and validate updates against provider-supported reasoning levels. Add ordinary-user settings controls without granting model catalog or provider administration access.

* fix(codex): bind reasoning overrides to OAuth account

Persist only a one-way account binding on managed Codex profiles. Hide and reject stale or legacy-unbound reasoning controls until a successful catalog refresh, and do not carry overrides across account switches.

* fix(codex): reject stale cross-account overrides

* fix(codex): isolate account switches at runtime
2026-08-12 23:38:15 +08:00
Bingxi Zhao (Frank)
a8e03347cb fix: decouple mastery paths from chat sessions (#810) 2026-08-12 16:11:35 +08:00
Bingxi Zhao (Frank)
712d4137f0 feat: DSML streaming robustness, memory observability, and mastery pending questions
Work in progress carried over from earlier sessions, committed together.

Chat / DSML:
- Tolerate partial and malformed tool-call tags mid-stream, with a character
  ceiling so a stray "<" cannot make the live stream wait forever for its
  closing bracket.
- Narration rounds can now mark their prose as visible, so a DSML round that
  keeps the text surrounding a call has it persisted as part of the answer.

Runtime observability:
- New deeptutor/runtime/memory_probe.py reports resident memory across the
  process tree, exposed at /api/v1/system/memory and surfaced in the settings
  status strip. psutil is a soft dependency, imported lazily with a /proc
  fallback, so a missing wheel costs the strip and not the app.

Mastery:
- New deeptutor/learning/pending.py projects a persisted PendingQuestion into
  the smaller public contract safe to hand the tutor model, and owns the
  multiple-choice translations shared by registration and grading.

LightRAG:
- New pipelines/lightrag/worker.py moves local indexing onto a worker thread's
  own event loop, so RAG-Anything's synchronous graph merging stops stalling
  unrelated API and LLM work.

Also: request-scoped output artifact delivery (api/routers/outputs.py),
partner runtime and path_service adjustments, and CLI chat renderer updates.
2026-08-09 02:31:44 +08:00
Bingxi Zhao (Frank)
8865da7c6d release: v1.5.10
The paths underneath the providers. A batch upload that stalled every other
request, a knowledge-base list that rescanned every index, a tool call
dispatched with no arguments and retried until the budget ran out — plus two
things that were quietly missing.

- Every account can sign in to its own Codex. The token authorizes one
  person's ChatGPT plan so the profile was correctly never grantable, but the
  OAuth endpoints were admin-only too, leaving ordinary users no route at all.
  A sign-in now publishes into the OWNER's catalog
  (data/users/<uid>/settings/model_catalog.json), keyed by the same owner
  resolution as the credential store; redacted_model_access gains those
  personal rows for the caller's own id only, so the option list, capability
  gate and selection validation cannot disagree. Partners are refused.
- Model output language is its own setting. Settings -> Appearance carries two
  independent toggles; resolve_languages() in interface_settings.py owns the
  legacy migration (a pre-split file inherits its single `language` into both),
  and both readers go through it. GET /settings/ui is public so /login and
  /register can bootstrap before a session, projected down to theme+language.
- A tool call with empty `arguments` is rejected in front of dispatch instead
  of run. The tool used to do the rejecting ("requires a non-empty command",
  "Unknown mode ''"), which does not read as a missing argument, so the model
  re-emitted the same call until the loop budget ran out. The guard names the
  missing arguments and their accepted values, enums included.
- Batch uploads move off the event loop (the chunked write, zip extraction and
  per-file PocketBase upload ran inline; the staging pass sat in an async
  BackgroundTasks entry, which starlette awaits ON the loop). KB listing reuses
  one reconciled snapshot instead of reloading config and rescanning every
  index per item.
- Deep Research mounts the read-only Obsidian tools instead of rag for a linked
  vault, injects the vault path server-side, and treats their evidence as
  citable.
- The server-side backend address is the IPv4 loopback on all three paths
  (launcher, Docker entrypoint, web/proxy.ts default): `localhost` resolves to
  ::1 first on a dual-stack host while uvicorn binds 0.0.0.0.
- Escape stops a streaming Partner reply and bails while any dialog overlay is
  mounted; vision overrides match `claude-` by vendor prefix and recognize Kimi
  K3 and Qwen3.8-Max; Codex context-window metadata survives the catalog round
  trip; editing a message no longer races its refresh; the deeptutor-cli wheel
  ships the agents' prompt YAML again and prompt misses are no longer cached.

Also fixes the `ruff format --check` failure red on dev since 6cd55939, and
syncs the README prose, all ten translations, and the release-notes archive.
2026-08-07 22:28:33 +08:00
Bingxi Zhao (Frank)
4041c75d8e feat(multi-user): let each account sign in to its own Codex (#781)
A Codex token authorizes one person's ChatGPT plan, so the profile is
correctly never grantable — but the OAuth endpoints were admin-only too,
which left ordinary users unable to reach Codex by any route: they could
neither be given the administrator's profile nor sign in for themselves.

What made per-user sign-in unsafe was where the profile landed:
``get_model_catalog_service()`` resolves a non-admin to the ADMIN catalog, so
a user's sync would have published their profile into the shared one. A
sign-in now publishes into the owner's own catalog, keyed by the same owner
resolution as the credential store, so a login and its profile can never
land in different places. Ordinary users get
``data/users/<uid>/settings/model_catalog.json``; an administrator gets the
shared catalog exactly as before.

``redacted_model_access`` — the one place grants are resolved — gains those
personal rows (source="personal") for the caller's OWN id only, so the
option list, the capability gate, and selection validation agree without
three separate merges, and an administrator inspecting somebody's grants
still sees only what they assigned. The resolution path merges the same
profiles so a personal selection resolves to a real profile, with the
owner's copy winning over a shared profile of the same managed id (the ids
are per-provider constants, and the administrator's copy lists their models,
not the user's).

Runtime token ownership needed no change: the provider already reads the
token per owner. Endpoint gating is narrower rather than absent — a partner
is refused, since it is a synthetic user whose owner is a real account and
admitting one would mean acting on that person's login, sign-out included.

The restricted-user Settings → LLM page grows the connect/refresh/sign-out
card (no catalog, no credentials), and a sign-in now drops the cached model
options so a freshly connected account does not keep seeing the old list.
2026-08-07 21:09:40 +08:00
Bingxi Zhao (Frank)
f342281f33 fix(knowledge): keep batch uploads off the event loop (#777)
Batch-uploading files stalled every other request — chat WebSockets included
— for the whole duration of the batch. Two blocking paths, both in an async
context:

* ``_save_uploaded_files`` blocks end to end (a chunked write of every
  uploaded byte, zip extraction, plus a synchronous HTTP upload per file
  when PocketBase is on) and was called inline from the upload and
  create-KB routes;
* the follow-up work runs in a FastAPI ``BackgroundTasks`` entry declared
  ``async def``, which starlette awaits ON the loop — only *sync* callables
  reach its threadpool — so the staging pass (a full-content hash per file
  plus a copy) and the per-file re-hash blocked there too.

Each of those moves to a worker thread. Reading ``UploadFile.file`` off-loop
is safe: it is the plain SpooledTemporaryFile, never the async API. The
provider index itself already ran through an executor, and the remaining
small JSON writes are left inline rather than paying a thread hop each.
2026-08-07 21:09:20 +08:00
Bingxi Zhao (Frank)
847d2e7fff test(question): stop the mimic websocket test from depending on import order
The fixture replaced the whole deeptutor.services.config package with a
two-attribute stub. That was enough for the router's own import, but the
websocket handler lazily imports deeptutor.api.routers.auth, which reads
other loaders out of the same package — so the test only passed when an
earlier test had already cached that module and the lazy import never
reached the stub. On its own it failed with ImportError, and any change
to test ordering could have flipped the full run red.

Defer everything not deliberately overridden to the real module (PEP 562
module __getattr__), so the fake stays two lines wide and cannot rot as
the auth path grows dependencies.
2026-08-07 03:18:38 +08:00
wayblink
be14c3ef23 feat: separate UI and model response languages (#758)
* feat: separate UI and model response languages

* refactor(settings): keep one owner for the interface.json language rules

The legacy migration — a file written before the UI/response split
inherits its single language into both fields — had been duplicated into
both readers of interface.json, as had the theme/language defaults. Two
copies of a migration rule drift.

Move the rule into resolve_languages() in the module that owns the file,
have the router compose its superset of defaults on top of the service's,
and cover the agreement with a test that reads one legacy file through
both paths. The helper also drops the separate key-presence check:
_normalize_language already falls back to its default for missing, null
and unrecognized values alike.

* fix: keep the language bootstrap single and local-choice-first

Merging dev surfaced three collisions this branch had not seen:

- The new bootstrap fetched /settings/ui unconditionally and overwrote
  writeStoredLanguage on every mount, undoing #730's rule that a choice
  made in this browser is the more specific signal and must win. Folded it
  into the existing guarded effect so one fetch serves both language
  fields and neither can clobber a local selection.
- apiFetch/apiUrl ended up imported twice in AppShellContext, which git
  merged without a conflict and tsc rejects outright.
- Three tests still stubbed get_ui_language at call sites that now ask for
  get_response_language: the question router's stand-in module and two
  mastery_path patches (renamed the zh case to say response language).

* fix(api): include response_language in the pre-session UI read

The bootstrap adopts both languages from this one endpoint, so leaving
response_language out of the projection meant a fresh browser always
inherited the interface locale and never saw the saved output-language
preference. It belongs with the other two: all three are the visitor's
own presentation choices, none describe the deployment.

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-07 03:13:04 +08:00
Huoran
6cd55939a4 fix(api): expose GET /api/v1/settings/ui without auth for pre-session language bootstrap (#763)
* fix(api): expose GET /api/v1/settings/ui without auth for pre-session language bootstrap

The app shell bootstraps the interface language from GET /api/v1/settings/ui
(added in #730), but auth pages (/register, /login) have no session, so the
request hit the router-level _auth dependency and returned 401. The bootstrap
silently bailed out and auth pages stayed English even with the persisted
language set to zh (#760).

Move the anonymous read to a public_router mounted before the gated settings
router. The payload is non-sensitive UI preferences (theme/language) only;
PUT /ui and every other settings endpoint remain auth/admin-gated.

Adds regression tests: anonymous GET returns 200, and the gated router no
longer carries GET /ui.

Closes #760

* fix(api): narrow the public UI read to theme and language

The endpoint was returning the whole saved `ui` blob to anonymous
callers, which also carries sidebar_nav_order, enabled_optional_tools
and chat_response_timeout — configuration that describes the deployment,
not the visitor. Project it down to the two fields a page can actually
need before it knows who is asking; the rest stays behind auth on
GET /settings.

Also fixes the gated-router assertion, which compared "GET" against a
list of method *sets* and so would have passed even with GET /ui still
mounted on the auth-gated router.

---------

Co-authored-by: Huoran559 <huoran559@users.noreply.github.com>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-06 22:25:13 +08:00
PenaFong
a8534ed336 fix: keep knowledge-base listing linear (#778)
Reuse the reconciled manager snapshot while building one knowledge-base list response so each item does not reload configuration and rescan every index.

Constraint: Preserve fresh config reads for standalone callers and target the upstream dev branch.

Rejected: Raise the proxy timeout | it masks repeated full-index scans and leaves list cost quadratic.

Confidence: high

Scope-risk: moderate

Directive: Do not reuse manager snapshots across await boundaries or write operations.

Tested: 53 focused pytest cases; Ruff check and format; 58-KB read-only benchmark completed in 2.114 seconds.

Not-tested: Full repository pre-commit suite.

Co-authored-by: OmX <omx@oh-my-codex.dev>
2026-08-06 19:19:53 +08:00
Dongyu
bf76ccfd83 fix(web): honour the saved interface language on first load (#730)
The interface language is persisted in the backend's ui settings, but only the settings route ever read it into state — so /home and every other page started in English until the user picked the language again in that browser.

The app shell now adopts the saved value once after mount, and only when the browser has recorded no choice of its own, so a local selection still wins. It goes through apiFetch (works with auth enabled), leaves the routes statically prerendered, and keeps the zh locale a lazy chunk.

Also replaces the duplicated "New conversation" sentinel check with a shared helper — the chat header showed the untranslated English sentinel the same way the sidebar did — and adds three composer aria-label keys that were referenced but missing from both catalogs.

Closes #729.
2026-08-03 21:45:40 +08:00
jax-novita
160f12ab24 feat(providers): add Novita AI as an LLM gateway (#746)
Registers Novita AI as an OpenAI-compatible gateway (https://api.novita.ai/openai, NOVITA_API_KEY) with base-URL detection and brand aliases.

Also teaches context-window detection about Novita's `context_size` metadata key — without it every Novita model, including the 1M-token ones, planned against the 16K-64K fallback.
2026-08-03 20:38:05 +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)
e1c669f02a feat(knowledge): add Tencent IMA as a connected knowledge engine
IMA (ima.qq.com) is where a lot of users already keep their library, and
its OpenAPI exposes retrieval over it. Adding it as a sixth engine follows
the `lightrag-server` shape exactly: a KB bound to `ima` is a connection
pointer, not an index. Nothing is copied and nothing is stored locally —
documents are added in IMA, retrieval calls IMA, and DeepTutor's chat loop
still writes the answer.

The wire is plain HTTP POST to `/openapi/wiki/v1/<method>` with two auth
headers and a `{code,msg,data}` envelope; `search_knowledge` returns
cursor-paginated items carrying a `highlight_content` snippet. Only the two
read-only calls we need are wrapped, and pagination is bounded so a server
that never reports the end cannot spin.

Credentials (`client_id` + `api_key`) and the library id live per-KB in
`kb_config.json` rather than as one global account key. IMA credentials
identify a person, so per-KB means each user on a shared deployment
retrieves through their own account, and connecting stays self-contained
with no separate settings surface to fill in first. Both metadata paths
already work off an allowlist, so the credentials cannot leak into
surfaced metadata; only the library id is exposed, for the UI to show.

`connect-ima` re-probes server-side and never trusts the client's verdict,
matching the LightRAG-server route. IMA KBs are registered as a connected
type — no folder under `base_dir`, no embedding reconcile, deletion drops
only our pointer — and are reported as non-enumerable in the manifest,
since claiming "0 documents" for a library held behind an API would be a
lie.

Backend only; the connect flow in the knowledge center UI is not wired up
yet.
2026-07-29 00:38:10 +08:00
Bingxi Zhao (Frank)
7a5102a8cd fix(codex-auth): route the OAuth callback by state, not by request user
The remote callback endpoint added in #716 cannot be authenticated: the
browser reaches /auth/callback on the far end of the user's own tunnel,
a different origin from the DeepTutor Web session, so no cookie is sent.
The user ContextVar is only ever set inside require_auth, which left
get_codex_oauth_service() resolving every callback to the default root
while the login operation lived under data/users/<id> — so remote Codex
sign-in returned login_not_active for every non-administrator.

Deliver by OAuth state instead. The state is a secret this process
minted for exactly one login and is compared in constant time, which is
already the trust model the loopback listener uses; no new authorization
surface is opened. Delivery keeps the endpoint's existing status codes:
409 when nothing is waiting, 400 when a login is waiting but the state
does not match.

The PR's endpoint tests monkeypatched the service factory, so user
resolution was never exercised; they now patch the delivery seam, and
three service-level tests cover routing to a non-default instance.
2026-07-28 19:20:57 +08:00
TyrionH-is-coding
1117e6fe93 fix(codex-auth): guide remote Codex OAuth loopback callbacks (#716)
For a remote or containerized deployment the browser's localhost is the
user's workstation while the OAuth listener runs on the server, so a
reverse proxy cannot deliver http://localhost:1455/auth/callback to that
private listener and Codex sign-in could never complete.

Keep the listener loopback-only and forward just the exact browser
callback path through the Web origin to a state-validating broker. The
settings card and CLI now show the real callback address, the SSH tunnel
command, an explicit authorize action and a countdown, and survive a page
reload; the deployment docs cover the Docker host-port and reverse-proxy
caveats.

The listener stays bound to loopback and ports 1455/1457 are never
published; the Web bridge rewrites only /auth/callback; the broker
requires an active operation and a constant-time state match; callback
responses are no-store HTML that never echo the code or state; PKCE and
the token exchange are unchanged. Binding the listener with
start_serving=False also closes a window where a connection could be
accepted before the callback object existed.
2026-07-28 19:20:27 +08:00
TyrionH-is-coding
c3d1dd0b15 feat(llm): add first-party OpenAI Codex OAuth provider (#690)
Replaces the oauth_cli_kit indirection with DeepTutor's own PKCE loopback
sign-in, an account-scoped live model catalog, and a Settings card that exposes
only the OAuth surface. Credentials live in `<user-root>/private/openai-codex/`
with owner-only permissions, atomic writes, and a generation guard that stops a
late refresh from resurrecting a signed-out session; `~/.codex` is never read or
modified. A CLI path shares the same service.

A Codex token authorizes one person's ChatGPT plan, so credentials anchor to the
signing-in account's own root and the managed profile is marked `owner_bound`:
`redacted_model_access` drops it for every caller, and it is not offered as an
assignable model. Signing in publishes the profile but only activates it when no
LLM is configured yet, so it never repoints a deployment that already has one.

Also from review: reschedule the status poll so one dropped response cannot
strand the card on "waiting"; defer the catalog reload when the operator has
unsaved edits instead of discarding them; log the real cause behind the generic
provider error; stop promising a retry when the token refresh actually failed;
bind both loopback stacks since `localhost` may resolve to either; and drop the
provider metadata fields nothing consumed.
2026-07-26 22:27:54 +08:00
Bingxi Zhao (Frank)
75900a5b2f fix(llm): resolve eden_ai binding alias and backfill Eden AI provider tests
Follow-up to #671. The eden_ai/eden-ai spelling variants lived in the
spec's keywords tuple, but keywords are only consulted by find_by_model
(which excludes gateways) — binding names resolve through
PROVIDER_ALIASES. Register the alias there (canonicalization folds
eden-ai into eden_ai) and trim keywords to the canonical name.

Backfill the four registry-wiring tests the Atlas Cloud addition (#654)
established as the pattern: spec fields + alias + base detection,
runtime binding resolution, settings provider choices, and the cloud
openai_compat native-tools guard.
2026-07-24 22:14:56 +08:00
Bingxi Zhao (Frank)
308a0606f9 perf(chat): eliminate the post-stream "generating" stall
The spinner (and a frozen tab) outlived the LLM stream by seconds and
grew with conversation length:

- DONE now carries the persisted user/assistant message ids so the
  frontend reconciles its optimistic ids in place (lib/turn-reconcile)
  instead of refetching, re-normalizing, and re-rendering the whole
  session after every turn.
- The turn-event workspace mirror writes the whole batch in one append
  off the event loop instead of one synchronous open/write per event.
- PocketBase gains a batch append_turn_events that uploads in the
  background; the events.jsonl rglob flush in update_turn_status is
  gone, and add_message returns the real record id.
- The streaming autoscroll pin is mutation/load-driven instead of an
  unconditional 60fps scrollHeight read (forced layout) per frame.
2026-07-24 17:35:19 +08:00
Bingxi Zhao (Frank)
5d315a271d fix(quiz): scope streaming quiz cards to their turn (#677)
Two quizzes in one chat session share positional question ids
(q_1..q_N), so answer state is turn-scoped (#487). But during
streaming generation the QuizViewer received turnId=null — the result
event only lands at turn end — which bypassed that scoping: the card
hydrated the previous quiz's answers through the legacy cross-turn
lookup, showed them as already answered, and auto-reported them back
with an empty turn_id while questions were still being generated.

- derive the quiz turn id from the streamed events themselves
  (extractQuizTurnId); the result event stays authoritative
- QuizViewer: without a turn identity the card is local-only — no
  notebook hydration, no auto-report, no upserts
- sqlite store: a lookup without turn_id now only matches the legacy
  namespace (turn_id='') instead of falling back to other turns' rows
2026-07-24 17:14:41 +08:00
Bingxi Zhao
ec0746c185 Merge pull request #648 from dryice/feat/code_block_theme
Add a theme selector for code blocks
2026-07-23 22:43:02 +08:00
binyangzhu000-sudo
0d898690be Add Atlas Cloud LLM provider 2026-07-20 18:53:20 +08:00
Bingxi Zhao (Frank)
c0037dfb58 fix chat attatchments 2026-07-19 16:56:34 +08:00
Dryice Liu
45948d9fcc Merge branch 'dev' into feat/code_block_theme 2026-07-19 16:02:43 +08:00
Bingxi Zhao (Frank)
c463ab8387 refactor: shared pre-dispatch status helper + valid live-progress stage + regression test
Rebased onto dev (the original base, multi-user, is a stale v1.3.8
ancestor). The two duplicated inline update_kb_status blocks become one
_mark_kb_queued_for_processing helper, and the progress stage changes
from 'processing' (not a member of the frontend's LIVE_PROGRESS_STAGES
set, so the UI would not render live progress) to 'starting', matching
the reindex endpoint's pre-dispatch convention. Adds a router regression
test pinning status/stage/task_id before background dispatch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:05:38 +08:00
Dryice Liu
b893d0a2b2 feat(settings): persist code block appearance options in backend
Add code_block_theme, code_block_show_line_numbers, and
code_block_wrap_long_lines to UI settings with defaults (oneDark,
false, false). The Pydantic update model uses Optional fields with
exclude_none=True so existing {theme, language} saves do not reset
saved code-block preferences.
2026-07-18 14:51:34 +08:00
whm
ec3b12c4f2 fix: set Secure attribute when clearing dt_token on logout
logout() called delete_cookie() with only samesite, which defaults
secure=False. When cookie_secure=true (SameSite=None), that produces
an invalid SameSite=None-without-Secure expiry header that browsers
reject, leaving the original dt_token cookie in place after sign-out.

Closes #623

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 19:59:23 +08:00
Bingxi Zhao (Frank)
3d5b669cd3 minor fix 2026-07-04 15:49:11 +08:00
Bingxi Zhao (Frank)
9983c0a3d1 fix: partners & multi-user 2026-06-27 18:27:16 +08:00
Bingxi Zhao (Frank)
eef785ae1e integrate lightrag-server & other fixes. 2026-06-24 15:54:12 +08:00
Bingxi Zhao (Frank)
42941faaff fix prs 2026-06-21 14:43:41 +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 (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>
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 2026-06-18 00:22:48 +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
Bingxi Zhao (Frank)
7ac3a3ba79 release: v1.4.6
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>
2026-06-17 10:50:44 +08:00