Commit Graph
188 Commits
Author SHA1 Message Date
Mario Zechner b10fa86ff9 Merge branch 'feat/resume-slash-command' 2025-12-05 22:54:03 +01:00
Mario Zechner 3be445de80 feat(coding-agent): add /resume command to switch sessions mid-conversation
- Opens interactive session selector
- Properly aborts in-flight agent turns before switching
- Restores model and thinking level from resumed session
- Clears UI state (queued messages, pending tools, etc.)

closes #117
2025-12-05 22:53:51 +01:00
Mario Zechner a6867016df Merge feat/scroll-previous-prompts with history load on resume 2025-12-05 22:02:16 +01:00
Mario Zechner 13e3f8d935 feat(tui): add prompt history navigation with Up/Down arrows
- Browse previously submitted prompts using Up/Down arrow keys
- History is session-scoped and stores up to 100 entries
- Load history from session on continue/resume
- Includes 15 tests for history navigation

fixes #121
2025-12-05 22:00:23 +01:00
Markus YlisiurunenandGitHub 3ca9d6f70a Implement fuzzy search for model/session selector and improve Input multi-key sequence handling (#122)
* implement fuzzy search and filtering for tui selectors

* update changelog and readme

* add correct pr to changelog
2025-12-05 20:33:04 +01:00
Nico Bailon b9525642cf feat(tui): add prompt history navigation with Up/Down arrows
Browse previously submitted prompts using Up/Down arrow keys, similar to
shell history and Claude Code's prompt history feature.

- Up arrow when editor is empty: browse to older prompts
- Down arrow when browsing: return to newer prompts or clear editor
- Cursor movement within multi-line history entries supported
- History is session-scoped, stores up to 100 entries
- Consecutive duplicates are not added to history

Includes 15 new tests for history navigation behavior.
2025-12-05 07:57:42 -08:00
Mario Zechner 73baa40d9c fix: make footer token counts more compact
- Use M suffix for millions (e.g., 10.2M instead of 10184k)
- Change '% of' to '%/' for context display
2025-12-05 12:21:44 +01:00
Mario Zechner 39b434c801 fix: footer overflow crash on narrow terminals
Footer stats line now truncates gracefully when terminal width is too
narrow to fit all stats, instead of overflowing and crashing the TUI.
2025-12-05 12:17:56 +01:00
Mario Zechner bf2c8aae44 fix: strip remaining escape sequences from bash output
stripAnsi misses some escape sequences like standalone ESC \ (String
Terminator) which caused rendering issues when displaying captured TUI
output. Now also removes any remaining ESC+char sequences and control
characters after stripAnsi processing.
2025-12-05 12:13:33 +01:00
Mario Zechner 4e1bcd616d fix: TUI crash with Unicode characters in branch selector
- Use truncateToWidth instead of substring in user-message-selector.ts
- Fix truncateToWidth to use Intl.Segmenter for proper grapheme handling
- Add tests for Unicode truncation behavior
2025-12-05 11:59:39 +01:00
Hew Li Yang 787706a487 wip: add /resume slash command 2025-12-05 18:49:24 +08:00
Mario Zechner 155360a191 Add authHeader option and fix print mode error handling
- Add 'authHeader' boolean option to models.json provider config
  When true, adds 'Authorization: Bearer <apiKey>' to model headers
  Useful for providers requiring explicit auth headers (fixes #81)

- Fix print mode (-p) silently failing on errors
  Now outputs error message to stderr and exits with code 1
  when assistant message has stopReason of error/aborted
2025-12-05 11:31:14 +01:00
Mario Zechner 6de565595a Improve compaction UI styling
- Simplified collapsed state: warning-colored text instead of styled banner
- Shows token count inline: 'Earlier messages compacted from X tokens'
- Removed redundant success message after compaction
- Cleaner vertical spacing using paddingY instead of explicit Spacers

Fixes #108
2025-12-05 11:05:04 +01:00
Mario Zechner 4e229ab4fe Merge hide-thinking branch (PR #113) 2025-12-05 10:48:53 +01:00
Mario Zechner 4473d5aca3 Fix spacer after hidden thinking block, add contributor link to CHANGELOG 2025-12-05 10:48:28 +01:00
Markus Ylisiurunen 11bda7ffd9 add ctrl+t shortcut to toggle llm thinking block visibility 2025-12-05 09:48:35 +02:00
Markus Ylisiurunen 9e60b41077 allow toggling visibility of the assistant's thinking block 2025-12-05 09:43:09 +02:00
Markus Ylisiurunen 9d7d7b6a25 support appending content to the system prompt via cli argument 2025-12-05 09:25:10 +02:00
Markus YlisiurunenandGitHub 2583d8701c improve readability of context usage display calculation (#111) 2025-12-05 01:38:31 +01:00
Markus Ylisiurunen 673858dc7f add cross-platform clipboard support and /copy command 2025-12-04 09:16:11 +02:00
Mario Zechner 5622cbd0cc Release v0.12.8 2025-12-04 03:59:20 +01:00
Mario Zechner 8f193790fb docs(coding-agent): add /compact, /autocompact commands and Context Compaction section
- Add /compact and /autocompact slash command documentation
- Add Context Compaction section explaining how it works, manual/auto modes, configuration
- Update /autocompact output to match thinking level toggle style (dimmed text)
- Remove Planned Features section (auto-compaction now implemented)
2025-12-04 02:56:03 +01:00
Mario Zechner 7ab3d33ae7 feat(coding-agent): add auto-compaction to RPC mode, add RPC compaction test
- RPC mode now auto-compacts when context exceeds threshold (same as TUI)
- Add RPC test for manual compaction via compact command
- Auto-compaction emits compaction event with auto: true flag
2025-12-04 02:49:22 +01:00
Mario Zechner b6a4b05796 perf(coding-agent): avoid loading session file for auto-compaction check
Use agent.state.messages instead of loading entries from disk
2025-12-04 02:42:43 +01:00
Mario Zechner 28348c600c feat(coding-agent): context compaction with /compact, /autocompact, and auto-trigger
- Add /compact command for manual context compaction with optional custom instructions
- Add /autocompact command to toggle automatic compaction
- Auto-trigger compaction when context usage exceeds threshold (contextWindow - reserveTokens)
- Add CompactionComponent for TUI display with collapsed/expanded states
- Add compaction events to HTML export with collapsible summary
- Refactor export-html.ts to eliminate duplication between session and streaming formats
- Use setTimeout to break out of agent event handler for safe async compaction
- Show compaction summary in TUI after compaction completes

fixes #92
2025-12-04 02:39:54 +01:00
Mario Zechner 900811f610 Wire up /compact and /autocompact slash commands 2025-12-04 00:31:21 +01:00
Mario Zechner 7d8a3a0a88 Context compaction: commands, auto-trigger, RPC support, /branch rework (fixes #92)
- Add compaction settings to Settings interface
- /compact [instructions]: manual compaction with optional focus
- /autocompact: toggle auto-compaction on/off
- Auto-compaction triggers after assistant message_end when threshold exceeded
- Footer shows (auto) when auto-compact is enabled
- RPC mode: {type: 'compact'} command emits CompactionEntry
- /branch now reads from session file to show ALL historical user messages
- createBranchedSessionFromEntries preserves compaction events
2025-12-04 00:25:53 +01:00
Mario Zechner e9b4fda9d3 WIP: Context compaction core logic (#92)
- Add CompactionEntry type with firstKeptEntryIndex
- Add loadSessionFromEntries() for compaction-aware loading
- Add compact() function that returns CompactionEntry
- Add token calculation and cut point detection
- Add tests with real session fixture and LLM integration

Still TODO: settings, /compact and /autocompact commands, auto-trigger in TUI, /branch rework
2025-12-04 00:07:53 +01:00
Mario Zechner 93824fe185 fix: normalize OpenAI token counting, add branch source tracking
pi-ai:
- Fixed usage.input to exclude cached tokens for OpenAI providers
- Previously input included cached tokens, causing double-counting
- Now input + output + cacheRead + cacheWrite correctly gives total context

coding-agent:
- Session header now includes branchedFrom field for branched sessions
- Updated compaction.md with refined implementation plan
- Updated session.md with branchedFrom documentation
2025-12-03 17:11:22 +01:00
Mario Zechner e159e8c8fa fix(coding-agent): use APP_NAME in export-html and tools-manager 2025-12-03 16:27:49 +01:00
Mario Zechner eddbff982e feat(coding-agent): configurable app name and config dir for forks (#95)
- Add piConfig to package.json for app name and config directory
- Consolidate paths.ts into config.ts with clearer naming
- Fix Bun binary detection (changed from %7EBUN to $bunfs)
- Update all hardcoded paths to use config.ts exports
- getThemesDir() for built-in themes, getCustomThemesDir() for user themes
2025-12-03 16:18:59 +01:00
Mario Zechner 1e79eabdbd Add comprehensive RPC protocol documentation 2025-12-03 15:22:20 +01:00
badlogic 350d9c046d Fix Windows terminal background rendering and add /debug command
- Strip carriage return characters from bash tool output to fix background padding on Windows
- Add hidden /debug command to write rendered lines to debug log for TUI debugging
- Document /debug command in README.md development section
2025-12-02 13:22:54 +01:00
badlogic 40ab295f65 Enable truecolor support for Windows Terminal 2025-12-02 13:04:05 +01:00
badlogic 077e6f6cd9 Fix Windows binary path resolution for Bun compiled executable 2025-12-02 12:58:00 +01:00
Mario Zechner 53bf63714c feat: standalone binary support with Bun
- Add build:binary script for Bun compilation
- Add paths.ts for cross-platform asset resolution (npm/bun/tsx)
- Add GitHub Actions workflow for automated binary releases
- Update README with installation options

Based on #89 by @steipete
2025-12-02 12:18:42 +01:00
Mario Zechner 7aae0d8a59 feat: show (sub) indicator in footer when using OAuth subscription 2025-12-02 09:34:37 +01:00
Mario Zechner ace6ec78f2 fix: use TruncatedText in oauth-selector to prevent line overflow 2025-12-02 09:28:27 +01:00
Peter Steinberger a961305a16 feat(coding-agent): show login status in OAuth provider selector
Display '✓ logged in' indicator next to providers where the user is already authenticated. This makes it clear at a glance whether you're using your Claude Pro/Max subscription.
2025-12-02 07:35:00 +00:00
Mario Zechner 824b1fba03 Release v0.11.5 2025-12-01 20:22:14 +01:00
Mario Zechner 8beecda3f1 Release v0.11.4 2025-12-01 13:05:12 +01:00
86123d3c73 feat(tui): add circular wrap-around navigation to all menus (#82)
Co-authored-by: xes garcia <xes.garcia@deus.ai>
2025-12-01 02:49:38 +01:00
Mario Zechner f48654a244 fix: RPC mode session management not saving sessions
Since version 0.9.0, RPC mode (--mode rpc) was not saving messages to
session files. The agent.subscribe() call with session management logic
was only present in the TUI renderer after it was refactored.

RPC mode now properly saves sessions just like interactive mode.

Added test for RPC mode session management to prevent regression.

Fixes #83

Thanks @kiliman for reporting this issue!
2025-12-01 01:19:17 +01:00
Mario Zechner 2b730cc479 feat(coding-agent): add --export CLI flag to convert session files to HTML
Closes #80
2025-11-29 23:05:07 +01:00
Tino EhrichandGitHub b58d7cc5b1 feat(coding-agent): watch .git/HEAD for branch changes (#79)
Auto-updates footer when git branch changes externally (e.g., git checkout in another terminal)
2025-11-29 21:52:13 +01:00
Mario Zechner 5517b1acc7 feat(coding-agent): add read-only exploration tools (grep, find, ls) and --tools flag
Add grep, find, and ls tools for safe code exploration without modification risk.
These tools are available via the new --tools CLI flag.

- grep: Uses ripgrep (auto-downloaded) for fast regex searching. Respects .gitignore,
  supports glob filtering, context lines, and hidden files.
- find: Uses fd (auto-downloaded) for fast file finding. Respects .gitignore, supports
  glob patterns, and hidden files.
- ls: Lists directory contents with proper sorting and directory indicators.
- --tools flag: Specify available tools (e.g., --tools read,grep,find,ls for read-only mode)
- Dynamic system prompt adapts to selected tools with relevant guidelines

Closes #74
2025-11-29 00:59:23 +01:00
Mario Zechner 0329440f26 fix: file @ autocomplete performance using fd
- Replace slow synchronous directory walking with fd for fuzzy file search
- Auto-download fd to ~/.pi/agent/tools/ if not found in PATH
- Performance improved from ~900ms to ~10ms per keystroke on large repos
- Remove minimatch dependency from tui package
- Graceful degradation if fd unavailable (empty results)

Fixes #69
2025-11-28 23:38:44 +01:00
Mario Zechner da34de2503 Restore prompt to editor on API key validation failure
fixes #77
2025-11-28 23:00:37 +01:00
Mario Zechner 399e6b3bac coding-agent: remove identity override from system prompt (#73)
Models now use their native identity instead of being told they are Pi.
2025-11-27 23:57:02 +01:00
Mario Zechner 03b3eb1953 coding-agent: add pi-session- prefix to exported HTML files (#72)
Makes exported session files easier to filter with .gitignore
2025-11-27 23:54:10 +01:00