Commit graph

28 commits

Author SHA1 Message Date
Danila Poyarkov
a497fccd06
refactor: use configurable keybindings for all UI hints (#724)
Follow-up to #717. Replaces all remaining hardcoded keybinding hints with configurable ones.

- Add pasteImage to AppAction so it can be configured in keybindings.json
- Create keybinding-hints.ts with reusable helper functions:
  - editorKey(action) / appKey(keybindings, action) - get key display string
  - keyHint(action, desc) / appKeyHint(kb, action, desc) / rawKeyHint(key, desc) - styled hints
- Export helpers from components/index.ts for extensions
- Update all components to use configured keybindings
- Remove now-unused getDisplayString() from KeybindingsManager and EditorKeybindingsManager
- Use keybindings.matches() instead of matchesKey() for pasteImage in custom-editor.ts
2026-01-14 15:42:03 +01:00
Mario Zechner
c16e21331a Preserve tree selection when returning from summary selector or abort 2026-01-12 00:15:12 +01:00
Helmut Januschka
7574fed2f2 feat: use keybindings in all selectors and lists
Update all selector/list components to use EditorKeybindingsManager:
- model-selector, session-selector, oauth-selector, user-message-selector
- hook-selector, hook-input, hook-editor, tree-selector
- select-list, settings-list, cancellable-loader

This allows users to configure selectUp, selectDown, selectConfirm,
selectCancel actions in keybindings.json
2026-01-03 08:23:56 +01:00
Helmut Januschka
8f2682578b feat: configurable keybindings for all editor and app actions
All keybindings configurable via ~/.pi/agent/keybindings.json

Editor actions:
- cursorUp, cursorDown, cursorLeft, cursorRight
- cursorWordLeft, cursorWordRight, cursorLineStart, cursorLineEnd
- deleteCharBackward, deleteCharForward, deleteWordBackward
- deleteToLineStart, deleteToLineEnd
- newLine, submit, tab
- selectUp, selectDown, selectConfirm, selectCancel

App actions:
- interrupt, clear, exit, suspend
- cycleThinkingLevel, cycleModelForward, cycleModelBackward
- selectModel, expandTools, toggleThinking, externalEditor

Also adds support for numpad Enter key (Kitty protocol codepoint 57414
and SS3 M sequence)

Example emacs-style keybindings.json:
{
  "cursorUp": ["up", "ctrl+p"],
  "cursorDown": ["down", "ctrl+n"],
  "cursorLeft": ["left", "ctrl+b"],
  "cursorRight": ["right", "ctrl+f"],
  "deleteCharForward": ["delete", "ctrl+d"],
  "cycleModelForward": "ctrl+o"
}
2026-01-03 08:23:56 +01:00
Mario Zechner
1ed8a25563 Hide model_change and thinking_level_change in tree selector default view 2025-12-30 22:42:25 +01:00
Mario Zechner
ca457bd0ca Update tree selector help text to show Shift+^O for reverse filter cycling 2025-12-30 22:42:25 +01:00
Mario Zechner
ae351257b6 Fix tree selector: proper selectedBg theme color, correct filter logic
- Add selectedBg theme color for active line highlight
- Fix filter modes:
  - no-tools: default minus tool results (still hides label/custom)
  - user-only: just user messages
  - labeled-only: just labeled entries
  - all: everything
- Update theme.md with new color tokens (50 total)
2025-12-30 22:42:25 +01:00
Mario Zechner
e4df5d14b5 Tree selector improvements: active line highlight and tool filter
- Add inverse background highlight for selected/active line
- Add 'no-tools' filter mode to hide tool results
- Add isShiftCtrlO to cycle filters backwards
- Filter order: default → no-tools → user-only → labeled-only → all
2025-12-30 22:42:25 +01:00
Mario Zechner
01dae9ebcc Fix branch summarization abort handling and tree navigation
- Check response.stopReason instead of catching errors for abort detection
- Return result object from _generateBranchSummary instead of throwing
- Fix summary attachment: attach to navigation target position, not old branch
- Support root-level summaries (parentId=null) in branchWithSummary
- Remove setTimeout hack for re-showing tree selector on abort
2025-12-30 22:42:23 +01:00
Mario Zechner
159e19a010 Fix tree selector gutter alignment, add page navigation, improve styling
- Fix gutter/connector alignment by tracking gutter positions with GutterInfo
- Convert recursive markContains to iterative to avoid stack overflow
- Add left/right arrow keys for page up/down navigation
- Consistent assistant message styling (green prefix, appropriate status colors)
- Remove leaf marker (*), active path bullets are sufficient
- Add Expandable interface for toggle expansion
- Fix BranchSummaryMessageComponent expansion toggle
2025-12-30 22:42:23 +01:00
Mario Zechner
975e90ea8c fix(coding-agent): prioritize active branch in sorting and fix gutters spacing 2025-12-30 22:42:23 +01:00
Mario Zechner
97e5e8c918 fix(coding-agent): use smaller bullet marker with space for active path 2025-12-30 22:42:23 +01:00
Mario Zechner
3493e47b4d fix(coding-agent): move active path marker to right before entry text 2025-12-30 22:42:23 +01:00
Mario Zechner
96c071b4c4 feat(coding-agent): highlight active path with ● marker in tree selector 2025-12-30 22:42:23 +01:00
Mario Zechner
8d3b4dd762 fix(coding-agent): keep gutters when rendering virtual root children 2025-12-30 22:42:23 +01:00
Mario Zechner
6465bc502f fix(coding-agent): show gutters without connectors on virtual root children 2025-12-30 22:42:23 +01:00
Mario Zechner
d568ebd659 feat(coding-agent): add gutters and connectors back to tree selector
- Show ├─ for non-last siblings, └─ for last sibling
- Show │ gutter for descendants of non-last siblings
- Properly handle multiple roots display shift
2025-12-30 22:42:23 +01:00
Mario Zechner
e50eae1054 fix(coding-agent): display multiple roots at indent 0, keep child logic intact 2025-12-30 22:42:23 +01:00
Mario Zechner
32ec1fa883 fix(coding-agent): treat multiple roots as children of virtual branching root 2025-12-30 22:42:23 +01:00
Mario Zechner
7c103ddc55 refactor(coding-agent): simplify tree indentation
- At indent 0: stay flat unless parent branches
- At indent 1: children go to indent 2 (visual grouping)
- At indent 2+: stay flat for single-child chains
- Remove gutter/connector complexity for now
2025-12-30 22:42:23 +01:00
Mario Zechner
6fbc3a01ef refactor(coding-agent): cleaner tree gutter/indent logic
- Only indent when parent has siblings (branch point)
- gutterLevels array tracks which levels need │ vs spaces
- connector: none/branch/last for ├─/└─ display
2025-12-30 22:42:23 +01:00
Mario Zechner
1d90592df1 fix(coding-agent): always show error/aborted assistant messages in tree 2025-12-30 22:42:23 +01:00
Mario Zechner
5726770d1f fix(coding-agent): always show current leaf in tree selector even if aborted/error 2025-12-30 22:42:22 +01:00
Mario Zechner
2922020382 feat(coding-agent): improve tree selector tool display
- Tool results show formatted call info like [read: path:1-10], [bash: cmd]
- Skip assistant messages with stopReason error/aborted
- Skip assistant messages with only tool calls (no text)
- Format built-in tools like tool-execution.ts (read, write, edit, bash, grep, find, ls)
- Custom tools show truncated JSON args
2025-12-30 22:42:22 +01:00
Mario Zechner
b153b528e8 feat(coding-agent): show tool name instead of result content in tree selector 2025-12-30 22:42:22 +01:00
Mario Zechner
6b7ad0ed4b feat(coding-agent): reimplement tree selector features
- Label editing with 'l' key
- Ctrl+O cycles through filters: default -> user-only -> labeled-only -> all
- Preserve cursor position when toggling filters
- Labels shown at front of node
- Normalize tabs/newlines in content
- extractContent limited to 200 chars for performance
- truncateToWidth on all rendered lines
- Iterative flattenTree to avoid stack overflow
- Linear chain optimization (no indent for single-child chains)
2025-12-30 22:42:22 +01:00
Mario Zechner
1f4594598b feat(coding-agent): add search to /tree selector
- Type to filter nodes by matching tokens in content
- Search field always visible above tree
- Backspace removes chars, Escape clears search
- Restructured layout: title, border, help+search, border, tree, border
2025-12-30 22:42:22 +01:00
Mario Zechner
4958271dd3 feat(coding-agent): implement /tree command for session tree navigation
- Add TreeSelectorComponent with ASCII tree visualization
- Add AgentSession.navigateTree() for switching branches
- Add session_before_tree/session_tree hook events
- Add SessionManager.resetLeaf() for navigating to root
- Change leafId from string to string|null for consistency with parentId
- Support optional branch summarization when switching
- Update buildSessionContext() to handle null leafId
- Add /tree to slash commands in interactive mode
2025-12-30 22:42:22 +01:00