Commit Graph

2105 Commits

Author SHA1 Message Date
xyuai 8532dcc49e feat: add Xiaomi MiMo speech support 2026-06-01 21:18:28 -07:00
Hu Qiantao 139b542d3f test(ci): add Cache Guard CI test for prefix-cache stability
Add a CI guard test that verifies prefix-cache stability across
multi-turn conversations.

The test runs 8 test cases × 14-24 turns each:
- plain-dialogue (14 turns, with/without reasoning)
- long-dialogue (18 turns)
- mixed-message-sizes (20 turns)
- tool-loop (14 turns, with/without reasoning)
- long-tool-loop (24 turns, with/without reasoning)
- compaction-must-cause-at-least-one-miss (30 turns)

Environment variables:
- CODEWHALE_CACHE_GUARD=1: Enable the guard (default: disabled)
- CODEWHALE_CACHE_GUARD_THRESHOLD=40: Hit rate threshold (0-100)
- CODEWHALE_CACHE_GUARD_STRICT=1: Fail on threshold violation

Usage:
  CODEWHALE_CACHE_GUARD=1 cargo test --test cache_guard
  CODEWHALE_CACHE_GUARD=1 CODEWHALE_CACHE_GUARD_STRICT=1 cargo test --test cache_guard

The mock simulates DeepSeek's server-side prefix cache behavior
using byte-prefix matching. The default threshold (40%) is calibrated
for the mock; real CI should use CODEWHALE_CACHE_GUARD_THRESHOLD=90
for production-quality validation.

9 tests covering:
- 8 multi-turn conversation scenarios
- 1 compaction behavior verification
2026-06-01 21:15:12 -07:00
Hu Qiantao d58613ab23 test(client): add plan mode toggle byte-stability invariant test
Add test plan_mode_toggle_preserves_catalog_byte_stability that verifies
three invariants critical for DeepSeek's KV prefix cache:

1. Building the tool catalog twice for the same mode produces identical
   JSON bytes. This catches any non-determinism in catalog construction
   (e.g., HashMap iteration order, timestamp-dependent logic).

2. Non-deferred tools common to Plan and Agent modes appear in the same
   order. Plan mode excludes execution tools, but the tools that are
   present in both modes must have stable byte positions so that toggling
   between modes doesn't shift byte offsets of shared tools.

3. Activating a deferred tool mid-session appends to the tail without
   reordering the catalog head. This is the existing invariant from #263,
   now covered by a dedicated byte-level assertion.

Also add a doc comment to build_model_tool_catalog documenting the
catalog-head stability invariant.
2026-06-01 21:15:12 -07:00
Justin Gao c9e4c8b2ce fix: clarify comment, avoid per-turn tool clone on happy path
- Comment: remove 'never auto-re-pins' (it does auto-re-freeze),
  describe accurately as 'auto-re-freeze on drift'
- Perf: use as_deref().unwrap_or_default() to borrow &[Tool] for
  verify(), only to_vec() when constructing PinnedPrefix
2026-06-01 21:15:12 -07:00
Justin Gao b122b58c92 refs(#2264): Phase 2 — wire FrozenPrefix::verify() into turn_loop
Adds a three-zone diagnostic layer alongside the existing
PrefixStabilityManager::check_and_update(). On the first turn,
freeze the PinnedPrefix baseline; on subsequent turns, verify
the current system+tool state against the frozen baseline and
log drift via tracing::debug!. Phase 2 is warn-only — no
request refusal — auto-re-freezes on drift to keep subsequent
turn comparisons meaningful.

- Session: add frozen_prefix: Option<FrozenPrefix> field
- turn_loop: import PinnedPrefix, insert verify block after
  check_and_update, before MessageRequest construction
2026-06-01 21:15:12 -07:00
Hunter B 4a09197433 fix(tui): bound foreground shell reader drains
Refs #2571

Harvests the core idea from PR #2573 by @idling11, with local cleanup for normal-exit inherited pipe handles and a foreground orphan-pipe regression.

Co-authored-by: Hanmiao Li <894876246@qq.com>
2026-06-01 20:49:26 -07:00
Hunter B eedeb5290b fix(agent): pass through explicit AtlasCloud model ids
Refs #2569

Harvests the safe part of PR #2569 by allowing AtlasCloud provider-hinted namespaced model IDs to route exactly as requested, without freezing a volatile provider model catalog in the static registry.

Co-authored-by: lucaszhu-hue <lucas.zhu@atlascloud.ai>
2026-06-01 20:06:26 -07:00
Hunter B 88f34fc9dd fix(tui): protect multiline drafts on arrow navigation 2026-06-01 19:58:39 -07:00
Hunter B 41edcd5c4f chore(release): bump local version to 0.8.50 2026-06-01 19:39:45 -07:00
Hunter B 63b7c189b8 fix(release): ship NSIS installer artifact 2026-06-01 19:34:25 -07:00
songzhenrui e6de6f47d5 fix: address Gemini code review feedback
- Define UnStrStr macro for uninstaller string functions
- Use un.StrStr instead of StrStr in uninstaller context
- Rewrite un.RemoveFromPath with correct offset calculations
  and semicolon handling to prevent PATH corruption
- Use dynamic version fetch from GitHub API in CLASSROOM_INSTALL.md
2026-06-01 19:27:30 -07:00
songzhenrui c2c36cca11 feat: add NSIS installer and classroom admin checklist
Closes #1983

- Add scripts/installer/codewhale.nsi: NSIS installer that installs both
  codewhale.exe and codewhale-tui.exe to %LOCALAPPDATA%\Programs\CodeWhale\bin,
  adds to current-user PATH, and includes an uninstaller that cleans PATH
- Add docs/CLASSROOM_INSTALL.md: step-by-step checklist for IT admins
  deploying CodeWhale in labs/classrooms, covering silent install, manual
  fallback, API key provisioning, imaging notes, and troubleshooting
- Update docs/INSTALL.md: add Windows NSIS Installer section referencing
  the new installer and classroom checklist
2026-06-01 19:27:30 -07:00
cyq c92f3c350b feat(tui): expose current model in turn metadata 2026-06-01 19:22:49 -07:00
cyq a41a3825c5 docs(runtime): outline receipt export boundary 2026-06-01 19:22:00 -07:00
cyq baba81cfb9 fix(tui): show session timestamps in listings 2026-06-01 19:21:53 -07:00
Hu Qiantao b1cc344d21 fix(tui): force full repaint on theme switch to prevent stale sidebar colors
When switching themes, ratatui's incremental diff engine may miss
color-only changes in sidebar cells that were rendered with
theme-resolved UiTheme fields rather than palette constants routed
through the backend remap layer.  This manifests as the sidebar
retaining the previous theme's colors until a window resize or
conversation turn triggers a full repaint.

Add a force_next_full_repaint flag on App that is set whenever a
theme or background_color ConfigUpdated event is processed.  The
main render loop merges this into the existing force_terminal_repaint
mechanism, which clears the terminal and redraws every cell.
2026-06-01 19:21:53 -07:00
Hu Qiantao 556e0b46fb fix(tui): use theme colors in sidebar panels instead of hardcoded palette constants
The task, work, agents, and context sidebar panels were using hardcoded
palette::DEEPSEEK_SKY, palette::TEXT_MUTED, palette::STATUS_WARNING etc.
constants (Whale dark theme colors) that never change when the user
switches themes. This caused the sidebar content to remain in Whale dark
colors even after switching to Claude, Catppuccin, Dracula, or other
community themes.

Root cause:
- task_panel_lines() used palette::DEEPSEEK_SKY, TEXT_MUTED, STATUS_* etc.
- work_panel_lines() and helpers used palette::TEXT_MUTED, STATUS_* etc.
- subagent_panel_lines() used palette::DEEPSEEK_SKY, TEXT_DIM, STATUS_* etc.
- render_context_panel() used palette::DEEPSEEK_SKY, TEXT_MUTED, TEXT_DIM
- tool_status_marker() returned hardcoded palette::STATUS_* colors
- agent_status_marker() returned hardcoded palette::STATUS_* colors

Fix:
- All sidebar panel functions now accept &UiTheme and use theme fields
- task_panel_lines: uses app.ui_theme directly
- work_panel_lines: passes ui_theme to all helpers
- subagent_panel_lines: accepts theme parameter
- render_context_panel: uses app.ui_theme
- tool_status_marker/agent_status_marker: accept theme parameter
- All palette::DEEPSEEK_SKY -> theme.accent_primary
- All palette::TEXT_MUTED -> theme.text_muted
- All palette::TEXT_DIM -> theme.text_dim
- All palette::STATUS_WARNING -> theme.warning
- All palette::STATUS_SUCCESS -> theme.success
- All palette::STATUS_ERROR -> theme.error_fg

This ensures sidebar panels immediately reflect the active theme when
switching, without requiring a conversation turn to trigger a refresh.

Also creates a theme modification guide for future contributors.
2026-06-01 19:21:53 -07:00
cyq 0842b3f528 test(config): use real legacy home on windows 2026-06-01 19:21:53 -07:00
cyq eff4e99a2c test(config): stabilize migration home on windows 2026-06-01 19:21:53 -07:00
cyq 6144d64914 fix(config): report legacy config migration 2026-06-01 19:21:53 -07:00
cyq 537afcf07e fix(subagent): cap truncated response retries 2026-06-01 19:21:42 -07:00
cyq 650d1a6195 fix(subagent): guard truncated tool calls 2026-06-01 19:21:42 -07:00
cyq c148b00e89 fix(npm): prefer binary version output 2026-06-01 19:17:58 -07:00
cyq 5becfda03b fix(tui): use effective model window in context inspector 2026-06-01 19:17:58 -07:00
reidliu41 c81cdabc09 feat(tui): add bang shell command shortcut
Support `! <command>` and `!command` in the TUI composer to run shell commands through the existing exec_shell path.

  The shortcut keeps normal approval, sandbox, policy, transcript, and work-panel handling, while avoiding model context
  pollution from local-only tool results.

  Refs #1546
2026-06-01 17:42:04 -07:00
cyq f185d46917 fix(tui): expose mention behavior in config 2026-06-01 17:33:41 -07:00
cyq 73cd721665 feat(tui): add mention browser completions 2026-06-01 17:33:41 -07:00
cyq 908a25d0f6 test(mcp): close stale-session mock responses cleanly 2026-06-01 17:30:05 -07:00
Hunter Bown cbd6239f3d docs: mark agent shell tools approval-gated 2026-06-01 17:23:23 -07:00
cyq 9e9326990d docs: polish mode availability table 2026-06-01 17:23:04 -07:00
cyq fda2141b70 docs: clarify shell tool mode availability 2026-06-01 17:23:04 -07:00
Hunter Bown ae2000b59a docs(tui): align statusline customization limits 2026-06-01 17:20:49 -07:00
cyq 9bd08c2f1c docs(tui): document statusline footer items 2026-06-01 17:20:05 -07:00
cyq 3db7b40458 docs(rebrand): address migration review notes 2026-06-01 17:19:26 -07:00
cyq 5f3cc3c8e8 docs(rebrand): clarify state migration paths 2026-06-01 17:19:26 -07:00
cyq 5a909eea45 docs(providers): clarify local model tool calls 2026-06-01 17:17:20 -07:00
cyq 7c06cf5981 fix(tui): guide bug reports toward failure causes 2026-06-01 17:14:59 -07:00
Hunter Bown eba019ae43 test(tui): align activity labels with semantic tools 2026-06-01 17:03:18 -07:00
cyq d71cba692e test(tui): wait for background shell completion 2026-06-01 16:57:07 -07:00
Hunter Bown 57c10c78d6 fix(tui): compact tool-call UI and context 2026-06-01 16:55:10 -07:00
Hunter Bown c52769e5f5 feat(tools): add parallel verifier ensemble 2026-06-01 16:40:30 -07:00
Hunter Bown 91c5bb64bd fix(tui): keep tui prefs under codewhale home
Refs #2369

Harvested from PR #2516 by @cyq1017
2026-06-01 16:22:40 -07:00
cyq 0eb2ff59ae fix(tui): isolate settings path fallback tests 2026-06-01 16:17:43 -07:00
cyq 3b5727f283 fix(tui): prefer codewhale settings path 2026-06-01 16:17:43 -07:00
Hunter Bown bc7f98a6a0 fix(tui): refresh prompt on mode changes
Refs #2379

Harvested from PR #2534 by @cyq1017
2026-06-01 16:14:59 -07:00
cyq 46de1a9b2d fix(tui): refresh prompt on model switch 2026-06-01 16:09:29 -07:00
cyq 1605d8de44 fix(sandbox): allow tty device in seatbelt profile
Refs #2372

Harvested from PR #2524 by @cyq1017
2026-06-01 16:04:58 -07:00
Hunter Bown 9f33c4d594 fix(tui): suppress wl-paste trailing newline
Refs #1920

Harvested from PR #2540 by @cyq1017
2026-06-01 16:01:05 -07:00
cyq e2201b87dd fix(tui): read Wayland clipboard via wl-paste 2026-06-01 16:00:06 -07:00
cyq 29f57665eb fix(tui): narrow mention depth hint 2026-06-01 15:31:55 -07:00