import type { AgentIdentity } from './handshake.js'; /** * Who spawned this process — a GUESS, for a client that names itself to * nobody in its MCP handshake (handshake.ts holds the identity that is not a * guess). Before this, such a client signed in as "hexis-mcp on ", and * the person reading the Audit log saw the local server where they wanted * the agent. * * The agent is somewhere up the process tree: it spawns `npx`, which spawns * `node`, which runs this file — with shells in between, and on Windows * `cmd`. The walk goes up from the parent and stops at the first ancestor * it can NAME: a program on the list below, recognised by its executable, * its macOS bundle, or — for an agent that runs on a runtime such as `node` * — by the package or script its command line names. Everything else is * passed over, plumbing and unknown alike: a terminal, an ssh daemon, a * container runtime, an Electron helper are not agents, and a name the * list does not know is not a guess, it is a mystery, which the Audit log * must not carry. No match in a bounded number of hops is "no guess". * * Passing over the shells has one consequence worth knowing: a server * started BY HAND from an editor's integrated terminal has that editor * above the shell, and is named after it — the chain looks exactly like the * editor spawning the server through `cmd` or `sh`, which it does. The * stderr line says the name was guessed, and from what; a client that * names itself in its handshake is never guessed at. * * One process-table read per guess, never one per hop: the table is one or * two short commands on every platform, and a guess is made once, at sign-in. * * Nothing here is authoritative. A client that names itself always wins, and * the sign-in says on stderr when the name was guessed. */ export interface ProcessRow { pid: number; ppid: number; /** The executable as the platform reports it: `Claude.exe`, `node`, or a full path on macOS and Linux. */ name: string; /** The full command line, when the platform gives it. */ command?: string; } export type ProcessTable = () => Promise; /** The platform's process table; empty when it cannot be read. */ export declare const readProcessTable: ProcessTable; /** * The nearest ancestor of `startPid` that is an agent this module can name, * as an identity marked `guessed` — or null when the table cannot be read, * the chain ends, or no ancestor within `maxHops` is one. Loop-safe: a * table that reports a cycle (a reaped parent whose pid was reused) ends the * walk instead of spinning. */ export declare function guessAgentFromAncestry(startPid?: number, table?: ProcessTable, maxHops?: number): Promise; //# sourceMappingURL=parent-process.d.ts.map