@pstdio/sdk 0.24.1 → 0.35.0

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,261 @@
1
+ import { $a as UpdateSkillInput, B as DispatchExtensionEventInput, Bd as AgentModel, Eo as UpdateNotificationInput, H as ExtensionConnectionRecord, L as UpgradeProjectExtensionResponse, M as EnableInstalledExtensionResponse, P as ListProjectExtensionsResponse, Q as ListExtensionCommandsResponse, Qa as SkillWithContent, R as CommandExecuteRequest, To as NotificationStatus, U as ListExtensionConnectionsResponse, Ud as ListActivityResponse, V as ConfigureExtensionConnectionInput, Wd as ListProjectActivityInput, Xa as Skill, Z as ListExtensionAppearanceResponse, _ as RegisterRepoInput, _o as ListNotificationsQuery, a as RemoveWorktreeResponse, ao as ListSessionActivityResponse, b as Project, c as WorkspaceFileContent, co as Session, ct as CreateAutomationRunInput, do as SessionConversationResponse, dt as ListAutomationRunEventsResponse, eo as ApprovalInput, f as WorkspaceProviderDescriptor, ft as ListAutomationTokensResponse, go as CreateNotificationInput, h as UpdateSettingsInput, i as ListWorkspaceFilesInput, io as ListSessionActivityInput, j as EnableInstalledExtensionRequest, l as WorkspaceFileEntry, lo as SessionAttachment, lt as IssueAutomationTokenInput, m as Settings, mo as SessionQueuedMessagesResponse, n as ListWorkspaceActivityInput, no as FollowUpInput, o as RenameWorkspaceInput, oo as ResolveSessionIdInput, p as WriteWorkspaceFileInput, po as SessionHistoryIssue, r as ListWorkspaceActivityResponse, ro as FollowUpResponse, rt as AutomationRun, so as ResolveSessionIdResponse, t as CreateWorkspaceInput, to as CreateSessionInput, u as WorkspaceFilesResponse, ut as IssueAutomationTokenResponse, v as Repo, vo as ListNotificationsResponse, y as CreateProjectInput, yo as Notification, z as CommandExecuteResponse, zd as AgentInfo } from "./index-x7CdJPRb.js";
2
+ import "./skills-DcxmP7uF.js";
3
+ import { n as WorkspaceListItem, t as Workspace } from "./index-iez3LrOK.js";
4
+ //#region src/client/request.d.ts
5
+ type ClientOptions = {
6
+ baseUrl?: string;
7
+ token?: string;
8
+ fetch?: typeof fetch;
9
+ };
10
+ declare class PstdioApiError extends Error {
11
+ status: number;
12
+ constructor(message: string, status: number);
13
+ }
14
+ type RequestOptions = {
15
+ method?: string;
16
+ body?: unknown;
17
+ signal?: AbortSignal;
18
+ headers?: HeadersInit;
19
+ cache?: RequestCache;
20
+ };
21
+ type RequestFn = <T>(path: string, options?: RequestOptions) => Promise<T>;
22
+ declare const createRequest: (options: ClientOptions) => RequestFn;
23
+ //#endregion
24
+ //#region src/client/agents.d.ts
25
+ type AgentClient = {
26
+ info(params?: {
27
+ project?: string;
28
+ }): Promise<AgentInfo[]>;
29
+ models(agentId: string): Promise<AgentModel[]>;
30
+ };
31
+ //#endregion
32
+ //#region src/client/automation.d.ts
33
+ type AutomationClient = {
34
+ issueToken(input: IssueAutomationTokenInput): Promise<IssueAutomationTokenResponse>;
35
+ listTokens(projectId: string): Promise<ListAutomationTokensResponse>;
36
+ revokeToken(tokenId: string): Promise<void>;
37
+ createRun(projectId: string, idempotencyKey: string, input: CreateAutomationRunInput): Promise<AutomationRun>;
38
+ getRun(projectId: string, runId: string): Promise<AutomationRun>;
39
+ listRunEvents(projectId: string, runId: string, after?: number): Promise<ListAutomationRunEventsResponse>;
40
+ cancelRun(projectId: string, runId: string): Promise<AutomationRun>;
41
+ };
42
+ //#endregion
43
+ //#region src/client/extensions.d.ts
44
+ type ExtensionClient = {
45
+ enableInstalled(projectId: string, installName: string, request: EnableInstalledExtensionRequest): Promise<EnableInstalledExtensionResponse>;
46
+ listAppearance(projectId: string): Promise<ListExtensionAppearanceResponse>;
47
+ listCommands(projectId: string): Promise<ListExtensionCommandsResponse>;
48
+ listProject(projectId: string): Promise<ListProjectExtensionsResponse>;
49
+ upgradeProject(projectId: string, instanceId: string): Promise<UpgradeProjectExtensionResponse>;
50
+ listConnections(projectId: string): Promise<ListExtensionConnectionsResponse>;
51
+ configureConnection(projectId: string, extensionId: string, connectionId: string, input: ConfigureExtensionConnectionInput): Promise<ExtensionConnectionRecord>;
52
+ checkConnection(projectId: string, extensionId: string, connectionId: string): Promise<ExtensionConnectionRecord>;
53
+ deleteConnection(projectId: string, extensionId: string, connectionId: string): Promise<void>;
54
+ execute(commandId: string, request: CommandExecuteRequest): Promise<CommandExecuteResponse>;
55
+ dispatchEvent(projectId: string, input: DispatchExtensionEventInput): Promise<void>;
56
+ };
57
+ //#endregion
58
+ //#region src/client/filesystem.d.ts
59
+ interface DirectoryEntry {
60
+ name: string;
61
+ path: string;
62
+ isDirectory: boolean;
63
+ isGitRepo: boolean;
64
+ }
65
+ declare const createFilesystemClient: (request: RequestFn) => {
66
+ list: (path?: string) => Promise<{
67
+ currentPath: string;
68
+ entries: DirectoryEntry[];
69
+ }>;
70
+ createDirectory: (input: {
71
+ parent_path: string;
72
+ name: string;
73
+ }) => Promise<{
74
+ path: string;
75
+ }>;
76
+ };
77
+ type FilesystemClient = ReturnType<typeof createFilesystemClient>;
78
+ //#endregion
79
+ //#region src/client/notifications.d.ts
80
+ type NotificationsClient = {
81
+ list(projectId: string, query?: ListNotificationsQuery): Promise<ListNotificationsResponse>;
82
+ count(projectId: string, query?: Pick<ListNotificationsQuery, "status" | "priority" | "sourceExtensionId">): Promise<{
83
+ count: number;
84
+ }>;
85
+ get(projectId: string, id: string): Promise<Notification>;
86
+ create(input: CreateNotificationInput): Promise<Notification>;
87
+ update(projectId: string, id: string, input: UpdateNotificationInput): Promise<Notification>;
88
+ markRead(projectId: string, id: string): Promise<Notification>;
89
+ dismiss(projectId: string, id: string): Promise<Notification>;
90
+ markDone(projectId: string, id: string): Promise<Notification>;
91
+ snooze(projectId: string, id: string, until: string): Promise<Notification>;
92
+ resolveByDedupeKey(projectId: string, input: {
93
+ dedupeKey: string;
94
+ status?: Extract<NotificationStatus, "done" | "dismissed" | "expired">;
95
+ }): Promise<{
96
+ resolved: number;
97
+ notifications: Notification[];
98
+ }>;
99
+ };
100
+ //#endregion
101
+ //#region src/client/projects.d.ts
102
+ type ProjectClient = {
103
+ list(): Promise<Project[]>;
104
+ get(projectId: string): Promise<Project>;
105
+ create(input: CreateProjectInput): Promise<Project>;
106
+ delete(projectId: string): Promise<void>;
107
+ listActivity(projectId: string, input?: ListProjectActivityInput): Promise<ListActivityResponse>;
108
+ listRepos(projectId: string): Promise<Repo[]>;
109
+ registerRepo(projectId: string, input: RegisterRepoInput): Promise<Repo>;
110
+ removeRepo(projectId: string, repoId: string): Promise<void>;
111
+ };
112
+ //#endregion
113
+ //#region src/client/runtime.d.ts
114
+ type RuntimeClient = {
115
+ provisionBrowserSession: () => Promise<void>;
116
+ };
117
+ declare const createRuntimeClient: (request: RequestFn) => RuntimeClient;
118
+ //#endregion
119
+ //#region src/client/sse.d.ts
120
+ type SseEvent = {
121
+ event: string;
122
+ data: string;
123
+ };
124
+ //#endregion
125
+ //#region src/client/sessions.d.ts
126
+ type ListSessionsInput = {
127
+ status?: string;
128
+ agent?: string;
129
+ workspaceId?: string;
130
+ archived?: boolean;
131
+ };
132
+ type SessionClient = {
133
+ list(projectId: string, input?: ListSessionsInput): Promise<Session[]>;
134
+ get(sessionId: string): Promise<Session>;
135
+ uploadAttachment(projectId: string, input: {
136
+ name: string;
137
+ data: Uint8Array | ArrayBuffer;
138
+ mimeType?: string | null;
139
+ }): Promise<SessionAttachment>;
140
+ deleteAttachment(projectId: string, fileId: string): Promise<void>;
141
+ create(input: CreateSessionInput): Promise<Session>;
142
+ archive(sessionId: string): Promise<void>;
143
+ followUp(sessionId: string, input: FollowUpInput): Promise<FollowUpResponse>;
144
+ approve(sessionId: string, input: ApprovalInput): Promise<void>;
145
+ getConversation(sessionId: string, signal?: AbortSignal): Promise<SessionConversationResponse>;
146
+ resolveSessionId(input: ResolveSessionIdInput): Promise<ResolveSessionIdResponse>;
147
+ updateStatus(sessionId: string, status: string): Promise<Session>;
148
+ listActivity(sessionId: string, input?: ListSessionActivityInput): Promise<ListSessionActivityResponse>;
149
+ stream(sessionId: string, onEvent: (event: SseEvent) => void, options?: {
150
+ signal?: AbortSignal;
151
+ }): Promise<void>;
152
+ connectStream(sessionId: string, handlers: SessionStreamHandlers, options?: {
153
+ attempt?: number;
154
+ }): SessionStreamConnection;
155
+ };
156
+ type SessionStreamHandlers = {
157
+ onReady?: (data: unknown) => void;
158
+ onPatch?: (data: unknown) => void;
159
+ onApprovalRequest?: (data: unknown) => void;
160
+ onHistoryIssue?: (data: SessionHistoryIssue) => void;
161
+ onQueuedMessages?: (data: SessionQueuedMessagesResponse | {
162
+ error: string;
163
+ }) => void;
164
+ onEnd?: (data: unknown) => void;
165
+ onError?: (error: unknown) => void;
166
+ };
167
+ type SessionStreamConnection = {
168
+ close: () => void;
169
+ };
170
+ //#endregion
171
+ //#region src/client/settings.d.ts
172
+ type SettingsClient = {
173
+ get(): Promise<Settings>;
174
+ update(input: UpdateSettingsInput): Promise<Settings>;
175
+ };
176
+ //#endregion
177
+ //#region src/client/skills.d.ts
178
+ type SkillClient = {
179
+ list(projectId: string): Promise<Skill[]>;
180
+ get(projectId: string, skillId: string): Promise<SkillWithContent>;
181
+ updatePreferences(projectId: string, skillName: string, input: UpdateSkillInput): Promise<Skill>;
182
+ };
183
+ //#endregion
184
+ //#region src/client/sync.d.ts
185
+ type SyncRow = {
186
+ id: string;
187
+ [key: string]: unknown;
188
+ };
189
+ type SyncWriter = {
190
+ truncateAndWrite: (rows: SyncRow[]) => void;
191
+ upsert: (row: SyncRow) => void;
192
+ remove: (id: string) => void;
193
+ };
194
+ type SyncWriterProvider = {
195
+ getWriter: (table: string) => SyncWriter | undefined;
196
+ };
197
+ type SyncConnection = {
198
+ close: () => void;
199
+ connected: boolean;
200
+ };
201
+ type StartSyncInput = SyncWriterProvider & {
202
+ /** Called after the initial snapshot, or when a cursor-based connection resumes. */
203
+ onConnected?: () => void;
204
+ onDisconnected?: () => void;
205
+ onConnectionLost?: () => void;
206
+ heartbeatIntervalMs?: number;
207
+ heartbeatThreshold?: number;
208
+ reconnectDelayMs?: number;
209
+ };
210
+ type SyncClient = {
211
+ start: (input: StartSyncInput) => SyncConnection;
212
+ };
213
+ declare const parseSyncDeleteEvent: (data: string) => {
214
+ table: string;
215
+ id: string;
216
+ seq: number;
217
+ };
218
+ declare const applySyncEvent: (event: string, data: string, writers: SyncWriterProvider) => number | null;
219
+ //#endregion
220
+ //#region src/client/workspaces.d.ts
221
+ type WorkspaceClient = {
222
+ listProviders(projectId: string): Promise<WorkspaceProviderDescriptor[]>;
223
+ list(projectId: string): Promise<WorkspaceListItem[]>;
224
+ getByShorthand(projectId: string, shorthand: string): Promise<Workspace>;
225
+ create(input: CreateWorkspaceInput): Promise<Workspace>;
226
+ rename(workspaceId: string, input: RenameWorkspaceInput): Promise<Workspace>;
227
+ listActivity(workspaceId: string, input?: ListWorkspaceActivityInput): Promise<ListWorkspaceActivityResponse>;
228
+ listFiles(workspaceId: string, input?: ListWorkspaceFilesInput, options?: {
229
+ signal?: AbortSignal;
230
+ }): Promise<WorkspaceFilesResponse>;
231
+ createDirectory(workspaceId: string, path: string): Promise<WorkspaceFileEntry>;
232
+ createFile(workspaceId: string, path: string, input: WriteWorkspaceFileInput): Promise<WorkspaceFileContent>;
233
+ readFile(workspaceId: string, path: string, options?: {
234
+ signal?: AbortSignal;
235
+ }): Promise<WorkspaceFileContent>;
236
+ writeFile(workspaceId: string, path: string, input: WriteWorkspaceFileInput): Promise<WorkspaceFileContent>;
237
+ moveEntry(workspaceId: string, path: string, destinationPath: string): Promise<void>;
238
+ deleteEntry(workspaceId: string, path: string): Promise<void>;
239
+ removeWorktree(workspaceId: string): Promise<RemoveWorktreeResponse>;
240
+ delete(workspaceId: string): Promise<void>;
241
+ };
242
+ //#endregion
243
+ //#region src/client/client.d.ts
244
+ type PstdioClient = {
245
+ projects: ProjectClient;
246
+ filesystem: FilesystemClient;
247
+ workspaces: WorkspaceClient;
248
+ sessions: SessionClient;
249
+ skills: SkillClient;
250
+ agents: AgentClient;
251
+ automation: AutomationClient;
252
+ notifications: NotificationsClient;
253
+ extensions: ExtensionClient;
254
+ settings: SettingsClient;
255
+ sync: SyncClient;
256
+ runtime: RuntimeClient;
257
+ };
258
+ declare const createClient: (options?: ClientOptions) => PstdioClient;
259
+ //#endregion
260
+ export { RequestFn as A, DirectoryEntry as C, AgentClient as D, AutomationClient as E, createRequest as M, ClientOptions as O, NotificationsClient as S, ExtensionClient as T, SessionStreamHandlers as _, SyncClient as a, createRuntimeClient as b, SyncWriter as c, parseSyncDeleteEvent as d, SkillClient as f, SessionStreamConnection as g, SessionClient as h, StartSyncInput as i, RequestOptions as j, PstdioApiError as k, SyncWriterProvider as l, ListSessionsInput as m, createClient as n, SyncConnection as o, SettingsClient as p, WorkspaceClient as r, SyncRow as s, PstdioClient as t, applySyncEvent as u, SseEvent as v, FilesystemClient as w, ProjectClient as x, RuntimeClient as y };
261
+ export {};
@@ -0,0 +1,7 @@
1
+ import { d as WorkspaceListItem$1, s as Workspace$1 } from "./index-x7CdJPRb.js";
2
+ //#region src/resources/workspace.d.ts
3
+ type Workspace = Workspace$1;
4
+ type WorkspaceListItem = WorkspaceListItem$1;
5
+ //#endregion
6
+ export { WorkspaceListItem as n, Workspace as t };
7
+ export {};