import type { DaemonClientConfig } from "./daemon-client.js"; import type { AgentPermissionResponse } from "@getpaseo/protocol/agent-types"; import type { AgentSnapshotPayload, CreateAgentRequestMessage, FetchWorkspacesRequestMessage, FetchWorkspacesResponseMessage, GetProvidersSnapshotResponseMessage, ListAvailableProvidersResponse, ListCommandsResponse, ListProviderFeaturesRequestMessage, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ProjectListRequestMessage, ProjectListResponseMessage, ListProviderModesResponseMessage, MutableDaemonConfig, MutableDaemonConfigPatch, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, ProjectPlacementPayload, WorkspaceProjectDescriptorPayload, RefreshProvidersSnapshotResponseMessage, SendAgentMessageRequest, SessionOutboundMessage, WorkspaceDescriptorPayload, WorkspaceCreateRequest } from "@getpaseo/protocol/messages"; import { DaemonClient } from "./daemon-client.js"; import { type PaseoTerminalActions, type PaseoWorkspaceTerminalActions } from "./terminals/index.js"; export type { PaseoTerminal, PaseoTerminalActions, PaseoTerminalHandle, PaseoTerminalCreateOptions, PaseoTerminalListOptions, PaseoTerminalListResult, PaseoTerminalCaptureOptions, PaseoTerminalCaptureResult, PaseoWorkspaceTerminalActions, } from "./terminals/index.js"; import type { PluginTimelineItem } from "@getpaseo/protocol/agent-types"; import type { FetchAgentsEntry, FetchAgentsOptions, FetchAgentsPageInfo, FetchAgentTimelineCursor, FetchAgentTimelineDirection, FetchAgentTimelinePayload, FetchAgentTimelineProjection, WaitForFinishResult } from "./daemon-client.js"; export type ConnectionState = { status: "idle"; } | { status: "connecting"; attempt: number; } | { status: "connected"; } | { status: "disconnected"; reason?: string; } | { status: "disposed"; }; export interface PaseoLogger { debug(obj: object, msg?: string): void; info(obj: object, msg?: string): void; warn(obj: object, msg?: string): void; error(obj: object, msg?: string): void; } export interface PaseoClientConfig { capabilities?: DaemonClientConfig["capabilities"]; url: string; clientId?: string; appVersion?: string; runtimeGeneration?: number | null; password?: string; authHeader?: string; suppressSendErrors?: boolean; logger?: PaseoLogger; connectTimeoutMs?: number; e2ee?: { enabled?: boolean; daemonPublicKeyB64?: string; }; reconnect?: { enabled?: boolean; baseDelayMs?: number; maxDelayMs?: number; }; runtimeMetricsIntervalMs?: number; runtimeMetricsWindowMs?: number; } export type PaseoWorkspace = WorkspaceDescriptorPayload; export type PaseoAgent = AgentSnapshotPayload; export type PaseoAgentListOptions = FetchAgentsOptions; export type PaseoProject = WorkspaceProjectDescriptorPayload; export type PaseoProjectListOptions = Omit & { requestId?: string; }; export type PaseoProjectListResult = ProjectListResponseMessage["payload"]; export type PaseoProjectUpdate = Extract["payload"]; export type PaseoProjectUpdateHandler = (update: PaseoProjectUpdate) => void; export interface PaseoAgentListResult { requestId: string; subscriptionId?: string | null; entries: FetchAgentsEntry[]; pageInfo: FetchAgentsPageInfo; } export type PaseoWorkspaceListOptions = Omit & { requestId?: string; }; export interface PaseoWorkspaceListResult { requestId: string; subscriptionId?: string | null; entries: PaseoWorkspace[]; pageInfo: FetchWorkspacesResponseMessage["payload"]["pageInfo"]; } export interface PaseoWorkspaceOpenOptions { cwd: string; requestId?: string; } export type PaseoWorkspaceCreateOptions = Omit & { requestId?: string; }; export interface PaseoWorkspaceArchiveResult { requestId: string; workspaceId: string; archivedAt: string | null; error: string | null; } export type PaseoWorkspaceUpdate = Extract["payload"]; export type PaseoWorkspaceUpdateHandler = (update: PaseoWorkspaceUpdate) => void; export interface PaseoWorkspaceHandle { readonly id: string; readonly projectId: string | null; readonly directory: string | null; readonly name: string | null; readonly status: PaseoWorkspace["status"] | null; readonly agents: { create(options: PaseoWorkspaceAgentCreateOptions): Promise; }; readonly terminals: PaseoWorkspaceTerminalActions; current(): PaseoWorkspace | null; refresh(options?: { requestId?: string; }): Promise; setTitle(title: string | null, requestId?: string): Promise<{ title: string | null; }>; archive(requestId?: string): Promise; /** * Subscribes to already-emitted daemon workspace_update events for this id. * This returns a local unsubscribe function; it does not own app cache state or * send a daemon unsubscribe RPC. Call `workspaces.list({ subscribe: {} })` when * the daemon should start streaming workspace directory updates. */ subscribe(handler: (update: PaseoWorkspaceUpdate) => void): () => void; } export interface PaseoProjectActions { list(options?: PaseoProjectListOptions): Promise; subscribe(handler: PaseoProjectUpdateHandler): () => void; } export interface PaseoWorkspaceActions { list(options?: PaseoWorkspaceListOptions): Promise; ref(workspace: string | PaseoWorkspace): PaseoWorkspaceHandle; open(input: string | PaseoWorkspaceOpenOptions, requestId?: string): Promise; create(options: PaseoWorkspaceCreateOptions): Promise; archive(workspace: string | PaseoWorkspaceHandle, requestId?: string): Promise; /** * Local event subscription over the low-level driver's workspace_update stream. * The returned function only removes this SDK listener. */ subscribe(handler: PaseoWorkspaceUpdateHandler): () => void; } type PaseoAgentSessionConfig = CreateAgentRequestMessage["config"]; export type PaseoAgentProvider = PaseoAgentSessionConfig["provider"]; export type PaseoProviderFeatureValues = Record; export interface PaseoAgentConfig { /** Provider and model in `provider/model` format. */ provider: string; modeId?: PaseoAgentSessionConfig["modeId"]; thinkingOptionId?: PaseoAgentSessionConfig["thinkingOptionId"]; featureValues?: PaseoProviderFeatureValues; /** JSON-safe provider-native settings, validated by the selected provider. */ options?: PaseoAgentSessionConfig["providerOptions"]; systemPrompt?: PaseoAgentSessionConfig["systemPrompt"]; toolPolicy?: PaseoAgentSessionConfig["toolPolicy"]; mcpServers?: PaseoAgentSessionConfig["mcpServers"]; } export interface PaseoAgentCreateOptions { config: PaseoAgentConfig; cwd: string; parent?: string | PaseoAgentHandle; title?: PaseoAgentSessionConfig["title"]; env?: CreateAgentRequestMessage["env"]; prompt?: string; clientMessageId?: string; outputSchema?: Record; images?: CreateAgentRequestMessage["images"]; attachments?: CreateAgentRequestMessage["attachments"]; git?: CreateAgentRequestMessage["git"]; worktree?: CreateAgentRequestMessage["worktree"]; autoArchive?: CreateAgentRequestMessage["autoArchive"]; requestId?: string; labels?: Record; } export type PaseoWorkspaceAgentCreateOptions = Omit; export interface PaseoAgentRefetchResult { agent: PaseoAgent; project: ProjectPlacementPayload | null; } export interface PaseoAgentTimelineRefetchOptions { direction?: FetchAgentTimelineDirection; cursor?: FetchAgentTimelineCursor; limit?: number; projection?: FetchAgentTimelineProjection; requestId?: string; } export interface PaseoAgentSendOptions { messageId?: string; images?: Array<{ data: string; mimeType: string; }>; attachments?: SendAgentMessageRequest["attachments"]; } export interface PaseoAgentRunOptions extends PaseoAgentSendOptions { timeoutMs?: number; } export type PaseoAgentRunResult = WaitForFinishResult; export type PaseoAgentPermissionResponse = AgentPermissionResponse; export interface PaseoAgentRespondToPermissionOptions { requestId: string; response: PaseoAgentPermissionResponse; } export interface PaseoAgentCommandsOptions { requestId?: string; } export type PaseoAgentCommandsResult = ListCommandsResponse["payload"]; export type PaseoAgentUpdate = Extract["payload"]; export type PaseoAgentStream = Extract["payload"]; export type PaseoAgentUpdateHandler = (update: PaseoAgentUpdate) => void; export type PaseoAgentTimelineEvent = PaseoAgentStream | { agentId: string; event: { type: "replacement"; epoch: string; }; }; export type PaseoAgentTimelineSubscription = ReturnType; export interface PaseoAgentTimelineHandle { append(item: Omit): Promise<{ seq: number; epoch: string; }>; /** * Fetches a fresh timeline page through the existing daemon RPC. If the daemon * includes an agent snapshot in the response, the parent handle is updated to * that value. */ refetch(options?: PaseoAgentTimelineRefetchOptions): Promise; /** * Subscribe to this agent and restore demand after reconnect. A replacement * event invalidates previously fetched history; refetch the page you need. * Await the returned unsubscribe function's `ready` promise before starting * work that must be observed. It rejects if establishment fails. */ subscribe(handler: (event: PaseoAgentTimelineEvent) => void): PaseoAgentTimelineSubscription; } export interface PaseoAgentHandle { readonly id: string; /** * `workspaceId` through `archivedAt` mirror the last snapshot this handle * observed. A handle from `ref()` reads `null` for all of them until * `refresh()`, `run()`, `waitForFinish()`, a timeline refetch, or * `subscribe()` delivers a snapshot. Optional snapshot values also read as * `null`; use `current()` when you need to distinguish those states. */ readonly workspaceId: string | null; readonly cwd: string | null; readonly status: PaseoAgent["status"] | null; readonly capabilities: PaseoAgent["capabilities"] | null; readonly availableModes: PaseoAgent["availableModes"] | null; readonly pendingPermissions: PaseoAgent["pendingPermissions"] | null; readonly activeTurn: NonNullable | null; readonly lastUsage: NonNullable | null; readonly lastError: NonNullable | null; readonly features: NonNullable | null; readonly runtimeInfo: NonNullable | null; readonly archivedAt: NonNullable | null; readonly timeline: PaseoAgentTimelineHandle; current(): PaseoAgent | null; refresh(requestId?: string): Promise; send(text: string, options?: PaseoAgentSendOptions): Promise; respondToPermission(options: PaseoAgentRespondToPermissionOptions): Promise; /** Sends a prompt and resolves when that turn finishes or needs attention. */ run(text: string, options?: PaseoAgentRunOptions): Promise; /** Waits for the current turn, including one started with `prompt`. */ waitForFinish(timeoutMs?: number): Promise; /** * Asks the running session for the slash commands and skills it actually * loaded. Providers answer from the live session, so this sees built-in and * bundled entries that no directory scan can find. The payload carries its own * `error` string; a provider that cannot answer reports it there rather than * rejecting. */ commands(options?: PaseoAgentCommandsOptions): Promise; archive(): Promise<{ archivedAt: string; }>; detach(): Promise; subscribe(handler: (update: PaseoAgentUpdate) => void): () => void; } export interface PaseoAgentActions { list(options?: PaseoAgentListOptions): Promise; ref(agent: string | PaseoAgent): PaseoAgentHandle; create(options: PaseoAgentCreateOptions): Promise; /** * Local event subscription over the low-level driver's agent_update stream. * The returned function only removes this SDK listener. */ subscribe(handler: PaseoAgentUpdateHandler): () => void; } export type PaseoProviderModelsResult = ListProviderModelsResponseMessage["payload"]; export type PaseoProviderModesResult = ListProviderModesResponseMessage["payload"]; type PaseoProviderFeaturesDraft = ListProviderFeaturesRequestMessage["draftConfig"]; export interface PaseoProviderFeaturesInput extends Omit { /** Provider and model in `provider/model` format. */ provider: string; } export type PaseoProviderFeaturesResult = ListProviderFeaturesResponseMessage["payload"]; export type PaseoProviderAvailabilityResult = ListAvailableProvidersResponse["payload"]; export type PaseoProviderSnapshotResult = GetProvidersSnapshotResponseMessage["payload"]; export type PaseoProviderSnapshotUpdate = Extract["payload"]; export type PaseoProviderRefreshResult = RefreshProvidersSnapshotResponseMessage["payload"]; export type PaseoProviderDiagnosticResult = ProviderDiagnosticResponseMessage["payload"]; export type PaseoProviderUsageResult = ProviderUsageListResponseMessage["payload"]; export interface PaseoProviderUsageOptions { requestId?: string; } export interface PaseoProviderListOptions { cwd?: string; requestId?: string; } export interface PaseoProviderRefreshOptions { cwd?: string; providers?: PaseoAgentProvider[]; requestId?: string; } export interface PaseoProviderWaitOptions extends PaseoProviderListOptions { timeoutMs?: number; } export interface PaseoProviderActions { listModels(provider: PaseoAgentProvider, options?: PaseoProviderListOptions): Promise; listModes(provider: PaseoAgentProvider, options?: PaseoProviderListOptions): Promise; listFeatures(draftConfig: PaseoProviderFeaturesInput, options?: { requestId?: string; }): Promise; listAvailable(options?: { requestId?: string; }): Promise; snapshot(options?: PaseoProviderListOptions): Promise; /** Resolves after the daemon's lazy provider discovery has finished. */ waitForReady(options?: PaseoProviderWaitOptions): Promise; refresh(options?: PaseoProviderRefreshOptions): Promise; diagnostic(provider: PaseoAgentProvider, options?: { requestId?: string; }): Promise; listUsage(options?: PaseoProviderUsageOptions): Promise; subscribe(handler: (update: PaseoProviderSnapshotUpdate) => void): () => void; } export interface PaseoConfigActions { /** * Reads daemon config through the existing config RPC. Provider profiles, * custom provider entries, keys/env, custom binaries, and provider enablement * are currently config-file-shaped daemon state, so the SDK exposes this raw * typed surface instead of pretending there are higher-level provider-settings * RPCs. */ get(requestId?: string): Promise<{ requestId: string; config: MutableDaemonConfig; }>; /** * Patches daemon config through the existing config RPC. The daemon validates * and persists supported fields; unsupported provider/settings workflows remain * daemon gaps until first-class RPCs exist. */ patch(config: MutableDaemonConfigPatch, requestId?: string): Promise<{ requestId: string; config: MutableDaemonConfig; }>; } export interface PaseoApi { readonly terminals: PaseoTerminalActions; readonly workspaces: PaseoWorkspaceActions; readonly projects: PaseoProjectActions; readonly agents: PaseoAgentActions; readonly providers: PaseoProviderActions; readonly config: PaseoConfigActions; } export interface PaseoClient extends PaseoApi { connect(): Promise; close(): Promise; ensureConnected(): void; getConnectionState(): ConnectionState; } export declare function createPaseoClient(config: PaseoClientConfig): PaseoClient; export declare function createPaseoApi(daemonClient: DaemonClient): PaseoApi; //# sourceMappingURL=index.d.ts.map