(event hooks.EventType, sessionID string, result *hooks.Result, dispatchErr error, duration time.Duration, agentName string)
| 811 | func (e *HookFinishedEvent) GetSessionID() string { return e.SessionID } |
| 812 | |
| 813 | func HookFinished(event hooks.EventType, sessionID string, result *hooks.Result, dispatchErr error, duration time.Duration, agentName string) Event { |
| 814 | e := &HookFinishedEvent{ |
| 815 | Type: "hook_finished", |
| 816 | SessionID: sessionID, |
| 817 | HookEvent: event, |
| 818 | DurationMs: duration.Milliseconds(), |
| 819 | Allowed: true, |
| 820 | AgentContext: newAgentContext(agentName), |
| 821 | } |
| 822 | if result != nil { |
| 823 | e.Allowed = result.Allowed |
| 824 | e.Message = result.Message |
| 825 | } |
| 826 | if dispatchErr != nil { |
| 827 | e.Allowed = false |
| 828 | e.Error = dispatchErr.Error() |
| 829 | } |
| 830 | return e |
| 831 | } |
| 832 | |
| 833 | // HookBlockedEvent is sent when a pre-tool hook blocks a tool call |
| 834 | type HookBlockedEvent struct { |
no test coverage detected