/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */ import type { ObservedAgentKind } from '../types.js'; /** One live process as read from the process table, only read-only-derivable facts. */ export interface ObservedRawProcess { readonly pid: number; readonly ppid: number; /** Full command line (argv joined by spaces), for the argv-shape kind match. */ readonly args: string; /** Controlling terminal path (e.g. `/dev/pts/11`), or undefined when the process has none. */ readonly tty?: string | undefined; /** Working directory, when derivable read-only (Linux `/proc//cwd`). */ readonly cwd?: string | undefined; /** Epoch ms the process started, when derivable. */ readonly startedAt?: number | undefined; /** Cumulative CPU seconds the OS reports for the process (monotonic per pid). */ readonly cpuSeconds: number; } /** Injectable process-table reader. The default reads Linux `/proc`; tests substitute a stub. */ export interface ProcessTableReader { read(): readonly ObservedRawProcess[]; } /** One tmux pane's tty → pane-id mapping row. */ export interface TmuxPaneRow { readonly paneId: string; /** The pane's controlling terminal path (tmux `#{pane_tty}`), e.g. `/dev/pts/11`. */ readonly tty: string; } /** Injectable tmux pane reader. The default runs `tmux list-panes -a`; tests substitute a stub. */ export interface TmuxPaneReader { listPanes(): readonly TmuxPaneRow[]; } /** * Classify a process's argv shape into an external coding-agent kind, or null * when it is not one of the known agents (so it is skipped entirely, not an * `unknown` row). `unknown` is reserved for a process that matched a launcher * shape but whose specific agent could not be named; the current matchers are * specific enough that they always name a kind, so null-vs-kind is the real * discriminator callers use. */ export declare function classifyExternalKind(args: string): ObservedAgentKind | null; /** A classified observed process: a raw row plus the external kind it matched. */ export interface ClassifiedObservedProcess extends ObservedRawProcess { readonly externalKind: ObservedAgentKind; } /** * Classify the process table into observed coding-agent rows, keeping ONE row * per session: a matched process whose parent is also a matched process of the * same kind is a child helper (e.g. the native `codex` binary under its `node` * launcher) and is dropped in favour of its root, so a single session never * lists twice. */ export declare function classifyObservedProcesses(processes: readonly ObservedRawProcess[]): ClassifiedObservedProcess[]; /** Map a controlling tty to a tmux pane id, from the pane list. */ export declare function paneForTty(panes: readonly TmuxPaneRow[], tty: string | undefined): TmuxPaneRow | undefined; /** * The real process-table reader over Linux `/proc`. Every field is read from a * pseudo-file or a symlink, no child process is spawned and no target process * is signalled or probed. On a host without `/proc` (non-Linux) it yields an * empty set, so detection is honestly quiet rather than wrong. */ export declare function defaultProcessTableReader(): ProcessTableReader; /** * The real tmux pane reader. Runs `tmux list-panes -a -F '#{pane_tty} #{pane_id}'` * once (read-only; never a state-changing tmux verb, never a shell). No tmux * server, or no panes, yields an empty set, detection then honestly reports no * steer channel for every tty. */ export declare function defaultTmuxPaneReader(): TmuxPaneReader; //# sourceMappingURL=detect.d.ts.map