UNPKG

@code-yeongyu/senpi

Version:

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

53 lines • 2.73 kB
export interface HostUnitProbe { readonly platform: NodeJS.Platform; /** Whether `systemctl --user is-system-running` answered for this environment. */ readonly userManager: boolean; /** `systemd-run` resolved on this environment's PATH. */ readonly systemdRun: string | undefined; /** Whether that `systemd-run` could start a transient user scope just now. */ readonly scopeAccepted: boolean; } export type HostUnitPlacement = { readonly kind: "own_unit"; readonly unit: string; readonly systemdRun: string; } | { readonly kind: "caller_unit"; readonly reason: "not_linux" | "no_user_manager" | "no_systemd_run" | "scope_refused"; }; export declare function decideHostUnitPlacement(instanceId: string, probe: HostUnitProbe): HostUnitPlacement; export interface HostLaunchCommand { readonly command: string; readonly args: readonly string[]; } export declare function placedLaunch(launch: HostLaunchCommand, placement: HostUnitPlacement): HostLaunchCommand; /** What the placement needs to know about `env`, the environment the supervisor is spawned with. */ export declare function probeHostUnitPlacement(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): Promise<HostUnitProbe>; /** The launch a generation is spawned with: in its own scope where the user manager answers, else unchanged. */ export declare function placeHostLaunch(launch: HostLaunchCommand, instanceId: string, env: NodeJS.ProcessEnv): Promise<HostLaunchCommand>; /** The cgroup a generation's supervisor runs in, and whether it is that generation's own unit. */ export interface HostUnit { readonly cgroup: string; /** The `.service` / `.scope` unit owning that cgroup; stopping it ends the generation. */ readonly name: string | null; /** True when `name` is the generation's own scope, so no caller's unit decides its lifetime. */ readonly own: boolean; } /** Status rows with the unit each live generation's supervisor runs in; an ended one has none. */ export declare function withHostUnits<Row extends { readonly pid: number; readonly instanceId: string; readonly alive: boolean; }>(rows: readonly Row[]): Promise<(Row & { readonly unit: HostUnit | null; })[]>; /** * The `host ensure` / `host handoff` answer: the unit, and `lifetime_tied_to` naming the unit whose stop would end * the host when it is not the generation's own. */ export declare function hostUnitPayload(pid: number, instanceId: string | undefined): Promise<{ unit: HostUnit | null; lifetime_tied_to?: string; }>; export declare function hostUnitFromCgroupTable(table: string, instanceId: string | undefined): HostUnit | null; //# sourceMappingURL=host-unit-placement.d.ts.map