acp-sdk
Version:
Agent Communication Protocol SDK
36 lines (33 loc) • 1.49 kB
TypeScript
import { SessionId, AgentManifest, AgentName, Run, Event, RunId, AwaitResume } from '../models/models.js';
import { Input } from './types.js';
import 'zod';
import 'type-fest';
type FetchLike = typeof fetch;
interface ClientInit {
baseUrl?: string;
/**
* Optional fetch implementation to use. Defaults to `globalThis.fetch`.
* Can also be used for advanced use cases like mocking, proxying, custom certs etc.
*/
fetch?: FetchLike;
sessionId?: string;
}
declare class Client {
#private;
constructor(init?: ClientInit);
get sessionId(): string | undefined;
withSession<T>(cb: (session: Client) => Promise<T>, sessionId?: SessionId): Promise<T>;
ping(): Promise<void>;
agents(): Promise<AgentManifest[]>;
agent(name: AgentName): Promise<AgentManifest>;
runSync(agentName: AgentName, input: Input): Promise<Run>;
runAsync(agentName: AgentName, input: Input): Promise<Run>;
runStream(agentName: AgentName, input: Input, signal?: AbortSignal): AsyncGenerator<Event, void, unknown>;
runStatus(runId: RunId): Promise<Run>;
runEvents(runId: RunId): Promise<Event[]>;
runCancel(runId: RunId): Promise<Run>;
runResumeSync(runId: RunId, awaitResume: AwaitResume): Promise<Run>;
runResumeAsync(runId: RunId, awaitResume: AwaitResume): Promise<Run>;
runResumeStream(runId: RunId, awaitResume: AwaitResume, signal?: AbortSignal): AsyncGenerator<Event, void, unknown>;
}
export { Client, type ClientInit };