Deliver inbox answers mid-turn through the PostToolUse hook

This commit is contained in:
Ian Gulliver
2026-10-15 10:20:23 -07:00
parent c934b00737
commit 03b70bd44e
10 changed files with 186 additions and 21 deletions
+11 -2
View File
@@ -129,10 +129,19 @@ func (m *Manager) dropSnapshots(repo, taskID string) error {
return git.DeleteSnapshotRefs(repo, taskID)
}
func (m *Manager) snapshotAfterTool(l *live) claude.HookFunc {
func (m *Manager) afterTool(l *live) claude.HookFunc {
return func(ctx context.Context, input json.RawMessage) (map[string]any, error) {
m.snapshotSoon(l, api.SnapshotTriggerToolCall)
return map[string]any{}, nil
text := m.deliverMidTurn(ctx, l)
if text == "" {
return map[string]any{}, nil
}
return map[string]any{
"hookSpecificOutput": map[string]any{
"hookEventName": "PostToolUse",
"additionalContext": text,
},
}, nil
}
}