Commit Graph

135 Commits

Author SHA1 Message Date
can1357 f366e7bea8 Merge PR #3402: Shared TUI mouse-routing helpers and overlay selector migration (@wolfiesch)
# Conflicts:
#	packages/coding-agent/src/modes/components/settings-selector.ts
2026-06-27 01:40:11 +02:00
can1357 b72b83884d Merge PR #3216: feat: add provider in-flight request limits (@H4vC)
# Conflicts:
#	packages/coding-agent/src/modes/components/settings-selector.ts
2026-06-27 01:39:32 +02:00
can1357 8e206dbd54 Merge PR #3056: feat(coding-agent): add native terminal progress setting (@lederniermagicien) 2026-06-27 01:39:30 +02:00
can1357 366313df33 test(coding-agent): improved stdout geometry stubs in tests
- Added no-op setters to process.stdout properties in test geometry stubs.
- Prevented potential errors when code under test attempts to reassign stdout dimensions.
2026-06-25 05:15:40 +02:00
Wolfgang Schoenberger 16df865a88 test(coding-agent): cover inline-picker wrapper mouse offset
Add regression tests for all five inline-picker wrappers asserting a click
on the top border row is inert and a click on the first list row below it
confirms the first item, pinning the top-border line offset.
2026-06-24 20:09:48 -07:00
can1357 92d03466b7 Merge branch 'farm/c8a3da70/fix-resume-delete-scroll' into resume picker
Resolve the session-selector.ts conflict by integrating the delete-dialog
content-slot fix (#3283) on top of the fullscreen mouse-picker refactor.

The branch swapped the delete-confirmation dialog INTO a single content
slot (replacing the SessionList) so the picker is always
`chrome + max(list, dialog) + chrome` and never overflows the viewport.
Adjustments baked into this merge:

- Wrap the SessionList in `#contentSlot` and keep the dialog swapping into
  that slot, but preserve the new fullscreen path: mouse hit-testing,
  the pinned footer (`#footerLines`/`#footerStart`), and fill-height
  trimming all still work because the render offset now tracks
  `#contentSlot` (the list lives one level down).
- Keep both CHANGELOG entries (picker mouse/fullscreen + #3283 fix) and
  the ported scroll-stability regression test.
2026-06-23 02:46:56 +02:00
can1357 cffb804d3a feat(coding-agent): added mouse support and fullscreen rendering to session picker
- Enabled fullscreen overlay rendering for the terminal session picker.
- Implemented full mouse support including wheel-based scrolling and click-to-select functionality.
- Anchored the session picker footer to the bottom of the viewport to correct UI flickering.
- Added comprehensive unit tests for mouse interaction and layout constancy during resizing.
2026-06-23 02:25:30 +02:00
roboomp e266782604 fix(session-selector): swap delete dialog into SessionList slot
Earlier rounds shrank the SessionList by the dialog's row count to keep
the picker inside the viewport, but the SessionList could only claw back
whole session rows and bottomed out at zero entries. On a narrow
terminal with a long session title the dialog still wrapped past what
the SessionList could free, the picker overflowed the viewport, and the
TUI committed the header into native scrollback.

The picker now hosts the SessionList inside a single contentSlot
Container. Opening the delete confirmation swaps the dialog INTO that
slot (replacing the SessionList); closing it swaps the SessionList back.
The dialog therefore competes only with the SessionList's rendered
budget, not with the SessionList AND the picker chrome, so the picker
frame stays bounded by terminalRows even when the dialog wraps to many
rows. SessionList's external-reserve plumbing is no longer needed and is
removed.

Addresses PR #3285 second-round review feedback.
2026-06-23 00:05:53 +00:00
roboomp 964dc480c9 fix(session-selector): derive delete-dialog reserve from rendered height
The first round of the issue #3283 fix reserved a fixed 12 SessionList
rows for the delete confirmation dialog. On a narrow terminal or against
a long session name, HookSelectorComponent's Markdown title and help
text wrap past 12 rows; the picker would still overflow even after the
SessionList shrank to zero entries, and the TUI committed the picker
header into native scrollback again.

SessionSelectorComponent now overrides render() to measure the dialog's
actual rendered height at the live width before super.render() walks
the children, and pushes that as the SessionList's external-row reserve.
The dialog's own Container memoization makes the extra pre-render
essentially free.

Addresses PR #3285 review feedback.
2026-06-22 23:56:25 +00:00
roboomp ecdff42513 fix(session-selector): keep /resume header pinned after delete
The delete-confirmation dialog mounted as a sibling below the picker's
bottom border briefly grew the picker past the terminal height. The TUI's
append-only renderer committed the picker's top rows (header + first
sessions) into native scrollback to fit the dialog within the viewport.
When the dialog closed and the picker re-rendered shorter, `windowTop`
stayed pinned at `#committedRows`, leaving the picker stranded below the
committed prefix — the user saw the header scrolled off the top.

SessionList now exposes `setExternalReserveRows`; SessionSelectorComponent
reserves the dialog's worst-case height while the dialog is mounted so
the picker's total rendered output stays within the terminal viewport
and the TUI never commits its rows.

Fixes #3283
2026-06-22 23:38:11 +00:00
can1357 2ff005a354 fix(coding-agent/modes): resolved escape key handling under kitty keyboard protocol
- Update input handler to recognize CSI-u escape sequences using `matchesKey`.
- Ensure legacy bare escape sequences remain supported in environments without the protocol.
- Add test coverage for both CSI-u and legacy escape inputs.
2026-06-23 00:36:54 +02:00
Brit b1deca6606 feat: add provider in-flight request limits 2026-06-22 02:11:41 +02:00
can1357 e43d01a684 Merge PR #1794: fix(coding-agent): mark forked sessions in resume picker (@roboomp)
# Conflicts:
#	packages/coding-agent/src/modes/components/session-selector.ts
2026-06-21 17:18:16 +02:00
can1357 d3d88ce5c3 test(coding-agent): force startInAllScope in #3099 regression so it discriminates
The #3099 test omitted the startInAllScope flag, so it passed against the
buggy baseline too (empty folder defaults to folder scope regardless). Force
the removed flag via a cast to pin the real contract: even when a caller asks
for all-projects scope on an empty folder, the picker must stay folder-scoped.
Proven: passes on head src, fails on baseline src (renders '(all projects)').
2026-06-20 22:13:01 +02:00
can1357 31bb2144e7 Merge PR #3100: fix(coding-agent): keep /resume picker scoped to the current folder (@roboomp) 2026-06-20 22:13:01 +02:00
can1357 b717a65fc3 feat(coding-agent): introduced prose-only thinking mode
- Added a `proseOnlyThinking` configuration setting to suppress raw code blocks in AI thinking traces.
- Implemented `formatThinkingForDisplay` utility to replace code blocks with ellipses in the UI.
- Integrated runtime toggling and live refreshing of message components via streaming reveal controllers.
- Added a live tokens-per-second indicator to the assistant thinking pulse.
- Verified logic with new unit and integration tests for thinking block presentation.
2026-06-20 08:51:15 +02:00
can1357 4947ac6ce2 feat(coding-agent/modes): added live streaming-speed indicator to thinking animation
- Added a windowed `SpeedTracker` to report average tokens-per-second during reasoning streams.
- Updated thinking animation from a dot pulse to a starburst effect with a dynamic speed badge.
- Engineered badges to fade from gray to accent color based on streaming throughput.
- Implemented automatic badge suppression during streaming lulls or for providers without live usage reporting.
- Added session-wide reset logic to prevent rate leaking between consecutive message turns.
2026-06-20 08:30:01 +02:00
roboomp de03b0c8ee fix(coding-agent): kept /resume picker scoped to the current folder
The session picker auto-switched into all-projects scope whenever the
current cwd had no sessions, so /resume from a fresh project silently
surfaced every other project's history. The empty-folder hint already
tells users to Tab into all-projects, but the auto-switch made it
unreachable. Both call sites (the /resume slash command and `omp
--resume` startup) now always open in folder scope; `omp --resume`
keeps the global probe only to early-exit with 'No sessions found' when
nothing exists anywhere. The component-level `startInAllScope` option
is deleted along with its callers.

Fixes #3099
2026-06-20 03:43:59 +00:00
Magicien 40b498ffb6 feat(coding-agent): add native terminal progress setting 2026-06-19 18:00:41 +01:00
can1357 2de02f2119 Merge PR #3019: fix: Windows test failures — path handling, EBUSY, SQLite handle leaks (@oldschoola) 2026-06-19 17:17:04 +02:00
can1357 d46bd0139b refactor(coding-agent): fixed system prompt customization path
- Fixed `SYSTEM.md` integration to correctly include custom-rendered sections like rules and skills.
- Consolidated system prompt validation by requiring `<skills>` tag presence instead of specific prose.
- Removed redundant system prompt math-formatting tests and orphaned task batch documentation tests.
2026-06-19 16:16:37 +02:00
can1357 fd0dd40083 refactor(coding-agent): improved detection of reflowing markdown
- Replaced regex-based markdown detection with a stateful parser in `detectLiveReflowingMarkdown`.
- Correctly ignore table delimiters and mermaid markers when they appear inside fenced code blocks.
- Added tests to verify that code blocks containing markdown-like syntax do not prevent commit stability.
2026-06-19 16:11:40 +02:00
can1357 865694df7e fix: resolved streaming stability and reference isolation issues
- Prevent object reference sharing between agent snapshots and stream events by deep-cloning tool-call arguments.
- Stabilize GFM tables and Mermaid diagrams during streaming by delaying transcript block commits until content finalization.
- Implement session resume safety to prevent crashes when working directories are missing.
- Add comprehensive test suites to verify streaming commit stability and immutable snapshot isolation.
2026-06-19 16:09:00 +02:00
can1357 a98230addc chore: update changelog & tests 2026-06-19 16:06:18 +02:00
roboomp ffcbc5f876 fix(ux): gated advisor dependent settings
Added an advisorEnabled visibility predicate and wired the advisor dependent settings through it so the Model Advisor sub-options hide unless Enable Advisor is active. Added regression coverage for the settings UI adapter.\n\nFixes #3027
2026-06-19 06:39:24 +00:00
can1357 b877464575 refactor(coding-agent): migrated UI chrome to rounded box corners
- Switch all UI components and tests from sharp box corners (`boxSharp`) to rounded ones (`boxRound`).
- Update `Theme` to re-export sharp junction symbols (tees and cross) under `boxRound` to ensure consistent divider rendering in rounded boxes.
- Remove outdated architectural notes regarding forced tool-choice queues in documentation.
2026-06-19 07:57:15 +02:00
oldschoola 14252e71cb fix: Windows test failures — path handling, EBUSY, SQLite handle leaks
Fix all Windows-specific test failures caused by path handling problems
and EBUSY errors from unclosed SQLite database handles.

Root causes fixed:
1. POSIX path assumptions: replaced hard-coded file:///tmp, /repo, etc.
   with pathToFileURL/path.resolve/path.join computed expectations
2. shortenPath() now normalizes backslashes to forward slashes after ~
   and respects home directory boundaries
3. HistoryStorage.resetInstance() leaked its Database — added #close()
   that finalizes all prepared statements and closes the DB
4. AgentStorage gained the same resetInstance()/#close() pattern
5. SqliteAuthCredentialStore.close() leaked one-off prepared statements
   from inline this.#db.prepare() calls — wrapped each in try/finally
6. model-cache.ts used a process-global DB even for custom dbPath —
   now opens/closes per-call via withModelCacheDb
7. createAgentSession leaked AuthStorage on construction failure —
   added ownsAuthStorage cleanup in catch block
8. MnemopiBackend.removeDbFiles() now truly best-effort (catches errors)
9. TempDir retry window expanded from 4x10ms to 40x25ms
10. TempDir prefix convention: non-@ prefixes created dirs relative to
    cwd instead of os.tmpdir() — all test temp dirs now use @ prefix
11. Shell-escaped interpolated paths in bash tool tests
12. git core.autocrlf false in autoresearch test repo init

All 522 previously-failing Windows tests now pass.
2026-06-18 21:32:38 -07:00
can1357 7a819bba16 Merge PR #2906: fix(login): honor disabledProviders in /login provider list (@dipunj) 2026-06-18 23:32:53 +02:00
Dipunj ca4c5463d9 fix(login): hide alias logins when their credential provider is disabled
A login entry can store credentials under a different provider id via
storeCredentialsAs (e.g. openai-codex-device => openai-codex). Filtering
only on provider.id left such alias logins visible after disabling the
underlying model provider. Surface storeCredentialsAs on OAuthProviderInfo
and hide a login entry when either its own id or its storeCredentialsAs
target is in disabledProviders.

Addresses Codex review on #2906.
2026-06-18 15:56:43 -04:00
can1357 f5ebab2b83 feat(utils): vendor mermaid rendering 2026-06-18 18:52:38 +02:00
can1357 31fe9ab3f1 hack: backtrack changelog 2026-06-18 04:55:19 +02:00
Dipunj d23774663e fix(login): honor disabledProviders in /login provider list
The /login selector listed every OAuth-capable provider regardless of the
disabledProviders setting, so providers hidden from the model picker still
appeared as login targets. Filter them out in login mode (logout stays
unfiltered so stored credentials of a now-disabled provider can still be
removed).
2026-06-17 16:14:03 -04:00
can1357 c6fd50b8e6 feat(coding-agent): added advisor context auto-maintenance with safer replay and compaction
- Added advisor context maintenance hook and token estimation before prompting for auto-upkeep.
- Added re-prime replay handling to reset advisor context and recover deferred prompts.
- Implemented session-level context compaction with model promotion and snapcompact-first fallback summarization.
- Surfaced advisor settings in the model tab and updated advisor system guidance text.
2026-06-15 16:49:21 +02:00
can1357 6b1ba425df feat(coding-agent): animated thinking pulse for hidden thinking blocks
Render a breathing dots pulse (·‥…‥) in place of a hidden thinking block while the model is actively reasoning, so streaming progress is visible with hideThinkingBlock enabled. The pulse shows only while the block is live (not finalized), thinking is hidden, no tool call has started, and the tail block is thinking; it yields to streamed text and is removed when the block is sealed.
2026-06-15 13:44:44 +02:00
can1357 6639d6e1f7 feat(coding-agent/modes): added conditional nerd-font tip for unicode welcome mode
- WelcomeComponent now lazily selected and cached a tip per instance, preserving it across re-renders.
- With the unicode preset, it showed a special nerdfont tip 10% of the time and otherwise used the regular tip rotation.
- Added tests that mocked theme preset and Math.random to verify standard and special tip selection behavior.
2026-06-15 06:10:52 +02:00
can1357 a655953e7a fix(hashline): hardened hashline editing with seen-line and block-anchor validation
- Tracked seen-line provenance in snapshots and propagated it from read/search/ast-grep rows.
- Rejected hashline edits on unseen lines before patching, throwing unseen-line errors.
- Rejected single-line block anchors in strict mode and dropped them in unresolved lenient mode.
- Trimmed one-sided keeper-echo duplicates during multi-line replacements with warning output.
2026-06-15 04:25:33 +02:00
can1357 687487385b test(coding-agent): drop tts/stt worker tests; harden timing-bound tests
The tts/stt suite spawns sherpa-onnx worker subprocesses that hang on the
headless CI runner (zero-output stall → SIGTERM), and the resulting event-loop
starvation tipped real-time TUI tests (streaming-preview, custom-editor shimmer,
ask timeouts) past bun's 5s default. Remove the tts/stt tests and give the
timing-sensitive tests an explicit 30s timeout.
2026-06-14 20:18:09 +02:00
can1357 0bf5f5f7bf test: drop stale priority-default and memory-tab assertions
- model-resolver: removed three resolveAgentModelPatterns cases that pinned exact
  priority.json model names (gpt-5.4 / gemini-3 designer list); priority.json now
  leads slow with gpt-5.5 and includes gemini-3.5-flash, so the hardcoded lists
  were stale. The remaining cases still cover cross-role alias inheritance and
  configured-override precedence.
- settings-selector: removed the condition-hidden group-title assertion that
  depended on the pre-autolearn memory-tab group layout.
2026-06-14 17:20:18 +02:00
can1357 a1d1d4c44f feat(coding-agent/modes): added shared compact divider for handoff summary
- Routed `customType: "handoff"` messages to the compact divider path in Agent Hub and UI helpers.
- Added handoff summary expansion that extracts context text and strips `<handoff-context>` wrappers.
- Refactored shared divider rendering into `SummaryDividerComponent` used by compaction and handoff messages.
2026-06-14 04:29:11 +02:00
can1357 24c8bb24c6 feat(session): added modular session APIs and rebuilt listing/persistence behavior
- Added session-domain modules and exports for session-entries, context, listing, loader, and migrations.
- Changed persistence to async append writes plus writeTextAtomic, removing sync line APIs.
- Added compaction-aware session context rebuild with dangling tool-call cleanup.
- Added resumable session resolution with status inference, id/stem/suffix matching, and backup recovery.
2026-06-14 02:02:53 +02:00
can1357 65880477fe docs(coding-agent/modes): documented fix for unmatched OSC 133 command markers
- Added a changelog entry describing that submitted user messages no longer pair OSC 133 command-start markers with missing end markers.
- Annotated the user-message component with guidance to avoid emitting OSC 133 command-start markers for submitted prompts.
2026-06-14 01:32:46 +02:00
can1357 2bbf995a1d feat(tui): added viewport-only transcript tail rendering and deferred resize repaint
- Added tail-only transcript rendering via `renderViewportTail`, stopping at `maxRows` and returning `EMPTY_TAIL`.
- Added `ViewportTailProvider`/`asViewportTailProvider` API and resize getters for viewport state.
- Implemented viewport-only painting during non-mux resize with deferred full repaint after settle.
- Added settle-resize helpers and coverage for deferred repaint timing and cancel paths.
2026-06-13 21:27:36 +02:00
can1357 3def4a6979 feat(coding-agent-logout/auth-ux): enabled selective OAuth account logout
- Added a credential-picker `/logout` flow for selecting one OAuth account.
- Added optional `/logout` provider argument and unknown-provider error handling.
- Changed logout handling to delete only the chosen credential and keep others.
- Added AuthStorage APIs to list and remove credentials by id, with remote deletion hook.
2026-06-13 17:31:18 +02:00
can1357 e30c642126 fix: corrected assistant render and reveal logic to skip blank thinking
- Filtered dot-only or blank thinking blocks so they no longer render as assistant thought.
- Adjusted assistant-message and streaming-reveal logic to use visible-thinking helpers for consistency.
2026-06-13 16:26:51 +02:00
chan1103 4b136b0710 fix: align Mermaid ASCII box borders for CJK/emoji labels
beautiful-mermaid@1.1.3 measures label width in UTF-16 code units, but
terminals render East Asian characters (Hangul/CJK/kana) and emoji 2
columns wide, so fenced mermaid blocks in assistant messages and
render_mermaid tool output had misaligned box borders for non-Latin
labels (upstream: lukilabs/beautiful-mermaid#119, #122).

Adds a patchedDependencies entry rebuilding the ASCII renderer to
measure terminal display columns: grapheme-cluster segmentation
(Intl.Segmenter), wcwidth-style policy (East Asian Wide + emoji
presentation + ZWJ/VS16/flag sequences = 2 columns; text-presentation
symbols like the renderer's own arrowheads stay narrow), and atomic
wide-glyph cell pairs so label collisions cannot shift row widths.

The patch modifies only existing files (bun cannot patch in new files,
and the exports "bun" condition loads src/ directly, so both src and
dist are patched). It mirrors the upstream PR and should be dropped
once the fix ships in a beautiful-mermaid release; a new CJK alignment
regression test keeps that transition honest.

Verified: bun test packages/coding-agent/test/modes/components/
assistant-message-mermaid.test.ts (8 pass, incl. new display-column
alignment regression test); bun test packages/utils (154 pass); Korean
flowchart renders with uniform display-column row widths through the
patched package.
2026-06-13 16:44:17 +09:00
can1357 c938fe4d27 feat(coding-agent): added focused subagent session mode for main-agent hub navigation
- Added a SessionFocusController to switch transcript and input context between main and subagent sessions.
- Added agent-hub Enter activation and double-left return behavior for focused local agents.
- Added view-session-based event and render logic to avoid stale focus-session state.
- Added status-line focused agent display with ghost icon and focused-mode border dimming.
2026-06-12 15:37:56 +02:00
can1357 d214e2f022 Merge branch 'pr-2182'
# Conflicts:
#	packages/coding-agent/package.json
#	packages/coding-agent/src/config/model-registry.ts
#	packages/coding-agent/src/main.ts
#	packages/coding-agent/src/modes/components/assistant-message.ts
#	packages/coding-agent/src/sdk.ts
#	packages/tui/src/components/markdown.ts
2026-06-12 11:24:26 +02:00
can1357 12bada4ce0 fix: hardened deferred MCP discovery and streaming render fast paths
- Recomputed `tools.discoveryMode: "auto"` in the deferred MCP closure in `sdk.ts` once the real tool count is known: a toolset crossing the threshold now flips discovery on, registers and activates `search_tool_bm25`, and skips `activateAll` instead of force-activating every MCP tool.
- Guarded the deferred MCP task against disposed sessions: added `AgentSession.isDisposed` and `enableMCPDiscovery()`, and the late connect now calls `disconnectAll()` instead of refreshing tools onto a dead session.
- Cleared `#fastPathKey`/`#fastPathItems` in `AssistantMessageComponent.invalidate()` so theme/symbol changes rebuild reused Markdown children instead of keeping stale captured themes.
- Memoized unusable read summaries as a `false` sentinel in `read.ts` so the per-session LRU no longer retains full sources of unsummarizable files.
- Broadened `HAS_REF_DEF` in `markdown.ts` to match backslash-escaped reference labels (`[a\]b]: x`) and cleared frozen stream-lex state on blank `setText()`.
- Added regression tests: deferred auto-discovery flip and mid-connect dispose (`sdk-mcp-auto-discovery.test.ts` + `many-tools-mcp.ts` fixture), fast-path child rebuild on invalidate, and escaped-ref-def incremental-lex equivalence.
2026-06-12 11:14:39 +02:00
can1357 9f79c5e353 feat(coding-agent): Color segment track segments by position on HSV hue band
Dynamically assigns segment colors by sweeping across the full HSV hue spectrum based on their track position. This ensures each segment has a distinct, predictable hue and removes the need for explicit `color` assignments.
2026-06-12 10:37:21 +02:00
can1357 a1a7131cc5 fix(coding-agent): prevented provisional tool previews from committing to scrollback
- Added commit-stability signaling to transcript blocks and marked tool previews as unstable until expanded or finalized.
- Updated transcript scrollback promotion to derive live commit state only for blocks reporting commit-stable rows.
- Added tests ensuring provisional pending edit previews are never committed while durable live rows still promote after the stability window.
2026-06-12 05:53:39 +02:00