Skip to content

ProcRef

Defined in: packages/core/src/kernel/types.ts:974

Narrow public view of a process, consumed by helpers that operate on behalf of another process (tool discovery, bin probing). ProcContext is structurally assignable to ProcRef — a ProcRef is the subset of fields these helpers actually touch, nothing more.

The four members below are the usage-grounded union audited against the three consumers — one line per field explaining which helper reads it:

  • env: enumerateBins reads $PATH to discover bin directories.
  • fs: enumerateBins calls readdir and stat on each $PATH entry to enumerate executable bins.
  • spawn: probeBin forwards to captureSpawn.spawn to run bin --help-mcp and capture stdout.
  • signal: probeBin forwards to captureSpawn.signal for the SIGTERM/SIGKILL timeout-kill path.

A fifth field is a design signal — do NOT widen this interface; split the helper instead, or raise a follow-up ticket. The compile-time assignability guard at packages/core/test/types/proc-ref.type-test.ts fails the build if ProcRef ever widens beyond what ProcContext satisfies.

ProcContext

readonly env: Record<string, string>

Defined in: packages/core/src/kernel/types.ts:976

Environment variables — consumed for $PATH lookups.


readonly fs: ProcFS

Defined in: packages/core/src/kernel/types.ts:978

Per-process fs view — consumed for readdir/stat on $PATH entries.

signal(pid, sig): void

Defined in: packages/core/src/kernel/types.ts:982

Send a signal to another process — forwarded to by captureSpawn for timeout kills.

Pid

Signal

void


spawn(bin, argv, opts?): Promise<ChildHandle>

Defined in: packages/core/src/kernel/types.ts:980

Spawn a child process — forwarded to by captureSpawn when probing bins.

string | BinFunction

string[]

SpawnOpts

Promise<ChildHandle>