Commit Graph

62 Commits

Author SHA1 Message Date
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
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
ZQR1101
ed6b5da1b9 feat(partners): record wrong questions into the question bank (#1244) 2026-09-10 01:48:52 +08:00
Bingxi Zhao (Frank)
04040a2c06 release: v1.6.5
Ship a content workspace you choose, one exec tool for every language,
Mastery Path modes that gate its tools, and Settings that grades
readiness instead of listing faults.

Release notes: assets/releases/ver1-6-5.md
2026-09-06 13:46:29 +08:00
Bingxi Zhao (Frank)
cd286801b6 Merge pull request #1074 from evan188199-tech/codex/feat/weknora-server
# Conflicts:
#	web/components/knowledge/CreateKbModal.tsx
#	web/components/knowledge/EngineDetail.tsx
#	web/components/knowledge/KnowledgeHome.tsx
2026-08-31 19:40:31 +08:00
Bingxi Zhao (Frank)
8cfec4e685 Merge pull request #1033 from contributor
# Conflicts:
#	deeptutor/tools/prompting/hints/en/exec.yaml
#	deeptutor/tools/prompting/hints/zh/exec.yaml
2026-08-31 18:36:05 +08:00
Bingxi Zhao (Frank)
da9492fbaf feat(parsing): integrate MinerU multi-format inputs (#1087) 2026-08-30 16:36:43 +08:00
XZH
7615e36bb8 fix(code-execution): preserve deliverable scope and retry discipline 2026-08-30 15:42:32 +08:00
Bingxi Zhao (Frank)
fc0be68d6f wip: course / partner groups in progress 2026-08-29 22:29:53 +08:00
Bingxi Zhao (Frank)
d790419548 Merge remote-tracking branch 'origin/dev' into dev 2026-08-29 19:14:40 +08:00
Bingxi Zhao
f3d43d969b Merge pull request #1025 from evan188199-tech/codex/fix/code-execution-file-artifacts 2026-08-29 11:50:04 +08:00
XZH
8460fb7ec5 feat(knowledge): add WeKnora retrieval connections (#918) 2026-08-28 16:47:43 -07:00
Bingxi Zhao (Frank)
97a4d0eeef feat(reading): add immersive reading workspace 2026-08-28 14:58:48 +08:00
ZQR1101
81e5ff8e3d fix(tools): decode unicode escapes in ask_user payloads
Models sometimes emit literal \\uXXXX runs in ask_user and mastery_quiz tool args. Decode dense non-ASCII runs when building learner-facing payloads so cards do not leak escapes (#973).
2026-08-28 13:21:08 +08:00
zhou2030109-glitch
b342b63b7a fix: align Windows exec runtime and search readiness 2026-08-27 17:17:03 +08:00
XZH
8b24f1ae67 fix(tools): route file generation through code execution 2026-08-26 19:19:54 -07:00
Wong
1625cdd105 fix(embedding): survive provider rate limits — key rotation, retry budget, global throttle (#962)
* T028(Codex交付,ZC核验代提交): KeyPool多key轮换层(provider×model×key池·429冷却·单key兼容) · api_key/api_token字段兼容数组 · 三处接入(embedding/mineru/llm) · 图片描述gather+Semaphore并发化 · 303单测全过(含官方既有测试回归)

* FIX-EMB-429: 火山embedding 429根治(上游PR候选) · ①429重试按Retry-After等30s(滑窗等过) ②resolver从profile读batch_size/batch_delay(火山RPM极低必须限速) · 实测batch5/delay2s下语文reindex突破processing · 三key池x2冷却机制已验

* HARDEN-429: embedding限流重试1→8次+全冷却等待65s再取 · 单key池滑动窗口瞬时429不再报废数小时reindex整跑(08-22三烧教训) · 月度额度429仍8轮后raise不空转

* FIX-UNBOUND: 限流重试槽位for耗尽静默穿落到data引用 · 槽位1+max(MAX_RETRIES,10)兜住8轮限流 · t035镜像UnboundLocalError根因(逻辑走查复现)

* THROTTLE-GLOBAL: embedding跨实例全局节流锁 · 类级锁串行化'间隔+发帖'(多文档并行reindex各自client叠加超RPM=08-22历史库六烧终根因) · batch_delay升级为全局最小间隔 · 手动单发200而进程内全429的分歧由此闭合

* FIX-LOCK: 节流锁asyncio→threading · LlamaIndex _run_in_new_loop每线程新event loop,asyncio.Lock绑创建loop跨loop不互斥(根因三层剥洋葱终层) · 静态方法装饰修正 · 容器内3线程串行化实测2.01s通过

* PR-PREP: 中性化 fork 痕迹注释(中文→英文 provider 通用表述) · 上游v1.5.16已有_as_api_key数组支持,删我方重复实现保留上游版 · 测试148+86全过 · 密钥扫描分支历史+工作树双清(A类指纹0命中,B类28处=上游自带fixture)

* LINT: ruff format 6文件对齐CI(上游基线0债,全是我方引入) + import顺序修正

* FIX-CI: 图片处理块整体采纳上游v1.5.16版(_describe_image新签名+批量embed_contents) · 删越域的fork逐图并发测试(记档将来独立PR) · 592测全过

* FIX-CI: _build_openai_client合并壳与实现(上游sanitize保留+key池数组兼容) · placeholder_key改用primary_key(list哈希修复) · 889测全过

* fix(keypool): never refuse the only key

`KeyPool` is built even for a single-key config, and `next()` raised
`RuntimeError("All API keys are cooling down")` once every key was cooling.
For the common one-key setup that meant two 429s took every LLM and embedding
call down for the full 60s window — and it bypassed the rotation layer's own
429 handling entirely, since the RuntimeError surfaces before
`_KeyRotatingCompletions.create` can mark the strike and re-raise the real
provider error. `sdk_max_retries=0` had already handed retry duty to that
layer.

Cooling is a preference hint, not a circuit breaker: when everything is
cooling, return the key that recovers soonest and let the provider's own 429
surface to be retried.

The existing single-key test asserted the raise while calling itself
"keeps single key compatible" — it now pins the behaviour the name promises,
plus the soonest-recovery ordering for the multi-key case.

---------

Co-authored-by: interia <interia@interiadeMac-mini.local>
Co-authored-by: Frank <bingxizhao@novix.science>
2026-08-24 16:54:14 +08:00
落雨✦
6f0c7fdb47 fix: Windows MinerU parsing — subprocess UTF-8 decoding & render-thread crash (#844)
* fix: Windows robustness — MinerU UTF-8 decode, render-thread crash & atomic-write PermissionError

- mineru/local.py: pass encoding="utf-8", errors="replace" to subprocess.Popen so MinerU's combined stdout/stderr is decoded as UTF-8 instead of the platform default (GBK on zh-CN Windows), which previously crashed with a UnicodeDecodeError (0x8b).
- mineru/models.py: set MINERU_PDF_RENDER_THREADS=1 in model_env_overrides to avoid MinerU's multi-threaded PDF rendering heap-corruption crash (0xc0000409) on Windows.
- services/file_io.py: retry atomic replace on transient PermissionError (e.g. target locked by antivirus/indexer) with exponential backoff, instead of failing the whole write on Windows.

* fix(mineru): gate the render-thread guard to Windows

`MINERU_PDF_RENDER_THREADS=1` was set unconditionally, but the variable is
honored on Linux and macOS too (upstream default 3-4 render workers), so a
Windows-only heap-corruption workaround was serializing page rendering for
every platform. It also sat in `model_env_overrides`, whose contract is the
model-weight download source — and adding a key there broke that function's
exact-equality test.

Move it to its own `render_env_overrides()` next to the other MinerU env
knowledge, guarded on `sys.platform`, and merge it into the subprocess env at
the local-CLI branch in `backend.py`. Only that branch renders pages in this
process tree; cloud mode never does.

---------

Co-authored-by: Frank <bingxizhao@novix.science>
2026-08-24 16:54:05 +08:00
Bingxi Zhao (Frank)
2503c2ccc4 feat(tools): add a question_bank tool so the tutor can file questions
Asking the tutor to group wrong answers had no writable handle on the
bank, so it reached for write_note and the request silently became a
notebook record — the zh write_note hint even listed 错题分析 as a
reason to append. The new tool is name-addressed: organize takes a
category name and creates it when missing, so filing is one call after
one listing. Auto-mounted only when the bank has entries, and both
write_note hints now point categorisation at it.
2026-08-20 01:29:55 +08:00
Bukely_
07abbd7326 feat(pageindex): add OSS knowledge bases and reasoning-based retrieval (#907)
Adds PageIndex OSS as a knowledge-base type and moves PageIndex retrieval from traditional RAG to reasoning-based retrieval: a small workflow-owned agent loop reads the document tree instead of going through the built-in MCP server, which this removes.
2026-08-20 00:35:15 +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)
e1c669f02a feat(knowledge): add Tencent IMA as a connected knowledge engine
IMA (ima.qq.com) is where a lot of users already keep their library, and
its OpenAPI exposes retrieval over it. Adding it as a sixth engine follows
the `lightrag-server` shape exactly: a KB bound to `ima` is a connection
pointer, not an index. Nothing is copied and nothing is stored locally —
documents are added in IMA, retrieval calls IMA, and DeepTutor's chat loop
still writes the answer.

The wire is plain HTTP POST to `/openapi/wiki/v1/<method>` with two auth
headers and a `{code,msg,data}` envelope; `search_knowledge` returns
cursor-paginated items carrying a `highlight_content` snippet. Only the two
read-only calls we need are wrapped, and pagination is bounded so a server
that never reports the end cannot spin.

Credentials (`client_id` + `api_key`) and the library id live per-KB in
`kb_config.json` rather than as one global account key. IMA credentials
identify a person, so per-KB means each user on a shared deployment
retrieves through their own account, and connecting stays self-contained
with no separate settings surface to fill in first. Both metadata paths
already work off an allowlist, so the credentials cannot leak into
surfaced metadata; only the library id is exposed, for the UI to show.

`connect-ima` re-probes server-side and never trusts the client's verdict,
matching the LightRAG-server route. IMA KBs are registered as a connected
type — no folder under `base_dir`, no embedding reconcile, deletion drops
only our pointer — and are reported as non-enumerable in the manifest,
since claiming "0 documents" for a library held behind an API would be a
lie.

Backend only; the connect flow in the knowledge center UI is not wired up
yet.
2026-07-29 00:38:10 +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)
eef785ae1e integrate lightrag-server & other fixes. 2026-06-24 15:54:12 +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)
6c024857b7 release: v1.4.1 — security & stability patch
Security: lock down the TutorBot tool sandbox (shell exec is opt-in, all
filesystem/shell access confined to the bot workspace) and isolate per-user
resources, closing #518, #517, #516, #515, #514 and #506 (first hardened in
#507).

Bug fixes: chat input disabled after the first turn (#520), KB embedding
failure on long documents (#521 / #509), profile creation under Docker
(#512 / #513), Qwen reasoning models failing native tool calling (#527 / #528),
the GPT-5 init-wizard token parameter (#508), and oversized session-event
truncation (#524).

Features: HTTP/SSE API for multi-turn chat with a specific TutorBot (#511),
multimodal image fallback for vision-capable providers without a capability
entry, safe ZIP knowledge upload, and a /settings/network page with model
fetching (community PRs #522 and #523 reimplemented locally).

Also bumps __version__ to 1.4.1, adds the v1.4.1 release notes, updates the
README Releases section, and ships the Astro + Starlight docs site under site/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 23:16:00 +08:00
Kagura
c90fae5609 fix(security): harden ExecTool defaults against command injection (#506) (#507)
* fix(security): harden ExecTool defaults against command injection (#506)

- Default restrict_to_workspace to True (was False), confining commands
  to the working directory unless explicitly opted out
- Add deny patterns for network exfiltration (curl, wget, nc, ssh, scp,
  rsync, ftp, socat)
- Add deny patterns for script interpreter exfiltration (python -c,
  perl -e, ruby -e)
- Add deny patterns for sensitive file access (/etc/passwd, /etc/shadow,
  /etc/sudoers) and privilege escalation (useradd, usermod, crontab,
  chmod world-writable)
- Add comprehensive test suite (32 tests) covering deny patterns,
  workspace restriction, and command execution

* fix(tests): use pytest.mark.asyncio for Python 3.14 compatibility

asyncio.get_event_loop() raises RuntimeError in Python 3.14 when
no event loop is running. Switch to pytest-asyncio's async test
decorator which is already a project dependency.
2026-05-27 20:21:48 +08:00