Commit Graph

914 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
069ba53a00 docs:update readme 2026-06-14 00:53:57 +08:00
Bingxi Zhao (Frank)
e7e38063b8 docs:update readme 2026-06-13 22:46:10 +08:00
Bingxi Zhao (Frank)
4ce3434c11 docs:update readme 2026-06-13 22:38:22 +08:00
Bingxi Zhao (Frank)
ab4134fc8f docs:update readme 2026-06-13 22:04:33 +08:00
Bingxi Zhao (Frank)
b4c02931ab docs:update readme 2026-06-13 21:57:54 +08:00
Bingxi Zhao (Frank)
ed05ab4e2b docs:update readme 2026-06-13 21:48:26 +08:00
Bingxi Zhao (Frank)
d72b4f0d02 docs:update readme 2026-06-13 21:10:57 +08:00
Bingxi Zhao (Frank)
74789190e3 docs:update readme 2026-06-13 20:53:46 +08:00
Bingxi Zhao (Frank)
2cdbab4b63 docs:update readme 2026-06-13 20:44:49 +08:00
Bingxi Zhao (Frank)
04cc156fa8 daily update 2026-06-13 19:51:44 +08:00
Bingxi Zhao (Frank)
171b1cc2d2 release: v1.4.4 — ClawHub skill hub, real KB document previews
A focused cut on top of v1.4.3:

- Skill hub: install community skills from ClawHub (and any compatible
  registry via settings/skill_hubs.json) — provider abstraction in
  services/skill/hub.py, new `deeptutor skill search/install/list/remove`
  CLI, admin-only install endpoint for multi-user (install ≠ assign).
  Every import runs a security gate: hub verdict check, zip-slip/zip-bomb
  guards, text/script suffix whitelist, `always:` frontmatter stripped,
  provenance recorded in .hub-lock.json.
- KB previews: new /knowledge/{kb}/file-preview-text/{filename} endpoint
  serving extracted plain text; KB Files tab renders real in-browser
  DOCX/XLSX previews; DOCX previewer scales pages to fit narrow panels.
- Markdown previews allow safe raster data:image URLs on <img src>
  (react-markdown strips all data: URLs by default); script-capable
  schemes stay blocked.
- All ten localized READMEs re-synced with the English README.
- Docs (deeptutor.info): `deeptutor skill` reference, hub-install notes on
  Space and multi-user pages, KB file routes in the server API table
  (en + zh).
- CLI docs contract test updated for partner/skill subcommands.

Release notes: assets/releases/ver1-4-4.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
v1.4.4
2026-06-13 03:58:28 +08:00
Bingxi Zhao (Frank)
452de66729 release: v1.4.3 — TutorBot→Partners, single-loop Chat, real multi-user isolation
The biggest cut since v1.4.0:

- Partners: TutorBot renamed and rebuilt on the product chat agent loop —
  production IM pipeline (retry/dedup/coalescing, per-channel delivery),
  live streaming on Telegram/Discord/Feishu, new WeCom AI Bot channel
  (15 connectors), web-chat attachments, soul template library + editor.
  Automatic non-destructive migration from data/tutorbot/; HTTP API moved
  to /api/v1/partners.
- Chat: single exploring agent loop with native tool calling; Activity
  header with collapsible thinking/tool trace.
- Multi-user: per-user grants v2 (tools/MCP/exec), data/users + data/system
  layout with automatic migration, runner mounts only the user workspace.
- Visualize: inline themed SVG, structured prompts, local validate+repair
  replacing the LLM review round.
- Co-writer Mermaid diagrams + selection RAG/web; file viewer docx/xlsx
  previews; MinerU cloud parsing backend; office skills on by default;
  CLI chat renderer rewrite.
- Docs rebuilt at deeptutor.info: per-channel setup guides (en+zh),
  refreshed screenshots.
- Pre-commit clean sweep: defusedxml for SVG validation, usedforsecurity
  flags on content hashes, mypy fixes, types-croniter stub.

Release notes: assets/releases/ver1-4-3.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
v1.4.3
2026-06-12 17:17:43 +08:00
Bingxi Zhao (Frank)
59e407731f docs(partners): document the streaming delivery switch in the channel matrix
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:52:11 +08:00
Bingxi Zhao (Frank)
062f401195 feat(partners): live streaming for telegram/discord/feishu + unavailable-channel surfacing
- telegram: send_delta via progressive edit_message_text (throttled,
  flood-control retry, HTML final render, mid-stream overflow split)
- discord: send_delta via REST POST/PATCH with rate-limit retry; send()
  now raises on failure so the manager retry applies
- feishu: send_delta via CardKit streaming cards (create → sequenced
  stream updates → close streaming_mode, regular-card fallback)
- registry: discover_all_with_errors keeps import-failed channels
  diagnosable; schema API marks them available:false with the reason;
  UI grays them out and shows the missing-dependency message instead
  of silently dropping them (the "why is X missing?" class of bugs)
- 10 new streaming contract tests; 343 partner tests green; tsc clean

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:39:49 +08:00
Bingxi Zhao (Frank)
1ac902edbf update 2026-06-11 20:27:22 +08:00
Bingxi Zhao (Frank)
6d4dd15d78 update 2026-06-11 20:15:48 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
da1061910b feat(partners): production IM infra — retry/dedup/coalescing, per-channel delivery flags, stream-delta protocol, slack/telegram connection fixes
- manager: exponential-backoff retry (send_max_retries), origin-scoped
  duplicate suppression, _stream_delta coalescing, per-channel
  send_progress/send_tool_hints gating (global AND channel override)
- base: send_delta/supports_streaming protocol, _wants_stream injection
- runner: live stream segments per loop round (turn_id:call_id), narration
  rounds freeze on completion, final reply marked _streamed when delivered
- telegram: split API/polling HTTPX pools (pool exhaustion fix), trim
  legacy nanobot command menu, raise on send failure for manager retry
- slack: Socket Mode handshake timeout + WSS diagnostics, send raises
- schema: DeliveryOverrides/StreamingSupport mixins on channel configs
- partners/network.py: strict SSRF validator for channel media downloads
- icons: correct WeCom mark (TDesign outline, official brand palette)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 17:43:08 +08:00
Bingxi Zhao (Frank)
46ea5cf33e fix(visualize): fullscreen overlay — portal to body + viewport-fit all types
Fullscreen was broken for every render type, two root causes stacked:

- The overlay used position:fixed but rendered inside the message bubble,
  whose ancestors (streaming animation transforms, chat scroll root) break
  fixed positioning — inset-0 resolved against the bubble and the composer
  stacked above the overlay. Render via createPortal(document.body).
- Content was fit to width only, so figures outgrew the viewport
  vertically, and items-center + overflow made the top edge unreachable.
  Now: m-auto centering (small content centers, oversized content scrolls
  from its start edge); svg (ours + mermaid) clamps max-height and
  letterboxes via the default preserveAspectRatio; Chart.js caps the
  wrapper WIDTH so its own 2:1 aspect scaling lands within the viewport
  (CSS-clamping the canvas would squish the bitmap). The chart wrapper's
  inline maxHeight moved to .dt-chart-wrap so fullscreen can override it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 01:41:24 +08:00
Bingxi Zhao (Frank)
e8f0e77f83 refactor(visualize): migrate Book blocks to validate+repair, drop LLM review
Finishes the visualize overhaul (517c90b backend + b499ba7 frontend).

- Book figure/interactive now share the chat path: deterministic local
  validate_visualization, one targeted repair on failure (figure), and
  GenerationFailure on residual invalidity so the book engine retries
  instead of baking a broken figure/placeholder into the book.
- Delete the now-dead open-ended LLM review: pipeline.run_review and the
  review prompts (review_agent.yaml keeps only repair_system/
  repair_user_template). ReviewAgent's process() IS the repair pass now
  (BaseAgent.process is abstract, so repair was renamed, not stubbed).
- Prompts: drop the 'split into an overview plus a detail figure' wording
  that contradicted the single-<svg> policy; add a text vertical-centering
  rule (y = box center, host centers via CSS) and a visual_genre fallback
  line. en + zh kept in sync.
- svg-theme.css: dominant-baseline: central on .dt-svg-root text — the
  host guarantees vertical centering so the model never has to emit (or
  misspell) dominant-baseline itself.
- tests: replace the stale FakeReview/run_review fake with a valid-svg
  no-repair path in test_capabilities_runtime.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 00:15:58 +08:00
Bingxi Zhao (Frank)
517c90b11d refactor(visualize): structured prompts, local validate+repair, drop answer-now
Backend half of the visualize overhaul (frontend is b499ba7).

- code_generator prompts split into system_base/rules_general/rules_{svg,chartjs,
  mermaid,html}; svg rules add coordinate math, viewBox checklist, complexity
  budget, the c-*/t-ts-th class system, single-<svg> + data-prompt.
- analysis: visual_genre (route-on-the-verb) + routing table.
- replace generic LLM review with deterministic local validation (well-formed
  XML + camelCase viewBox / strict JSON / mermaid lint / HTML); on failure, one
  targeted repair call. ReviewAgent keeps process (Book review) + repair (chat);
  pipeline keeps run_review + run_repair.
- remove the visualize answer-now fast-path + its prompts + tests.
- i18n: sync capabilities/prompts/{en,zh}/visualize.yaml status keys to what the
  code emits + add test_status_i18n_consistency.py to guard against drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 23:26:31 +08:00
Bingxi Zhao (Frank)
b499ba7aaf feat(visualize): inline + themed SVG rendering, html sendPrompt bridge
- SvgRenderer: <img> data-URI -> sanitized inline DOM. Dependency-free
  sanitizeSvg strips script/foreignObject/on*/js-urls and scopes element ids +
  url()/href/aria refs so multiple inlined svgs don't collide. Multi-<svg>
  content is split into independent figures.
- svg-theme.css: themed class system (t/ts/th, box/node/arr, c-* 9-ramp)
  following light/dark via CSS vars and the app Geist font; svg sized width:100%
  by viewBox to avoid the 300x150 inline collapse.
- HtmlRenderer: iframe height auto-fit + receives the widget's sendPrompt.
- iframe-html.ts: inject the sendPrompt bridge + a ResizeObserver height report.

Frontend visualize only — the chat page.tsx composer-prefill listener is left in
the working tree alongside the unrelated chat changes there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 22:33:16 +08:00
Bingxi Zhao (Frank)
f1aa889a80 feat(web): hide Guided Learning from product nav (keep backend + pages)
Remove the user-facing entry points so /learning no longer appears in the
product, while keeping all backend logic, the /learning pages/components, and
the capability registration intact for continued development.

- SidebarShell: drop the 'Learning' nav item (+ now-unused GraduationCap icon);
  left a comment documenting how to re-expose it.
- Book page: stop wiring onLearn -> remove the 'Start learning' button path and
  the handleLearn handler + its learning-api imports. BookLibrary keeps its
  onLearn prop + button markup so re-enabling is a one-line prop pass.

The /learning routes remain reachable by direct URL for development.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 18:12:14 +08:00
Bingxi Zhao (Frank)
e3a351a488 refactor(guided-learning): post-merge hardening of #500
Security/correctness:
- Stop leaking diagnostic answers: persist a _sanitize_diagnostic() snapshot
  (drops top-level answers + inline answer keys) into progress.diagnostic,
  which is returned verbatim by the /progress endpoints. Grading is unaffected
  (authoritative answers live in LearningStore).
- _safe_json_parse + generate_from_notebook now use the shared fence-stripping
  parse_json_response instead of bare json.loads, so the common fenced/lightly
  -malformed LLM output is recovered instead of silently dropped / 500'd.

Decoupling:
- unified_ws change_module: move module lookup + PRETEST reset into
  LearningService.switch_module(); router keeps only the WS ordering
  (module_changed before cancel) and no longer imports learning.models.
- unified_ws check_active_turn: use new public TurnRuntimeManager
  .has_live_execution() instead of reaching into _lock/_executions.
- redo endpoint: LearningStore.clear_questions() instead of poking _questions_path.
- remove unused StreamEventType.USER_INPUT enum; document the WS message types.

Stability:
- LearningStore: question read-modify-write (save_question_answers/_meta),
  delete(), and clear_questions() now hold _cas_lock — consistent concurrency
  model; _atomic_write_text cleans up its temp file on failure.

Cleanliness/clarity:
- router: shared _validate_book_id() (9 endpoints) + _parse_modules()
  (init/replace); _classify_error drops unused expected_answer param.
- guided_learning: hoist logging/RAGService imports + module logger; move tuning
  constants to class top; ContextVar declared after imports.
- storage: hoist json import (7 inline copies removed).
- pocketbase_store: move _VALID_ID/_validate_id below the import block.
- rename misleading mastered_pct -> avg_mastery_pct (service + web consumers).

Frontend:
- learning [bookId] page uses lib fetchProgress (apiFetch -> auth redirect)
  instead of a raw credentials fetch; track/clear the retry + auto-advance
  timers on unmount; drop dead currentStage state + ModuleTree prop.
- learning-api: remove orphaned submitAnswer + AnswerRequest.
- CreateModuleDialog: use the static bookApi import; reset manualBookId to ''
  to match initial state; learning list page: stop shadowing the t() translator.

Conflict-resolution carryover: dropped the PR's incidental 300s factory timeout
(kept dev's stream runner).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 14:28:32 +08:00
Bingxi Zhao (Frank)
1946ae8182 refactor(book/session/zulip): post-merge hardening of #493/#529/#484
#493 (sqlite): route _initialize() through the _connect() contextmanager
(the one remaining raw sqlite3.connect FD leak); document the auto-commit
contract so the redundant explicit commits are understood.

#529 (book):
- _strip_thinking_preamble: guard `{ not in text` before rindex() so plain
  prose (refusals/errors) no longer raises ValueError -> ERROR block;
  hoist json import to module top.
- llm_json: honor caller max_tokens as max(max_tokens, 2600) instead of
  discarding it; bump default to 2600; fix stale 'minimal' docstring -> 'low'.
- engine.compile_page: rebuild OVERVIEW pages deterministically via
  _materialize_overview_page on force, instead of running the generic LLM
  compiler over hand-built intro/concept-graph/index blocks.
- kb_health.scan_log_health: key repeated-failure detection on the op, not
  the free-text message, removing false positives/negatives + dead block_error.
- services/__init__: drop orphaned notebook_manager lazy-import + __all__ entry.
- PageReader.tsx: restore t() i18n on regenerate buttons; add 'Regenerating…'.
- remove PATCHES.md (developer-local scratch notes).

#484 (zulip): also match the disambiguated @**Name|user_id** mention form;
make the docstring truthful; add coverage.

#500: remove stray PR_DESCRIPTION.md committed to repo root.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 14:07:02 +08:00
Bingxi Zhao (Frank)
b2ce70db69 Merge pull request #500: Guided Learning (mastery-based tutoring subsystem)
New self-contained deeptutor/learning/ subsystem (models, storage, service,
scheduler, grading) + 12-stage guided_learning capability, REST router, and
web learning pages, with 164 tests.

Conflict resolutions:
- services/llm/factory.py: kept dev's stream runner (allow_image_fallback
  multimodal path); dropped the PR's incidental 300s asyncio.wait_for wrapper
  and its now-orphaned TimeoutError handler / unused logger — the blanket
  timeout is unrelated to guided learning, dev already has consumer-side
  timeouts, and 300s would truncate long legitimate streams (book/research).
- web/components/sidebar/WorkspaceSidebar.tsx: kept dev's structure, added a
  useCallback handleNewChat that cancels any in-flight streaming turn before
  newSession() (mirrors handleDeleteSession) and wired it to onNewChat.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 13:44:05 +08:00
Bingxi Zhao (Frank)
e5846fe462 Merge pull request #484: Zulip Generic-bot @mention content fallback
Generic bot + Event Queue API returns an empty flags array, so flag-only
mention detection never fires. Add a content fallback that scans the message
body for the rendered @**Bot Full Name** syntax, backed by a _bot_full_name
captured from the bot profile. Resolved against dev's MENTION_FLAGS constant
and structured logging; added content-fallback test coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 13:38:25 +08:00
Bingxi Zhao (Frank)
56a87d3f72 Merge pull request #529: Qwen JSON preamble, force-recompile overview pages, health false positives
Book Engine fixes for local/Qwen models: robust JSON parsing, force-recompile
now resets overview pages, regenerate_block finalizes the book, and
scan_log_health no longer flags repeated successes as failures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 13:36:32 +08:00
Bingxi Zhao (Frank)
79ea87909b Merge pull request #493: Fix SQLite FD exhaustion
Wrap _connect() in a contextmanager that closes the connection after use,
preventing one leaked file descriptor per query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 13:35:13 +08:00
Bingxi Zhao (Frank)
c4d47668b7 release: v1.4.2 — Gemini 2.5+ unblocked, auth ContextVar fix, smooth streaming everywhere
- Centralize Gemini 2.5/3 reasoning_effort=none in
  reasoning_params.default_reasoning_effort_for so Visualize / Chat /
  Solve / agentic loop stop returning empty bodies on those models.
- Visualize: per-capability max_tokens default (16k) seeded from
  DEFAULT_AGENTS_SETTINGS, defensive root-tag trim on SVG/HTML output,
  graceful fallback when JSON-mode review step crashes.
- Fix #485: require_auth / require_admin are async so the
  set_current_user ContextVar reaches the endpoint instead of being
  discarded by anyio.to_thread.run_sync's worker-thread context copy.
  Adds _install_current_user helper shared by HTTP + WebSocket.
- Reasoning + native-tools chat protocol: formal content stream must
  still start with FINISH/TOOL/THINK/PAUSE; tool-call deltas no longer
  force-resolve labels and implicit_think_label is ignored, so
  protocol-repair catches missing labels instead of mis-routing turns.
- Smooth streaming on every chat surface: useSmoothStreamText through
  AssistantResponse, pin-to-bottom (useLayoutEffect) on book chat +
  quiz follow-up, data-chat-scroll-root opt-in for overflow-anchor:none.
- Sidebar: collapsible Recents region with own scroll viewport,
  deterministic Lucide icon per session via SessionAvatar, Docs link
  next to GitHub footer, "New Chat" button removed (nav handles it).
- Add Lemonade local provider (port 13305) — registry entry, README
  Docker host-gateway row, providers.md docs.
- Context-window models-endpoint probe honors DISABLE_SSL_VERIFY via
  TCPConnector(ssl=False).
- README: insert v1.4.2 release row, push v1.3.10 inside "Past
  releases" fold, bump install opt-in note to v1.4.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
v1.4.2
2026-05-28 22:36:21 +08:00
Bingxi Zhao (Frank)
c54743bfb0 improve chat 2026-05-28 22:01:26 +08:00
Bingxi Zhao (Frank)
db41c574a1 refactor: centralize Gemini default-off reasoning in reasoning_params
Follow-up to #490. The PR inlined the "disable thinking for Gemini 2.5/3"
gate in 5 places across 3 files. This commit collapses them to one
registry and three thin call sites.

Changes:

* `services/llm/reasoning_params.py`: new `_PROVIDER_DEFAULT_OFF_PATTERNS`
  registry + `default_reasoning_effort_for(provider, model)` public helper.
  `build_openai_compatible_reasoning_kwargs` now consults the registry, so
  the openai-compat path (which lost its inline gate during the #490 merge
  conflict resolution) is restored via the helper.

* `services/llm/executors.py` (sdk_complete + sdk_stream) and
  `services/llm/cloud_provider.py` (_openai_complete + _openai_stream) now
  call `default_reasoning_effort_for(...)` instead of inlining the
  ('gemini-2.5', 'gemini-3') startswith check.

* Use substring (not startswith) match so `models/gemini-2.5-flash` is
  also covered — some OpenAI-compat clients prefix model ids with `models/`.

* `services/config/loader.py:get_agent_params`: when a module's section is
  missing from the user's stale `agents.yaml`, fall back through
  `DEFAULT_AGENTS_SETTINGS` before the global `(0.5, 4096)` default. This
  lets the `capabilities.visualize` default (`max_tokens=16384` from #490)
  reach existing installs, not just fresh ones.

* `capabilities/visualize.py`: hoist the duplicated lazy
  `from deeptutor.agents.visualize.models import ReviewResult` import
  from two branches into the top of `run()`.

Tests:

* `tests/services/llm/test_reasoning_params.py` — 17 new cases covering
  Gemini 2.5/3 + `models/` prefix + case-insensitivity + the legacy
  Gemini 1.5/2.0 / other-provider untouched paths + the explicit-override
  takes-precedence rule.
* All 107 tests in `tests/services/llm/` still pass; 5 pre-existing
  `test_chat_params_config` failures (8192 vs 8000 drift) are unrelated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 18:00:08 +08:00
Bingxi Zhao (Frank)
44564b077b Merge pull request #490: fix(visualize): unblock Gemini 2.5+ and harden Visualize pipeline
Squash-merge of #490 (skinred78) with two non-trivial conflict resolutions:

* `openai_compat_provider.py`: PR inlined reasoning_effort logic that has since
  been refactored into `build_openai_compatible_reasoning_kwargs`. Keep the
  helper call; the Gemini default-down will be folded into the helper in a
  follow-up commit instead of duplicating it inline.

* `capabilities/visualize.py`: i18n was applied to the review-stage messages
  after the PR forked. Kept the new try/except review-fallback structure but
  routed all three messages through `i18n.t(...)`; added `review_skipped_error`
  key to en/zh visualize.yaml.

Other PR changes applied as-is:
* `executors.py` / `cloud_provider.py`: inline Gemini 2.5/3.x default-down
* `loader.py`: section_map entry for `visualize`
* `init.py`: `capabilities.visualize` default with max_tokens=16384
* `code_generator_agent.py`: defensive root-tag trim for svg/html

Closes #489.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 17:50:56 +08:00
Truffle
69ea8b3c90 fix(auth): make require_auth async so the user ContextVar reaches the endpoint (#485)
Fixes #481. Makes `require_auth` and `require_admin` `async def` so the user ContextVar set inside the dep is visible to async endpoints; sync deps run via `anyio.to_thread.run_sync` under `copy_context()` and the set is discarded on return.
2026-05-28 17:43:23 +08:00
Bingxi Zhao (Frank)
932987921b support lemonade & minor fixes 2026-05-28 17:23:09 +08:00
Name Card Scanner Dev
4c611c63f4 Merge remote-tracking branch 'origin/main' into fix/local-patches-win-utf8 2026-05-28 02:21:13 +08:00
Name Card Scanner Dev
34b46d672b fix: Qwen model JSON stripping, force-recompile overview pages, health false positives
- _llm_writer.py: strip thinking preamble from Qwen output, remove unsupported
  response_format, increase max_tokens to 2600, fix reasoning_effort 'minimal' -> 'low'
- engine.py: allow force-recompile on overview pages (previously a no-op),
  add _maybe_finalize_book to regenerate_block for book status propagation
- kb_health.py: filter repeated_failures to only count error/fail log entries
- PageReader.tsx: loading spinner + disabled state on regenerate buttons
- page.tsx: error notifications via notify() for compile/regenerate failures
- layout.tsx: suppressHydrationWarning for browser extension attribute injection
2026-05-28 02:07:59 +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>
v1.4.1
2026-05-27 23:16:00 +08:00
wedone
b2f2002a0a fix(chat): enable native tool calling for reasoning models via OpenAI-compatible endpoints (#528)
* fix(chat): disable thinking mode for native tool calling and strip TOOL label when unavailable

* fix(chat): only disable thinking for reasoning models when native tool calling is active

Previous fix unconditionally set enable_thinking=False for all models
when use_native_tools=True. Now gate on has_thinking_tags() so only
reasoning models (e.g. Qwen3.6-Plus matched via "qwen" prefix) get
thinking disabled. Non-reasoning models are unaffected.

* fix: enable native tool_calls for reasoning models via custom OpenAI binding

Reasoning models (e.g. Qwen3.6-Plus) accessed through a generic OpenAI-compatible binding lacked the enable_thinking parameter that DashScope sets automatically. Without it the Bailian API defaults to thinking mode but the label protocol confuses the model into writing tool-call JSON inside content instead of using native tool_calls, causing tool_without_calls violations and infinite retries. Changes: Inject enable_thinking True for reasoning models whose binding lacks a thinking_style; Append a system-prompt note telling reasoning models to ignore the label protocol; Use implicit_think_label LABEL_FINISH for reasoning models with native tool calling.

* fix: escape quotes in reasoner protocol note strings

* fix(chat): fix Qwen 3.6 Plus tool call failures

- Move _is_reasoner assignment before first use to fix UnboundLocalError
- Add custom binding capabilities for OpenAI-compatible endpoints
- Enable supports_tools and has_thinking_tags for custom providers

Fixes tool call failures with reasoning models via OpenAI-compatible APIs

* fix(capabilities): change custom binding has_thinking_tags to False

Rely on MODEL_OVERRIDES for per-model detection (qwen/deepseek/qwq
prefixes) instead of hardcoding True for all custom endpoints.
Prevents enable_thinking injection and reasoner protocol notes from
being incorrectly applied to non-reasoning models like GPT-4o.
2026-05-27 20:22:22 +08:00
xiongjnu
c1932dcb0a feat: truncate oversized event payloads in session response (#524)
RAG tool results can return KB document content exceeding 1MB per event,
causing the frontend TraceSurface to run out of memory when loading large
sessions. Truncate tool_result and observation payloads at 1MB in the
get_session endpoint, marking truncated events with _truncated: true.

The LLM context builder reads from a separate content-only store and
is unaffected by this truncation.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 20:22:08 +08:00
washi4
5c0af9983a fix: prevent Document nodes from bypassing chunking pipeline (#509)
LlamaIndex's Document class inherits from BaseNode, so the previous
isinstance(doc, BaseNode) check classified all Documents as pre-embedded
nodes, skipping SentenceSplitter entirely. This sent full-document text
(1M+ chars) to the embedding API, triggering HTTP 400 input-length errors.

Replace the type check with an explicit embedding-presence check that
correctly distinguishes pre-embedded nodes (e.g. ImageNode from multimodal
loaders) from regular Documents that still require splitting.
2026-05-27 20:21:57 +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
lezhimiffyliu
1218236004 Fix GPT-5 token limit parameter in init wizard probe (#508) 2026-05-27 20:21:33 +08:00
wedone
71e4396b92 fix(settings): add profile button when no profiles exist (#513)
When the LLM/Embedding/Search settings page has no profiles configured, the UI displayed 'No profiles configured. Add a profile to start.' but provided no button to actually add one. The add-profile button was only visible inside the profile editor, which never rendered when the list was empty - creating a dead end for new users.

Add a '+ Profile' button in the empty-state view, matching the existing button style used in the profile editor.

Closes #512, Closes #505
2026-05-27 20:21:24 +08:00
Name Card Scanner Dev
262de248bd fix: Windows UTF-8 encoding, Deep Research guard, notebook import, startup scripts
- Fix UnicodeEncodeError 'gbk' on Windows by setting encoding='utf-8' on
  stdout/stderr reconfigure in run_server.py
- Guard Deep Research send to prevent 'settings are incomplete' crash
- Add lazy import for notebook_manager in services/__init__.py
- Add start_backend.bat with PYTHONIOENCODING=utf-8 and PYTHONUTF8=1
- Add start_frontend.bat convenience script
- Document all patches in PATCHES.md for re-apply after upstream sync
2026-05-27 15:40:33 +08:00
unknown
daa0c4bd4b chore: remove web/.env.local (auto-generated local config)
This file is auto-generated by start_web.py and should not be tracked.
Upstream/dev already removed it.
2026-05-23 23:57:37 +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>
v1.4.0
2026-05-22 21:09:22 +08:00
Bingxi Zhao (Frank)
81d081d968 update readme 2026-05-22 20:36:55 +08:00
Bingxi Zhao (Frank)
921b1d6cff update readme 2026-05-22 20:32:02 +08:00
Bingxi Zhao (Frank)
ca7916bc57 fix: docs, docker deployment & official web 2026-05-22 20:19:32 +08:00