export type SidecarStampShape = {
    app: string;
    ipc: string;
    mode: string;
    namespace: string;
    source: string;
};
export type SidecarContractDescriptor<TStamp extends SidecarStampShape = SidecarStampShape> = {
    defaults: {
        host: string;
        ipcBase: string;
        namespace: string;
        projectTmpDirName: string;
        windowsPipePrefix: string;
    };
    env: {
        base: string;
        ipcBase: string;
        ipcPath: string;
        namespace: string;
        source: string;
    };
    normalizeApp(app: unknown): TStamp["app"];
    normalizeNamespace(namespace: unknown): string;
    normalizeSource(source: unknown): TStamp["source"];
    normalizeStamp(input: unknown): TStamp;
};
export type NamespaceResolutionOptions<TStamp extends SidecarStampShape = SidecarStampShape> = {
    contract: SidecarContractDescriptor<TStamp>;
    env?: NodeJS.ProcessEnv;
    namespace?: string | null;
};
export type ProjectRuntimePathRequest<TStamp extends SidecarStampShape = SidecarStampShape> = {
    contract: SidecarContractDescriptor<TStamp>;
    projectRoot: string;
    source: TStamp["source"] | string;
};
export type BaseResolutionOptions<TStamp extends SidecarStampShape = SidecarStampShape> = {
    base?: string | null;
    contract: SidecarContractDescriptor<TStamp>;
    env?: NodeJS.ProcessEnv;
    projectRoot?: string;
    source: TStamp["source"] | string;
};
export type RuntimePathRequest<TStamp extends SidecarStampShape = SidecarStampShape> = {
    base: string;
    contract: SidecarContractDescriptor<TStamp>;
    namespace: string;
};
export type RuntimeRootRequest<TStamp extends SidecarStampShape = SidecarStampShape> = RuntimePathRequest<TStamp> & {
    runId: string;
};
export type AppIpcPathRequest<TStamp extends SidecarStampShape = SidecarStampShape> = {
    app: TStamp["app"] | string;
    contract: SidecarContractDescriptor<TStamp>;
    env?: NodeJS.ProcessEnv;
    namespace: string;
};
export type AppRuntimePathRequest<TStamp extends SidecarStampShape = SidecarStampShape> = {
    app: TStamp["app"] | string;
    contract: SidecarContractDescriptor<TStamp>;
    namespaceRoot: string;
};
export type SidecarRuntimeContext<TStamp extends SidecarStampShape = SidecarStampShape> = {
    app: TStamp["app"];
    base: string;
    ipc: string;
    mode: TStamp["mode"];
    namespace: string;
    source: TStamp["source"];
};
export type SidecarLaunchEnvRequest<TStamp extends SidecarStampShape = SidecarStampShape> = {
    base: string;
    contract: SidecarContractDescriptor<TStamp>;
    extraEnv?: NodeJS.ProcessEnv;
    stamp: TStamp;
};
export type BootstrapSidecarRuntimeOptions<TStamp extends SidecarStampShape = SidecarStampShape> = {
    app: TStamp["app"] | string;
    base?: string | null;
    contract: SidecarContractDescriptor<TStamp>;
    projectRoot?: string;
};
export type PortAllocation = {
    port: number;
    source: "dynamic" | "forced";
};
export type PortRequest = {
    host?: string;
    label?: string;
    port?: number | string | null;
    reserved?: Set<number>;
};
export type JsonIpcHandler = (message: any) => unknown | Promise<unknown>;
export type JsonIpcServerHandle = {
    close(): Promise<void>;
};
export declare function isWindowsNamedPipePath(value: unknown): boolean;
export declare function normalizeIpcPath(ipc: unknown): string;
export declare function resolveNamespace<TStamp extends SidecarStampShape>(options: NamespaceResolutionOptions<TStamp>): string;
export declare function resolveProjectRoot(projectRoot: string): string;
export declare function resolveProjectTmpRoot<TStamp extends SidecarStampShape>({ contract, projectRoot, }: {
    contract: SidecarContractDescriptor<TStamp>;
    projectRoot: string;
}): string;
export declare function resolveSourceRuntimeRoot<TStamp extends SidecarStampShape>({ contract, projectRoot, source, }: ProjectRuntimePathRequest<TStamp>): string;
export declare function resolveSidecarBase<TStamp extends SidecarStampShape>({ base, contract, env, projectRoot, source, }: BaseResolutionOptions<TStamp>): string;
export declare function resolveNamespaceRoot<TStamp extends SidecarStampShape>({ base, contract, namespace, }: RuntimePathRequest<TStamp>): string;
export declare function resolveRuntimeRoot<TStamp extends SidecarStampShape>({ base, contract, namespace, runId, }: RuntimeRootRequest<TStamp>): string;
export declare function resolvePointerPath<TStamp extends SidecarStampShape>({ base, contract, namespace }: RuntimePathRequest<TStamp>): string;
export declare function resolveManifestPath({ runtimeRoot }: {
    runtimeRoot: string;
}): string;
export declare function resolveLogsDir<TStamp extends SidecarStampShape>({ app, contract, runtimeRoot, }: {
    app: TStamp["app"] | string;
    contract: SidecarContractDescriptor<TStamp>;
    runtimeRoot: string;
}): string;
export declare function resolveLogFilePath<TStamp extends SidecarStampShape>({ app, contract, fileName, runtimeRoot, }: {
    app: TStamp["app"] | string;
    contract: SidecarContractDescriptor<TStamp>;
    fileName?: string;
    runtimeRoot: string;
}): string;
export declare function resolveAppRuntimeDir<TStamp extends SidecarStampShape>({ app, contract, namespaceRoot, }: AppRuntimePathRequest<TStamp>): string;
export declare function resolveAppRuntimePath<TStamp extends SidecarStampShape>({ app, contract, fileName, namespaceRoot, }: AppRuntimePathRequest<TStamp> & {
    fileName: string;
}): string;
export declare function resolveAppIpcPath<TStamp extends SidecarStampShape>({ app, contract, env, namespace, }: AppIpcPathRequest<TStamp>): string;
export declare function createSidecarLaunchEnv<TStamp extends SidecarStampShape>({ base, contract, extraEnv, stamp, }: SidecarLaunchEnvRequest<TStamp>): NodeJS.ProcessEnv;
export declare function bootstrapSidecarRuntime<TStamp extends SidecarStampShape>(stampInput: unknown, env: NodeJS.ProcessEnv, options: BootstrapSidecarRuntimeOptions<TStamp>): SidecarRuntimeContext<TStamp>;
export declare function allocatePort({ host, label, port, reserved, }?: PortRequest): Promise<PortAllocation>;
export declare function readJsonFile<T = any>(filePath: string): Promise<T | null>;
export declare function writeJsonFile(filePath: string, payload: unknown): Promise<void>;
export declare function removeFile(filePath: string): Promise<void>;
export declare function removePointerIfCurrent(pointerPath: string, runId: string): Promise<void>;
export declare function createJsonIpcServer({ handler, socketPath, }: {
    handler: JsonIpcHandler;
    socketPath: string;
}): Promise<JsonIpcServerHandle>;
export declare function requestJsonIpc<T = any>(socketPath: string, payload: unknown, { timeoutMs }?: {
    timeoutMs?: number;
}): Promise<T>;
//# sourceMappingURL=index.d.ts.map