Skip to main content

Module processes

Module processes 

Source

Structs§

ConfiguredMcpServer
A configured MCP server distilled to what the process matcher needs: the configured name plus the stdio launch command + args used to match it against a live process cmdline.
InfraLabel
Friendly display name + kind for a recognized known-infra process.
ProcessEntry
One descendant process the scanner found alive. Field shape is driven by what a view’s process row builder needs (PID + cmdline + memory for the metadata line) + the cmdline-matching needed for wire-tracked overlay (process_cmdline_matches_tool_input).
ProcessSnapshot
Snapshot of claude’s descendant processes at one point in time. Always succeeds - failures (sysinfo errors, process gone) collapse to an empty processes vec.
RootProcess
One depth-0 process the elimination join may consider, with whether an alive wire tool call already claims it.

Constants§

SCAN_STALENESS
How old a snapshot may be before another walk replaces it.

Functions§

basename_exe
Strip the executable’s directory from a cmdline headline so the row reads cargo nextest run, not /opt/homebrew/bin/cargo nextest run. Only the FIRST token (the executable) is basenamed; args are kept verbatim (they carry the distinguishing detail). A first token with no / (e.g. a postgres: walwriter process title) is unchanged.
classify_known_infra
Friendly name for a known-infra process (MCP servers today), derived from its cmdline. None when unrecognized.
cmdline_haystack
The normalized cmdline text a process is matched on: the unwrapped inner command for a shell wrapper, else the cmdline itself.
cmdline_needle
The normalized command text a wire-tracked tool call is matched on. normalize_ws already trims, so a whitespace-only command yields the empty string and the caller can treat that as “no needle”.
configured_mcp_servers
Extract the stdio-launched configured MCP servers from an mcp-status snapshot. A server contributes (name, command, args) only when its config blob carries a string command (the stdio shape); url-only (http/sse) servers have no local process, so they’re skipped.
configured_text_match
The configured server whose command + args uniquely text-match cmdline. None when none matches or several do - the ambiguous case declines rather than guesses.
elect_unmatched_server
Pair the sole unmatched Connected stdio server with the sole unmatched candidate process, returning that process’s pid and the name its row takes.
extract_inner_command
Unwrap a shell-wrapper cmdline to the user command inside it. Recognizes the shape claude wraps Bash tool calls in (captured via ps -axww): /bin/zsh -c source <snapshot> ... && eval '<CMD>' < /dev/null && pwd -P >| /tmp/claude-<hash>-cwd. The inner command is single-quoted between eval ' and ' < /dev/null. Returns None when cmdline is not a recognized wrapper (non-shell processes pass through unchanged at the call site).
process_cmdline_matches_tool_input
True when process_cmd plausibly matches the shell command captured in a wire-tracked tool’s raw_input.command. Used by a view’s process row builder (path A+) to overlay wire-tracked task descriptions onto OS-detected processes when both refer to the same work.
resolve_infra_label
Friendly label for a known-infra process: the CONFIGURED MCP server name when the process’s command + args uniquely match one of configured, else the package-derived name from classify_known_infra. None when neither produces a name - the process isn’t a recognized MCP server.
scan
Walk claude_pid’s descendant tree plus any command-matched backgrounded local_bash and build a sorted snapshot. Always returns successfully - sysinfo failures, missing processes, or empty trees all collapse to an empty snapshot with a fresh scanned_at.
strip_plugin_namespace
The bare server name inside a plugin-namespaced configured name. The CLI exposes a plugin-provided MCP server as plugin:<plugin>:<server>, which reads worse than the package-derived name; anything else (including a plain name that merely contains a colon) is returned verbatim.