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.
Replace no longer reuses positional IDs for unrelated waypoints, invalid
questions can be voided or re-keyed, and defer advances the route without
faking mastery.
Fixes#1527
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Route Mastery, Book, and Immersive Reading attempts through one review record so reading quizzes are server-graded, retryable, and show the learner's pick next to the reference answer.
Co-authored-by: Cursor <cursoragent@cursor.com>
The marker lines the extractor embeds ([图片 N: image-NN.png]) rendered
as literal text in the body with the pictures collected in a separate
strip below the article, each captioned with its filename. Render the
picture itself at the marker's position instead — the marker text stays
in the DOM under the same HiddenMark pattern every other collapsed
marker uses, so Recogito's char-level selectors still resolve against
the exact text an annotation was saved against. A picture whose media
row is missing keeps its literal marker, and anything the inline
renderer cannot claim falls back to the strip.
Also accept catalog-minted rm_ material ids in the reader's wire
validators (turn state, references, location history, citation
anchors), matching the id shape the store already accepts.
Bind mastery drafts before their opening turn and preserve stored session modes.
Track chat duration from submission through terminal completion. Run async reading
extensions on their event loop and allow retries after cancellable timeouts.
Allow first uploads into empty LlamaIndex knowledge bases, preserve Telegram
thread routing, parse embedding Retry-After dates, and enforce robots rules and
host pacing during documentation crawls, including redirects.
Fixes#1461Fixes#1458Fixes#1451Fixes#1448Fixes#1392Fixes#1429
Refs #1435, #1412
Reuses contributions from PRs #1462, #1452 and #1403.
Co-authored-by: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: AoHanBei <dongaohan21@gmail.com>
Co-authored-by: Gao-Chenkai <DevChenkai@outlook.com>
pdfjs-dist ships two builds. The default one is neither transpiled nor
polyfilled: it targets the newest engines and calls recent ECMAScript methods
such as `Map.prototype.getOrInsertComputed` (ES2026; Chrome/Edge 145+,
Firefox 144+) straight off the platform. On any slightly older engine --
including a browser or embedded webview only a few months behind -- the worker
throws
this._requestsByChunk.getOrInsertComputed is not a function
and the document never renders, silently, because the failure happens inside
the worker where the main thread cannot see it.
Take both the library and its worker from the `legacy` bundle, which carries
core-js and patches those methods in. The two must come from the same bundle,
or PDF.js aborts with an API/Worker version mismatch. The extra weight is paid
only by users who actually open a PDF, since this module loads dynamically.
Pin the choice with a test so it is not "optimised" back.
* feat(sessions): add recycle bin for deleted chats
Implements soft-delete for chat sessions so users can restore
accidentally deleted conversations from a recycle bin.
Backend:
- Schema migration adds deleted_at REAL column to sessions
- delete_session becomes a soft-delete (sets deleted_at timestamp)
- New store methods: restore_session, purge_session, list_deleted_sessions
- Session list queries exclude soft-deleted sessions
- API endpoints: GET /sessions/recycle-bin, POST /{id}/restore,
DELETE /{id}/purge (purge triggers attachment/mastery cleanup)
Frontend:
- RecycleBinSection: collapsible sidebar section listing deleted
sessions with Restore and Delete permanently actions
- Wired into SidebarShell via recycleBinSlot prop
- API client functions for list, restore, and purge
- en/zh translations for all recycle-bin UI strings
Tests: 6 backend tests covering the soft-delete lifecycle
* style: apply ruff format to sqlite_store
* fix(sessions): preserve recycled chat artifacts
* feat(sessions): fold #1444's backend into this recycle bin
#1444 built the same feature from the other end. This PR had the SQLite
column, the routes and the sidebar UI; #1444 had the protocol declarations,
the PocketBase implementation and the CLI wording. Neither shipped alone —
this one left multi-user deployments answering AttributeError on
/recycle-bin, and #1444 built a bin nobody could see. Closes#1444; its
backend is here.
Kept from here: one `deleted_at` column. #1444 carried `is_deleted` beside it
in both backends, and `deleted_at IS NOT NULL` already says everything the
boolean did — PocketBase now derives the outward `is_deleted` field from the
timestamp instead of storing it twice.
Taken from #1444: the naming, which turns out to fix the residual both PRs
shipped with. `delete_session` keeps meaning what every existing caller
already meant by it — remove the row — so `reading.py`'s two internal
cleanups need no patch: a deleted reading workspace still takes its sessions
with it instead of depositing them in a learner's bin, where restoring one
would resurrect a session pointing at a workspace that no longer exists. The
chat surface's delete is a separate, explicitly named `soft_delete_session`,
and `hard_delete_session` empties the bin. Both backends agree, and the
protocol declares all five so a backend cannot silently lack one again.
`test_entries_cascade_on_session_purge` becomes two tests, because there are
now two deletions worth pinning: one the bin can undo, and one that skips it
and cascades immediately.
Co-Authored-By: sjagadee <srini.jagadeesh@gmail.com>
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: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.
Importing a current Codex session gave the learner a message they never
wrote — a 4KB catalogue of uninstalled plugins — and a session titled
with the first line of it (#1354, follow-up to #1327).
Codex delivers its own context to the model as `role: "user"` items.
Across the 631 rollouts on this machine that is ten distinct tags —
`environment_context`, `recommended_plugins`, `codex_internal_context`,
`skill`, `task`, `heartbeat`, `turn_aborted`, `subagent_notification`,
`codex_delegation`, `send_user_message_question_reply` — and about a
third of every user turn on disk.
Matching the tags would fix today and nothing after it: the list is the
harness's to grow, and a new one walks straight through. What the
injected turns share is a shape, not a name — each is *nothing but*
markup, one or more balanced top-level elements with no prose of the
person's own anywhere around them. So `isHarnessInjectedTurn` consumes
top-level elements and keeps the turn the moment a single character of
anything else remains.
Erring that way is not caution for its own sake, it is the common case:
an attachment turn arrives as `<image name=[Image #1]></image>` followed
by the actual question, 76 of them here, and every one is kept because
the question sits outside the element. Anything ambiguous — a same-named
nested tag, an unclosed one, an attribute holding a `>` — falls out of
the loop unmatched and is kept too. Losing a title to a block we failed
to recognise is a blemish; eating the sentence someone typed is not.
Known to under-catch, deliberately: 181 turns pair the plugin catalogue
with an injected `# AGENTS.md instructions for <path>` in plain markdown,
which has no shape to recognise and would need the literal string. Those
still import.
The legacy `event_msg` path is untouched — it carries none of this (zero
such turns in the corpus), and the tests pin the `<image>` prefix and an
unclosed tag as the two cases that must survive.
The clamp read `min(clampedTop, rowCenter - lowerMargin)`, and
`rowCenter - 0.75h` is always the smaller of the two, so every cue
subtracted three quarters of a viewport from the centring offset — putting
the active row below the bottom edge, or pinned at the top for early cues.
The intent was to move only when the row leaves the middle 50%.
The arithmetic *is* the behaviour, so it moves to a pure
`transcriptFollowScrollTop` with the six cases pinned: inside the band
(no scroll at all, so the list stops creeping under the reader), above it,
below it, first cue, last cue, and a list too short to scroll.
(cherry picked from commit 0e51f652024d755460ea122447548d40e9285c16)
Adds `uk` alongside `en` and `zh`: a complete `web/locales/uk/app.json`
(4009 keys), a Ukrainian CLI label set (102 keys), a Ukrainian quiz-judge
prompt, and the language directive that tells the model to answer in it.
Most of the diff is not the translation — it is the six independent
places that each decided, on their own, which languages exist. Every one
of them collapsed an unknown code to English *silently*, so picking
Ukrainian in Settings produced an English UI, English AI feedback and an
English chat reply, with nothing logged anywhere:
* `services/settings/interface_settings._normalize_language` — the
canonical normalizer; `interface.json` stored `uk`, the API returned
`en`, and it looked like the setting had failed to save.
* `agents/loop/prompt_blocks` — conflated two different things in one
attribute: which prompt ASSETS exist (yaml ships `en`/`zh` only) and
which language to ANSWER in (any). Split into `language` and
`output_language`; the directive now takes the latter.
* `api/routers/quiz_judge` — the supported set is now derived from
`_JUDGE_SYSTEM_PROMPTS`, so a language cannot be advertised without a
prompt or shipped without being advertised.
* `web/i18n/init` — `normalizeLanguage`/`ensureLanguage`, plus a new
exported `APP_LANGUAGES` that every picker maps over. The Settings
toggle inlined `["en", "zh"]`, so a new locale was invisible there
even once it existed.
* `web/context/app-shell-storage` — held a second, private copy of the
`AppLanguage` union; re-exported from `i18n/init` instead.
* `runtime/banner` and `services/config/settings_spec` — the CLI wizard
labels and the Settings language list.
Tool hints stay a per-language map from the API where only `en` is
guaranteed, so `ToolsSettingsSection` falls back instead of indexing a
missing key. Backend prompt yaml is still `en`/`zh`; Ukrainian uses the
English scaffolding with a Ukrainian output directive, which is what the
directive is for.
`tests/i18n/test_ukrainian_locale.py` pins each seam — locale key parity,
placeholder integrity, judge/prompt/normalizer coverage, and that the
Settings toggle maps over `APP_LANGUAGES` rather than a literal — so the
next language fails in CI rather than quietly in the UI.
One partner serving three study groups plus DMs rendered as a flat list
where every row looked like a private chat: the only label is the
opening message, which in a group is one student's question (#1229). The
data was never lost — sessions are already one file per chat — it just
never reached the list.
The channels state the kind of conversation on the inbound event and
DeepTutor was dropping it: Feishu sends ``chat_type`` ("group" / "p2p"),
Slack and Mattermost send ``channel_type``. Delivery is the only moment
this is known for certain, so the turn records it, and the summary reads
it back. No prefix sniffing, no lookup on the read path, and nothing has
to import a channel to render a list.
``conversation_scope`` is the single place those three vocabularies
become the two words a reader cares about. A channel that says nothing —
or says something new — yields no label at all, and the row renders as
it always did; a list that guesses is worse than one that stays quiet.
Sessions written before this carry no origin and are likewise unlabelled
rather than marked "unknown".
This is the distinction the report called the minimal useful fix.
Resolving a Feishu group's *name* through the chats API, which is what
it asked for first, is left out on purpose: it needs a call and a cache
I cannot exercise against a real tenant here.
The regenerated contract picks up ``/api/knowledge-bases/delete`` as
well — the committed schema was already behind by that route before this
change, and the file is generated, so it comes back whole.
The provider redirects the browser to a loopback listener. Under Docker
that listener runs inside the container and the standard compose file
publishes only the Web and API ports, so the browser lands on a page it
cannot load while the sign-in waits until it expires. The card treated
localhost as native local execution and offered nothing else: the remote
guidance was gated behind a non-loopback hostname, so the one deployment
that most needs a way back in was the one that never saw it (#1252).
The browser can read that address even when this process cannot receive
it, so pasting it back is the recovery path. It goes to a new
authenticated endpoint on the Web origin, which resolves the caller's
*own* pending operation rather than scanning every login in the process
— the loopback route has to identify itself by OAuth state because it
arrives without a session, and this one does not.
``parse_oauth_callback_url`` is where the address is judged, once: it
must be this login's registered redirect URI down to scheme, host, port
and path, and a repeated OAuth parameter is ambiguous rather than
untidy, so it is refused instead of resolved to one of the two. The
string is parsed and dropped — never fetched, never stored, never
echoed. Past the parse it is ``receive_callback``, so the state check,
PKCE, the registered redirect URI and owner binding are the existing
ones rather than a second implementation of them.
The form now appears whenever a login is waiting, local or remote; the
SSH command stays remote-only, because that advice is.
A knowledge-base name is three things at once: a kb_config.json key, a
directory under data/knowledge_bases, and a path segment in every per-KB API
route. `validate_knowledge_base_name` exists to keep those three uses
compatible — its docstring says so — but it was called from one of the eight
HTTP entry points that can write a name into the config. The seven connect-*
endpoints (Obsidian, MarginNote, folder, LightRAG server, WeKnora, IMA, and
the subagent connection) did `(name or "").strip()` and wrote the result.
A name holding a "/" registers fine that way and is then unreachable.
uvicorn percent-decodes the path before routing, so %2F is a real separator
by the time Starlette matches `{kb_name}` — compiled to `[^/]+`, which cannot
span it. All 29 per-KB routes 404, delete included, while the list endpoint
takes no path parameter and keeps rendering the KB. Connected KBs are also
exempt from the orphan prune, so nothing collects it either: visible, unusable,
and removable only by hand-editing kb_config.json.
Two changes, both needed. Validation moves onto the eight `register_*`
methods, which is the seam every route already goes through — no route file
changes, since they all map ValueError to 400 — and the now-unreachable
"name is required" guards go with it. And a path-free
`POST /knowledge-bases/delete` gives the entries that predate the guard a way
out; a body is never split into segments. Widening the path route to
`{kb_name:path}` would not work: it is declared ahead of the DELETE routes
for linked folders, GitHub sources and web sources, and a greedy converter
would silently swallow all three.
Two smaller fixes ride along. The delete handler's catch-all swallowed its
own HTTPException and answered 500 with "404: ... not found" in the detail;
it now re-raises. And CreateKbModal states the rule under the field instead
of letting an untranslated English 400 be the first the user hears of it.
test_marginnote4_kb's store-collision case used "My Lib" / "My/Lib"; the
slash is now refused before that guard is reached, so it uses "My.Lib" —
still a name the rule allows, still sanitized to the same My_Lib.db.
When a question's turn is gone, `submit_user_reply` is refused — correctly;
the backend has no waiter left. What the three composers did with that
refusal is the bug: they raised "This question is no longer active, so your
answer could not be sent. Send a new message to continue." and returned.
The composer had already cleared the box, so the return discarded what the
user had typed. And the advice was impossible to follow: every subsequent
message hit the same branch, because the predicate that routes into it reads
only the persisted card, which nothing ever retires. The one instruction the
error gave was the one thing it was preventing.
So a refused reply now falls through to `sendMessage` with the same content.
The card is one way to answer, never the only one, and the conversation
cannot trap the user — whichever of the several ways in to a dead turn they
came by (a backend restart, a Stop, a replay race).
The message says what actually happened rather than reporting a failure:
the text was delivered, just not to the question. `REPLY_NOT_DELIVERED`
stays for the card banners, where it remains true — a card's own Submit has
no composer to fall through to.
The regression test pins the refusal path specifically: it fails against the
previous `return`, which is the shape that stranded the reporter.
This does not remove the need to retire a dead card server-side (no
`ask_user_resolved` counterpart is ever emitted when a turn dies) — that is
the deeper half and is left as follow-up.
The button inferred success from its handler's promise *resolving*, and the
handler it was given could not fail: `copyAssistantMessage` awaited
`navigator.clipboard.writeText` inside a try/catch that logged and swallowed.
So the only failure signal was destroyed one frame before the only code that
could have used it — and every clipboard failure rendered 已复制 with a
checkmark. Because the label is also the `aria-label` on an `aria-live`
element, the false success was announced to screen readers.
The failure is not exotic. `launcher.py` binds the web app to 0.0.0.0 while
printing a localhost URL, so opening the same instance from another machine
on the LAN is an ordinary way to run DeepTutor — and on that plain-http
origin `navigator.clipboard` does not exist, so reading `.writeText` throws
synchronously. `FilePreviewDrawer` already carried a comment naming this
exact cause; the handling was local instead of shared.
So: one `copyText` helper that rejects when the text did not reach the
clipboard, with a selection-based fallback for insecure origins (probed
before any await, since `execCommand` needs the click's user activation);
`CopyActionButton` narrowed to a `Promise<void>` handler and given a real
failure state, so the contract cannot be reintroduced by the next consumer;
and the three consumers plus the two other optimistic sites moved onto it.
`Promise.resolve().then(() => onCopy(...))` replaces
`Promise.resolve(onCopy(...))` because the latter runs the handler outside
the chain, which is where the synchronous TypeError was escaping.
Also adds the `attachments` and `references` locale keys. Both call sites
pass a lowercase noun for inline reading, neither key existed, and i18next is
configured to return a missing key verbatim — which is why a Chinese UI
rendered "5 attachments" in English next to this very button.