@pstdio/pocketcoder-sdk 0.5.0 → 0.6.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +370 -190
  2. package/dist/index.js +497 -372
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,14 +1,5 @@
1
1
  import { z } from "zod";
2
- //#region ../contracts/src/api.d.ts
3
- declare const OutputResourceSchema: z.ZodObject<{
4
- seq: z.ZodNumber;
5
- name: z.ZodString;
6
- value: z.ZodUnknown;
7
- occurred_at: z.ZodISODateTime;
8
- }, z.core.$strip>;
9
- type OutputResource = z.infer<typeof OutputResourceSchema>;
10
- //#endregion
11
- //#region ../contracts/src/attachment.d.ts
2
+ //#region ../contracts/src/attachments/attachment.d.ts
12
3
  declare const AttachmentDescriptorSchema: z.ZodObject<{
13
4
  id: z.ZodUUID;
14
5
  name: z.ZodString;
@@ -23,27 +14,89 @@ declare function splitAttachmentManifest(content: string): {
23
14
  attachments: AttachmentDescriptor[] | null;
24
15
  };
25
16
  //#endregion
26
- //#region ../contracts/src/conversation.d.ts
27
- declare const ConversationMessageResourceSchema: z.ZodObject<{
28
- message_id: z.ZodString;
29
- role: z.ZodEnum<{
30
- user: "user";
31
- assistant: "assistant";
32
- system: "system";
33
- tool: "tool";
34
- }>;
35
- content: z.ZodString;
36
- occurred_at: z.ZodISODateTime;
37
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
38
- seq: z.ZodNumber;
17
+ //#region ../contracts/src/auth/keys.d.ts
18
+ declare const KeyIssueRequestSchema: z.ZodObject<{
19
+ request_id: z.ZodString;
20
+ scopes: z.ZodArray<z.ZodEnum<{
21
+ "templates:read": "templates:read";
22
+ "workspaces:create": "workspaces:create";
23
+ "workspaces:read": "workspaces:read";
24
+ "workspaces:cancel": "workspaces:cancel";
25
+ "workspaces:purge": "workspaces:purge";
26
+ "workspaces:recover": "workspaces:recover";
27
+ "keys:read": "keys:read";
28
+ "keys:write": "keys:write";
29
+ "workspaces:preserve": "workspaces:preserve";
30
+ "workspaces:restore": "workspaces:restore";
31
+ "checkpoints:read": "checkpoints:read";
32
+ "checkpoints:delete": "checkpoints:delete";
33
+ "outputs:read": "outputs:read";
34
+ "conversations:read": "conversations:read";
35
+ "conversations:delete": "conversations:delete";
36
+ "services:relay": "services:relay";
37
+ "attachments:write": "attachments:write";
38
+ "logs:read": "logs:read";
39
+ "network:read": "network:read";
40
+ "terminal:attach": "terminal:attach";
41
+ "terminal:read": "terminal:read";
42
+ admin: "admin";
43
+ }>>;
44
+ expires_at: z.ZodISODateTime;
45
+ }, z.core.$strict>;
46
+ type KeyIssueRequest = z.infer<typeof KeyIssueRequestSchema>;
47
+ declare const KeyResourceSchema: z.ZodObject<{
48
+ id: z.ZodUUID;
49
+ principal_id: z.ZodUUID;
50
+ scopes: z.ZodArray<z.ZodString>;
51
+ effective_scopes: z.ZodArray<z.ZodString>;
52
+ managed_principal_ids: z.ZodArray<z.ZodUUID>;
53
+ issuance_request_id: z.ZodNullable<z.ZodString>;
54
+ created_at: z.ZodISODateTime;
55
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
56
+ revoked_at: z.ZodNullable<z.ZodISODateTime>;
57
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
39
58
  }, z.core.$strip>;
40
- type ConversationMessageResource = z.infer<typeof ConversationMessageResourceSchema>;
59
+ type KeyResource = z.infer<typeof KeyResourceSchema>;
60
+ declare const KeyIssueResponseSchema: z.ZodObject<{
61
+ key: z.ZodObject<{
62
+ id: z.ZodUUID;
63
+ principal_id: z.ZodUUID;
64
+ scopes: z.ZodArray<z.ZodString>;
65
+ effective_scopes: z.ZodArray<z.ZodString>;
66
+ managed_principal_ids: z.ZodArray<z.ZodUUID>;
67
+ issuance_request_id: z.ZodNullable<z.ZodString>;
68
+ created_at: z.ZodISODateTime;
69
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
70
+ revoked_at: z.ZodNullable<z.ZodISODateTime>;
71
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
72
+ }, z.core.$strip>;
73
+ token: z.ZodNullable<z.ZodString>;
74
+ }, z.core.$strip>;
75
+ type KeyIssueResponse = z.infer<typeof KeyIssueResponseSchema>;
76
+ declare const KeyListResponseSchema: z.ZodObject<{
77
+ items: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodUUID;
79
+ principal_id: z.ZodUUID;
80
+ scopes: z.ZodArray<z.ZodString>;
81
+ effective_scopes: z.ZodArray<z.ZodString>;
82
+ managed_principal_ids: z.ZodArray<z.ZodUUID>;
83
+ issuance_request_id: z.ZodNullable<z.ZodString>;
84
+ created_at: z.ZodISODateTime;
85
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
86
+ revoked_at: z.ZodNullable<z.ZodISODateTime>;
87
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
88
+ }, z.core.$strip>>;
89
+ next_cursor: z.ZodNullable<z.ZodUUID>;
90
+ }, z.core.$strip>;
91
+ type KeyListResponse = z.infer<typeof KeyListResponseSchema>;
41
92
  //#endregion
42
- //#region ../contracts/src/errors.d.ts
93
+ //#region ../contracts/src/common/errors.d.ts
43
94
  declare const ERROR_CODES: {
44
95
  readonly "auth.invalid_key": 401;
45
96
  readonly "auth.missing_scope": 403;
46
97
  readonly "auth.disabled_principal": 403;
98
+ readonly "principal.not_found": 404;
99
+ readonly "key.not_found": 404;
47
100
  readonly "validation.invalid": 400;
48
101
  readonly "idempotency.conflict": 409;
49
102
  readonly "capacity.queue_full": 429;
@@ -95,7 +148,133 @@ declare const ERROR_CODES: {
95
148
  };
96
149
  type ErrorCode = keyof typeof ERROR_CODES;
97
150
  //#endregion
98
- //#region ../contracts/src/workspace.d.ts
151
+ //#region ../contracts/src/conversations/conversation.d.ts
152
+ declare const ConversationMessageResourceSchema: z.ZodObject<{
153
+ message_id: z.ZodString;
154
+ role: z.ZodEnum<{
155
+ user: "user";
156
+ assistant: "assistant";
157
+ system: "system";
158
+ tool: "tool";
159
+ }>;
160
+ content: z.ZodString;
161
+ occurred_at: z.ZodISODateTime;
162
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
163
+ seq: z.ZodNumber;
164
+ }, z.core.$strip>;
165
+ type ConversationMessageResource = z.infer<typeof ConversationMessageResourceSchema>;
166
+ //#endregion
167
+ //#region ../contracts/src/network/network.d.ts
168
+ declare const NetworkEventSchema: z.ZodObject<{
169
+ path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
170
+ occurred_at: z.ZodISODateTime;
171
+ decision: z.ZodEnum<{
172
+ allow: "allow";
173
+ deny: "deny";
174
+ }>;
175
+ transport: z.ZodEnum<{
176
+ http: "http";
177
+ https: "https";
178
+ }>;
179
+ host: z.ZodString;
180
+ port: z.ZodNumber;
181
+ method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
182
+ matched_rule: z.ZodDefault<z.ZodNullable<z.ZodString>>;
183
+ reason: z.ZodString;
184
+ seq: z.ZodNumber;
185
+ workspace_id: z.ZodUUID;
186
+ source_session_id: z.ZodUUID;
187
+ source_seq: z.ZodNumber;
188
+ }, z.core.$strip>;
189
+ type NetworkEvent = z.infer<typeof NetworkEventSchema>;
190
+ //#endregion
191
+ //#region ../contracts/src/persistence/persistence.d.ts
192
+ declare const CHECKPOINT_STATES: readonly ["creating", "ready", "failed", "deleting", "deleted"];
193
+ type CheckpointState = (typeof CHECKPOINT_STATES)[number];
194
+ declare const OPERATION_KINDS: readonly ["preserve", "restore", "verify", "delete", "purge"];
195
+ type OperationKind = (typeof OPERATION_KINDS)[number];
196
+ declare const OPERATION_STATES: readonly ["pending", "running", "succeeded", "failed"];
197
+ type OperationState = (typeof OPERATION_STATES)[number];
198
+ declare const STORAGE_STATES: readonly ["allocating", "ready", "snapshotting", "retained", "restoring", "deleting", "deleted", "lost", "quarantined"];
199
+ type StorageState = (typeof STORAGE_STATES)[number];
200
+ declare const CheckpointResourceSchema: z.ZodObject<{
201
+ id: z.ZodUUID;
202
+ workspace_id: z.ZodUUID;
203
+ state: z.ZodEnum<{
204
+ creating: "creating";
205
+ ready: "ready";
206
+ failed: "failed";
207
+ deleting: "deleting";
208
+ deleted: "deleted";
209
+ }>;
210
+ reason_code: z.ZodNullable<z.ZodString>;
211
+ template: z.ZodObject<{
212
+ name: z.ZodString;
213
+ version: z.ZodString;
214
+ digest: z.ZodString;
215
+ }, z.core.$strip>;
216
+ manifest_digest: z.ZodNullable<z.ZodString>;
217
+ logical_bytes: z.ZodNullable<z.ZodNumber>;
218
+ stored_bytes: z.ZodNullable<z.ZodNumber>;
219
+ file_count: z.ZodNullable<z.ZodNumber>;
220
+ mounts: z.ZodArray<z.ZodString>;
221
+ conversation_restore: z.ZodEnum<{
222
+ supported: "supported";
223
+ filesystem_only: "filesystem_only";
224
+ unknown: "unknown";
225
+ }>;
226
+ label: z.ZodNullable<z.ZodString>;
227
+ created_at: z.ZodISODateTime;
228
+ ready_at: z.ZodNullable<z.ZodISODateTime>;
229
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
230
+ }, z.core.$strip>;
231
+ type CheckpointResource = z.infer<typeof CheckpointResourceSchema>;
232
+ declare const OperationResourceSchema: z.ZodObject<{
233
+ id: z.ZodUUID;
234
+ kind: z.ZodEnum<{
235
+ restore: "restore";
236
+ preserve: "preserve";
237
+ verify: "verify";
238
+ delete: "delete";
239
+ purge: "purge";
240
+ }>;
241
+ state: z.ZodEnum<{
242
+ failed: "failed";
243
+ pending: "pending";
244
+ running: "running";
245
+ succeeded: "succeeded";
246
+ }>;
247
+ workspace_id: z.ZodNullable<z.ZodUUID>;
248
+ checkpoint_id: z.ZodNullable<z.ZodUUID>;
249
+ result_workspace_id: z.ZodNullable<z.ZodUUID>;
250
+ reason_code: z.ZodNullable<z.ZodString>;
251
+ created_at: z.ZodISODateTime;
252
+ updated_at: z.ZodISODateTime;
253
+ completed_at: z.ZodNullable<z.ZodISODateTime>;
254
+ }, z.core.$strip>;
255
+ type OperationResource = z.infer<typeof OperationResourceSchema>;
256
+ declare const PreserveRequestSchema: z.ZodObject<{
257
+ retention: z.ZodOptional<z.ZodString>;
258
+ label: z.ZodOptional<z.ZodString>;
259
+ }, z.core.$strip>;
260
+ type PreserveRequest = z.infer<typeof PreserveRequestSchema>;
261
+ declare const RestoreRequestSchema: z.ZodObject<{
262
+ external_id: z.ZodString;
263
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
264
+ launch_input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
265
+ }, z.core.$strip>;
266
+ type RestoreRequest = z.infer<typeof RestoreRequestSchema>;
267
+ //#endregion
268
+ //#region ../contracts/src/protocol/api.d.ts
269
+ declare const OutputResourceSchema: z.ZodObject<{
270
+ seq: z.ZodNumber;
271
+ name: z.ZodString;
272
+ value: z.ZodUnknown;
273
+ occurred_at: z.ZodISODateTime;
274
+ }, z.core.$strip>;
275
+ type OutputResource = z.infer<typeof OutputResourceSchema>;
276
+ //#endregion
277
+ //#region ../contracts/src/workspaces/workspace.d.ts
99
278
  declare const WORKSPACE_STATES: readonly ["queued", "provisioning", "connected", "ready", "preserving", "terminating", "succeeded", "failed", "canceled", "expired", "preserved"];
100
279
  type WorkspaceState = (typeof WORKSPACE_STATES)[number];
101
280
  declare const AGENT_STATES: readonly ["unknown", "running", "stable"];
@@ -272,7 +451,7 @@ declare const TemplateListItemSchema: z.ZodObject<{
272
451
  }, z.core.$strip>;
273
452
  type TemplateListItem = z.infer<typeof TemplateListItemSchema>;
274
453
  //#endregion
275
- //#region ../contracts/src/logs.d.ts
454
+ //#region ../contracts/src/protocol/logs.d.ts
276
455
  declare const LogChunkSchema: z.ZodObject<{
277
456
  seq: z.ZodNumber;
278
457
  stream: z.ZodString;
@@ -281,107 +460,7 @@ declare const LogChunkSchema: z.ZodObject<{
281
460
  }, z.core.$strip>;
282
461
  type LogChunk = z.infer<typeof LogChunkSchema>;
283
462
  //#endregion
284
- //#region ../contracts/src/network.d.ts
285
- declare const NetworkEventSchema: z.ZodObject<{
286
- path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
287
- occurred_at: z.ZodISODateTime;
288
- decision: z.ZodEnum<{
289
- allow: "allow";
290
- deny: "deny";
291
- }>;
292
- transport: z.ZodEnum<{
293
- http: "http";
294
- https: "https";
295
- }>;
296
- host: z.ZodString;
297
- port: z.ZodNumber;
298
- method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
299
- matched_rule: z.ZodDefault<z.ZodNullable<z.ZodString>>;
300
- reason: z.ZodString;
301
- seq: z.ZodNumber;
302
- workspace_id: z.ZodUUID;
303
- source_session_id: z.ZodUUID;
304
- source_seq: z.ZodNumber;
305
- }, z.core.$strip>;
306
- type NetworkEvent = z.infer<typeof NetworkEventSchema>;
307
- //#endregion
308
- //#region ../contracts/src/persistence.d.ts
309
- declare const CHECKPOINT_STATES: readonly ["creating", "ready", "failed", "deleting", "deleted"];
310
- type CheckpointState = (typeof CHECKPOINT_STATES)[number];
311
- declare const OPERATION_KINDS: readonly ["preserve", "restore", "verify", "delete"];
312
- type OperationKind = (typeof OPERATION_KINDS)[number];
313
- declare const OPERATION_STATES: readonly ["pending", "running", "succeeded", "failed"];
314
- type OperationState = (typeof OPERATION_STATES)[number];
315
- declare const STORAGE_STATES: readonly ["allocating", "ready", "snapshotting", "retained", "restoring", "deleting", "deleted", "lost", "quarantined"];
316
- type StorageState = (typeof STORAGE_STATES)[number];
317
- declare const CheckpointResourceSchema: z.ZodObject<{
318
- id: z.ZodUUID;
319
- workspace_id: z.ZodUUID;
320
- state: z.ZodEnum<{
321
- creating: "creating";
322
- ready: "ready";
323
- failed: "failed";
324
- deleting: "deleting";
325
- deleted: "deleted";
326
- }>;
327
- reason_code: z.ZodNullable<z.ZodString>;
328
- template: z.ZodObject<{
329
- name: z.ZodString;
330
- version: z.ZodString;
331
- digest: z.ZodString;
332
- }, z.core.$strip>;
333
- manifest_digest: z.ZodNullable<z.ZodString>;
334
- logical_bytes: z.ZodNullable<z.ZodNumber>;
335
- stored_bytes: z.ZodNullable<z.ZodNumber>;
336
- file_count: z.ZodNullable<z.ZodNumber>;
337
- mounts: z.ZodArray<z.ZodString>;
338
- conversation_restore: z.ZodEnum<{
339
- supported: "supported";
340
- filesystem_only: "filesystem_only";
341
- unknown: "unknown";
342
- }>;
343
- label: z.ZodNullable<z.ZodString>;
344
- created_at: z.ZodISODateTime;
345
- ready_at: z.ZodNullable<z.ZodISODateTime>;
346
- expires_at: z.ZodNullable<z.ZodISODateTime>;
347
- }, z.core.$strip>;
348
- type CheckpointResource = z.infer<typeof CheckpointResourceSchema>;
349
- declare const OperationResourceSchema: z.ZodObject<{
350
- id: z.ZodUUID;
351
- kind: z.ZodEnum<{
352
- restore: "restore";
353
- preserve: "preserve";
354
- verify: "verify";
355
- delete: "delete";
356
- }>;
357
- state: z.ZodEnum<{
358
- failed: "failed";
359
- pending: "pending";
360
- running: "running";
361
- succeeded: "succeeded";
362
- }>;
363
- workspace_id: z.ZodNullable<z.ZodUUID>;
364
- checkpoint_id: z.ZodNullable<z.ZodUUID>;
365
- result_workspace_id: z.ZodNullable<z.ZodUUID>;
366
- reason_code: z.ZodNullable<z.ZodString>;
367
- created_at: z.ZodISODateTime;
368
- updated_at: z.ZodISODateTime;
369
- completed_at: z.ZodNullable<z.ZodISODateTime>;
370
- }, z.core.$strip>;
371
- type OperationResource = z.infer<typeof OperationResourceSchema>;
372
- declare const PreserveRequestSchema: z.ZodObject<{
373
- retention: z.ZodOptional<z.ZodString>;
374
- label: z.ZodOptional<z.ZodString>;
375
- }, z.core.$strip>;
376
- type PreserveRequest = z.infer<typeof PreserveRequestSchema>;
377
- declare const RestoreRequestSchema: z.ZodObject<{
378
- external_id: z.ZodString;
379
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
380
- launch_input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
381
- }, z.core.$strip>;
382
- type RestoreRequest = z.infer<typeof RestoreRequestSchema>;
383
- //#endregion
384
- //#region ../contracts/src/terminal.d.ts
463
+ //#region ../contracts/src/terminals/terminal.d.ts
385
464
  declare const ServerTerminalMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
386
465
  type: z.ZodLiteral<"opened">;
387
466
  session_id: z.ZodUUID;
@@ -428,7 +507,7 @@ declare const TerminalSessionSchema: z.ZodObject<{
428
507
  type ServerTerminalMessage = z.infer<typeof ServerTerminalMessageSchema>;
429
508
  type TerminalSession = z.infer<typeof TerminalSessionSchema>;
430
509
  //#endregion
431
- //#region src/transport.d.ts
510
+ //#region src/transport/transport.d.ts
432
511
  type FetchLike = typeof fetch;
433
512
  type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocket;
434
513
  interface PocketCoderClientConfig {
@@ -455,7 +534,7 @@ declare class PocketCoderTransport {
455
534
  request<T>(path: string, schema: z.ZodType<T>, init?: RequestInit): Promise<T>;
456
535
  }
457
536
  //#endregion
458
- //#region src/admin.d.ts
537
+ //#region src/resources/admin/admin.d.ts
459
538
  declare class AdministrationApi {
460
539
  private readonly transport;
461
540
  constructor(transport: PocketCoderTransport);
@@ -485,17 +564,7 @@ declare class AdministrationApi {
485
564
  }>;
486
565
  }
487
566
  //#endregion
488
- //#region src/common.d.ts
489
- interface Page<T> {
490
- items: T[];
491
- nextCursor: string | null;
492
- }
493
- interface CursorListQuery {
494
- limit?: number;
495
- cursor?: string;
496
- }
497
- //#endregion
498
- //#region src/workspaces.d.ts
567
+ //#region src/resources/workspaces/workspaces.d.ts
499
568
  interface WorkspaceCreateInput {
500
569
  externalId: string;
501
570
  templateName: string;
@@ -977,7 +1046,7 @@ declare class WorkspacesApi {
977
1046
  checkpoint: {
978
1047
  id: string;
979
1048
  workspace_id: string;
980
- state: "ready" | "failed" | "creating" | "deleting" | "deleted";
1049
+ state: "deleted" | "ready" | "failed" | "creating" | "deleting";
981
1050
  reason_code: string | null;
982
1051
  template: {
983
1052
  name: string;
@@ -997,7 +1066,7 @@ declare class WorkspacesApi {
997
1066
  };
998
1067
  operation: {
999
1068
  id: string;
1000
- kind: "preserve" | "restore" | "verify" | "delete";
1069
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1001
1070
  state: "succeeded" | "failed" | "running" | "pending";
1002
1071
  workspace_id: string | null;
1003
1072
  checkpoint_id: string | null;
@@ -1008,6 +1077,18 @@ declare class WorkspacesApi {
1008
1077
  completed_at: string | null;
1009
1078
  };
1010
1079
  }>;
1080
+ purge(id: string, key: string, options?: RequestOptions): Promise<{
1081
+ id: string;
1082
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1083
+ state: "succeeded" | "failed" | "running" | "pending";
1084
+ workspace_id: string | null;
1085
+ checkpoint_id: string | null;
1086
+ result_workspace_id: string | null;
1087
+ reason_code: string | null;
1088
+ created_at: string;
1089
+ updated_at: string;
1090
+ completed_at: string | null;
1091
+ }>;
1011
1092
  recreate(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
1012
1093
  workspace: {
1013
1094
  id: string;
@@ -1061,7 +1142,7 @@ declare class WorkspacesApi {
1061
1142
  };
1062
1143
  operation: {
1063
1144
  id: string;
1064
- kind: "preserve" | "restore" | "verify" | "delete";
1145
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1065
1146
  state: "succeeded" | "failed" | "running" | "pending";
1066
1147
  workspace_id: string | null;
1067
1148
  checkpoint_id: string | null;
@@ -1125,7 +1206,7 @@ declare class WorkspacesApi {
1125
1206
  };
1126
1207
  operation: {
1127
1208
  id: string;
1128
- kind: "preserve" | "restore" | "verify" | "delete";
1209
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1129
1210
  state: "succeeded" | "failed" | "running" | "pending";
1130
1211
  workspace_id: string | null;
1131
1212
  checkpoint_id: string | null;
@@ -1145,7 +1226,7 @@ declare class WorkspacesApi {
1145
1226
  private jsonOperation;
1146
1227
  }
1147
1228
  //#endregion
1148
- //#region src/attachments.d.ts
1229
+ //#region src/resources/attachments/attachments.d.ts
1149
1230
  type UploadBody = NonNullable<RequestInit["body"]>;
1150
1231
  interface AttachmentUploadInput {
1151
1232
  id?: string;
@@ -1174,7 +1255,17 @@ declare class AgentApi {
1174
1255
  sendMessage(workspaceId: string, input: AgentMessageInput): Promise<void>;
1175
1256
  }
1176
1257
  //#endregion
1177
- //#region src/checkpoints.d.ts
1258
+ //#region src/transport/common.d.ts
1259
+ interface Page<T> {
1260
+ items: T[];
1261
+ nextCursor: string | null;
1262
+ }
1263
+ interface CursorListQuery {
1264
+ limit?: number;
1265
+ cursor?: string;
1266
+ }
1267
+ //#endregion
1268
+ //#region src/resources/checkpoints/checkpoints.d.ts
1178
1269
  declare class CheckpointsApi {
1179
1270
  private readonly transport;
1180
1271
  constructor(transport: PocketCoderTransport);
@@ -1183,7 +1274,7 @@ declare class CheckpointsApi {
1183
1274
  }, options?: RequestOptions): Promise<Page<{
1184
1275
  id: string;
1185
1276
  workspace_id: string;
1186
- state: "ready" | "failed" | "creating" | "deleting" | "deleted";
1277
+ state: "deleted" | "ready" | "failed" | "creating" | "deleting";
1187
1278
  reason_code: string | null;
1188
1279
  template: {
1189
1280
  name: string;
@@ -1204,7 +1295,7 @@ declare class CheckpointsApi {
1204
1295
  get(id: string, options?: RequestOptions): Promise<{
1205
1296
  id: string;
1206
1297
  workspace_id: string;
1207
- state: "ready" | "failed" | "creating" | "deleting" | "deleted";
1298
+ state: "deleted" | "ready" | "failed" | "creating" | "deleting";
1208
1299
  reason_code: string | null;
1209
1300
  template: {
1210
1301
  name: string;
@@ -1224,7 +1315,7 @@ declare class CheckpointsApi {
1224
1315
  }>;
1225
1316
  verify(id: string, key: string, options?: RequestOptions): Promise<{
1226
1317
  id: string;
1227
- kind: "preserve" | "restore" | "verify" | "delete";
1318
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1228
1319
  state: "succeeded" | "failed" | "running" | "pending";
1229
1320
  workspace_id: string | null;
1230
1321
  checkpoint_id: string | null;
@@ -1236,7 +1327,7 @@ declare class CheckpointsApi {
1236
1327
  }>;
1237
1328
  delete(id: string, key: string, options?: RequestOptions): Promise<{
1238
1329
  id: string;
1239
- kind: "preserve" | "restore" | "verify" | "delete";
1330
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1240
1331
  state: "succeeded" | "failed" | "running" | "pending";
1241
1332
  workspace_id: string | null;
1242
1333
  checkpoint_id: string | null;
@@ -1299,7 +1390,7 @@ declare class CheckpointsApi {
1299
1390
  };
1300
1391
  operation: {
1301
1392
  id: string;
1302
- kind: "preserve" | "restore" | "verify" | "delete";
1393
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1303
1394
  state: "succeeded" | "failed" | "running" | "pending";
1304
1395
  workspace_id: string | null;
1305
1396
  checkpoint_id: string | null;
@@ -1317,7 +1408,7 @@ declare class OperationsApi {
1317
1408
  constructor(transport: PocketCoderTransport);
1318
1409
  get(id: string, options?: RequestOptions): Promise<{
1319
1410
  id: string;
1320
- kind: "preserve" | "restore" | "verify" | "delete";
1411
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1321
1412
  state: "succeeded" | "failed" | "running" | "pending";
1322
1413
  workspace_id: string | null;
1323
1414
  checkpoint_id: string | null;
@@ -1329,7 +1420,7 @@ declare class OperationsApi {
1329
1420
  }>;
1330
1421
  }
1331
1422
  //#endregion
1332
- //#region src/conversations.d.ts
1423
+ //#region src/resources/conversations/conversations.d.ts
1333
1424
  type ConversationMessage = ConversationMessageResource;
1334
1425
  type ConversationPage = Page<ConversationMessageResource>;
1335
1426
  declare class ConversationsApi {
@@ -1345,7 +1436,7 @@ declare class ConversationsApi {
1345
1436
  }>>;
1346
1437
  }
1347
1438
  //#endregion
1348
- //#region src/diagnostics.d.ts
1439
+ //#region src/resources/diagnostics/diagnostics.d.ts
1349
1440
  declare class WorkspaceCursorApi<T> {
1350
1441
  private readonly transport;
1351
1442
  private readonly resource;
@@ -1366,7 +1457,94 @@ declare class OutputsApi extends WorkspaceCursorApi<OutputResource> {
1366
1457
  constructor(transport: PocketCoderTransport);
1367
1458
  }
1368
1459
  //#endregion
1369
- //#region src/templates.d.ts
1460
+ //#region src/resources/keys/keys.d.ts
1461
+ interface KeyListQuery {
1462
+ limit?: number;
1463
+ cursor?: string;
1464
+ requestId?: string;
1465
+ }
1466
+ declare class KeysApi {
1467
+ private readonly transport;
1468
+ constructor(transport: PocketCoderTransport);
1469
+ list(principalId: string, query?: KeyListQuery, options?: RequestOptions): Promise<{
1470
+ items: {
1471
+ id: string;
1472
+ principal_id: string;
1473
+ scopes: string[];
1474
+ effective_scopes: string[];
1475
+ managed_principal_ids: string[];
1476
+ issuance_request_id: string | null;
1477
+ created_at: string;
1478
+ expires_at: string | null;
1479
+ revoked_at: string | null;
1480
+ last_used_at: string | null;
1481
+ }[];
1482
+ next_cursor: string | null;
1483
+ }>;
1484
+ all(principalId: string, query?: Omit<KeyListQuery, "cursor">, options?: RequestOptions): AsyncGenerator<{
1485
+ id: string;
1486
+ principal_id: string;
1487
+ scopes: string[];
1488
+ effective_scopes: string[];
1489
+ managed_principal_ids: string[];
1490
+ issuance_request_id: string | null;
1491
+ created_at: string;
1492
+ expires_at: string | null;
1493
+ revoked_at: string | null;
1494
+ last_used_at: string | null;
1495
+ }, void, unknown>;
1496
+ issue(principalId: string, input: KeyIssueRequest, options?: RequestOptions): Promise<{
1497
+ key: {
1498
+ id: string;
1499
+ principal_id: string;
1500
+ scopes: string[];
1501
+ effective_scopes: string[];
1502
+ managed_principal_ids: string[];
1503
+ issuance_request_id: string | null;
1504
+ created_at: string;
1505
+ expires_at: string | null;
1506
+ revoked_at: string | null;
1507
+ last_used_at: string | null;
1508
+ };
1509
+ token: string | null;
1510
+ }>;
1511
+ revoke(principalId: string, keyId: string, options?: RequestOptions): Promise<{
1512
+ revoked: true;
1513
+ }>;
1514
+ revokeAll(principalId: string, options?: RequestOptions): Promise<{
1515
+ revoked: true;
1516
+ }>;
1517
+ }
1518
+ declare class RecoveryApi {
1519
+ private readonly transport;
1520
+ constructor(transport: PocketCoderTransport);
1521
+ purge(principalId: string, workspaceId: string, executionKey: string, options?: RequestOptions): Promise<{
1522
+ id: string;
1523
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1524
+ state: "succeeded" | "failed" | "running" | "pending";
1525
+ workspace_id: string | null;
1526
+ checkpoint_id: string | null;
1527
+ result_workspace_id: string | null;
1528
+ reason_code: string | null;
1529
+ created_at: string;
1530
+ updated_at: string;
1531
+ completed_at: string | null;
1532
+ }>;
1533
+ operation(principalId: string, operationId: string, options?: RequestOptions): Promise<{
1534
+ id: string;
1535
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1536
+ state: "succeeded" | "failed" | "running" | "pending";
1537
+ workspace_id: string | null;
1538
+ checkpoint_id: string | null;
1539
+ result_workspace_id: string | null;
1540
+ reason_code: string | null;
1541
+ created_at: string;
1542
+ updated_at: string;
1543
+ completed_at: string | null;
1544
+ }>;
1545
+ }
1546
+ //#endregion
1547
+ //#region src/resources/templates/templates.d.ts
1370
1548
  type TemplateSummary = TemplateListItem;
1371
1549
  declare class TemplatesApi {
1372
1550
  private readonly transport;
@@ -1387,7 +1565,7 @@ declare class TemplatesApi {
1387
1565
  }[]>;
1388
1566
  }
1389
1567
  //#endregion
1390
- //#region src/terminals.d.ts
1568
+ //#region src/resources/terminals/terminals.d.ts
1391
1569
  interface TerminalConnectOptions {
1392
1570
  sessionId?: string;
1393
1571
  }
@@ -1439,42 +1617,13 @@ declare class PocketCoderClient {
1439
1617
  readonly outputs: OutputsApi;
1440
1618
  readonly administration: AdministrationApi;
1441
1619
  readonly terminals: TerminalsApi;
1620
+ readonly keys: KeysApi;
1621
+ readonly recovery: RecoveryApi;
1442
1622
  constructor(config: PocketCoderClientConfig, fetchImpl?: typeof fetch);
1443
1623
  raw(path: string, init?: RequestInit): Promise<Response>;
1444
1624
  }
1445
1625
  //#endregion
1446
- //#region src/errors.d.ts
1447
- declare const ClientErrorCodeSchema: z.ZodEnum<{
1448
- "client.invalid_response": "client.invalid_response";
1449
- "client.non_json_response": "client.non_json_response";
1450
- }>;
1451
- type ClientErrorCode = z.infer<typeof ClientErrorCodeSchema>;
1452
- declare class PocketCoderError extends Error {
1453
- readonly code: ErrorCode | ClientErrorCode;
1454
- readonly status: number;
1455
- readonly requestId: string | undefined;
1456
- readonly details: Record<string, unknown> | undefined;
1457
- constructor(input: {
1458
- message: string;
1459
- code: ErrorCode | ClientErrorCode;
1460
- status: number;
1461
- requestId?: string;
1462
- details?: Record<string, unknown>;
1463
- });
1464
- }
1465
- declare class ConversationGoneError extends PocketCoderError {}
1466
- declare class WorkspaceTerminalError extends Error {
1467
- readonly workspace: WorkspaceResource;
1468
- constructor(workspace: WorkspaceResource);
1469
- }
1470
- declare class AgentNotReadyError extends Error {
1471
- readonly workspaceId: string;
1472
- readonly agentState: AgentState;
1473
- constructor(workspaceId: string, agentState: AgentState, timeoutMs: number);
1474
- }
1475
- declare function isPocketCoderErrorCode(value: unknown): value is ErrorCode;
1476
- //#endregion
1477
- //#region src/workspace-turn-resolver.d.ts
1626
+ //#region src/resources/workspaces/workspace-turn-resolver.d.ts
1478
1627
  type WorkspaceTurnResolutionErrorCode = "not_resumable" | "resume_handler_missing" | "resume_failed" | "invalid_resumed_workspace" | "readiness_failed";
1479
1628
  declare class WorkspaceTurnResolutionError extends Error {
1480
1629
  readonly code: WorkspaceTurnResolutionErrorCode;
@@ -1511,4 +1660,35 @@ declare class WorkspaceTurnResolver {
1511
1660
  private assertLineage;
1512
1661
  }
1513
1662
  //#endregion
1514
- export { AdministrationApi, AgentApi, type AgentMessageInput, AgentNotReadyError, type AttachmentDescriptor, type AttachmentUploadInput, AttachmentsApi, type CheckpointResource, type CheckpointState, CheckpointsApi, type ClientErrorCode, ConversationGoneError, type ConversationMessage, type ConversationPage, ConversationsApi, type CursorListQuery, type LogChunk, LogsApi, type NetworkEvent, NetworkEventsApi, type OperationKind, type OperationResource, type OperationState, OperationsApi, type OutputResource, OutputsApi, type Page, PocketCoderClient, type PocketCoderClientConfig, PocketCoderError, type PreserveRequest, type RequestOptions, type ResolveWorkspaceTurnOptions, type ResolvedWorkspaceTurn, type RestoreRequest, type ResumeWorkspaceContext, type ServerTerminalMessage, type StorageState, TERMINAL_WORKSPACE_STATES, type TemplateSummary, TemplatesApi, type TerminalConnectOptions, TerminalConnection, type TerminalSession, TerminalsApi, type WebSocketFactory, type WorkspaceCreateInput, type WorkspaceListQuery, type WorkspaceResource, type WorkspaceState, type WorkspaceSummary, WorkspaceTerminalError, WorkspaceTurnResolutionError, type WorkspaceTurnResolutionErrorCode, WorkspaceTurnResolver, type WorkspaceTurnResolverOptions, WorkspacesApi, isPocketCoderErrorCode, splitAttachmentManifest };
1663
+ //#region src/transport/errors.d.ts
1664
+ declare const ClientErrorCodeSchema: z.ZodEnum<{
1665
+ "client.invalid_response": "client.invalid_response";
1666
+ "client.non_json_response": "client.non_json_response";
1667
+ }>;
1668
+ type ClientErrorCode = z.infer<typeof ClientErrorCodeSchema>;
1669
+ declare class PocketCoderError extends Error {
1670
+ readonly code: ErrorCode | ClientErrorCode;
1671
+ readonly status: number;
1672
+ readonly requestId: string | undefined;
1673
+ readonly details: Record<string, unknown> | undefined;
1674
+ constructor(input: {
1675
+ message: string;
1676
+ code: ErrorCode | ClientErrorCode;
1677
+ status: number;
1678
+ requestId?: string;
1679
+ details?: Record<string, unknown>;
1680
+ });
1681
+ }
1682
+ declare class ConversationGoneError extends PocketCoderError {}
1683
+ declare class WorkspaceTerminalError extends Error {
1684
+ readonly workspace: WorkspaceResource;
1685
+ constructor(workspace: WorkspaceResource);
1686
+ }
1687
+ declare class AgentNotReadyError extends Error {
1688
+ readonly workspaceId: string;
1689
+ readonly agentState: AgentState;
1690
+ constructor(workspaceId: string, agentState: AgentState, timeoutMs: number);
1691
+ }
1692
+ declare function isPocketCoderErrorCode(value: unknown): value is ErrorCode;
1693
+ //#endregion
1694
+ export { AdministrationApi, AgentApi, type AgentMessageInput, AgentNotReadyError, type AttachmentDescriptor, type AttachmentUploadInput, AttachmentsApi, type CheckpointResource, type CheckpointState, CheckpointsApi, type ClientErrorCode, ConversationGoneError, type ConversationMessage, type ConversationPage, ConversationsApi, type CursorListQuery, type KeyIssueRequest, type KeyIssueResponse, type KeyListQuery, type KeyListResponse, type KeyResource, KeysApi, type LogChunk, LogsApi, type NetworkEvent, NetworkEventsApi, type OperationKind, type OperationResource, type OperationState, OperationsApi, type OutputResource, OutputsApi, type Page, PocketCoderClient, type PocketCoderClientConfig, PocketCoderError, type PreserveRequest, RecoveryApi, type RequestOptions, type ResolveWorkspaceTurnOptions, type ResolvedWorkspaceTurn, type RestoreRequest, type ResumeWorkspaceContext, type ServerTerminalMessage, type StorageState, TERMINAL_WORKSPACE_STATES, type TemplateSummary, TemplatesApi, type TerminalConnectOptions, TerminalConnection, type TerminalSession, TerminalsApi, type WebSocketFactory, type WorkspaceCreateInput, type WorkspaceListQuery, type WorkspaceResource, type WorkspaceState, type WorkspaceSummary, WorkspaceTerminalError, WorkspaceTurnResolutionError, type WorkspaceTurnResolutionErrorCode, WorkspaceTurnResolver, type WorkspaceTurnResolverOptions, WorkspacesApi, isPocketCoderErrorCode, splitAttachmentManifest };