Commit Graph

1361 Commits

Author SHA1 Message Date
Reid eef16f45fd fix(model): canonicalize DeepSeek model completions
Deduplicate official DeepSeek model completions and normalize known prefixed aliases to the bare model IDs expected by official DeepSeek providers, while preserving provider-specific IDs for compatible backends.\n\nFixes #1594.\n\nCo-authored-by: reidliu41 <reid201711@gmail.com>
2026-05-14 13:39:31 -05:00
MidoriKurage a87c50b044 fix(tui): keep onboarding alive without an API key
Make the translation client optional so missing or invalid API configuration does not crash startup before onboarding can render.\n\nCo-authored-by: Crvena <kuragectl@gmail.com>
2026-05-14 13:34:33 -05:00
ZzzPL ece805568b fix(mcp): persist Streamable HTTP session IDs
Capture and replay Mcp-Session-Id for Streamable HTTP transports, and apply configured custom headers to the GET preflight.\n\nCloses #1629.\n\nCo-authored-by: Zhiping <2716057626@qq.com>
2026-05-14 13:25:22 -05:00
Gordon 13e7957621 fix(input): avoid enabling CSI-u flags on Windows
Write the Kitty keyboard protocol probe (ESC[>0u) on Windows instead of enabling disambiguation flags that crossterm does not decode there. Fixes #1599.
2026-05-14 07:41:09 -05:00
Hunter Bown 89e78d75db test(tui): avoid Windows Instant underflow
Make the sidebar expiry test avoid subtracting from a fresh Instant on Windows runners, falling back to a short sleep only when an older Instant cannot be represented.
2026-05-14 07:33:02 -05:00
Reid 8fd82be1ee fix(streaming): wrap overlong no-whitespace text
Hard-break oversized streaming tokens so CJK runs, URLs, and other no-whitespace content stay within the target width. Includes regression coverage for long CJK text and first-token overflow.
2026-05-14 07:11:38 -05:00
jieshu666 96369a8d51 fix(tui): reduce full-repaint flicker
Avoid an intermediate flush between terminal origin reset and clear so slow terminals do not render the transient reset state.
2026-05-14 07:04:50 -05:00
Vishnu 4a617b1b2c fix(tui): restore terminal on SIGINT and SIGTERM
Restore terminal modes on abnormal signal exit and share the emergency restore path with the panic hook. Fixes #1583.
2026-05-14 07:03:54 -05:00
axobase001 7d3a36ddbc fix(shell): preserve proxy env for child tasks
Allow standard proxy environment variables through the child task environment filter, with regression coverage for upper- and lower-case forms.
2026-05-14 07:03:12 -05:00
Reid 5003fd4d38 fix(ci): avoid caching cargo binaries
Disable Swatinem rust-cache binary caching so restored caches cannot replace cargo/rustup shims on hosted runners.
2026-05-14 07:02:53 -05:00
Hunter Bown 9483248a9f feat(feishu): carry Lighthouse bridge into v0.8.37
Add the Feishu/Lark long-connection bridge, Tencent Lighthouse runbooks, CNB mirror guidance, CNB tag release pipeline, and China-friendly update fallback documentation for the v0.8.37 line.
2026-05-14 03:56:03 -05:00
Hunter Bown 019d55694a fix(tui): treat absolute slash paths as messages
Let absolute filesystem paths like /usr/bin pass through the composer as user text instead of being parsed as slash commands.
2026-05-14 03:43:35 -05:00
Hunter Bown 11c655b32a fix(tui): refresh mcp discovery on manager open
Refresh deferred MCP discovery when the manager opens so the sidebar count reflects deferred tools already available to the model.
2026-05-14 03:43:32 -05:00
Hunter Bown 1ecbcfb1f4 docs(install): add download safety verification
Document checksum verification, AV false-positive triage, Linux binary dependency expectations, and blocked-GitHub download fallback guidance.
2026-05-14 03:38:19 -05:00
Hunter Bown a3f88bf6cf fix(search): default web search to bing (#1619)
Summary:
- add Bing as explicit default web_search provider
- keep explicit DuckDuckGo configuration supported
- update docs/help/config examples

Validation: CI green before merge.
2026-05-14 03:31:15 -05:00
Hunter Bown d46f7415b3 fix(tui): let ctrl-alt-0 restore hidden sidebar (#1621)
Summary:
- restore auto sidebar focus when Ctrl+Alt+0 is pressed from hidden state
- preserve existing hide behavior from visible sidebar states
- add regression coverage

Validation: CI green before merge.
2026-05-14 03:30:44 -05:00
Hunter Bown f060386927 fix(approval): fingerprint generic tool denials (#1623)
Summary:
- include generic tool input in approval-cache fingerprints
- keep exact repeat denials stable
- prevent one denied generic tool call from blocking future distinct calls

Validation: CI green before merge.
2026-05-14 03:30:11 -05:00
Hunter Bown 9eb588c383 fix(tui): summarize live tool status noise (#1618)
Summary:
- concise live shell/tool labels
- collapsed pending CI polling rows
- hardened stale task-panel timing test

Validation: CI green before merge.
2026-05-14 03:21:57 -05:00
Hunter Bown d5c45d962d chore(release): prepare v0.8.36
Squash merge of work/v0.8.36-cache-hygiene into main.

All preflight gates passed: version-drift/check/lint/test (3073 pass, 0 fail) / CodeQL / GitGuardian / npm-smoke. Preparing the v0.8.36 release tag.
2026-05-14 00:31:18 -05:00
Hunter Bown 6b5011a722 Merge pull request #1587 from Hmbown/work/v0.8.35
chore(release): prepare v0.8.35
2026-05-13 18:43:57 -05:00
Hunter Bown d5051429dd ci(release): harden changelog drift checks 2026-05-13 18:09:57 -05:00
Hunter Bown 2739f8ee08 fix(tui): clarify sidebar state and settings wiring 2026-05-13 18:09:41 -05:00
Hunter Bown 3890ce0b82 docs(release): credit Horace Liu for nix package support
Horace Liu (@liuhq) contributed Nix package support and install
documentation in the v0.8.34 cycle but was inadvertently omitted from
that release's changelog and the README contributor list. This commit
adds them to both.
2026-05-13 17:44:15 -05:00
Hunter Bown 3451075689 test(onboarding): avoid secret-derived panic output 2026-05-13 14:49:05 -05:00
Hunter Bown 0289f24e88 test(skills): avoid home env mutation in discovery test 2026-05-13 14:33:19 -05:00
Hunter Bown e0956c896f docs(readme): align mode summary with v0.8.35 prompts 2026-05-13 13:58:04 -05:00
Hunter Bown 0ab95aea1c chore(release): start v0.8.35 branch
- Bump workspace, internal crate pins, npm wrapper metadata, generated facts, and docs from 0.8.34 to 0.8.35

- Clarify 60% manual compact guidance vs 80% opt-in automatic guardrail

- Expire completed live-tool rows and collapse stale running shell rows in the Tasks sidebar
2026-05-13 13:36:15 -05:00
Hunter Bown f0a4e25360 fix(prompt): trim first-turn context noise 2026-05-13 13:12:14 -05:00
Hunter Bown 656f8e4b15 chore(release): fix clippy warnings and update web docs for v0.8.34
- Fix result_large_err and mem_replace_option_with_some in prefix_cache.rs
- Update web tool names from legacy (agent_spawn/agent_wait) to session-based (agent_open/agent_eval/agent_close)
- Fix config.toml examples: flat api_key instead of [api] section
- Add zh-CN fields to dispatch curation pipeline
- Update facts.generated.ts timestamp
2026-05-13 12:59:10 -05:00
Hunter Bown ad23f525b0 fix(tui): remove session prompt from composer chrome 2026-05-13 12:49:29 -05:00
Hunter Bown de3a3c1a5d fix(tui): show latest session history in picker 2026-05-13 12:34:41 -05:00
Hunter Bown 16114f3020 fix(release): polish v0.8.34 review issues 2026-05-13 12:08:46 -05:00
Hunter Bown 5f1bf58cfc chore(changelog): mirror [0.8.34] entry into crates/tui/CHANGELOG.md
The workspace ships two CHANGELOG files — the repo-root one and the
crate-local `crates/tui/CHANGELOG.md`. The `prompts::tests::
changelog_entry_exists_for_current_package_version` gate scans the
nearest CHANGELOG to the manifest, so the crate-local copy needs the
same `## [<version>]` section before tagging.

Copy the [0.8.34] section over from the root CHANGELOG, including the
edit_file fuzzy-punctuation bullet added later in the session. No new
content; the two files now agree.
2026-05-13 02:07:43 -05:00
Hunter Bown 06177155da feat(edit_file): fuzzy fallback tolerates typographic punctuation drift
When `edit_file` is called with `fuzz: true` and exact match fails,
the existing fallback strips leading whitespace and retries. That
catches indentation differences, but not the much more common
copy-paste failure mode where the search string came from a browser
or chat client that silently substituted Unicode punctuation:

  * U+201C / U+201D (`"` / `"`)  ↔  ASCII `"`
  * U+2018 / U+2019 (`'` / `'`)  ↔  ASCII `'`
  * U+2013 / U+2014 (en/em dash `–` / `—`)  ↔  ASCII `-`
  * U+00A0 (non-breaking space)  ↔  ASCII space

Add a second fallback after the indentation pass: when that yields
no matches, retry once more with both the file contents and the
search string punctuation-normalized to ASCII. A byte-map sized to
the normalized output recovers the original byte range, so the
replacement still goes back into the file untouched (the replacement
text is taken verbatim from the caller).

The fuzz note appended to the success message now distinguishes the
two cases:

  Replaced 1 occurrence in foo.txt (fuzzy indentation match)
  Replaced 1 occurrence in foo.rs (fuzzy punctuation match — typographic quotes/dashes normalized)

Adds two unit tests: one that recovers a smart-quote substitution,
one that handles em-dash + NBSP together.

Inspired by pi-agent's `edit-diff.ts` Unicode normalization step.
2026-05-13 02:03:25 -05:00
Hunter Bown 5036a3efd6 refactor(tui/ui): extract format helpers and keyboard-shortcut predicates
Two more cohesive seams move out of ui.rs:

* `tui::format_helpers` (new) — the three pure builders for the
  cache-warmup status message, the prefix-stability footer chip, and
  the `/models` listing. Renamed `format_cache_warmup_result` →
  `cache_warmup_result`, `format_prefix_stability_chip` →
  `prefix_stability_chip`, `format_available_models_message` →
  `available_models_message` (the `format_` prefix was redundant once
  the module name is `format_helpers`). Adds two unit tests.

* `tui::key_shortcuts` (new) — the 10 cross-platform key-event
  predicates and labels: `is_copy_shortcut`,
  `is_file_tree_toggle_shortcut`, `tool_details_shortcut_label`,
  `activity_shortcut_label`, `alt_nav_modifiers`,
  `is_macos_option_v_legacy_key` (+ the test-only platform variant),
  `is_paste_shortcut`, `is_text_input_key`, `is_ctrl_h_backspace`.
  These were the cross-platform glue around `crossterm`'s `KeyEvent`
  that normalises Ctrl-vs-Cmd, the macOS Option-Latin escape, and
  legacy Ctrl+H-as-backspace behavior.

ui.rs is now **8916 lines** — under 9000 for the first time, down
from the 10,025-line starting point (a ~11% reduction across the
session). All 956 tui:: unit tests still pass.
2026-05-13 02:01:13 -05:00
Hunter Bown 8a0c8ca3ce refactor(tui/ui): extract file-picker relevance scoring
The `/files` picker ranks workspace files by three signals harvested
from the session: which files git reports as modified, which the user
@-mentioned in the composer, and which recent tool calls touched. The
scoring code — `open_file_picker` plus 9 helpers (build_relevance,
modified_workspace_paths, parse_git_status_path,
mark_tool_detail_paths / from_value / from_text, workspace_file_candidate,
clean_path_token, workspace_path_to_picker_string) — was ~218 lines
of self-contained logic mid-ui.rs.

Moved to `tui/file_picker_relevance.rs`. Same behavior; the picker
view file (`tui/file_picker.rs`) keeps the rendering layer, and the
new module owns the per-session ranking that fed it.

ui.rs is now 9073 lines (down ~950 from the pre-refactor 10025).
2026-05-13 01:57:18 -05:00
Hunter Bown b434b92137 docs(readme): surface v0.8.34 distinguishing features
The Key Features list was missing several capabilities that meaningfully
distinguish DeepSeek TUI from other terminal coding agents:

* Prefix-cache stability tracking (the footer chip from #1473).
* OS-level sandboxing — Seatbelt on macOS, Landlock on Linux, Windows
  Job Objects. The README previously said "approval gates" without
  noting that shell execution actually runs through OS isolation.
* Bundled starter skill set (11 skills) so `/skills` is useful on
  first launch, before any community skill is installed.
* Terminal-native notifications across OSC 9 / 99 / 777 plus the
  desktop fallback.
* Theme picker covering Catppuccin / Tokyo Night / Dracula / Gruvbox.
* CNY cost display when the session locale is `zh-Hans`.

No promotional language added; entries describe shipped behavior that
already existed but went unnamed in the elevator pitch.
2026-05-13 01:53:01 -05:00
Hunter Bown da9c6e9ba0 chore(tui): delete dead crates/tui/src/modules/text.rs
`crates/tui/src/modules/` was never registered with `mod modules;` in
the binary and nothing in the workspace called `run_deepseek_chat` /
`run_official_chat`. The file is a 23 KB text-REPL workflow from a
much earlier iteration of the project — superseded by the actual
TUI runtime in `crates/tui/src/tui/` long ago, but never deleted.

Removing it cuts ~580 lines of unreachable code and 44 `println!`
calls from the workspace audit, with zero behavior change (the
compiler confirms nothing imports from this path).
2026-05-13 01:51:41 -05:00
Hunter Bown 56ff37c01d refactor(engine): extract EngineHandle impl into engine/handle.rs
`crates/tui/src/core/engine.rs` is the agent-loop core (1983 lines after
this commit, down from 2077). One of the cleanest seams in there is the
public `EngineHandle` method surface: 9 short async/sync methods that
just push operations down the engine's mpsc mailbox — `send`, `cancel`
+ `cancel_with_reason` + `is_cancelled`, `approve_tool_call` /
`deny_tool_call` / `retry_tool_with_policy`, `submit_user_input` /
`cancel_user_input`, and `steer`.

Move that impl block to a new `engine/handle.rs` submodule. The struct
itself stays in `engine.rs` because two construction sites
(`Engine::new` and the test-only `mock_engine_handle`) need access to
its private channels; child modules see parent private items, so the
impl in `handle.rs` works without widening any field visibility.

No behavior change. All 100 `core::engine::*` tests still pass.
2026-05-13 01:49:48 -05:00
Hunter Bown 8681ea7999 feat(engine): structured tracing on tool dispatch entry/exit
The tool dispatch path (`Engine::execute_tool_with_lock`) had no
observability around the actual call: we knew when a tool was
*requested* (via the existing engine-loop logs) and when it *audited*
(via `DEEPSEEK_TOOL_AUDIT_LOG` JSONL), but not how long any individual
tool took, what its outcome was, or how the request was routed (MCP
vs in-process registry).

Add two tracing events around every tool call:

* `tool.exec.start` — tool name, dispatch kind (`mcp` / `registry` /
  `missing`), interactive flag, supports-parallel flag, input byte
  size. `tracing::debug!` so the noise is opt-in via
  `RUST_LOG=engine.tool_execution=debug`.

* `tool.exec.end` — same tool/dispatch fields plus `duration_ms`,
  `success` (or `error_kind` mapped from `ToolError` variants), and
  output byte size. Successful calls log at `debug`; failures log at
  `warn` so they surface under the default filter.

Targets are flat strings (`engine.tool_execution`) following the
existing convention already used by `InteractiveTerminalGuard`. CLAUDE.md
documents `RUST_LOG=deepseek_cli::core::engine=debug` as the canonical
filter for agent-loop events; this is the per-tool-call layer beneath
that.
2026-05-13 01:47:13 -05:00
Hunter Bown 7f0773a5d5 refactor(tui/ui): move per-turn notification composition into tui::notifications
The notification dispatch primitives (`Method`, `notify_done`,
`humanize_duration`, OSC 9 / OSC 99 / OSC 777 formatters) already live
in `tui/notifications.rs`. The five composition helpers that decided
*when* and *what* to notify still lived in ui.rs:

* `notification_settings`        → `notifications::settings`
* `completed_turn_notification_message` → `notifications::completed_turn_message`
* `subagent_completion_notification_message` → `notifications::subagent_completion_message`
* `latest_assistant_notification_text` → `notifications::latest_assistant_text`
* `notification_text_summary`    → `notifications::text_summary`

Move them so the whole notification stack lives in one file. The lone
streaming sanitizer they share, `sanitize_stream_chunk`, stays in ui.rs
(it has three other call sites in the streaming render path) but is
now `pub(super)` so notifications.rs can reuse it via `super::ui::`.

ui.rs drops to ~9290 lines (down ~735 from the pre-refactor baseline
of 10025). All 954 tui:: tests still pass.
2026-05-13 01:45:09 -05:00
Hunter Bown 7744ee781a refactor(tui/ui): extract vim-mode, workspace-context, streaming-thinking
Three more cohesive function clusters move out of the 10k-line ui.rs:

* `tui::vim_mode` (new) — `handle_vim_normal_key`, the composer's
  Normal-mode dispatch (h/j/k/l, w/b, x/dd, i/a/o/v/G, plus the
  pending-`d` operator state).

* `tui::workspace_context` (new) — the composer-header git context
  badge: `refresh_if_needed`, `collect`, `branch`, `change_summary`,
  `run_git`, the `ChangeSummary` struct, and the `REFRESH_SECS` TTL
  constant. Replaces `refresh_workspace_context_if_needed` /
  `collect_workspace_context` / `workspace_git_branch` /
  `workspace_git_change_summary` / `run_git_query` / `WorkspaceChangeSummary`
  / `WORKSPACE_CONTEXT_REFRESH_SECS` in ui.rs.

* `tui::streaming_thinking` (new) — the 10-function lifecycle that
  manages the live "Thinking" entry inside `active_cell`: ensuring an
  entry exists, appending chunks, animating the translation
  placeholder, replacing it with finalized text, starting / finalizing
  a block, and stashing the reasoning buffer onto `app.last_reasoning`
  so it survives compaction.

Plus the unused `ActiveCell` import in ui.rs that became dead after
the streaming-thinking move.

ui.rs is now ~9434 lines (down from ~10025). All 954 tui::* tests
still pass; no runtime behavior change.
2026-05-13 01:41:15 -05:00
Hunter Bown 838ad20d40 refactor(tui/ui): extract auto-router + onboarding-validation helpers
ui.rs has grown past 10k lines; the first two extraction targets are
self-contained function clusters that don't share state with the rest
of the file:

* `tui::auto_router` (new module) gathers the 7 functions that decide
  whether to run the auto-route flash model and what context to send
  it: `should_resolve_auto_model_selection`,
  `resolve_auto_model_selection`, `normalize_auto_routed_effort`,
  `recent_auto_router_context`, and three private helpers
  (`content_blocks_text`, `append_router_text`,
  `truncate_for_auto_router`). Adds unit tests for the pure pieces.

* `tui::onboarding` (existing module) grows three state-machine
  transitions and one API-key validator: `validate_api_key_for_onboarding`,
  `advance_onboarding_from_welcome`,
  `advance_onboarding_after_language`,
  `sync_api_key_validation_status`, plus the `ApiKeyValidation` enum.
  These belong next to the existing onboarding screen renderers.
  Adds unit tests for the validator.

Net effect: ui.rs is ~160 lines shorter and two cohesive concerns are
now reviewable without scrolling through unrelated UI plumbing. No
behavior change. All 954 tui:: tests still pass.
2026-05-13 01:34:39 -05:00
Hunter Bown 861fc9df36 fix(skills): partition /skills output so user-created skills stay visible
The /skills menu renders one history cell containing every discoverable
skill with full description. With the v0.8.34 bundled-skill set (11
first-party skills), a typical 40-row terminal viewport no longer fits
the message, and the top of the list scrolls off — including any
workspace-level user skill at .agents/skills/, which the registry
returns first thanks to precedence ordering.

The qa_pty `skills_menu_shows_local_and_global_skills` test exercises
exactly this case: a workspace skill plus a sealed-home global skill
plus the 11 bundled skills come to 13 entries, the viewport cuts off
above /global-alpha, and the workspace skill is invisible. Discovery
was healthy — confirmed by the new unit test
`discover_finds_both_workspace_and_global_skills`.

Render the menu in two sections so user-created skills stay prominent:

- `Your skills (N):` lists every user-installed skill with its full
  description.
- `Built-in skills (M):` either lists every bundled skill with its
  description (when there are no user skills to surface) or compacts
  them into a comma-separated name list with a "run /skills <name>
  for details" hint (when user skills are present).

Filtered views (`/skills <prefix>`) keep the old flat list — the user
has already narrowed the catalog and section headers would be noise.

Expose `skills::is_bundled_skill_name` so the renderer can partition
without a side-channel marker. Replace one unit test that asserted
the old between-entry blank-line spacing with one that asserts the
section structure.
2026-05-13 01:25:38 -05:00
Hunter Bown cf45efa07b chore(release): bump workspace to v0.8.34 and clean repo root
- Bump workspace.package.version 0.8.33 -> 0.8.34 across all 14 crates
- Bump npm wrapper version + deepseekBinaryVersion pin
- Update docs/TOOL_SURFACE.md "Current surface" + docs/ARCHITECTURE.md
  current-surface references; historical "removed_in"/"v0.8.33 began
  moving" wording stays as fact
- Update web/lib/facts.generated.ts version pin
- Draft [0.8.34] CHANGELOG section covering the 135 commits since 0.8.33
  (prefix-cache stability, bundled skills, Kitty/Ghostty notifications,
  theme picker, chunked tool dispatch, MCP session-id persistence,
  cost-calc reasoning tokens, and the in-flight internal cleanup)
- Remove stale repo-root development artifacts:
  * TAKEOVER_PROMPT.md (v0.8.6 handoff, 3 minors stale)
  * PROMPT_ANALYSIS.md (v0.8.13-era prompt audit doc)
  * DEPENDENCY_GRAPH.md (claimed monolith layout, predates 14-crate split)
  docs/ARCHITECTURE.md already contains the live crate map.
- Update CONTRIBUTING.md to reference docs/ARCHITECTURE.md for build
  ordering instead of the removed DEPENDENCY_GRAPH.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 01:12:21 -05:00
Hunter Bown 1af37e3fab Add DeepSeek-native bundled workflow skills 2026-05-13 00:53:44 -05:00
Hunter Bown 7b61983804 Merge remote-tracking branch 'origin/pr/1456' into work/v0.8.34 2026-05-13 00:26:49 -05:00
Hunter Bown ee0b1be9e2 fix(auth): check startup keys against saved provider 2026-05-13 00:26:13 -05:00
Hunter Bown fe98cce1c7 fix(auto): skip router for decisive local routes 2026-05-13 00:23:46 -05:00
Hunter Bown 2c58f1eafe Merge remote-tracking branch 'origin/pr/1144' into work/v0.8.34 2026-05-13 00:21:45 -05:00