Commit Graph
100 Commits
Author SHA1 Message Date
Mario Zechner 138d111b05 remove debug file 2025-11-26 23:55:35 +01:00
Mario Zechner e7c48e33a2 fix: emoji text wrapping crash in pi-tui
Fixed crash when rendering text containing emojis followed by long content.
The breakLongWord function was iterating over UTF-16 code units instead of
grapheme clusters, causing emojis (surrogate pairs) to be miscounted during
line wrapping. Now uses Intl.Segmenter to properly handle multi-codepoint
characters.
2025-11-26 23:55:01 +01:00
Mario Zechner 5b940c2686 docs: clarify that AGENTS.md files are loaded at every startup
Removed confusing parenthetical that suggested context files aren't loaded when continuing/resuming sessions. They are always freshly loaded from disk at startup - the parenthetical only applied to console logging behavior.
2025-11-26 23:41:52 +01:00
Mario Zechner 0af6742604 Restructure mom README: improve flow, clarify concepts, enhance security section 2025-11-26 23:22:43 +01:00
Mario Zechner 0c6c0f34dd mom: add working indicator and improve stop command
Working Indicator:
- Add '...' to channel messages while mom is processing
- Automatically removed when work completes or stops
- Applies to working message, not status messages

Improved Stop Command:
- Posts separate 'Stopping...' message that updates to 'Stopped'
- Original working message continues updating with tool results
- Clean separation between status and work output
- Properly handles abort during multi-step operations

Clean Stop Reason Handling:
- Agent run() now returns { stopReason } instead of throwing
- Handle 'aborted', 'error', 'stop', 'length', 'toolUse' cases cleanly
- No more exception-based control flow
- Track stopReason from assistant message.stopReason field

New SlackContext Methods:
- replaceMessage() - replace message text instead of appending
- setWorking() - add/remove working indicator
- Improved context tracking for stop command updates
2025-11-26 20:49:02 +01:00
Mario Zechner bfe7df6a49 fix: biome linter warnings (unused parameters) 2025-11-26 18:04:37 +01:00
Mario Zechner 213bc4df1c mom: add centralized logging, usage tracking, and improve prompt caching
Major improvements to mom's logging and cost reporting:

Centralized Logging System:
- Add src/log.ts with type-safe logging functions
- Colored console output (green=user, yellow=mom, dim=details)
- Consistent format: [HH:MM:SS] [context] message
- Replace scattered console.log/error calls throughout codebase

Usage Tracking & Cost Reporting:
- Track tokens (input, output, cache read/write) and costs per run
- Display summary at end of each run in console and Slack thread
- Example: 💰 Usage: 12,543 in + 847 out (5,234 cache read) = $0.0234

Prompt Caching Optimization:
- Move recent messages from system prompt to user message
- System prompt now mostly static (only changes with memory files)
- Enables effective use of Anthropic's prompt caching
- Significantly reduces costs on subsequent requests

Model & Cost Improvements:
- Switch from Claude Opus 4.5 to Sonnet 4.5 (~40% cost reduction)
- Fix Claude Opus 4.5 cache pricing in ai package (was 3x too expensive)
- Add manual override in generate-models.ts until upstream fix merges
- Submitted PR to models.dev: https://github.com/sst/models.dev/pull/439

UI/UX Improvements:
- Extract actual text from tool results instead of JSON wrapper
- Cleaner Slack thread formatting with duration and labels
- Tool args formatting shows paths with offset:limit notation
- Add chalk for colored terminal output

Dependencies:
- Add chalk package for terminal colors
2025-11-26 18:04:16 +01:00
Mario Zechner 82d4ac93e1 ai: update models list (removed grok-4.1-fast non-free variant) 2025-11-26 13:21:59 +01:00
Mario Zechner 4e01eca40e mom: add working memory system and improve log querying
- Add MEMORY.md files for persistent working memory
  - Global memory: workspace/MEMORY.md (shared across channels)
  - Channel memory: workspace/<channel>/MEMORY.md (channel-specific)
  - Automatically loaded into system prompt on each request

- Enhance JSONL log format with ISO 8601 dates
  - Add 'date' field for easy grepping (e.g., grep '"date":"2025-11-26"')
  - Migrated existing logs to include date field

- Improve log query efficiency
  - Add jq query patterns to prevent context overflow
  - Emphasize limiting NUMBER of messages (10-50), not truncating text
  - Show full message text and attachments in queries
  - Handle null/empty attachments with (.attachments // [])

- Optimize system prompt
  - Add current date/time for date-aware operations
  - Format recent messages as TSV (43% token savings vs raw JSONL)
  - Add efficient query examples with both JSON and TSV output

- Enhanced security documentation
  - Add prompt injection risk warnings
  - Document credential exfiltration scenarios
  - Provide mitigation strategies
2025-11-26 13:21:43 +01:00
Mario Zechner a484330cd1 v0.9.4: Mom Slack bot with Docker sandbox 2025-11-26 01:50:28 +01:00
Mario Zechner 30964e0c33 mom: Thread-based tool details, improved README, fixed message ordering 2025-11-26 01:48:41 +01:00
Mario Zechner f53e4fba42 mom: Add scratchpad directory to system prompt 2025-11-26 01:22:47 +01:00
Mario Zechner 6117127b02 mom: Single accumulated message per run, exclude data dir from biome 2025-11-26 01:21:45 +01:00
Mario Zechner 9e0255b10b mom: Tell mom what environment she's in (Docker vs host) 2025-11-26 01:09:43 +01:00
Mario Zechner f140f2e432 mom: Docker sandbox support with --sandbox=docker:container-name option 2025-11-26 01:06:00 +01:00
Mario Zechner da26edb2a7 mom: remove data dir from git, add to gitignore 2025-11-26 00:28:08 +01:00
Mario Zechner aa9e058249 mom: Slack bot with abort support, streaming console output, removed sandbox 2025-11-26 00:27:21 +01:00
Mario Zechner a7423b954e Merge pull request #57 from badlogic/feature/footer-cost-dollar-sign
Add $ prefix to cost in footer
2025-11-25 21:35:18 +01:00
Mario Zechner b42df6848c Add $ prefix to cost in footer
Fixes #53
2025-11-25 21:32:52 +01:00
Mario Zechner 0148f0ac3d v0.9.3: Added Anthropic Claude Opus 4.5 support 2025-11-24 21:03:32 +01:00
Mario Zechner 2918d871c7 Update package-lock.json 2025-11-24 19:46:32 +01:00
Mario Zechner 52325adb97 Release v0.9.2 2025-11-24 19:32:55 +01:00
Mario Zechner 68ca83441b Changes to AGENTS.md 2025-11-24 19:17:50 +01:00
Mario Zechner 18db1fd6eb Changes for AGENTS.md 2025-11-24 19:00:28 +01:00
Mario Zechner 7ff3e572a4 clean-up 2025-11-24 18:41:45 +01:00
Mario Zechner e1856daf57 fix: rename pi-agent to pi-agent-core (npm deprecation issue) 2025-11-21 22:20:43 +01:00
Mario Zechner 56450a4f19 fix(coding-agent): suppress informational output in non-interactive modes
In -p, --mode json, and --mode rpc modes, don't print informational
messages like 'Loaded project context from:' or model restore messages.
Only the actual output should be printed.
2025-11-21 22:07:17 +01:00
Mario Zechner b49a017c55 Release v0.9.0 2025-11-21 21:58:12 +01:00
Mario Zechner e89e657045 feat(coding-agent): allow starting CLI with prompt in interactive mode (#46)
BREAKING CHANGE: Passing a prompt on the command line now starts interactive
mode with the prompt pre-submitted, instead of exiting after completion.
Use --print or -p to get the previous non-interactive behavior.

- Add --print / -p flag for non-interactive mode
- Update runInteractiveMode to accept initial messages
- Update README documentation
- Fix Model Selection Priority docs to include --models scope
2025-11-21 21:57:35 +01:00
Mario Zechner 3018b01460 Fix slash command autocomplete Enter behavior
When pressing Enter on a highlighted slash command suggestion (e.g., typing
`/mod` with `/model` highlighted), the completion is now applied before
submitting. Previously, the partial text was submitted instead of the
selected command.

Fixes #49
2025-11-21 21:50:19 +01:00
Mario Zechner ba8c073ed2 feat: enhance model cycling with thinking levels and --thinking flag
PR #47 enhancements:
- Add thinking level syntax to --models (e.g., --models sonnet:high,haiku:low)
- First model in scope used as initial model when starting new session
- Auto-apply thinking level when cycling models with Ctrl+P
- Save both model and thinking to session AND settings for persistence
- Simplify UX by removing autoThinkingDisabled flag
- Fix model matching to prioritize exact matches over partial
- Support provider/modelId format (e.g., openrouter/openai/gpt-5.1-codex)

Issue #45:
- Add --thinking CLI flag to set thinking level directly
- Takes highest priority over all other thinking level sources

Closes #45
2025-11-21 21:32:30 +01:00
Mario Zechner df3af27288 Merge remote-tracking branch 'origin/main' into feat/model-cycling-enhancements 2025-11-21 21:16:05 +01:00
Mario Zechner 1b6a70ccb1 feat: add /clear command to reset context and start fresh session 2025-11-21 20:59:00 +01:00
Mario Zechner 59af0fd53a fix: markdown link rendering for links with identical text and href 2025-11-21 20:14:32 +01:00
Mario Zechner 38524ea900 Release v0.8.5 2025-11-21 12:48:18 +01:00
Mario Zechner 1d8bc9d6eb Fix path completion hanging and autocomplete arrow key behavior
- Fixed catastrophic regex backtracking in extractPathPrefix that caused
  terminal to hang when text contained many / characters (e.g., URLs).
  Replaced complex regex with simple lastIndexOf approach. (#18)
- Fixed arrow keys moving both autocomplete selection and editor cursor
  by adding missing return statement after handling arrow keys in
  autocomplete mode.

Closes #18
2025-11-21 12:47:23 +01:00
Mario Zechner e7a5ca144c Release v0.8.4 2025-11-21 05:09:58 +01:00
Mario Zechner aa46dfecd4 Release v0.8.3 2025-11-21 04:57:24 +01:00
Mario Zechner 85adcf22bf Release v0.8.0 2025-11-21 03:12:42 +01:00
Mario Zechner cc88095140 WIP: Add theming system with /theme command
- Consolidated theme system into single src/theme/ directory
- Created Theme class with fg(), bg(), bold(), italic(), underline()
- Added dark and light built-in themes with 36 color tokens
- Support for custom themes in ~/.pi/agent/themes/*.json
- JSON schema for theme validation
- Theme selector UI with /theme command
- Save theme preference to settings
- Uses chalk for text formatting to preserve colors

TODO:
- Replace hardcoded colors throughout TUI components
- Apply markdown theming to Markdown components
- Add theme support to all TUI elements
2025-11-20 23:16:59 +01:00
Mario Zechner 93a60b7969 Downgrade Biome to 2.3.5 to fix false positive noUnusedPrivateClassMembers warnings 2025-11-20 22:32:45 +01:00
Mario Zechner c7d00e6ba4 Updated README.md 2025-11-20 21:17:32 +01:00
Mario Zechner ba5bf54af4 Release v0.7.29
- Show offset/limit in read tool display (e.g., read src/main.ts:100-200)
- Fix PI_CODING_AGENT_DIR env var name in help and code
- Add all API key env vars to help text
2025-11-20 20:48:25 +01:00
Mario Zechner d44073b140 Release v0.7.28
- Add message queuing with configurable modes (one-at-a-time/all) (#15)
- Add /queue command to select queue mode
- Add TruncatedText component for proper viewport-aware text truncation
- Queue mode setting persists in ~/.pi/agent/settings.json
- Visual feedback for queued messages with proper ANSI handling
- Press Escape to abort and restore queued messages to editor
2025-11-20 20:39:43 +01:00
Mario Zechner e694d435fd Release v0.7.27
- Fix slash command submission requiring two Enter presses (#30)
- Fix slash command autocomplete not re-triggering after typos (#29)
2025-11-20 18:56:27 +01:00
Mario Zechner 3655ce74f1 Fix: Change prepublish to prepublishOnly to prevent build failing on npm install
The prepublish hook was running during npm install, before optional platform-specific dependencies were installed. This caused build failures on Linux for packages like @typescript/native-preview-linux-x64 and @parcel/watcher-linux-x64-glibc.

prepublishOnly only runs before npm publish, not during install.

Fixes #41
2025-11-20 17:47:52 +01:00
Mario Zechner 11aa39c5e4 Release v0.7.26 2025-11-20 17:29:24 +01:00
Mario Zechner 4afb3231e4 Fix up prompt for image-tool-result for Gemini 2025-11-20 17:09:32 +01:00
Mario Zechner de39f1f493 Add custom headers support for models.json
Fixes #39

- Added headers field to Model type (provider and model level)
- Model headers override provider headers when merged
- Supported in all APIs:
  - Anthropic: defaultHeaders
  - OpenAI (completions/responses): defaultHeaders
  - Google: httpOptions.headers
- Enables bypassing Cloudflare bot detection for proxied endpoints
- Updated documentation with examples

Also fixed:
- Mistral/Chutes syntax error (iif -> if)
- process.env.ANTHROPIC_API_KEY bug (use delete instead of = undefined)
2025-11-20 17:05:31 +01:00
Mario Zechner 425890e674 Merge pull request #42 from butelo/fix/chutes-ai-provider-400-error
fix 400 error when trying to use chutes ai provider
2025-11-20 16:39:14 +01:00
Mario Zechner 4ccc7d47e0 Release v0.7.25 2025-11-20 13:41:38 +01:00
Mario Zechner 9555b75674 Add PR and contributor credits to CHANGELOG 2025-11-20 13:41:19 +01:00
Mario Zechner a1215fc32c Add table of contents to README 2025-11-20 13:20:48 +01:00
Mario Zechner ee5228becf Fix help text to use 'pi' instead of 'coding-agent' 2025-11-20 13:00:38 +01:00
Mario Zechner 95247a3e5e Add documentation for model cycling feature 2025-11-20 12:58:31 +01:00
Mario ZechnerandTino Ehrich fecf9734b0 Add --models parameter for quick model cycling with Ctrl+P
- Add --models CLI arg accepting comma-separated patterns
- Implement smart matching: prefers aliases over dated versions
- Add Ctrl+P to cycle through scoped models (or all if no scope)
- Show model scope hint at startup
- Update help text with examples

Co-authored-by: Tino Ehrich <tino.ehrich@hey.com>
2025-11-20 12:57:20 +01:00
Mario Zechner 097ff25ed4 Release v0.7.24 2025-11-20 12:41:00 +01:00
Mario Zechner c7e4c84731 Simplify thinking level display in footer (remove 'Thinking:' prefix) 2025-11-20 12:38:55 +01:00
Mario Zechner 23d6746bb9 Don't show 'Thinking: off' in footer when thinking is disabled 2025-11-20 12:37:17 +01:00
Mario Zechner cfcdcf055d Add CHANGELOG and README docs for thinking level cycling feature 2025-11-20 12:35:54 +01:00
Mario Zechner 973a129407 Merge PR #36: Add Shift+Tab thinking level cycling with visual border feedback 2025-11-20 12:34:12 +01:00
Mario Zechner d771475f98 Fix superfluous newline in update notification 2025-11-20 12:28:18 +01:00
Mario Zechner e3c4dd22ae Fix TypeScript error in version check 2025-11-20 12:00:51 +01:00
Mario Zechner b3d4478b61 Release v0.7.23 2025-11-20 11:59:17 +01:00
Mario Zechner ddb5a4497f Remove the garbage the agent left behind and commited 2025-11-20 11:03:01 +01:00
Mario Zechner 1f68d6eb40 Release v0.7.22 2025-11-19 01:50:45 +01:00
Mario Zechner 1b28780155 Release v0.7.21 2025-11-19 00:56:16 +01:00
Mario Zechner 5112fc6ba9 Release v0.7.20 2025-11-18 22:52:49 +01:00
Mario Zechner 38ac29acfb Add ANSI-aware word wrapping to TUI components
- Created shared wrapTextWithAnsi() function in utils.ts
- Handles word-based wrapping while preserving ANSI escape codes
- Properly tracks active ANSI codes across wrapped lines
- Supports multi-byte characters (emoji, surrogate pairs)
- Updated Markdown and Text components to use shared wrapping
- Removed duplicate wrapping logic (158 lines total)
2025-11-18 22:26:24 +01:00
Mario Zechner 22d8a0ae4a Release v0.7.18 2025-11-18 22:08:44 +01:00
Mario Zechner a11c1aa4ff Release v0.7.17 2025-11-18 17:49:12 +01:00
Mario Zechner 587d7c39a4 feat(coding-agent): add OAuth authentication for Claude Pro/Max
- Add /login and /logout commands for OAuth flow
- OAuth tokens stored in ~/.pi/agent/oauth.json with 0600 permissions
- Auto-refresh tokens when expired (5min buffer)
- Priority: OAuth > ANTHROPIC_OAUTH_TOKEN env > ANTHROPIC_API_KEY env
- Fix model selector async loading and re-render
- Add bracketed paste support to Input component for long codes
- Update README.md with OAuth documentation
- Add implementation docs and testing checklist
2025-11-18 17:33:33 +01:00
Mario Zechner 387cc97bac Fix Anthropic API rejection when resubmitting aborted thinking blocks
- Convert thinking blocks with missing/empty signatures to text blocks
- Prevents 400 error: 'Invalid signature in thinking block'
- Occurs when stream is aborted mid-thinking and message is resubmitted
2025-11-18 14:36:57 +01:00
Mario Zechner 6680034a64 Release v0.7.16 2025-11-17 14:12:04 +01:00
Mario Zechner f2b3953711 v0.7.15: Anthropic OAuth support 2025-11-17 12:53:57 +01:00
Mario Zechner 063b7e0f11 chore: bump coding-agent to 0.7.14 - fix Anthropic OAuth and Mistral API compatibility 2025-11-17 12:46:59 +01:00
Mario Zechner a5ed6ab641 v0.7.13: Unicode input support for TUI editor 2025-11-16 23:08:10 +01:00
Mario Zechner 21f24061bb Merge branch 'fix/support-umlauts-and-unicode' 2025-11-16 23:06:06 +01:00
Mario Zechner 3b6ef6cf57 refactor(tui): Use explicit charCode check for unicode filtering
- Use 'charCodeAt(0) >= 32' instead of open 'else' in handleInput()
- Use same filter in handlePaste() for consistency
- Prevents control characters while allowing all unicode
- More explicit and safer than accepting everything
2025-11-16 23:05:19 +01:00
Mario Zechner 0c5cbd0068 v0.7.12: Custom models/providers support via models.json
- Add ~/.pi/agent/models.json config for custom providers (Ollama, vLLM, etc.)
- Support all 4 API types (openai-completions, openai-responses, anthropic-messages, google-generative-ai)
- Live reload models.json on /model selector open
- Smart model defaults per provider (claude-sonnet-4-5, gpt-5.1-codex, etc.)
- Graceful session fallback when saved model missing or no API key
- Validation errors show precise file/field info in CLI and TUI
- Agent knows its own README.md path for self-documentation
- Added gpt-5.1-codex (400k context, 128k output, reasoning)

Fixes #21
2025-11-16 22:56:24 +01:00
Mario Zechner 112ce6e5d1 Footer shouldn't explode when no model is given. 2025-11-16 22:35:27 +01:00
Mario Zechner e0c2745989 Add gpt-5.1-codex to model list 2025-11-16 22:35:09 +01:00
Mario Zechner 9b08f92dd9 Filter model selector by API keys and add user-facing documentation
- Model selector now only shows models with configured API keys
- Added yellow hint in model selector UI explaining the filtering
- Updated README.md to document the filtering behavior in both API Keys and /model sections
- Bumped version to 0.7.11
2025-11-16 21:01:31 +01:00
Mario Zechner 977dfec5c9 Merge pull request #19 from CarlosGtrz/filter-model-selector-by-api-key
Filter model selector to only show models with configured API keys
2025-11-16 20:43:02 +01:00
Mario Zechner 3932c5e04c Add lifecycle callbacks to SandboxRuntimeProvider for abort signal support
- Added onExecutionStart(sandboxId, signal) - called when sandbox execution begins
- Added onExecutionEnd(sandboxId) - called when sandbox execution ends
- Integrated callbacks in SandboxedIframe.execute()
- Enables providers to track and cancel async operations (e.g., userScript executions)
2025-11-16 00:56:20 +01:00
Mario Zechner 901449b38a Pin pdfjs-dist to exact version 5.4.394 to fix worker version mismatch 2025-11-16 00:03:58 +01:00
Mario Zechner 147a850de2 Remove instructions to run publish:dry 2025-11-14 23:56:58 +01:00
Mario Zechner b9c2f0a492 Release 0.7.10 2025-11-14 23:55:56 +01:00
Mario Zechner 8ae236f956 Add /branch command for conversation branching (fixes #16)
- Add /branch slash command to create conversation branches
- New UserMessageSelectorComponent shows all user messages chronologically
- Selecting a message creates new session with messages before selection
- Selected message is placed in editor for modification/resubmission
- SessionManager.createBranchedSession() creates new session files
- Updated README.md and CHANGELOG.md with /branch documentation
2025-11-14 23:52:46 +01:00
Mario Zechner 85ea9f500c chore: bump version to 0.7.9 2025-11-14 23:22:20 +01:00
Mario Zechner a686f61c1d feat(tui): improve editor Ctrl/Alt word and line deletion shortcuts
- Add Ctrl+W for word deletion (stops at whitespace/punctuation)
- Add Ctrl+U for delete to start of line (merges with previous line at col 0)
- Change Ctrl+K from delete entire line to delete to end of line (merges with next line at EOL)
- Add Option+Backspace support in Ghostty (maps to Ctrl+W via ESC+DEL sequence)
- Cmd+Backspace in Ghostty works as Ctrl+U (terminal sends same control code)
- Update README and CHANGELOG with new keyboard shortcuts

Fixes #2, Fixes #3
2025-11-14 23:19:24 +01:00
Mario Zechner 508d1bb2d6 Clean-up 2025-11-14 21:32:16 +01:00
Mario Zechner ced5fc3394 Bump version to 0.7.8 2025-11-13 23:49:04 +01:00
Mario Zechner 29ca62fb6e Document /changelog slash command in coding-agent README 2025-11-13 23:46:14 +01:00
Mario Zechner 25a8910ca5 Simplify development section in README 2025-11-13 23:43:15 +01:00
Mario Zechner 43767e0b2a Remove sitegeist reference 2025-11-13 23:42:34 +01:00
Mario Zechner bc01ed5eb6 Document npm run dev for watch mode development 2025-11-13 23:42:04 +01:00
Mario Zechner bc670bc63c Fix lockstep versioning and improve documentation
- Sync all packages to version 0.7.7
- Rewrite sync-versions.js to handle ALL inter-package dependencies automatically
- Fix web-ui dependency on pi-ai (was 0.6.0, now 0.7.7)
- Move agent fix changelog entry to coding-agent CHANGELOG
- Remove redundant agent CHANGELOG.md
- Improve README.md with clearer lockstep versioning docs
- Add /changelog command to display full changelog in TUI (newest last)
- Fix changelog description (not a scrollable viewer, just displays in chat)
- Update CHANGELOG for 0.7.7 release
2025-11-13 23:37:43 +01:00
Mario Zechner 7b347291ff Update CHANGELOG for PR #13 - Windows Git Bash detection improvements 2025-11-13 23:23:43 +01:00
Mario Zechner b22dfcd2be Merge pull request #13 from CarlosGtrz/refactor/bash-windows-detection
Cleaner Windows Git Bash detection
2025-11-13 23:22:17 +01:00