import { type postmortem } from "@oh-my-pi/pi-utils"; import { type Agent, type AgentSideConnection, type AuthenticateRequest, type AuthenticateResponse, type ClientCapabilities, type CloseSessionRequest, type CloseSessionResponse, type ForkSessionRequest, type ForkSessionResponse, type InitializeRequest, type InitializeResponse, type ListSessionsRequest, type ListSessionsResponse, type LoadSessionRequest, type LoadSessionResponse, type NewSessionRequest, type NewSessionResponse, type PromptRequest, type PromptResponse, type ResumeSessionRequest, type ResumeSessionResponse, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type SetSessionModeRequest, type SetSessionModeResponse } from "@oh-my-pi/pi-utils/acp"; import { type ExtensionUIContext } from "../../extensibility/extensions/index.js"; import type { AgentSession } from "../../session/agent-session.js"; /** * Delay between `session/new` (or `session/load` / `session/resume` / * `unstable_session/fork`) returning and the agent firing the first * notifications against the new session id. Mitigates Zed's * `Received session notification for unknown session` race — see * `#scheduleBootstrapUpdates`. Exported so the ACP test harness can * wait past this guard without hard-coding the literal. */ export declare const ACP_BOOTSTRAP_RACE_GUARD_MS = 50; type AcpSessionHandle = { session: AgentSession; setToolUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void; }; type CreateAcpSession = (cwd: string, options?: { interactivePrompts?: boolean; }) => Promise; /** * Build an {@link ExtensionUIContext} that translates skill/extension UI * requests into ACP elicitations against `connection` for the session * returned by `getSessionId()`. Hosts supply the stable protocol handle, * even when an extension changes the underlying durable session. * * The non-elicitation surface (custom components, theming, terminal * input) remains stubbed — ACP clients render those themselves or not * at all. Capability gating respects the client's `initialize` * advertisement. */ export declare function createAcpExtensionUiContext(connection: AgentSideConnection, getSessionId: () => string, clientCapabilities: ClientCapabilities | undefined): ExtensionUIContext; export declare class AcpAgent implements Agent { #private; constructor(connection: AgentSideConnection, createSession: CreateAcpSession, initialSession?: AgentSession); setCancelCleanupTimeoutForTesting(timeoutMs: number): void; initialize(params: InitializeRequest): Promise; authenticate(params: AuthenticateRequest): Promise; newSession(params: NewSessionRequest): Promise; loadSession(params: LoadSessionRequest): Promise; listSessions(params: ListSessionsRequest): Promise; resumeSession(params: ResumeSessionRequest): Promise; unstable_forkSession(params: ForkSessionRequest): Promise; closeSession(params: CloseSessionRequest): Promise; setSessionMode(params: SetSessionModeRequest): Promise; setSessionConfigOption(params: SetSessionConfigOptionRequest): Promise; prompt(params: PromptRequest): Promise; cancel(params: { sessionId: string; }): Promise; extMethod(method: string, params: { [key: string]: unknown; }): Promise<{ [key: string]: unknown; }>; extNotification(_method: string, _params: { [key: string]: unknown; }): Promise; get signal(): AbortSignal; get closed(): Promise; /** Dispose every session owned by this ACP connection and await persisted teardown. */ dispose(reason?: postmortem.Reason): Promise; } export {};