Commit Graph

1001 Commits

Author SHA1 Message Date
manaskarra cdcb907780 feat(project-context): load global AGENTS fallback 2026-05-10 08:24:21 -05:00
lbcheng fddda04fca fix(tui): add composer_arrows_scroll config option for trackpad terminals
Instead of unconditionally changing Up/Down behavior, gate the
empty-composer-scroll path behind a new `tui.composer_arrows_scroll`
config option (default false).  Users whose terminals map trackpad
gestures to arrow keys can opt in via:

    [tui]
    composer_arrows_scroll = true

When enabled, empty-composer Up/Down scroll the transcript; otherwise
plain arrows always navigate input history (preserving #1117 default).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 08:20:44 -05:00
fuleinist 665801bb8e fix(cli): forward --yolo to TUI binary via DEEPSEEK_YOLO env
The CLI dispatcher accepted --yolo but only passed it to Exec(TuiPassthroughArgs),
not to the plain Run(RunArgs) path used for interactive sessions.

Fix: pass DEEPSEEK_YOLO=true env var to the TUI binary. The TUI already
reads this env var (matching DEEPSEEK_SANDBOX_MODE pattern) and sets
allow_shell + start_in_agent_mode + yolo.

Also adds yolo field to CliRuntimeOverrides and ResolvedRuntimeOptions
so the flag propagates through the full resolve chain.
2026-05-10 08:19:08 -05:00
whtis c227a805bd docs(readme): sync zh-CN with run pr dispatcher path 2026-05-10 08:19:07 -05:00
THINKER_ONLY 0fedee00cc feat(tui): add session artifact metadata 2026-05-10 08:16:38 -05:00
reidliu41 0ccd4e731c Add feedback command for GitHub links
Add a /feedback command for opening project feedback links.

  The command shows a picker when run without arguments and supports direct
  bug, feature, and security targets. Bug and feature options open the matching
  GitHub issue templates, while security opens the repository security policy.
2026-05-10 08:16:13 -05:00
reidliu41 24ec0839e1 Add runtime status command
Add a dedicated /status command that reports the current runtime session state.

  The new report shows provider, model, workspace, mode, permissions, session,
  context usage, token telemetry, cache telemetry, cost, transcript counts, and
  rate-limit availability. /statusline remains available for footer configuration.
2026-05-10 08:16:07 -05:00
reidliu41 4f8eff0c69 refactor: unify mode switching under /mode
Replace the separate /agent, /plan, and /yolo commands with a single
  /mode command that can either open a picker or switch directly by name
  or number.

  This keeps mode switching in one command surface and avoids duplicating
  similar commands for each mode.
2026-05-10 08:15:19 -05:00
THINKER_ONLY 250953ad35 feat(tools/agent_spawn): teach parent that subagent results are self-reports 2026-05-10 08:15:19 -05:00
dst1213 682e915857 fix: retry quota errors returned as HTTP 400 2026-05-10 08:15:19 -05:00
Zhiping 39fd5379fd docs(tui): clarify Windows mouse capture behavior 2026-05-10 08:15:19 -05:00
Zhang Yonglun fd5a0aaec5 fix(tests): cover hook event dispatch paths 2026-05-10 08:15:19 -05:00
Zhang Yonglun 0428f08625 fix(tests): cover approval decision branches 2026-05-10 08:15:19 -05:00
Hunter Bown c2893b9682 docs(readme): bump What's New to v0.8.26 (security + polish) 2026-05-10 02:56:58 -05:00
Hunter Bown c3fb343860 Merge pull request #1335 from Hmbown/work/v0.8.26-security
chore(release): prepare v0.8.26 — security hotfix + release-pipeline polish
2026-05-10 02:14:06 -05:00
Hunter Bown 503140d8d5 fix(config): warn when root base_url is set with non-DeepSeek provider (#1308)
Common footgun: users set api_provider = \"ollama\" (or vllm /
openrouter / etc.) at the top of config.toml and add a top-level
base_url = \"http://my-server\" alongside it. The root base_url field
is only read for DeepSeek/DeepseekCN (and a back-compat sniff for
NvidiaNim) — for every other provider it's silently ignored, and the
user can't figure out why their override doesn't apply.

Add a one-line tracing::warn at config load time pointing the user at
the matching `[providers.<name>]` table or the corresponding
`*_BASE_URL` env var. Skipped if the per-provider table already has
its own `base_url` (which would win anyway).

No behavior change to URL resolution.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:29:28 -05:00
Hunter Bown 829270a8e7 fix(client): clearer insecure-base-URL rejection (#1303)
The previous one-line error told users to set
DEEPSEEK_ALLOW_INSECURE_HTTP=1 but the env var name is easy to typo
when you're staring at it in a terminal (sam43b in #1303 wrote
"DEEPSEEKALLOWINSECURE_HTTP"). Reformat the message to:

- Note that loopback hosts are auto-allowed (no env var needed)
- Show the env var with underscores explicit and prominent
- Include a one-line copy-pasteable example

No behavior change; same `validate_base_url_security` decisions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:27:56 -05:00
Hunter Bown 8ede860c05 docs(changelog): credit @hhhaiai for workspace-skill precedence under truncation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:26:33 -05:00
sanbo 7e289568a2 Keep workspace skills visible when the prompt budget truncates
The skills prompt renderer was re-sorting every discovered skill by name,
which discarded workspace/source precedence at the last mile. Under a large
global skills set, higher-priority workspace skills from directories such as
`.claude/skills` could be pushed past the prompt budget and disappear from the
model-visible skills list even though discovery had found them correctly.

This keeps stable ordering in discovery and preserves registry order during
rendering, then adds a regression test that proves a workspace-priority skill
survives when lower-priority global skills overflow the prompt budget.

Constraint: Session-time skill rendering must preserve cross-tool/workspace precedence
Rejected: Raise the prompt budget cap | would hide the ordering bug and bloat prompts
Rejected: Special-case `.claude/skills` during rendering | precedence belongs to registry order, not path-specific branches
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Do not re-sort rendered skills without re-proving precedence behavior under prompt truncation
Tested: cargo test --all-features; cargo fmt --all -- --check; cargo clippy --all-targets --all-features
Not-tested: Manual TUI interaction beyond automated skills prompt and QA PTY coverage
2026-05-10 00:25:53 -05:00
Hunter Bown 1ab5528727 docs(changelog): credit @reidliu41 for /skills spacing
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:25:38 -05:00
reidliu41 edb8bb0754 fix: add spacing between listed skills
Render a blank line between entries in the /skills output so long skill
  descriptions remain easier to scan. Add coverage for multi-skill list spacing.
2026-05-10 00:25:15 -05:00
Hunter Bown 21c3df1533 docs(changelog): credit @reidliu41 for base-URL override propagation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:25:01 -05:00
reidliu41 dcb8cd5926 fix: forward base URL overrides to active providers
Route DEEPSEEK_BASE_URL through the active provider config instead of leaving
  self-hosted providers on their localhost defaults. This makes --base-url work
  for Ollama and vLLM while preserving provider-specific env overrides.
2026-05-10 00:24:22 -05:00
Hunter Bown fd82ef626a docs(changelog): credit @michaeltse321 for WSL2 turn-start fix
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:24:09 -05:00
Chun Tse 29be2b18f7 fix(tui): send TurnStarted before snapshot to prevent WSL2 timeout
On WSL2 with Windows drives mounted at /mnt/c, git snapshot operations
can take 30+ seconds due to the slow 9P filesystem bridge. The original
code sent TurnStarted *after* the snapshot, causing the UI's 30-second
dispatch watchdog to fire with 'Turn dispatch timed out; the engine may
have stopped' before the turn ever appeared to start.

This commit sends TurnStarted immediately before the snapshot, so the
UI shows progress while the snapshot runs in the background.
2026-05-10 00:23:44 -05:00
Hunter Bown 9209c3366f docs(changelog): credit @Giggitycountless for .gitignore automation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:23:27 -05:00
Jiahao Ren f9004c2a3f fix: handle missing newline and slash-less variants in gitignore check
- Check for both .deepseek and .deepseek/ to prevent duplicates
- Ensure trailing newline before appending to avoid joining with unterminated line
- Add tests for both edge cases
2026-05-10 00:23:17 -05:00
Jiahao Ren afaaab1433 refactor: fix clippy single_match warning
Use if-let instead of match for single-pattern destructuring in
ensure_deepseek_gitignored(). Addresses clippy::single_match warning.
2026-05-10 00:20:56 -05:00
Jiahao Ren c4ab84e1d8 feat: auto-add .deepseek/ to .gitignore in git repos
When /init runs inside a git repository, automatically append .deepseek/
to .gitignore so that workspace-local state (instructions, snapshots,
pastes) is not accidentally committed.

The helper ensure_deepseek_gitignored() checks for an existing .git
directory, reads the current .gitignore (if any), and appends the entry
only when it is not already present. Non-fatal if the file cannot be
written (e.g. read-only filesystem).

Includes four tests covering creation, append, idempotency, and
non-git-repo skip behaviour.

Fixes #1326
2026-05-10 00:20:56 -05:00
Hunter Bown 2576408484 fix(mcp): stabilize tool ordering for prefix-cache stability (#1319)
Sort discovered tools by name in three places so the prompt prefix
the model sees is deterministic across runs regardless of server
pagination order:

- McpConnection::discover_tools — after all pages collected
- McpPool::all_tools — after iterating connections
- McpPool::to_api_tools — final block sent to the model

Adds a regression test that exercises a 2-page paginated discovery
with reverse-ordered tools and asserts the result is sorted.

Adapts the production sort idea from @hxy91819's PR; the test
infrastructure here uses the existing ScriptedValueTransport rather
than introducing a parallel MockTransport with a different trait
signature.

Co-Authored-By: hxy91819 <hxy91819@gmail.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:20:41 -05:00
Hunter Bown 73adb5b41a docs(changelog): credit @douglarek for error-cell markdown fix
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:15:39 -05:00
Leo Douglas 2d4b0e3369 fix(ui): render error cells without markdown to preserve env-var underscores
Error messages containing environment variable names like
DEEPSEEK_ALLOW_INSECURE_HTTP were mangled by markdown rendering:
the inline _italic_ parser consumed underscored segments (e.g.
_ALLOW_ → italic ALLOW without underscores), resulting in the
illegible DEEPSEEKALLOWINSECURE_HTTP displayed to the user.

Switch HistoryCell::Error from render_message (which routes through
markdown_render::render_markdown_tagged) to wrap_plain_line, which
renders the message body verbatim while preserving the existing
severity label, bold prefix, and continuation-rail layout.

Closes #1303
2026-05-10 00:14:55 -05:00
Hunter Bown 0d0f563851 docs(changelog): credit @Giggitycountless for /clear+Todos fix
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:14:39 -05:00
Jiahao Ren 5436041b6e refactor: extract retry_lock helper for mutex acquisition
Extract the duplicated try_lock retry loop into a generic helper method
retry_lock<T>() that retries up to N times with 1ms pauses. This improves
readability and makes the retry pattern reusable.

Addresses review feedback from gemini-code-assist.
2026-05-10 00:14:28 -05:00
Jiahao Ren 2544896704 fix: /clear now resets the Todos sidebar panel
The /clear command was not reliably clearing the Todos sidebar because
clear_todos() used a single try_lock() attempt. When the engine held
the mutex during tool execution, the lock acquisition failed and todos
persisted across /clear commands.

Replace the non-blocking try_lock with a retry loop (up to 100 attempts,
1ms apart) so /clear waits briefly for the mutex and always clears todos.

Also add a regression test clear_todos_resets_todos_list that seeds todos
and asserts they are empty after /clear.

Fixes #1258
2026-05-10 00:13:38 -05:00
Hunter Bown 7f1b4a9bbc docs(changelog): credit @Oliver-ZPLiu for drag-select + copy-rails fix
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:13:19 -05:00
Zhiping 964da97b93 fix(tui): update scrollbar-gutter test for interactive scrollbar (#1163)
Replace the upstream inert-scrollbar test (transcript_scrollbar_gutter_
is_not_draggable) with one that asserts the gutter starts a scrollbar
drag rather than a text selection, matching the intended behaviour
where the visible scrollbar thumb remains interactive.

The other 17 test failures in the CI run are pre-existing Windows/local
environment issues (Python REPL / skills fixture pollution) unrelated
to this change.
2026-05-10 00:12:04 -05:00
Zhiping 540a18146f fix(tui): wire scrollbar-drag entry point; fix clippy warnings (#1163)
- Wire mouse_hits_transcript_scrollbar into the Left-Down handler so the
  scrollbar thumb remains draggable after rebase onto upstream/main.
- Fix clippy::useless_format in memory-overhead test.
2026-05-10 00:12:04 -05:00
Zhiping 36a850561b test(tui): add rail-prefix-widths memory overhead test (#1163)
Simulate a 30-turn complex session (user → thinking → assistant →
tools) and assert the rail_prefix_widths vector stays under 1 MB even
in pathological sessions. The test reports exact memory figures via
eprintln! for diagnostic visibility.
2026-05-10 00:12:04 -05:00
Zhiping 31ce5bd196 fix(tui): generalize rail-prefix detection with structural pattern matching (#1163)
Replace the hardcoded three-glyph TOOL_CARD_RAIL_PREFIXES set (only
covered tool-card rails) with iterative structural detection that
handles all TUI decoration glyphs:

- Iterates through consecutive leading decorative spans so tool headers
  with multiple prefix spans (e.g. "• ▶ run issue") are fully stripped.
- Pattern A: "<glyph>[<glyph>…]<space>" where all non-space chars are
  drawing characters — covers single-glyph (▏, ▶, ⌕) and multi-glyph
  prefixes (⋮⋮).
- Pattern B: "<glyph>" + lone space span — covers assistant/user glyphs
  (●, ▎).
- Covers Box Drawing, Block Elements, Geometric Shapes, and individual
  chars used as TUI decoration (•, …, ·, ⌕, ⋮).

Store rail-prefix widths in TranscriptViewCache so the copy path reads
metadata rather than guessing from glyphs.
2026-05-10 00:12:04 -05:00
Zhiping 25c064e43f fix(tui): drag-select past edge auto-scrolls; copy strips tool-card rail (#1163)
When the user holds the left mouse button and drags past the top or

bottom of the transcript rect, advance the viewport on a fixed cadence

so a long passage can be selected in one drag. Also strip the visual

tool-card left-rail glyph (`╭ │ ╰`) from copied text so it does not

leak into the clipboard.

Auto-scroll:

* New `SelectionAutoscroll` state on `ViewportState` records direction

  and the last in-bounds column while a drag is held outside the rect.

* Armed/disarmed by the existing `Drag(Left)` handler; cleared on

  `Up(Left)`, on a fresh `Down(Left)`, and when the cursor returns

  inside the viewport.

* A new per-loop helper `tick_selection_autoscroll` advances

  `pending_scroll_delta` by ±1 line every 30 ms (~33 lines/sec) and

  extends the selection head to the matching edge row, so the visible

  selection rect stays glued to the cursor edge.

* The main loop's `poll_timeout` is clamped to the next autoscroll

  tick so the loop wakes up on cadence even with no input events.

Copy artifact:

* `line_to_plain_for_copy` returns `(plain_text, rail_prefix_width)`,

  stripping a leading rail glyph span when present.

* `selection_to_text` shifts recorded selection columns left by the

  rail width before slicing so visible selection bounds still match.

Tests:

* `drag_above/below_viewport_arms_autoscroll_*` — verify direction

  and clamped column for vertical-out drags.

* `drag_back_inside_disarms_autoscroll` — re-entering clears state.

* `mouse_up_clears_selection_autoscroll` — release ends autoscroll.

* `tick_selection_autoscroll_advances_pending_scroll_when_due` —

  cadence advances scroll and head; `_respects_cadence` blocks early

  ticks; `_clears_when_drag_ended` self-heals if drag state is lost.

* `line_to_plain_for_copy_*` — rail glyph stripping for top/middle/

  bottom rails plus negative tests for plain spans, OSC-8 wrappers,

  and lines whose plain text legitimately starts with `│`.

* Strengthened `selection_to_text_copies_rendered_transcript_block`

  to assert no `│ ` line-prefix leaks.
2026-05-10 00:12:04 -05:00
Hunter Bown 870bc2ab20 fix(build): also rerun on commits to the current branch
The earlier build-script fix only watched .git/HEAD, which catches
branch switches and detached-HEAD moves but NOT git commit on the
current branch — the commit updates the underlying ref file
(refs/heads/<name> or packed-refs after pack-refs), and HEAD itself
stays unchanged. So the embedded short-SHA in deepseek --version went
stale on the same-branch-commit case the fix was supposed to cover.

Resolve the symbolic ref at build time and watch:
- the loose ref file (refs/heads/<branch>)
- packed-refs (Cargo treats a non-existent rerun-if-changed path as
  always-changed, which covers the loose to packed transition after
  git pack-refs)

Detached HEAD is unchanged: HEAD itself contains a SHA, no symbolic
deref happens, and HEAD-as-watched still triggers on every move.

Adds parse_symbolic_ref + 4 unit tests covering: stripped prefix,
no trailing newline, detached SHA, empty input.

Smoke verified: with the previous fix, an empty commit on the same
branch did not bust the cache. With this commit, it does.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 00:11:51 -05:00
Hunter Bown 263ff4be13 docs(changelog): note mouse-wheel scroll fix for WT users (#1298, #1331)
The Windows Terminal mouse-capture default-on change in #1169 also
restores the v0.8.14 wheel-scrolls-transcript behavior on Windows
Terminal. Before mouse capture, the terminal interpreted wheel events
as input-history navigation keys; with capture on, wheel events come
into the TUI and dispatch to the viewport scroll handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 23:02:29 -05:00
Hunter Bown 74760a39d3 fix(mcp): capture stderr from spawned stdio servers
The stdio MCP spawn site discarded server stderr (`Stdio::null`), so a
server that crashed after \`initialize\` left only "Stdio transport
closed" — useless for debugging.

Pipe stderr now and drain it into a bounded ring buffer
(\`StderrTail\`, capped at 64 lines) via a tokio task. When the read
side fails (EOF or IO error), the transport error includes the
captured stderr tail so callers see why the server died.

Adds a unix-only regression test that spawns
\`sh -c 'echo >&2; exit 1'\` and asserts the stderr line propagates
through the recv() error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:53:23 -05:00
Hunter Bown 29e418474e fix(tui): default mouse capture on in Windows Terminal (#1169)
The application's drag-select clamps to the transcript area; selection
that appeared to cross into the right sidebar on Windows was actually
the terminal handling the drag natively because Windows defaulted
`mouse_capture = false`. That default was set to dodge the
mouse-mode-leak failure mode from #878 / #898 on legacy conhost, but
modern Windows Terminal handles mouse mode cleanly.

`default_mouse_capture_enabled` now branches on `WT_SESSION`:
- Set (Windows Terminal): default on, sidebar isolation works.
- Unset (legacy conhost / older Windows hosts): default off, same as
  before — explicit `--mouse-capture` or `[tui] mouse_capture = true`
  still opts in.

Adds two regression tests on the Windows path covering both branches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:49:43 -05:00
Hunter Bown 252bf6498c test(tui): broaden code-block rail regression coverage (#1212)
Adds three additional cases to the rail-on-code-block guard:
- multi-line SQL fence after an intro paragraph (issue #1212 repro)
- fenced block with an embedded blank line (different wrap branch)
- a single source line long enough to wrap inside the fence

The existing fix in caf77949d already covers these, but the original
test only asserted on a 2-line fence with no wrap. The wider coverage
locks the current behavior so a future markdown-render rewrite can't
silently regress the visible \`▏\` rail back into code output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:43:34 -05:00
Hunter Bown 3bea6b74fc docs(changelog): note bundled polish items in v0.8.26
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:38:30 -05:00
Hunter Bown 44fa06620d fix(test): make CHANGELOG-aware gate robust to packaged-crate runs
`changelog_entry_exists_for_current_package_version` reached for
`CARGO_MANIFEST_DIR/../../CHANGELOG.md`, which assumes a workspace
checkout. Running the test from a packaged crate (no parent workspace)
panicked instead of skipping.

Walk up from `CARGO_MANIFEST_DIR` looking for `CHANGELOG.md`. Inside
the workspace it still finds the top-level file; outside the workspace
the gate quietly skips with a printed note instead of panicking.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:37:51 -05:00
Hunter Bown d32cbd0b0e fix(build): rerun build script when .git/HEAD moves
`build.rs` only declared `rerun-if-env-changed` for `DEEPSEEK_BUILD_SHA`
and `GITHUB_SHA`. With no `rerun-if-changed` directives, Cargo cached
the build-script output across commits and the embedded short-SHA in
`DEEPSEEK_BUILD_VERSION` (visible in `--version`) went stale until the
next `cargo clean`.

Add a `cargo:rerun-if-changed=<workspace>/.git/HEAD` directive in both
the `cli` and `tui` build scripts. Handle both layouts: a regular
checkout (`.git` is a directory) and a worktree (`.git` is a pointer
file containing `gitdir: <path>`), so the SHA stays current in either
case.

Verified: touching `.git/HEAD` now triggers a recompile of the affected
crate; `--version` reflects the current commit on the next build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:37:51 -05:00
Hunter Bown b92d3569fd chore(release): prepare v0.8.26 — security hotfix
Two responsibly-disclosed security fixes:
- GHSA-88gh-2526-gfrr (@JafarAkhondali)
- GHSA-72w5-pf8h-xfp4 (@47Cid)

Plus version bump, CHANGELOG, regression tests for both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:30:16 -05:00