Commit Graph

997 Commits

Author SHA1 Message Date
Hunter Bown 373fbd95a0 chore(release): prepare v0.8.39
Bump workspace, inter-crate, and npm package versions 0.8.38 -> 0.8.39.

Roll CHANGELOG [Unreleased] into [0.8.39] with all fixes:
- Revert v0.8.38 /model picker rework (back to instant curated picker)
- Restore approval grouping (lossy v0.8.37 logic for approvals, exact key for denials)
- Thinking-only turn surface fix (#1727)
- ACP server JSON-RPC id stringification (#1696)
- Chat client: reasoning_content for generic providers (#1673)
- Compaction: user text query preservation (#1704)
- Engine: system prompt override survival (#1688)
- Pager: G/End overshoot fix (#1706), mouse scroll (#1716)
- Composer: scroll with text (#1677), multiline arrows (#1721)
- macOS system theme detection (#1670)
- rlm_open blank source fields (#1712)
- Terminal resize paging fix (#1724)
- Docker first-run permission (#1684)
- README Rust 1.88+ requirement note (#1718)

Tests: 3149 passed, 0 failed (deepseek-tui crate)
clippy: clean on --all-targets --all-features
2026-05-17 16:36:21 +08:00
Claude 81bc2da069 fix(tui): revert v0.8.38 /model picker rework and restore approval grouping
The v0.8.38 upgrade dramatically changed two user-visible behaviors that
were not intended as regressions:

- The /model picker was reworked (#1201/#1632) to make a blocking network
  fetch on open and replace the curated tier list with the raw provider
  catalog. Revert model_picker.rs and the OpenModelPicker handler to the
  v0.8.37 instant curated picker. The /models command still lists the live
  catalog.

- #1617 rekeyed the approval cache to an exact full-argument fingerprint,
  which also dropped the v0.8.37 arity-aware command-family grouping for
  "approve for session". Reintroduce build_approval_grouping_key (the lossy
  v0.8.37 logic) for approvals while keeping the exact key for denials, so
  denying one call no longer over-blocks later differing calls.

https://claude.ai/code/session_01NDuRxM56o17SE7SDLcTFYT
2026-05-17 16:15:17 +08:00
Hunter Bown f0a7e15d30 fix(feishu): guard thread store startup order (#1700) 2026-05-16 18:25:23 -05:00
Hunter Bown 5401eaae08 chore(release): prepare v0.8.38 (#1698) 2026-05-15 18:08:58 -05:00
hexin a528ea9824 fix(streaming): preserve all tool_calls in OpenAI batch responses (#1686)
When an OpenAI-compatible backend (vLLM, Ollama, LM Studio, Together AI,
self-hosted vLLM/SGLang, etc.) streams an assistant message containing
multiple tool_calls in a single round, only the **last** tool's
`Event::ToolCallStarted` was firing. The preceding N-1 tool calls
executed and produced tool_result events, but never announced their
start to consumers (TUI / runtime API / embedder bridges), leaving them
with N orphan tool_result blocks and no matching tool_use blocks in the
assistant history.

## Reproduction

```text
backend dispatches:   7 × write_file + 1 × exec_shell
log shows:            7 × ApprovalRequired events ✓
listeners receive:    1 × chat:tool_start, 7 × chat:tool_end
session history:      1 tool_use + 7 tool_result (6 orphans)
```

Tested against vLLM 0.7 + Qwen3.6-35B-A3B with a "scaffold 7-file Tauri
template" prompt. Any model+backend combo that emits batch tool_calls
trips this — typical when a single LLM round asks for multiple parallel
file writes or edits.

## Root cause

`run_turn` tracked the currently-streaming tool block with a single
`current_tool_index: Option<usize>`. The Anthropic-style adapter
(non-streaming response → events at `chat.rs::L1807`) emits
Start/Stop pairs in lockstep so the slot never overlaps. But the
OpenAI streaming parser (`chat.rs::L1954-2064`) emits every
`ContentBlockStart::ToolUse` as soon as a tool_call delta lands, then
batches every `ContentBlockStop` at `finish_reason`:

```text
Start { index: 0 }       // tool #1
Delta { index: 0, .. }
Start { index: 1 }       // tool #2 — overwrites current_tool_index
Delta { index: 1, .. }
…
Start { index: 6 }       // current_tool_index = Some(6)
Delta { index: 6, .. }
Stop  { index: 0 }       // take() returns Some(6)  ← wrong tool!
Stop  { index: 1 }       // take() returns None
Stop  { index: 2 }       // take() returns None
…
```

The first `Stop` consumes the last index and emits `ToolCallStarted`
for the wrong `tool_uses` entry; every subsequent `Stop` finds the
slot already `None` and skips the entire `if let Some(index) = …`
branch, dropping the announcement.

## Fix

Replace the single slot with `HashMap<u32 block_index, usize
tool_uses_idx>`:

- `ContentBlockStart::ToolUse` and `::ServerToolUse` insert the
  `(event.index → tool_uses.len())` mapping.
- `InputJsonDelta` looks up by the `ContentBlockDelta` outer index.
- `ContentBlockStop` removes by the stop's index, so each Stop routes
  to its own `tool_uses` entry regardless of arrival order.

Routing no longer depends on `current_block_kind` (which has the same
single-slot overwrite problem); `current_tool_indices.remove(&index)`
returning `Some(_)` already proves the Stop belongs to a tool block.

## Tests

Added `batch_tool_calls_preserve_all_tool_use_indices` in
`core/engine/turn_loop.rs::tests` — feeds 7 Starts and 7 Stops through
the same `HashMap` API used by `run_turn`, asserts every index round-trips.

Manual end-to-end verification: vLLM + Qwen3.6-35B + 7-file Tauri
template prompt → frontend `messages` history now contains all 7
`write_file` tool_use blocks paired with their tool_result blocks.

Co-authored-by: hexin <he.xin@h3c.com>
2026-05-15 17:55:44 -05:00
Hunter Bown b080891efa fix(tui): count loop guard blocks as failures (#1658) 2026-05-15 17:43:07 -05:00
Hunter Bown b834548897 fix(tui): calm legacy Windows console rendering (#1655) 2026-05-14 19:00:52 -05:00
Hunter Bown 7c8c71eb03 fix(tui): default Windows composer arrows to scroll 2026-05-14 16:39:51 -05:00
Hunter Bown 2a4022acbe docs: refresh README setup guidance 2026-05-14 16:38:11 -05:00
Hunter Bown f8a4dee173 fix(tui): preserve provider-selected models 2026-05-14 16:18:18 -05:00
Hunter Bown a21d34181b docs: sync packaged changelog 2026-05-14 15:25:40 -05:00
Hunter Bown 668121ccc5 style: rustfmt markdown renderer 2026-05-14 15:25:40 -05:00
Hunter Bown e12b4f18e1 fix(tui): keep wrapped OSC 8 links whole 2026-05-14 15:25:40 -05:00
Hunter Bown f23c9828b7 fix(tui): restore terminal modes on early exit
Harvests the cleanup-guard portion of PR #1630 by @duanchao-lab while preserving provider-aware onboarding startup.
2026-05-14 15:25:40 -05:00
Hunter Bown ae9e4b4b24 fix(client): omit strict OpenAI-incompatible fields 2026-05-14 15:25:40 -05:00
Hunter Bown 4c32a316be chore(release): prepare v0.8.37 2026-05-14 14:37:14 -05:00
qiyan233 cc67454f1f fix(config): accept legacy DeepSeek CN provider aliases
Map legacy DeepSeek CN provider names back to the canonical Deepseek provider in both manual parsing and TOML deserialization.

Co-authored-by: qiyan233 <qiyan233@users.noreply.github.com>
2026-05-14 14:00:35 -05:00
Hunter Bown b84fa98153 fix(tui): compile URL opener on unsupported targets
Gate browser-launch command construction to supported desktop targets and return the existing unsupported-platform error elsewhere.

Fixes #1639.
2026-05-14 14:00:27 -05:00
Eosin Ai f7eb17b00f fix(tui): wrap CJK runs in diff and pager
Hard-wrap overlong CJK/no-whitespace runs in diff and pager text wrappers so they do not overflow the right edge.

Fixes #1571.

Co-authored-by: Aitensa <1900013029@pku.edu.cn>
2026-05-14 13:46:58 -05:00
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
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 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 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 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 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