Commit Graph

19 Commits

Author SHA1 Message Date
Bryan Frimin
6a77d42dd6 Style
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-16 00:28:47 +01:00
Bryan Frimin
7a4101185b Add per-folder CLAUDE.md for key packages
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-15 15:04:27 +01:00
Bryan Frimin
5d2b394bac Include error in tool_end event for interrupted tools
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-14 12:28:26 +01:00
Bryan Frimin
d01ee914c1 Style
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 20:00:22 +01:00
Bryan Frimin
deac1538e5 Style
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:58:02 +01:00
Bryan Frimin
d80a0fa7e4 Reject null input in agent tool parameter validation
JSON null unmarshals into an empty string, so the presence-only
key check let {"input":null} through, running the nested agent
with a blank user message.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:57:18 +01:00
Bryan Frimin
9d999559f1 Emit OnToolEnd hooks for interrupted and failed tools
executeSingleTool had three exit paths but only the success path
emitted all end signals. The interrupted path (nested agent
approval) skipped OnToolEnd and StreamEventToolEnd entirely,
leaving hook consumers with an unpaired OnToolStart. The error
path also missed StreamEventToolEnd and AgentHooks.OnToolEnd.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:53:08 +01:00
Bryan Frimin
5c889a1d47 Fall back to StructuredContent in MCP tool results
When an MCP server sets StructuredContent without populating
Content with TextContent entries, extractMCPContent returned
an empty string, making successful tool calls look empty to
the agent. Now the function serializes StructuredContent as
JSON when no text parts are found.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:43:19 +01:00
Bryan Frimin
1f5e68abe6 Fix typeName panic for interface type parameters
reflect.TypeOf on a nil interface value returns nil, causing a
panic when Kind() is called. Use reflect.TypeFor[T]() instead,
which resolves the type directly from the type parameter.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:34:07 +01:00
Bryan Frimin
0c3893ee8b Skip nil handoffs to prevent panic during run
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:31:09 +01:00
Bryan Frimin
cb4b893dfc Skip nil MCP servers in WithMCPServers
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:26:29 +01:00
Bryan Frimin
da9a594f79 Here's a commit message following the repo's style:
Fix Wait draining events from concurrent consumers
Wait() was ranging over the public Events channel, competing
with any concurrent reader for events. Callers that streamed
events in one goroutine and called Wait() in another would
lose an arbitrary subset of events. Wait now only blocks on
the done channel; the result fields are already visible thanks
to the close ordering (set fields → close events → close done).

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 19:22:46 +01:00
Bryan Frimin
f3239a1a7b Return errors from schema generation instead of panicking
jsonSchemaFor panicked on unsupported types, which meant
FunctionTool, NewOutputType, and RunTyped would crash the
process during setup rather than returning a normal error.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 18:56:56 +01:00
Bryan Frimin
def8f417ca Validate required input in agent tool execution
The agentTool.Execute method accepted {} despite the schema
marking input as required. Unlike functionTool, it skipped
required-field validation, silently sending an empty message
to the sub-agent.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 18:31:22 +01:00
Bryan Frimin
9f92a27b51 Emit tool-result for post-handoff tool calls
When the LLM returns tool calls after a handoff in the same
assistant message, they were silently dropped. This left
orphaned tool_call entries without matching tool-result
messages, causing protocol errors on the next LLM turn.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 18:28:37 +01:00
Bryan Frimin
a710a7472d Prevent infinite recursion when agents delegate to each other as tools
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 18:15:45 +01:00
Bryan Frimin
a0ed50a908 Propagate nested agent approval interruptions through tool pipeline
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 18:01:36 +01:00
Bryan Frimin
74f1d44119 Validate required tool parameters before execution
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 17:28:08 +01:00
Bryan Frimin
9fd251ee5d Add agent library
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-13 17:21:43 +01:00