import { type ProviderName } from "./providers"; import type { DiscoveredProcess } from "./types"; export declare function discoverClaudeProcesses(): Promise; export declare function tokenizeCommandLine(commandLine: string): string[]; /** * Whether a command line is a Claude Code CLI process. * * Accepts a native binary invoked by any path, and a JS runtime hosting the * published CLI entry point. Deliberately conservative: it inspects only the * executable and the script it runs, never the whole string, so an unrelated * process that merely mentions "claude" in a flag (an editor session, this * streamer itself) is not mistaken for an agent. */ export declare function looksLikeClaudeProcess(commandLine: string): boolean; /** * Whether a command line is an interactive Codex CLI session. * * Far more selective than the Claude matcher has to be, because "codex" is a * crowded name on a machine that has the ChatGPT desktop app: its Electron * framework is literally `Codex Framework.framework`, its helpers are * `Codex (Renderer)` and `Codex (Service)`, and `~/.codex/` holds a Chrome * extension host and a computer-use service. Measured on one developer machine, * 21 processes matched the word "codex" and only 3 were sessions. * * Two discriminators do the work: * * - The executable's base name must be exactly `codex`, which drops every * Electron helper and the `codex-code-mode-host` sidecar (which does have a * TTY, so liveness alone would not have separated it). * - No token may be a non-interactive subcommand. This is the load-bearing * one: the ChatGPT app's `/Applications/ChatGPT.app/Contents/Resources/codex` * and the VS Code extension's bundled binary are both named exactly `codex`, * and only `app-server` distinguishes them from a session someone is typing * at. Scanning every token rather than locating the subcommand means a * value that happens to equal one of these names costs a missed session, * never a wrongly claimed one. */ export declare function looksLikeCodexProcess(commandLine: string): boolean; export declare function looksLikeCursorProcess(commandLine: string): boolean; /** Which agent a command line is, or null when it is neither. */ export declare function providerForCommandLine(commandLine: string): ProviderName | null; export declare function extractCodexResumeId(args: string): string | null; /** The conversation id a discovered process is working on, if it states one. */ export declare function extractConversationId(args: string, provider: ProviderName): string | null; export declare function parsePsOutput(stdout: string): number[]; /** * Full command line of a single live process, or "" if it cannot be read. * * Used by the boot reconciler's pid-reuse guard: a recorded pid being alive is * never sufficient evidence that the process is still ours, because pids get * recycled. The caller matches its stored token against this before claiming a * surviving session — and treats an unreadable command line as "cannot confirm" * rather than "confirmed", so a failure here can never promote an unrelated * process into a managed session. */ export declare function getProcessArgs(pid: number): Promise; interface CimProcess { ProcessId: number; CommandLine: string | null; CreationDate: string | null; } export declare function parseCimProcesses(stdout: string): CimProcess[]; export declare function parseCimDate(value: string | null): Date; export declare function extractResumeId(args: string): string | null; export {}; //# sourceMappingURL=process-discovery.d.ts.map