pub struct ProcessRegistration { /* private fields */ }Expand description
A live process registration. Holds the generated proc_id and the env
vars to inject into the agent subprocess. Callers wire env_vars() and
on_spawn_hook() to the agent and call update_status() once the agent
exits.
Implementations§
Source§impl ProcessRegistration
impl ProcessRegistration
Sourcepub fn proc_id(&self) -> &str
pub fn proc_id(&self) -> &str
The UUID assigned to this registration. Matches the id field of the
ProcessEntry in zag’s process store and the ZAG_PROCESS_ID env
var injected into the child.
Sourcepub fn env_vars(&self) -> &[(String, String)]
pub fn env_vars(&self) -> &[(String, String)]
The env vars to inject into the agent subprocess so it can resolve
"self" for zag ps kill self / zig self terminate. Use with
crate::agent::Agent::set_env_vars (CLI path) or repeated
crate::builder::AgentBuilder::env calls (library path).
Sourcepub fn on_spawn_hook(&self) -> OnSpawnHook
pub fn on_spawn_hook(&self) -> OnSpawnHook
on_spawn hook that retargets the registry entry’s pid from zag’s
own pid (registered up-front so zag ps is populated immediately) to
the actual agent subprocess pid. Wire via
crate::agent::Agent::set_on_spawn_hook or
crate::builder::AgentBuilder::on_spawn.
Without this, zag ps kill self would SIGTERM the parent zag/zig
orchestrator instead of the agent child, taking the workflow down
with it.
Sourcepub fn update_status(&self, status: &str, exit_code: Option<i32>)
pub fn update_status(&self, status: &str, exit_code: Option<i32>)
Mark the registration’s entry as finished. Pass "exited" for clean
completion or "killed" when the agent crashed / was signalled.