Commit Graph

342 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
0xTidalBore
5afb2547da fix(obsidian): tolerate undecodable bytes and date frontmatter (#922)
Fixes #914, Fixes #915. Read-only vault scans degrade one note instead of aborting the whole search; json.dumps(default=str) keeps unquoted YAML dates serialisable. Read-modify-write paths deliberately stay strict so replacement chars never land back in the vault.
2026-08-19 23:36:14 +08:00
zhouraym
927c2b3257 fix(usage): record token usage emitted as plain dicts by native adapters (#919)
UsageTracker.add_from_response read usage via attribute access, but TutorStreamChunk.usage is a plain dict, so every streamed call recorded 0 tokens and summary() returned None. Normalise dict / model_dump / attribute shapes in one place.
2026-08-19 23:35:42 +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)
1511e914c6 fix(home): keep the slot present when there are no lines to show
Changing the model-output language made the whole block vanish. Two causes,
and the second is the more interesting one.

The cache is keyed by language, so a switch correctly invalidates it and the
read returns nothing — but the background regeneration that would refill it was
being swallowed by the probe throttle. That interval exists because page loads
arrive in bursts and the material rarely changes between them; it is exactly
wrong when the caller already knows the cached set is unusable. A read that
finds a cache in another language now forces the probe past the interval. The
in-flight guard still applies, so forcing cannot fan out concurrent calls.

The deeper problem is that "no lines" rendered as "no slot". Every way this can
come up empty — cold cache, failed model call, re-reads that timed out, a
language just switched, no history at all — produced an identical blank space
with no way to act on it. The component now always renders its control once the
first read lands: a spinner with "finding what to explore next" while work is
in flight, and an explicit "suggest what to explore next" button whenever it is
not, which generates synchronously on click. When that returns nothing because
there is genuinely nothing to draw on, it says so rather than looking broken.

This is not the generic fallback copy that was removed earlier — that was
filler pretending to be a suggestion. This is a button that says what it does.
2026-08-17 09:57:56 +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)
3eb1182ba0 fix(home): size the output bounds per language
English installs got nothing. The model was answering correctly — well-formed
JSON, three grounded proposals — and every one was discarded before rendering.

The label bound was 60 characters, set while testing in Chinese, where
"LangGraph 中状态机与有向无环图的区别" says the whole thing in 20. The same
proposal in English is "How Self-Correction loops in LangGraph reduce
pedagogical hallucinations" — 72 characters, same line on screen, three times
the count. All three came back over the bound, the batch went entirely, and it
presented as a generation failure on English installs only.

Bounds are now per language for both fields. The three labels above are pinned
as a regression case, together with the assertion that the Chinese bound still
rejects them — the point is that one number cannot serve both, not that the
number should be bigger.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
8226352274 fix(home): three reasons the starter lines never appeared
Found on a real install with 20+ sessions, where the slot stayed empty.

**A failed generation was cached as an answer.** One call failed shortly after
boot; the empty result was written with the fingerprint of the material it
failed on. The background pass then saw "fresh, and the material has not
changed" and skipped every retry — six hours of empty slot from one timeout.
An empty result is now only saved when it is the right answer (no material to
work from); an empty result produced despite having material is dropped, so
the next visit retries. Collecting the material once and passing it down is
what makes that distinction available.

**The throttle swallowed the language switch.** The component asked before
i18n settled, which resolves to "en" for everyone, so the cache was built in
English. The Chinese UI then asked for "zh", got nothing (a cached set in one
language is not an answer for another), and its background pass was throttled
behind the English one — for the whole interval, with a perfectly fresh cache
sitting there unusable. The throttle is now keyed by scope *and* language, and
the component waits for i18n's ready flag rather than guessing.

**The material was mostly noise.** A week's lookback plus label dedup left one
usable trace out of twenty sessions; the other two slots went to knowledge
bases the user had named "q" and "q2". Now: 30 days (dedup and per-surface caps
already bound the list, so a longer window means depth, not length), labels
under 3 chars dropped, placeholder titles dropped — those are the *newest* rows
by definition, so they were taking the budget from named work — and the brief
tells the model to skip the noise it still sees rather than build on it.

Also: the single delayed re-read assumed a model answers within 3.5s. A cold
provider does not, and the first visit is exactly when nothing is cached. Four
spaced attempts, stopping as soon as something lands.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
b46805cc42 feat(home): propose a specific thing to understand, not a way to revisit history
The previous brief still produced lines that pointed *at* the traces —
"Redo the two eigenvalue questions you missed", "Pick up where Agentic RAG
retrieval left off". Those restate what the learner already knows they did.
They propose nothing to understand.

What earns a click is one step further out: read the traces for the *subject*
behind them, then name something specific about that subject worth
understanding. Same root, one jump.

  Trace: [conversation, 2d ago] Agentic RAG retrieval flow
  now:  "How agentic RAG differs from naive RAG"
  was:  "Continue the Agentic RAG conversation"   <- restates the trace
  also bad: "Explore retrieval"                   <- a field, not a question

The brief now leads with that jump, shows it worked both ways, and asks for
three different *kinds* of question (a distinction, a mechanism, a why, a
boundary case) so the three do not collapse into one shape. The floor is
unchanged and still explicit: one step beyond a trace is the point, a subject
with no root in the material is invention.

The fixed fallback is gone. Its three lines named activities — exactly what
the brief now calls failure — and more importantly the whole value of this
slot is that it is about *this* learner's material; generic copy sitting there
teaches people to stop reading it. With nothing in memory, the component
renders nothing and the home screen looks as it did before. That also drops
the fixed/generated split and its i18n keys: everything rendered here is now
generated, so nothing in it goes through the translation table.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
399fe55964 feat(home): make the starting points specific, and let them read as invitations
Two problems with the first pass, and they were the same problem.

The copy named activities, not subjects. "Explain a topic" fits any learner's
screen, which is exactly what makes it useless — it proposes nothing. The
model's brief now leads with concreteness and shows it both ways (BAD "Review
your notes" / GOOD "Redo the two eigenvalue questions you missed"), and the
label bound goes 40 → 60 chars because naming the actual thing costs words.
The fixed starters shown to a learner with no history got the same treatment:
they cannot name that learner's material, but they can still propose a
concrete first move.

And a specific sentence in a pill reads as a tag, not as an invitation. So the
pills are gone: one line each, left-aligned to the composer's own edge, serif,
no border or fill, with an arrow that is the only coloured thing at rest and
steps right on hover.

Note the colour is written as color-mix rather than `text-[var(--x)]/60` —
that Tailwind form compiles to nothing, and the arrow was silently inheriting
its parent's colour until this was checked against the computed style.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
913cba58ab style: apply ruff format to the recall tests
Mechanical line-wrapping left over from running ruff format across the tree;
belongs with the commit that added the file.
2026-08-17 09:57:55 +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)
da6dfa002b feat(memory): add recall — what the learner touched lately, across surfaces
L1 keeps two kinds of record and answering "what happened lately" needs both.
The snapshot knows what exists (sessions, notebook records, quiz attempts,
documents, books) with a label and a timestamp; the trace knows what was done,
of which knowledge-base queries are the one kind holding a question the
learner typed themselves.

``recent`` merges the seven surfaces newest-first; ``recent_queries`` reads
the trace. Both run on stamps — no message body, no document text, no answer
is read — which is what makes them callable outside consolidation.

Two shaping rules earn their place. Undated items are dropped rather than
assumed recent: knowledge bases stamp their *earliest* index time, so one in
daily use would otherwise be filtered out as ancient while claiming to be
inside the window — the trace answers for KBs instead. And a label repeated on
one surface collapses to its newest occurrence, so a session reopened all
afternoon counts once rather than crowding out everything else.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
f5b905f535 perf(memory): read snapshot stamps without loading entity content
The chat adapter inlines every message body of every session into each
Entity's ``content``. That is what L2 consolidation needs, and it is the
wrong price for a caller that only wants to know what the sessions are
called — or for the diff, which reads nothing but fingerprints and labels.

Adds ``EntityStamp`` (identity + label + fingerprint + timestamp) and a
per-surface probe that produces stamps directly. ``read_stamps`` uses a
surface's probe when it has one and projects the full read otherwise, so a
surface without a probe is slower rather than unsupported, and a probe that
raises degrades to the full read rather than reporting the surface empty —
which the diff would take for a mass deletion.

Only ``chat`` gets a probe: every other adapter reads a bounded amount, and
each probe is a standing obligation to match its full reader expression by
expression. The chat probe's fingerprint deliberately picks the last message
under ``created_at ASC, id ASC`` via a window function rather than MAX(id);
the two diverge on backfilled rows, and a probe-driven refresh would then
disagree with a content-driven one about what changed.
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
Bingxi Zhao
1de14e8584 fix(chat): preserve provider stream failure boundaries (#890) 2026-08-17 02:13:23 +08:00
Bingxi Zhao
0e17712888 fix(book): keep chapter map titles visible (#889) 2026-08-17 02:04:52 +08:00
Bingxi Zhao
f12d6a8a1f fix: recover model catalog and provider transport (#888) 2026-08-17 01:58:23 +08:00
Bingxi Zhao
0765085166 fix: expose active virtualenv inside bwrap (#887) 2026-08-17 01:41:52 +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
4d5effeaa4 fix: keep mastery teaching content visible (#855)
Preserve learner-facing Markdown emitted in Mastery tool rounds via the existing answer_visible contract. Ordinary tool narration remains trace-only.

Adds regression coverage for Markdown tables and teaching content that share a round with mastery_quiz.
2026-08-16 23:48:21 +08:00
Bingxi Zhao
dae3c4ef3c fix: use Responses API for OpenAI GPT-5 agentic tools (#708)
Route direct OpenAI GPT-5/o-series agentic tool calls through the shared Responses API provider adapter, preserving existing paths for Azure, custom endpoints, and older models.
2026-08-16 23:25:28 +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
Amir Fathi
a182ce7177 fix: persist completed turn message IDs for reconnects (#705)
Persist the terminal DONE event after attaching real user and assistant message IDs, so reconnecting clients can reconcile optimistic rows and preserve the correct conversation parent chain.
2026-08-16 23:07:15 +08:00
Bingxi Zhao
4f06aaa070 fix: isolate Partner data per user (#621)
Keep Partner configuration and assets shared while isolating authenticated users’ sessions, relationship memory, search, and media paths. Preserve legacy admin/IM behavior and enforce assignment checks at every access boundary.
2026-08-16 23:00:41 +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
Bingxi Zhao
0c51fe0c6b test: restore CI baseline contracts (#878)
Restore Ruff formatting, whitespace-tolerant source contracts, and a deterministic CI model catalog.
2026-08-16 22:39:47 +08:00
Alok Saboo
5062924279 feat: Add remote Docling Serve parsing support (#845)
* feat: Add remote Docling Serve parsing support

* fix: close remote uploads and await settings saves

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-16 19:25:53 +08:00
zhouraym
0f22353806 feat: add EPUB support for knowledge base (#843)
* feat: add EPUB support for knowledge base

* fix: bound and tolerate EPUB extraction

---------

Co-authored-by: zhouruim <zhouruim@digitalchina.com>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-16 19:24:04 +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
ClaretWheel1481
57166ba6c4 fix(sessions): ensure cleanup of mastery path on session deletion (#869)
* fix(sessions): ensure cleanup of mastery path on session deletion

* test: cover scoped session artifact cleanup

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-16 19:19:12 +08:00
Wong
026ebc585a fix(rag): run document parsing off the event loop (KB indexing stalls all requests) (#847)
* fix(rag): run document parsing off the event loop

MinerU cloud parsing blocks end to end (upload + long polling + archive
download) on a synchronous httpx.Client. document_loader.load() awaited
the parser inline on the event loop, so indexing a KB stalled every
other request (chat WebSockets included) for the whole duration of each
PDF — same class of bug as #761/#777. Move _parse_document onto a worker
thread via asyncio.to_thread.

* test: prove document parsing stays off event loop

---------

Co-authored-by: interia <interia@users.noreply.github.com>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-16 19:15:40 +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
0xTidalBore
cbc6538273 fix: cache and dedupe docstore probes in kb list / knowledge API (#859) (#870)
Co-authored-by: 0xtidalbore <ahmed@itcloud.ca>
2026-08-16 19:08:41 +08:00
evan188199-tech
cc23cbe3ac fix(runtime): reject invalid homes and placeholder OpenAI keys (#863)
Co-authored-by: evan <evan@dazongguandeMac-mini.local>
2026-08-16 19:08:33 +08:00
LamXwah
179a8a1795 fix: preserve console exception tracebacks (#856) 2026-08-16 19:08:27 +08:00
zhouraym
e1cb7ebd2a fix(subagent): resolve .cmd shims on Windows before spawning CLIs (#853)
Use shutil.which() (honors PATHEXT) to resolve bare CLI command names to
their full path before asyncio.create_subprocess_exec, so npm-installed
CLIs shipped as .cmd shims (claude/codex) are detected and connectable
on Windows. Closes #759.

Co-authored-by: zhouruim <zhouruim@digitalchina.com>
2026-08-16 19:08:19 +08:00
NoxsMedia
d388b697c5 fix(mcp): omit image payloads from tool text (#848) 2026-08-16 19:08:12 +08:00
jjjjjjava
51532a2ea4 fix: propagate Responses stream failures (#829)
Co-authored-by: panruiqi <panruiqi@ovopark.com>
2026-08-16 19:08:05 +08:00
Souptik Chakraborty
1091a88fc4 fix: Install mcp by default so pageindex MCP connects (#852)
The `mcp` client was declared only under the `partners` extra, but the MCP
connection manager and the built-in PageIndex MCP server are core: the manager
overlays a reserved `pageindex` entry onto the config whenever a PageIndex API
key is set, on any turn. A plain `pip install deeptutor` therefore had no `mcp`,
so the connection task raised ModuleNotFoundError, never resolved the caller's
ready future, and every turn stalled for the full 15s connect timeout before
reporting the one cause that was not responsible: "connect timed out after 15s".

Declare `mcp>=1.26.0,<2.0.0` as a core dependency of both published
distributions and drop it from the `partners` extra, which now inherits it.
Mirror the move in requirements/ (cli.txt gains it, partners.txt inherits it
via server.txt).

Also import `mcp` inside `_run_server`'s guarded block rather than above it. At
function scope the import raised before anything could fail `ready`, which is
what turned a permanent, instantly-knowable error into a timeout plus an
orphaned "Task exception was never retrieved". Inside the block the real cause
reaches the caller immediately.

Closes #792
2026-08-16 19:07:59 +08:00
Souptik Chakraborty
a5879735b7 fix: Keep env-bootstrapped admin usable and unpromoted (#851)
The identity store had two bugs that combined into a lockout for
deployments whose admin comes from auth.json rather than /register.

load_users() returned the bootstrap admin only when the store was empty,
so writing the first real account dropped it and the operator's login
started returning 401. save_user() then decided first-admin promotion
from load_users() called with no env arguments, an env-blind view, so
with an empty store the first account an admin created from /admin/users
was silently promoted to admin even though that endpoint documents
role="user". Together: create one student account, the student is the
only admin, the operator is locked out.

load_users() now merges the bootstrap admin whenever it is configured; a
stored record with the same username still wins, so the account can be
adopted into the store. The merge stays in memory because no write path
passes the env arguments, so a rotation of auth.json is never shadowed by
a stale persisted hash. save_user() counts a configured bootstrap admin
as an existing account, except when saving that same username, which is
an adoption and keeps the admin role.

The genuinely-empty deployment is unchanged: with no bootstrap
credentials the first /register user is still promoted. A username
configured with an empty hash cannot authenticate and so does not count,
which matters because that is the shipped default.

Fixes #849
2026-08-16 19:07:52 +08:00
Bingxi Zhao (Frank)
7858c6b8d7 fix(test): expect liteparse in the normalized parsing-engine set
#771 added LiteParse to ``_normalize_document_parsing``'s unconditional
engines dict (runtime_settings.py:821) and updated the engine-registry
test, but not this migration test's exhaustive set — so the assertion has
been failing on main since that PR landed, and the merge into dev brought
the failure with it. LiteParse is always present after normalization, so
the expected set is what was stale, not the behaviour.
2026-08-13 18:19:24 +08:00
Bingxi Zhao (Frank)
ccc53218c5 Merge origin/main into dev
Two PRs were merged straight into main after v1.5.11 and never reached
dev — #771 (LiteParse parsing engine) and #813 (MCP reconnect on
credential change; report transport failures as themselves rather than as
tool timeouts). dev had since moved 20 commits ahead, so main was no
longer an ancestor and a release could not fast-forward into it.

#813 was squash-merged from a branch cut before #808/#809/#825 landed, so
its snapshot carries pre-fix copies of five files. Every conflict is
resolved in dev's favour for that reason, verified file by file:

- citation_manager.py — main lacks #808's tool_metadata path
- reasoning_params.py — main hardcodes the Gemini check #809 tabled
- openai_responses/parsing.py — main aliases the "fc_0" placeholder as an
  item identity, the exact defect #825 fixed
- test_citation_manager.py, test_openai_responses_parsing.py — dev's
  copies are strict supersets; main contributes no unique assertion

main's genuinely new content (liteparse/, mcp/manager.py reconnect,
tests/services/mcp/test_call_failures.py) merges in untouched.
2026-08-13 16:44:02 +08:00
Bingxi Zhao (Frank)
f4f2a73b2a feat(search): rebuild the search provider layer and add six providers
Two pieces of work land together because the second is built on the
first: the provider layer was consolidated onto one spec table, then six
new providers were registered against it.

Layer overhaul
- Converge seven separate provider lists (backend registry, runtime
  config, settings router, CLI wizard, frontend catalog, i18n, tests)
  onto a single SEARCH_PROVIDERS spec table; every consumer derives from
  it instead of keeping its own copy.
- Fix three silent defects: serper's `num` never reached the API (it was
  swallowed by **kwargs, so max_results did nothing), serper dropped its
  proxies, and jina had no result-count limit at all.
- A runtime failure (rate limit, timeout, unreachable network) no longer
  fails the whole turn. The request walks the user's other credentialed
  search profiles and finally DuckDuckGo, recording the downgrade under
  a top-level `search_fallback` key so the trace shows what happened.
- Drop three provider modules that were never registered (exa, baidu,
  openrouter). They stay in the deprecated list, so a stale config reads
  as outdated rather than as a misspelled name.

Six new providers
doubao, bocha, zhipu, firecrawl, qianfan, aliyun_iqs — selectable under
Settings > Catalog > Search with their credential fields derived from the
spec table, and offered by `deeptutor init`. All six set
`soft_fallback=False`: five are China-hosted and the DuckDuckGo fallback
is unreachable on those networks, so a missing API key has to fail
loudly instead of silently timing out somewhere else.

Baidu returns as `qianfan` on the official Qianfan API; the old `baidu`
key stays deprecated.
2026-08-13 16:41:39 +08:00
Bingxi Zhao (Frank)
f2b7828bc4 fix: correct the provider PRs merged this round
An adversarial pass over #818 / #789 / #780 after merging.

**Codex sign-ins from before this week stopped working (#789).**
``validate_runtime_profile`` compared the profile's ``codex_account_binding``
for equality, but that key is written only by ``sync_codex_catalog`` — every
managed profile published by #690/#774 has none, so ``None != <hash>`` made
each of them look like another account's and locked its owner out of Codex
until they re-ran "Refresh models". Absent now reads as legacy; a binding
that is present and different is still an account switch and still refused.

**Overriding reasoning effort for one turn returned 409 (#789).** The same
function also required the request's effort to be byte-equal to the value
stored in the catalog. Effort is a per-request knob, not part of the identity
that ties a config to a token — the check now stops at model membership.
Its test asserted the old behaviour and has been rewritten around what the
function is actually for.

**The reasoning-effort endpoint left the runtime caches stale (#789).** It
writes the catalog the runtime resolves against, like every other catalog
write in this router, but skipped ``_invalidate_runtime_caches()``.

**OrcaRouter claimed Anthropic prompt caching (#818).** ``supports_prompt_caching``
makes ``_build_kwargs`` inject ``cache_control`` blocks into any ``anthropic/*``
or ``claude*`` request — an OpenRouter extension. No other gateway sets it and
nothing established the second one accepts it; a strict gateway would 400 every
Claude turn. Also fixed ``anthropic/claude-sonnet-4.6`` in the fallback list,
which the rest of the repo spells with dashes, so a user picking it from our
own menu would have got "model not found".

**OrcaRouter inserted itself into the curated menus (#818).** The featured
lists are hand-picked and rendered as a positional numbered menu, so adding an
entry shifted Ollama from [10] to [11]. The registry entry alone already makes
a provider reachable via "Show all" and the Settings dropdown; which providers
are featured is a maintainer decision. The README paragraph goes with it — no
other provider has per-provider prose there, and it would have been translated
into ten languages.
2026-08-13 00:07:06 +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
XiaoHuo888-hue
80766a420c feat: add OrcaRouter as a named OpenAI-compatible gateway provider (#818) 2026-08-12 23:38:08 +08:00