MCPcopy Index your code
hub / github.com/docker/docker-agent / fireHook

Method fireHook

cmd/wasm/runtime_wasm.go:752–767  ·  view source on GitHub ↗

fireHook dispatches a hook event and returns the result.

(ctx context.Context, agentName string, event hooks.EventType, input *hooks.Input)

Source from the content-addressed store, hash-verified

750
751// fireHook dispatches a hook event and returns the result.
752func (rt *wasmRuntime) fireHook(ctx context.Context, agentName string, event hooks.EventType, input *hooks.Input) *hooks.Result {
753 exec, ok := rt.hookExec[agentName]
754 if !ok || exec == nil {
755 return nil
756 }
757 if !exec.Has(event) {
758 return nil
759 }
760
761 result, err := exec.Dispatch(ctx, event, input)
762 if err != nil {
763 slog.WarnContext(ctx, "Hook dispatch failed", "event", event, "agent", agentName, "error", err)
764 return nil
765 }
766 return result
767}
768
769// emitEvent sends a typed event to the JS onEvent callback.
770func (rt *wasmRuntime) emitEvent(event map[string]any) {

Callers 2

runAgentLoopMethod · 0.95
processToolCallsMethod · 0.95

Calls 2

DispatchMethod · 0.65
HasMethod · 0.45

Tested by

no test coverage detected