77 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
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
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
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
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
Bingxi Zhao (Frank)
d731546cf6 Merge #2379 from remote-controlled-man 2026-11-06 01:56:25 +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
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)
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
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)
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
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)
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
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
Bingxi Zhao (Frank)
0bb753868e fix(rag): keep visual tool replies valid and pin asset scope 2026-09-27 11:03:10 +08:00
Bingxi Zhao (Frank)
a4900a813d fix(rag): keep source captions out of visual model instructions 2026-09-27 10:57:27 +08:00
Bingxi Zhao (Frank)
5e7be659a2 Preserve retrieved source visuals for vision answers 2026-09-27 10:57:00 +08:00
Bingxi Zhao (Frank)
55490af65e Merge issue fixes into PR synthesis
Combine knowledge bootstrap coverage and preserve later progress-isolation tests, native notebook tooltip, and locale-aware tool-hint fallback. Regenerate frontend contracts and align test fixtures with merged APIs.
2026-09-23 12:06:19 +08:00
Bingxi Zhao (Frank)
69058b48bb fix(rag): avoid false IMA citations on empty and failed search (#1500) 2026-09-23 11:00:37 +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
5c1495b3f6 Merge pull request #1513 from evan188199-tech/codex/fix/rag-empty-result
fix(rag): report empty retrieval results (#1500)
2026-09-23 10:24:47 +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
Bingxi Zhao (Frank)
715e5de592 Merge remote-tracking branch 'origin/dev' into codex/question-pr-1341 2026-09-19 16:11:05 +08:00
XZH
7dde859eaf fix(rag): report empty retrieval results (#1500) 2026-09-18 16:35:55 -07: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
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
Albertanda
08963e29ab fix(geogebra): repair image analysis that crashed before any model call (#1362)
* fix(geogebra): repair image analysis that crashed before any model call

Every invocation of the ``geogebra_analysis`` tool died with a TypeError
before reaching a model: ``_call_vision_llm`` passed a ``verbose=False``
kwarg that ``BaseAgent.stream_llm`` does not accept (the signature has no
``verbose`` parameter and no ``**kwargs`` fallback). Image understanding —
the only path that turns a problem figure into GeoGebra commands — was
therefore broken end to end, in both chat and deep_solve.

Two repairs in the vision solver agent:

* drop the nonexistent ``verbose=`` kwarg so the call reaches the model;
* make ``_extract_json`` tolerate what reasoning vision models actually
  return: a ``<think>`` preamble (e.g. Qwen3-VL-*-Thinking), prose after
  the JSON object, multiple fenced blocks (the last one wins), and bare
  tail JSON. The comment and trailing-comma tolerance of the original
  parser is preserved.

Regression coverage: parametrized ``_extract_json`` cases for the shapes
above, plus a test asserting ``_call_vision_llm`` forwards no ``verbose``
kwarg while still building the multimodal ``image_url`` message.

* fix(geogebra): bound a stalled vision analysis with a 240s timeout

An unbounded ``await agent.process(...)`` lets a stalled provider hang the
whole turn. Reasoning VL models legitimately take minutes on hard figures,
so the bound is generous (240s): it only converts a silent hang into a
loud, actionable failure ("retry, or describe the figure in text") instead
of leaving the learner staring at an empty response.
2026-09-10 23:44:08 +08:00
evan188199-tech
2cefc62a71 fix(skills): distinguish missing file from missing skill in read_skill (#1349)
Co-authored-by: XZH <cto@xzh.ai>
2026-09-10 23:42:09 +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)
93df3d48b7 release: v1.6.4
Ship lighter isolated runtimes, richer Books and Mastery flows,
Reading/session polish, and explicit model API capabilities.

Release notes: assets/releases/ver1-6-4.md
2026-09-03 01:38:54 +08:00