mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-11 10:57:07 +00:00
* Revert "Remove the unreleased Antigravity provider plugin (#5781)"
This reverts commit 9d9d9af993.
* fix(providers): commit plugin notices emitted during session opening
* feat(providers): restore Antigravity with full access and session warnings
* fix(providers): warn once when opening Antigravity sessions
Driver respawn retains the live transcript and unchanged permission posture. Emit the warning only when opening a session, including resume after a daemon restart.
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { execFile } from "node:child_process";
|
|
import { promisify } from "node:util";
|
|
|
|
interface SignalOptions {
|
|
platform: NodeJS.Platform;
|
|
pid: number;
|
|
signal: NodeJS.Signals;
|
|
}
|
|
|
|
type SignalPlan =
|
|
| { type: "group"; pid: number; signal: NodeJS.Signals }
|
|
| { type: "tree"; command: "taskkill"; args: string[] };
|
|
|
|
const executeFile = promisify(execFile);
|
|
|
|
export function signalPlan(options: SignalOptions): SignalPlan {
|
|
if (options.platform === "win32") {
|
|
return { type: "tree", command: "taskkill", args: ["/PID", String(options.pid), "/T", "/F"] };
|
|
}
|
|
return { type: "group", pid: -options.pid, signal: options.signal };
|
|
}
|
|
|
|
export function signalProcess(options: SignalOptions): void | Promise<void> {
|
|
const plan = signalPlan(options);
|
|
if (plan.type === "tree") return killTree(plan);
|
|
try {
|
|
process.kill(plan.pid, plan.signal);
|
|
} catch (error) {
|
|
if (!(error instanceof Error && "code" in error && error.code === "ESRCH")) throw error;
|
|
}
|
|
}
|
|
|
|
async function killTree(plan: Extract<SignalPlan, { type: "tree" }>): Promise<void> {
|
|
try {
|
|
await executeFile(plan.command, plan.args, { windowsHide: true });
|
|
} catch (error) {
|
|
// taskkill reports an already-exited PID with exit code 128.
|
|
if (!(error instanceof Error && "code" in error && error.code === 128)) throw error;
|
|
}
|
|
}
|