co-mono/packages/agent/CHANGELOG.md
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

2 KiB

Changelog

[Unreleased]

Fixed

  • prompt() and continue() now throw if called while the agent is already streaming, preventing race conditions and corrupted state. Use queueMessage() to queue messages during streaming, or await the previous call.

[0.31.1] - 2026-01-02

[0.31.0] - 2026-01-02

Breaking Changes

  • Transport abstraction removed: ProviderTransport, AppTransport, and AgentTransport interface have been removed. Use the streamFn option directly for custom streaming implementations.

  • Agent options renamed:

    • transport → removed (use streamFn instead)
    • messageTransformerconvertToLlm
    • preprocessortransformContext
  • AppMessage renamed to AgentMessage: All references to AppMessage have been renamed to AgentMessage for consistency.

  • CustomMessages renamed to CustomAgentMessages: The declaration merging interface has been renamed.

  • UserMessageWithAttachments and Attachment types removed: Attachment handling is now the responsibility of the convertToLlm function.

  • Agent loop moved from @mariozechner/pi-ai: The agentLoop, agentLoopContinue, and related types have moved to this package. Import from @mariozechner/pi-agent instead.

Added

  • streamFn option on Agent for custom stream implementations. Default uses streamSimple from pi-ai.

  • streamProxy() utility function for browser apps that need to proxy LLM calls through a backend server. Replaces the removed AppTransport.

  • getApiKey option for dynamic API key resolution (useful for expiring OAuth tokens like GitHub Copilot).

  • agentLoop() and agentLoopContinue() low-level functions for running the agent loop without the Agent class wrapper.

  • New exported types: AgentLoopConfig, AgentContext, AgentTool, AgentToolResult, AgentToolUpdateCallback, StreamFn.

Changed

  • Agent constructor now has all options optional (empty options use defaults).

  • queueMessage() is now synchronous (no longer returns a Promise).