Commit graph

109 commits

Author SHA1 Message Date
Mario Zechner
adbe47c255 chore: bump version to 0.7.3 2025-11-13 01:29:42 +01:00
Mario Zechner
d2e4a34772 fix: make read tool output more concise for images 2025-11-13 01:28:39 +01:00
Mario Zechner
39e22f1294 chore: bump versions to 0.7.2 2025-11-13 01:00:22 +01:00
Mario Zechner
6cf2ac0519 fix: remove debug context window size from footer 2025-11-13 01:00:06 +01:00
Mario Zechner
97ac82312f fix: update footer state when rendering initial messages on resume/continue 2025-11-13 00:58:20 +01:00
Mario Zechner
4019acf1f0 chore: bump versions to 0.7.1 2025-11-13 00:05:09 +01:00
Mario Zechner
383b67b5c0 feat: add tool call and result counts to /session command 2025-11-13 00:02:24 +01:00
Mario Zechner
b1410ef903 chore: bump versions to 0.7.0 2025-11-12 23:54:57 +01:00
Mario Zechner
29900ce647 feat: make bash tool timeout optional and configurable
- Add optional timeout parameter (in seconds) to bash tool
- No default timeout - commands run until completion unless specified
- Agent can provide timeout when needed for long-running commands
- Update README to reflect optional timeout
2025-11-12 23:53:27 +01:00
Mario Zechner
60cea11f37 chore: bump versions to 0.6.3 2025-11-12 23:51:08 +01:00
Mario Zechner
a2dc1187dc fix: handle Windows paths in session directory generation
- Replace backslashes in addition to forward slashes
- Remove colons from Windows drive letters (C:, D:, etc)
- Fixes ENOENT error on Windows when creating session directories
2025-11-12 23:50:30 +01:00
Mario Zechner
43a1c1ae44 chore: sync all versions to 0.6.2 and fix workspace references 2025-11-12 23:44:05 +01:00
Mario Zechner
88c65a7007 chore: bump versions to 0.6.1/0.6.2 2025-11-12 23:40:42 +01:00
Mario Zechner
0e5778c69b README.md update for coding agent 2025-11-12 23:38:35 +01:00
Mario Zechner
227aedc6db docs: rewrite opening paragraph with clearer value proposition
- Change title from package name to 'pi'
- Emphasize: radically simple, multi-model support, mid-session switching
- Highlight: CLI for headless tasks, creature comforts
- More concise and compelling
2025-11-12 23:34:26 +01:00
Mario Zechner
c0f94c2bba docs: note exa-search was built by agent in ~2 minutes 2025-11-12 23:30:39 +01:00
Mario Zechner
42e0cbd4f4 docs: add real-world example linking to exa-search tools
- Reference exa-search repo as concrete example
- Shows web search capability via simple tool pattern
- Demonstrates how easy it is to extend pi with custom tools
2025-11-12 23:28:40 +01:00
Mario Zechner
271810c808 docs: add Background Bash section before Planned Features
- Clear stance: no background bash execution
- Alternative: use tmux or tterminal-cp
- Link to tterminal-cp repo
- Rationale: long-running commands need proper terminal sessions
2025-11-12 23:25:29 +01:00
Mario Zechner
c4102c7b81 docs: clarify auto-compaction options and fix flicker claim
- Expanded auto-compaction: switch to bigger model and either continue or summarize
- Fixed planned feature: MORE flicker than Claude Code (not less)
2025-11-12 23:22:40 +01:00
Mario Zechner
cf2a0d1c22 docs: clarify planning approach in Planning section 2025-11-12 23:21:27 +01:00
Mario Zechner
6f032fbbf7 docs: add Planning section and improve auto-compaction note
Planning:
- Clear stance: no built-in planning mode
- Alternative: write plans to PLAN.md files
- Persists across sessions, can be versioned
- Example provided showing structured approach

Auto-compaction:
- Added alternative: switch to bigger context model (Gemini)
- Can summarize session with larger model mid-session
2025-11-12 23:19:58 +01:00
Mario Zechner
9066f58ca7 docs: add To-Dos section explaining no built-in support
- Clear stance: no built-in to-dos
- Rationale: they confuse models more than help
- Alternative: stateful TODO.md file with checkboxes
- Simple example provided
- Agent can read/update file as needed
2025-11-12 23:16:14 +01:00
Mario Zechner
e9935beb5f docs: add Sub-Agents and Planned Features sections
Sub-Agents:
- Clear stance: not supported as built-in feature
- Agent can spawn itself via CLI or write custom tools
- Rationale: poor context transfer between agents
- Manual orchestration recommended for parallel work

Planned Features:
- Custom/local models (Ollama, llama.cpp, vLLM, SGLang, LM Studio)
- Auto-compaction (current mitigation documented)
- Message queuing (core supports, UI needs wiring)
- Better RPC mode docs
- Less flicker than Claude Code
2025-11-12 23:14:36 +01:00
Mario Zechner
a0fa254107 feat: support file paths for --system-prompt option
- Check if --system-prompt argument is a valid file path
- Load file contents if it exists, otherwise use as literal text
- Works in both interactive and single-shot modes
- Project context and datetime still appended automatically
- Document in README with examples
2025-11-12 23:10:56 +01:00
Mario Zechner
79ee33c3fc refactor: rename package to @mariozechner/pi-coding-agent
- Changed package name from @mariozechner/coding-agent to @mariozechner/pi-coding-agent
- Updated README installation command
- Binary name 'pi' remains the same
- Avoids conflict with existing @mariozechner/pi (pods package)
2025-11-12 23:08:05 +01:00
Mario Zechner
6695219e67 docs: add note about referencing tool READMEs in AGENT.md files 2025-11-12 23:04:59 +01:00
Mario Zechner
858824df83 docs: clarify blog post link includes rationale 2025-11-12 23:01:19 +01:00
Mario Zechner
60e4fcf012 docs: simplify MCP section with clear stance and minimal example
- State upfront: pi does not support MCP
- Provide minimal working example (README + bash script)
- Show simple usage pattern
- Remove verbose explanations

fix(tui): don't show duplicate URL when link text equals href
2025-11-12 23:00:27 +01:00
Mario Zechner
fda04484b9 docs: restructure tools section and add MCP alternatives
- Rename 'Available Tools' to 'Tools' with 'Built-in Tools' subsection
- Add 'MCP & Adding Your Own Tools' section
- Explain bash/code approach vs MCP servers
- Highlight token efficiency and composability benefits
- Link to blog post for detailed examples
2025-11-12 22:57:45 +01:00
Mario Zechner
b172beb925 docs: add Security (YOLO Mode) section to README
- Document unrestricted filesystem and command access
- Explain no permission checks or safety rails
- Warn about prompt injection risks
- Provide mitigation suggestions
- Clear about design philosophy and use at own risk
2025-11-12 22:53:42 +01:00
Mario Zechner
efb0a635b5 fix: add horizontal scroll to diffs in HTML export 2025-11-12 22:40:37 +01:00
Mario Zechner
cc6e4c7f38 fix: render edit tool diffs in HTML export
- Use result.details.diff from tool execution (same as TUI)
- Apply proper color coding for added/removed/context lines
- Remove unused generateDiff function
- Match TUI's diff rendering approach
2025-11-12 22:39:07 +01:00
Mario Zechner
9bd297e253 docs: add /session command to README 2025-11-12 22:34:16 +01:00
Mario Zechner
5ba2109da8 feat: add /session command to show session info and stats
- Shows session file path and ID
- Displays message counts (user, assistant, total)
- Shows token usage (input, output, cache read/write, total)
- Displays total cost if available
- Reuses same calculation logic as footer component
2025-11-12 22:29:55 +01:00
Mario Zechner
2509add9bf fix: don't clear loading animation when Ctrl+C clears editor
- Remove statusContainer.clear() from clearEditor()
- Loading animation should only be removed when agent finishes
- Ctrl+C once should only clear editor text, not status
2025-11-12 22:23:21 +01:00
Mario Zechner
dea7067593 style: format context file list on separate lines 2025-11-12 22:21:14 +01:00
Mario Zechner
b1c2c32e23 refactor: move context files to system prompt instead of user messages
- Context files now appended to system prompt
- Added current date/time to system prompt
- Added current working directory to system prompt
- Date/time and cwd placed at end of system prompt
- Updated README to reflect system prompt integration
2025-11-12 22:19:56 +01:00
Mario Zechner
dca3e1cc60 feat: hierarchical context file loading for monorepos
- Walk up parent directories to load all AGENT.md/CLAUDE.md files
- Load global context from ~/.pi/agent/AGENT.md or CLAUDE.md
- Load order: global → top-most parent → ... → cwd
- Prefer AGENT.md over CLAUDE.md in each directory
- Each context file injected as separate message
- Updated README with detailed documentation
2025-11-12 22:17:54 +01:00
Mario Zechner
812f2f43cd feat: defer session creation until first user+assistant message exchange
- Sessions are no longer created immediately on startup
- Session files only created after at least 1 user message and 1 assistant response
- Prevents empty session files when agent is launched and immediately quit
- Messages are queued until session is initialized
- Continue/resume modes properly mark sessions as already initialized
2025-11-12 22:06:02 +01:00
Mario Zechner
5e988b444b Remove event logging from session files - only save messages and state changes
Session reconstruction only needs:
- type: 'session' - session metadata
- type: 'message' - conversation history
- type: 'thinking_level_change' - thinking level changes
- type: 'model_change' - model changes

Events like agent_start/end, tool_execution_start/end are not needed for
session reconstruction and only added bloat. This reduces session file size
significantly and speeds up writes.
2025-11-12 21:56:29 +01:00
Mario Zechner
9e3e319f1a Add session export to HTML, improve tool error handling, and enhance RPC mode documentation 2025-11-12 21:55:10 +01:00
Mario Zechner
68092ccf01 Add --mode flag for CLI output control (text/json/rpc)
- text mode: only outputs final assistant message text (default)
- json mode: streams all events as JSON (same as session manager writes)
- rpc mode: JSON output + listens for JSON input on stdin for headless operation
- Suppress informational messages in json/rpc modes
2025-11-12 20:33:31 +01:00
Mario Zechner
c75f53f6f2 Improve edit tool diff display with context-aware rendering
- Add generateDiffString() function in edit tool to create unified diffs with line numbers and 4 lines of context
- Store only the formatted diff string in tool result details instead of full file contents
- Update tool-execution renderer to parse and colorize the diff string
- Filter out message_update events from session saving to prevent verbose session files
- Add markdown nested list and table rendering tests
2025-11-12 20:09:11 +01:00
Mario Zechner
2f0f0a913e Add proper truncation notices and comprehensive tests for read tool
**Improved output messages:**
1. File fits within limits: Just outputs content (no notices)
2. Lines get truncated: Shows "Some lines were truncated to 2000 characters for display"
3. File doesn't fit limit: Shows "N more lines not shown. Use offset=X to continue reading"
4. Offset beyond file: Shows "Error: Offset X is beyond end of file (N lines total)"
5. Both truncations: Combines both notices with ". " separator

**Comprehensive test coverage:**
- Files within limits (no notices)
- Large files (line truncation)
- Long lines (character truncation)
- Offset parameter
- Limit parameter
- Offset + limit together
- Invalid offset (out of bounds)
- Combined truncations (both notices)

All 17 tests passing ✓
2025-11-12 17:13:03 +01:00
Mario Zechner
c7a73d4f81 Add line limits and truncation to read tool
- Default limit of 2000 lines per read
- Maximum line length of 2000 characters (truncates longer lines)
- Add optional offset and limit parameters for pagination
- Show truncation notice with instruction to continue reading
- Plain text output (no line numbers)

Examples:
- `read path/to/file` - reads first 2000 lines
- `read path/to/file offset=2001` - continues from line 2001
- `read path/to/file limit=100` - reads only 100 lines

This prevents extremely large files from overwhelming context.
2025-11-12 16:53:05 +01:00
Mario Zechner
bb0b77af16 Match export output style to thinking level display
Changed export success/error messages to match the style used for thinking level changes:
- Use Spacer(1) instead of empty Text for proper blank line spacing
- Use chalk.dim() for success message instead of chalk.green()
- Add left padding (1, 0) to match other system messages
- Removed checkmark/x symbols for cleaner look

Now "Session exported to: filename.html" appears dimmed with proper spacing, just like "Thinking level: off"
2025-11-12 16:45:51 +01:00
Mario Zechner
5cab91f839 Make HTML export header minimal and stack info vertically
**Header improvements:**
- Changed title from "pi coding-agent session" to "pi v{version}"
- Smaller, more compact header (16px instead of 20px)
- Info items now stack vertically with consistent labels (80px width)
- Reduced padding and spacing for cleaner look
- Labels aligned to left, values aligned to baseline

The header is now much less cramped and easier to read.
2025-11-12 16:35:06 +01:00
Mario Zechner
1b81d803bf Add click-to-expand and system prompt display to HTML export
**Click-to-expand functionality:**
- Truncated tool outputs are now clickable to show full content
- Works for bash (>5 lines), read (>10 lines), write (>10 lines)
- Displays "... (N more lines) - click to expand" hint in cyan
- Smooth toggle between preview and full output
- Cursor changes to pointer on hover

**System prompt and tools display:**
- Added system prompt section with yellow header on dark brownish background
- Shows all available tools with names and descriptions
- Both sections appear before messages for context
- Subtle yellow/brown theme (rgb(60, 55, 40)) that's not too bright

The HTML export now provides better interactivity for large outputs and gives full context about the agent's configuration.
2025-11-12 16:32:20 +01:00
Mario Zechner
6b496e006e Rewrite HTML export to match TUI visual style exactly
Complete overhaul of export-html.ts to replicate the TUI renderer's visual design:

**Exact TUI color matching:**
- User messages: rgb(52, 53, 65) dark slate background
- Tool pending: rgb(40, 40, 50) dark blue-gray
- Tool success: rgb(40, 50, 40) dark green
- Tool error: rgb(60, 40, 40) dark red
- Body background: rgb(24, 24, 30) very dark
- Text colors matching chalk: cyan for paths, dimmed gray for output

**Tool formatting (matching ToolExecutionComponent):**
- bash: Bold `$ command`, dimmed output (max 5 lines)
- write: Bold header with cyan path, line count, content preview (max 10 lines)
- read: Bold header with cyan path, content preview (max 10 lines)
- edit: Bold header with cyan path, unified diff with line numbers
- All tools show "... (N more lines)" indicators

**Additional improvements:**
- Use session filename + .html for default output
- Shorten paths with tilde notation (~)
- Replace tabs with 3 spaces
- Monospace font matching terminal aesthetic
- Minimal, clean design with no borders/boxes
- Print-friendly styles

The HTML export now looks identical to the TUI version.
2025-11-12 16:27:12 +01:00
Mario Zechner
e467a80b5b Add /export command to export sessions as self-contained HTML
- Add exportSessionToHtml function that generates beautifully formatted HTML exports
- HTML includes session metadata, all messages, tool calls, tool results, thinking blocks, and images
- Support for ANSI color codes in tool output (converted to HTML)
- Self-contained with inline CSS (dark theme, responsive design, print-friendly)
- Add /export slash command to TUI with optional filename parameter
- Add agent and coding-agent to dev script for watch mode
- Increment coding-agent version to 0.6.1

Usage: /export [optional-filename.html]
2025-11-12 16:21:59 +01:00