Commit graph

2325 commits

Author SHA1 Message Date
Mario Zechner
b846a4bfcf feat(coding-agent): ResourceLoader, package management, and /reload command (#645)
- Add ResourceLoader interface and DefaultResourceLoader implementation
- Add PackageManager for npm/git extension sources with install/remove/update
- Add session.reload() and session.bindExtensions() APIs
- Add /reload command in interactive mode
- Add CLI flags: --skill, --theme, --prompt-template, --no-themes, --no-prompt-templates
- Add pi install/remove/update commands for extension management
- Refactor settings.json to use arrays for skills, prompts, themes
- Remove legacy SkillsSettings source flags and filters
- Update SDK examples and documentation for ResourceLoader pattern
- Add theme registration and loadThemeFromPath for dynamic themes
- Add getShellEnv to include bin dir in PATH for bash commands
2026-01-22 13:49:38 +01:00
Mario Zechner
866d21c252 chore: move pi-dosbox to separate repo
Moved to https://github.com/badlogic/pi-dosbox
2026-01-22 13:19:54 +01:00
Michael Renner
6289c144bf
fix(ai): batch tool-result images after consecutive tool results (#902)
Fixes 400 errors when reading multiple images via GitHub Copilot's
Claude models. Claude requires tool_use -> tool_result adjacency with
no user messages interleaved.

Before: assistant(tool_calls) -> tool -> user(images) -> tool -> user(images)
After:  assistant(tool_calls) -> tool -> tool -> user(all images)
2026-01-22 13:10:10 +01:00
Mario Zechner
c083e195ad Revert "fix(pi-dosbox): force image re-render to prevent ghosting during streaming"
This reverts commit 1668a59bff.
2026-01-22 05:36:00 +01:00
Mario Zechner
1668a59bff fix(pi-dosbox): force image re-render to prevent ghosting during streaming
The TUI only re-renders changed lines. During agent streaming, the
conversation lines above DOSBox change but DOSBox lines stay the same.
This caused the image to stay at its old position while text scrolled.

Fix: Add invisible timestamp to image line to force TUI to see it as
changed every render, ensuring the image is always re-rendered at the
correct position.
2026-01-22 05:30:57 +01:00
Mario Zechner
29e6c13c03 fix(pi-dosbox): use post-init FS mounting instead of bundle.extract
bundle.extract() uses XMLHttpRequest which doesn't exist in Node.js.
Reverted to writing files directly to Emscripten FS after DOSBox init.
jsdos mounts C: to /home/web_user by default.
2026-01-22 05:11:57 +01:00
Mario Zechner
935417cff1 fix(pi-dosbox): include QBasic files in jsdos bundle
The previous approach of writing files to Emscripten FS after DOSBox
started didn't work because the C: drive mount was pointing elsewhere.

Now we create a proper zip archive of QBasic files and include it in
the jsdos bundle using the extract() API with a data URL. The bundle
extracts to the C: drive root on startup.
2026-01-22 05:09:32 +01:00
Mario Zechner
4f343f39b9 feat(pi-dosbox): persistent DOSBox with QBasic and agent tool
- DOSBox now starts at session_start and persists in background
- /dosbox command attaches UI to running instance (Ctrl+Q detaches)
- Added dosbox tool with actions: send_keys, screenshot, read_text
- Bundled QuickBASIC 4.5 files, mounted at C:\QB on startup
- Agent can interact with DOSBox programmatically via tool

Use: pi -e ./examples/extensions/pi-dosbox
Then: /dosbox to view, or let agent use the dosbox tool
2026-01-22 05:03:39 +01:00
Mario Zechner
fbd6b7f9ba fix(tui): prevent image ID collisions between modules
- allocateImageId() now returns random IDs instead of sequential
- Static images no longer auto-allocate IDs (transient display)
- Only explicit imageId usage (like DOSBox) gets tracked IDs
- Suppress emulators exit logging in DOSBox dispose

Fixes image replacement bug when extension and main app both
allocated sequential IDs starting at 1.
2026-01-22 04:52:55 +01:00
Mario Zechner
df1d5c40ea fix(tui): proper Kitty image ID management and cleanup
- Add allocateImageId() to generate unique image IDs
- Add deleteKittyImage() and deleteAllKittyImages() functions
- Image component now tracks its ID and has dispose() method
- renderImage() returns imageId for tracking
- DOSBox: reuse single image ID for all frames, delete on dispose

Fixes image accumulation hitting terminal quota and lingering
images after component close.
2026-01-22 04:39:58 +01:00
Mario Zechner
6515b1a3dd feat(coding-agent): add DOSBox terminal extension
- Render DOSBox framebuffer as images in terminal via emulators package
- Support keyboard input with js-dos key codes
- Push Kitty enhanced mode for proper key press/release events
- Standalone app (npm start) and pi extension entry point
- Exit with Ctrl+Q
2026-01-22 04:35:43 +01:00
Mario Zechner
df8b3544c3 Add [Unreleased] section for next cycle 2026-01-22 01:43:26 +01:00
Mario Zechner
34d28a47b5 Release v0.49.3 2026-01-22 01:42:43 +01:00
Mario Zechner
289d88c284 feat(coding-agent): add Space Invaders example extension
- Classic gameplay with 5x11 alien formation
- 3 alien types, destructible shields, level progression
- Uses Kitty keyboard protocol for smooth movement
- Saves game state on pause, tracks high score
2026-01-22 01:39:51 +01:00
Mario Zechner
ccf6db6376 docs: add missing changelog entries for f39ec4d7, b712d1ca 2026-01-22 01:37:55 +01:00
Ben Vargas
f39ec4d772
feat(extensions): add antigravity-image-gen example for image generation (#893)
Adds a new extension that generates images via Google Antigravity's
image models (gemini-3-pro-image, imagen-3). Features:

- Returns images as tool result attachments for inline terminal rendering
- Configurable save modes: none, project, global, custom
- Supports env vars (PI_IMAGE_SAVE_MODE, PI_IMAGE_SAVE_DIR) and config files
- Configurable aspect ratios (1:1, 16:9, etc.)

Requires OAuth login via /login for google-antigravity provider.
2026-01-22 01:34:22 +01:00
Mario Zechner
b712d1ca43 fix(ai, web-ui): browser compatibility for pi-ai, update tsgo for decorator support
- Update @typescript/native-preview to 7.0.0-dev.20260120.1 (supports experimentalDecorators)
- Replace top-level node:fs, node:os, node:path imports with dynamic imports in stream.ts
- Replace top-level node:os import with dynamic import in openai-codex-responses.ts
- Replace top-level node:crypto, node:http imports with dynamic imports in openai-codex.ts
- Replace Buffer.from with atob for browser-compatible base64 decoding

fixes #873
2026-01-22 01:33:46 +01:00
Mario Zechner
d327b9c768 fix(ai): handle same-provider different-model handoff in OpenAI Responses API
When switching between OpenAI models (e.g., gpt-5-mini to gpt-5.2-codex),
function_call IDs with fc_ prefix trigger pairing validation errors because
OpenAI tracks which fc_xxx IDs were paired with rs_xxx reasoning items.

The fix omits the id field for function_calls from different models, which
avoids the pairing validation while keeping call_id for matching with
function_call_output.

Fixes #886
2026-01-22 00:58:49 +01:00
Mario Zechner
de58391085 test(ai): add failing test for orphaned function_call without reasoning item
Reproduces issue #886 where function_call is sent without its required
paired reasoning item, causing Azure/OpenAI 400 error.
2026-01-21 23:59:29 +01:00
Mario Zechner
b7cef51f3f fix(tui): don't add space after directory completion for @ file attachments 2026-01-21 23:48:41 +01:00
Mario Zechner
4ed9527213 docs: add missing changelog entries for commits since v0.49.2 2026-01-21 23:32:28 +01:00
Richard Gill
7dc652f304
Autocomplete allow searchs with /'s like: folder1/folder2 (#882)
* Extend fd autocomplete tests

* Renamed fixture type in autocomplete test
2026-01-21 23:23:51 +01:00
Aliou Diallo
69d02b8a5f
fix(coding-agent): use dynamic paths in error messages (#887)
Error messages for missing credentials and shell config now use
getAuthPath() and getSettingsPath() instead of hardcoded ~/.pi/agent/
paths, so they correctly reflect PI_CODING_AGENT_DIR when set.
2026-01-21 23:21:10 +01:00
Michael Renner
620239bd3f
fix(tui): prevent duplicate URL display for autolinked emails (#888)
Autolinked emails like user@example.com were rendered as
'user@example.com (mailto:user@example.com)' because the comparison
token.text === token.href failed (text lacks mailto: prefix).

Now strips mailto: prefix before comparing, so autolinked emails
display without redundant URL in parentheses.
2026-01-21 23:20:00 +01:00
Andres Araujo
0363a10c69
feat(coding-agent): add PI_SHARE_VIEWER_URL env var for custom share viewer (#889) 2026-01-21 23:19:12 +01:00
github-actions[bot]
cdca93173b chore: approve contributor lightningRalf 2026-01-21 13:28:41 +00:00
github-actions[bot]
487caef65e chore: approve contributor andresaraujo 2026-01-21 13:21:17 +00:00
github-actions[bot]
3a14af1253 chore: approve contributor toorusr 2026-01-21 13:19:34 +00:00
scutifer
82cc0fe866
feat(extensions): add inline-bash example for expanding !{command} in prompts (#881)
* feat(extensions): add inline-bash example for expanding !{command} in prompts

Adds an example extension that expands inline bash commands within user
prompts before sending to the agent. Uses the `input` event to transform
patterns like `!{pwd}` or `!{git status}` into their output.

Preserves existing `!command` whole-line bash behavior.

* docs(extensions): add inline-bash to README

* chore: fix stupid bug
2026-01-21 14:08:07 +01:00
Mario Zechner
565488fde6 fix(tui): fix viewport tracking and cursor positioning for overlays and content shrink
- Add maxLinesRendered to track terminal's working area (grows with content, only resets on full clear)
- Fix viewport calculation: use maxLinesRendered instead of cursorRow for correct viewport bounds
- Separate cursorRow (end of content for viewport calc) from hardwareCursorRow (actual cursor position)
- Refactor full render into fullRender(clear) helper to reduce duplication
- Fix shrink-clearing: properly clear extra lines when content shrinks
- Add PI_TUI_DEBUG=1 env var for render debugging (writes to /tmp/tui/)

The core issue was that after partial renders (e.g., overlay show/hide), the viewport
calculation used cursorRow which reflected where rendering stopped, not where content
ended. This caused incorrect viewport bounds, leading to cursor movement into scrollback
(unreachable) or rendering at wrong positions.

Additionally, when content shrank (e.g., selector dismissed), the terminal still had
the old lines as blank space. maxLinesRendered tracks this so viewport calculations
account for the terminal's actual working area.
2026-01-20 23:30:53 +01:00
scutifer
2354bc571e
feat(coding-agent): show session name in terminal title and footer (#876)
* ⏺ feat(tui): show session name in terminal title and footer

- Add updateTerminalTitle() method that sets terminal title to
"π - session-name - dirname" (or "π - dirname" if no name)
- Update title when session name changes via /name or extension API
- Display session name in footer after git branch with bullet separator

* chore: update CHANGELOG
2026-01-20 23:05:32 +01:00
Sviatoslav Abakumov
698aea34bd
feat(tui): add Alt+Delete as hotkey for Delete word forwards (#878)
* feat(tui): add Alt+Delete as hotkey for delete word forwards

* docs(coding-agent): update keybindings table with Alt+Delete
2026-01-20 23:03:44 +01:00
scutifer
a9fbfc7955
fix(export): use active theme instead of default for HTML export (#870)
getResolvedThemeColors and getThemeExportColors now fall back to
currentThemeName before getDefaultTheme(), so exports respect the
user's selected theme.
2026-01-20 14:50:40 +01:00
Sviatoslav Abakumov
236285b390
fix(coding-agent): fall back to 256color in Terminal.app (#869) 2026-01-20 14:49:57 +01:00
Mario Zechner
693112e395 feat(ai): add originator option to loginOpenAICodex 2026-01-20 01:28:51 +01:00
Mario Zechner
d2be6486a4 feat(ai): add headers option to StreamOptions for custom HTTP headers
- Added headers field to base StreamOptions interface
- Updated all providers to merge options.headers with defaults
- Forward headers and onPayload through streamSimple/completeSimple
- Bedrock not supported (uses AWS SDK auth)
2026-01-20 01:08:31 +01:00
Michael Renner
20c7b5fed4
feat(tui, coding-agent): add configurable code block indent setting (#855)
Add markdown.codeBlockIndent setting to customize indentation prefix for
rendered code blocks. Default remains 2 spaces for visual clarity, but
setting to empty string removes indentation for easier copy/paste of
code snippets to scripts, editors, or other tools.

Changes:
- tui: add optional codeBlockIndent to MarkdownTheme interface
- coding-agent: add MarkdownSettings with codeBlockIndent property
- coding-agent: compose theme with settings at call sites (no global state)
- coding-agent: update message components to accept optional MarkdownTheme

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-01-19 22:36:03 +01:00
Mario Zechner
46545276e3 fix(coding-agent): show errors from write tool in UI
fixes #856
2026-01-19 22:30:30 +01:00
Armin Ronacher
d37b5a52d7
More fuzzy finder (#860) 2026-01-19 22:22:51 +01:00
Armin Ronacher
d276c9fbe0
l -> shift+l so one can search for l (#861) 2026-01-19 22:22:20 +01:00
Mario Zechner
68352a42cf fix(ai): skip cross-provider-handoff tests when no API keys available
Tests were throwing errors instead of skipping on CI where no API keys
are configured. Now uses describe.skipIf() and it.skipIf() patterns
consistent with other tests in the package.
2026-01-19 16:47:49 +01:00
Mario Zechner
2f4b510c12 Add [Unreleased] section for next cycle 2026-01-19 16:14:47 +01:00
Mario Zechner
17a37bd174 Release v0.49.2 2026-01-19 16:14:07 +01:00
Mario Zechner
d772a09161 docs(coding-agent): add missing changelog entries for v0.49.1..HEAD 2026-01-19 16:13:15 +01:00
Mario Zechner
2b04aefa6d feat(ai): add AWS ECS/IRSA credential detection for Bedrock, fixes #848
Added support for additional AWS credential environment variables:
- AWS_CONTAINER_CREDENTIALS_RELATIVE_URI (ECS task roles)
- AWS_CONTAINER_CREDENTIALS_FULL_URI (ECS task roles)
- AWS_WEB_IDENTITY_TOKEN_FILE (IRSA for Kubernetes)

Also fixed undefined currentModel variable in OAuth error handling.
2026-01-19 16:10:10 +01:00
github-actions[bot]
cd0df4c0dd chore: approve contributor mrud 2026-01-19 15:04:11 +00:00
github-actions[bot]
60674908ea chore: approve contributor zedrdave 2026-01-19 15:00:27 +00:00
Dave
d6bb66a494
fix(coding-agent): prevent crash on OAuth authentication failure (#849)
Detect OAuth authentication failures (expired credentials, offline) and provide helpful error message instead of crashing with generic 'No API key found' error.

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-01-19 15:59:45 +01:00
Armin Ronacher
98fb9f378c
Improves the HTML export (#853)
- Added jsonl download button

Jump to last message on click

Fix missing labels
2026-01-19 15:57:44 +01:00
Mario Zechner
3e68744cae docs(coding-agent): add changelog entry for #838 2026-01-19 15:56:08 +01:00