Skip to main content

Module process

Module process 

Source
Expand description

Generic streaming subprocess engine — the shared core behind every process-backed harness (bob, Claude Code, Codex, …).

Spawns a child, pipes stdout/stderr line-by-line through a callback as ProcessEvents, augments PATH so Node-based CLIs resolve even from a Finder-launched .app, and hands back a ProcessHandle for cancellation (SIGTERM → SIGKILL). No harness-trait or bob knowledge — purely subprocess streaming.

Cancellation is the wrinkle: a run needs to be stoppable mid-stream when the user closes the tab or hits “stop”. ProcessHandle::cancel() sends SIGTERM (with a SIGKILL fallback) and flips an atomic cancelled flag the reader threads use to short-circuit.

Structs§

ProcessHandle
Handle to an in-flight streaming run. Caller stores it (e.g. in a runId-keyed map) so a later cancel() can find it.

Enums§

ProcessEvent
Raw events emitted to the caller’s callback during a streaming run. JSON-tagged so axum SSE and Tauri Channel render identical payloads on the wire. Harness-neutral: a process-backed adapter parses the Stdout lines into a normalized event vocabulary (e.g. agent-harness’s RunEvent).

Functions§

augmented_node_path
A PATH that resolves Node-based CLIs (bob, claude, codex) even from a process launched by Finder/Launchpad, which inherits only the minimal launchd PATH (/usr/bin:/bin:/usr/sbin:/sbin) rather than the user’s shell PATH.
spawn_streaming
Spawn an arbitrary streaming child process — the generic engine behind every process-backed harness (bob, Claude Code, Codex).