Skip to main content

Module script_callback

Module script_callback 

Source
Expand description

Script-based callbacks — run shell or Python scripts as lifecycle hooks.

ScriptCallback wraps an external script that receives JSON on stdin and returns JSON on stdout. The builder uses this to bridge config-specified script paths into Rust closure callbacks.

§Protocol

Input (stdin):

{ "hook": "before_loop", "session_id": "...", "loop_id": "...", ... }

Output (stdout) for before_* hooks:

{ "allow": true }

Output (stdout) for after_* hooks: Any JSON (logged but not acted upon).

Structs§

ScriptCallback
A callback that executes an external script (shell or Python).

Enums§

ScriptCallbackError
Errors from script callback execution.

Functions§

detect_interpreter
Detect the interpreter for a script based on file extension.
is_script_path
Returns true if a string looks like a script path (for config detection).