import type { AgentCommand, AgentPromptInput, AgentEvent, AgentReconfigureOptions, AgentRuntimeConfig, ClientTransport, IAgentRuntime } from "@skaile/workspaces/types"; /** * Framework-agnostic protocol client for remote skaile agent servers. * * Implements `IAgentRuntime` over a pluggable `ClientTransport` (WebSocket, stdio, * in-process mock, etc.). Translates each `IAgentRuntime` method call into a typed * `AgentCommand` sent through the transport, and fans incoming `AgentEvent` messages * out to all handlers registered via `onEvent`. Key methods: `start()` optionally * connects the transport and sends initial configuration; `configure()` reconfigures * the agent at runtime; `prompt()` sends a user message; `sendStateAction()` pushes * an action to a shared state store; `dispose()` sends a shutdown command and * disconnects the transport. * * One `AgentClient` instance represents one connection to one agent server. Mapping * multiple session IDs to client instances is the consumer's responsibility (e.g. * `WsAgentGatewayService` in the platform backend uses `Map`). * * @example * ```ts * const transport = new WebSocketClientTransport({ url: 'ws://localhost:8080' }); * const client = new AgentClient(transport); * await client.start({ projectDir: '/my/project' }); * client.onEvent((e) => console.log(e)); * await client.prompt('Hello'); * await client.dispose(); * ``` * * @docLink packages/client/dev-guide#agent-client */ export declare class AgentClient implements IAgentRuntime { private readonly transport; private readonly handlers; private readonly unsubTransport; constructor(transport: ClientTransport); /** Connect transport (if needed) and send initial configuration. */ start(config: AgentRuntimeConfig): Promise; /** * @deprecated v2 reconfigure path. Protocol v3 replaces this with a one-shot * `SessionInitCommand` envelope sent at session start; mid-session reconfig is * routed through the `runner.*` capability surface. Kept for v2 callers; the * cast survives because the wire shape is no longer in the `AgentCommand` * union. Remove once forge apps have migrated to v3. */ configure(config: AgentReconfigureOptions): Promise; /** Send a raw AgentCommand to the server. */ send(command: AgentCommand): void; /** Send a user message to the agent. */ prompt(message: string): Promise; promptInput(input: AgentPromptInput): Promise; /** * Answer an agent question. Pass `question` — verbatim from the `question` * event being answered — whenever the user can answer a multi-question call * out of order; without it the agent fills its next unanswered slot. */ reply(answer: string, question?: string, requestId?: string): Promise; /** Cancel the current operation. */ abort(): Promise; /** Shut down the agent and disconnect transport. */ dispose(): Promise; /** * @deprecated v2 shared-state mutation path. Protocol v3 routes shared-state * writes through the `runner.set_state` capability; this client method stays * as a stop-gap for v2 callers. The cast survives because `state_action` is * no longer in the `AgentCommand` union. Remove once forge apps have * migrated to v3. */ sendStateAction(store: string, action: Record): void; onEvent(handler: (event: AgentEvent) => void): void; offEvent(handler: (event: AgentEvent) => void): void; get isRunning(): boolean; } //# sourceMappingURL=client.d.ts.map