import type { ProvisionEvent } from "./adapter.js"; import type { RemoteExecutor } from "./remote-executor.js"; import type { AdapterLogger } from "./logger.js"; /** * Build the env-file content string for the PowerLine process. * Returns the full file content (with trailing newline), or empty string if * there are no env vars to write. * @param powerlineToken - The PowerLine authentication token * @param extraEnv - Additional environment variables to include * @param logger - Logger for diagnostic output */ export declare function buildEnvFileContent(powerlineToken: string, extraEnv?: Record, logger?: AdapterLogger): string; /** * Write the environment variable file to the remote PowerLine directory. * Used during both initial bootstrap and reconnect (tokens may have rotated). */ export declare function writeRemoteEnvFile(executor: RemoteExecutor, powerlineToken: string, extraEnv?: Record, logger?: AdapterLogger): Promise; /** * Probe whether the remote PowerLine is listening on its port. * Throws if the port is not reachable. */ export declare function probeRemotePowerLine(executor: RemoteExecutor): Promise; /** * Build a shell command that kills the remote PowerLine process. * Prefers killing by tracked PID (written at startup) to avoid terminating * unrelated services on the same port. Falls back to port-based kill. */ export declare function buildRemoteKillCommand(): string; /** Options for {@link startRemotePowerLine}. */ export interface StartRemotePowerLineOptions { /** Additional environment variables forwarded to the remote PowerLine. */ extraEnv?: Record; /** Explicit working directory for the PowerLine process. */ workingDirectory?: string; /** * Host address to bind the PowerLine to. Defaults to unset (PowerLine's * own default, 127.0.0.1). Use "0.0.0.0" for Docker containers where * the port is accessed via Docker's port mapping. */ host?: string; /** * When true, detects `/workspaces/*\/` on the remote host (codespace * convention) and uses it as the working directory. */ autoDetectWorkspace?: boolean; /** * When true, the compound script starts with a TCP probe and exits * immediately if PowerLine is already listening. This avoids a separate * SSH round trip for the initial health check. */ probeFirst?: boolean; /** Logger for diagnostic output. */ logger?: AdapterLogger; } /** * Ensure the remote PowerLine process is running. * * Batches env-var write, process start, and port probe into a **single SSH * call** to minimize per-call latency (each `gh codespace ssh` round trip * takes ~10-15 s through GitHub's relay). * * Uses Node's `spawn({ detached: true })` to properly daemonize the * PowerLine process, avoiding the SSH-hanging issue where `nohup ... &` * keeps the session alive through GitHub's codespace relay. * * When `probeFirst` is true the script begins with a TCP port check and * returns immediately if PowerLine is already listening, combining the * "is it alive?" check and the "start if not" logic into one SSH call. * * This is the "restart" middle path — it assumes code is already installed * and skips npm install, git checks, and artifact copies. */ export declare function startRemotePowerLine(executor: RemoteExecutor, powerlineToken: string, options?: StartRemotePowerLineOptions): Promise<{ alreadyRunning: boolean; }>; /** Options for {@link bootstrapPowerLine}. */ export interface BootstrapOptions { /** Additional environment variables forwarded to the remote PowerLine. */ extraEnv?: Record; /** Explicit working directory for the PowerLine process. */ workingDirectory?: string; /** * Host address to bind the PowerLine to. Defaults to unset (PowerLine's * own default, 127.0.0.1). Use "0.0.0.0" for Docker containers where * the port is accessed via Docker's port mapping. */ host?: string; /** Logger for diagnostic output. */ logger?: AdapterLogger; /** Callback to check whether the GitHub credential provider is enabled. */ isGitHubProviderEnabled?: () => boolean; /** * Default runtime to eagerly install during provisioning. * When set, the runtime's packages are pre-installed into * `~/.grackle/runtimes//` so the first spawn is instant. */ defaultRuntime?: string; } /** * Bootstrap the PowerLine on a remote host via the given executor. * Yields progress events for each stage of the process. */ export declare function bootstrapPowerLine(executor: RemoteExecutor, powerlineToken: string, options?: BootstrapOptions): AsyncGenerator; //# sourceMappingURL=bootstrap.d.ts.map