@camerontaylor/paseo-client 0.8.0-fork.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,383 @@
1
+ import type { DaemonClientConfig } from "./daemon-client.js";
2
+ import type { AgentPermissionResponse } from "@camerontaylor/paseo-protocol/agent-types";
3
+ import type { AgentSnapshotPayload, CreationSnapshot, CreateAgentRequestMessage, FetchWorkspacesRequestMessage, FetchWorkspacesResponseMessage, GetProvidersSnapshotResponseMessage, ListAvailableProvidersResponse, ListCommandsResponse, ListProviderFeaturesRequestMessage, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ProjectListRequestMessage, ProjectListResponseMessage, ListProviderModesResponseMessage, MutableDaemonConfig, MutableDaemonConfigPatch, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, ProjectPlacementPayload, WorkspaceProjectDescriptorPayload, RefreshProvidersSnapshotResponseMessage, SendAgentMessageRequest, SessionOutboundMessage, WorkspaceDescriptorPayload, WorkspaceCreateRequest } from "@camerontaylor/paseo-protocol/messages";
4
+ import { DaemonClient } from "./daemon-client.js";
5
+ import { type PaseoTerminalActions, type PaseoWorkspaceTerminalActions } from "./terminals/index.js";
6
+ export type { PaseoTerminal, PaseoTerminalActions, PaseoTerminalHandle, PaseoTerminalCreateOptions, PaseoTerminalListOptions, PaseoTerminalListResult, PaseoTerminalCaptureOptions, PaseoTerminalCaptureResult, PaseoWorkspaceTerminalActions, } from "./terminals/index.js";
7
+ import type { PluginTimelineItem } from "@camerontaylor/paseo-protocol/agent-types";
8
+ import type { FetchAgentsEntry, FetchAgentsOptions, FetchAgentsPageInfo, FetchAgentTimelineCursor, FetchAgentTimelineDirection, FetchAgentTimelinePayload, FetchAgentTimelineProjection, WaitForFinishResult } from "./daemon-client.js";
9
+ export type ConnectionState = {
10
+ status: "idle";
11
+ } | {
12
+ status: "connecting";
13
+ attempt: number;
14
+ } | {
15
+ status: "connected";
16
+ } | {
17
+ status: "disconnected";
18
+ reason?: string;
19
+ } | {
20
+ status: "disposed";
21
+ };
22
+ export interface PaseoLogger {
23
+ debug(obj: object, msg?: string): void;
24
+ info(obj: object, msg?: string): void;
25
+ warn(obj: object, msg?: string): void;
26
+ error(obj: object, msg?: string): void;
27
+ }
28
+ export interface PaseoClientConfig {
29
+ capabilities?: DaemonClientConfig["capabilities"];
30
+ url: string;
31
+ clientId?: string;
32
+ appVersion?: string;
33
+ runtimeGeneration?: number | null;
34
+ password?: string;
35
+ authHeader?: string;
36
+ suppressSendErrors?: boolean;
37
+ logger?: PaseoLogger;
38
+ connectTimeoutMs?: number;
39
+ e2ee?: {
40
+ enabled?: boolean;
41
+ daemonPublicKeyB64?: string;
42
+ };
43
+ reconnect?: {
44
+ enabled?: boolean;
45
+ baseDelayMs?: number;
46
+ maxDelayMs?: number;
47
+ };
48
+ runtimeMetricsIntervalMs?: number;
49
+ runtimeMetricsWindowMs?: number;
50
+ }
51
+ export type PaseoWorkspace = WorkspaceDescriptorPayload;
52
+ export type PaseoAgent = AgentSnapshotPayload;
53
+ export type PaseoAgentListOptions = FetchAgentsOptions;
54
+ export type PaseoProject = WorkspaceProjectDescriptorPayload;
55
+ export type PaseoProjectListOptions = Omit<ProjectListRequestMessage, "type" | "requestId"> & {
56
+ requestId?: string;
57
+ };
58
+ export type PaseoProjectListResult = ProjectListResponseMessage["payload"];
59
+ export type PaseoProjectUpdate = Extract<SessionOutboundMessage, {
60
+ type: "project.update";
61
+ }>["payload"];
62
+ export type PaseoProjectUpdateHandler = (update: PaseoProjectUpdate) => void;
63
+ export interface PaseoAgentListResult {
64
+ requestId: string;
65
+ subscriptionId?: string | null;
66
+ entries: FetchAgentsEntry[];
67
+ pageInfo: FetchAgentsPageInfo;
68
+ }
69
+ export type PaseoWorkspaceListOptions = Omit<FetchWorkspacesRequestMessage, "type" | "requestId"> & {
70
+ requestId?: string;
71
+ };
72
+ export interface PaseoWorkspaceListResult {
73
+ requestId: string;
74
+ subscriptionId?: string | null;
75
+ entries: PaseoWorkspace[];
76
+ pageInfo: FetchWorkspacesResponseMessage["payload"]["pageInfo"];
77
+ }
78
+ export interface PaseoWorkspaceOpenOptions {
79
+ cwd: string;
80
+ requestId?: string;
81
+ }
82
+ export type PaseoWorkspaceCreateOptions = Omit<WorkspaceCreateRequest, "type" | "requestId" | "agent" | "subscribe"> & {
83
+ requestId?: string;
84
+ agent?: Omit<PaseoAgentCreateOptions, "worktree" | "git" | "onEvent" | "idempotencyKey" | "requestId">;
85
+ onEvent?: (snapshot: CreationSnapshot) => void;
86
+ };
87
+ export interface PaseoWorkspaceArchiveResult {
88
+ requestId: string;
89
+ workspaceId: string;
90
+ archivedAt: string | null;
91
+ error: string | null;
92
+ }
93
+ export type PaseoWorkspaceUpdate = Extract<SessionOutboundMessage, {
94
+ type: "workspace_update";
95
+ }>["payload"];
96
+ export type PaseoWorkspaceUpdateHandler = (update: PaseoWorkspaceUpdate) => void;
97
+ export interface PaseoWorkspaceHandle {
98
+ readonly id: string;
99
+ readonly projectId: string | null;
100
+ readonly directory: string | null;
101
+ readonly name: string | null;
102
+ readonly status: PaseoWorkspace["status"] | null;
103
+ readonly agents: {
104
+ create(options: PaseoWorkspaceAgentCreateOptions): Promise<PaseoAgentHandle>;
105
+ };
106
+ readonly terminals: PaseoWorkspaceTerminalActions;
107
+ current(): PaseoWorkspace | null;
108
+ refresh(options?: {
109
+ requestId?: string;
110
+ }): Promise<PaseoWorkspace | null>;
111
+ setTitle(title: string | null, requestId?: string): Promise<{
112
+ title: string | null;
113
+ }>;
114
+ archive(requestId?: string): Promise<PaseoWorkspaceArchiveResult>;
115
+ /**
116
+ * Subscribes to already-emitted daemon workspace_update events for this id.
117
+ * This returns a local unsubscribe function; it does not own app cache state or
118
+ * send a daemon unsubscribe RPC. Call `workspaces.list({ subscribe: {} })` when
119
+ * the daemon should start streaming workspace directory updates.
120
+ */
121
+ subscribe(handler: (update: PaseoWorkspaceUpdate) => void): () => void;
122
+ }
123
+ export interface PaseoProjectActions {
124
+ list(options?: PaseoProjectListOptions): Promise<PaseoProjectListResult>;
125
+ subscribe(handler: PaseoProjectUpdateHandler): () => void;
126
+ }
127
+ export interface PaseoWorkspaceActions {
128
+ list(options?: PaseoWorkspaceListOptions): Promise<PaseoWorkspaceListResult>;
129
+ ref(workspace: string | PaseoWorkspace): PaseoWorkspaceHandle;
130
+ open(input: string | PaseoWorkspaceOpenOptions, requestId?: string): Promise<PaseoWorkspaceHandle>;
131
+ create(options: PaseoWorkspaceCreateOptions): Promise<PaseoWorkspaceHandle>;
132
+ archive(workspace: string | PaseoWorkspaceHandle, requestId?: string): Promise<PaseoWorkspaceArchiveResult>;
133
+ /**
134
+ * Local event subscription over the low-level driver's workspace_update stream.
135
+ * The returned function only removes this SDK listener.
136
+ */
137
+ subscribe(handler: PaseoWorkspaceUpdateHandler): () => void;
138
+ }
139
+ type PaseoAgentSessionConfig = CreateAgentRequestMessage["config"];
140
+ export type PaseoAgentProvider = PaseoAgentSessionConfig["provider"];
141
+ export type PaseoProviderFeatureValues = Record<string, unknown>;
142
+ export interface PaseoAgentConfig {
143
+ /** Provider and model in `provider/model` format. */
144
+ provider: string;
145
+ modeId?: PaseoAgentSessionConfig["modeId"];
146
+ thinkingOptionId?: PaseoAgentSessionConfig["thinkingOptionId"];
147
+ featureValues?: PaseoProviderFeatureValues;
148
+ /** JSON-safe provider-native settings, validated by the selected provider. */
149
+ options?: PaseoAgentSessionConfig["providerOptions"];
150
+ systemPrompt?: PaseoAgentSessionConfig["systemPrompt"];
151
+ toolPolicy?: PaseoAgentSessionConfig["toolPolicy"];
152
+ mcpServers?: PaseoAgentSessionConfig["mcpServers"];
153
+ }
154
+ export interface PaseoAgentCreateOptions {
155
+ idempotencyKey?: string;
156
+ agentId?: string;
157
+ onEvent?: (snapshot: CreationSnapshot) => void;
158
+ config: PaseoAgentConfig;
159
+ cwd: string;
160
+ parent?: string | PaseoAgentHandle;
161
+ title?: PaseoAgentSessionConfig["title"];
162
+ env?: CreateAgentRequestMessage["env"];
163
+ prompt?: string;
164
+ clientMessageId?: string;
165
+ outputSchema?: Record<string, unknown>;
166
+ images?: CreateAgentRequestMessage["images"];
167
+ attachments?: CreateAgentRequestMessage["attachments"];
168
+ git?: CreateAgentRequestMessage["git"];
169
+ worktree?: CreateAgentRequestMessage["worktree"];
170
+ autoArchive?: CreateAgentRequestMessage["autoArchive"];
171
+ requestId?: string;
172
+ labels?: Record<string, string>;
173
+ }
174
+ export type PaseoWorkspaceAgentCreateOptions = Omit<PaseoAgentCreateOptions, "cwd">;
175
+ export interface PaseoAgentRefetchResult {
176
+ agent: PaseoAgent;
177
+ project: ProjectPlacementPayload | null;
178
+ }
179
+ export interface PaseoAgentTimelineRefetchOptions {
180
+ direction?: FetchAgentTimelineDirection;
181
+ cursor?: FetchAgentTimelineCursor;
182
+ limit?: number;
183
+ projection?: FetchAgentTimelineProjection;
184
+ requestId?: string;
185
+ }
186
+ export interface PaseoAgentSendOptions {
187
+ messageId?: string;
188
+ images?: Array<{
189
+ data: string;
190
+ mimeType: string;
191
+ }>;
192
+ attachments?: SendAgentMessageRequest["attachments"];
193
+ }
194
+ export interface PaseoAgentRunOptions extends PaseoAgentSendOptions {
195
+ timeoutMs?: number;
196
+ }
197
+ export type PaseoAgentRunResult = WaitForFinishResult;
198
+ export type PaseoAgentPermissionResponse = AgentPermissionResponse;
199
+ export interface PaseoAgentRespondToPermissionOptions {
200
+ requestId: string;
201
+ response: PaseoAgentPermissionResponse;
202
+ }
203
+ export interface PaseoAgentCommandsOptions {
204
+ requestId?: string;
205
+ }
206
+ export type PaseoAgentCommandsResult = ListCommandsResponse["payload"];
207
+ export type PaseoAgentUpdate = Extract<SessionOutboundMessage, {
208
+ type: "agent_update";
209
+ }>["payload"];
210
+ export type PaseoAgentStream = Extract<SessionOutboundMessage, {
211
+ type: "agent_stream";
212
+ }>["payload"];
213
+ export type PaseoAgentUpdateHandler = (update: PaseoAgentUpdate) => void;
214
+ export type PaseoAgentTimelineEvent = PaseoAgentStream | {
215
+ agentId: string;
216
+ event: {
217
+ type: "replacement";
218
+ epoch: string;
219
+ };
220
+ };
221
+ export type PaseoAgentTimelineSubscription = ReturnType<DaemonClient["subscribeAgentTimeline"]>;
222
+ export interface PaseoAgentTimelineHandle {
223
+ append(item: Omit<PluginTimelineItem, "pluginId">): Promise<{
224
+ seq: number;
225
+ epoch: string;
226
+ }>;
227
+ /**
228
+ * Fetches a fresh timeline page through the existing daemon RPC. If the daemon
229
+ * includes an agent snapshot in the response, the parent handle is updated to
230
+ * that value.
231
+ */
232
+ refetch(options?: PaseoAgentTimelineRefetchOptions): Promise<FetchAgentTimelinePayload>;
233
+ /**
234
+ * Subscribe to this agent and restore demand after reconnect. A replacement
235
+ * event invalidates previously fetched history; refetch the page you need.
236
+ * Await the returned unsubscribe function's `ready` promise before starting
237
+ * work that must be observed. It rejects if establishment fails.
238
+ */
239
+ subscribe(handler: (event: PaseoAgentTimelineEvent) => void): PaseoAgentTimelineSubscription;
240
+ }
241
+ export interface PaseoAgentHandle {
242
+ readonly id: string;
243
+ /**
244
+ * `workspaceId` through `archivedAt` mirror the last snapshot this handle
245
+ * observed. A handle from `ref()` reads `null` for all of them until
246
+ * `refresh()`, `run()`, `waitForFinish()`, a timeline refetch, or
247
+ * `subscribe()` delivers a snapshot. Optional snapshot values also read as
248
+ * `null`; use `current()` when you need to distinguish those states.
249
+ */
250
+ readonly workspaceId: string | null;
251
+ readonly cwd: string | null;
252
+ readonly status: PaseoAgent["status"] | null;
253
+ readonly capabilities: PaseoAgent["capabilities"] | null;
254
+ readonly availableModes: PaseoAgent["availableModes"] | null;
255
+ readonly pendingPermissions: PaseoAgent["pendingPermissions"] | null;
256
+ readonly activeTurn: NonNullable<PaseoAgent["activeTurn"]> | null;
257
+ readonly lastUsage: NonNullable<PaseoAgent["lastUsage"]> | null;
258
+ readonly lastError: NonNullable<PaseoAgent["lastError"]> | null;
259
+ readonly features: NonNullable<PaseoAgent["features"]> | null;
260
+ readonly runtimeInfo: NonNullable<PaseoAgent["runtimeInfo"]> | null;
261
+ readonly archivedAt: NonNullable<PaseoAgent["archivedAt"]> | null;
262
+ readonly timeline: PaseoAgentTimelineHandle;
263
+ current(): PaseoAgent | null;
264
+ refresh(requestId?: string): Promise<PaseoAgentRefetchResult | null>;
265
+ send(text: string, options?: PaseoAgentSendOptions): Promise<void>;
266
+ respondToPermission(options: PaseoAgentRespondToPermissionOptions): Promise<void>;
267
+ /** Sends a prompt and resolves when that turn finishes or needs attention. */
268
+ run(text: string, options?: PaseoAgentRunOptions): Promise<PaseoAgentRunResult>;
269
+ /** Waits for the current turn, including one started with `prompt`. */
270
+ waitForFinish(timeoutMs?: number): Promise<PaseoAgentRunResult>;
271
+ /**
272
+ * Asks the running session for the slash commands and skills it actually
273
+ * loaded. Providers answer from the live session, so this sees built-in and
274
+ * bundled entries that no directory scan can find. The payload carries its own
275
+ * `error` string; a provider that cannot answer reports it there rather than
276
+ * rejecting.
277
+ */
278
+ commands(options?: PaseoAgentCommandsOptions): Promise<PaseoAgentCommandsResult>;
279
+ archive(): Promise<{
280
+ archivedAt: string;
281
+ }>;
282
+ detach(): Promise<void>;
283
+ subscribe(handler: (update: PaseoAgentUpdate) => void): () => void;
284
+ }
285
+ export interface PaseoAgentActions {
286
+ list(options?: PaseoAgentListOptions): Promise<PaseoAgentListResult>;
287
+ ref(agent: string | PaseoAgent): PaseoAgentHandle;
288
+ create(options: PaseoAgentCreateOptions): Promise<PaseoAgentHandle>;
289
+ /**
290
+ * Local event subscription over the low-level driver's agent_update stream.
291
+ * The returned function only removes this SDK listener.
292
+ */
293
+ subscribe(handler: PaseoAgentUpdateHandler): () => void;
294
+ }
295
+ export type PaseoProviderModelsResult = ListProviderModelsResponseMessage["payload"];
296
+ export type PaseoProviderModesResult = ListProviderModesResponseMessage["payload"];
297
+ type PaseoProviderFeaturesDraft = ListProviderFeaturesRequestMessage["draftConfig"];
298
+ export interface PaseoProviderFeaturesInput extends Omit<PaseoProviderFeaturesDraft, "provider" | "model"> {
299
+ /** Provider and model in `provider/model` format. */
300
+ provider: string;
301
+ }
302
+ export type PaseoProviderFeaturesResult = ListProviderFeaturesResponseMessage["payload"];
303
+ export type PaseoProviderAvailabilityResult = ListAvailableProvidersResponse["payload"];
304
+ export type PaseoProviderSnapshotResult = GetProvidersSnapshotResponseMessage["payload"];
305
+ export type PaseoProviderSnapshotUpdate = Extract<SessionOutboundMessage, {
306
+ type: "providers_snapshot_update";
307
+ }>["payload"];
308
+ export type PaseoProviderRefreshResult = RefreshProvidersSnapshotResponseMessage["payload"];
309
+ export type PaseoProviderDiagnosticResult = ProviderDiagnosticResponseMessage["payload"];
310
+ export type PaseoProviderUsageResult = ProviderUsageListResponseMessage["payload"];
311
+ export interface PaseoProviderUsageOptions {
312
+ requestId?: string;
313
+ }
314
+ export interface PaseoProviderListOptions {
315
+ cwd?: string;
316
+ requestId?: string;
317
+ }
318
+ export interface PaseoProviderRefreshOptions {
319
+ cwd?: string;
320
+ providers?: PaseoAgentProvider[];
321
+ requestId?: string;
322
+ }
323
+ export interface PaseoProviderWaitOptions extends PaseoProviderListOptions {
324
+ timeoutMs?: number;
325
+ }
326
+ export interface PaseoProviderActions {
327
+ listModels(provider: PaseoAgentProvider, options?: PaseoProviderListOptions): Promise<PaseoProviderModelsResult>;
328
+ listModes(provider: PaseoAgentProvider, options?: PaseoProviderListOptions): Promise<PaseoProviderModesResult>;
329
+ listFeatures(draftConfig: PaseoProviderFeaturesInput, options?: {
330
+ requestId?: string;
331
+ }): Promise<PaseoProviderFeaturesResult>;
332
+ listAvailable(options?: {
333
+ requestId?: string;
334
+ }): Promise<PaseoProviderAvailabilityResult>;
335
+ snapshot(options?: PaseoProviderListOptions): Promise<PaseoProviderSnapshotResult>;
336
+ /** Resolves after the daemon's lazy provider discovery has finished. */
337
+ waitForReady(options?: PaseoProviderWaitOptions): Promise<PaseoProviderSnapshotResult>;
338
+ refresh(options?: PaseoProviderRefreshOptions): Promise<PaseoProviderRefreshResult>;
339
+ diagnostic(provider: PaseoAgentProvider, options?: {
340
+ requestId?: string;
341
+ }): Promise<PaseoProviderDiagnosticResult>;
342
+ listUsage(options?: PaseoProviderUsageOptions): Promise<PaseoProviderUsageResult>;
343
+ subscribe(handler: (update: PaseoProviderSnapshotUpdate) => void): () => void;
344
+ }
345
+ export interface PaseoConfigActions {
346
+ /**
347
+ * Reads daemon config through the existing config RPC. Provider profiles,
348
+ * custom provider entries, keys/env, custom binaries, and provider enablement
349
+ * are currently config-file-shaped daemon state, so the SDK exposes this raw
350
+ * typed surface instead of pretending there are higher-level provider-settings
351
+ * RPCs.
352
+ */
353
+ get(requestId?: string): Promise<{
354
+ requestId: string;
355
+ config: MutableDaemonConfig;
356
+ }>;
357
+ /**
358
+ * Patches daemon config through the existing config RPC. The daemon validates
359
+ * and persists supported fields; unsupported provider/settings workflows remain
360
+ * daemon gaps until first-class RPCs exist.
361
+ */
362
+ patch(config: MutableDaemonConfigPatch, requestId?: string): Promise<{
363
+ requestId: string;
364
+ config: MutableDaemonConfig;
365
+ }>;
366
+ }
367
+ export interface PaseoApi {
368
+ readonly terminals: PaseoTerminalActions;
369
+ readonly workspaces: PaseoWorkspaceActions;
370
+ readonly projects: PaseoProjectActions;
371
+ readonly agents: PaseoAgentActions;
372
+ readonly providers: PaseoProviderActions;
373
+ readonly config: PaseoConfigActions;
374
+ }
375
+ export interface PaseoClient extends PaseoApi {
376
+ connect(): Promise<void>;
377
+ close(): Promise<void>;
378
+ ensureConnected(): void;
379
+ getConnectionState(): ConnectionState;
380
+ }
381
+ export declare function createPaseoClient(config: PaseoClientConfig): PaseoClient;
382
+ export declare function createPaseoApi(daemonClient: DaemonClient): PaseoApi;
383
+ //# sourceMappingURL=index.d.ts.map