@pstdio/pocketcoder-sdk 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +575 -218
  2. package/dist/index.js +592 -380
  3. package/package.json +2 -2
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,90 @@ 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:write": "conversations:write";
36
+ "conversations:delete": "conversations:delete";
37
+ "services:relay": "services:relay";
38
+ "attachments:write": "attachments:write";
39
+ "logs:read": "logs:read";
40
+ "network:read": "network:read";
41
+ "terminal:attach": "terminal:attach";
42
+ "terminal:read": "terminal:read";
43
+ admin: "admin";
44
+ }>>;
45
+ expires_at: z.ZodISODateTime;
46
+ }, z.core.$strict>;
47
+ type KeyIssueRequest = z.infer<typeof KeyIssueRequestSchema>;
48
+ declare const KeyResourceSchema: z.ZodObject<{
49
+ id: z.ZodUUID;
50
+ principal_id: z.ZodUUID;
51
+ scopes: z.ZodArray<z.ZodString>;
52
+ effective_scopes: z.ZodArray<z.ZodString>;
53
+ managed_principal_ids: z.ZodArray<z.ZodUUID>;
54
+ issuance_request_id: z.ZodNullable<z.ZodString>;
55
+ created_at: z.ZodISODateTime;
56
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
57
+ revoked_at: z.ZodNullable<z.ZodISODateTime>;
58
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
39
59
  }, z.core.$strip>;
40
- type ConversationMessageResource = z.infer<typeof ConversationMessageResourceSchema>;
60
+ type KeyResource = z.infer<typeof KeyResourceSchema>;
61
+ declare const KeyIssueResponseSchema: z.ZodObject<{
62
+ key: z.ZodObject<{
63
+ id: z.ZodUUID;
64
+ principal_id: z.ZodUUID;
65
+ scopes: z.ZodArray<z.ZodString>;
66
+ effective_scopes: z.ZodArray<z.ZodString>;
67
+ managed_principal_ids: z.ZodArray<z.ZodUUID>;
68
+ issuance_request_id: z.ZodNullable<z.ZodString>;
69
+ created_at: z.ZodISODateTime;
70
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
71
+ revoked_at: z.ZodNullable<z.ZodISODateTime>;
72
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
73
+ }, z.core.$strip>;
74
+ token: z.ZodNullable<z.ZodString>;
75
+ }, z.core.$strip>;
76
+ type KeyIssueResponse = z.infer<typeof KeyIssueResponseSchema>;
77
+ declare const KeyListResponseSchema: z.ZodObject<{
78
+ items: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodUUID;
80
+ principal_id: z.ZodUUID;
81
+ scopes: z.ZodArray<z.ZodString>;
82
+ effective_scopes: z.ZodArray<z.ZodString>;
83
+ managed_principal_ids: z.ZodArray<z.ZodUUID>;
84
+ issuance_request_id: z.ZodNullable<z.ZodString>;
85
+ created_at: z.ZodISODateTime;
86
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
87
+ revoked_at: z.ZodNullable<z.ZodISODateTime>;
88
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
89
+ }, z.core.$strip>>;
90
+ next_cursor: z.ZodNullable<z.ZodUUID>;
91
+ }, z.core.$strip>;
92
+ type KeyListResponse = z.infer<typeof KeyListResponseSchema>;
41
93
  //#endregion
42
- //#region ../contracts/src/errors.d.ts
94
+ //#region ../contracts/src/common/errors.d.ts
43
95
  declare const ERROR_CODES: {
44
96
  readonly "auth.invalid_key": 401;
45
97
  readonly "auth.missing_scope": 403;
46
98
  readonly "auth.disabled_principal": 403;
99
+ readonly "principal.not_found": 404;
100
+ readonly "key.not_found": 404;
47
101
  readonly "validation.invalid": 400;
48
102
  readonly "idempotency.conflict": 409;
49
103
  readonly "capacity.queue_full": 429;
@@ -95,7 +149,252 @@ declare const ERROR_CODES: {
95
149
  };
96
150
  type ErrorCode = keyof typeof ERROR_CODES;
97
151
  //#endregion
98
- //#region ../contracts/src/workspace.d.ts
152
+ //#region ../contracts/src/conversations/conversation.d.ts
153
+ declare const ConversationMessageResourceSchema: z.ZodObject<{
154
+ message_id: z.ZodString;
155
+ role: z.ZodEnum<{
156
+ user: "user";
157
+ assistant: "assistant";
158
+ system: "system";
159
+ tool: "tool";
160
+ }>;
161
+ content: z.ZodString;
162
+ occurred_at: z.ZodISODateTime;
163
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
164
+ seq: z.ZodNumber;
165
+ identity: z.ZodDefault<z.ZodNullable<z.ZodObject<{
166
+ schema: z.ZodLiteral<"pocketcoder.conversation/v2">;
167
+ authority: z.ZodEnum<{
168
+ external: "external";
169
+ generic: "generic";
170
+ }>;
171
+ conversation_id: z.ZodUUID;
172
+ request_id: z.ZodUUID;
173
+ turn_id: z.ZodUUID;
174
+ request_fingerprint: z.ZodString;
175
+ event_id: z.ZodUUID;
176
+ message_id: z.ZodString;
177
+ sequence: z.ZodNumber;
178
+ revision: z.ZodNumber;
179
+ fact: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
180
+ type: z.ZodLiteral<"intermediate">;
181
+ }, z.core.$strip>, z.ZodObject<{
182
+ type: z.ZodLiteral<"final_response">;
183
+ }, z.core.$strip>, z.ZodObject<{
184
+ type: z.ZodLiteral<"tool_only">;
185
+ }, z.core.$strip>, z.ZodObject<{
186
+ type: z.ZodLiteral<"activity_started">;
187
+ activity_id: z.ZodUUID;
188
+ kind: z.ZodEnum<{
189
+ tool: "tool";
190
+ attachment: "attachment";
191
+ workspace: "workspace";
192
+ retrieval: "retrieval";
193
+ }>;
194
+ label: z.ZodString;
195
+ started_at: z.ZodNullable<z.ZodISODateTime>;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ type: z.ZodLiteral<"activity_finished">;
198
+ activity_id: z.ZodUUID;
199
+ ended_at: z.ZodNullable<z.ZodISODateTime>;
200
+ outcome: z.ZodEnum<{
201
+ completed: "completed";
202
+ failed: "failed";
203
+ interrupted: "interrupted";
204
+ canceled: "canceled";
205
+ }>;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ type: z.ZodLiteral<"turn_terminal">;
208
+ outcome: z.ZodEnum<{
209
+ completed: "completed";
210
+ failed: "failed";
211
+ interrupted: "interrupted";
212
+ canceled: "canceled";
213
+ lost: "lost";
214
+ }>;
215
+ }, z.core.$strip>], "type">>;
216
+ }, z.core.$strip>>>;
217
+ }, z.core.$strip>;
218
+ type ConversationMessageResource = z.infer<typeof ConversationMessageResourceSchema>;
219
+ //#endregion
220
+ //#region ../contracts/src/conversations/identity.d.ts
221
+ declare const ConversationRequestIdentitySchema: z.ZodObject<{
222
+ schema: z.ZodLiteral<"pocketcoder.conversation/v2">;
223
+ authority: z.ZodEnum<{
224
+ external: "external";
225
+ generic: "generic";
226
+ }>;
227
+ conversation_id: z.ZodUUID;
228
+ request_id: z.ZodUUID;
229
+ turn_id: z.ZodUUID;
230
+ request_fingerprint: z.ZodString;
231
+ }, z.core.$strip>;
232
+ type ConversationRequestIdentity = z.infer<typeof ConversationRequestIdentitySchema>;
233
+ declare const ConversationMessageIdentitySchema: z.ZodObject<{
234
+ schema: z.ZodLiteral<"pocketcoder.conversation/v2">;
235
+ authority: z.ZodEnum<{
236
+ external: "external";
237
+ generic: "generic";
238
+ }>;
239
+ conversation_id: z.ZodUUID;
240
+ request_id: z.ZodUUID;
241
+ turn_id: z.ZodUUID;
242
+ request_fingerprint: z.ZodString;
243
+ event_id: z.ZodUUID;
244
+ message_id: z.ZodString;
245
+ sequence: z.ZodNumber;
246
+ revision: z.ZodNumber;
247
+ fact: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
248
+ type: z.ZodLiteral<"intermediate">;
249
+ }, z.core.$strip>, z.ZodObject<{
250
+ type: z.ZodLiteral<"final_response">;
251
+ }, z.core.$strip>, z.ZodObject<{
252
+ type: z.ZodLiteral<"tool_only">;
253
+ }, z.core.$strip>, z.ZodObject<{
254
+ type: z.ZodLiteral<"activity_started">;
255
+ activity_id: z.ZodUUID;
256
+ kind: z.ZodEnum<{
257
+ tool: "tool";
258
+ attachment: "attachment";
259
+ workspace: "workspace";
260
+ retrieval: "retrieval";
261
+ }>;
262
+ label: z.ZodString;
263
+ started_at: z.ZodNullable<z.ZodISODateTime>;
264
+ }, z.core.$strip>, z.ZodObject<{
265
+ type: z.ZodLiteral<"activity_finished">;
266
+ activity_id: z.ZodUUID;
267
+ ended_at: z.ZodNullable<z.ZodISODateTime>;
268
+ outcome: z.ZodEnum<{
269
+ completed: "completed";
270
+ failed: "failed";
271
+ interrupted: "interrupted";
272
+ canceled: "canceled";
273
+ }>;
274
+ }, z.core.$strip>, z.ZodObject<{
275
+ type: z.ZodLiteral<"turn_terminal">;
276
+ outcome: z.ZodEnum<{
277
+ completed: "completed";
278
+ failed: "failed";
279
+ interrupted: "interrupted";
280
+ canceled: "canceled";
281
+ lost: "lost";
282
+ }>;
283
+ }, z.core.$strip>], "type">>;
284
+ }, z.core.$strip>;
285
+ type ConversationMessageIdentity = z.infer<typeof ConversationMessageIdentitySchema>;
286
+ //#endregion
287
+ //#region ../contracts/src/network/network.d.ts
288
+ declare const NetworkEventSchema: z.ZodObject<{
289
+ path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
290
+ occurred_at: z.ZodISODateTime;
291
+ decision: z.ZodEnum<{
292
+ allow: "allow";
293
+ deny: "deny";
294
+ }>;
295
+ transport: z.ZodEnum<{
296
+ http: "http";
297
+ https: "https";
298
+ }>;
299
+ host: z.ZodString;
300
+ port: z.ZodNumber;
301
+ method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
302
+ matched_rule: z.ZodDefault<z.ZodNullable<z.ZodString>>;
303
+ reason: z.ZodString;
304
+ seq: z.ZodNumber;
305
+ workspace_id: z.ZodUUID;
306
+ source_session_id: z.ZodUUID;
307
+ source_seq: z.ZodNumber;
308
+ }, z.core.$strip>;
309
+ type NetworkEvent = z.infer<typeof NetworkEventSchema>;
310
+ //#endregion
311
+ //#region ../contracts/src/persistence/persistence.d.ts
312
+ declare const CHECKPOINT_STATES: readonly ["creating", "ready", "failed", "deleting", "deleted"];
313
+ type CheckpointState = (typeof CHECKPOINT_STATES)[number];
314
+ declare const OPERATION_KINDS: readonly ["preserve", "restore", "verify", "delete", "purge"];
315
+ type OperationKind = (typeof OPERATION_KINDS)[number];
316
+ declare const OPERATION_STATES: readonly ["pending", "running", "succeeded", "failed"];
317
+ type OperationState = (typeof OPERATION_STATES)[number];
318
+ declare const STORAGE_STATES: readonly ["allocating", "ready", "snapshotting", "retained", "restoring", "deleting", "deleted", "lost", "quarantined"];
319
+ type StorageState = (typeof STORAGE_STATES)[number];
320
+ declare const CheckpointResourceSchema: z.ZodObject<{
321
+ id: z.ZodUUID;
322
+ workspace_id: z.ZodUUID;
323
+ state: z.ZodEnum<{
324
+ creating: "creating";
325
+ ready: "ready";
326
+ failed: "failed";
327
+ deleting: "deleting";
328
+ deleted: "deleted";
329
+ }>;
330
+ reason_code: z.ZodNullable<z.ZodString>;
331
+ template: z.ZodObject<{
332
+ name: z.ZodString;
333
+ version: z.ZodString;
334
+ digest: z.ZodString;
335
+ }, z.core.$strip>;
336
+ manifest_digest: z.ZodNullable<z.ZodString>;
337
+ logical_bytes: z.ZodNullable<z.ZodNumber>;
338
+ stored_bytes: z.ZodNullable<z.ZodNumber>;
339
+ file_count: z.ZodNullable<z.ZodNumber>;
340
+ mounts: z.ZodArray<z.ZodString>;
341
+ conversation_restore: z.ZodEnum<{
342
+ supported: "supported";
343
+ filesystem_only: "filesystem_only";
344
+ unknown: "unknown";
345
+ }>;
346
+ label: z.ZodNullable<z.ZodString>;
347
+ created_at: z.ZodISODateTime;
348
+ ready_at: z.ZodNullable<z.ZodISODateTime>;
349
+ expires_at: z.ZodNullable<z.ZodISODateTime>;
350
+ }, z.core.$strip>;
351
+ type CheckpointResource = z.infer<typeof CheckpointResourceSchema>;
352
+ declare const OperationResourceSchema: z.ZodObject<{
353
+ id: z.ZodUUID;
354
+ kind: z.ZodEnum<{
355
+ restore: "restore";
356
+ preserve: "preserve";
357
+ verify: "verify";
358
+ delete: "delete";
359
+ purge: "purge";
360
+ }>;
361
+ state: z.ZodEnum<{
362
+ failed: "failed";
363
+ pending: "pending";
364
+ running: "running";
365
+ succeeded: "succeeded";
366
+ }>;
367
+ workspace_id: z.ZodNullable<z.ZodUUID>;
368
+ checkpoint_id: z.ZodNullable<z.ZodUUID>;
369
+ result_workspace_id: z.ZodNullable<z.ZodUUID>;
370
+ reason_code: z.ZodNullable<z.ZodString>;
371
+ created_at: z.ZodISODateTime;
372
+ updated_at: z.ZodISODateTime;
373
+ completed_at: z.ZodNullable<z.ZodISODateTime>;
374
+ }, z.core.$strip>;
375
+ type OperationResource = z.infer<typeof OperationResourceSchema>;
376
+ declare const PreserveRequestSchema: z.ZodObject<{
377
+ retention: z.ZodOptional<z.ZodString>;
378
+ label: z.ZodOptional<z.ZodString>;
379
+ }, z.core.$strip>;
380
+ type PreserveRequest = z.infer<typeof PreserveRequestSchema>;
381
+ declare const RestoreRequestSchema: z.ZodObject<{
382
+ external_id: z.ZodString;
383
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
384
+ launch_input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
385
+ }, z.core.$strip>;
386
+ type RestoreRequest = z.infer<typeof RestoreRequestSchema>;
387
+ //#endregion
388
+ //#region ../contracts/src/protocol/api.d.ts
389
+ declare const OutputResourceSchema: z.ZodObject<{
390
+ seq: z.ZodNumber;
391
+ name: z.ZodString;
392
+ value: z.ZodUnknown;
393
+ occurred_at: z.ZodISODateTime;
394
+ }, z.core.$strip>;
395
+ type OutputResource = z.infer<typeof OutputResourceSchema>;
396
+ //#endregion
397
+ //#region ../contracts/src/workspaces/workspace.d.ts
99
398
  declare const WORKSPACE_STATES: readonly ["queued", "provisioning", "connected", "ready", "preserving", "terminating", "succeeded", "failed", "canceled", "expired", "preserved"];
100
399
  type WorkspaceState = (typeof WORKSPACE_STATES)[number];
101
400
  declare const AGENT_STATES: readonly ["unknown", "running", "stable"];
@@ -272,7 +571,7 @@ declare const TemplateListItemSchema: z.ZodObject<{
272
571
  }, z.core.$strip>;
273
572
  type TemplateListItem = z.infer<typeof TemplateListItemSchema>;
274
573
  //#endregion
275
- //#region ../contracts/src/logs.d.ts
574
+ //#region ../contracts/src/protocol/logs.d.ts
276
575
  declare const LogChunkSchema: z.ZodObject<{
277
576
  seq: z.ZodNumber;
278
577
  stream: z.ZodString;
@@ -281,107 +580,7 @@ declare const LogChunkSchema: z.ZodObject<{
281
580
  }, z.core.$strip>;
282
581
  type LogChunk = z.infer<typeof LogChunkSchema>;
283
582
  //#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
583
+ //#region ../contracts/src/terminals/terminal.d.ts
385
584
  declare const ServerTerminalMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
386
585
  type: z.ZodLiteral<"opened">;
387
586
  session_id: z.ZodUUID;
@@ -428,7 +627,7 @@ declare const TerminalSessionSchema: z.ZodObject<{
428
627
  type ServerTerminalMessage = z.infer<typeof ServerTerminalMessageSchema>;
429
628
  type TerminalSession = z.infer<typeof TerminalSessionSchema>;
430
629
  //#endregion
431
- //#region src/transport.d.ts
630
+ //#region src/transport/transport.d.ts
432
631
  type FetchLike = typeof fetch;
433
632
  type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocket;
434
633
  interface PocketCoderClientConfig {
@@ -455,7 +654,7 @@ declare class PocketCoderTransport {
455
654
  request<T>(path: string, schema: z.ZodType<T>, init?: RequestInit): Promise<T>;
456
655
  }
457
656
  //#endregion
458
- //#region src/admin.d.ts
657
+ //#region src/resources/admin/admin.d.ts
459
658
  declare class AdministrationApi {
460
659
  private readonly transport;
461
660
  constructor(transport: PocketCoderTransport);
@@ -485,17 +684,7 @@ declare class AdministrationApi {
485
684
  }>;
486
685
  }
487
686
  //#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
687
+ //#region src/resources/workspaces/workspaces.d.ts
499
688
  interface WorkspaceCreateInput {
500
689
  externalId: string;
501
690
  templateName: string;
@@ -525,7 +714,7 @@ declare class WorkspacesApi {
525
714
  version: string;
526
715
  digest: string;
527
716
  };
528
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
717
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
529
718
  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;
530
719
  agent_state: "unknown" | "running" | "stable";
531
720
  change_cursor: number;
@@ -575,7 +764,7 @@ declare class WorkspacesApi {
575
764
  version: string;
576
765
  digest: string;
577
766
  };
578
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
767
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
579
768
  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;
580
769
  agent_state: "unknown" | "running" | "stable";
581
770
  change_cursor: number;
@@ -625,7 +814,7 @@ declare class WorkspacesApi {
625
814
  version: string;
626
815
  digest: string;
627
816
  };
628
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
817
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
629
818
  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;
630
819
  agent_state: "unknown" | "running" | "stable";
631
820
  change_cursor: number;
@@ -675,7 +864,7 @@ declare class WorkspacesApi {
675
864
  version: string;
676
865
  digest: string;
677
866
  };
678
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
867
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
679
868
  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;
680
869
  agent_state: "unknown" | "running" | "stable";
681
870
  change_cursor: number;
@@ -725,7 +914,7 @@ declare class WorkspacesApi {
725
914
  version: string;
726
915
  digest: string;
727
916
  };
728
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
917
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
729
918
  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;
730
919
  agent_state: "unknown" | "running" | "stable";
731
920
  change_cursor: number;
@@ -778,7 +967,7 @@ declare class WorkspacesApi {
778
967
  version: string;
779
968
  digest: string;
780
969
  };
781
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
970
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
782
971
  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;
783
972
  agent_state: "unknown" | "running" | "stable";
784
973
  change_cursor: number;
@@ -831,7 +1020,7 @@ declare class WorkspacesApi {
831
1020
  version: string;
832
1021
  digest: string;
833
1022
  };
834
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1023
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
835
1024
  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;
836
1025
  agent_state: "unknown" | "running" | "stable";
837
1026
  change_cursor: number;
@@ -881,7 +1070,7 @@ declare class WorkspacesApi {
881
1070
  version: string;
882
1071
  digest: string;
883
1072
  };
884
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1073
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
885
1074
  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;
886
1075
  agent_state: "unknown" | "running" | "stable";
887
1076
  change_cursor: number;
@@ -932,7 +1121,7 @@ declare class WorkspacesApi {
932
1121
  version: string;
933
1122
  digest: string;
934
1123
  };
935
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1124
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
936
1125
  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;
937
1126
  agent_state: "unknown" | "running" | "stable";
938
1127
  change_cursor: number;
@@ -977,7 +1166,7 @@ declare class WorkspacesApi {
977
1166
  checkpoint: {
978
1167
  id: string;
979
1168
  workspace_id: string;
980
- state: "ready" | "failed" | "creating" | "deleting" | "deleted";
1169
+ state: "deleted" | "failed" | "ready" | "creating" | "deleting";
981
1170
  reason_code: string | null;
982
1171
  template: {
983
1172
  name: string;
@@ -997,8 +1186,8 @@ declare class WorkspacesApi {
997
1186
  };
998
1187
  operation: {
999
1188
  id: string;
1000
- kind: "preserve" | "restore" | "verify" | "delete";
1001
- state: "succeeded" | "failed" | "running" | "pending";
1189
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1190
+ state: "failed" | "succeeded" | "running" | "pending";
1002
1191
  workspace_id: string | null;
1003
1192
  checkpoint_id: string | null;
1004
1193
  result_workspace_id: string | null;
@@ -1008,6 +1197,18 @@ declare class WorkspacesApi {
1008
1197
  completed_at: string | null;
1009
1198
  };
1010
1199
  }>;
1200
+ purge(id: string, key: string, options?: RequestOptions): Promise<{
1201
+ id: string;
1202
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1203
+ state: "failed" | "succeeded" | "running" | "pending";
1204
+ workspace_id: string | null;
1205
+ checkpoint_id: string | null;
1206
+ result_workspace_id: string | null;
1207
+ reason_code: string | null;
1208
+ created_at: string;
1209
+ updated_at: string;
1210
+ completed_at: string | null;
1211
+ }>;
1011
1212
  recreate(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
1012
1213
  workspace: {
1013
1214
  id: string;
@@ -1017,7 +1218,7 @@ declare class WorkspacesApi {
1017
1218
  version: string;
1018
1219
  digest: string;
1019
1220
  };
1020
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1221
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
1021
1222
  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;
1022
1223
  agent_state: "unknown" | "running" | "stable";
1023
1224
  change_cursor: number;
@@ -1061,8 +1262,8 @@ declare class WorkspacesApi {
1061
1262
  };
1062
1263
  operation: {
1063
1264
  id: string;
1064
- kind: "preserve" | "restore" | "verify" | "delete";
1065
- state: "succeeded" | "failed" | "running" | "pending";
1265
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1266
+ state: "failed" | "succeeded" | "running" | "pending";
1066
1267
  workspace_id: string | null;
1067
1268
  checkpoint_id: string | null;
1068
1269
  result_workspace_id: string | null;
@@ -1081,7 +1282,7 @@ declare class WorkspacesApi {
1081
1282
  version: string;
1082
1283
  digest: string;
1083
1284
  };
1084
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1285
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
1085
1286
  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;
1086
1287
  agent_state: "unknown" | "running" | "stable";
1087
1288
  change_cursor: number;
@@ -1125,8 +1326,8 @@ declare class WorkspacesApi {
1125
1326
  };
1126
1327
  operation: {
1127
1328
  id: string;
1128
- kind: "preserve" | "restore" | "verify" | "delete";
1129
- state: "succeeded" | "failed" | "running" | "pending";
1329
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1330
+ state: "failed" | "succeeded" | "running" | "pending";
1130
1331
  workspace_id: string | null;
1131
1332
  checkpoint_id: string | null;
1132
1333
  result_workspace_id: string | null;
@@ -1145,7 +1346,7 @@ declare class WorkspacesApi {
1145
1346
  private jsonOperation;
1146
1347
  }
1147
1348
  //#endregion
1148
- //#region src/attachments.d.ts
1349
+ //#region src/resources/attachments/attachments.d.ts
1149
1350
  type UploadBody = NonNullable<RequestInit["body"]>;
1150
1351
  interface AttachmentUploadInput {
1151
1352
  id?: string;
@@ -1174,7 +1375,17 @@ declare class AgentApi {
1174
1375
  sendMessage(workspaceId: string, input: AgentMessageInput): Promise<void>;
1175
1376
  }
1176
1377
  //#endregion
1177
- //#region src/checkpoints.d.ts
1378
+ //#region src/transport/common.d.ts
1379
+ interface Page<T> {
1380
+ items: T[];
1381
+ nextCursor: string | null;
1382
+ }
1383
+ interface CursorListQuery {
1384
+ limit?: number;
1385
+ cursor?: string;
1386
+ }
1387
+ //#endregion
1388
+ //#region src/resources/checkpoints/checkpoints.d.ts
1178
1389
  declare class CheckpointsApi {
1179
1390
  private readonly transport;
1180
1391
  constructor(transport: PocketCoderTransport);
@@ -1183,7 +1394,7 @@ declare class CheckpointsApi {
1183
1394
  }, options?: RequestOptions): Promise<Page<{
1184
1395
  id: string;
1185
1396
  workspace_id: string;
1186
- state: "ready" | "failed" | "creating" | "deleting" | "deleted";
1397
+ state: "deleted" | "failed" | "ready" | "creating" | "deleting";
1187
1398
  reason_code: string | null;
1188
1399
  template: {
1189
1400
  name: string;
@@ -1204,7 +1415,7 @@ declare class CheckpointsApi {
1204
1415
  get(id: string, options?: RequestOptions): Promise<{
1205
1416
  id: string;
1206
1417
  workspace_id: string;
1207
- state: "ready" | "failed" | "creating" | "deleting" | "deleted";
1418
+ state: "deleted" | "failed" | "ready" | "creating" | "deleting";
1208
1419
  reason_code: string | null;
1209
1420
  template: {
1210
1421
  name: string;
@@ -1224,8 +1435,8 @@ declare class CheckpointsApi {
1224
1435
  }>;
1225
1436
  verify(id: string, key: string, options?: RequestOptions): Promise<{
1226
1437
  id: string;
1227
- kind: "preserve" | "restore" | "verify" | "delete";
1228
- state: "succeeded" | "failed" | "running" | "pending";
1438
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1439
+ state: "failed" | "succeeded" | "running" | "pending";
1229
1440
  workspace_id: string | null;
1230
1441
  checkpoint_id: string | null;
1231
1442
  result_workspace_id: string | null;
@@ -1236,8 +1447,8 @@ declare class CheckpointsApi {
1236
1447
  }>;
1237
1448
  delete(id: string, key: string, options?: RequestOptions): Promise<{
1238
1449
  id: string;
1239
- kind: "preserve" | "restore" | "verify" | "delete";
1240
- state: "succeeded" | "failed" | "running" | "pending";
1450
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1451
+ state: "failed" | "succeeded" | "running" | "pending";
1241
1452
  workspace_id: string | null;
1242
1453
  checkpoint_id: string | null;
1243
1454
  result_workspace_id: string | null;
@@ -1255,7 +1466,7 @@ declare class CheckpointsApi {
1255
1466
  version: string;
1256
1467
  digest: string;
1257
1468
  };
1258
- state: "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "failed" | "canceled" | "expired" | "preserved";
1469
+ state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
1259
1470
  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;
1260
1471
  agent_state: "unknown" | "running" | "stable";
1261
1472
  change_cursor: number;
@@ -1299,8 +1510,8 @@ declare class CheckpointsApi {
1299
1510
  };
1300
1511
  operation: {
1301
1512
  id: string;
1302
- kind: "preserve" | "restore" | "verify" | "delete";
1303
- state: "succeeded" | "failed" | "running" | "pending";
1513
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1514
+ state: "failed" | "succeeded" | "running" | "pending";
1304
1515
  workspace_id: string | null;
1305
1516
  checkpoint_id: string | null;
1306
1517
  result_workspace_id: string | null;
@@ -1317,8 +1528,8 @@ declare class OperationsApi {
1317
1528
  constructor(transport: PocketCoderTransport);
1318
1529
  get(id: string, options?: RequestOptions): Promise<{
1319
1530
  id: string;
1320
- kind: "preserve" | "restore" | "verify" | "delete";
1321
- state: "succeeded" | "failed" | "running" | "pending";
1531
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1532
+ state: "failed" | "succeeded" | "running" | "pending";
1322
1533
  workspace_id: string | null;
1323
1534
  checkpoint_id: string | null;
1324
1535
  result_workspace_id: string | null;
@@ -1329,23 +1540,80 @@ declare class OperationsApi {
1329
1540
  }>;
1330
1541
  }
1331
1542
  //#endregion
1332
- //#region src/conversations.d.ts
1543
+ //#region src/resources/conversations/conversations.d.ts
1333
1544
  type ConversationMessage = ConversationMessageResource;
1334
- type ConversationPage = Page<ConversationMessageResource>;
1545
+ type ConversationPage = Awaited<ReturnType<ConversationsApi["list"]>>;
1335
1546
  declare class ConversationsApi {
1336
1547
  private readonly transport;
1337
1548
  constructor(transport: PocketCoderTransport);
1338
- list(id: string, query?: CursorListQuery, options?: RequestOptions): Promise<Page<{
1339
- message_id: string;
1340
- role: "user" | "assistant" | "system" | "tool";
1341
- content: string;
1342
- occurred_at: string;
1343
- metadata: Record<string, string>;
1344
- seq: number;
1345
- }>>;
1549
+ list(id: string, query?: CursorListQuery, options?: RequestOptions): Promise<{
1550
+ protocol: {
1551
+ schema: "pocketcoder.conversation/v2";
1552
+ request_identity_authorities: ("external" | "generic")[];
1553
+ producer_capabilities: null;
1554
+ } | null;
1555
+ retention: {
1556
+ status: "retained";
1557
+ expires_at: string | null;
1558
+ };
1559
+ items: {
1560
+ message_id: string;
1561
+ role: "user" | "assistant" | "system" | "tool";
1562
+ content: string;
1563
+ occurred_at: string;
1564
+ metadata: Record<string, string>;
1565
+ seq: number;
1566
+ identity: {
1567
+ schema: "pocketcoder.conversation/v2";
1568
+ authority: "external" | "generic";
1569
+ conversation_id: string;
1570
+ request_id: string;
1571
+ turn_id: string;
1572
+ request_fingerprint: string;
1573
+ event_id: string;
1574
+ message_id: string;
1575
+ sequence: number;
1576
+ revision: number;
1577
+ fact?: {
1578
+ type: "intermediate";
1579
+ } | {
1580
+ type: "final_response";
1581
+ } | {
1582
+ type: "tool_only";
1583
+ } | {
1584
+ type: "activity_started";
1585
+ activity_id: string;
1586
+ kind: "tool" | "attachment" | "workspace" | "retrieval";
1587
+ label: string;
1588
+ started_at: string | null;
1589
+ } | {
1590
+ type: "activity_finished";
1591
+ activity_id: string;
1592
+ ended_at: string | null;
1593
+ outcome: "completed" | "failed" | "interrupted" | "canceled";
1594
+ } | {
1595
+ type: "turn_terminal";
1596
+ outcome: "completed" | "failed" | "interrupted" | "canceled" | "lost";
1597
+ } | undefined;
1598
+ } | null;
1599
+ }[];
1600
+ nextCursor: string | null;
1601
+ }>;
1602
+ acceptRequest(id: string, identity: ConversationRequestIdentity, options?: RequestOptions): Promise<{
1603
+ kind: "accepted" | "replayed";
1604
+ identity: {
1605
+ schema: "pocketcoder.conversation/v2";
1606
+ authority: "external" | "generic";
1607
+ conversation_id: string;
1608
+ request_id: string;
1609
+ turn_id: string;
1610
+ request_fingerprint: string;
1611
+ };
1612
+ accepted_at: string;
1613
+ }>;
1346
1614
  }
1347
1615
  //#endregion
1348
- //#region src/diagnostics.d.ts
1616
+ //#region src/resources/diagnostics/diagnostics.d.ts
1349
1617
  declare class WorkspaceCursorApi<T> {
1350
1618
  private readonly transport;
1351
1619
  private readonly resource;
@@ -1366,7 +1634,94 @@ declare class OutputsApi extends WorkspaceCursorApi<OutputResource> {
1366
1634
  constructor(transport: PocketCoderTransport);
1367
1635
  }
1368
1636
  //#endregion
1369
- //#region src/templates.d.ts
1637
+ //#region src/resources/keys/keys.d.ts
1638
+ interface KeyListQuery {
1639
+ limit?: number;
1640
+ cursor?: string;
1641
+ requestId?: string;
1642
+ }
1643
+ declare class KeysApi {
1644
+ private readonly transport;
1645
+ constructor(transport: PocketCoderTransport);
1646
+ list(principalId: string, query?: KeyListQuery, options?: RequestOptions): Promise<{
1647
+ items: {
1648
+ id: string;
1649
+ principal_id: string;
1650
+ scopes: string[];
1651
+ effective_scopes: string[];
1652
+ managed_principal_ids: string[];
1653
+ issuance_request_id: string | null;
1654
+ created_at: string;
1655
+ expires_at: string | null;
1656
+ revoked_at: string | null;
1657
+ last_used_at: string | null;
1658
+ }[];
1659
+ next_cursor: string | null;
1660
+ }>;
1661
+ all(principalId: string, query?: Omit<KeyListQuery, "cursor">, options?: RequestOptions): AsyncGenerator<{
1662
+ id: string;
1663
+ principal_id: string;
1664
+ scopes: string[];
1665
+ effective_scopes: string[];
1666
+ managed_principal_ids: string[];
1667
+ issuance_request_id: string | null;
1668
+ created_at: string;
1669
+ expires_at: string | null;
1670
+ revoked_at: string | null;
1671
+ last_used_at: string | null;
1672
+ }, void, unknown>;
1673
+ issue(principalId: string, input: KeyIssueRequest, options?: RequestOptions): Promise<{
1674
+ key: {
1675
+ id: string;
1676
+ principal_id: string;
1677
+ scopes: string[];
1678
+ effective_scopes: string[];
1679
+ managed_principal_ids: string[];
1680
+ issuance_request_id: string | null;
1681
+ created_at: string;
1682
+ expires_at: string | null;
1683
+ revoked_at: string | null;
1684
+ last_used_at: string | null;
1685
+ };
1686
+ token: string | null;
1687
+ }>;
1688
+ revoke(principalId: string, keyId: string, options?: RequestOptions): Promise<{
1689
+ revoked: true;
1690
+ }>;
1691
+ revokeAll(principalId: string, options?: RequestOptions): Promise<{
1692
+ revoked: true;
1693
+ }>;
1694
+ }
1695
+ declare class RecoveryApi {
1696
+ private readonly transport;
1697
+ constructor(transport: PocketCoderTransport);
1698
+ purge(principalId: string, workspaceId: string, executionKey: string, options?: RequestOptions): Promise<{
1699
+ id: string;
1700
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1701
+ state: "failed" | "succeeded" | "running" | "pending";
1702
+ workspace_id: string | null;
1703
+ checkpoint_id: string | null;
1704
+ result_workspace_id: string | null;
1705
+ reason_code: string | null;
1706
+ created_at: string;
1707
+ updated_at: string;
1708
+ completed_at: string | null;
1709
+ }>;
1710
+ operation(principalId: string, operationId: string, options?: RequestOptions): Promise<{
1711
+ id: string;
1712
+ kind: "preserve" | "restore" | "verify" | "delete" | "purge";
1713
+ state: "failed" | "succeeded" | "running" | "pending";
1714
+ workspace_id: string | null;
1715
+ checkpoint_id: string | null;
1716
+ result_workspace_id: string | null;
1717
+ reason_code: string | null;
1718
+ created_at: string;
1719
+ updated_at: string;
1720
+ completed_at: string | null;
1721
+ }>;
1722
+ }
1723
+ //#endregion
1724
+ //#region src/resources/templates/templates.d.ts
1370
1725
  type TemplateSummary = TemplateListItem;
1371
1726
  declare class TemplatesApi {
1372
1727
  private readonly transport;
@@ -1387,7 +1742,7 @@ declare class TemplatesApi {
1387
1742
  }[]>;
1388
1743
  }
1389
1744
  //#endregion
1390
- //#region src/terminals.d.ts
1745
+ //#region src/resources/terminals/terminals.d.ts
1391
1746
  interface TerminalConnectOptions {
1392
1747
  sessionId?: string;
1393
1748
  }
@@ -1439,42 +1794,13 @@ declare class PocketCoderClient {
1439
1794
  readonly outputs: OutputsApi;
1440
1795
  readonly administration: AdministrationApi;
1441
1796
  readonly terminals: TerminalsApi;
1797
+ readonly keys: KeysApi;
1798
+ readonly recovery: RecoveryApi;
1442
1799
  constructor(config: PocketCoderClientConfig, fetchImpl?: typeof fetch);
1443
1800
  raw(path: string, init?: RequestInit): Promise<Response>;
1444
1801
  }
1445
1802
  //#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
1803
+ //#region src/resources/workspaces/workspace-turn-resolver.d.ts
1478
1804
  type WorkspaceTurnResolutionErrorCode = "not_resumable" | "resume_handler_missing" | "resume_failed" | "invalid_resumed_workspace" | "readiness_failed";
1479
1805
  declare class WorkspaceTurnResolutionError extends Error {
1480
1806
  readonly code: WorkspaceTurnResolutionErrorCode;
@@ -1511,4 +1837,35 @@ declare class WorkspaceTurnResolver {
1511
1837
  private assertLineage;
1512
1838
  }
1513
1839
  //#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 };
1840
+ //#region src/transport/errors.d.ts
1841
+ declare const ClientErrorCodeSchema: z.ZodEnum<{
1842
+ "client.invalid_response": "client.invalid_response";
1843
+ "client.non_json_response": "client.non_json_response";
1844
+ }>;
1845
+ type ClientErrorCode = z.infer<typeof ClientErrorCodeSchema>;
1846
+ declare class PocketCoderError extends Error {
1847
+ readonly code: ErrorCode | ClientErrorCode;
1848
+ readonly status: number;
1849
+ readonly requestId: string | undefined;
1850
+ readonly details: Record<string, unknown> | undefined;
1851
+ constructor(input: {
1852
+ message: string;
1853
+ code: ErrorCode | ClientErrorCode;
1854
+ status: number;
1855
+ requestId?: string;
1856
+ details?: Record<string, unknown>;
1857
+ });
1858
+ }
1859
+ declare class ConversationGoneError extends PocketCoderError {}
1860
+ declare class WorkspaceTerminalError extends Error {
1861
+ readonly workspace: WorkspaceResource;
1862
+ constructor(workspace: WorkspaceResource);
1863
+ }
1864
+ declare class AgentNotReadyError extends Error {
1865
+ readonly workspaceId: string;
1866
+ readonly agentState: AgentState;
1867
+ constructor(workspaceId: string, agentState: AgentState, timeoutMs: number);
1868
+ }
1869
+ declare function isPocketCoderErrorCode(value: unknown): value is ErrorCode;
1870
+ //#endregion
1871
+ export { AdministrationApi, AgentApi, type AgentMessageInput, AgentNotReadyError, type AttachmentDescriptor, type AttachmentUploadInput, AttachmentsApi, type CheckpointResource, type CheckpointState, CheckpointsApi, type ClientErrorCode, ConversationGoneError, type ConversationMessage, type ConversationMessageIdentity, type ConversationPage, type ConversationRequestIdentity, 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 };