UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

112 lines • 4.24 kB
import "./gateway-lock-payload-CHvO7eLi.js"; import { MessagePort, Transferable } from "node:worker_threads"; import "execa"; import { Socket } from "node:net"; //#region src/process/exec-output.d.ts type CommandOutputCaptureMode = "head" | "tail" | "discard"; type CommandOutputStream = "stdout" | "stderr"; type CommandOutputCaptureOption = CommandOutputCaptureMode | { stdout?: CommandOutputCaptureMode; stderr?: CommandOutputCaptureMode; }; type CommandOutputLimitOption = boolean | { stdout?: boolean; stderr?: boolean; combined?: boolean; }; type CommandOutputErrorOption = boolean | { stdout?: boolean; stderr?: boolean; }; type PreserveOutputLine = (line: string, stream: CommandOutputStream) => boolean; //#endregion //#region src/process/exec-result.d.ts type SpawnResult = { pid?: number; stdout: string; stderr: string; stdoutTruncatedBytes?: number; stderrTruncatedBytes?: number; preservedStdoutLines?: string[]; preservedStderrLines?: string[]; code: number | null; signal: NodeJS.Signals | null; killed: boolean; /** The runner accepted cancellation and requested termination, independent of the OS signal. */ killIssuedByAbort?: boolean; /** Completion of this invocation's cleanup; never an escaped-descendant inventory. */ cleanup?: "normal" | "cooperative" | "forced" | "uncertain"; termination: "exit" | "timeout" | "no-output-timeout" | "signal"; noOutputTimedOut?: boolean; outputLimitExceeded?: boolean; outputErrorStream?: "stdout" | "stderr"; }; //#endregion //#region src/process/exec-runner.d.ts type CommandOptions = { timeoutMs?: number; cwd?: string; input?: string | Uint8Array; /** Borrow a caller-owned descriptor as stdin without buffering or piping its bytes. */ stdinFileDescriptor?: number; /** Synchronous admission with the spawned PID and argv, before input is released. */ beforeInput?: (pid: number, argv?: readonly string[]) => void; baseEnv?: NodeJS.ProcessEnv; env?: NodeJS.ProcessEnv; windowsVerbatimArguments?: boolean; noOutputTimeoutMs?: number; signal?: AbortSignal; maxOutputBytes?: number | { stdout?: number; stderr?: number; }; maxCombinedOutputBytes?: number; outputCapture?: CommandOutputCaptureOption; /** Observe raw output without owning child lifecycle. Return false to stop the command. */ onOutputChunk?: (chunk: Buffer, stream: CommandOutputStream) => boolean | void; /** Accept a successful exit when only the selected diagnostic output stream failed. */ tolerateOutputError?: { stdout?: boolean; stderr?: boolean; }; /** Terminate when the selected output stream emits an error. */ terminateOnOutputError?: CommandOutputErrorOption; terminateOnOutputLimit?: CommandOutputLimitOption; maxPreservedOutputLines?: number; preserveOutputLine?: PreserveOutputLine; killProcessTree?: boolean; /** Join owned descendants even after a successful root exits. */ requireProcessTreeExtinction?: boolean; /** Initial signal for direct-child and graceful process-group cancellation. */ killSignal?: NodeJS.Signals | number; /** Grace between graceful termination and the force-kill fallback. */ killGraceMs?: number; }; declare function runCommandWithTimeout(argv: string[], optionsOrTimeout: number | CommandOptions): Promise<SpawnResult>; //#endregion //#region src/process/exec.d.ts type RunExecOptions = { timeoutMs?: number; maxBuffer?: number; logOutput?: boolean; cwd?: string; baseEnv?: NodeJS.ProcessEnv; env?: NodeJS.ProcessEnv; input?: string | Uint8Array; stdinFileDescriptor?: number; signal?: AbortSignal; /** Observe received bytes without changing buffering, completion or cancellation. */ onOutputChunk?: (chunk: Buffer, stream: CommandOutputStream) => void; }; declare function runExec(command: string, args: string[], opts?: number | RunExecOptions): Promise<{ stdout: string; stderr: string; }>; //#endregion //#region src/infra/gateway-owner-lease.types.d.ts type GatewayOwnerSupervisor = { kind: "launchd" | "systemd" | "schtasks" | "external"; name: string | null; }; //#endregion export { SpawnResult as a, runCommandWithTimeout as i, runExec as n, CommandOptions as r, GatewayOwnerSupervisor as t };