Skip to main content

make_base_hook_env

Function make_base_hook_env 

Source
pub fn make_base_hook_env(
    tool_name: &str,
    tool_input: &Value,
) -> HashMap<String, String>
Expand description

Build the common hook environment variables shared by all hook dispatch sites.

Sets ZEPH_TOOL_NAME and ZEPH_TOOL_ARGS_JSON. The serialized tool_input is truncated to TOOL_ARGS_JSON_LIMIT bytes at a valid UTF-8 boundary when it would exceed the OS ARG_MAX limit.

Callers should extend the returned map with site-specific variables such as ZEPH_AGENT_ID, ZEPH_AGENT_NAME, or ZEPH_SESSION_ID.

ยงExamples

use zeph_subagent::make_base_hook_env;

let env = make_base_hook_env("Edit", &serde_json::Value::Null);
assert_eq!(env["ZEPH_TOOL_NAME"], "Edit");
assert!(env.contains_key("ZEPH_TOOL_ARGS_JSON"));