Release v5.1.3: Fix PostToolUse hook field name bug

Bug Fix:
- Changed tool_output to tool_response throughout PostToolUse hook chain
- PostToolUse events provide tool_response field, not tool_output
- Updated save-hook.ts to send tool_response
- Updated worker-service.ts endpoint to accept tool_response
- Updated worker-service-v2.ts for consistency
- Updated worker-types.ts interfaces (PendingMessage, ObservationData)
- Updated SessionManager.ts message queue
- Updated SDKAgent.ts observation prompt builder

Impact: Fixes observation capture for PostToolUse events. Previous version was sending undefined for tool responses, causing incomplete observations.

Files changed:
- src/hooks/save-hook.ts (interface + destructuring + fetch body)
- src/services/worker-service.ts (ObservationMessage interface + handler + SDK prompt)
- src/services/worker-service-v2.ts (handler)
- src/services/worker-types.ts (PendingMessage + ObservationData interfaces)
- src/services/worker/SessionManager.ts (queue push)
- src/services/worker/SDKAgent.ts (observation prompt)
- plugin/scripts/*.js (rebuilt)
- Version bumped to 5.1.3 (patch)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2025-11-07 11:47:03 -05:00
parent 980151a50e
commit 13643a5b18
12 changed files with 21 additions and 21 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ export interface PostToolUseInput {
cwd: string;
tool_name: string;
tool_input: any;
tool_output: any;
tool_response: any;
[key: string]: any;
}
@@ -31,7 +31,7 @@ async function saveHook(input?: PostToolUseInput): Promise<void> {
throw new Error('saveHook requires input');
}
const { session_id, tool_name, tool_input, tool_output } = input;
const { session_id, tool_name, tool_input, tool_response } = input;
if (SKIP_TOOLS.has(tool_name)) {
console.log(createHookResponse('PostToolUse', true));
@@ -64,7 +64,7 @@ async function saveHook(input?: PostToolUseInput): Promise<void> {
body: JSON.stringify({
tool_name,
tool_input: tool_input !== undefined ? JSON.stringify(tool_input) : '{}',
tool_output: tool_output !== undefined ? JSON.stringify(tool_output) : '{}',
tool_response: tool_response !== undefined ? JSON.stringify(tool_response) : '{}',
prompt_number: promptNumber
}),
signal: AbortSignal.timeout(2000)