142 Commits

Author SHA1 Message Date
zszz3
5a32e5434e refactor: trim duplicated guidance in ask_user, cron and learning_update schemas
Nested ask_user option and multi_select fields repeated what the
top-level description already says; the option label/description rule
is now stated once in the options description. The cron and
learning_update descriptions drop sentences that their parameter
descriptions repeat. Types, required fields and enums are unchanged.

Refs #2975
2026-12-01 11:17:29 +08:00
wojiecihuo
76dc7e2e26 Merge pull request #3035 from zszz3/fix/chat-call-tool
fix: reach loaded tools through call_tool instead of growing tools[] mid-turn
2026-12-01 00:30:14 +08:00
wojiecihuo
4db66bf3bd Merge pull request #3034 from zszz3/fix/chat-stable-tools
fix: keep chat tools[] and the system prompt stable within a session
2026-12-01 00:29:55 +08:00
bluefateludi
9dafbcfa4a fix(tools): report truncated reason and brainstorm results (#3096) 2026-12-01 00:26:37 +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
12e9809a6e fix: reach loaded tools through call_tool instead of growing tools[] mid-turn
load_tools appended the loaded schema to the end of tools[]. tools[] is the
first thing in the provider's prompt-cache key, so the next request of the
same turn re-processed the system prompt and the whole history.

When the turn mounts the new call_tool builtin, load_tools now returns the
loaded tools' definitions in its result and leaves tools[] alone; the loop
forwards each call_tool call to the named tool before dispatch, so the tool
runs with its own argument checks, injected kwargs and trace, while the
history keeps the model's own call. Tools loaded this way stay proxied for
the session (loaded_tools.json gains proxied_tools). Runtime loads that must
land in tools[] pass native=True; the TypeScript engine keeps the old
behaviour.
2026-11-30 23:35:59 +08:00
zszz3
224a08029d feat: let deferred tools return their usage rules from load_tools 2026-11-30 23:34:37 +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
Frant1cc
912e8fba2d fix(pptx): resolve font fallback in PDF previews and exports (#3043)
* fix(pptx): resolve font fallback in PDF previews and exports

* test: match host path semantics in the PPTX preview fixture

---------

Co-authored-by: Qiuner <wdst3635@163.com>
2026-11-30 05:17:20 -03:00
zszz3
8f230158c3 fix: carry the manifest-only input constraints in the tool schemas
Native requests no longer send the text manifest, whose when_to_use and
input_format hints held a few constraints the schemas did not: paper_search
takes at most 3 English words, reason's usage condition, a non-empty rag
query, and not inventing a Zotero user ID or passing an API key the user
did not supply. The rest of the hints were already in the schemas (ask_user's
12-character header included).

Refs #2973
2026-11-30 13:58:21 +08:00
zszz3
d9a06eafd7 fix: drop the text tool manifest when native tool schemas are sent 2026-11-29 16:32:47 +08:00
Marcello Pichini
5901993bcb fix(tools): resume read_file after the last line shown (#2850)
When the numbered page exceeded the 128k-character budget, read_file cut
the text mid-page but still reported the requested range: the hint
pointed past lines that were never shown, or claimed the end of the
file. Stop at the last whole line that fits and base the continuation
offset on it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 19:41:54 +08:00
Bingxi Zhao (Frank)
8ab4ecfee9 feat(books): review and undo scoped chapter and section edits
Fixes #2571
2026-11-15 01:42:47 +08:00
Bingxi Zhao (Frank)
794f1c7399 Merge PR #2545: fix: scope text source_path RAG to the requested document (#2374)
Declare document-scope support at the pipeline contract and reject unsupported scoped queries before rewrite/retrieval; verify empty scopes also fail closed (29 retrieval tests and 10 service tests passed).
2026-11-14 23:16:26 +08:00
Bingxi Zhao (Frank)
3fc9d2ce18 Merge PR #2534: feat(web_fetch): pluggable fetch backend with DeepSeek Fetch as first alternative
Combine independent locale additions and regenerate integrated route index.
2026-11-14 23:00:23 +08:00
Adithya
ec6168a107 fix: keep model tool calls on configured connections and search paths 2026-11-11 12:18:20 +05:30
evan188199-tech
f426862725 fix: prefer full-path RAG scope identity over basename (#2374) 2026-11-09 17:00:19 +08:00
evan188199-tech
1cd7e2e150 fix: match scoped RAG sources by exact path (#2374) 2026-11-09 16:28:24 +08:00
evan188199-tech
91104d9a3f fix(web_fetch): settings UI for backend + harden DeepSeek fetch cap (#2448)
Addresses Air R1/R2 review blockers on top of the opened PR head:
Settings GET/PUT /api/settings/web-fetch with UI control; DeepSeek fetch
uses identity encoding, raw bytes, and capacity checks before buffer extend;
provider-branding treats `local` as generic.
Air Codex R3 on MacBook Air: READY.
2026-11-09 16:23:50 +08:00
evan188199-tech
2103f2523c fix: scope text source_path RAG queries to their document (#2374)
source_path alone is a document scope, not a visual request: an ordinary
text query with no page, figure, region or asset_id selector now stays on
the text retrieval path, restricted to that one document, instead of
entering exact-source visual inspection and failing reference_required.

- RAGTool routes source_path-only queries to a scoped semantic search that
  verifies the source exists (and its source_hash when given), forwards
  document_keys to the backend, and never falls back to a whole-KB search:
  a backend that cannot enforce the scope, or a document with no matching
  passage, fails explicitly (source_scope_unsupported /
  source_scope_no_match) with foreign passages withheld.
- LlamaIndex scoped retrieval now recognises plain-text documents, which
  carry only file_path metadata, by their raw-relative position — never by
  bare basename, so sub/notes.txt does not leak into a notes.txt scope —
  and admits nodes without a page_status.
- Tool schema description and en/zh prompt hints state the contract;
  selector-contract tests cover the scoped text path and a new suite
  covers raw-relative scope matching.
2026-11-09 15:07:50 +08:00
evan188199-tech
1a9c006a2d feat(web_fetch): pluggable fetch backend with DeepSeek Fetch as first alternative (#2448)
Add a FETCH_PROVIDERS spec table next to SEARCH_PROVIDERS and a
deeptutor/services/fetch/providers registry, mirroring the search-provider
shape: local (the unchanged in-process extractor, default) and deepseek
(POST /v1/tools/fetch, Bearer auth; key from kwargs > env > DeepSeek chat
profile).

fetch_url_as_markdown gains backend=None -> DEEPTUTOR_FETCH_BACKEND ->
local. The scheme/SSRF gate runs before any remote backend so a private
URL is never handed to a third party. Retryable backend failures
(401/402/403/408/429/5xx, network, missing key) fall back to the local
extractor; 400/404/413 and an empty body are hard failures. Remote
outcomes keep the requested URL for citations; the crawler/KB site sync
stay local. All tests mock HTTP offline.
2026-11-09 12:53:31 +08:00
Bingxi Zhao (Frank)
d731546cf6 Merge #2379 from remote-controlled-man 2026-11-06 01:56:25 +08:00
Bingxi Zhao (Frank)
c0b286b11a Merge #2368 from KKandLL-Forever 2026-11-06 01:56:24 +08:00
Steven Huang
b4dab154da fix: retain inferred source page inspection 2026-11-02 22:22:18 +08:00
Steven Huang
ad92fd11be fix: report unsupported source-only RAG text scope 2026-11-02 22:15:29 +08:00
wangkai
c7757741b5 feat(tools): add paginated favorite record reads 2026-11-02 19:23:43 +08:00
Rudy Celekli
5c39ff5b46 fix(tools): raise ValueError, not TypeError, on a None LLM response
extract_questions_with_llm raises ValueError("LLM returned empty or None
response") when the completion is None, but its except handler then sliced
result_text[:500] — None[:500] — raising TypeError and masking the intended
error. A None completion is a realistic provider outcome (content filter,
transient empty response) in the exam-mimic question pipeline.

Build the preview from (result_text or "") so the handler reports the clean
ValueError.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-01 09:36:42 -05:00
Bingxi Zhao (Frank)
6d2026ee71 Merge reviewed PR #2207 and regenerate routing contracts 2026-10-31 17:39:41 +08:00
x-labb
6aee33b228 fix(mastery): show a presented source page at the call that presented it 2026-10-30 21:52:29 +01:00
czc
f742fc2693 fix(settings): require a model ID and keep model panels URL-driven
- The Add model panel now asks for a model ID (prefilled from provider
  defaults and discovered models) and keeps Continue disabled until it is
  filled, so an unusable row can no longer reach the draft.
- The model editor marks a blank ID as required, explains it inline, and
  blocks "Set as default" until it is fixed.
- Apply now names the first incomplete model and opens the page and row
  that can repair it, instead of failing with a message pointing nowhere.
- Add/selection state lives in the URL, so refreshing no longer swaps the
  add panel for the list (or vice versa).
- Backend guidance points at the current page names (Language models /
  Embedding models / Search) instead of the removed Catalog page.
- Regression tests cover the add flow, URL state, editor validation, and
  the Apply preflight; new i18n keys for en/zh/de/pl/fr/uk.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-29 18:16:23 +09:00
Bingxi Zhao (Frank)
e7b6e48c25 Merge pull request #2069 into validated PR integration 2026-10-29 00:56:11 +08:00
Bingxi Zhao (Frank)
9aadac3e3b merge: integrate current dev with modular installation 2026-10-28 01:23:48 +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)
4205da1651 Merge remote-tracking branch 'origin/dev' into HEAD 2026-10-27 21:39:47 +08:00
Bingxi Zhao (Frank)
9d822fcdf0 fix(ci): align preview fixtures and formatting with current contracts 2026-10-27 01:44:57 +08:00
Bingxi Zhao (Frank)
6bbcc00c55 Merge dev into preview, preserving preview features
Integrate dev fixes with preview's Python/TypeScript schedulers, chat queue, learning navigation, and live turn persistence.
2026-10-27 01:16:58 +08:00
Rudy Celekli
b3c235fc1f fix(vision): track escapes when splitting GeoGebra command args
_split_command_args toggled its in-string state with a single-char check
(current[-1] != '\\'), so a real closing quote preceded by an escaped
backslash (\\") was misread as escaped. The parser stayed in-string, swallowed
the following comma separators, and returned the whole remainder as one
argument — e.g. Text["a\\", 1, 2] was reported as an unterminated string and
its scalar-to-point repair was lost. Track escaping with a flag that flips on
each unescaped backslash so an even run closes the string.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-26 10:54:04 -04: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
AleFlyX
8f9fb42b6b fix(mastery): 阻止历史回忆递归归档膨胀
变更:
- 将归档与历史回放中的历史读取正文替换为可回查引用,保留原始存储记录
- 为精通之路历史归档增加每页 16000 字符的分页读取
- 增加多轮重复读取、旧大记录兼容和分页还原的回归测试

验证:
- 216 项相关 pytest 测试:PASS
- 修改文件的 Ruff lint 与格式检查:PASS
- scripts/check_architecture.py:PASS
- git diff --check:PASS

Fixes #2032
2026-10-23 12:44:33 +08:00
Bingxi Zhao (Frank)
9aae961412 Merge PR #1957: separate private source evidence from explicit public presentation 2026-10-19 00:53:44 +08:00
Bingxi Zhao (Frank)
0fd8dc8384 Merge PR #1953: source-bound assessment with portable lexical page lookup 2026-10-19 00:43:33 +08:00
Bingxi Zhao (Frank)
399297e7f0 feat: preserve TypeScript engine migration and workspace updates 2026-10-18 23:09:10 +08:00
Mohammad Hijjawi
630742b6cc fix: decode fetched pages with their declared <meta> charset
web_fetch decoded every response with httpx's response.encoding, which
only reads the Content-Type header and otherwise defaults to UTF-8. Pages
that declare their charset in the markup (common for GBK, Shift_JIS and
EUC-KR sites) came back as replacement characters in the web_fetch tool,
Immersive Reading URL imports and website knowledge-base crawls.

Pick the charset the way a browser does: byte-order mark, then the
Content-Type charset, then a <meta> declaration in the first 1024 bytes,
then UTF-8. Labels such as gb2312 and iso-8859-1 decode as their
superset encodings (gb18030, cp1252), matching the WHATWG Encoding
standard.
2026-10-17 23:30:55 +01:00
Bingxi Zhao (Frank)
857a82e74a feat(notes): add block notebooks with inline reviews and linked favorites
Add rich text and learning blocks, media uploads, page trees, and revisioned notebook storage. Present AI suggestions at their target blocks with durable accept and dismiss actions.

Unify saved outputs as Favorites with typed expandable blocks, stable source links, atomic batch insertion, nesting, dragging, and undo/redo.

Validation: 99 frontend tests and 99 backend tests pass in an isolated snapshot, along with TypeScript, scoped ESLint, dependency architecture, and locale parity checks.
2026-10-17 23:15:23 +08:00
yepyhun
755686264d fix(mastery): separate source inspection from assessment delivery 2026-10-13 13:49:35 +02:00
yepyhun
ccac56eec1 fix(mastery): bind semantic assessment to verified question evidence 2026-10-13 12:21:04 +02:00
XZH
43ad667a35 fix(rag): align tool selector contract with execution (#1928)
Optional selectors are now advertised as nullable, page is one-based with
minimum 1, and region is four coordinates bounded to 0..1 with omitted/null
meaning the full page. At the tool boundary a legacy empty region counts as
omission instead of switching to visual routing, and malformed page/region
selectors fail visibly with a correctable message instead of being clamped
or rerouted to replacement evidence.
2026-10-11 14:09:11 -07:00
Bingxi Zhao (Frank)
1e7eef0e9a feat(research): add grounded scientific primitives and scoped private MCP origins (#1629) 2026-10-08 10:05:38 +08:00
Bingxi Zhao (Frank)
2350ea2dba feat(mastery): complete source-grounded visual practice and evidence (#1611)
Bind original visual sources and keys to supported tasks; verify accepted model pixels, preserve cues/assistance and canonical attempts, keep uncertainty ungraded, expose challenge/repair, and separate required visual evidence from generic text mastery.
2026-10-08 05:25:05 +08:00
Bingxi Zhao (Frank)
de64a9aa0f feat(rag): complete exact source visual and PDF page grounding (#1610)
Expose inspectable extraction coverage, retain structured provenance, resolve bilingual figure and table references without similarity substitution, and provide bounded local page/region fallback with source identity checks.
2026-10-08 03:44:56 +08:00