Commit graph

696 commits

Author SHA1 Message Date
Mario Zechner
ad42ebf5f5 Fix crash when bash mode outputs binary data
Sanitize shell output by removing Unicode Format characters and lone
surrogates that crash string-width. This fixes crashes when running
commands like curl that download binary files.
2025-12-08 23:26:58 +01:00
Mario Zechner
a054fecd11 Release v0.14.1 2025-12-08 22:59:46 +01:00
Mario Zechner
238c5d34e4 Fix tsgo type issues: update tsgo, fix ReasoningEffort import, remove broken enum-test 2025-12-08 22:59:13 +01:00
Mario Zechner
0bc8d79216 Release v0.14.0 2025-12-08 22:51:29 +01:00
Mario Zechner
21800035cd Merge branch 'bash-mode' 2025-12-08 22:49:28 +01:00
Mario Zechner
d5200b4f1c Add green borders around bash execution component 2025-12-08 22:45:05 +01:00
Mario Zechner
bd0d0676d4 Add bash mode for executing shell commands
- Add ! prefix in TUI editor to execute shell commands directly
- Output streams in real-time and is added to LLM context
- Supports multiline commands, cancellation (Escape), truncation
- Preview mode shows last 20 lines, Ctrl+O expands full output
- Commands persist in session history as bashExecution messages
- Add bash command to RPC mode via {type:'bash',command:'...'}
- Add RPC tests for bash command execution and context inclusion
- Update docs: rpc.md, session.md, README.md, CHANGELOG.md

Closes #112

Co-authored-by: Markus Ylisiurunen <markus.ylisiurunen@gmail.com>
2025-12-08 22:40:32 +01:00
Mario Zechner
1608da8770 Merge main into bash-mode 2025-12-08 21:39:01 +01:00
Tiago Freitas
8f67e00160
fix: include empty tools param when conversation has tool history (#150)
Anthropic (via LiteLLM/proxy) requires the `tools` parameter to be
present when messages include tool_calls or tool role messages,
even if no tools are currently being provided.

This adds a `hasToolHistory()` helper to detect if the conversation
contains tool calls or tool results, and ensures `tools: []` is
included in the request params when needed.

Fixes #149

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Ubuntu <ubuntu@ip-172-31-50-87.us-west-2.compute.internal>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 21:30:43 +01:00
Mario Zechner
00370cab39 Add xhigh thinking level for OpenAI codex-max models
- Add 'xhigh' to ThinkingLevel type in ai and agent packages
- Map xhigh to reasoning_effort: 'max' for OpenAI providers
- Add thinkingXhigh color token to theme schema and built-in themes
- Show xhigh option only when using codex-max models
- Update CHANGELOG for both ai and coding-agent packages

closes #143
2025-12-08 21:12:54 +01:00
Mario Zechner
87a1a9ded4 Add OpenAICompat for openai-completions provider quirks
Fixes #133
2025-12-08 19:02:03 +01:00
Mario Zechner
e34e0c503f Merge PR #137: Remove provider-level tool validation 2025-12-08 18:06:50 +01:00
Mario Zechner
8bec289dc6 Remove provider-level tool validation, add validateToolCall helper 2025-12-08 18:04:33 +01:00
Markus Ylisiurunen
0196308266 add option to skip provider tool call validation 2025-12-07 17:24:06 +02:00
Nico Bailon
2e3ff4a15a
Fix truncation test assertions to match new message format (#136) 2025-12-07 12:07:15 +01:00
Mario Zechner
a0bbc29201 Release v0.13.2 2025-12-07 01:25:17 +01:00
Mario Zechner
306f9cc660 Add changelog entry for tool output truncation (#134) 2025-12-07 01:24:41 +01:00
Mario Zechner
5a549cc7da Restore TUI warning notices for truncated tool output
Warnings now shown at bottom of tool execution (outside collapsed area)
so users can see truncation occurred even when content is collapsed.
2025-12-07 01:14:57 +01:00
Mario Zechner
b813a8b92b Implement tool result truncation with actionable notices (#134)
- read: actionable notices with offset for continuation
  - First line > 30KB: return empty + bash command suggestion
  - Hit limit: '[Showing lines X-Y of Z. Use offset=N to continue]'

- bash: tail truncation with temp file
  - Notice includes line range + temp file path
  - Edge case: last line > 30KB shows partial

- grep: pre-truncate match lines to 500 chars
  - '[... truncated]' suffix on long lines
  - Notice for match limit and line truncation

- find/ls: result/entry limit notices
  - '[N results limit reached. Use limit=M for more]'

- All notices now in text content (LLM sees them)
- TUI simplified (notices render as part of output)
- Never return partial lines (except bash edge case)
2025-12-07 01:11:31 +01:00
Mario Zechner
de77cd1419 Add tool output truncation with line/byte limits
- Add truncate.ts utility with truncateHead/truncateTail functions
- Both respect 2000 line and 30KB limits (whichever hits first)
- read: head truncation, returns truncation info in details
- bash: tail truncation, writes full output to temp file if large
- grep: head truncation + 100 match limit
- find: head truncation + 1000 result limit
- ls: head truncation + 500 entry limit
- tool-execution.ts displays truncation notices in warning color
- All tools return clean output + structured truncation in details
2025-12-07 00:03:16 +01:00
Mario Zechner
95eadb9ed7 Release v0.13.1 2025-12-06 23:12:36 +01:00
Mario Zechner
2641424bfa Add [Unreleased] section to CHANGELOG 2025-12-06 22:49:45 +01:00
Mario Zechner
ecdbd88f5d Release v0.13.0 2025-12-06 22:48:39 +01:00
Mario Zechner
86e5a70ec4 Add totalTokens field to Usage type
- Added totalTokens field to Usage interface in pi-ai
- Anthropic: computed as input + output + cacheRead + cacheWrite
- OpenAI/Google: uses native total_tokens/totalTokenCount
- Fixed openai-completions to compute totalTokens when reasoning tokens present
- Updated calculateContextTokens() to use totalTokens field
- Added comprehensive test covering 13 providers

fixes #130
2025-12-06 22:46:02 +01:00
badlogic
52f1a8cb31 Fix Windows binary detection for Bun compiled executables
- Updated isBunBinary detection to check for %7EBUN (URL-encoded ~BUN)
- Simplified build:binary script to remove Unix-specific shell syntax
- Binary now correctly locates supporting files next to executable on Windows
2025-12-06 22:42:47 +01:00
Mario Zechner
301c6ba11f Release v0.12.15 2025-12-06 21:29:03 +01:00
Mario Zechner
d7f84469a7 Fix editor crash with wide characters (emojis, CJK)
Editor text wrapping now uses grapheme-aware width calculation instead
of string length. Fixes crash when pasting text containing emojis like
 or CJK characters that are 2 terminal columns wide.
2025-12-06 21:24:26 +01:00
Mario Zechner
a325c1c7d1 Add context overflow detection utilities
Extract overflow detection logic into reusable utilities:
- isContextOverflowError() to detect overflow from error messages
- isContextOverflowFromUsage() to detect overflow from token usage
- Patterns for Anthropic, OpenAI, Google, xAI, Groq, OpenRouter, llama.cpp, LM Studio

Fixes #129
2025-12-06 21:24:15 +01:00
Mario Zechner
10a1e1ef90 docs: add under-compaction analysis
Documents context window overflow scenarios, how OpenCode and Codex
handle them, and what fixes are needed.

Related to #128
2025-12-06 14:53:05 +01:00
Peter Steinberger
fa77ef8b6a
docs: fix mini-lit links (#123) 2025-12-06 09:56:31 +01:00
Mario Zechner
ee83284dcf Fix wrap-ansi test to use node:test instead of vitest 2025-12-06 00:48:46 +01:00
Mario Zechner
4a972fbe6c Release v0.12.14 2025-12-06 00:46:57 +01:00
Mario Zechner
05849258b5 Release v0.12.13 2025-12-05 23:38:32 +01:00
Mario Zechner
bd3f5779d3 Add changelog entry for parallel version check 2025-12-05 23:36:30 +01:00
Mario Zechner
7352072bc2 Run version check in parallel with TUI startup
Instead of blocking startup for up to 1 second waiting for the version check,
run it in the background and insert the notification into chat when it completes.
2025-12-05 23:36:06 +01:00
Mario Zechner
c423734e36 Add [Unreleased] section 2025-12-05 23:01:46 +01:00
Mario Zechner
ddf09720cc Release v0.12.12 2025-12-05 23:00:45 +01:00
Mario Zechner
94d6c6704b Merge branch 'feat/resume-slash-command' 2025-12-05 22:54:03 +01:00
Mario Zechner
4bd52cf3ed 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
30dd31d787 Merge feat/scroll-previous-prompts with history load on resume 2025-12-05 22:02:16 +01:00
Mario Zechner
3a5185c5fd 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
Mario Zechner
6ec1391ebb fix: escape codes not properly wrapped during line wrapping
- ANSI codes now attach to next visible content, not trailing whitespace
- Rewrote AnsiCodeTracker to track individual attributes
- Line-end resets only turn off underline, preserving background colors
- Added vitest config to exclude node:test files

fixes #109
2025-12-05 21:49:44 +01:00
Markus Ylisiurunen
ff047e5ee1
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
c550ed2bca 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
ca39e899f4 docs: add changelog entry for footer display changes 2025-12-05 12:22:30 +01:00
Mario Zechner
5c388c0a77 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
6a29b2df3f Add [Unreleased] section 2025-12-05 12:20:35 +01:00
Mario Zechner
b193560ab0 Release v0.12.11 2025-12-05 12:19:37 +01:00
Mario Zechner
ef333af3d1 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
9375384371 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