import { Readable, Writable } from 'node:stream'; import { type Client } from '@agentclientprotocol/sdk'; import type { RuntimeHost } from '../host.js'; import type { AgentProfile } from '../agents.js'; import type { AcpTransport, AcpTransportConnection } from '../runtime.js'; export interface SpawnOptions { cwd: string; env?: NodeJS.ProcessEnv; } export interface SpawnedProcess { stdin: Writable | null; stdout: Readable | null; stderr: Readable | null; kill(signal?: NodeJS.Signals | number): boolean; } export type SpawnProcess = (command: string, args: string[], options: SpawnOptions) => SpawnedProcess; /** * Legacy connection factory hook. Prefer custom `AcpTransport` instead. * Kept for backward compatibility. */ export interface AcpConnectionFactory { create(params: { client: Client; process: SpawnedProcess; agent: AgentProfile; /** Optional host — when provided, the SDK factory will tap wire frames into `host.onWireMessage`. */ host?: RuntimeHost; }): AcpTransportConnection; } export interface NodeChildProcessTransportOptions { /** Override the process spawn function (defaults to `node:child_process` spawn with platform handling). */ spawnProcess?: SpawnProcess; /** Override how the spawned process is wrapped into an ACP connection. */ connectionFactory?: AcpConnectionFactory; /** * On macOS/Linux, launch the agent through the user's login shell so that * `PATH` includes nvm/Homebrew/etc. Useful when the host is a GUI app * (VS Code, Tauri shell) that didn't inherit the terminal `PATH`. * Default: `false`. */ useLoginShell?: boolean; } /** * Default ACP transport: spawns the agent as a child process, wires stdin/stdout * with `ndJsonStream`, and bridges to a `ClientSideConnection`. */ export declare function nodeChildProcessTransport(options?: NodeChildProcessTransportOptions): AcpTransport; export declare function defaultSpawnProcess(command: string, args: string[], options: SpawnOptions): SpawnedProcess; /** * macOS/Linux: launch the agent through the user's login shell so it inherits * `PATH` from `~/.zshrc`, `~/.bash_profile`, etc. On Windows behaves like * `defaultSpawnProcess` (which already routes `npx`/`*.cmd` through cmd.exe). */ export declare function createLoginShellSpawnProcess(): SpawnProcess; export declare function resolveLaunch(command: string, args: string[], platform?: NodeJS.Platform): { command: string; args: string[]; }; export declare function createSdkConnectionFactory(): AcpConnectionFactory;