Commit graph

186 commits

Author SHA1 Message Date
Thomas Mustier
520e3b02f3 feat(coding-agent): tweak queued hint text 2026-01-12 16:36:46 +01:00
Mario Zechner
175a137d00 Fix missing spacer between assistant message and text editor
Initialize widgetContainer with default spacer during init() instead of
only when extension widgets change.

fixes #655
2026-01-12 14:26:22 +01:00
Mario Zechner
50cd054edb Rework /scoped-models command UX
- Renamed from /models to /scoped-models
- Changes are now session-only by default (Ctrl+S to persist to settings)
- Added search with fuzzy filtering
- Hotkeys: Enter toggle, Ctrl+A enable all, Ctrl+X clear all, Ctrl+P toggle provider
- Ctrl+C clears search (or exits if empty), Escape exits
- Enabled models shown at top of list
- No checkmarks when all models enabled (no scope)
- First toggle when unscoped clears all and selects that model
- Uses current session thinking level instead of settings default
- Reads from session state first (preserves session-only changes across /scoped-models invocations)

Builds on #626
2026-01-12 00:53:52 +01:00
Mario Zechner
c16e21331a Preserve tree selection when returning from summary selector or abort 2026-01-12 00:15:12 +01:00
Mario Zechner
a0311fd5b9 Return to summary selector when cancelling custom instructions editor 2026-01-12 00:12:36 +01:00
Armin Ronacher
62caf219a1 Hook up custom summarization on branch switch 2026-01-12 00:09:33 +01:00
Mario Zechner
9d49b4d4ed Merge branch 'tmp-2025-01-11' - resume scope toggle with async loading (#620) 2026-01-12 00:00:28 +01:00
Mario Zechner
302404684f feat(coding-agent): add resume scope toggle with async loading
- /resume and --resume now toggle between Current Folder and All sessions with Tab
- SessionManager.list() and listAll() are now async with optional progress callback
- Shows loading progress (e.g. Loading 5/42) while scanning sessions
- SessionInfo.cwd field shows session working directory in All view
- Lazy loading: All sessions only loaded when user presses Tab

closes #619

Co-authored-by: Thomas Mustier <mustierthomas@gmail.com>
2026-01-12 00:00:03 +01:00
Mario Zechner
df3f5f41c0 Rename /branch command to /fork
- RPC: branch -> fork, get_branch_messages -> get_fork_messages
- SDK: branch() -> fork(), getBranchMessages() -> getForkMessages()
- AgentSession: branch() -> fork(), getUserMessagesForBranching() -> getUserMessagesForForking()
- Extension events: session_before_branch -> session_before_fork, session_branch -> session_fork
- Settings: doubleEscapeAction 'branch' -> 'fork'

fixes #641
2026-01-11 23:12:31 +01:00
Thomas Mustier
e8d91f2bd4 feat(coding-agent): add resume scope toggle
refactor(coding-agent): refine session listing helpers
2026-01-11 20:51:20 +00:00
Carlos Gutierrez
49acd8e648 Add /models command for enabling/disabling Ctrl+P model cycling
- New /models command with toggle UI for each available model
- Changes persist to enabledModels in settings.json
- Updates take effect immediately for Ctrl+P cycling
2026-01-11 19:36:36 +01:00
Mario Zechner
5db7cc693b fix: Model selector fuzzy search matches id + provider
Restores original behavior from 3de8e075. Allows multi-token queries
like 'opus anthropic' to match Anthropic models.
2026-01-11 18:04:57 +01:00
Mario Zechner
3592f9b7c9 fix: Model selector fuzzy search matches provider + id
Allows queries like 'anthropic opus' to match Anthropic models.
Previously only matched against model ID, so 'anthropic' token failed.
2026-01-11 18:00:52 +01:00
Mario Zechner
9655907624 feat: Add skill slash commands and fuzzy matching for all commands
- Skills registered as /skill:name commands for quick access
- Toggle via /settings or skills.enableSkillCommands in settings.json
- Fuzzy matching for all slash command autocomplete (type /skbra for /skill:brave-search)
- Moved fuzzy module from coding-agent to tui package for reuse

Closes #630 by @Dwsy (reimplemented with fixes)
2026-01-11 17:56:11 +01:00
Nico Bailon
271b49da3c feat: add ctx.ui.setWorkingMessage() extension API
Allows extensions to customize the streaming loader message.
Pass undefined to restore default.
2026-01-10 21:11:44 -08:00
Mario Zechner
019ad0ec11 Fix /changelog adding 'What's New' to footer permanently
fixes #613
2026-01-11 02:23:04 +01:00
Mario Zechner
0d2731cf6b Remove built-in tool override warning, closes #615 2026-01-11 02:20:32 +01:00
Mario Zechner
2787638561 Remove built-in tool override warning, closes #615 2026-01-11 02:20:32 +01:00
Armin Ronacher
5cf0490383 Add support for /model autocomplete 2026-01-10 20:32:16 +01:00
Mario Zechner
22b2a18952
Merge pull request #600 from nicobailon/feature/footer-data-provider
feat(coding-agent): add FooterDataProvider for git branch and extension statuses
2026-01-09 22:46:23 +01:00
Mario Zechner
e8eb4c254a feat: add search parameter and auto-select to /model command
- /model <search> pre-filters selector or auto-selects on exact match
- Support provider/model syntax for disambiguation (e.g., /model openai/gpt-4)
- Auto-select logic moved to InteractiveMode to avoid selector UI flicker

Closes #587
2026-01-09 22:39:26 +01:00
Mario Zechner
62a423a218 Adjust widget spacing with empty state 2026-01-09 21:42:44 +01:00
Mario Zechner
b95cb7503e Add PR/issue widget metadata and spacing 2026-01-09 21:40:29 +01:00
Thomas Mustier
902d5d3d05
Add Alt+Up hotkey to restore queued messages (#604) 2026-01-09 20:31:51 +01:00
Nico Bailon
7b902612e9 feat(coding-agent): add FooterDataProvider for git branch and extension statuses
Expose data that extensions cannot otherwise access: git branch and
extension statuses from setStatus(). Token stats, model info, etc.
remain computable via ctx.sessionManager and ctx.model.
2026-01-09 07:39:30 -08:00
Mario Zechner
2dfc13e455 chore: format 2026-01-08 23:41:58 +01:00
Mario Zechner
af2d8509e6 Fix --no-skills flag not preventing skills from loading
The --no-skills flag set options.skills = [] in main.ts, but the
interactive mode UI would rediscover skills anyway because it called
loadSkills() directly instead of using the already-loaded skills.

Changes:
- Add AgentSession.skills and AgentSession.skillWarnings properties
- discoverSkills() now returns { skills, warnings } instead of Skill[]
- Interactive mode uses session.skills instead of calling loadSkills()
- Update SDK docs and examples for new return type

Fixes #577
2026-01-08 23:41:54 +01:00
Mario Zechner
f9064c2f69 feat(tui): add overlay compositing for ctx.ui.custom() (#558)
Adds overlay rendering capability to the TUI, enabling floating modal
components that render on top of existing content without clearing the screen.

- Add showOverlay(), hideOverlay(), hasOverlay() methods to TUI
- Implement ANSI-aware line compositing via extractSegments()
- Support overlay stack (multiple overlays, later on top)
- Add { overlay: true } option to ctx.ui.custom()
- Add overlay-test.ts example extension

Also fixes pre-existing bug where bash tool output cached visual lines
at fixed terminal width, causing crashes on terminal resize.

Co-authored-by: Nico Bailon <nico.bailon@gmail.com>
2026-01-08 22:40:42 +01:00
Mario Zechner
121823c74d feat(coding-agent): add user_bash event and theme API extensions
- user_bash event for intercepting ! and !! commands (#528)
- Extensions can return { operations } or { result } to redirect/replace
- executeBashWithOperations() for custom BashOperations execution
- session.recordBashResult() for extensions handling bash themselves
- Theme API: getAllThemes(), getTheme(), setTheme() on ctx.ui
- mac-system-theme.ts example: sync with macOS dark/light mode
- Updated ssh.ts to use user_bash event
2026-01-08 21:50:56 +01:00
Mario Zechner
aa91864715 chore: add changelog for #571, init theme with watcher in interactive mode 2026-01-08 20:10:39 +01:00
Mario Zechner
7a2c19cdf0
Merge pull request #568 from tmustier/gemini-raw-stream
fix: restore ESC interrupt after auto-retry and correct retry abort messaging
2026-01-08 18:50:47 +01:00
ferologics
9073111cb0 fix(coding-agent): show release URL for bun binary updates
For bun binary installs, show 'Download from: <releases URL>' instead of 'npm install -g' since npm doesn't apply to standalone binaries.
2026-01-08 14:50:50 +01:00
Thomas Mustier
01f15fcbd2 fix: show retry attempt count when aborting during retry
When aborting a retry attempt, surface the retry-aware abort message
in the assistant output and tool results instead of a generic "Aborted".

- Set errorMessage for aborted streaming messages
- Render abort message without forcing a leading newline when no content
2026-01-08 12:36:46 +00:00
Thomas Mustier
a65da1c14b fix: ESC key not interrupting during Working... state
Three related fixes:

1. google-gemini-cli: Handle abort signal in stream reading loop
   - Add abort event listener to cancel reader immediately when signal fires
   - Fix AbortError detection in retry catch block (fetch throws AbortError,
     not our custom message)
   - Swallow reader.cancel() rejection to avoid unhandled promise

2. agent-session: Fix retry attempt counter showing 0 on cancel
   - abortRetry() was resetting _retryAttempt before the catch block could
     read it for the error message

3. interactive-mode: Restore main escape handler on agent_start
   - When auto-retry starts, onEscape is replaced with retry-specific handler
   - auto_retry_end (which restores it) fires on turn_end, after streaming begins
   - Now restore immediately on agent_start if retry handler is still active

Amended: suppress reader.cancel() rejection on abort.
2026-01-08 12:35:34 +00:00
Kao Félix
6845c4b85e
feat(coding-agent): make ctx.shutdown() available for extensions (#542) 2026-01-08 03:30:48 +01:00
Mario Zechner
6f726a2178 feat(coding-agent): add PI_SKIP_VERSION_CHECK env variable
Skip new version check at startup when set. Useful for Nix or other
package manager installs where npm install is not used.

Also documents PI_CODING_AGENT_DIR and other environment variables
in the README.

closes #549

Co-authored-by: Aos Dabbagh <25783780+aos@users.noreply.github.com>
2026-01-08 02:29:51 +01:00
Mario Zechner
5d39074a35 refactor(coding-agent): simplify InteractiveMode API
- Replace 11-param runInteractiveMode with InteractiveModeOptions
- Add InteractiveMode.run() that handles init, warnings, prompts, and loop
- Move version check, changelog loading, fdPath discovery inside InteractiveMode
- Detect resumed sessions via session.state.messages.length
- Export InteractiveModeOptions from modes/index.ts
2026-01-08 01:38:12 +01:00
Mario Zechner
cb3ac0ba9e refactor(coding-agent): simplify extension runtime architecture
- Replace per-extension closures with shared ExtensionRuntime
- Split context actions: ExtensionContextActions (required) + ExtensionCommandContextActions (optional)
- Rename LoadedExtension to Extension, remove setter methods
- Change runner.initialize() from options object to positional params
- Derive hasUI from uiContext presence (no separate param)
- Add warning when extensions override built-in tools
- RPC and print modes now provide full command context actions

BREAKING CHANGE: Extension system types and initialization API changed.
See CHANGELOG.md for migration details.
2026-01-07 23:50:18 +01:00
Mario Zechner
09471ebc7d feat(coding-agent): add ctx.ui.setEditorComponent() extension API
- Add setEditorComponent() to ctx.ui for custom editor components
- Add CustomEditor base class for extensions (handles app keybindings)
- Add keybindings parameter to ctx.ui.custom() factory (breaking change)
- Add modal-editor.ts example (vim-like modes)
- Add rainbow-editor.ts example (animated text highlighting)
- Update docs: extensions.md, tui.md Pattern 7
- Clean up terminal on TUI render errors
2026-01-07 16:11:49 +01:00
Nico Bailon
77477f6166 feat(coding-agent): add timeout option to extension dialogs with live countdown
Extension UI dialogs (select, confirm, input) now support a timeout option
that auto-dismisses with a live countdown display. Simpler alternative to
manually managing AbortSignal for timed dialogs.

Also adds ExtensionUIDialogOptions type export and updates RPC mode to
forward timeout to clients.
2026-01-06 21:49:27 -08:00
Mario Zechner
2015964c40
Merge pull request #512 from nicobailon/feat/abort-signal-ui-dialogs
Add AbortSignal support to extension UI dialogs
2026-01-07 00:10:20 +01:00
Nico Bailon
9771fa1e44 Add AbortSignal support to extension UI dialogs
Closes #474
2026-01-06 15:01:15 -08:00
Mario Zechner
03e3f0d801
Merge pull request #510 from mitsuhiko/annotate-bridge-prompt
Annotate bridge prompt
2026-01-06 23:47:02 +01:00
Mario Zechner
59d8b7948c Add ExtensionAPI methods, preset example, and TUI documentation improvements
- ExtensionAPI: setModel(), getThinkingLevel(), setThinkingLevel() methods
- New preset.ts example with plan/implement presets for model/thinking/tools switching
- Export all UI components from pi-coding-agent for extension use
- docs/tui.md: Common Patterns section with copy-paste code for SelectList, BorderedLoader, SettingsList, setStatus, setWidget, setFooter
- docs/tui.md: Key Rules section for extension UI development
- docs/extensions.md: Exhaustive example links for all ExtensionAPI methods and events
- System prompt now references docs/tui.md for TUI development

Fixes #509, relates to #347
2026-01-06 23:24:23 +01:00
Mario Zechner
999f97cd49 fix(coding-agent): update help text for ctrl+k and add !! shortcut 2026-01-06 21:27:35 +01:00
Tudor Oancea
f755f69e0a added custom header support and example extension 2026-01-06 21:20:19 +01:00
Thomas Mustier
3964984f59 fix(coding-agent): keep editor text on queued steering 2026-01-06 17:02:35 +00:00
Armin Ronacher
6a5f04ce1f Add the codex bridge prompt in the html export 2026-01-06 14:21:34 +01:00
Mario Zechner
7210086677 Extensions: add pi.sendUserMessage() for sending user messages
Adds sendUserMessage() to the extension API, allowing extensions to send
actual user messages (role: user) rather than custom messages. Unlike
sendMessage(), this always triggers a turn and behaves as if the user
typed the message.

- Add SendUserMessageHandler type and sendUserMessage() to ExtensionAPI
- Wire handler through loader, runner, and all modes
- Implement via prompt() with expandPromptTemplates: false
- Add send-user-message.ts example with /ask, /steer, /followup commands
- Document in extensions.md

fixes #483
2026-01-06 13:40:24 +01:00
Mario Zechner
f023af0dab Add ctx.ui.setFooter() for extensions to replace footer component
Extensions can now replace the built-in footer with a custom component:
- setFooter(factory) replaces with custom component
- setFooter(undefined) restores built-in footer

Includes example extension demonstrating context usage display.

Closes #481
2026-01-06 12:39:45 +01:00