Commit Graph
100 Commits
Author SHA1 Message Date
Mario Zechner 029a04c43b fix(mom): clarify attach tool only works with /workspace/ files 2025-12-05 02:38:11 +01:00
Mario Zechner e1d3c2b76e fix(mom): handle Slack msg_too_long errors gracefully
- Add try/catch to all Slack API calls in promise chain
- Truncate main channel messages at 35K with elaboration note
- Truncate thread messages at 20K
- Prevents process crash on long messages
2025-12-04 23:39:17 +01:00
Mario Zechner c7585e37c9 Release v0.12.10 2025-12-04 20:51:57 +01:00
Mario Zechner 47bb302155 Release v0.12.9 2025-12-04 13:22:53 +01:00
Mario Zechner 9e5aaf1932 Add /copy command docs and changelog entry, closes #105 2025-12-04 13:22:17 +01:00
Mario Zechner 6a4a2fdfe9 Merge branch 'built-in-copy-slash-command' 2025-12-04 13:22:13 +01:00
Mario Zechner 547dcf0e4a fix(coding-agent): update compaction test to match actual summary prefix 2025-12-04 12:29:14 +01:00
Mario Zechner 706554a5d3 fix(mom): private channel messages not being logged
- Add message.groups to required bot events in README
- Add groups:history and groups:read to required scopes in README
- app_mention handler now logs messages directly instead of relying on message event
- Add deduplication in ChannelStore.logMessage() to prevent double-logging
- Remove redundant current message append in agent.ts (already in log)
2025-12-04 12:24:29 +01:00
Mario Zechner db6d655ee9 Release v0.12.8 2025-12-04 03:59:20 +01:00
Mario Zechner 5663bf16ce Add [Unreleased] section 2025-12-04 03:12:00 +01:00
Mario Zechner cfa9dbfc03 Release v0.12.7 2025-12-04 03:11:03 +01:00
Mario Zechner 186308e4b4 docs(coding-agent): add GitHub link to context compaction docs in CHANGELOG 2025-12-04 03:09:00 +01:00
Mario Zechner 700baca113 docs(coding-agent): clean up compaction note 2025-12-04 03:05:01 +01:00
Mario Zechner be2d90819a docs(coding-agent): add note about iterating on manual summary 2025-12-04 03:01:07 +01:00
Mario Zechner 3d66d2561d docs(coding-agent): expand compaction note with manual summary alternative 2025-12-04 02:59:55 +01:00
Mario Zechner 18e9c17ae5 docs(coding-agent): add note that compaction should generally be avoided 2025-12-04 02:58:45 +01:00
Mario Zechner 0c460fcfe8 docs(coding-agent): fix context compaction documentation
- Correctly describe cut point mechanism that keeps recent messages verbatim
- Document keepRecentTokens setting (default 20k)
- Fix reserveTokens default (16k not 20k)
- Explain summary chaining for multiple compactions
2025-12-04 02:57:45 +01:00
Mario Zechner a57768b91b 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 233917c6d1 docs(coding-agent): add compaction to RPC protocol documentation 2025-12-04 02:51:27 +01:00
Mario Zechner 79d8d2ef2d docs(coding-agent): add context compaction to CHANGELOG 2025-12-04 02:49:46 +01:00
Mario Zechner c3f63dd243 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 1a97331af1 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 c89b1ec3c2 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 bddb99fa7c Wire up /compact and /autocompact slash commands 2025-12-04 00:31:21 +01:00
Mario Zechner 79731249eb 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 6c2360af28 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 f02194296d feat(mom): backfill missed messages on startup using conversations.history API
- Add getLastTimestamp() to ChannelStore to read last ts from log.jsonl
- Add backfillChannel() to fetch up to 3 pages (3000 messages) per channel
- Add backfillAllChannels() called in start() before socket connection
- Include mom's own messages (as bot) and user messages, exclude other bots
- Process attachments from backfilled messages
- Add logging: logBackfillStart, logBackfillChannel, logBackfillComplete
- Warn if attachment missing name instead of failing

fixes #103
2025-12-03 22:05:13 +01:00
Mario Zechner 1517e64869 chore: bump version to 0.12.6 2025-12-03 17:12:27 +01:00
Mario Zechner 989af79752 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 6cd8bcdeb3 fix(coding-agent): use APP_NAME in export-html and tools-manager 2025-12-03 16:27:49 +01:00
Mario Zechner d4d5051940 Release v0.12.5 2025-12-03 16:21:11 +01:00
Mario Zechner e82fb0fc83 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 9d5fe1fe85 Update session docs: add type definition links, reorder sections 2025-12-03 15:44:33 +01:00
Mario Zechner 9ed1c4e7ba Clean up docs, add session format documentation 2025-12-03 15:42:56 +01:00
Mario Zechner 011e8d705a Add RPC protocol documentation with tool call correlation 2025-12-03 15:28:17 +01:00
Mario Zechner 92b2ba9e91 Add comprehensive RPC protocol documentation 2025-12-03 15:22:20 +01:00
Mario Zechner faa0b5f6da Simplified CI setup 2025-12-03 15:12:21 +01:00
Mario Zechner 05644ebcd5 Use ordered root build instead of parallel workspace build in CI 2025-12-03 15:05:04 +01:00
Mario Zechner e0c057ecc6 Add web-ui/example to workspaces, remove CI workaround 2025-12-03 14:27:02 +01:00
Mario Zechner 24fcca5b7b Try fixing root level compiles 2025-12-03 14:16:00 +01:00
Mario Zechner eb5cd9d4be Add CTRL+ENTER note for WSL 2025-12-02 22:18:12 +01:00
Mario Zechner 923d85463d ci: install fd and ripgrep for coding-agent tests 2025-12-02 16:36:36 +01:00
Mario Zechner 1c18b8006f Add auto-compaction trigger flow and maxTokens calculation 2025-12-02 16:17:05 +01:00
Mario Zechner 50b334f88a Add compaction examples and /branch interaction 2025-12-02 16:09:46 +01:00
Mario Zechner 5daef11b4c Add compaction research and implementation plan 2025-12-02 16:00:52 +01:00
Mario Zechner b69fe06d43 docs: add CI section with warning about API secrets 2025-12-02 14:52:28 +01:00
Mario Zechner bc4aa4aaa1 fix(coding-agent): use describe.skipIf for RPC test with explicit model
- Use describe.skipIf pattern matching other tests
- Skip when ANTHROPIC_API_KEY and ANTHROPIC_OAUTH_TOKEN are missing
- Use explicit --provider anthropic --model claude-sonnet-4-5
2025-12-02 14:50:29 +01:00
Mario Zechner 30f69c5f83 release: v0.12.4 2025-12-02 13:26:46 +01:00
Mario Zechner 4432fc9b72 docs: add changelog rules to prevent modifying released versions 2025-12-02 13:15:17 +01:00
Mario Zechner cd62c87323 docs: fix changelog - separate v0.12.2 and v0.12.3 entries 2025-12-02 13:14:20 +01:00
Mario Zechner 858d041a5b release: v0.12.3 2025-12-02 13:10:27 +01:00
Mario Zechner 15428f10ed Clean-up out.html 2025-12-02 13:01:13 +01:00
Mario Zechner 0d905ec5d9 release: v0.12.2 2025-12-02 13:00:31 +01:00
Mario Zechner 468acdf0d6 docs: use xattr -c to clear all extended attributes 2025-12-02 12:36:46 +01:00
Mario Zechner 062edb4707 docs: add macOS quarantine fix for unsigned binaries 2025-12-02 12:36:02 +01:00
Mario Zechner 752bd3353d ci: build all packages before creating binaries 2025-12-02 12:32:41 +01:00
Mario Zechner f480c98c80 release: v0.12.1 2025-12-02 12:31:05 +01:00
Mario Zechner a508195612 ci: name binary 'pi' inside archives for easier use 2025-12-02 12:29:35 +01:00
Mario Zechner 7cf3baebed ci: add manual trigger for build workflow 2025-12-02 12:23:14 +01:00
Mario Zechner b348c2549e docs: update AGENTS.md style guide - no emojis, no fluff 2025-12-02 12:20:32 +01:00
Mario Zechner c4a65ad8b9 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 0aa84624c2 chore: remove pnpm-specific .npmrc options 2025-12-02 09:40:29 +01:00
Mario Zechner 1f55424d2d chore: update models.generated.ts 2025-12-02 09:38:49 +01:00
Mario Zechner c32ff608d3 release: 0.11.6 2025-12-02 09:36:20 +01:00
Mario Zechner bc838b021d feat: show (sub) indicator in footer when using OAuth subscription 2025-12-02 09:34:37 +01:00
Mario Zechner 8cd3151c2a docs: add changelog entry for OAuth login status indicator 2025-12-02 09:29:08 +01:00
Mario Zechner 5a65ce5349 fix: use TruncatedText in oauth-selector to prevent line overflow 2025-12-02 09:28:27 +01:00
Mario Zechner 7a1884f85c Release v0.11.5 2025-12-01 20:22:14 +01:00
Mario Zechner cdc64c7569 Add [Unreleased] section 2025-12-01 13:06:13 +01:00
Mario Zechner e25420a4c8 Release v0.11.4 2025-12-01 13:05:12 +01:00
Mario Zechner 285c657b70 Release v0.11.3 2025-12-01 12:50:04 +01:00
Mario Zechner 75bb14cc4d fix(mom): include triggering message in context
Fix race condition where app_mention event fires before message event
logs to log.jsonl, causing the user's triggering message to be missing
from the agent's context. Now append the current message directly from
ctx.message to recentMessages.
2025-12-01 11:56:40 +01:00
Mario Zechner dd9decb9e1 docs(coding-agent): add changelog entry for circular menu navigation (#82) 2025-12-01 09:47:22 +01:00
Mario Zechner d2b60f11eb 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 5fa30b8add Release v0.11.1 2025-11-29 23:05:45 +01:00
Mario Zechner 8900897840 feat(coding-agent): add --export CLI flag to convert session files to HTML
Closes #80
2025-11-29 23:05:07 +01:00
Mario Zechner dd71f877e5 docs(coding-agent): add changelog entry for git branch watcher (#79) 2025-11-29 21:54:02 +01:00
Mario Zechner 532bb69ed6 Release v0.11.0 2025-11-29 01:03:31 +01:00
Mario Zechner 66517b72e9 fix(tui): use consistent accent color for entire selected line in file selector
Previously, the selected line in @ fuzzy search and Tab completion used
accent color for prefix/label but muted color for description. Now the
entire selected line uses the accent color for better visual consistency.
2025-11-29 01:02:08 +01:00
Mario Zechner 186169a820 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 a61eca5dee 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 754e745b1f Restore prompt to editor on API key validation failure
fixes #77
2025-11-28 23:00:37 +01:00
Mario Zechner 4830a9cf40 Release v0.10.2 2025-11-27 23:59:15 +01:00
Mario Zechner 8b1cca8279 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 0397dd44c8 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
Mario Zechner 9ebee631be mom: turn-based context, timestamp fixes, system prompt improvements (#68)
Breaking Changes:
- Timestamps now use Slack format - run migrate-timestamps.ts for existing logs

Added:
- Channel/user ID mappings in system prompt
- Skills documentation in system prompt
- Debug last_prompt.txt output
- Bash working directory info
- Token-efficient log queries filtering tool calls

Changed:
- Turn-based message context (groups consecutive bot messages as one turn)
- Messages sorted by Slack timestamp
- Condensed system prompt (~5k → ~2.7k chars)
- Simplified user prompt
- Selective logging (skip UI status labels)

Fixed:
- Duplicate message logging from app_mention handler
- Username obfuscation in thread messages
2025-11-27 23:45:25 +01:00
Mario Zechner 330e044b55 feat(mom): split long messages instead of truncating
- Messages > 40k chars are split into multiple Slack messages
- Full tool results now shown in thread (no truncation)
- Main message truncates with 'see thread for full response' if too long
- Keep jsonl log truncation for storage efficiency
2025-11-27 19:32:54 +01:00
Mario Zechner 4f845cdd1b fix(mom): handle Slack message length limits and API errors gracefully
- Truncate messages exceeding Slack's 40,000 char limit
- Catch Slack API errors in queue and post to thread instead of crashing
- Add error context to queue operations for better debugging
- Wrap replaceMessage in try/catch
2025-11-27 19:22:53 +01:00
Mario Zechner 0e95592eb7 Release v0.10.1 2025-11-27 14:18:29 +01:00
Mario Zechner 5fcdf0cfd8 feat(mom): add arrow prefix to tool labels for visual distinction
Closes #65
2025-11-27 14:11:08 +01:00
Mario Zechner effb4d0b7c feat(mom): reduce tool verbosity in main Slack messages
- During execution: show tool labels, thinking, and text in main message
- After completion: replace main message with only final assistant text
- Post thinking (italic) and text to thread for full audit trail
- Add promise queue to ensure ctx.respond calls execute sequentially
- Add log.logThinking() and log.logResponse() for console output
- Get final text from agent.state.messages instead of tracking

Closes #65
2025-11-27 14:07:21 +01:00
Mario Zechner 318254bff4 feat: show git branch in footer
- Footer now displays active git branch after directory path (e.g., ~/project (main))
- Branch detected by reading .git/HEAD directly (fast, synchronous)
- Cache refreshed after each assistant message to detect branch changes
- Handles normal branches, detached HEAD, and non-git repos

Closes #55
2025-11-27 12:56:45 +01:00
Mario Zechner f95f41b1c4 Add CLI file arguments support via @file prefix
Implements ability to include files directly in the initial message using @ prefix.

Features:
- All @file arguments are coalesced into the first user message
- Text files wrapped in <file name="path">content</file> tags
- Images (.jpg, .jpeg, .png, .gif, .webp) attached as base64-encoded attachments
- Supports ~ expansion, relative and absolute paths
- Empty files are skipped silently
- Non-existent files cause immediate error with clear message
- Works in interactive, --print, and --mode text/json modes
- Not supported in --mode rpc (errors with clear message)

Examples:
  pi @prompt.md @image.png "Do this"
  pi --print @code.ts "Review this code"
  pi @requirements.md @design.png "Implement this"

Closes #54
2025-11-27 12:47:11 +01:00
Mario Zechner 48df1ff259 Improved HTML export with timestamps, better styling, and comprehensive stats
- Added timestamps to each user and assistant message (HH:MM:SS format)
- Fixed text clipping issues with comprehensive word-wrapping CSS
- Improved font selection: ui-monospace, Cascadia Code, Source Code Pro
- Reduced font sizes for more compact display (12px base, down from 14px)
- Added model switch indicators in conversation timeline with subtle background
- Created dedicated Tokens & Cost section showing:
  - Cumulative input/output/cache read/write tokens
  - Cost breakdown by token type with 4 decimal precision
  - Total cost in bold
  - Context usage with token count, percentage, and model identification
- Now displays all unique models used during session (not just initial model)
- Made Messages section more compact (reduced gaps, removed redundant fields)

Closes #51
Closes #52
2025-11-27 12:32:45 +01:00
Mario Zechner ca0a86b981 Fix editor cursor navigation for wrapped lines, add word navigation
- Up/down arrows now navigate visual (wrapped) lines instead of logical lines
- Fixed double cursor display at wrap boundaries
- Added word by word navigation via Option+Left/Right or Ctrl+Left/Right
- Updated README keyboard shortcuts documentation

Closes #61
2025-11-27 12:08:36 +01:00
Mario Zechner a59553a881 Fix edit diff line number alignment and whitespace preservation
- Fix line numbers showing incorrect values for edits far from file start
  (e.g., 1,2,3 instead of 336,337,338). Skip count was added after displaying
  lines instead of before.

- Rewrite splitIntoTokensWithAnsi in pi-tui to preserve whitespace as separate
  tokens instead of discarding it. Wrapped lines now maintain proper alignment
  and code indentation.

- Update mom README: rename title, remove em-dashes for cleaner prose
2025-11-27 11:53:00 +01:00
Mario Zechner 932f48b0e9 Release v0.10.0 2025-11-27 01:33:50 +01:00
Mario Zechner daecee70d7 Add biome check to mom package check script 2025-11-27 01:31:13 +01:00
Mario Zechner 384e4a3a7d feat: fuzzy file search with @ prefix
- Type @ to fuzzy-search files/folders across project
- Respects .gitignore and skips hidden files
- Pure Node.js implementation using readdir with withFileTypes
- No external dependencies (fd/find) required
- Also optimized Tab completion to use withFileTypes instead of statSync

Based on PR #60 by @fightbulc, reimplemented for performance.
2025-11-27 00:59:12 +01:00
Mario Zechner 4de46fbab3 fix: suppress stderr in execSync calls to prevent TUI corruption
Added stdio: 'pipe' to all execSync calls in fuzzy file search to prevent
stderr output from fd/fdfind command checks from corrupting TUI rendering.
2025-11-27 00:13:06 +01:00