@pstdio/pocketcoder-sdk 0.4.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 +709 -470
  2. package/dist/index.js +565 -371
  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,9 +148,137 @@ 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];
280
+ declare const AGENT_STATES: readonly ["unknown", "running", "stable"];
281
+ type AgentState = (typeof AGENT_STATES)[number];
101
282
  declare const WorkspaceCreateRequestSchema: z.ZodObject<{
102
283
  external_id: z.ZodString;
103
284
  template: z.ZodObject<{
@@ -270,7 +451,7 @@ declare const TemplateListItemSchema: z.ZodObject<{
270
451
  }, z.core.$strip>;
271
452
  type TemplateListItem = z.infer<typeof TemplateListItemSchema>;
272
453
  //#endregion
273
- //#region ../contracts/src/logs.d.ts
454
+ //#region ../contracts/src/protocol/logs.d.ts
274
455
  declare const LogChunkSchema: z.ZodObject<{
275
456
  seq: z.ZodNumber;
276
457
  stream: z.ZodString;
@@ -279,107 +460,7 @@ declare const LogChunkSchema: z.ZodObject<{
279
460
  }, z.core.$strip>;
280
461
  type LogChunk = z.infer<typeof LogChunkSchema>;
281
462
  //#endregion
282
- //#region ../contracts/src/network.d.ts
283
- declare const NetworkEventSchema: z.ZodObject<{
284
- path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
285
- occurred_at: z.ZodISODateTime;
286
- decision: z.ZodEnum<{
287
- allow: "allow";
288
- deny: "deny";
289
- }>;
290
- transport: z.ZodEnum<{
291
- http: "http";
292
- https: "https";
293
- }>;
294
- host: z.ZodString;
295
- port: z.ZodNumber;
296
- method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
297
- matched_rule: z.ZodDefault<z.ZodNullable<z.ZodString>>;
298
- reason: z.ZodString;
299
- seq: z.ZodNumber;
300
- workspace_id: z.ZodUUID;
301
- source_session_id: z.ZodUUID;
302
- source_seq: z.ZodNumber;
303
- }, z.core.$strip>;
304
- type NetworkEvent = z.infer<typeof NetworkEventSchema>;
305
- //#endregion
306
- //#region ../contracts/src/persistence.d.ts
307
- declare const CHECKPOINT_STATES: readonly ["creating", "ready", "failed", "deleting", "deleted"];
308
- type CheckpointState = (typeof CHECKPOINT_STATES)[number];
309
- declare const OPERATION_KINDS: readonly ["preserve", "restore", "verify", "delete"];
310
- type OperationKind = (typeof OPERATION_KINDS)[number];
311
- declare const OPERATION_STATES: readonly ["pending", "running", "succeeded", "failed"];
312
- type OperationState = (typeof OPERATION_STATES)[number];
313
- declare const STORAGE_STATES: readonly ["allocating", "ready", "snapshotting", "retained", "restoring", "deleting", "deleted", "lost", "quarantined"];
314
- type StorageState = (typeof STORAGE_STATES)[number];
315
- declare const CheckpointResourceSchema: z.ZodObject<{
316
- id: z.ZodUUID;
317
- workspace_id: z.ZodUUID;
318
- state: z.ZodEnum<{
319
- creating: "creating";
320
- ready: "ready";
321
- failed: "failed";
322
- deleting: "deleting";
323
- deleted: "deleted";
324
- }>;
325
- reason_code: z.ZodNullable<z.ZodString>;
326
- template: z.ZodObject<{
327
- name: z.ZodString;
328
- version: z.ZodString;
329
- digest: z.ZodString;
330
- }, z.core.$strip>;
331
- manifest_digest: z.ZodNullable<z.ZodString>;
332
- logical_bytes: z.ZodNullable<z.ZodNumber>;
333
- stored_bytes: z.ZodNullable<z.ZodNumber>;
334
- file_count: z.ZodNullable<z.ZodNumber>;
335
- mounts: z.ZodArray<z.ZodString>;
336
- conversation_restore: z.ZodEnum<{
337
- supported: "supported";
338
- filesystem_only: "filesystem_only";
339
- unknown: "unknown";
340
- }>;
341
- label: z.ZodNullable<z.ZodString>;
342
- created_at: z.ZodISODateTime;
343
- ready_at: z.ZodNullable<z.ZodISODateTime>;
344
- expires_at: z.ZodNullable<z.ZodISODateTime>;
345
- }, z.core.$strip>;
346
- type CheckpointResource = z.infer<typeof CheckpointResourceSchema>;
347
- declare const OperationResourceSchema: z.ZodObject<{
348
- id: z.ZodUUID;
349
- kind: z.ZodEnum<{
350
- restore: "restore";
351
- preserve: "preserve";
352
- verify: "verify";
353
- delete: "delete";
354
- }>;
355
- state: z.ZodEnum<{
356
- failed: "failed";
357
- pending: "pending";
358
- running: "running";
359
- succeeded: "succeeded";
360
- }>;
361
- workspace_id: z.ZodNullable<z.ZodUUID>;
362
- checkpoint_id: z.ZodNullable<z.ZodUUID>;
363
- result_workspace_id: z.ZodNullable<z.ZodUUID>;
364
- reason_code: z.ZodNullable<z.ZodString>;
365
- created_at: z.ZodISODateTime;
366
- updated_at: z.ZodISODateTime;
367
- completed_at: z.ZodNullable<z.ZodISODateTime>;
368
- }, z.core.$strip>;
369
- type OperationResource = z.infer<typeof OperationResourceSchema>;
370
- declare const PreserveRequestSchema: z.ZodObject<{
371
- retention: z.ZodOptional<z.ZodString>;
372
- label: z.ZodOptional<z.ZodString>;
373
- }, z.core.$strip>;
374
- type PreserveRequest = z.infer<typeof PreserveRequestSchema>;
375
- declare const RestoreRequestSchema: z.ZodObject<{
376
- external_id: z.ZodString;
377
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
378
- launch_input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
379
- }, z.core.$strip>;
380
- type RestoreRequest = z.infer<typeof RestoreRequestSchema>;
381
- //#endregion
382
- //#region ../contracts/src/terminal.d.ts
463
+ //#region ../contracts/src/terminals/terminal.d.ts
383
464
  declare const ServerTerminalMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
384
465
  type: z.ZodLiteral<"opened">;
385
466
  session_id: z.ZodUUID;
@@ -426,7 +507,7 @@ declare const TerminalSessionSchema: z.ZodObject<{
426
507
  type ServerTerminalMessage = z.infer<typeof ServerTerminalMessageSchema>;
427
508
  type TerminalSession = z.infer<typeof TerminalSessionSchema>;
428
509
  //#endregion
429
- //#region src/transport.d.ts
510
+ //#region src/transport/transport.d.ts
430
511
  type FetchLike = typeof fetch;
431
512
  type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocket;
432
513
  interface PocketCoderClientConfig {
@@ -453,7 +534,7 @@ declare class PocketCoderTransport {
453
534
  request<T>(path: string, schema: z.ZodType<T>, init?: RequestInit): Promise<T>;
454
535
  }
455
536
  //#endregion
456
- //#region src/admin.d.ts
537
+ //#region src/resources/admin/admin.d.ts
457
538
  declare class AdministrationApi {
458
539
  private readonly transport;
459
540
  constructor(transport: PocketCoderTransport);
@@ -483,294 +564,7 @@ declare class AdministrationApi {
483
564
  }>;
484
565
  }
485
566
  //#endregion
486
- //#region src/attachments.d.ts
487
- type UploadBody = NonNullable<RequestInit["body"]>;
488
- interface AttachmentUploadInput {
489
- id?: string;
490
- name: string;
491
- mediaType?: string;
492
- body: UploadBody;
493
- sizeBytes: number;
494
- signal?: AbortSignal;
495
- onProgress?: (uploadedBytes: number, totalBytes: number) => void;
496
- }
497
- interface AgentMessageInput {
498
- content: string;
499
- attachmentIds?: string[];
500
- signal?: AbortSignal;
501
- }
502
- declare class AttachmentsApi {
503
- private readonly transport;
504
- constructor(transport: PocketCoderTransport);
505
- upload(workspaceId: string, input: AttachmentUploadInput): Promise<AttachmentDescriptor>;
506
- }
507
- declare class AgentApi {
508
- private readonly transport;
509
- constructor(transport: PocketCoderTransport);
510
- sendMessage(workspaceId: string, input: AgentMessageInput): Promise<void>;
511
- }
512
- //#endregion
513
- //#region src/common.d.ts
514
- interface Page<T> {
515
- items: T[];
516
- nextCursor: string | null;
517
- }
518
- interface CursorListQuery {
519
- limit?: number;
520
- cursor?: string;
521
- }
522
- //#endregion
523
- //#region src/checkpoints.d.ts
524
- declare class CheckpointsApi {
525
- private readonly transport;
526
- constructor(transport: PocketCoderTransport);
527
- list(workspaceId: string, query?: CursorListQuery & {
528
- state?: CheckpointState;
529
- }, options?: RequestOptions): Promise<Page<{
530
- id: string;
531
- workspace_id: string;
532
- state: "deleted" | "creating" | "ready" | "failed" | "deleting";
533
- reason_code: string | null;
534
- template: {
535
- name: string;
536
- version: string;
537
- digest: string;
538
- };
539
- manifest_digest: string | null;
540
- logical_bytes: number | null;
541
- stored_bytes: number | null;
542
- file_count: number | null;
543
- mounts: string[];
544
- conversation_restore: "unknown" | "supported" | "filesystem_only";
545
- label: string | null;
546
- created_at: string;
547
- ready_at: string | null;
548
- expires_at: string | null;
549
- }>>;
550
- get(id: string, options?: RequestOptions): Promise<{
551
- id: string;
552
- workspace_id: string;
553
- state: "deleted" | "creating" | "ready" | "failed" | "deleting";
554
- reason_code: string | null;
555
- template: {
556
- name: string;
557
- version: string;
558
- digest: string;
559
- };
560
- manifest_digest: string | null;
561
- logical_bytes: number | null;
562
- stored_bytes: number | null;
563
- file_count: number | null;
564
- mounts: string[];
565
- conversation_restore: "unknown" | "supported" | "filesystem_only";
566
- label: string | null;
567
- created_at: string;
568
- ready_at: string | null;
569
- expires_at: string | null;
570
- }>;
571
- verify(id: string, key: string, options?: RequestOptions): Promise<{
572
- id: string;
573
- kind: "preserve" | "restore" | "verify" | "delete";
574
- state: "failed" | "pending" | "running" | "succeeded";
575
- workspace_id: string | null;
576
- checkpoint_id: string | null;
577
- result_workspace_id: string | null;
578
- reason_code: string | null;
579
- created_at: string;
580
- updated_at: string;
581
- completed_at: string | null;
582
- }>;
583
- delete(id: string, key: string, options?: RequestOptions): Promise<{
584
- id: string;
585
- kind: "preserve" | "restore" | "verify" | "delete";
586
- state: "failed" | "pending" | "running" | "succeeded";
587
- workspace_id: string | null;
588
- checkpoint_id: string | null;
589
- result_workspace_id: string | null;
590
- reason_code: string | null;
591
- created_at: string;
592
- updated_at: string;
593
- completed_at: string | null;
594
- }>;
595
- restore(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
596
- workspace: {
597
- id: string;
598
- external_id: string;
599
- template: {
600
- name: string;
601
- version: string;
602
- digest: string;
603
- };
604
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
605
- reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
606
- agent_state: "unknown" | "running" | "stable";
607
- change_cursor: number;
608
- provider_kind: string | null;
609
- provisioning_mode: "cold" | "warm" | null;
610
- network: {
611
- state: "ready" | "disabled" | "starting" | "degraded";
612
- };
613
- health: Record<string, string>;
614
- created_at: string;
615
- updated_at: string;
616
- connected_at: string | null;
617
- ready_at: string | null;
618
- deadline_at: string;
619
- terminal_at: string | null;
620
- metadata: Record<string, string>;
621
- origin_workspace_id: string | null;
622
- restored_from_checkpoint_id: string | null;
623
- source: {
624
- kind: "git";
625
- repository: string;
626
- requested_revision: string;
627
- resolved_commit: string | null;
628
- } | null;
629
- persistence: {
630
- enabled: boolean;
631
- conversation_restore: "unknown" | "supported" | "filesystem_only";
632
- conversation_resume: {
633
- status: "unknown" | "supported" | "unsupported";
634
- reason: "filesystem_only" | "capability_unknown" | null;
635
- };
636
- latest_checkpoint_id: string | null;
637
- };
638
- outputs: Record<string, unknown>;
639
- failure: {
640
- reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed";
641
- log_tail: string;
642
- log_tail_truncated: boolean;
643
- last_log_seq: number | null;
644
- } | null;
645
- };
646
- operation: {
647
- id: string;
648
- kind: "preserve" | "restore" | "verify" | "delete";
649
- state: "failed" | "pending" | "running" | "succeeded";
650
- workspace_id: string | null;
651
- checkpoint_id: string | null;
652
- result_workspace_id: string | null;
653
- reason_code: string | null;
654
- created_at: string;
655
- updated_at: string;
656
- completed_at: string | null;
657
- };
658
- }>;
659
- private operationRequest;
660
- }
661
- declare class OperationsApi {
662
- private readonly transport;
663
- constructor(transport: PocketCoderTransport);
664
- get(id: string, options?: RequestOptions): Promise<{
665
- id: string;
666
- kind: "preserve" | "restore" | "verify" | "delete";
667
- state: "failed" | "pending" | "running" | "succeeded";
668
- workspace_id: string | null;
669
- checkpoint_id: string | null;
670
- result_workspace_id: string | null;
671
- reason_code: string | null;
672
- created_at: string;
673
- updated_at: string;
674
- completed_at: string | null;
675
- }>;
676
- }
677
- //#endregion
678
- //#region src/conversations.d.ts
679
- type ConversationMessage = ConversationMessageResource;
680
- type ConversationPage = Page<ConversationMessageResource>;
681
- declare class ConversationsApi {
682
- private readonly transport;
683
- constructor(transport: PocketCoderTransport);
684
- list(id: string, query?: CursorListQuery, options?: RequestOptions): Promise<Page<{
685
- message_id: string;
686
- role: "user" | "assistant" | "system" | "tool";
687
- content: string;
688
- occurred_at: string;
689
- metadata: Record<string, string>;
690
- seq: number;
691
- }>>;
692
- }
693
- //#endregion
694
- //#region src/diagnostics.d.ts
695
- declare class WorkspaceCursorApi<T> {
696
- private readonly transport;
697
- private readonly resource;
698
- private readonly schema;
699
- constructor(transport: PocketCoderTransport, resource: string, schema: z.ZodType<{
700
- items: T[];
701
- next_cursor: string | null;
702
- }>);
703
- list(workspaceId: string, query?: CursorListQuery, options?: RequestOptions): Promise<Page<T>>;
704
- }
705
- declare class LogsApi extends WorkspaceCursorApi<LogChunk> {
706
- constructor(transport: PocketCoderTransport);
707
- }
708
- declare class NetworkEventsApi extends WorkspaceCursorApi<NetworkEvent> {
709
- constructor(transport: PocketCoderTransport);
710
- }
711
- declare class OutputsApi extends WorkspaceCursorApi<OutputResource> {
712
- constructor(transport: PocketCoderTransport);
713
- }
714
- //#endregion
715
- //#region src/templates.d.ts
716
- type TemplateSummary = TemplateListItem;
717
- declare class TemplatesApi {
718
- private readonly transport;
719
- constructor(transport: PocketCoderTransport);
720
- page(query?: CursorListQuery, options?: RequestOptions): Promise<Page<{
721
- name: string;
722
- version: string;
723
- digest: string;
724
- status: "active" | "available" | "retired";
725
- description?: string | undefined;
726
- }>>;
727
- list(options?: RequestOptions): Promise<{
728
- name: string;
729
- version: string;
730
- digest: string;
731
- status: "active" | "available" | "retired";
732
- description?: string | undefined;
733
- }[]>;
734
- }
735
- //#endregion
736
- //#region src/terminals.d.ts
737
- interface TerminalConnectOptions {
738
- sessionId?: string;
739
- }
740
- declare class TerminalConnection {
741
- readonly socket: WebSocket;
742
- private readonly messageListeners;
743
- private readonly openListeners;
744
- private readonly closeListeners;
745
- private readonly errorListeners;
746
- private readonly pendingMessages;
747
- private opened;
748
- private closedEvent;
749
- private errored;
750
- constructor(socket: WebSocket);
751
- onMessage(listener: (message: ServerTerminalMessage) => void): () => void;
752
- onOpen(listener: () => void): () => void;
753
- onClose(listener: (event: CloseEvent) => void): () => void;
754
- onError(listener: () => void): () => void;
755
- sendInput(value: Uint8Array | string): void;
756
- resize(rows: number, cols: number): void;
757
- close(code?: number, reason?: string): void;
758
- private handleMessage;
759
- }
760
- declare class TerminalsApi {
761
- private readonly transport;
762
- constructor(transport: PocketCoderTransport);
763
- connect(workspaceId: string, options?: TerminalConnectOptions): TerminalConnection;
764
- list(workspaceId: string, query?: {
765
- cursor?: string;
766
- limit?: number;
767
- }, options?: RequestOptions): Promise<{
768
- items: TerminalSession[];
769
- nextCursor: string | null;
770
- }>;
771
- }
772
- //#endregion
773
- //#region src/workspaces.d.ts
567
+ //#region src/resources/workspaces/workspaces.d.ts
774
568
  interface WorkspaceCreateInput {
775
569
  externalId: string;
776
570
  templateName: string;
@@ -800,7 +594,7 @@ declare class WorkspacesApi {
800
594
  version: string;
801
595
  digest: string;
802
596
  };
803
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
597
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
804
598
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
805
599
  agent_state: "unknown" | "running" | "stable";
806
600
  change_cursor: number;
@@ -850,7 +644,7 @@ declare class WorkspacesApi {
850
644
  version: string;
851
645
  digest: string;
852
646
  };
853
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
647
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
854
648
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
855
649
  agent_state: "unknown" | "running" | "stable";
856
650
  change_cursor: number;
@@ -900,7 +694,7 @@ declare class WorkspacesApi {
900
694
  version: string;
901
695
  digest: string;
902
696
  };
903
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
697
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
904
698
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
905
699
  agent_state: "unknown" | "running" | "stable";
906
700
  change_cursor: number;
@@ -950,7 +744,7 @@ declare class WorkspacesApi {
950
744
  version: string;
951
745
  digest: string;
952
746
  };
953
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
747
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
954
748
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
955
749
  agent_state: "unknown" | "running" | "stable";
956
750
  change_cursor: number;
@@ -1000,7 +794,7 @@ declare class WorkspacesApi {
1000
794
  version: string;
1001
795
  digest: string;
1002
796
  };
1003
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
797
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1004
798
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1005
799
  agent_state: "unknown" | "running" | "stable";
1006
800
  change_cursor: number;
@@ -1053,7 +847,7 @@ declare class WorkspacesApi {
1053
847
  version: string;
1054
848
  digest: string;
1055
849
  };
1056
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
850
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1057
851
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1058
852
  agent_state: "unknown" | "running" | "stable";
1059
853
  change_cursor: number;
@@ -1106,7 +900,57 @@ declare class WorkspacesApi {
1106
900
  version: string;
1107
901
  digest: string;
1108
902
  };
1109
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
903
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
904
+ reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
905
+ agent_state: "unknown" | "running" | "stable";
906
+ change_cursor: number;
907
+ provider_kind: string | null;
908
+ provisioning_mode: "cold" | "warm" | null;
909
+ network: {
910
+ state: "ready" | "disabled" | "starting" | "degraded";
911
+ };
912
+ health: Record<string, string>;
913
+ created_at: string;
914
+ updated_at: string;
915
+ connected_at: string | null;
916
+ ready_at: string | null;
917
+ deadline_at: string;
918
+ terminal_at: string | null;
919
+ metadata: Record<string, string>;
920
+ origin_workspace_id: string | null;
921
+ restored_from_checkpoint_id: string | null;
922
+ source: {
923
+ kind: "git";
924
+ repository: string;
925
+ requested_revision: string;
926
+ resolved_commit: string | null;
927
+ } | null;
928
+ persistence: {
929
+ enabled: boolean;
930
+ conversation_restore: "unknown" | "supported" | "filesystem_only";
931
+ conversation_resume: {
932
+ status: "unknown" | "supported" | "unsupported";
933
+ reason: "filesystem_only" | "capability_unknown" | null;
934
+ };
935
+ latest_checkpoint_id: string | null;
936
+ };
937
+ outputs: Record<string, unknown>;
938
+ failure: {
939
+ reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed";
940
+ log_tail: string;
941
+ log_tail_truncated: boolean;
942
+ last_log_seq: number | null;
943
+ } | null;
944
+ }>;
945
+ waitForAgentInput(id: string, timeoutMs: number, options?: RequestOptions): Promise<{
946
+ id: string;
947
+ external_id: string;
948
+ template: {
949
+ name: string;
950
+ version: string;
951
+ digest: string;
952
+ };
953
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1110
954
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1111
955
  agent_state: "unknown" | "running" | "stable";
1112
956
  change_cursor: number;
@@ -1157,7 +1001,7 @@ declare class WorkspacesApi {
1157
1001
  version: string;
1158
1002
  digest: string;
1159
1003
  };
1160
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
1004
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1161
1005
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1162
1006
  agent_state: "unknown" | "running" | "stable";
1163
1007
  change_cursor: number;
@@ -1202,7 +1046,7 @@ declare class WorkspacesApi {
1202
1046
  checkpoint: {
1203
1047
  id: string;
1204
1048
  workspace_id: string;
1205
- state: "deleted" | "creating" | "ready" | "failed" | "deleting";
1049
+ state: "deleted" | "ready" | "failed" | "creating" | "deleting";
1206
1050
  reason_code: string | null;
1207
1051
  template: {
1208
1052
  name: string;
@@ -1222,8 +1066,8 @@ declare class WorkspacesApi {
1222
1066
  };
1223
1067
  operation: {
1224
1068
  id: string;
1225
- kind: "preserve" | "restore" | "verify" | "delete";
1226
- state: "failed" | "pending" | "running" | "succeeded";
1069
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1070
+ state: "succeeded" | "failed" | "running" | "pending";
1227
1071
  workspace_id: string | null;
1228
1072
  checkpoint_id: string | null;
1229
1073
  result_workspace_id: string | null;
@@ -1233,6 +1077,18 @@ declare class WorkspacesApi {
1233
1077
  completed_at: string | null;
1234
1078
  };
1235
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
+ }>;
1236
1092
  recreate(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
1237
1093
  workspace: {
1238
1094
  id: string;
@@ -1242,7 +1098,7 @@ declare class WorkspacesApi {
1242
1098
  version: string;
1243
1099
  digest: string;
1244
1100
  };
1245
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
1101
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1246
1102
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1247
1103
  agent_state: "unknown" | "running" | "stable";
1248
1104
  change_cursor: number;
@@ -1286,8 +1142,8 @@ declare class WorkspacesApi {
1286
1142
  };
1287
1143
  operation: {
1288
1144
  id: string;
1289
- kind: "preserve" | "restore" | "verify" | "delete";
1290
- state: "failed" | "pending" | "running" | "succeeded";
1145
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1146
+ state: "succeeded" | "failed" | "running" | "pending";
1291
1147
  workspace_id: string | null;
1292
1148
  checkpoint_id: string | null;
1293
1149
  result_workspace_id: string | null;
@@ -1297,7 +1153,191 @@ declare class WorkspacesApi {
1297
1153
  completed_at: string | null;
1298
1154
  };
1299
1155
  }>;
1300
- resume(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
1156
+ resume(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
1157
+ workspace: {
1158
+ id: string;
1159
+ external_id: string;
1160
+ template: {
1161
+ name: string;
1162
+ version: string;
1163
+ digest: string;
1164
+ };
1165
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1166
+ reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1167
+ agent_state: "unknown" | "running" | "stable";
1168
+ change_cursor: number;
1169
+ provider_kind: string | null;
1170
+ provisioning_mode: "cold" | "warm" | null;
1171
+ network: {
1172
+ state: "ready" | "disabled" | "starting" | "degraded";
1173
+ };
1174
+ health: Record<string, string>;
1175
+ created_at: string;
1176
+ updated_at: string;
1177
+ connected_at: string | null;
1178
+ ready_at: string | null;
1179
+ deadline_at: string;
1180
+ terminal_at: string | null;
1181
+ metadata: Record<string, string>;
1182
+ origin_workspace_id: string | null;
1183
+ restored_from_checkpoint_id: string | null;
1184
+ source: {
1185
+ kind: "git";
1186
+ repository: string;
1187
+ requested_revision: string;
1188
+ resolved_commit: string | null;
1189
+ } | null;
1190
+ persistence: {
1191
+ enabled: boolean;
1192
+ conversation_restore: "unknown" | "supported" | "filesystem_only";
1193
+ conversation_resume: {
1194
+ status: "unknown" | "supported" | "unsupported";
1195
+ reason: "filesystem_only" | "capability_unknown" | null;
1196
+ };
1197
+ latest_checkpoint_id: string | null;
1198
+ };
1199
+ outputs: Record<string, unknown>;
1200
+ failure: {
1201
+ reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed";
1202
+ log_tail: string;
1203
+ log_tail_truncated: boolean;
1204
+ last_log_seq: number | null;
1205
+ } | null;
1206
+ };
1207
+ operation: {
1208
+ id: string;
1209
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1210
+ state: "succeeded" | "failed" | "running" | "pending";
1211
+ workspace_id: string | null;
1212
+ checkpoint_id: string | null;
1213
+ result_workspace_id: string | null;
1214
+ reason_code: string | null;
1215
+ created_at: string;
1216
+ updated_at: string;
1217
+ completed_at: string | null;
1218
+ };
1219
+ resume: {
1220
+ status: "supported";
1221
+ reason: null;
1222
+ source_workspace_id: string;
1223
+ checkpoint_id: string;
1224
+ };
1225
+ }>;
1226
+ private jsonOperation;
1227
+ }
1228
+ //#endregion
1229
+ //#region src/resources/attachments/attachments.d.ts
1230
+ type UploadBody = NonNullable<RequestInit["body"]>;
1231
+ interface AttachmentUploadInput {
1232
+ id?: string;
1233
+ name: string;
1234
+ mediaType?: string;
1235
+ body: UploadBody;
1236
+ sizeBytes: number;
1237
+ signal?: AbortSignal;
1238
+ onProgress?: (uploadedBytes: number, totalBytes: number) => void;
1239
+ }
1240
+ interface AgentMessageInput {
1241
+ content: string;
1242
+ attachmentIds?: string[];
1243
+ signal?: AbortSignal;
1244
+ readyTimeoutMs?: number;
1245
+ }
1246
+ declare class AttachmentsApi {
1247
+ private readonly transport;
1248
+ constructor(transport: PocketCoderTransport);
1249
+ upload(workspaceId: string, input: AttachmentUploadInput): Promise<AttachmentDescriptor>;
1250
+ }
1251
+ declare class AgentApi {
1252
+ private readonly transport;
1253
+ private readonly workspaces;
1254
+ constructor(transport: PocketCoderTransport, workspaces: WorkspacesApi);
1255
+ sendMessage(workspaceId: string, input: AgentMessageInput): Promise<void>;
1256
+ }
1257
+ //#endregion
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
1269
+ declare class CheckpointsApi {
1270
+ private readonly transport;
1271
+ constructor(transport: PocketCoderTransport);
1272
+ list(workspaceId: string, query?: CursorListQuery & {
1273
+ state?: CheckpointState;
1274
+ }, options?: RequestOptions): Promise<Page<{
1275
+ id: string;
1276
+ workspace_id: string;
1277
+ state: "deleted" | "ready" | "failed" | "creating" | "deleting";
1278
+ reason_code: string | null;
1279
+ template: {
1280
+ name: string;
1281
+ version: string;
1282
+ digest: string;
1283
+ };
1284
+ manifest_digest: string | null;
1285
+ logical_bytes: number | null;
1286
+ stored_bytes: number | null;
1287
+ file_count: number | null;
1288
+ mounts: string[];
1289
+ conversation_restore: "unknown" | "supported" | "filesystem_only";
1290
+ label: string | null;
1291
+ created_at: string;
1292
+ ready_at: string | null;
1293
+ expires_at: string | null;
1294
+ }>>;
1295
+ get(id: string, options?: RequestOptions): Promise<{
1296
+ id: string;
1297
+ workspace_id: string;
1298
+ state: "deleted" | "ready" | "failed" | "creating" | "deleting";
1299
+ reason_code: string | null;
1300
+ template: {
1301
+ name: string;
1302
+ version: string;
1303
+ digest: string;
1304
+ };
1305
+ manifest_digest: string | null;
1306
+ logical_bytes: number | null;
1307
+ stored_bytes: number | null;
1308
+ file_count: number | null;
1309
+ mounts: string[];
1310
+ conversation_restore: "unknown" | "supported" | "filesystem_only";
1311
+ label: string | null;
1312
+ created_at: string;
1313
+ ready_at: string | null;
1314
+ expires_at: string | null;
1315
+ }>;
1316
+ verify(id: string, key: string, options?: RequestOptions): Promise<{
1317
+ id: string;
1318
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1319
+ state: "succeeded" | "failed" | "running" | "pending";
1320
+ workspace_id: string | null;
1321
+ checkpoint_id: string | null;
1322
+ result_workspace_id: string | null;
1323
+ reason_code: string | null;
1324
+ created_at: string;
1325
+ updated_at: string;
1326
+ completed_at: string | null;
1327
+ }>;
1328
+ delete(id: string, key: string, options?: RequestOptions): Promise<{
1329
+ id: string;
1330
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1331
+ state: "succeeded" | "failed" | "running" | "pending";
1332
+ workspace_id: string | null;
1333
+ checkpoint_id: string | null;
1334
+ result_workspace_id: string | null;
1335
+ reason_code: string | null;
1336
+ created_at: string;
1337
+ updated_at: string;
1338
+ completed_at: string | null;
1339
+ }>;
1340
+ restore(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
1301
1341
  workspace: {
1302
1342
  id: string;
1303
1343
  external_id: string;
@@ -1306,7 +1346,7 @@ declare class WorkspacesApi {
1306
1346
  version: string;
1307
1347
  digest: string;
1308
1348
  };
1309
- state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
1349
+ state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1310
1350
  reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
1311
1351
  agent_state: "unknown" | "running" | "stable";
1312
1352
  change_cursor: number;
@@ -1350,8 +1390,8 @@ declare class WorkspacesApi {
1350
1390
  };
1351
1391
  operation: {
1352
1392
  id: string;
1353
- kind: "preserve" | "restore" | "verify" | "delete";
1354
- state: "failed" | "pending" | "running" | "succeeded";
1393
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1394
+ state: "succeeded" | "failed" | "running" | "pending";
1355
1395
  workspace_id: string | null;
1356
1396
  checkpoint_id: string | null;
1357
1397
  result_workspace_id: string | null;
@@ -1360,14 +1400,206 @@ declare class WorkspacesApi {
1360
1400
  updated_at: string;
1361
1401
  completed_at: string | null;
1362
1402
  };
1363
- resume: {
1364
- status: "supported";
1365
- reason: null;
1366
- source_workspace_id: string;
1367
- checkpoint_id: string;
1403
+ }>;
1404
+ private operationRequest;
1405
+ }
1406
+ declare class OperationsApi {
1407
+ private readonly transport;
1408
+ constructor(transport: PocketCoderTransport);
1409
+ get(id: string, options?: RequestOptions): Promise<{
1410
+ id: string;
1411
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1412
+ state: "succeeded" | "failed" | "running" | "pending";
1413
+ workspace_id: string | null;
1414
+ checkpoint_id: string | null;
1415
+ result_workspace_id: string | null;
1416
+ reason_code: string | null;
1417
+ created_at: string;
1418
+ updated_at: string;
1419
+ completed_at: string | null;
1420
+ }>;
1421
+ }
1422
+ //#endregion
1423
+ //#region src/resources/conversations/conversations.d.ts
1424
+ type ConversationMessage = ConversationMessageResource;
1425
+ type ConversationPage = Page<ConversationMessageResource>;
1426
+ declare class ConversationsApi {
1427
+ private readonly transport;
1428
+ constructor(transport: PocketCoderTransport);
1429
+ list(id: string, query?: CursorListQuery, options?: RequestOptions): Promise<Page<{
1430
+ message_id: string;
1431
+ role: "user" | "assistant" | "system" | "tool";
1432
+ content: string;
1433
+ occurred_at: string;
1434
+ metadata: Record<string, string>;
1435
+ seq: number;
1436
+ }>>;
1437
+ }
1438
+ //#endregion
1439
+ //#region src/resources/diagnostics/diagnostics.d.ts
1440
+ declare class WorkspaceCursorApi<T> {
1441
+ private readonly transport;
1442
+ private readonly resource;
1443
+ private readonly schema;
1444
+ constructor(transport: PocketCoderTransport, resource: string, schema: z.ZodType<{
1445
+ items: T[];
1446
+ next_cursor: string | null;
1447
+ }>);
1448
+ list(workspaceId: string, query?: CursorListQuery, options?: RequestOptions): Promise<Page<T>>;
1449
+ }
1450
+ declare class LogsApi extends WorkspaceCursorApi<LogChunk> {
1451
+ constructor(transport: PocketCoderTransport);
1452
+ }
1453
+ declare class NetworkEventsApi extends WorkspaceCursorApi<NetworkEvent> {
1454
+ constructor(transport: PocketCoderTransport);
1455
+ }
1456
+ declare class OutputsApi extends WorkspaceCursorApi<OutputResource> {
1457
+ constructor(transport: PocketCoderTransport);
1458
+ }
1459
+ //#endregion
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;
1368
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
1548
+ type TemplateSummary = TemplateListItem;
1549
+ declare class TemplatesApi {
1550
+ private readonly transport;
1551
+ constructor(transport: PocketCoderTransport);
1552
+ page(query?: CursorListQuery, options?: RequestOptions): Promise<Page<{
1553
+ name: string;
1554
+ version: string;
1555
+ digest: string;
1556
+ status: "active" | "available" | "retired";
1557
+ description?: string | undefined;
1558
+ }>>;
1559
+ list(options?: RequestOptions): Promise<{
1560
+ name: string;
1561
+ version: string;
1562
+ digest: string;
1563
+ status: "active" | "available" | "retired";
1564
+ description?: string | undefined;
1565
+ }[]>;
1566
+ }
1567
+ //#endregion
1568
+ //#region src/resources/terminals/terminals.d.ts
1569
+ interface TerminalConnectOptions {
1570
+ sessionId?: string;
1571
+ }
1572
+ declare class TerminalConnection {
1573
+ readonly socket: WebSocket;
1574
+ private readonly messageListeners;
1575
+ private readonly openListeners;
1576
+ private readonly closeListeners;
1577
+ private readonly errorListeners;
1578
+ private readonly pendingMessages;
1579
+ private opened;
1580
+ private closedEvent;
1581
+ private errored;
1582
+ constructor(socket: WebSocket);
1583
+ onMessage(listener: (message: ServerTerminalMessage) => void): () => void;
1584
+ onOpen(listener: () => void): () => void;
1585
+ onClose(listener: (event: CloseEvent) => void): () => void;
1586
+ onError(listener: () => void): () => void;
1587
+ sendInput(value: Uint8Array | string): void;
1588
+ resize(rows: number, cols: number): void;
1589
+ close(code?: number, reason?: string): void;
1590
+ private handleMessage;
1591
+ }
1592
+ declare class TerminalsApi {
1593
+ private readonly transport;
1594
+ constructor(transport: PocketCoderTransport);
1595
+ connect(workspaceId: string, options?: TerminalConnectOptions): TerminalConnection;
1596
+ list(workspaceId: string, query?: {
1597
+ cursor?: string;
1598
+ limit?: number;
1599
+ }, options?: RequestOptions): Promise<{
1600
+ items: TerminalSession[];
1601
+ nextCursor: string | null;
1369
1602
  }>;
1370
- private jsonOperation;
1371
1603
  }
1372
1604
  //#endregion
1373
1605
  //#region src/client.d.ts
@@ -1385,37 +1617,13 @@ declare class PocketCoderClient {
1385
1617
  readonly outputs: OutputsApi;
1386
1618
  readonly administration: AdministrationApi;
1387
1619
  readonly terminals: TerminalsApi;
1620
+ readonly keys: KeysApi;
1621
+ readonly recovery: RecoveryApi;
1388
1622
  constructor(config: PocketCoderClientConfig, fetchImpl?: typeof fetch);
1389
1623
  raw(path: string, init?: RequestInit): Promise<Response>;
1390
1624
  }
1391
1625
  //#endregion
1392
- //#region src/errors.d.ts
1393
- declare const ClientErrorCodeSchema: z.ZodEnum<{
1394
- "client.invalid_response": "client.invalid_response";
1395
- "client.non_json_response": "client.non_json_response";
1396
- }>;
1397
- type ClientErrorCode = z.infer<typeof ClientErrorCodeSchema>;
1398
- declare class PocketCoderError extends Error {
1399
- readonly code: ErrorCode | ClientErrorCode;
1400
- readonly status: number;
1401
- readonly requestId: string | undefined;
1402
- readonly details: Record<string, unknown> | undefined;
1403
- constructor(input: {
1404
- message: string;
1405
- code: ErrorCode | ClientErrorCode;
1406
- status: number;
1407
- requestId?: string;
1408
- details?: Record<string, unknown>;
1409
- });
1410
- }
1411
- declare class ConversationGoneError extends PocketCoderError {}
1412
- declare class WorkspaceTerminalError extends Error {
1413
- readonly workspace: WorkspaceResource;
1414
- constructor(workspace: WorkspaceResource);
1415
- }
1416
- declare function isPocketCoderErrorCode(value: unknown): value is ErrorCode;
1417
- //#endregion
1418
- //#region src/workspace-turn-resolver.d.ts
1626
+ //#region src/resources/workspaces/workspace-turn-resolver.d.ts
1419
1627
  type WorkspaceTurnResolutionErrorCode = "not_resumable" | "resume_handler_missing" | "resume_failed" | "invalid_resumed_workspace" | "readiness_failed";
1420
1628
  declare class WorkspaceTurnResolutionError extends Error {
1421
1629
  readonly code: WorkspaceTurnResolutionErrorCode;
@@ -1452,4 +1660,35 @@ declare class WorkspaceTurnResolver {
1452
1660
  private assertLineage;
1453
1661
  }
1454
1662
  //#endregion
1455
- export { AdministrationApi, AgentApi, type AgentMessageInput, 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 };