Expose full tool result content and details in hook tool_result event

Breaking change: ToolResultEvent now exposes content and typed details
instead of just a result string. Hook handlers returning { result: ... }
must change to { content: [...] }.

- ToolResultEvent is now a discriminated union based on toolName
- Each built-in tool has typed details (BashToolDetails, etc.)
- Export tool details types and TruncationResult
- Update hooks.md documentation

Closes #233
This commit is contained in:
Mario Zechner 2025-12-19 00:42:08 +01:00
parent 05b7b81338
commit 3d9bad8fb6
12 changed files with 187 additions and 34 deletions

View file

@ -2,6 +2,16 @@
## [Unreleased]
### Breaking Changes
- **Hook `tool_result` event restructured**: The `ToolResultEvent` now exposes full tool result data instead of just text. ([#233](https://github.com/badlogic/pi-mono/pull/233))
- Removed: `result: string` field
- Added: `content: (TextContent | ImageContent)[]` - full content array
- Added: `details: unknown` - tool-specific details (typed per tool via discriminated union on `toolName`)
- `ToolResultEventResult.result` renamed to `ToolResultEventResult.text` (removed), use `content` instead
- Hook handlers returning `{ result: "..." }` must change to `{ content: [{ type: "text", text: "..." }] }`
- Built-in tool details types exported: `BashToolDetails`, `ReadToolDetails`, `GrepToolDetails`, `FindToolDetails`, `LsToolDetails`, `TruncationResult`
### Changed
- **Skills standard compliance**: Skills now adhere to the [Agent Skills standard](https://agentskills.io/specification). Validates name (must match parent directory, lowercase, max 64 chars), description (required, max 1024 chars), and frontmatter fields. Warns on violations but remains lenient. Prompt format changed to XML structure. Removed `{baseDir}` placeholder in favor of relative paths. ([#231](https://github.com/badlogic/pi-mono/issues/231))