UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

40 lines • 2.43 kB
export interface WindowsProcessRow { readonly pid: number; readonly parentPid: number; readonly createdAt: bigint; readonly bunChromeFlag: boolean; readonly name: string; /** The `.bun-chrome` temp profile on a flagged process's command line (senpi#5571). */ readonly profileDir?: string; } /** * PowerShell that prints one `pid parentPid createdFileTime flag name<TAB>commandLine` line per process, leaving * out the listing's own PowerShell (its command line names the flag). The image name comes after the numbers * because it can contain spaces, and the command line (printed only for a flagged process, where it names the * profile Bun made) after a tab. A process without a readable creation time prints 0, so it never counts as the * child of a process that has one. */ export declare const WINDOWS_PROCESS_ROWS = "Get-CimInstance Win32_Process | Where-Object { $_.ProcessId -ne $PID } | ForEach-Object {\n$created = if ($_.CreationDate) { $_.CreationDate.ToFileTimeUtc() } else { 0 }\n$flag = if ($_.CommandLine -like '*--remote-debugging-pipe*') { 1 } else { 0 }\n$command = if ($flag) { $_.CommandLine } else { '' }\n\"{0} {1} {2} {3} {4}`t{5}\" -f $_.ProcessId, $_.ParentProcessId, $created, $flag, $_.Name, $command }"; export declare function parseWindowsProcessRows(stdout: string): WindowsProcessRow[]; export declare const BROWSER_IMAGE: RegExp; /** * Bun's Chrome browsers (direct children of `ownerPid` with a browser image and the flag, started after it) and * every process that genuinely descends from them. The walk only ever goes down from those roots. */ export declare function bunChromeTree(rows: readonly WindowsProcessRow[], ownerPid: number): number[]; export interface SkippedProcess { readonly pid: number; readonly name: string; readonly reason: "protected_image" | "ancestor_of_this_process"; } export interface ChromeKillPlan { readonly kill: readonly number[]; readonly skipped: readonly SkippedProcess[]; } /** * The tree to end. If the walk adopted anything that must never be killed - a protected OS image, or an ancestor * of this very process (killing one would end the caller) - the walk is not trusted: nothing is killed and every * such process is reported. */ export declare function bunChromeKillPlan(rows: readonly WindowsProcessRow[], ownerPid: number): ChromeKillPlan; //# sourceMappingURL=windows-chrome-tree.d.ts.map