Commit graph

293 commits

Author SHA1 Message Date
Mario Zechner
5d7bc60cff Replace Markdown with Text component for tool execution
- Add background color support to Text component
- Replace Markdown component with Text in ToolExecutionComponent
- Use chalk.bold for formatting instead of markdown syntax
- Remove unnecessary markdown parsing overhead
2025-11-11 21:27:23 +01:00
Mario Zechner
10520a8c41 Fix read/write tool output formatting
- Remove code fences (```) from read output - show raw content
- Show first 10 lines instead of 5 for read
- Only show line count for write if > 10 lines
- Remove indentation from read output
- Cleaner, more minimal tool output display
2025-11-11 21:22:08 +01:00
Mario Zechner
4fa09814bd Refactor TUI components into separate files
- Move TUI components into src/tui/ folder
- Split out CustomEditor, StreamingMessageComponent, ToolExecutionComponent, FooterComponent
- Trim assistant message text content
- Add newline after per-message token/cost stats
- Improve code organization and maintainability
2025-11-11 21:16:31 +01:00
Mario Zechner
fe5706885d Clean up bash output formatting
- Remove "Command aborted by user" message (Aborted already shown separately)
- Remove STDOUT/STDERR labels - just show output cleanly
- Stderr is now separated by newline without labels
- Timeout and error messages moved to end of output
2025-11-11 21:09:50 +01:00
Mario Zechner
6e9fa8dde1 Fix bash abort to kill entire process tree immediately
- Switch from exec() to spawn() with detached: true
- Create new process group for spawned commands
- Kill entire process group with process.kill(-pid) on abort
- This ensures commands like "sleep 4 && echo hello" abort immediately
- Previous implementation only killed parent shell, leaving subprocesses running
2025-11-11 21:07:39 +01:00
Mario Zechner
ea5097e13e Add thinking trace support and improve bash output formatting
- Render thinking traces in dark gray italic in final messages
- Show thinking as italic markdown in streaming view
- Remove code fences from bash output for cleaner minimal display
- Remove superfluous empty line after tool executions
- Thinking blocks now render inline in proper order with text
2025-11-11 21:01:42 +01:00
Mario Zechner
8fa780e052 Improve TUI instructions and thinking selector styling
- Add ctrl+k to delete line instruction
- Change all "set x to y" confirmation messages to blue with padding
- Add blue top and bottom borders around thinking selector dialog
2025-11-11 20:53:27 +01:00
Mario Zechner
ba8d802999 Add interactive UI selector for /thinking command
- /thinking now opens a SelectList UI component to choose thinking level
- Temporarily replaces the editor with the selector
- Shows 5 levels (off, minimal, low, medium, high) with descriptions
- Supports keyboard navigation (arrows, enter, escape)
- Shows confirmation message after selection
- Maintains backward compatibility with /thinking <level> direct syntax
2025-11-11 20:49:20 +01:00
Mario Zechner
71fb1b9173 Put each instruction on its own line and add file drop hint 2025-11-11 20:43:17 +01:00
Mario Zechner
fb4893d8d4 Clear scrollback buffer on full TUI re-renders 2025-11-11 20:42:40 +01:00
Mario Zechner
9b20b91a99 Make stats darker gray and remove extra newline after header 2025-11-11 20:40:35 +01:00
Mario Zechner
9f0242d477 Replace logo with 'pi' + version from package.json 2025-11-11 20:38:56 +01:00
Mario Zechner
5627b3054a Improve logo design with decorative brackets 2025-11-11 20:35:50 +01:00
Mario Zechner
95d71920f3 Update welcome banner with minimal pi logo and improved instructions 2025-11-11 20:34:52 +01:00
Mario Zechner
ea01a758e0 Suppress punycode deprecation warning from dependencies 2025-11-11 20:32:49 +01:00
Mario Zechner
97e00fc45d Fix Escape key to cancel autocomplete before interrupting agent 2025-11-11 20:29:38 +01:00
Mario Zechner
dc1e2f928b Add /thinking command and improve TUI UX
- Add /thinking slash command with autocomplete for setting reasoning levels (off, minimal, low, medium, high)
- Fix Ctrl+C behavior: remove hardcoded exit in TUI, let focused component handle it
- Add empty lines before and after tool execution components for better visual separation
- Fix stats rendering: display stats AFTER tool executions complete (matches web-ui behavior)
- Remove "Press Ctrl+C again to exit" message, show "(esc to interrupt)" in loader instead
- Add bash tool abort signal support with immediate SIGKILL on interrupt
- Make Text and Markdown components return empty arrays when no actual text content
- Add setCustomBgRgb() method to Markdown for dynamic background colors
2025-11-11 20:28:10 +01:00
Mario Zechner
c5083bb7cb Fix markdown streaming duplication by splitting newlines first
- Added string-width library for proper terminal column width calculation
- Fixed wrapLine() to split by newlines before wrapping (like Text component)
- Fixed Loader interval leak by stopping before container removal
- Changed loader message from 'Loading...' to 'Working...'
2025-11-11 19:27:58 +01:00
Mario Zechner
985f955ea0 Clean up TUI package and refactor component structure
- Remove old TUI implementation and components (LoadingAnimation, MarkdownComponent, TextComponent, TextEditor, WhitespaceComponent)
- Rename components-new to components with new API (Loader, Markdown, Text, Editor, Spacer)
- Move Text and Input components to separate files in src/components/
- Add render caching to Text component (similar to Markdown)
- Add proper ANSI code handling in Text component using stripVTControlCharacters
- Update coding-agent to use new TUI API (requires ProcessTerminal, uses custom Editor subclass for key handling)
- Remove old test files, keep only chat-simple.ts and virtual-terminal.ts
- Update README.md with new minimal API documentation
- Switch from tsc to tsgo for type checking
- Update package dependencies across monorepo
2025-11-11 10:32:18 +01:00
Mario Zechner
1caa3cc1a7 Add line count to paste markers
- Paste markers now show line count: [paste #1 +50 lines]
- Update replacement logic to handle both old and new marker formats
- Provides better visibility into paste size
2025-11-11 00:24:40 +01:00
Mario Zechner
9dab1192ad Add padding to Text component and fix padding calculation
- Add paddingX and paddingY support to Text component (default 1, 1)
- Fix padding calculation bug in both Text and Markdown
- Right padding now correctly fills to terminal width
- Remove unused Spacer import from chat-simple
2025-11-11 00:22:31 +01:00
Mario Zechner
5f19dd62c7 Fix terminal rendering and add improvements
- Enable bracketed paste mode for handling large pastes
- Fix editor duplicate line rendering bug at terminal width
- Add padding support to Markdown component (paddingX/Y)
- Add Spacer component for vertical spacing
- Update chat-simple with spacers between messages
2025-11-11 00:13:46 +01:00
Mario Zechner
97c730c874 Add minimal TUI rewrite with differential rendering
- New TUI implementation with 3-strategy differential rendering
- Synchronized output (CSI 2026) for flicker-free updates
- New components: Editor, Markdown, Loader, SelectList, Spacer
- Editor: file autocomplete, slash commands, large paste markers
- Markdown: RGB background colors, caching
- Terminal: cursor movement, visibility, clear operations
- Chat demo with color-coded messages
2025-11-10 23:55:21 +01:00
Mario Zechner
904fc909c9 Fix lints 2025-11-10 21:55:55 +01:00
Mario Zechner
92bad8619c Removed agent-old 2025-11-10 21:55:01 +01:00
Mario Zechner
1f9a3a00cc Custom provider WIP 2025-11-10 21:47:21 +01:00
Mario Zechner
389c80d7a8 Improve web-ui message and tool UX
- Add collapsible thinking blocks with shimmer animation during streaming
- Update user messages to use orange gradient pill styling (matching sitegeist)
- Fix cost display to only show for completed messages, not while streaming
- Update tool renderers to use ChevronsUpDown/ChevronUp icons instead of rotating ChevronRight
- Export ThinkingBlock component from public API
2025-10-30 20:42:04 +01:00
Mario Zechner
cac353b3fe Limit max output tokens to 32k 2025-10-30 15:47:36 +01:00
Mario Zechner
9e50bb2c37 Fix ProviderKeyInput UX: improve save button state and remove clear button
- Add inputChanged state to track when user modifies input after save
- Remove Clear button and removeKey() method entirely
- Save button now disables after successful save until input changes
- Save button stays enabled on test failure (allows immediate retry)
- Keep input field showing stars (••••) after successful save instead of clearing

This provides clearer feedback and prevents accidental key deletion.
2025-10-29 21:14:19 +01:00
Mario Zechner
1726c1e3af Remove modelId from session metadata. Not needed, we grab it from the last assistantmessage. 2025-10-29 20:37:24 +01:00
Mario Zechner
129ec6063b Don't dedup models across providers. 2025-10-29 20:36:54 +01:00
Mario Zechner
92f8801864 Fix message editor height adjustment, requires Chrome +123 2025-10-29 16:11:05 +01:00
Mario Zechner
b6b64dff86 Better proxy handling. 2025-10-28 00:21:54 +01:00
Mario Zechner
ec50ede6c2 Release 0.5.48 2025-10-26 21:23:06 +01:00
Mario Zechner
e31973218e 0.0.2 2025-10-26 21:22:43 +01:00
Mario Zechner
bc8d994a7b Fix token statistics on abort for Anthropic provider
- Add handling for message_start event to capture initial token usage
- Fix message_delta to use assignment (=) instead of addition (+=)
  since Anthropic sends cumulative token counts, not incremental
- Add comprehensive tests for all providers (Google, OpenAI Completions,
  OpenAI Responses, Anthropic)
- Document OpenAI limitation: token stats only available at stream end

Fixes issue where aborted streams had zero token counts despite
Anthropic sending input tokens in the initial message_start event.
2025-10-26 21:22:24 +01:00
Mario Zechner
23be934a9a Relesae 0.5.47 2025-10-26 00:45:52 +02:00
Mario Zechner
55dc0b6e08 Add timestamp to messages 2025-10-26 00:43:43 +02:00
Mario Zechner
ef09efaac9 Fix XLSX dependency 2025-10-22 13:09:18 +02:00
Mario Zechner
a94b19e1df Fix dependencies 2025-10-22 13:05:24 +02:00
Mario Zechner
368ffb66aa Update models and mini-lit dependency 2025-10-22 13:01:39 +02:00
Mario Zechner
4ecbc2fe81 Debug tool rendering. 2025-10-18 01:11:31 +02:00
Mario Zechner
2d5054e6c0 Add reload button to HTML artifact header
Adds a reload button with RefreshCw icon to HTML artifact header buttons.
Clicking the button clears logs and re-executes the HTML content, useful
for manually refreshing when developing HTML artifacts or testing changes.

Changes:
- Import Button, icon from mini-lit and RefreshCw from lucide
- Add reload button to getHeaderButtons() that clears logs and calls executeContent()
- Add "Reload HTML" i18n key in English and German translations
2025-10-18 00:13:16 +02:00
Mario Zechner
92ce5a342f Add auto-reload for HTML artifacts when dependencies change
HTML artifacts can read other artifacts via getArtifact() and attachments.
When any artifact is created, updated, rewritten, or deleted, all HTML
artifacts now automatically reload to reflect the latest data.

Changes:
- Add reloadAllHtmlArtifacts() method to ArtifactsPanel
- Call reload after all artifact mutations (create/update/rewrite/delete)
- Make HtmlArtifact.sandboxIframeRef and executeContent() public
- Update runtime providers before re-executing HTML content

This ensures HTML artifacts always display current data from their dependencies.
2025-10-18 00:10:23 +02:00
Mario Zechner
2a7ccf0fcb Updates to prompts 2025-10-17 22:44:03 +02:00
Mario Zechner
ffc9be8867 Agent package + coding agent WIP, refactored web-ui prompts 2025-10-17 11:47:01 +02:00
Mario Zechner
4e7a340460 Add Unicode surrogate sanitization for all providers
Fixes issue where unpaired Unicode surrogates in tool results cause JSON serialization errors in API providers, particularly Anthropic.

- Add sanitizeSurrogates() utility function to remove unpaired surrogates
- Apply sanitization in all provider convertMessages() functions:
  - User message text content (string and text blocks)
  - Assistant message text and thinking blocks
  - Tool result output
  - System prompts
- Valid emoji (properly paired surrogates) are preserved
- Add comprehensive test suite covering all 8 providers

Previously only Google and Groq handled unpaired surrogates correctly.
Now all providers (Anthropic, OpenAI Completions/Responses, Google, xAI, Groq, Cerebras, zAI) sanitize text before API submission.
2025-10-13 14:26:54 +02:00
Mario Zechner
949cd4efd8 Fix console.log duplication bug in ConsoleRuntimeProvider
Issue:
Each browser_javascript execution wrapped console methods, but captured
the current (already wrapped) console as "original". This created a chain
of wrappers that accumulated across executions:
- Execution 1: 1x console.log (wrapper1 → real console)
- Execution 2: 2x console.log (wrapper2 → wrapper1 → real console)
- Execution 3: 3x console.log (wrapper3 → wrapper2 → wrapper1 → real console)
- Execution 4: 4x console.log (and so on...)

Fix:
Store the truly original console methods in window.__originalConsole on
first wrap only. All subsequent executions use these stored original methods
instead of capturing the current console. This prevents wrapper accumulation.

Changes:
- Check if window.__originalConsole exists before wrapping
- Store original console methods with .bind() to preserve context
- Always use window.__originalConsole for local logging
- Now each execution logs exactly 1x regardless of execution count
2025-10-13 00:20:23 +02:00
Mario Zechner
f66d577eb2 Add paste image support to MessageEditor
- Add handlePaste method to detect and process pasted images
- Automatically attach pasted images as attachments
- Support multiple images in single paste
- Prevent default paste behavior for images (text paste still works normally)
- Use same loadAttachment utility as drag-and-drop for consistency
2025-10-12 19:47:38 +02:00
Mario Zechner
4079bced36 Fix TypeScript errors and export UserMessageWithAttachments
- Export UserMessageWithAttachments type from web-ui index
- Remove unused i18n import from extract-document tool
- Update models.generated.ts (model order changes from API)

This fixes type errors when sitegeist uses custom user message renderer
2025-10-12 17:09:14 +02:00