Add AgentTool.prepareArguments and ToolDefinition.prepareArguments hook that runs before schema validation in the agent loop. This lets tools silently accept legacy argument shapes from resumed old sessions without polluting the public schema. The built-in edit tool uses this to fold legacy top-level oldText/newText into edits[] when resuming sessions that predate the edits-only schema. - AgentTool/ToolDefinition: typed prepareArguments returning Static<TParameters> - agent-loop: prepareToolCallArguments() runs before validateToolArguments() - edit tool: prepareEditArguments folds legacy fields, validateEditInput is strict - Documented in extensions.md with edit-tool example
7.9 KiB
Changelog
[Unreleased]
Added
- Added
AgentTool.prepareArgumentshook to prepare raw tool call arguments before schema validation, enabling compatibility shims for resumed sessions with outdated tool schemas
[0.63.2] - 2026-03-29
Added
- Added
Agent.signalto expose the active abort signal for the current turn, allowing callers to forward cancellation into nested async work (#2660)
[0.63.1] - 2026-03-27
[0.63.0] - 2026-03-27
[0.62.0] - 2026-03-23
[0.61.1] - 2026-03-20
[0.61.0] - 2026-03-20
[0.60.0] - 2026-03-18
[0.59.0] - 2026-03-17
[0.58.4] - 2026-03-16
Fixed
- Fixed steering messages to wait until the current assistant message's tool-call batch fully finishes instead of skipping pending tool calls.
[0.58.3] - 2026-03-15
[0.58.2] - 2026-03-15
[0.58.1] - 2026-03-14
[0.58.0] - 2026-03-14
Added
- Added
beforeToolCallandafterToolCallhooks toAgentOptionsandAgentLoopConfigfor preflight blocking and post-execution tool result mutation.
Changed
- Added configurable tool execution mode to
AgentandagentLoopviatoolExecution: "parallel" | "sequential", withparallelas the default. Parallel mode preflights tool calls sequentially, executes allowed tools concurrently, and emits final tool results in assistant source order.
[0.57.1] - 2026-03-07
[0.57.0] - 2026-03-07
[0.56.3] - 2026-03-06
[0.56.2] - 2026-03-05
[0.56.1] - 2026-03-05
[0.56.0] - 2026-03-04
[0.55.4] - 2026-03-02
[0.55.3] - 2026-02-27
[0.55.2] - 2026-02-27
[0.55.1] - 2026-02-26
[0.55.0] - 2026-02-24
[0.54.2] - 2026-02-23
[0.54.1] - 2026-02-22
[0.54.0] - 2026-02-19
[0.53.1] - 2026-02-19
[0.53.0] - 2026-02-17
[0.52.12] - 2026-02-13
Added
- Added
transporttoAgentOptionsandAgentLoopConfigforwarding, allowing stream transport preference ("sse","websocket","auto") to flow into provider calls.
[0.52.11] - 2026-02-13
[0.52.10] - 2026-02-12
[0.52.9] - 2026-02-08
[0.52.8] - 2026-02-07
[0.52.7] - 2026-02-06
Fixed
- Fixed
continue()to resume queued steering/follow-up messages when context currently ends in an assistant message, and preserved one-at-a-time steering ordering during assistant-tail resumes (#1312 by @ferologics)
[0.52.6] - 2026-02-05
[0.52.5] - 2026-02-05
[0.52.4] - 2026-02-05
[0.52.3] - 2026-02-05
[0.52.2] - 2026-02-05
[0.52.1] - 2026-02-05
[0.52.0] - 2026-02-05
[0.51.6] - 2026-02-04
[0.51.5] - 2026-02-04
[0.51.4] - 2026-02-03
[0.51.3] - 2026-02-03
[0.51.2] - 2026-02-03
[0.51.1] - 2026-02-02
[0.51.0] - 2026-02-01
[0.50.9] - 2026-02-01
[0.50.8] - 2026-02-01
Added
- Added
maxRetryDelayMsoption toAgentOptionsto cap server-requested retry delays. Passed through to the underlying stream function. (#1123)
[0.50.7] - 2026-01-31
[0.50.6] - 2026-01-30
[0.50.5] - 2026-01-30
[0.50.3] - 2026-01-29
[0.50.2] - 2026-01-29
[0.50.1] - 2026-01-26
[0.50.0] - 2026-01-26
[0.49.3] - 2026-01-22
[0.49.2] - 2026-01-19
[0.49.1] - 2026-01-18
[0.49.0] - 2026-01-17
[0.48.0] - 2026-01-16
[0.47.0] - 2026-01-16
[0.46.0] - 2026-01-15
[0.45.7] - 2026-01-13
[0.45.6] - 2026-01-13
[0.45.5] - 2026-01-13
[0.45.4] - 2026-01-13
[0.45.3] - 2026-01-13
[0.45.2] - 2026-01-13
[0.45.1] - 2026-01-13
[0.45.0] - 2026-01-13
[0.44.0] - 2026-01-12
[0.43.0] - 2026-01-11
[0.42.5] - 2026-01-11
[0.42.4] - 2026-01-10
[0.42.3] - 2026-01-10
[0.42.2] - 2026-01-10
[0.42.1] - 2026-01-09
[0.42.0] - 2026-01-09
[0.41.0] - 2026-01-09
[0.40.1] - 2026-01-09
[0.40.0] - 2026-01-08
[0.39.1] - 2026-01-08
[0.39.0] - 2026-01-08
[0.38.0] - 2026-01-08
Added
thinkingBudgetsoption onAgentandAgentOptionsto customize token budgets per thinking level (#529 by @melihmucuk)
[0.37.8] - 2026-01-07
[0.37.7] - 2026-01-07
[0.37.6] - 2026-01-06
[0.37.5] - 2026-01-06
[0.37.4] - 2026-01-06
[0.37.3] - 2026-01-06
Added
sessionIdoption onAgentto forward session identifiers to LLM providers for session-based caching.
[0.37.2] - 2026-01-05
[0.37.1] - 2026-01-05
[0.37.0] - 2026-01-05
Fixed
minimalthinking level now maps tominimalreasoning effort instead of being treated aslow.
[0.36.0] - 2026-01-05
[0.35.0] - 2026-01-05
[0.34.2] - 2026-01-04
[0.34.1] - 2026-01-04
[0.34.0] - 2026-01-04
[0.33.0] - 2026-01-04
[0.32.3] - 2026-01-03
[0.32.2] - 2026-01-03
[0.32.1] - 2026-01-03
[0.32.0] - 2026-01-03
Breaking Changes
- Queue API replaced with steer/followUp: The
queueMessage()method has been split into two methods with different delivery semantics (#403):steer(msg): Interrupts the agent mid-run. Delivered after current tool execution, skips remaining tools.followUp(msg): Waits until the agent finishes. Delivered only when there are no more tool calls or steering messages.
- Queue mode renamed:
queueModeoption renamed tosteeringMode. Added newfollowUpModeoption. Both control whether messages are delivered one-at-a-time or all at once. - AgentLoopConfig callbacks renamed:
getQueuedMessagessplit intogetSteeringMessagesandgetFollowUpMessages. - Agent methods renamed:
queueMessage()→steer()andfollowUp()clearMessageQueue()→clearSteeringQueue(),clearFollowUpQueue(),clearAllQueues()setQueueMode()/getQueueMode()→setSteeringMode()/getSteeringMode()andsetFollowUpMode()/getFollowUpMode()
Fixed
prompt()andcontinue()now throw if called while the agent is already streaming, preventing race conditions and corrupted state. Usesteer()orfollowUp()to queue messages during streaming, orawaitthe previous call.
[0.31.1] - 2026-01-02
[0.31.0] - 2026-01-02
Breaking Changes
-
Transport abstraction removed:
ProviderTransport,AppTransport, andAgentTransportinterface have been removed. Use thestreamFnoption directly for custom streaming implementations. -
Agent options renamed:
transport→ removed (usestreamFninstead)messageTransformer→convertToLlmpreprocessor→transformContext
-
AppMessagerenamed toAgentMessage: All references toAppMessagehave been renamed toAgentMessagefor consistency. -
CustomMessagesrenamed toCustomAgentMessages: The declaration merging interface has been renamed. -
UserMessageWithAttachmentsandAttachmenttypes removed: Attachment handling is now the responsibility of theconvertToLlmfunction. -
Agent loop moved from
@mariozechner/pi-ai: TheagentLoop,agentLoopContinue, and related types have moved to this package. Import from@mariozechner/pi-agent-coreinstead.
Added
-
streamFnoption onAgentfor custom stream implementations. Default usesstreamSimplefrom pi-ai. -
streamProxy()utility function for browser apps that need to proxy LLM calls through a backend server. Replaces the removedAppTransport. -
getApiKeyoption for dynamic API key resolution (useful for expiring OAuth tokens like GitHub Copilot). -
agentLoop()andagentLoopContinue()low-level functions for running the agent loop without theAgentclass wrapper. -
New exported types:
AgentLoopConfig,AgentContext,AgentTool,AgentToolResult,AgentToolUpdateCallback,StreamFn.
Changed
-
Agentconstructor now has all options optional (empty options use defaults). -
queueMessage()is now synchronous (no longer returns a Promise).