@pai/client
Transport-agnostic thread facade, live state, pending action, and client-tool snapshot APIs.
@pai/client is the framework-agnostic TypeScript facade. It owns AgentClient, Thread, RunHandle, pending action helpers, local state reduction, and transport event handling. HTTP apps usually use createPaiHttpClient() from @pai/client-http, which wraps this facade with the HTTP/SSE transport.
pnpm add @pai/clientExports
| API | Purpose |
|---|---|
createAgentClient() | Create a client from an AgentClientTransport. |
AgentClient | Top-level client for manifests, threads, and thread lists. |
Thread | Thread handle for send, refresh, watch, queueing, files, and pending actions. |
ThreadState | Native PaiMessage[] transcript plus normalized runs, queue, usage, and thread attributes. |
PendingActionView | Command sidecar resolved from an exact message and native tool part. |
ClientToolDefinitionSnapshot | Low-level serialized definition for frontend-defined tools. |
| Thread error classes | Portable busy, conflict, ownership, pagination, and retry errors. |
React apps should usually create an HTTP client with @pai/client-http and pass it to @pai/react.