Commit Graph

51 Commits

Author SHA1 Message Date
Bingxi Zhao
3da6cbd1e7 Merge pull request #1456 from hyeonsang010716/fix/marginnote4-close-store-connections
fix(marginnote4): close the store's SQLite connections
2026-09-23 10:24:01 +08:00
Wubian111
ead57a7b2e fix: require selected mastery quizzes to complete delivery 2026-09-21 10:26:31 +08:00
Wubian111
4b8e9bacbb fix: reject unposted mastery card delivery claims 2026-09-21 10:26:31 +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
hyeonsang010716
1f613b276a fix(marginnote4): close the store's SQLite connections
`MarginNoteStore._connect()` handed back a raw connection that every call
site used as `with self._connect() as conn:`. A connection's own context
manager commits or rolls back but never closes, so each call left the
database file open until the garbage collector reached the connection.

On Windows an open file cannot be removed. Deleting a MarginNote KB could
then fail to remove its store (only a warning is logged), and connecting a
library under the same name reopened that store, so devices paired with
the deleted library were accepted again.

Make `_connect()` a context manager that keeps the transaction and closes
the connection, the same shape the session, reading and file-library
stores already use. The call sites are unchanged. A new test checks that
every connection the store opens is closed, so the regression fails on any
platform, not only where the existing KB deletion test does.
2026-09-14 20:33:29 +09:00
Bingxi Zhao (Frank)
cc316f03dd test: stop letting one test decide what the next one resolves
Five kinds of global state leaked between tests, so the suite passed in
collection order and failed in any other. The worst is the LLM config
cache: `get_llm_config` memoises into a module-level `_LLM_CONFIG_CACHE`,
so whichever test resolved first decided what every later test saw, and
anything built off that config at init time — `QuestionPipeline` among
them — passed only because an earlier test had already filled it.

Resolve every test against the same fake and clear the cache on both
sides, with a `real_llm_resolver` marker for the tests that are checking
resolution itself. The rest are the same shape: patches that were never
torn down, a container singleton that outlived its test, and a launcher
writing `os.environ` where a subprocess inherited it.

Run in reverse, the suite went from 42 failed to 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 13:54:31 +08:00
Bingxi Zhao (Frank)
2ad1d45d18 fix(mastery): stop a review session offering to start the topic it is teaching
Clicking "start review" opened a session whose first reply was a card
offering to start a session on that same topic. Clicking it opened another,
which offered the card again — one conversation per click, all on one topic,
some bound to no topic at all (#1412). Those conversations begin with nothing
to quiz against, so they answer in prose; that is the other half of the same
report (#1411).

The generator is a premise the tool states as fact. `mastery_new_session`
stays mounted inside a mastery session on purpose — sending the learner to a
*different* topic mid-course is a real thing to want — and its hand-off
instruction tells the model not to tutor the topic here, because "the mastery
tutor picks up on the other side". Inside that topic's own session there is no
other side, and nothing in the tool's result said so, so the model kept
proposing the trip it was already on.

The turn knows which topic it is tutoring; the tool did not. Binding it the
way the mastery tools already get `_mastery_path_id` lets the tool answer for
itself: a hand-off aimed at the topic this conversation *is* gets refused, with
the instruction to teach the lesson here. A hand-off to any other topic is
untouched, and so is `mastery_open_session` — returning to an older
conversation on the same topic is not a loop.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 02:02:53 +08:00
evan188199-tech
271e4f7865 feat(knowledge): add KB frontier discovery tool (#1292) (#1293)
* feat(knowledge): add KB frontier discovery tool

* review: let agents.yaml own the query-derivation budget

`reason()` falls back to agents.yaml when the caller says nothing, which is
where every LLM budget in this codebase lives. 512 tokens is also the shape
that starves a reasoning model before it emits a single query — it spends the
allowance thinking and returns nothing, which is how #1318 shipped.

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

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 01:43:14 +08:00
ZQR1101
f27f347713 fix(explore-context): keep reasoning on replayed rounds for thinking providers (#1400) (#1404)
Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-09-14 01:28:05 +08:00
Bingxi Zhao (Frank)
8ee2258be4 fix(mastery): declare mastery_mode as a rebinding tool
Every tool call in a round has its arguments bound before any of them runs.
`rebinding_tools` is how a capability says "this call repoints the turn, so
run it first and re-bind the rest against the new target" — and mastery
declared two of the three tools that do that. `mastery_mode` was missing,
even though `augment_kwargs` hands it a `_bind_active_mode` binder a few
lines below the declaration.

So in a round holding both, `mastery_mode` landed in the concurrent batch and
`mastery_quiz` kept the mode bound before the switch. Every mode-gated tool
reads `_mastery_session_mode` off that bind, so the quiz was refused for
being in `outline` — in the very round that left `outline`. The refusal then
told the model to "call mastery_mode with mode='study' first", in a round
where `mastery_mode` had already returned `status: switched`.

That round is not a corner case: the prompt asks for it twice ("切完在同一轮
把事做完"), and it is what "继续学" at the end of an outline sitting produces.
The visible result is one of the shapes behind "it asked a question and then
answered it": the tutor streams the lead-in, the card never appears because
the call was refused, and the turn carries on.

`mastery_mode` and mode.py are both new in v1.6.5, so this path is new too.

The other routes to a self-answered question are separate and still open —
mastery declares no `tool_round_output_policy` and does not buffer, so the
posing round's own prose is published unexamined, and `mastery_grade` will
grade an interaction still AWAITING. Both need more than a declaration.
2026-09-08 00:34:13 +08:00
XZH
6b96364d83 fix(chat): prevent PDF attachment tool hallucinations 2026-09-06 04:22:20 -07: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)
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)
542204d2df Merge pull request #1081 from evan188199-tech/codex/assessment-history
# Conflicts:
#	deeptutor/api/routers/question_notebook.py
#	deeptutor/services/session/sqlite_store.py
#	web/components/space/question-bank/useQuestionBank.ts
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-08-31 19:51:48 +08:00
Bingxi Zhao (Frank)
ce7c2dc2dc release: v1.6.1 — one key, one navigator, one sidebar you arrange
Model configuration was one layer replicated seven times: every service
stored its own profile with its own credentials, so a single OpenRouter
key had to be pasted into five separate pages. This release splits that
in two — a **connection** holds one vendor credential and links it down
to every service that vendor can serve, and a **task model** takes the
calls nobody asks for (naming a conversation, writing the composer's
starting points) off the model picked for actual reasoning. Both are
opt-in; existing per-service profiles resolve exactly as before.

Around that: Settings drops the card grid for a persistent searchable
navigator whose landing page answers "what state am I in" instead of
repeating the directory; Mastery Path files study conversations under
their topic and opens them in the tutor rather than dropping them on
/home; the sidebar folds features into More and reorders by drag; the
reading companion is rebuilt from /home's own chat components; and the
LightRAG engine talks to the SDK directly, so its extra no longer drags
MinerU in transitively.

Also back-merges PR #1041 (Anthropic SDK 1.x temperature via extra_body)
and PR #741 (owner-only auth secret/token files), which had been merged
straight into main and never flowed back to dev.

Release notes: assets/releases/ver1-6-1.md
Gates: pre-commit 15/15, ruff clean, pytest 5802 passed, web 450 node
tests, eslint 0 errors, docs build clean.
2026-08-30 13:19:42 +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
XZH
7a0f1f6a07 feat(assessment): unify persisted review records (#824) 2026-08-28 20:54:48 -07:00
Bingxi Zhao (Frank)
693772a542 fix(chat): integrate guarded output with ask questions 2026-08-26 02:10:58 +08:00
Bingxi Zhao (Frank)
8525527836 fix(mastery): require explicit choice answer intent 2026-08-26 01:33:31 +08:00
ZQR1101
85602ca161 fix(mastery): don't freeze choice gates on clarifying composer text
Composer clarifying questions on a choice card were persisted as the formal
answer, after which mastery_grade could never map them to an option and the
gate stalled. Skip unreadable commits and allow a later readable pick to
recover already-stuck interactions.
2026-08-26 01:31:31 +08:00
zh769394
61a32bd626 fix: improve Windows cross-platform compatibility across runner, tools, and tests
- Guard resource module import in runner server for non-POSIX platforms
- Use POSIX relative path format in ListDirTool for consistent path separators
- Specify UTF-8 encoding in Weixin channel state loading and prompt tests to avoid GBK UnicodeDecodeError
- Use as_posix() in path assertion tests for cross-platform compatibility
2026-08-26 00:29:52 +08:00
Bingxi Zhao (Frank)
bd80a4d28a release: v1.5.17
Partners stop being a deployment-wide admin resource and become
per-user: three nested rights (manage / use / neither) replace the
blanket admin gate on the router, each member can build and own their
own, and every person's conversations with a partner stay private to
their account. Grants keep working and now offer only admin-managed
partners. Channel runtime state moves from one directory per channel to
one per partner — copied, not moved, and only when its owner is
unambiguous — so two partners can finally run the same channel.

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

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

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

Two defects found by the release gate and fixed here:

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

Gates: pre-commit (all 15 hooks), ruff check + format, pytest
5276 passed, web 605 node tests, docs build.
2026-08-25 02:24:35 +08:00
Bingxi Zhao (Frank)
0989dcbbd9 fix(marginnote4): one rule for where a library's store lives
"Pinned `db_path`, else derived from the name" was written twice — in the
capability binding and, in its derived half only, in the HTTP bridge. A
KB that pinned a path therefore paired devices into one file while the
tools read another, so the add-on would have synced into a store nothing
queried. `resolve_db_path` is now the single rule, and the binding, the
pairing endpoints and the device endpoints all go through it.

Deleting the KB now removes that store. Unlike an Obsidian vault it is
ours — `data/user/marginnote4/<name>.db`, created by us — so leaving it
behind both contradicted what the delete says and resurrected every
paired device as soon as a library of the same name was connected again.
Best-effort, on the same reasoning as the index directory above it: an
orphan file beats a config entry stuck in the list.
2026-08-21 22:50:55 +08:00
evan188199-tech
1413cd8ed0 feat(knowledge): add MarginNote 4 as a connected knowledge base (#931)
* feat(marginnote4): add connected KB type, read-only tools, and sync bridge

Add MarginNote 4 as a connected knowledge base type that syncs study data
(notes, excerpts, cards, mindmap nodes) from MN4 via the official Add-on API
into a dedicated SQLite store, then exposes it to the chat loop through seven
read-only tools.

New package: deeptutor/capabilities/marginnote4/
- models.py: MarginNoteObject, SyncBatch, PairedDevice, LearningEvent
- store.py: SQLite CRUD + search + device pairing with hashed tokens
- binding.py: per-turn resolution of the selected MN4 library
- tools.py: search, read, list, documents, links, tags, cards
- capability.py: KnowledgeCapability (exclusive turn ownership)
- prompts/{en,zh}/system.md

HTTP bridge: deeptutor/api/routers/marginnote4.py
- POST /pair (session auth) -- register a device, get one-time token
- POST /sync (device-token auth) -- incremental upsert + tombstones
- POST /heartbeat (device-token auth) -- liveness + object count
- GET /devices, DELETE /devices/{id}, GET /status (session auth)

Integration points:
- kb_types.py: MARGINNOTE4_KB_TYPE added to CONNECTED_KB_TYPES
- manager.py: db_path surfaced in get_metadata allowlist
- registry.py: MarginNoteCapability registered in LOOP_CAPABILITIES
- builtin/__init__.py: MARGINNOTE_TOOL_TYPES in BUILTIN_TOOL_TYPES
- api/main.py: router mounted at /api/v1/marginnote4

Phase 1 scope: device pairing, read-only sync, tool navigation.
Write-back (propose/apply/verify), learning events, and mastery bridge
are planned for Phase 2-3.

Refs: #756 (Obsidian external knowledge source pattern), #180

* fix(marginnote4): search scope, store caching, prompts, KB registration

Testing and experience improvements:

- Search now includes document_title in scope: searching for a textbook
  name returns results instead of zero hits
- Store instances cached by db_path so schema init runs once, not per
  tool call within a turn
- object_type parameters carry enum constraints so the LLM knows valid
  types without guessing
- System prompts (en/zh) rewritten with domain context: explains the
  five object types, link traversal strategy, and citation guidance
- KB registration: register_marginnote4_kb manager method +
  /connect-marginnote4 API endpoint, mirroring the Obsidian connect flow
- Fix indentation inconsistencies in manager.py and main.py
- New tests: document_title search scope, KB registration (create,
  default path, duplicate rejection)

65 tests pass, 0 regressions, ruff clean.

* style(marginnote4): apply repository formatter

* fix(marginnote4): keep MN4 libraries out of the rag_search sweep

``MARGINNOTE4_KB_TYPE`` joined ``CONNECTED_KB_TYPES`` but not
``NON_RETRIEVABLE_KB_TYPES``, so ``supports_rag_retrieval`` answered true
for a library that has no index and no retrieval API — its objects live
in ``mn4_objects`` and are reachable only through the seven
``marginnote_*`` tools. Book's source explorer would have swept it,
gotten nothing back, and reported it as a source with no relevant
content rather than one that needs its own tools.

MN4 belongs with ``obsidian`` and ``subagent``, not with ``linked`` /
``lightrag_server`` / ``ima``, which do resolve to an index or an HTTP
retrieval API. Tests pin both halves of that split, since collapsing it
the other way has cost Book its connected sources before.

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: evan <evan@dazongguandeMac-mini.local>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-21 16:10:22 +08:00
Bingxi Zhao (Frank)
8450a928c4 fix(obsidian): make vault failures legible instead of opaque
Builds on #922, which made read-only scans tolerate undecodable bytes and
kept the read-modify-write paths strict. Strict was the right call, but the
refusal was invisible: append_note / set_property let a raw
UnicodeDecodeError escape, _ObsidianTool.execute catches only VaultError,
so the model was told "an unknown error occurred" — the exact failure mode
#914 reported spending rounds guessing at.

* The two write paths raise VaultError naming the note, the byte offset and
  the fix. The vault is still never rewritten with U+FFFD in place of the
  user's bytes.
* Both decoders now live in one place each (_read_text / _read_text_exact)
  rather than four repeated read_text calls, so which of the two a new
  caller wants is a decision the module states once.
* execute() reports any other unexpected exception to the model by type and
  message, and logs the traceback for the operator.
* Frontmatter dates serialise through isoformat() rather than str(), so a
  YAML timestamp reaches the model as 2026-08-11T09:30:00 instead of
  2026-08-11 09:30:00, which is not a date it can hand back.
2026-08-20 00:56:34 +08:00
Bingxi Zhao (Frank)
2dcca4e910 fix(mastery): stop reads from inventing paths, and point at the real ones
Asking the tutor "what am I studying?" in a fresh chat answered "no
mastery path has been built yet, let me create one" to learners who had
several, and left an empty path behind for every attempt (#909).

Both halves come from reads going through get_or_create. A turn with no
explicit path and no selected book resolves its id to the conversation's
own scratch id, so the creating read manufactured a path under that id —
five such asks, five orphaned empty paths — and then truthfully reported
the empty thing it had just made.

Reads now load without creating (_load_path). mastery_status treats a
missing path exactly like an unbuilt one, and mastery_quiz / _grade /
_assess refuse an unbuilt path by name instead of half-creating it.

The empty-status message is the other half: unconditionally telling the
model to build is what made it replace a course rather than look for it.
It now reports how many built paths exist elsewhere and points at
mastery_paths / mastery_switch, keeping the build prompt for a learner
who genuinely has none.

Building still creates — mastery_build goes through its own write path.
2026-08-20 00:56:34 +08:00
Bingxi Zhao (Frank)
802a19779f refactor: one place loads plugin entry points
#908 and #911 landed two plugin groups — deeptutor.plugins for registry
capabilities, deeptutor.loop_capabilities for chat-loop ones — each with its own
copy of the same plumbing: read the group, import each target, warn and skip
whatever fails. Only the coercer actually differed.

Move the plumbing into core/entry_points.py, which both layers already depend
on, so the containment guarantee (one bad plugin cannot stop the others) is
stated and tested once instead of twice. Both suites now stub the single seam
rather than a module-local alias.

Drops #908's Python <3.10 entry_points() fallback along the way: the project
requires >=3.11, so the keyword form is the only API in play.
2026-08-20 00:34:08 +08:00
alanguan73
bfa875462b feat(capabilities): discover loop capabilities via entry points (#911)
Adds a neutral deeptutor.loop_capabilities entry-point group so third-party packages can register chat-loop capabilities. LOOP_CAPABILITIES stays the builtin tuple; builtins win on name collisions and broken entry points are skipped. Discovery is cached for the process so plugin capabilities stay singletons like the builtins and neither hot path rescans distribution metadata.
2026-08-20 00:10:35 +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
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)
94a6edd563 feat(mastery): harden path state and turn recovery 2026-08-17 09:57:55 +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)
a43f9fdf2a feat(knowledge): answer "how many files" from an inventory, not retrieval
Asked how many files a knowledge base holds, or whether some document is in
it, the model had only `rag` — and retrieval cannot answer either question:
the passages it returns say nothing about the size of the collection they
came from, so the model guessed from whichever chunks the query happened to
match. PageIndex KBs already answered correctly (their doc list is injected
into the system prompt) and Obsidian vaults have `list_notes`, which makes
this a wiring gap in the default engines rather than a limit of retrieval.

`deeptutor/knowledge/manifest.py` now owns a KB's document inventory as facts
read off disk, with two consumers that cannot disagree:

- the chat system prompt carries a per-KB inventory (count plus a truncated
  name list), so a count costs no tool round-trip — the failure mode where a
  weaker model never emits the call at all (cf. #532). Built once per turn on
  a worker thread, keeping the prompt byte-stable for the whole turn;
- a new `kb_files` tool enumerates on demand with glob / substring filtering,
  mounted under `rag`'s gate (a KB is attached) and deniable per partner the
  same way.

The inventory reports the document set and the KB's index status, and stops
there. It deliberately does not report how many documents reached the index:
every per-file record available is unreliable — LlamaIndex's docstore.json
counts nodes (chunk-level, so it drifts with the chunking config, and costs a
multi-MB parse to read), metadata.json's file_hashes is only written on the
incremental-add path, and last_indexed_count is the last batch's size rather
than a total. A confidently wrong count is worse than none. The prompt block
also states the rule that retrieved passages must never be used to infer how
many documents a KB holds or whether one exists in it.

Connected KBs degrade honestly instead of reporting zero: linked folders and
Obsidian vaults are enumerated in place, while a remote LightRAG server and a
connected subagent are declared unlistable. Hidden OS/editor entries
(.DS_Store, .obsidian/) stop counting as documents, and get_info's
raw_documents reads the same definition, so the KB page and the chat answer
can no longer disagree about the same KB.

Deep Research is untouched: its block loop narrows tools to the four that
produce block-level evidence, and a file list is not evidence for a subtopic.
2026-07-26 22:02:54 +08:00
Bingxi Zhao (Frank)
27a0947486 fix(chat): let rag coexist with an exclusive knowledge capability (#650)
Selecting an Obsidian vault (an exclusive KnowledgeCapability) silently
dropped every co-selected LlamaIndex KB: rag was unmounted, unseeded and
unmentioned. Capabilities now declare owned_kbs (the vault / agent refs
they consume via their own tools); the pipeline keeps rag mounted,
seeded and noted for the remaining coexisting KBs, while a pure-vault
turn still mounts nothing but the owned tools + ask_user.
2026-07-24 00:42:28 +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)
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
Bingxi Zhao (Frank)
c9d387e2b6 super super great great update 2026-06-17 00:56:27 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
517c90b11d refactor(visualize): structured prompts, local validate+repair, drop answer-now
Backend half of the visualize overhaul (frontend is b499ba7).

- code_generator prompts split into system_base/rules_general/rules_{svg,chartjs,
  mermaid,html}; svg rules add coordinate math, viewBox checklist, complexity
  budget, the c-*/t-ts-th class system, single-<svg> + data-prompt.
- analysis: visual_genre (route-on-the-verb) + routing table.
- replace generic LLM review with deterministic local validation (well-formed
  XML + camelCase viewBox / strict JSON / mermaid lint / HTML); on failure, one
  targeted repair call. ReviewAgent keeps process (Book review) + repair (chat);
  pipeline keeps run_review + run_repair.
- remove the visualize answer-now fast-path + its prompts + tests.
- i18n: sync capabilities/prompts/{en,zh}/visualize.yaml status keys to what the
  code emits + add test_status_i18n_consistency.py to guard against drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 23:26:31 +08:00
Bingxi Zhao (Frank)
acd0d9329d feat(capabilities): unify infra, merge Animator into Visualize, split settings UI
Capability infrastructure:
- New capabilities/_shared.emit_capability_result helper fills the
  result envelope (label, summary, payload, render hints, UsageTracker
  totals) consistently across modes.
- StatusI18n loads capability status copy from
  capabilities/prompts/{en,zh}/<name>.yaml; legacy main.yaml strings
  removed.
- New capabilities_settings router + service-config module power the
  /settings/capabilities admin page (live capability list, defaults,
  per-capability overrides).

Visualize + Animator merge:
- Visualize's AnalysisAgent now picks one of six render_types:
  svg / chartjs / mermaid / html (text pipeline) or manim_video /
  manim_image (Manim subprocess). The result envelope carries
  render_type so the frontend delegates to the right viewer.
- math_animator capability is folded behind Visualize; the standalone
  MathAnimatorConfigPanel.tsx is removed. The Animator sidebar entry
  is gone, but Manim outputs and existing records remain unaffected.

Settings UI:
- /settings page split into appearance / capabilities / embedding /
  llm / mcp / memory / search / status / tools tabs with a shared
  layout and items index.
- New /settings/tools page lists chat-mountable tools and surfaces
  availability (e.g. gh for github_query) via a new tools router.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:06:14 +08:00
Bingxi Zhao (Frank)
7bdb10b700 feat(chat): Auto mode router + new chat tools (ask_user, web_fetch, etc.)
Auto capability (agents/auto/) gains a three-stage agent loop:
ANALYZING (one LLM call, streamed as thinking) -> DELEGATING (router
emits delegate_to_<cap> tool calls or atomic tool calls, with bounded
retries and a same-cap quota) -> SYNTHESIZING (final inline answer).
Sub-capability events flow through forward_events with call_id tagging
so conversation history keeps only Auto's own synthesis.

New chat-mountable tools:
- ask_user: pauses the turn for 1-3 structured questions, frontend
  renders a card the user navigates and submits in one batch
- web_fetch: HTTP + readable-content extraction with strict
  scheme/private-IP/size guards (pre-flight + post-redirect)
- write_note: replaces save_to_notebook; append (new record) and
  edit (existing record by id) modes
- list_notebook: read-only index / drill-down listing; only mounted
  when the user has notebooks
- github_query: read-only ``gh`` CLI wrapper (pr/issue/run/repo plus
  GET-only api); no mutation verbs reachable

Updates chat agentic_pipeline.py + agentic_chat.yaml (en/zh) to the
new tool surface and source-inventory contract, refits
tools/builtin/__init__.py as the single place to register
chat-mounted tools and their argument-augmentation wrappers, and
tightens core stream + tool_protocol around tool-result metadata.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:05:15 +08:00
Bingxi Zhao (Frank)
3d5c3a1eb5 improve chat 2026-05-12 02:20:30 +08:00
Bingxi Zhao (Frank)
77f29cbcc7 fix lint 2026-04-23 19:29:16 +08:00
Bingxi Zhao (Frank)
100576da69 release: v1.1.2 — schema-driven channels, secret masking, RAG simplification, KB-consistency hardening
* TutorBot Channels tab is now schema-driven across every built-in & plugin channel
  (GET /api/v1/tutorbot/channels/schema), with per-field secret reveal toggles.
* Channel secrets are masked end-to-end; raw values only surface via the explicit
  ?include_secrets=true edit-form route. PATCH validates ChannelsConfig at the API
  boundary and returns 422 on bad payloads. reload_channels is serialised by an
  asyncio.Lock and records last_reload_error for the UI.
* Collapsed services/rag/ to a single LlamaIndex pipeline: removed ~2.6k lines of
  unused components/* + pipeline.py + types.py + utils/ + parsers/. rag_provider
  is now a stub; legacy values silently coerce to llamaindex.
* Centralised file routing into services/rag/file_routing.py (FileTypeRouter /
  DocumentType / FileClassification); dropped per-provider extension helpers.
* Defensive RAG/KB consistency: deep_solve / deep_research strip rag/kb when no
  KB is attached; SolveToolRuntime + ResearchPipeline + DecomposeAgent
  short-circuit instead of falling back to non-existent default KBs (DE-all,
  ai_textbook).
* Externalised AgenticChatPipeline prompts into agentic_chat.yaml (zh + en).
* Added Thai README (#337).
* New test modules: file_routing, knowledge_base_config, channel_schema,
  channel_secrets, rag_consistency, research_pipeline_rag.

Full notes: assets/releases/ver1-1-2.md

Made-with: Cursor
2026-04-18 11:33:53 +08:00