111 Commits

Author SHA1 Message Date
Carl
242b24beeb fix: keep chats usable after oversized tool calls (#3144)
Closes #2909.

Omit the fewest eligible historical tool-argument payloads so oversized completed exchanges remain replayable, without touching signed/native provider rounds or durable history.
2026-12-01 17:03:29 +08:00
zszz3
744d24a6bc refactor: state the LaTeX maths rule once as a shared prompt fragment
Chat, mastery, question FINISH and notes each carried their own copy of
the dollar-delimiter rule. They now reference {{shared:math_latex}}
(deeptutor/services/prompt/fragments), expanded by PromptManager at load
time; the notes capability expands the marker in its system.md, and
code-built prompts use shared_fragment(). The English notes prompt gains
the rule (and the mermaid line) its Chinese twin already had. The chat
loop no longer repeats the 'concise Markdown' line that runtime_policy
states.

Refs #2975
2026-12-01 11:05:06 +08:00
zszz3
aa72ec6bb9 fix: say why call_tool refused, and keep an opened setup mode's tools native
CallToolTool answered every unforwarded call with "load it first". That
was wrong for a tool already in tools[] (an MCP tool, a built-in) and for
malformed arguments, and for the former it sent the model round in a
loop. DeferredToolLoader.proxy_refusal now names the reason (missing
name, call_tool itself, already in the tool list, proxy off, unknown,
not loaded) and proxy_arguments checks the arguments: an object, or a
string holding valid JSON for one; anything else is refused. The
pipeline's _resolve_proxied_tool_calls and CallToolTool both go through
proxy_call_refusal, so the message matches the decision.

Setup tools loaded through load_tools are proxied. Opening setup mode
later left them proxied: not in tools[], no rules (already loaded), and
a note that never mentioned call_tool. An opened mode's tools are now
made native, like mastery's outline tools; a setup turn whose tools are
still proxied gets a hint to reach them through call_tool.

Also: call_tool is mounted only when the loader has built-in/capability
tools to proxy; its manifest order no longer duplicates load_tools'; a
forwarded call without an id is not marked for renaming.

Refs #2972
2026-11-30 23:35:59 +08:00
zszz3
d5ac66781f fix: keep chat tools[] and system prompt stable within a session 2026-11-30 23:35:08 +08:00
wojiecihuo
fed428e46a Merge pull request #3079 from zszz3/fix/chat-runtime-snapshots
fix: keep turn data out of the chat system prompt and drop the duplicate tool manifest
2026-11-30 23:21:32 +08:00
CyanPersica
b061e71d9b fix(loop): do not execute a tool call cut off by the output limit (#2719)
json-repair was closing the partial arguments and the tool then ran, so a
write could persist half a value and report success. A truncated round now
keeps the text and records one not-executed result per call.

Fixes #2713

Signed-off-by: fanjiahe <fanjiahe@mail.ustc.edu.cn>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 14:18:06 +08:00
zszz3
20bbe5e5fe fix: list only usable skills, as a runtime snapshot 2026-11-29 16:32:47 +08:00
Bingxi Zhao (Frank)
6c1e3b6e60 Merge PR #2549: fix(llm): map Anthropic context-window, refusal and stop_sequence stop reasons
Move the context-full finish reason into the shared LLM protocol and add English and Chinese notices; test both localized warnings and provider mappings (186 passed).
2026-11-14 23:09:35 +08:00
Bingxi Zhao (Frank)
c68cd03bd5 Merge #2388 from Adithya1331 2026-11-06 01:56:25 +08:00
Adithya
4dd10949b7 fix: add chat context summary prompt resources 2026-11-02 22:06:17 +05:30
stefanielizeth73-art
3f943e14c8 feat(agent-loop): configure bounded reasoning-budget recovery 2026-11-03 00:12:00 +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)
28c11e2ae8 feat: update notes, chat interactions and workspace UI on preview
Remove course pages, APIs and the course_study capability. Add anchored note
threads and reviewed learning-block generation, queued and withdrawable chat
messages, quote attachments, side chats, and the calendar/favorites/navigation
updates.

Keep preview's existing backend architecture. Wire the new features through
its Python application and existing chat engine, retain legacy selected-text
requests, persist mid-turn messages in replay, and restore note context when
regenerating. Leave stored user data intact.

Validate frontend contracts, dependency boundaries, types, 1290 node tests,
840 rendered tests, lint, localization and the production build. Exercise
session/notes/API regressions, 53 chat-engine tests and 20 Python/native
integration tests with isolated runtime data.
2026-10-26 22:13:34 +08:00
Bingxi Zhao (Frank)
3cbecb2479 feat(workspaces): add scoped instructions and refine learning UI 2026-10-12 19:29:47 +08:00
Bingxi Zhao (Frank)
eabc17d79f release: v1.6.10
Native LightRAG role models: extraction, keyword, query and vision each
resolve their own model, vision indexing pins a vision-capable model
instead of silently degrading, and a knowledge base records which models
and which embedding built it. A published index refuses queries after its
embedding identity changes rather than searching a foreign vector space,
and a rebuild is confirmed against the configuration it will actually
use — a stale confirmation is rejected instead of quietly rebuilding
something else. A failed publication is withdrawn, not left half-written.

PDF attachments follow the parsing engine configured for the workspace,
report the stage they are in, and a truncated answer says it was
truncated with the counters that prove it. Providers are no longer
filtered out of the embedding picker on an unverifiable capability guess:
configure the model and test it. Visualize's temperature and token budget
are settings rather than literals. Notebook evidence no longer depends on
the chat session that produced it.

See assets/releases/ver1-6-10.md for the full notes, and the README
translations for the propagated prose.
2026-09-22 21:36:27 +08:00
Bingxi Zhao (Frank)
da856ad670 release: v1.6.9
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.

Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
2026-09-21 02:30:40 +08:00
Bingxi Zhao (Frank)
42d793839b Merge branch 'dev' into worktree-chat-engine-interleaved 2026-09-15 13:25:06 +08:00
Gao Chenkai
3192757d45 fix: handle DeepSeek reasoning budget exhaustion (#1331)
* fix: handle DeepSeek reasoning budget exhaustion

* style: satisfy ruff format, the one thing CI was red on

`ruff format --check` on agent_loop.py, the Responses parser and the test
file that came with them. No behaviour change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 01:43:40 +08:00
evan188199-tech
24d3db124c fix(agent-loop): recover bounded reasoning-only finishes (#1402)
Co-authored-by: XZH <cto@xzh.ai>
2026-09-14 01:32:58 +08:00
Bingxi Zhao (Frank)
541b7f4f16 feat(chat): let a turn read as a running account instead of an answer with hidden working
Every round already streamed its text to the reader. The loop then took it
back: a round that called tools was marked narration, and the client moved
that prose out of the answer and into a collapsed block pinned to the top of
the message. The reader watched a sentence appear and vanish, and what was
left was an answer with no account of how it was reached.

That behaviour came from one field doing two jobs. ``call_role`` said both
where the turn was and whether the text counted, so "more work follows" and
"hide this" could not be told apart — and three separate exceptions had grown
to say "actually, show this one" for DSML, truncation and mastery.

Split the two facts. ``call_role`` keeps the phase. A new ``answer_visible``
carries visibility, true for every ordinary round, false only where a
capability's finish guard retracts a round it rejected. The three exceptions
disappear with the default they were fighting.

The client then lays the message out in the order it was written: the sentence
that introduced a step, the step's own row beneath it, what the next round
said below that. A settled turn is restored from an event preview that carries
no text, so tool calls now record how much of the answer had been written when
they ran, and the stored body is laid back out around them.

The prompt asks for the commentary this depends on, and says the closing
answer should not replay it.
2026-09-11 16:49:40 +08:00
Bingxi Zhao (Frank)
a3ff561cca fix(errors): finish the sweep for failure notices that hide their cause
#1356 was reported as "retrieval hides embedding connectivity failures".
The adapter had always raised a ConnectionError naming the endpoint and
the remedy; the text was discarded a layer above, where the template had
no placeholder to put it in. 4e816d79 converged the tool-dispatch half.
This is the audit for the rest of it.

Two scans, both over the AST rather than by eye: handlers that raise or
return a generic literal without touching the exception they caught, and
handlers that log the cause but hand the user a literal. The result is
smaller than expected and worth recording — the codebase is mostly
honest here, and the sites that do hide a cause almost all do it on
purpose. `knowledge.py` refuses to echo an upstream message from a
credential-bearing flow, and says so at the site; WeCom onboarding does
the same. Those stay.

Three did not have a reason:

* the agent loop's forced finish told the reader "a step failed" while
  the caller was logging the exception on the line above;
* the question pipeline's tool summarizer did the same, in the same
  shape, two lines apart;
* the update check turned every transport failure into "Unable to check
  for updates", which cannot distinguish being offline from a proxy that
  blocks github.com. The release URL is public and carries no
  credentials, so there was nothing to protect.

All three now carry what they already knew, through the same `{error}`
placeholder 4e816d79 established, in both locales.

The test is the durable half. A key the runtime formats with a cause must
have a slot for it in every locale that defines it — the exact drift that
let #1356 ship, where the code passed a cause the template could not
accept and nothing complained.

6925 passed, 24 skipped.
2026-09-11 12:43:41 +08:00
Bingxi Zhao (Frank)
4e816d7933 fix(tools): tell the model why a tool failed, not that it failed
Stop the Ollama a vector KB embeds against, ask a question, and the model
is told "An unknown error occurred while executing rag." The adapter had
already written the answer — `Cannot connect to Ollama at
http://localhost:11434. Make sure Ollama is running. Start it with:
ollama serve` — and the dispatcher was holding it (#1356).

`unknown_error_message_factory` took the tool name and nothing else, so
no caller could have done better. Four capabilities each wrote their own
message from that one argument and three of them called the result
unknown; the fourth, pageindex, restated the dispatcher's own default
minus the cause. The name was the bug: it presumed a cause the runtime
always had.

It is now `ToolErrorMessageFactory`, `(tool, cause) -> str`, and the key
plus the English wording live once in `tool_error_message_factory`, which
each capability wraps around its own `_t`. Capabilities keep their
translations and can no longer keep the cause out of them. pageindex
passes nothing and takes the default. A bundle predating the new
`notices.tool_error` key falls back to English rather than to silence
about what went wrong, which is the reason the fallback carries the cause
too.

This is the same shape as read_skill answering "skill not found" when the
skill resolved and only the file was missing (#1347): a failure the
caller cannot see has no way out, and the model spends its rounds
inventing one.

The regression test is the reporter's turn — a `rag` call raising the
real adapter error — and asserts the endpoint and the remediation reach
the role=tool message.
2026-09-10 23:00:11 +08:00
Bingxi Zhao (Frank)
04040a2c06 release: v1.6.5
Ship a content workspace you choose, one exec tool for every language,
Mastery Path modes that gate its tools, and Settings that grades
readiness instead of listing faults.

Release notes: assets/releases/ver1-6-5.md
2026-09-06 13:46:29 +08:00
Bingxi Zhao (Frank)
93df3d48b7 release: v1.6.4
Ship lighter isolated runtimes, richer Books and Mastery flows,
Reading/session polish, and explicit model API capabilities.

Release notes: assets/releases/ver1-6-4.md
2026-09-03 01:38:54 +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)
15c31267cc Merge pull request #1124 from evan188199-tech/codex/feat-learner-profile-controls
# Conflicts:
#	deeptutor/multi_user/identity.py
#	deeptutor/services/session/turn_runtime.py
2026-08-31 20:39:42 +08:00
Bingxi Zhao (Frank)
1b7643c558 Merge pull request #1067 from evan188199-tech
# Conflicts:
#	deeptutor/agents/chat/agent_loop.py
2026-08-31 19:00:32 +08:00
Bingxi Zhao (Frank)
8cfec4e685 Merge pull request #1033 from contributor
# Conflicts:
#	deeptutor/tools/prompting/hints/en/exec.yaml
#	deeptutor/tools/prompting/hints/zh/exec.yaml
2026-08-31 18:36:05 +08:00
Bingxi Zhao (Frank)
b7abfae652 Merge pull request #1084 from contributor
# Conflicts:
#	web/components/settings/ServiceConfigEditor.tsx
#	web/components/settings/SettingsContext.tsx
#	web/components/settings/SettingsMain.tsx
2026-08-31 18:13:31 +08:00
XZH
93d1a80310 feat(learner): add account-scoped learner profiles 2026-08-30 17:15:01 -07:00
Bingxi Zhao (Frank)
3dc372f551 release: v1.6.2 — immersive watching and extensible visualizers
Add synchronized YouTube learning, a plugin-driven visualizer catalog, and Hermes, OpenClaw, and DeepSeek agent harnesses. Refresh Reading, Knowledge, Partner status, guided updates, documentation, translations, and release notes for v1.6.2.
2026-08-31 01:13:07 +08:00
XZH
7615e36bb8 fix(code-execution): preserve deliverable scope and retry discipline 2026-08-30 15:42:32 +08:00
Bingxi Zhao (Frank)
8070773747 fix(course): the recommendation is the answer, not a tool preamble
Course Study turns were ending on "I could not produce a useful response
from the model output", with the real recommendation sitting collapsed in
the trace above it — and, in one observed turn, written out three times.

The loop treats prose emitted alongside a tool call as a preamble: it is
streamed into the trace, and the answer is whatever a later tool-less
round says. That is right for tools that fetch something. It is wrong for
this playbook, which asks for the opposite shape — recommend the next
action, say why it is timely, then call `course_handoff`. The
recommendation and the call are one thought, and models write them in one
round. Dropped from the answer, the model had nothing new to add on the
next round, so it called `course_handoff` again until the budget ran out
and the turn finished empty.

The partner-group capability documents the same failure for
`invoke_other` and already carries the remedy: classify the tool round's
prose, then end the turn on it. Course Study now implements both hooks.

Two details worth keeping:

`_capability_answer_published` is deliberately not set. It means "the
learner has already seen this text, do not emit it again", which holds
for capabilities that buffer output behind a protocol. This mode buffers
nothing, so claiming it left the message body empty with the whole
recommendation hidden a click away — the original symptom, differently
caused.

A bare `course_handoff` with nothing said is left alone rather than
ending the turn: there is no answer to rescue, and the model still gets
its ordinary finish round to write one.

The flag was named `_partner_group_formal_answer_published` while living
in the generic loop, which now has a second caller; renamed to match what
it is.
2026-08-30 00:45:10 +08:00
Bingxi Zhao (Frank)
43c9fe7ea0 feat(course): make a course the container, not a dashboard
A course held the right model — the syllabus that gives progress a
denominator, resources as references, conventions apart from the
assistant's own notes — but almost nothing crossed the edges between it
and the surfaces it was supposed to contain.

Getting in. Course Study was offered in the composer's mode menu while
the only way to bind a course was a link on the course page, so choosing
it there produced a conversation identical to an inert one, and the mode
advised pressing a button that did not exist. The composer now carries
the binding next to the mode: shown whenever there is one, and offered
as an unfinished field in Course Study when there is not. `_course_id`
rides every turn, so detaching detaches and the pill can never drift
from what the turn actually saw.

What a conversation inherits. `default_capability` and `default_persona`
were stored, validated and returned by the API while changing nothing:
`_apply_course_defaults` only fills fields a payload *omits*, and this
composer always sent all of them. They are applied client-side now,
along with the course's knowledge bases, where the learner can watch the
mode and material become the course's before they type. The dialog grows
the editor they never had.

Conventions. "Every conversation in this course starts knowing these" was
true only if the model happened to call `course_overview`. They ride in
the per-turn summary now, and — because the promise is not scoped to one
mode — in the system prompt of any course-bound turn.

Coming back. Mastery Path and Immersive Reading now read `?course=`,
scope themselves to it, and attach whatever is built there; the tiles and
hand-offs pass it; the picker offers to start one. A course could only
ever reference what already existed, so filling a new one meant leaving,
building, and remembering to return.

Hand-offs. A target with no ref stored an opening line for an index that
never consumes it, which then surfaced weeks later in an unrelated path.
An unresolvable ref was passed straight through: observed live, a
syllabus unit id ("u2") sent as a mastery path, producing a card pointing
at a page that does not exist. Refs are checked against the subsystem
that owns them — existence, not membership, since a path built outside
this course routes perfectly well.

Also: the sidebar groups conversations by course, so filing them is
finally readable; a course-scoped notebook console no longer shows
another course's notes beside a list saying there are none (the clear
raced an in-flight detail fetch that landed after it); a hand-off the
model also printed as prose is not rendered twice; a provider error is no
longer stored as a conversation's permanent title; `/space/courses` goes,
having been an unreferenced copy of `/courses`; and the Visualize mode
description gets its missing Chinese.
2026-08-30 00:09:36 +08:00
Bingxi Zhao (Frank)
fc0be68d6f wip: course / partner groups in progress 2026-08-29 22:29:53 +08:00
Bingxi Zhao
42ba832bc8 Merge pull request #1059 from ZQR1101/fix/openai-binding-deepseek-thinking 2026-08-29 18:44:49 +08:00
wayblink
2ba5e3aa5d feat(llm): support explicit OpenAI wire API selection 2026-08-29 15:02:31 +08:00
ZQR1101
8a0ea496f4 fix(llm): disable DeepSeek flash thinking on openai bindings
openai bindings pointed at DeepSeek never inherited flash's thinking:disabled default, so mid-conversation rounds failed with reasoning_content must be passed back. Infer thinking controls from the model id and replay Chat Completions reasoning on tool-call turns.

Fixes #1058
2026-08-28 21:24:15 +08:00
XZH
a32a9a98a1 fix(llm): persist DeepSeek reasoning across turns 2026-08-28 03:09:00 -07:00
zhou2030109-glitch
b342b63b7a fix: align Windows exec runtime and search readiness 2026-08-27 17:17:03 +08:00
XZH
8b24f1ae67 fix(tools): route file generation through code execution 2026-08-26 19:19:54 -07:00
diffaudit-review
3709c9e854 feat: add selection tutor and course workspaces 2026-08-26 02:25:23 +08:00
Bingxi Zhao (Frank)
693772a542 fix(chat): integrate guarded output with ask questions 2026-08-26 02:10:58 +08:00
Bingxi Zhao (Frank)
11c0a1ed68 fix(chat): preserve ask-user protocol across fallbacks and history 2026-08-26 02:08:46 +08:00
SeleiXi
5c45c38e4a fix: make ask questions card deterministic 2026-08-26 02:08:33 +08:00
Bingxi Zhao (Frank)
ce3532b7f8 fix(mastery): validate guarded finishes before streaming 2026-08-26 01:52:26 +08:00
XZH
b4bbe20e87 fix(mastery): redirect plain-text quizzes to cards 2026-08-26 01:52:26 +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
john00010
dcbb1d3393 fix(sandbox): support Windows code execution (#964)
* fix(sandbox): support Windows code execution

* refactor(sandbox): vary only the shell clause in the workspace note

The Windows branch duplicated the whole workspace paragraph, so the note
existed in four near-identical copies (zh/en x posix/windows) that would drift
apart on the next edit. Only the "how do I get a script into a file" clause
actually depends on the host shell, so vary that clause and keep one template
per language.

Also prefer `pwsh` (PowerShell 7+) when it is on PATH — it defaults to UTF-8
and is the version still receiving updates; the generated commands are written
in 5.1-compatible syntax, which 7 accepts too. And hoist `import sys` to module
scope now that two methods need it.

Adds the tests this note never had: each host gets the syntax that works there
(a Bash heredoc is a syntax error in PowerShell, and the model would silently
produce no file), and the host-independent half stays byte-identical.

---------

Co-authored-by: Frank <bingxizhao@novix.science>
2026-08-24 16:52:04 +08:00