/**
 * Ack-gated launch paths for the tool child's own (main-thread) launches (senpi#3566, plan todo 4).
 *
 * `launchOwnGroup` (POSIX; `lifetime: "detached"` for an explicitly detached launch) starts the go-line shim
 * (`go-shim.ts`), which leads a new process group and blocks on a go-line read from a control descriptor (it exits 127 if
 * that closes first, e.g. when the child died); stdin stays the caller's. Its pid and group are sent as the containment
 * handle; only after the server acknowledged does the gate store the invoke tick and write the go-line, and only then
 * does the shim `exec` the real command, keeping pid and group. `gateInherited` is the same barrier for a call that stays in the child's own group: wait for the ack, record
 * the invoke tick, then call. Kernel-worker launches and Windows breakaway launches live in their own modules.
 */
import { type ChildProcess, type SpawnOptions } from "node:child_process";
import type { LaunchGate } from "./launch-gate.ts";
import type { LaunchApi, LaunchOrigin } from "./protocol.ts";
export interface GatedChild {
    readonly launchId: string;
    readonly child: ChildProcess;
    readonly exited: Promise<{
        readonly exitCode: number | null;
        readonly signal: NodeJS.Signals | null;
    }>;
}
export interface OwnGroupLaunch {
    readonly gate: LaunchGate;
    readonly jobId: string;
    readonly origin: LaunchOrigin;
    readonly api: LaunchApi;
    readonly program: string;
    readonly args: readonly string[];
    readonly options?: Omit<SpawnOptions, "detached" | "stdio"> & {
        readonly stdio?: readonly [
            "pipe" | "ignore" | "inherit",
            "pipe" | "ignore" | "inherit",
            "pipe" | "ignore" | "inherit"
        ];
    };
    readonly lifetime?: "owned" | "detached";
}
export declare function launchOwnGroup(launch: OwnGroupLaunch): Promise<GatedChild>;
/** A call that stays in the child's own group: ack first, then the invoke tick, then the call. */
export declare function gateInherited<T>(gate: LaunchGate, request: {
    readonly jobId: string;
    readonly origin: LaunchOrigin;
    readonly api: LaunchApi;
}, call: () => T): Promise<{
    readonly launchId: string;
    readonly value: T;
}>;
//# sourceMappingURL=launch-barrier.d.ts.map