Commit graph

258 commits

Author SHA1 Message Date
Mario Zechner
12805f61bd Add [Unreleased] section for next cycle 2026-01-04 21:06:48 +01:00
Mario Zechner
71c978e2f9 Release v0.34.2 2026-01-04 21:06:08 +01:00
Mario Zechner
2a47b1114d Add [Unreleased] section for next cycle 2026-01-04 20:57:34 +01:00
Mario Zechner
de92eeda1f Release v0.34.1 2026-01-04 20:56:51 +01:00
Mario Zechner
61cadc226c Add [Unreleased] section for next cycle 2026-01-04 20:30:34 +01:00
Mario Zechner
dc2f5d43cc Release v0.34.0 2026-01-04 20:29:50 +01:00
Mario Zechner
7e2a99b485 Add [Unreleased] section for next cycle 2026-01-04 01:08:11 +01:00
Mario Zechner
faa10b9a7e Release v0.33.0 2026-01-04 01:07:24 +01:00
Mario Zechner
7aba5883f2 Add [Unreleased] section for next cycle 2026-01-03 17:09:58 +01:00
Mario Zechner
db829e73f9 Release v0.32.3 2026-01-03 17:09:22 +01:00
Mario Zechner
aea2ced2b8 Add [Unreleased] section for next cycle 2026-01-03 16:08:48 +01:00
Mario Zechner
113713d380 Release v0.32.2 2026-01-03 16:08:14 +01:00
Mario Zechner
5f91baa29e Add [Unreleased] section for next cycle 2026-01-03 04:26:33 +01:00
Mario Zechner
b783a3f50f Release v0.32.1 2026-01-03 04:25:57 +01:00
Mario Zechner
bc52509a42 Add [Unreleased] section for next cycle 2026-01-03 02:49:00 +01:00
Mario Zechner
42a19ea81d Release v0.32.0 2026-01-03 02:48:23 +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
a3772d2fd7 test(agent): update tests for steer()/followUp() API, update AGENTS.md 2026-01-03 00:13:25 +01:00
Mario Zechner
d0a4c37028 feat(agent): split queue into steer() and followUp() APIs
Breaking change: replaces queueMessage() with two separate methods:
- steer(msg): interrupt mid-run, delivered after current tool execution
- followUp(msg): wait until agent finishes before delivery

Also renames:
- queueMode -> steeringMode/followUpMode
- getQueuedMessages -> getSteeringMessages/getFollowUpMessages

Refs #403
2026-01-03 00:13:25 +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
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
6f7c10e323 Add setEditorText/getEditorText to hook UI context, improve custom() API
- Add setEditorText() and getEditorText() to HookUIContext for prompt generator pattern
- custom() now accepts async factories for fire-and-forget work
- Add CancellableLoader component to tui package
- Add BorderedLoader component for hooks with cancel UI
- Export HookAPI, HookContext, HookFactory from main package
- Update all examples to import from packages instead of relative paths
- Update hooks.md and custom-tools.md documentation

fixes #350
2026-01-01 00:04:56 +01:00
Mario Zechner
93f8d6e659 Fix README: tools are AgentTool, not extending Tool 2025-12-30 23:46:41 +01:00
Mario Zechner
b939f2b529 Fix README: use assistantMessageEvent.delta for streaming, not accumulated message 2025-12-30 23:43:27 +01:00
Mario Zechner
ae55389051 Rewrite agent README with clearer structure and event flow documentation 2025-12-30 23:40:49 +01:00
Mario Zechner
74637403b6 Update agent package: changelog, fix README type name, export proxy utilities 2025-12-30 23:33:32 +01:00
Mario Zechner
41af99cccf Support multiple messages in agent.prompt() and agentLoop
- agentLoop now accepts AgentMessage[] instead of single message
- agent.prompt() accepts AgentMessage | AgentMessage[]
- Emits message_start/end for each message in the array
- AgentSession.prompt() builds array with hook message + user message
- TUI now receives events for before_agent_start injected messages
2025-12-30 22:42:22 +01:00
Mario Zechner
4d1936d3df AgentInterface sets default streamFn and getApiKey
- Make Agent.streamFn and Agent.getApiKey public
- AgentInterface sets defaults if not already set
- Example no longer needs to configure these
2025-12-30 22:42:21 +01:00
Mario Zechner
92898f486b Allow async streamFn for dynamic proxy settings
- StreamFn type now allows returning Promise
- agent-loop awaits streamFn result
- createStreamFn takes getProxyUrl callback, reads settings on each call
2025-12-30 22:42:21 +01:00
Mario Zechner
e49e787322 Set isStreaming=false on agent_end event, before emitting to listeners
Was only setting in finally block, after event was emitted.
2025-12-30 22:42:21 +01:00
Mario Zechner
6ddc7418da WIP: Major cleanup - move Attachment to consumers, simplify agent API
- Removed Attachment from agent package (now in web-ui/coding-agent)
- Agent.prompt now takes (text, images?: ImageContent[])
- Removed transports from web-ui (duplicate of agent package)
- Updated coding-agent to use local message types
- Updated mom package for new agent API

Remaining: Fix AgentInterface.ts to compose UserMessageWithAttachments
2025-12-30 22:42:20 +01:00
Mario Zechner
f86dea2e4f Expand README with AgentMessage/LLM conversion, event semantics, partial messages
- Explain AgentMessage vs LLM Message separation and why it's needed
- Document conversion flow: AgentMessage -> transformContext -> convertToLlm -> LLM
- Clarify that prompt/queueMessage/continue must convert to user or toolResult
- Document message_start/end events for prompt() and queued messages
- Explain message_update is assistant-only with partial content
- Add pattern for handling partial messages in reactive UIs
- Document agent.state.streamMessage for accessing current partial
2025-12-30 22:42:20 +01:00
Mario Zechner
b6d9442916 Fix README: prompt takes ImageContent[], not Attachment[] 2025-12-30 22:42:20 +01:00
Mario Zechner
256d9a26bb Add CHANGELOG.md to agent package with refactor details 2025-12-30 22:42:20 +01:00
Mario Zechner
fa22595f25 Update READMEs: remove agent section from pi-ai, rewrite pi-agent-core
- Removed Agent API section from pi-ai README (moved to agent package)
- Rewrote agent package README for new architecture:
  - No more transports (ProviderTransport, AppTransport removed)
  - Uses streamFn directly with streamProxy for proxy usage
  - Documents convertToLlm and transformContext
  - Documents low-level agentLoop/agentLoopContinue API
  - Updated custom message types documentation
2025-12-30 22:42:20 +01:00
Mario Zechner
a055fd4481 WIP: Refactor agent package - not compiling
- Renamed AppMessage to AgentMessage throughout
- New agent-loop.ts with AgentLoopContext, AgentLoopConfig
- Removed transport abstraction, Agent now takes streamFn directly
- Extracted streamProxy to proxy.ts utility
- Removed agent-loop from pi-ai (now in agent package)
- Updated consumers (coding-agent, mom) for AgentMessage rename
- Tests updated but some consumers still need migration

Known issues:
- AgentTool, AgentToolResult not exported from pi-ai
- Attachment not exported from pi-agent-core
- ProviderTransport removed but still referenced
- messageTransformer -> convertToLlm migration incomplete
- CustomMessages declaration merging not working properly
2025-12-30 22:42:20 +01:00
Mario Zechner
f7ef44dc38 Fix: transform userMessage in _runAgentLoop before passing to transport
HookMessage (role: hookMessage) was being passed directly to transport
without transformation. Now it's transformed via messageTransformer
which converts it to a proper user message for the LLM.
2025-12-30 22:42:20 +01:00
Mario Zechner
204d27581b Cleanup: unify HookMessage naming and simplify SessionContext
- Rename HookAppMessage to HookMessage, isHookAppMessage to isHookMessage
- Remove entries array from SessionContext (use isHookMessage type guard instead)
- HookMessage.content now accepts string directly (not just array)
- Fix streamMessage type in AgentState (AppMessage, not Message)
- Rename CustomMessageComponent to HookMessageComponent
- Fix test hook to use pi.sendMessage
2025-12-30 22:42:20 +01:00
Mario Zechner
a2515cf43f Wire context event to preprocessor for per-LLM-call execution
- Change from contextTransform (runs once at agent start) to preprocessor
- preprocessor runs before EACH LLM call inside the agent loop
- ContextEvent now uses Message[] (pi-ai format) instead of AppMessage[]
- Deep copy handled by pi-ai preprocessor, not Agent

This enables:
- Pruning rules applied on every turn (not just agent start)
- /prune during long agent loop takes effect immediately
- Compaction can use same transforms (future work)
2025-12-30 22:42:20 +01:00
Mario Zechner
77fe3f1a13 Add context event for non-destructive message modification before LLM calls
- Add contextTransform option to Agent (runs before messageTransformer)
- Deep copy messages before passing to contextTransform (modifications are ephemeral)
- Add ContextEvent and ContextEventResult types
- Add emitContext() to HookRunner (chains multiple handlers)
- Wire up in sdk.ts when creating Agent with hooks

Enables dynamic context pruning: hooks can modify messages sent to LLM
without changing session data. See discussion #330.
2025-12-30 22:42:20 +01:00
Mario Zechner
c1b4d043a8 Remove emitLastMessage from continue(), use prompt(AppMessage) instead
Cleans up the temporary emitLastMessage plumbing since we now use
Agent.prompt(AppMessage) for hook messages instead of appendMessage+continue.

- Remove emitLastMessage parameter from Agent.continue()
- Remove from transport interface and implementations
- Remove from agentLoopContinue()
2025-12-30 22:42:19 +01:00
Mario Zechner
a6322fda59 Add Agent.prompt(AppMessage) overload for custom message types
Instead of using continue() which validates roles, prompt() now accepts
an AppMessage directly. This allows hook messages with role: 'hookMessage'
to trigger proper agent loop with message events.

- Add overloads: prompt(AppMessage) and prompt(string, attachments?)
- sendHookMessage uses prompt(appMessage) instead of appendMessage+continue
2025-12-30 22:42:19 +01:00
Mario Zechner
357bd946c2 Add emitLastMessage flag to agent.continue()
When calling continue() with emitLastMessage=true, the agent loop
emits message_start/message_end events for the last message in context.
This allows messages added outside the loop (e.g., hook messages via
sendHookMessage) to trigger proper TUI rendering.

Changes across packages:
- packages/ai: agentLoopContinue() accepts emitLastMessage parameter
- packages/agent: Agent.continue(), transports updated to pass flag
- packages/coding-agent: sendHookMessage passes true when triggerTurn
2025-12-30 22:42:19 +01:00
Mario Zechner
0e8173af00 Release v0.30.2 2025-12-26 03:25:55 +01:00
Mario Zechner
9dcb0bdba4 Release v0.30.1
fixes #320
2025-12-26 03:13:37 +01:00
Mario Zechner
6d97d212d5 Release v0.30.0 2025-12-25 20:35:14 +01:00
Mario Zechner
19dde0a988 Release v0.29.1 2025-12-25 18:10:11 +01:00