Commit graph

137 commits

Author SHA1 Message Date
Mario Zechner
ebd661fe13 Release v0.40.1 2026-01-09 05:11:49 +01:00
Mario Zechner
f5e6bcac1b Remove Anthropic OAuth support 2026-01-09 05:10:33 +01:00
Mario Zechner
2e362fbfd2 Make mac-system-theme extension async to avoid blocking keyboard input 2026-01-09 00:49:31 +01:00
Mario Zechner
070ef9c771 Release v0.40.0 2026-01-09 00:43:32 +01:00
Mario Zechner
39bfbb125c Release v0.39.1 2026-01-09 00:33:39 +01:00
Mario Zechner
37378fb346 Fix setTheme not triggering rerender, improve mac-system-theme example 2026-01-09 00:32:41 +01:00
Mario Zechner
e5e944475d Poll macOS system theme every 2 seconds in mac-system-theme extension 2026-01-09 00:18:59 +01:00
Mario Zechner
c25f1eab64 Release v0.39.0 2026-01-09 00:10:00 +01:00
Mario Zechner
c5b97d7a2f feat(coding-agent): add interactive-shell.ts extension example
Demonstrates running interactive commands (vim, git rebase, htop, etc.)
with full terminal access using user_bash event and ctx.ui.custom().

- Auto-detects interactive commands from built-in list
- !i prefix to force interactive mode
- Configurable via INTERACTIVE_COMMANDS/INTERACTIVE_EXCLUDE env vars

closes #532
2026-01-09 00:08:52 +01:00
Mario Zechner
af2d8509e6 Fix --no-skills flag not preventing skills from loading
The --no-skills flag set options.skills = [] in main.ts, but the
interactive mode UI would rediscover skills anyway because it called
loadSkills() directly instead of using the already-loaded skills.

Changes:
- Add AgentSession.skills and AgentSession.skillWarnings properties
- discoverSkills() now returns { skills, warnings } instead of Skill[]
- Interactive mode uses session.skills instead of calling loadSkills()
- Update SDK docs and examples for new return type

Fixes #577
2026-01-08 23:41:54 +01:00
Mario Zechner
f9064c2f69 feat(tui): add overlay compositing for ctx.ui.custom() (#558)
Adds overlay rendering capability to the TUI, enabling floating modal
components that render on top of existing content without clearing the screen.

- Add showOverlay(), hideOverlay(), hasOverlay() methods to TUI
- Implement ANSI-aware line compositing via extractSegments()
- Support overlay stack (multiple overlays, later on top)
- Add { overlay: true } option to ctx.ui.custom()
- Add overlay-test.ts example extension

Also fixes pre-existing bug where bash tool output cached visual lines
at fixed terminal width, causing crashes on terminal resize.

Co-authored-by: Nico Bailon <nico.bailon@gmail.com>
2026-01-08 22:40:42 +01:00
Mario Zechner
121823c74d feat(coding-agent): add user_bash event and theme API extensions
- user_bash event for intercepting ! and !! commands (#528)
- Extensions can return { operations } or { result } to redirect/replace
- executeBashWithOperations() for custom BashOperations execution
- session.recordBashResult() for extensions handling bash themselves
- Theme API: getAllThemes(), getTheme(), setTheme() on ctx.ui
- mac-system-theme.ts example: sync with macOS dark/light mode
- Updated ssh.ts to use user_bash event
2026-01-08 21:50:56 +01:00
Mario Zechner
dc54c308a9 SSH extension: evaluate pwd on remote when no path given, use accent color for status 2026-01-08 20:37:56 +01:00
Mario Zechner
b0e5954cf8 feat(coding-agent): default ssh extension remote cwd to ~ 2026-01-08 20:27:09 +01:00
Mario Zechner
17cb328ca1 Allow extensions to modify system prompt in before_agent_start
- Add systemPrompt to BeforeAgentStartEvent so extensions can see current prompt
- Change systemPromptAppend to systemPrompt in BeforeAgentStartEventResult for full replacement
- Extensions can now chain modifications (each sees the result of previous)
- Update ssh.ts to replace local cwd with remote cwd in system prompt
- Update pirate.ts, claude-rules.ts, preset.ts to use new API

fixes #575
2026-01-08 19:54:34 +01:00
Mario Zechner
9ed88646a8 feat(coding-agent): add pluggable operations for remote tool execution
Adds optional operations parameter to create*Tool functions enabling
delegation to remote systems (SSH, containers, etc.):

- ReadOperations: readFile, access, detectImageMimeType
- WriteOperations: writeFile, mkdir
- EditOperations: readFile, writeFile, access
- BashOperations: exec (with streaming, signal, timeout)

Add ssh.ts example demonstrating --ssh flag for remote execution.
Built-in renderers used automatically for overrides without custom renderers.

fixes #564
2026-01-08 19:32:25 +01:00
Mario Zechner
550742ca98 docs(coding-agent): simplify tool-override example to use built-in renderer 2026-01-08 18:52:33 +01:00
Mario Zechner
e3dd4f21d1 feat(coding-agent): add tool override support via extensions
- Add setActiveTools() to ExtensionAPI for dynamic tool management
- Extensions can now override, wrap, or disable built-in tools
- Add tool-override.ts example demonstrating the pattern
- Update documentation for tool override capabilities
2026-01-08 18:52:33 +01:00
Mario Zechner
4b084d0f9d Release v0.38.0 2026-01-08 04:52:55 +01:00
Mario Zechner
baf6fe4b39 fix(coding-agent): add PR attribution to ctx.shutdown() changelog, fix example comments 2026-01-08 03:31:55 +01:00
Kao Félix
6845c4b85e
feat(coding-agent): make ctx.shutdown() available for extensions (#542) 2026-01-08 03:30:48 +01:00
Mario Zechner
09471ebc7d feat(coding-agent): add ctx.ui.setEditorComponent() extension API
- Add setEditorComponent() to ctx.ui for custom editor components
- Add CustomEditor base class for extensions (handles app keybindings)
- Add keybindings parameter to ctx.ui.custom() factory (breaking change)
- Add modal-editor.ts example (vim-like modes)
- Add rainbow-editor.ts example (animated text highlighting)
- Update docs: extensions.md, tui.md Pattern 7
- Clean up terminal on TUI render errors
2026-01-07 16:11:49 +01:00
Nico Bailon
77477f6166 feat(coding-agent): add timeout option to extension dialogs with live countdown
Extension UI dialogs (select, confirm, input) now support a timeout option
that auto-dismisses with a live countdown display. Simpler alternative to
manually managing AbortSignal for timed dialogs.

Also adds ExtensionUIDialogOptions type export and updates RPC mode to
forward timeout to clients.
2026-01-06 21:49:27 -08:00
Mario Zechner
5514d4ffdb Release v0.37.8 2026-01-07 01:32:53 +01:00
Mario Zechner
a4f2bb5c27 Release v0.37.7 2026-01-07 01:01:55 +01:00
Mario Zechner
befbeb30e4 Release v0.37.6 2026-01-07 00:42:45 +01:00
Nico Bailon
9771fa1e44 Add AbortSignal support to extension UI dialogs
Closes #474
2026-01-06 15:01:15 -08:00
Mario Zechner
282273e156 Fix preset.ts example to use gpt-5.2-codex for plan mode 2026-01-06 23:29:20 +01:00
Mario Zechner
fe95983dcf Release v0.37.5 2026-01-06 23:25:12 +01:00
Mario Zechner
59d8b7948c Add ExtensionAPI methods, preset example, and TUI documentation improvements
- ExtensionAPI: setModel(), getThinkingLevel(), setThinkingLevel() methods
- New preset.ts example with plan/implement presets for model/thinking/tools switching
- Export all UI components from pi-coding-agent for extension use
- docs/tui.md: Common Patterns section with copy-paste code for SelectList, BorderedLoader, SettingsList, setStatus, setWidget, setFooter
- docs/tui.md: Key Rules section for extension UI development
- docs/extensions.md: Exhaustive example links for all ExtensionAPI methods and events
- System prompt now references docs/tui.md for TUI development

Fixes #509, relates to #347
2026-01-06 23:24:23 +01:00
Mario Zechner
7c99ea54bf Export truncation utilities for custom tools, add truncated-tool example
- Export truncateHead, truncateTail, truncateLine, formatSize, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES from package
- Add examples/extensions/truncated-tool.ts showing proper output truncation with custom rendering
- Document output truncation best practices in docs/extensions.md
2026-01-06 22:13:08 +01:00
Mario Zechner
b08a6b22ce Release v0.37.4 2026-01-06 21:28:24 +01:00
Tudor Oancea
f755f69e0a added custom header support and example extension 2026-01-06 21:20:19 +01:00
Mario Zechner
86fea6379c Release v0.37.3 2026-01-06 13:43:47 +01:00
Mario Zechner
7210086677 Extensions: add pi.sendUserMessage() for sending user messages
Adds sendUserMessage() to the extension API, allowing extensions to send
actual user messages (role: user) rather than custom messages. Unlike
sendMessage(), this always triggers a turn and behaves as if the user
typed the message.

- Add SendUserMessageHandler type and sendUserMessage() to ExtensionAPI
- Wire handler through loader, runner, and all modes
- Implement via prompt() with expandPromptTemplates: false
- Add send-user-message.ts example with /ask, /steer, /followup commands
- Document in extensions.md

fixes #483
2026-01-06 13:40:24 +01:00
Mario Zechner
f023af0dab Add ctx.ui.setFooter() for extensions to replace footer component
Extensions can now replace the built-in footer with a custom component:
- setFooter(factory) replaces with custom component
- setFooter(undefined) restores built-in footer

Includes example extension demonstrating context usage display.

Closes #481
2026-01-06 12:39:45 +01:00
Mario Zechner
6f4d16d76f Release v0.37.2 2026-01-06 00:53:18 +01:00
Mario Zechner
a20112f45f Release v0.37.1 2026-01-06 00:32:09 +01:00
Mario Zechner
d3d53392e8 Release v0.37.0 2026-01-06 00:07:15 +01:00
Mario Zechner
e824b6dfa4 fix: add missing scripts to pi-extension-with-deps example 2026-01-06 00:06:41 +01:00
Mario Zechner
7919c40907 docs: remove CLI-specific --extension mention from SDK example 2026-01-05 18:03:41 +01:00
Mario Zechner
7e2ebdd78e fix: mark with-deps example as private, update changelog 2026-01-05 17:55:15 +01:00
LiuVaayne
49c4fe0bc1
feat: add claude-rules extension example (#461)
Add an extension that scans .claude/rules/ folder for project-specific
rules and lists them in the system prompt. The agent can then load
relevant rules using the read tool when needed.
2026-01-05 16:59:07 +01:00
Aliou Diallo
042d3fa310
fix(sdk): extensions: [] now disables discovery as documented (#465) 2026-01-05 16:55:51 +01:00
Mario Zechner
168bfe618e Remove debug console.log from with-deps example 2026-01-05 03:57:30 +01:00
Mario Zechner
cf1c4c31f4 Flatten hello/ and question/ extension examples to single files 2026-01-05 01:45:10 +01:00
Mario Zechner
c6fc084534 Merge hooks and custom-tools into unified extensions system (#454)
Breaking changes:
- Settings: 'hooks' and 'customTools' arrays replaced with 'extensions'
- CLI: '--hook' and '--tool' flags replaced with '--extension' / '-e'
- API: HookMessage renamed to CustomMessage, role 'hookMessage' to 'custom'
- API: FileSlashCommand renamed to PromptTemplate
- API: discoverSlashCommands() renamed to discoverPromptTemplates()
- Directories: commands/ renamed to prompts/ for prompt templates

Migration:
- Session version bumped to 3 (auto-migrates v2 sessions)
- Old 'hookMessage' role entries converted to 'custom'

Structural changes:
- src/core/hooks/ and src/core/custom-tools/ merged into src/core/extensions/
- src/core/slash-commands.ts renamed to src/core/prompt-templates.ts
- examples/hooks/ and examples/custom-tools/ merged into examples/extensions/
- docs/hooks.md and docs/custom-tools.md merged into docs/extensions.md

New test coverage:
- test/extensions-runner.test.ts (10 tests)
- test/extensions-discovery.test.ts (26 tests)
- test/prompt-templates.test.ts
2026-01-05 01:43:35 +01:00
Mario Zechner
00fa8b71c8 revert: remove unnecessary themeOverride params from theme functions
The optional theme parameter was added as a workaround for tsx dev mode,
but that's a dev-only issue. Users running the built package don't need it.
2026-01-04 20:27:46 +01:00
Mario Zechner
b06bd1d24c fix(tools.ts): sync with active tools when no saved state
Hook was showing all tools as enabled even though only 4 were active.
Now initializes from pi.getActiveTools() to match actual state.
2026-01-04 18:50:45 +01:00
Mario Zechner
c447e62662 fix(theme): add optional themeOverride param to getSettingsListTheme/getSelectListTheme
When hooks are loaded via jiti, they get a separate module instance from
the main app. This means the global 'theme' variable in the hook's module
is never initialized. Adding an optional theme parameter allows hooks to
pass the theme from ctx.ui.custom() callback.

Usage in hooks:
  getSettingsListTheme(theme)  // theme from ctx.ui.custom callback
2026-01-04 18:39:00 +01:00