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
+5 -5
View File
@@ -73,7 +73,7 @@ interface ObservationMessage {
type: 'observation';
tool_name: string;
tool_input: string;
tool_output: string;
tool_response: string;
prompt_number: number;
}
@@ -753,11 +753,11 @@ class WorkerService {
/**
* POST /sessions/:sessionDbId/observations
* Body: { tool_name, tool_input, tool_output, prompt_number }
* Body: { tool_name, tool_input, tool_response, prompt_number }
*/
private handleObservation(req: Request, res: Response): void {
const sessionDbId = parseInt(req.params.sessionDbId, 10);
const { tool_name, tool_input, tool_output, prompt_number } = req.body;
const { tool_name, tool_input, tool_response, prompt_number } = req.body;
const session = this.getOrCreateSession(sessionDbId);
const toolStr = logger.formatTool(tool_name, tool_input);
@@ -771,7 +771,7 @@ class WorkerService {
type: 'observation',
tool_name,
tool_input,
tool_output,
tool_response,
prompt_number
});
@@ -977,7 +977,7 @@ class WorkerService {
id: 0,
tool_name: message.tool_name,
tool_input: message.tool_input,
tool_output: message.tool_output,
tool_output: message.tool_response,
created_at_epoch: Date.now()
});