Commit graph

360 commits

Author SHA1 Message Date
Mario Zechner
1007dca564 Fix changelog entries for Vertex AI provider 2026-01-03 01:12:16 +01:00
Mario Zechner
d747ec6e23 Enhance provider override to support baseUrl-only mode
Builds on #406 to support simpler proxy use case:
- Override just baseUrl to route built-in provider through proxy
- All built-in models preserved, no need to redefine them
- Full replacement still works when models array is provided
2026-01-03 01:06:08 +01:00
Mario Zechner
6186e497c5 Add word wrapping changelog entry to coding-agent 2026-01-03 00:49:46 +01:00
Mario Zechner
28fb502719 Add image auto-resize toggle to settings, changelog for #402 2026-01-03 00:42:02 +01:00
Mario Zechner
3b2d3baed2 Add changelog entries for #411 2026-01-03 00:31:03 +01:00
Mario Zechner
eb3d70c749 Add changelog entries for #411 2026-01-03 00:29:24 +01:00
Mario Zechner
9f2e6ac5eb docs: update README.md, hooks.md, and CHANGELOG for steer()/followUp() API
- Fix settings-selector descriptions to explain one-at-a-time vs all
- Update README.md message queuing section, settings example, and table
- Update hooks.md: hasPendingMessages, sendMessage options, triggerTurn example
- Add Theme/ThemeColor export and hasPendingMessages rename to CHANGELOG
2026-01-03 00:19:07 +01:00
Mario Zechner
9d8230dfc6 feat(coding-agent): expose deliverAs option in hook sendMessage() API
- pi.sendMessage(msg, options?) now accepts { triggerTurn?, deliverAs? }
- deliverAs: 'steer' (default) or 'followUp' controls delivery timing
- Update all mode handlers to pass options through
- Update file-trigger example to use new API
- Update CHANGELOG
2026-01-03 00:13:26 +01:00
Mario Zechner
d404f8fcfa docs: update CHANGELOGs for steer()/followUp() API changes
Refs #403
2026-01-03 00:13:26 +01:00
Mario Zechner
1625d127c7 Add CHANGELOG entry for #400 2026-01-03 00:13:25 +01:00
Mario Zechner
1e7d991a25 Add changelog entry for terminal title feature (#407) 2026-01-02 22:02:24 +01:00
Mario Zechner
5ef3cc90d1 Add guard against concurrent prompt() calls
Agent.prompt() and Agent.continue() now throw if called while already
streaming, preventing race conditions and corrupted state. Use
queueMessage() to queue messages during streaming, or await the
previous call.

AgentSession.prompt() has the same guard with a message directing
users to queueMessage().

Ref #403
2026-01-02 22:02:24 +01:00
Mario Zechner
0d1424d8e5 Add [Unreleased] section for next cycle 2026-01-02 10:39:42 +01:00
Mario Zechner
d78a245cc8 Release v0.31.1 2026-01-02 10:39:08 +01:00
Mario Zechner
c10d99d2de fix: export type guard functions at runtime, fixes #397 2026-01-02 10:37:28 +01:00
Mario Zechner
e76ad7aebe Add [Unreleased] section for next cycle 2026-01-02 02:00:36 +01:00
Mario Zechner
3caf359402 Release v0.31.0 2026-01-02 01:59:59 +01:00
Mario Zechner
d9adf659ca Fix edit tool failing on files with UTF-8 BOM
Strip BOM before matching (LLM won't include invisible BOM in oldText),
restore on write.

Based on #394 by @prathamdby
2026-01-02 01:57:24 +01:00
Mario Zechner
02175d908b Update docs for ctx.ui.editor() and handoff example
- Added ctx.ui.editor() to hooks.md and custom-tools.md
- Added ctx.ui.editor() to CHANGELOG.md
- Added handoff.ts to examples/hooks/README.md
2026-01-02 01:26:21 +01:00
Mario Zechner
03159d2f4b Add agent state methods to CustomToolContext and fix abort signature
CustomToolContext now has:
- isIdle() - check if agent is streaming
- hasQueuedMessages() - check if user has queued messages
- abort() - abort current operation (fire-and-forget)

Changed abort() signature from Promise<void> to void in both
HookContext and CustomToolContext. The abort is fire-and-forget:
it calls session.abort() without awaiting, so the abort signal
is set immediately while waitForIdle() runs in the background.

Fixes #388
2026-01-02 00:31:23 +01:00
Mario Zechner
0d9fddec1e Split HookContext and HookCommandContext to prevent deadlocks
HookContext (all events):
- isIdle() - read-only state check
- hasQueuedMessages() - read-only state check
- abort() - fire-and-forget, does not wait

HookCommandContext (slash commands only):
- waitForIdle() - waits for agent to finish
- newSession(options?) - create new session
- branch(entryId) - branch from entry
- navigateTree(targetId, options?) - navigate session tree

Session control methods moved from HookAPI (pi.*) to HookCommandContext (ctx.*)
because they can deadlock when called from event handlers that run inside
the agent loop (tool_call, tool_result, context events).
2026-01-02 00:24:58 +01:00
Mario Zechner
ccdd7bd283 Add session management and agent state methods to hooks API
HookAPI additions:
- pi.newSession(options?) - create new session with optional setup callback
- pi.branch(entryId) - branch from a specific entry
- pi.navigateTree(targetId, options?) - navigate the session tree

HookContext additions:
- ctx.isIdle() - check if agent is streaming
- ctx.waitForIdle() - wait for agent to finish
- ctx.abort() - abort current operation
- ctx.hasQueuedMessages() - check for queued user messages

These enable hooks to programmatically manage sessions (handoff, templates)
and check agent state before showing interactive UI.

Fixes #388
2026-01-01 23:56:24 +01:00
Mario Zechner
484d7e06bb Consolidate session events: remove session_before_new/session_new, add reason field to switch events
- Remove session_before_new and session_new hook events
- Add reason: 'new' | 'resume' to session_before_switch and session_switch events
- Remove 'new' reason from custom tool onSession (use 'switch' for both /new and /resume)
- Rename reset() to newSession(options?) in AgentSession
- Add NewSessionOptions with optional parentSession for lineage tracking
- Rename branchedFrom to parentSession in SessionHeader
- Rename RPC reset command to new_session with optional parentSession
- Update example hooks to use new event structure
- Update documentation and changelog

Based on discussion in #293
2026-01-01 23:31:26 +01:00
Mario Zechner
e9cf47d09d Add CHANGELOG entries for export theme colors and syntax highlighting 2026-01-01 22:28:44 +01:00
Mario Zechner
dccdf91b8c Add ctx.ui.theme getter for styling status text with theme colors
- Add theme property to HookUIContext interface
- Implement in interactive, RPC, and no-op contexts
- Add status-line.ts example hook
- Document styling with theme colors in hooks.md
2026-01-01 21:58:01 +01:00
Prateek Sunal
9b2aa4a683
Hooks can render custom status (#385)
* Add ctx.ui.setStatus(key, text) API for hooks to display status in footer

- Add setStatus to HookUIContext interface
- Implement in interactive mode (FooterComponent)
- Implement in RPC mode (fire-and-forget)
- Add no-op implementations for headless contexts
- Multiple statuses displayed on single line, sorted by key
- Supports ANSI styling (hooks handle their own colors)

* Remove setStatus from changelog for now

* Fix hook status API to follow TUI rules

- Sanitize status text: replace newlines, tabs, carriage returns with spaces
- Truncate combined status line to terminal width using truncateToWidth
- Update JSDoc to document sanitization and truncation behavior
- Remove unused createHookUIContext method
- Add missing setStatus to test mock

* Add setStatus to changelog

* Use dim ellipsis for hook status truncation for consistency with footer style

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-01-01 21:35:37 +01:00
Mario Zechner
738892eb7a Make /share cancellable with Escape, add CHANGELOG entries
- Use BorderedLoader for /share command so Escape cancels gist creation
- Add CHANGELOG entries for /share command and HTML export improvements
- Add todo.md with remaining export-html issues
2026-01-01 21:27:33 +01:00
Mario Zechner
a073477555 Add changelog entries for #372 2026-01-01 02:16:51 +01:00
Mario Zechner
46bb5dcde8 fix: enabledModels now supports glob patterns for OAuth providers
Added glob pattern support (e.g., github-copilot/*, *sonnet*) to --models
and enabledModels. Patterns are matched against both provider/modelId and
just modelId, so *sonnet* works without requiring anthropic/*sonnet*.

The existing fuzzy substring matching for non-glob patterns is preserved.

fixes #337
2026-01-01 02:04:04 +01:00
Mario Zechner
7369128b3a Footer shows full session stats after compaction
FooterComponent now iterates over all session entries for cumulative
token usage and cost, not just post-compaction messages.

fixes #322
2026-01-01 00:37:59 +01:00
Mario Zechner
a2afa490f1 Coalesce sequential status messages
Rapidly changing settings no longer spams the chat log with multiple status lines.

fixes #365
2026-01-01 00:28:37 +01:00
Mario Zechner
506e63a969 Add thinkingText theme token, fix streaming toggle bug
- Add configurable thinkingText color for thinking blocks (defaults to muted)
- Make 'Thinking...' label italic when collapsed
- Fix Ctrl+T during streaming hiding the current message
- Track streamingMessage to properly re-render on toggle

Based on #366 by @paulbettner
2026-01-01 00:25:04 +01:00
Mario Zechner
c15efdbcd9 Merge main, resolve CHANGELOG conflict 2026-01-01 00:10:46 +01:00
Mario Zechner
02d0d6e192 Fix hook tool_result event not emitted for tool errors
Tools are supposed to throw on error. What needs fixing is that we need to report tool_result for erroneous tool executions as well.

Fixes #374
2025-12-31 17:12:55 +01:00
Aliou Diallo
98c85bf36a fix(coding-agent): save initial model and thinking level to session
When creating a new session, initial model and thinking level were set
on the agent but never saved to session file. This caused --resume to
default thinking level to 'off'.

fixes #342
2025-12-31 15:21:41 +01:00
Mario Zechner
116fbad24c Expand theme changes section in CHANGELOG.md
- Mark as breaking for custom themes
- Explain that custom themes must add new tokens or fail to load
- Note total color count increased from 46 to 50
- Reference theme.md and built-in themes
2025-12-31 14:35:39 +01:00
Mario Zechner
f0ab8db40f Expand pi.sendMessage and registerMessageRenderer docs in hooks.md
- sendMessage: document storage timing, LLM context, TUI display
- registerMessageRenderer: document renderer signature, return null for default
2025-12-31 14:34:30 +01:00
Mario Zechner
410659d45e Fix SessionManager method name: getPath -> getBranch 2025-12-31 14:30:08 +01:00
Mario Zechner
1b078a3f79 Document SessionManager and ModelRegistry in CHANGELOG.md
- SessionManager: method renames, new tree/append/branch methods
- ModelRegistry: new class for model discovery and API key resolution
2025-12-31 14:28:44 +01:00
Mario Zechner
2f2d5ffa52 Specify AgentSession for branching API in CHANGELOG.md 2025-12-31 14:27:45 +01:00
Mario Zechner
b0b8336a5f Document Attachment type removal in CHANGELOG.md
- SDK: Attachment removed, use ImageContent from @mariozechner/pi-ai
- RPC: prompt command attachments field replaced with images field
2025-12-31 14:24:47 +01:00
Mario Zechner
ccfdd58619 Clarify tree events are new in CHANGELOG.md
- session_before_tree/session_tree are new events, not renamed
- reason: tree and shutdown are new reasons for custom tools
2025-12-31 14:24:21 +01:00
Mario Zechner
b72cf47409 Rewrite CHANGELOG.md with migration guides
- Session Tree: brief description, reference session.md
- Hooks Migration: type renames, event changes, API changes
- Custom Tools Migration: type renames, execute signature, context object
- SDK Migration: type changes, branching API, exports
- RPC Migration: entryId, AgentMessage, compaction events
- Structured Compaction: output format, file tracking
- Interactive Mode: /tree, labels, themes, settings
- Keep Fixed section with external contributions
2025-12-31 14:11:55 +01:00
Mario Zechner
8fb936853b Add sdk.md intro, update CHANGELOG for branch() change 2025-12-31 13:48:22 +01:00
Mario Zechner
88e39471ea Remove hook execution timeouts
- Remove timeout logic from HookRunner
- Remove hookTimeout from Settings interface
- Remove getHookTimeout/setHookTimeout methods
- Update CHANGELOG.md and hooks.md

Timeouts were inconsistently applied and caused issues with
legitimate slow operations (LLM calls, user prompts). Users can
use Ctrl+C to abort hung hooks.
2025-12-31 12:57:54 +01:00
Mario Zechner
19c4182c21 Reorder execute params: (toolCallId, params, onUpdate, ctx, signal?)
Optional signal now at the end for cleaner API
2025-12-31 12:14:28 +01:00
Mario Zechner
4c9c453646 Update CHANGELOG, README, and custom-tools.md for new CustomTool API
- Add custom tools API rework to CHANGELOG breaking changes
- Update docs/custom-tools.md with new types and signatures
- Update README quick example with correct execute signature
2025-12-31 12:10:37 +01:00
Mario Zechner
b123df5fab Add custom tool dispose removal to CHANGELOG 2025-12-31 02:56:04 +01:00
Mario Zechner
ddda8b124c refactor(coding-agent): fix compaction for branched sessions, consolidate hook context types
Compaction API:
- prepareCompaction() now takes (pathEntries, settings) only
- CompactionPreparation restructured: removed cutPoint/messagesToKeep/boundaryStart, added turnPrefixMessages/isSplitTurn/previousSummary/fileOps/settings
- compact() now takes (preparation, model, apiKey, customInstructions?, signal?)
- Fixed token overflow by using getPath() instead of getEntries()

Hook types:
- HookEventContext renamed to HookContext
- HookCommandContext removed, RegisteredCommand.handler takes (args, ctx)
- HookContext now includes model field
- SessionBeforeCompactEvent: removed previousCompactions/model, added branchEntries
- SessionBeforeTreeEvent: removed model (use ctx.model)
- HookRunner.initialize() added for modes to set up callbacks
2025-12-31 02:24:24 +01:00
Mario Zechner
b4ce93c577 Expand CHANGELOG.md with complete API diff from v0.30.2
- Document renamed exports (messageTransformer -> convertToLlm, etc.)
- Document removed exports (createSummaryMessage, SUMMARY_PREFIX/SUFFIX, Attachment)
- Document new exports (entry types, branch summarization, compaction types, hook types)
- Add structured compaction and file tracking details
- Add entry labels feature description
- Remove duplicate entry labels from Changed section
2025-12-31 01:01:31 +01:00