88 Commits

Author SHA1 Message Date
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
Bingxi Zhao (Frank)
0340ea551e Merge #2318 from rudycelekli 2026-11-06 01:56:22 +08:00
Bingxi Zhao (Frank)
864bd40c59 Merge #2283 from Plastic-time 2026-11-06 01:56:21 +08:00
Bingxi Zhao (Frank)
d47cd88b13 Merge #2276 from Plastic-time 2026-11-06 01:56:21 +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
7187d5b610 test(tools): cover favorite read safety and compatibility 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
RRFZ
2d3bf1f42b test: read UTF-8 sources and fixtures as UTF-8
Twenty tests read repository files (pyproject.toml, SKILL.md, prompt
YAML/Markdown, requirements) or a UTF-8 backup with a bare read_text(),
which decodes with the locale. On a Chinese-locale Windows machine
(cp936) every one of them fails with UnicodeDecodeError before asserting
anything, so the suite cannot be run there to check Windows behaviour.

Pass encoding="utf-8", as the product code reading the same files does.
No assertion changes.
2026-10-31 22:27:43 -04:00
RRFZ
60a29f09c8 fix(skills): list a skill's files with forward slashes on every OS
When read_skill asks for a file the skill does not hold, the tool names
the files it does hold so the model can ask again. list_skill_files
built those names with str(relative_to(...)) and sorted Path objects,
so on Windows the model saw "references\outline.md" in case-insensitive
order, not the "references/outline.md" form SKILL.md links use.

Return relative_to(...).as_posix() and sort the strings.
2026-10-31 21:42:12 -04:00
RRFZ
1b41175cad fix(parsing): keep model-download jobs readable on non-UTF-8 Windows
The Docling and MinerU model downloads read their child's output with
text=True and no encoding, so the backend decoded it with the ANSI code
page. Under `deeptutor start` the backend gets PYTHONIOENCODING=utf-8
but not UTF-8 mode, so on a cp936/cp932 server the downloader writes
UTF-8 tqdm bars that the pump cannot decode. The first bar raised
UnicodeDecodeError, the pump stopped reading, the child blocked on the
full pipe and the job stayed "running" with an empty log.

Follow the MinerU parse subprocess: run the downloader with
PYTHONUTF8=1 and decode its output as UTF-8 with errors="replace".
2026-10-31 21:01:18 -04: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
Bingxi Zhao (Frank)
e99d632de5 fix: prepare modular installs and align dev documentation 2026-10-28 19:02:44 +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)
be596676f7 fix: restore preview calendar and navigation workspace boundaries 2026-10-27 02:04:20 +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
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)
8e67802b11 fix(mineru): include CLI worker dependencies and update parser test seam 2026-10-19 00:32:54 +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
yepyhun
755686264d fix(mastery): separate source inspection from assessment delivery 2026-10-13 13:49:35 +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)
64bc0d8e7c feat(learning): expose a durable workspace journal overview (#1407)
Adapt the journal foundation from PR #1226 and add a read-only mission, handoff and confirmed-record panel. Share its snapshot with turn injection, preserve corrupt files, and serialize worker writes.

Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-10-08 03:11:15 +08:00
Mohammad Hijjawi
d16481a77c fix: decode escaped emoji in ask_user cards as real characters (#1780)
decode_escaped_unicode_for_display repairs double-encoded \uXXXX runs
(#973) with the unicode_escape codec, which turns a surrogate-pair escape
for an emoji into two lone surrogates instead of one emoji. The
result cannot be encoded as UTF-8, so an ask_user card or mastery question
whose escaped text contains an emoji fails when the event is persisted to
SQLite or sent over the WebSocket.

Decode each run as a JSON string instead, matching the web decoder's
JSON.parse, and leave runs with an unpaired surrogate escaped.
2026-10-07 20:21:09 +08:00
evan188199-tech
614834dad0 test: add tex_downloader/tex_chunker toolchain tests (#1748)
Co-authored-by: XZH <cto@xzh.ai>
2026-10-07 20:12:27 +08:00
cxzyy
731736f860 fix(parsing): map local MinerU failures to actionable errors (#1612)
Local parse failures were flattened into one 'Ensure MinerU is installed or switch to cloud mode' error even when the CLI existed and the run failed at runtime, and the captured stderr tail only reached the server console. Map each LocalParseReason to its own MinerUError message (install hint only for cli_missing, stderr tail for nonzero_exit) and carry code/detail on MinerUError. The four white-box tests that injected the old bool function now inject parse_document_with_mineru_result; assertions are unchanged.
2026-09-29 23:55:44 +08:00
polaris-smart
7656acf106 fix(mineru): scale cloud retry budget with key pool size
_request_json used a fixed two-attempt loop, so with N configured keys
only the first two were ever tried before MinerUError was raised after
consecutive 429s. Follow the #1499 retry-budget semantics used by the
LLM/embedding paths: attempts = max(2, len(key_pool)).

Behavior is unchanged for single- and two-key setups; pools with three
or more keys can now actually rotate past two rate-limited keys.
2026-09-24 23:52:21 +08:00
Bingxi Zhao (Frank)
705e9bf9d5 Merge branch 'codex/reading-learning-prs-20260923' into codex/pr-batch-root
# Conflicts:
#	deeptutor/reading/extract.py
#	deeptutor/reading/store.py
#	web/components/notebook/NotebookRecordRow.tsx
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-09-23 10:58:38 +08:00
Bingxi Zhao (Frank)
33b74abdbc Merge PR #1417: deduplicate ask_user options 2026-09-23 10:30:24 +08:00
Bingxi Zhao (Frank)
4defba8b99 Merge commit 'refs/pr/1371' into codex/evan-backend-prs-20260923 2026-09-23 10:27:59 +08:00
Bingxi Zhao (Frank)
1fe74df0ed fix(notebook): decouple evidence from chat sessions (#1519) 2026-09-21 14:50:02 +08:00
Bingxi Zhao (Frank)
715e5de592 Merge remote-tracking branch 'origin/dev' into codex/question-pr-1341 2026-09-19 16:11:05 +08:00
evan188199-tech
9ad83d0630 fix(skills): improve read_skill file recovery (#1347) (#1370)
* fix(skills): distinguish missing skill files

* review: bound the file listing, drop the scolding

Naming a skill's actual files is the right fix — it tells the model the path
it should have asked for instead of leaving it to guess. Two corrections.

`list_skill_files` walks `rglob("*")` with no ceiling, so a skill carrying a
references tree answered a wrong path by reciting its whole inventory into
the turn. Capped at 40, and it says how many it withheld.

"Do NOT try other skill names." was a rule aimed at the model in the middle
of a result. The message already resolves the skill and lists its files, so
the structure says the name was fine and only the path was wrong; the
instruction was restating that in a louder voice.

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:22 +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
6f72468d86 fix(ask-user): drop an option whose visible text duplicates another (#1409) (#1418)
Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-09-14 01:28:41 +08:00
XZH
f4dbeea205 fix(mastery): drop duplicate ask_user options 2026-09-11 07:15:59 -07:00
XZH
785f13cca7 feat(knowledge): add Zotero BibTeX search
Refs #1303.
2026-09-10 09:49:20 -07:00
AoHanBei
eb49228d8f fix(chat): recover hallucinated PDF tool calls for attached sources (#1333)
* fix(chat): recover PDF source tool calls

* fix(runtime): preserve tool alias defaults
2026-09-10 23:44:31 +08:00