Skip to main content

Module hooks

Module hooks 

Source
Expand description

Lifecycle hooks as the engine sees them: the events, the payload a hook is sent, the merged answer of one run, and the trait the session holds. The runner that parses the settings’ hooks and runs commands, prompts, HTTP and agents is the hooks crate’s (hooks::Factory); NoHooks is what a session runs on without it. What each event carries and what an answer can do there is documented by hooks::catalog.

Structs§

HookBlock
A hook refused the action.
HookInput
What a hook is sent. Which optional fields are set depends on the event.
HookSession
What a session’s own hooks are built from.
HookVerdict
What one run of an event’s hooks came to, merged.
NoHooks
No hooks: nothing runs, nothing is refused.

Enums§

AgentHookError
HookEvent
The events a settings file keys hooks by.

Traits§

AgentHookExecutor
Runs a "type": "agent" hook: the agent’s {"ok": bool, "reason": ...} as JSON text. The agent stops when stop does.
Hooks
A session’s hooks; one is shared by a session and its delegates.
HooksFactory
PromptHookExecutor
Runs a "type": "prompt" hook: the model’s answer, as the JSON text of a hook response. Returns soon once stop is cancelled.

Functions§

configures_hooks
Whether a settings hooks section asks for any hook: anything but nothing, null, or events each with an empty list.

Type Aliases§

HookAmbient
The fields every payload of a session carries, read when the hook fires: the permission mode changes under a session, so a snapshot would go stale.