51 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
30a7e43001 fix(memory): capture chat questions and rebuild missing L2 documents
Local dev repairs for #2294.

Memory, regeneration and decoding suite: 398 passed; regeneration does not duplicate trace events.
2026-11-15 00:50:30 +08:00
Steven Huang
391f3fa36b fix: reject line-breaking memory operations before mutation 2026-11-12 17:08:38 +08:00
Bingxi Zhao (Frank)
3ed050c4dd Merge #2362 from sriv144 2026-11-06 02:27:50 +08:00
Bingxi Zhao (Frank)
ebcebd4723 Unify migration locks and plugin environments, and cover compatibility boundaries 2026-11-06 02:04:52 +08:00
Bingxi Zhao (Frank)
5fcba322b8 Merge #2360 from sriv144 2026-11-06 01:56:40 +08:00
Bingxi Zhao (Frank)
198d8f50fb Merge #2371 from sriv144 2026-11-06 01:56:24 +08:00
sriv144
4a910a3172 fix(memory): expose source refs to deduplication 2026-11-02 17:29:57 +05:30
sriv144
5a4fc3e0f8 Add opt-in dense and reranked raw-history evaluation 2026-11-02 15:00:55 +05:30
sriv144
db0b84b4a1 fix: isolate non-text partner snapshot records 2026-11-02 14:39:04 +05:30
Rudy Celekli
6498bc7fbc fix(memory): keep footnote-like tokens in entry text on round-trip
parse() swallowed a `[^token]` that was part of an entry's text. The
new-bullet regex matched trailing markers as `[^...]` (any non-`]`
run), so prose ending in a footnote-like token (e.g. "footnote syntax
is [^note]") was absorbed into the markers group and dropped, breaking
the documented `parse(serialize(d)) == d` contract. Because the token
label failed to resolve, the text was silently truncated and, once the
entry also carried a real ref, its markers were mangled too.

serialize() emits integer labels exclusively, so narrow the inline-marker
pattern to `[^<digits>]`. Non-integer footnote-like tokens now stay in
the text where they belong; real numeric citation markers still parse
(including the legacy compact `[^1][^2]` form).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-01 09:13:39 -05:00
Bingxi Zhao (Frank)
49e4225b55 Merge commit '3b750ec003b8c8e3da011ae18aede591b9d84457' into codex/validate-reviewed-integration 2026-10-31 18:53:30 +08:00
sriv144
ad160faeb2 fix: honor soft archive flags in partner memory snapshots 2026-10-29 12:11:31 +05:30
Bryan Nathan
8ee9d1be36 fix: recognize unspaced CJK memory sentence boundaries
Preserve the ASCII whitespace requirement while allowing CJK sentence terminators to end memory chunks without intervening spaces. Add regressions for punctuation, supported closing quotes, default chunk sizes and decimal compatibility.

Fixes #2130
2026-10-29 06:57:52 +08:00
Bingxi Zhao (Frank)
308d99b167 style(memory): apply repository line length to rebased contribution 2026-10-29 01:38:15 +08:00
Bingxi Zhao (Frank)
15aa6a75ae Merge current rebased head of PR #2112 2026-10-29 01:38:01 +08:00
Eapp1e
e1c05b8527 fix(memory): size chunk windows by the stride that overlap leaves
Formatting pass with ruff 0.16.0 so the lint job stops asking for a reformat;
no behaviour change: tests/services/memory/test_chunker.py still passes 15/15.

Signed-off-by: Eapp1e <163811520+Eapp1e@users.noreply.github.com>
2026-10-28 17:06:31 +00:00
Bingxi Zhao (Frank)
0da5dc4bbe fix(llm): correlate interleaved tool calls through one accumulator 2026-10-29 00:59:07 +08:00
Bingxi Zhao (Frank)
29c52cc15c Merge pull request #2112 for memory chunk budgeting 2026-10-29 00:58:01 +08:00
sriv144
2f04d33a38 Retain reported usage when reader answer validation fails 2026-10-28 15:20:56 +05:30
sriv144
381e89580c Add isolated native memory snapshot evaluation 2026-10-28 15:17:39 +05:30
Eapp1e
45d4cdd0ed fix(memory): size chunk windows by the stride overlap leaves
chunk_with_boundary() documented a hard upper bound of `budget` chunks but
sized the window off len(text) / budget while every cut advances the cursor
by target - overlap. The overlap is spent at each cut, so the default 10%
overlap profile needed 21 chunks for a budget of 20 and one extra LLM call
per consolidation. Derive the window from the distance the budget chunk
really covers and assert the bound in a new regression test.

Signed-off-by: Eapp1e <163811520+Eapp1e@users.noreply.github.com>
2026-10-28 08:21:34 +00:00
Bingxi Zhao
5a3e644b94 Merge pull request #1840 from dajiaohuang/fix/memory-audit-line-identity
fix(memory): anchor audit edits to the original document view
2026-10-19 00:23:48 +08:00
dajiaohuang
149343c414 fix(storage): close SQLite connections after helper operations 2026-10-15 12:08:30 +08:00
dajiaohuang
fd992c9b22 Merge commit '6cf793bd868ba5ecbe64722936d4be8fab5a01df' into fix/memory-audit-line-identity 2026-10-08 12:35:37 +08:00
dajiaohuang
e20001beb4 fix(memory): preserve initial line identities during audit edits 2026-10-08 12:35:37 +08:00
Bingxi Zhao (Frank)
6cf793bd86 release: v1.6.14
Ship original-source visual practice, recoverable indexing, unified video
Reading, scientific research tools, managed plugins, and a learning journal
as summarized in assets/releases/ver1-6-14.md.

Improve provider setup and protocol-aware endpoints. Restore missing
localized setup and Ukrainian UI text, keep plugin loading in the plugin
layer, harden research XML parsing, and repair isolated test fixtures and
type-checking errors found by the release gate.

Sync README prose and all eleven translations, bump the package version,
and update the stable release announcement.

Validation: 10180 Python tests and 8 subtests passed (28 skipped); 1303
Node tests passed on Node 22; 24 provider UI tests passed. All pre-commit
hooks, ruff, translation checks, documentation checks, and docs build passed.
2026-10-08 11:34:42 +08:00
Bingxi Zhao (Frank)
6ca208b2f0 fix(memory): preserve account scope and reject redirected workspace stores 2026-10-07 20:39:30 +08:00
evan188199-tech
0802510450 fix: log silently swallowed failures in five services (#1707)
* fix(codex): log a warning when token revocation fails during logout

Logout previously swallowed revocation failures silently, leaving the
remote token possibly valid with no operator trace. Log only the error
kind and HTTP status (never credential material) and keep clearing the
local credentials as before.

* fix(llm): warn when CodeBuddy tool-call interrupt or drain fails

A silent except-pass after receiving tool_calls let the SDK keep
generating in the background when interrupt() failed, quietly draining
quota. Log a warning (exception type + short reason) for interrupt and
drain failures; return value semantics unchanged.

* fix(memory): log corrupt snapshot files instead of skipping silently

read_notebook_entities / read_cowriter_entities / read_book_entities
swallowed (OSError, json.JSONDecodeError) with a bare continue, so a
corrupt notebook file or manifest silently dropped content from the
memory snapshot. Each skip now logs a warning with the file path and
reason (no file content); snapshot results are otherwise unchanged.

* fix(notebook): log unreadable files instead of skipping them silently during index rebuild

* fix(question): log failed error-event delivery in mimic websocket

The mimic generation error handler swallowed secondary failures of the
error send_json with a bare 'except Exception: pass', so a delivery
failure left the frontend without any reason and nothing in the logs.
Split the handler: closed/disconnecting clients (RuntimeError,
WebSocketDisconnect) stay debug-level, any other send failure is logged
as a warning with traceback. Cleanup paths keep their best-effort
narrow handling. Focused tests cover both branches.

* test(codebuddy): make credential fixture expiry relative to now

test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.

Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-10-07 20:37:27 +08:00
ZQR1101
5b2b99fab9 fix(memory): aggregate account-level L1 across workspaces (#1799) (#1800)
Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-10-07 20:36:53 +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
Bingxi Zhao (Frank)
6e6e56aedb release: v1.6.3
Ship the breaking front- and back-end runtime and route refactor,
learner and guardian flows, grounded reading, knowledge and parser
updates, and recoverable long-running streams.

Release notes: assets/releases/ver1-6-3.md
2026-09-02 04:09:11 +08:00
Bingxi Zhao (Frank)
913cba58ab style: apply ruff format to the recall tests
Mechanical line-wrapping left over from running ruff format across the tree;
belongs with the commit that added the file.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
da6dfa002b feat(memory): add recall — what the learner touched lately, across surfaces
L1 keeps two kinds of record and answering "what happened lately" needs both.
The snapshot knows what exists (sessions, notebook records, quiz attempts,
documents, books) with a label and a timestamp; the trace knows what was done,
of which knowledge-base queries are the one kind holding a question the
learner typed themselves.

``recent`` merges the seven surfaces newest-first; ``recent_queries`` reads
the trace. Both run on stamps — no message body, no document text, no answer
is read — which is what makes them callable outside consolidation.

Two shaping rules earn their place. Undated items are dropped rather than
assumed recent: knowledge bases stamp their *earliest* index time, so one in
daily use would otherwise be filtered out as ancient while claiming to be
inside the window — the trace answers for KBs instead. And a label repeated on
one surface collapses to its newest occurrence, so a session reopened all
afternoon counts once rather than crowding out everything else.
2026-08-17 09:57:55 +08:00
Bingxi Zhao (Frank)
f5b905f535 perf(memory): read snapshot stamps without loading entity content
The chat adapter inlines every message body of every session into each
Entity's ``content``. That is what L2 consolidation needs, and it is the
wrong price for a caller that only wants to know what the sessions are
called — or for the diff, which reads nothing but fingerprints and labels.

Adds ``EntityStamp`` (identity + label + fingerprint + timestamp) and a
per-surface probe that produces stamps directly. ``read_stamps`` uses a
surface's probe when it has one and projects the full read otherwise, so a
surface without a probe is slower rather than unsupported, and a probe that
raises degrades to the full read rather than reporting the surface empty —
which the diff would take for a mass deletion.

Only ``chat`` gets a probe: every other adapter reads a bounded amount, and
each probe is a standing obligation to match its full reader expression by
expression. The chat probe's fingerprint deliberately picks the last message
under ``created_at ASC, id ASC`` via a window function rather than MAX(id);
the two diverge on backfilled rows, and a probe-driven refresh would then
disagree with a content-driven one about what changed.
2026-08-17 09:57:55 +08:00
Bingxi Zhao
4f06aaa070 fix: isolate Partner data per user (#621)
Keep Partner configuration and assets shared while isolating authenticated users’ sessions, relationship memory, search, and media paths. Preserve legacy admin/IM behavior and enforce assignment checks at every access boundary.
2026-08-16 23:00:41 +08:00
Bingxi Zhao (Frank)
3a19752a44 release: v1.5.3
Maintenance release on top of v1.5.2.

- Themeable code blocks: Settings → Appearance gains a Code blocks panel
  (syntax theme, line numbers, wrapping) applied across chat, Book, and
  Co-Writer.
- My Agents connects four more coding CLIs — Gemini, Kimi, opencode, and
  MiMo Code — alongside Claude Code and Codex.
- Atlas Cloud joins as an LLM provider (34 bindings total); DashScope text
  embeddings route correctly and encoding_format is omitted for strict
  OpenAI-compatible gateways.
- Reliability sweep: RAG coexists with an exclusive knowledge capability
  (#650), DeepSeek DSML tool-call parsing (#666), autoscroll release (#649),
  idempotent write_memory (#647), seeded persona presets (#659), plus Book
  WebSocket streaming, partner filename/split fixes, Visualize fences, and
  CLI UTF-8 input hardening.
- Packaging: cap requires-python to >=3.11,<3.14 so pip refuses 3.14 with a
  readable message instead of a failed source build (#664).

Release notes: assets/releases/ver1-5-3.md
2026-07-24 03:06:58 +08:00
Bingxi Zhao (Frank)
630041a1cd fix(memory): make write_memory preference add idempotent (#647)
preferences.md is never auto-consolidated, so a repeated identical
write_memory add persisted forever as a duplicate — common in long,
tool-driven mastery turns. write_preference now short-circuits a
duplicate add to a no-op that reports the existing entry, and the tool
returns an explicit 'already saved' signal to the model.
2026-07-24 00:42:28 +08:00
Bingxi Zhao
b0ec5daba5 Merge pull request #646 from santhreal/fix/update-facts-raw-decode-dev
fix(memory): parse update facts JSON with raw_decode
2026-07-23 22:26:55 +08:00
santhreal
eee0431fff fix(memory): parse update facts JSON with raw_decode
Trailing prose with braces made the greedy rfind slice invalid, so
_parse_facts silently dropped valid facts. Decode the first object.
2026-07-18 17:26:33 -07:00
santhreal
69582220ef fix(memory): parse line-edit JSON with raw_decode
Trailing prose containing braces made the greedy rfind slice invalid,
so parse_edits_payload silently dropped valid edits. Decode the first
JSON value like math_animator.
2026-07-18 17:23:57 -07:00
Bingxi Zhao (Frank)
7ac3a3ba79 release: v1.4.6
A broad consolidation release across four product surfaces.

- Learning Space: Space becomes a learning dashboard; My Agents imports
  local Claude Code / Codex chat history into resumable agents (with an
  objective explore_context briefing so the tutor never role-plays the
  user); Memory is promoted to a top-level /memory route; Partner
  conversations flow into Memory; EduHub skills install inline.
- Knowledge Center: /knowledge rebuilt as a console with per-engine
  detail pages; GraphRAG / PageIndex / LightRAG engines join LlamaIndex;
  linked-KB read-only mounts; Obsidian live-vault capability.
- Settings: pluggable document parsing (MinerU / Docling / MarkItDown)
  with a content-addressed cache and MinerU cloud/local backends; voice
  TTS/STT; image & video generation; rebuilt settings navigation.
- Platform: per-user capability gating by assigned model; Solve rebuilt
  on the chat loop with a per-step gate and mid-run failure fallback;
  username login + inline errors; CLI skill publish/update; picker
  polish; math-before-citation render fix.

Docs were split out to a standalone site, so site/ is now landing-page
only. Bumps __version__ to 1.4.6 and adds assets/releases/ver1-4-6.md.

Folds in mypy fixes surfaced by pre-commit (mineru/local Path typing,
knowledge/manager no-redef, explore_context token kwargs, CLI
set_dist_tag capability probe) plus prettier reformatting of
previously-committed web files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 10:50:44 +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)
6153d8c092 release: v1.4.0 — release notes, version bump, repo hygiene
- Add assets/releases/ver1-4-0.md covering deltas since v1.4.0-beta
  (reasoning_effort normalization, tool-schema fallback, restart-safe
  turn runtime, frontend placeholder hardening, CLI chat REPL config).
- Bump deeptutor/__version__ to 1.4.0.
- Update README Releases section: v1.4.0 at top, install opt-in note
  updated for stable.
- Fix pre-existing pre-commit failures so the v1.4.0 cut runs clean:
  bandit B324 (mark _sha1 as non-security), mypy no-redef in
  document.py / line_doc.py, mypy arg-type/assignment in
  snapshot/adapters.py, mypy assignment + arg-type in
  services/memory/settings.py, mypy func-returns-value on
  set.add idiom in deeptutor_cli/init_wizard.py.
- Apply ruff format / prettier sweep across the repo.
- Remove stale workspace + i18n env example + playwright captures
  already cleaned locally; ignore .playwright-cli/ going forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 21:09:22 +08:00
Bingxi Zhao (Frank)
206b775ad4 fix: unblock v1.4.0-beta release — Docker build + CI test alignment
web/lib/api.ts: defer NEXT_PUBLIC_API_BASE placeholder check from
module-load to first call. Docker bakes the literal placeholder for
runtime sed substitution, but Next.js evaluates this module during
static export of every prerendered page — the old throw failed the
admin/users page export and aborted the entire build.

Test alignment with shipped code (no behavior change):
- test_path_service: override _workspace_root alongside _project_root,
  since get_memory_dir() reads workspace_root, not _user_data_dir.
- test_meta_settings: assertions now match shipped defaults
  (l2_budget=20, min_chunk_chars=1000, max_chunk_chars=64000).
- test_unified_ws_turn_runtime + test_regenerate: drop emit_calls
  assertions; turn_runtime doesn't emit a memory trace after chat
  turns (feature was never wired up).
- test_turn_runtime_subscribe: 200 polls × 10ms instead of 20 × 0,
  Python 3.14's asyncio scheduler doesn't give sleep(0) enough ticks
  for the subscriber-append race.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 00:21:41 +08:00
Bingxi Zhao (Frank)
2b7242081f feat(memory): three-layer memory subsystem (L1/L2/L3) with workbench
Replaces the flat single-blob memory page with a structured store:
- L1 captures raw run traces; L2 holds normalized document records;
  L3 holds curated slots per surface (chat, notebook, book, TutorBot).
- New consolidator pipeline (chunker, guards, parse, references, runs,
  modes, line-doc, meta) turns traces into versioned line-oriented
  documents with stable ids and snapshot history.
- Per-user isolation flows through PathService; the store API is
  stateless.

UI ships a dedicated /memory workbench with graph / L1 / L2 / L3 /
resolve subpages, plus a reusable MemorySection embedded where the
legacy panel lived.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:02:32 +08:00
Bingxi Zhao (Frank)
255738d991 prepare v1.3.3 release
Document v1.3.3 and include the latest Space context, memory, RAG, provider, and session stability updates for release.

Made-with: Cursor
2026-04-30 23:41:58 +08:00
Bingxi Zhao (Frank)
a069b6ebf0 chore: prepare v1.3.2 release
Embedding endpoint URLs are now transparent end-to-end: Settings shows the
exact URL DeepTutor will POST to, legacy `/v1`-style bases are migrated to
full `/embeddings` / `/api/embed` URLs, the embedding client rejects
known-provider misconfigurations early, and OpenRouter routes through the
same exact-URL HTTP adapter as other providers.

LlamaIndex RAG now refreshes embedding state before initialize/search/add,
validates persisted vectors before retrieval, and reports invalid indexes
with `needs_reindex: true` instead of raw NumPy/`NoneType` errors.

Memory refresh strips `<think>` / `<thinking>` blocks from reasoning-model
output before writing PROFILE.md / SUMMARY.md, and existing memory files
self-repair on read.

Also fixes a Deep Solve runtime regression where `MainSolver` still passed
a stale `attachments` keyword to `SolverAgent.process()`.

Adds release notes (assets/releases/ver1-3-2.md) and updates README.

Made-with: Cursor
2026-04-29 20:44:05 +08:00
Bingxi Zhao (Frank)
593ddba3fb feat(co-writer): add multi-doc co-writer workspace with backend storage
- Add co-writer storage module and API router for document persistence
- Restructure co-writer page to per-doc routing ([docId]) with sidebar recent list
- Wire CoWriterRecent into sidebar shell and AppShellContext
- Tidy notebook prompts, facade, path service, and builtin tools wiring
- Refresh tests (add missing __init__.py, drop obsolete app_facade test)
- Add favicon/apple-touch-icon assets and minor i18n cleanup

Made-with: Cursor
2026-04-20 19:46:41 +08:00
Bingxi Zhao (Frank)
3ec4bc9bf0 fix(tests): align memory tests with two-file memory architecture
Memory service was refactored from single-file (content/exists/updated_at)
to two-file (summary/profile) architecture, but tests were not updated.

Made-with: Cursor
2026-04-07 23:44:35 +08:00