@pstdio/pocketcoder-sdk 0.3.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.
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/index.d.ts +1417 -0
- package/dist/index.js +2335 -0
- package/package.json +51 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1417 @@
|
|
|
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
|
|
12
|
+
declare const AttachmentDescriptorSchema: z.ZodObject<{
|
|
13
|
+
id: z.ZodUUID;
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
path: z.ZodString;
|
|
16
|
+
media_type: z.ZodString;
|
|
17
|
+
size_bytes: z.ZodNumber;
|
|
18
|
+
sha256: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
type AttachmentDescriptor = z.infer<typeof AttachmentDescriptorSchema>;
|
|
21
|
+
declare function splitAttachmentManifest(content: string): {
|
|
22
|
+
text: string;
|
|
23
|
+
attachments: AttachmentDescriptor[] | null;
|
|
24
|
+
};
|
|
25
|
+
//#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;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
type ConversationMessageResource = z.infer<typeof ConversationMessageResourceSchema>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region ../contracts/src/errors.d.ts
|
|
43
|
+
declare const ERROR_CODES: {
|
|
44
|
+
readonly "auth.invalid_key": 401;
|
|
45
|
+
readonly "auth.missing_scope": 403;
|
|
46
|
+
readonly "auth.disabled_principal": 403;
|
|
47
|
+
readonly "validation.invalid": 400;
|
|
48
|
+
readonly "idempotency.conflict": 409;
|
|
49
|
+
readonly "capacity.queue_full": 429;
|
|
50
|
+
readonly "capacity.waiters_full": 429;
|
|
51
|
+
readonly "template.not_found": 404;
|
|
52
|
+
readonly "template.version_not_found": 404;
|
|
53
|
+
readonly "template.not_authorized": 403;
|
|
54
|
+
readonly "workspace.not_found": 404;
|
|
55
|
+
readonly "workspace.external_id_conflict": 409;
|
|
56
|
+
readonly "workspace.not_ready": 409;
|
|
57
|
+
readonly "workspace.terminal": 410;
|
|
58
|
+
readonly "workspace.disconnected": 503;
|
|
59
|
+
readonly "terminal.not_declared": 422;
|
|
60
|
+
readonly "terminal.session_limit": 409;
|
|
61
|
+
readonly "terminal.session_not_found": 404;
|
|
62
|
+
readonly "terminal.session_closed": 409;
|
|
63
|
+
readonly "terminal.protocol_unsupported": 426;
|
|
64
|
+
readonly "workspace.persistence_not_enabled": 409;
|
|
65
|
+
readonly "workspace.preserving": 409;
|
|
66
|
+
readonly "checkpoint.not_found": 404;
|
|
67
|
+
readonly "checkpoint.not_ready": 409;
|
|
68
|
+
readonly "checkpoint.none_ready": 409;
|
|
69
|
+
readonly "checkpoint.corrupt": 409;
|
|
70
|
+
readonly "checkpoint.quota_exceeded": 413;
|
|
71
|
+
readonly "checkpoint.in_use": 409;
|
|
72
|
+
readonly "restore.template_not_authorized": 403;
|
|
73
|
+
readonly "restore.image_unavailable": 409;
|
|
74
|
+
readonly "restore.incompatible": 409;
|
|
75
|
+
readonly "resume.unsupported": 409;
|
|
76
|
+
readonly "conversation.expired": 410;
|
|
77
|
+
readonly "conversation.deleted": 410;
|
|
78
|
+
readonly "operation.conflict": 409;
|
|
79
|
+
readonly "source.not_allowed": 422;
|
|
80
|
+
readonly "source.invalid_revision": 422;
|
|
81
|
+
readonly "secret.unavailable": 503;
|
|
82
|
+
readonly "storage.capacity_exhausted": 507;
|
|
83
|
+
readonly "relay.body_too_large": 413;
|
|
84
|
+
readonly "relay.route_not_allowed": 422;
|
|
85
|
+
readonly "relay.streaming_unsupported": 409;
|
|
86
|
+
readonly "relay.deadline_exceeded": 504;
|
|
87
|
+
readonly "relay.upstream_error": 502;
|
|
88
|
+
readonly "attachment.invalid": 400;
|
|
89
|
+
readonly "attachment.too_large": 413;
|
|
90
|
+
readonly "attachment.not_found": 404;
|
|
91
|
+
readonly "attachment.conflict": 409;
|
|
92
|
+
readonly "attachment.unsupported": 409;
|
|
93
|
+
readonly "attachment.interrupted": 503;
|
|
94
|
+
readonly "internal.error": 500;
|
|
95
|
+
};
|
|
96
|
+
type ErrorCode = keyof typeof ERROR_CODES;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../contracts/src/workspace.d.ts
|
|
99
|
+
declare const WORKSPACE_STATES: readonly ["queued", "provisioning", "connected", "ready", "preserving", "terminating", "succeeded", "failed", "canceled", "expired", "preserved"];
|
|
100
|
+
type WorkspaceState = (typeof WORKSPACE_STATES)[number];
|
|
101
|
+
declare const WorkspaceCreateRequestSchema: z.ZodObject<{
|
|
102
|
+
external_id: z.ZodString;
|
|
103
|
+
template: z.ZodObject<{
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
version: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
launch_input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
108
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
kind: z.ZodLiteral<"git">;
|
|
110
|
+
repository: z.ZodString;
|
|
111
|
+
revision: z.ZodString;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
type WorkspaceCreateRequest = z.infer<typeof WorkspaceCreateRequestSchema>;
|
|
116
|
+
declare const WorkspaceResourceSchema: z.ZodObject<{
|
|
117
|
+
id: z.ZodUUID;
|
|
118
|
+
external_id: z.ZodString;
|
|
119
|
+
template: z.ZodObject<{
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
version: z.ZodString;
|
|
122
|
+
digest: z.ZodString;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
state: z.ZodEnum<{
|
|
125
|
+
queued: "queued";
|
|
126
|
+
provisioning: "provisioning";
|
|
127
|
+
connected: "connected";
|
|
128
|
+
ready: "ready";
|
|
129
|
+
preserving: "preserving";
|
|
130
|
+
terminating: "terminating";
|
|
131
|
+
succeeded: "succeeded";
|
|
132
|
+
failed: "failed";
|
|
133
|
+
canceled: "canceled";
|
|
134
|
+
expired: "expired";
|
|
135
|
+
preserved: "preserved";
|
|
136
|
+
}>;
|
|
137
|
+
reason_code: z.ZodNullable<z.ZodEnum<{
|
|
138
|
+
child_exit_success: "child_exit_success";
|
|
139
|
+
child_exit_failure: "child_exit_failure";
|
|
140
|
+
setup_failed: "setup_failed";
|
|
141
|
+
bootstrap_failed: "bootstrap_failed";
|
|
142
|
+
registration_timeout: "registration_timeout";
|
|
143
|
+
health_failed: "health_failed";
|
|
144
|
+
child_crash: "child_crash";
|
|
145
|
+
provider_lost: "provider_lost";
|
|
146
|
+
disconnect_timeout: "disconnect_timeout";
|
|
147
|
+
canceled_by_caller: "canceled_by_caller";
|
|
148
|
+
deadline_expired: "deadline_expired";
|
|
149
|
+
idle_expired: "idle_expired";
|
|
150
|
+
queue_timeout: "queue_timeout";
|
|
151
|
+
launch_failed: "launch_failed";
|
|
152
|
+
preserve_requested: "preserve_requested";
|
|
153
|
+
preserved_by_policy: "preserved_by_policy";
|
|
154
|
+
checkpoint_created: "checkpoint_created";
|
|
155
|
+
checkpoint_failed: "checkpoint_failed";
|
|
156
|
+
checkpoint_corrupt: "checkpoint_corrupt";
|
|
157
|
+
checkpoint_quota_exceeded: "checkpoint_quota_exceeded";
|
|
158
|
+
checkpoint_storage_lost: "checkpoint_storage_lost";
|
|
159
|
+
restore_requested: "restore_requested";
|
|
160
|
+
restore_failed: "restore_failed";
|
|
161
|
+
image_unavailable: "image_unavailable";
|
|
162
|
+
source_resolution_failed: "source_resolution_failed";
|
|
163
|
+
secret_resolution_failed: "secret_resolution_failed";
|
|
164
|
+
operation_conflict: "operation_conflict";
|
|
165
|
+
network_policy_failed: "network_policy_failed";
|
|
166
|
+
}>>;
|
|
167
|
+
agent_state: z.ZodEnum<{
|
|
168
|
+
unknown: "unknown";
|
|
169
|
+
running: "running";
|
|
170
|
+
stable: "stable";
|
|
171
|
+
}>;
|
|
172
|
+
change_cursor: z.ZodNumber;
|
|
173
|
+
provider_kind: z.ZodNullable<z.ZodString>;
|
|
174
|
+
provisioning_mode: z.ZodNullable<z.ZodEnum<{
|
|
175
|
+
cold: "cold";
|
|
176
|
+
warm: "warm";
|
|
177
|
+
}>>;
|
|
178
|
+
network: z.ZodObject<{
|
|
179
|
+
state: z.ZodEnum<{
|
|
180
|
+
ready: "ready";
|
|
181
|
+
disabled: "disabled";
|
|
182
|
+
starting: "starting";
|
|
183
|
+
degraded: "degraded";
|
|
184
|
+
}>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
health: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
187
|
+
created_at: z.ZodISODateTime;
|
|
188
|
+
updated_at: z.ZodISODateTime;
|
|
189
|
+
connected_at: z.ZodNullable<z.ZodISODateTime>;
|
|
190
|
+
ready_at: z.ZodNullable<z.ZodISODateTime>;
|
|
191
|
+
deadline_at: z.ZodISODateTime;
|
|
192
|
+
terminal_at: z.ZodNullable<z.ZodISODateTime>;
|
|
193
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
194
|
+
origin_workspace_id: z.ZodNullable<z.ZodUUID>;
|
|
195
|
+
restored_from_checkpoint_id: z.ZodNullable<z.ZodUUID>;
|
|
196
|
+
source: z.ZodNullable<z.ZodObject<{
|
|
197
|
+
kind: z.ZodLiteral<"git">;
|
|
198
|
+
repository: z.ZodString;
|
|
199
|
+
requested_revision: z.ZodString;
|
|
200
|
+
resolved_commit: z.ZodNullable<z.ZodString>;
|
|
201
|
+
}, z.core.$strip>>;
|
|
202
|
+
persistence: z.ZodObject<{
|
|
203
|
+
enabled: z.ZodBoolean;
|
|
204
|
+
conversation_restore: z.ZodEnum<{
|
|
205
|
+
unknown: "unknown";
|
|
206
|
+
supported: "supported";
|
|
207
|
+
filesystem_only: "filesystem_only";
|
|
208
|
+
}>;
|
|
209
|
+
conversation_resume: z.ZodObject<{
|
|
210
|
+
status: z.ZodEnum<{
|
|
211
|
+
unknown: "unknown";
|
|
212
|
+
supported: "supported";
|
|
213
|
+
unsupported: "unsupported";
|
|
214
|
+
}>;
|
|
215
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
216
|
+
filesystem_only: "filesystem_only";
|
|
217
|
+
capability_unknown: "capability_unknown";
|
|
218
|
+
}>>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
latest_checkpoint_id: z.ZodNullable<z.ZodUUID>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
outputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
223
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
224
|
+
reason_code: z.ZodEnum<{
|
|
225
|
+
child_exit_success: "child_exit_success";
|
|
226
|
+
child_exit_failure: "child_exit_failure";
|
|
227
|
+
setup_failed: "setup_failed";
|
|
228
|
+
bootstrap_failed: "bootstrap_failed";
|
|
229
|
+
registration_timeout: "registration_timeout";
|
|
230
|
+
health_failed: "health_failed";
|
|
231
|
+
child_crash: "child_crash";
|
|
232
|
+
provider_lost: "provider_lost";
|
|
233
|
+
disconnect_timeout: "disconnect_timeout";
|
|
234
|
+
canceled_by_caller: "canceled_by_caller";
|
|
235
|
+
deadline_expired: "deadline_expired";
|
|
236
|
+
idle_expired: "idle_expired";
|
|
237
|
+
queue_timeout: "queue_timeout";
|
|
238
|
+
launch_failed: "launch_failed";
|
|
239
|
+
preserve_requested: "preserve_requested";
|
|
240
|
+
preserved_by_policy: "preserved_by_policy";
|
|
241
|
+
checkpoint_created: "checkpoint_created";
|
|
242
|
+
checkpoint_failed: "checkpoint_failed";
|
|
243
|
+
checkpoint_corrupt: "checkpoint_corrupt";
|
|
244
|
+
checkpoint_quota_exceeded: "checkpoint_quota_exceeded";
|
|
245
|
+
checkpoint_storage_lost: "checkpoint_storage_lost";
|
|
246
|
+
restore_requested: "restore_requested";
|
|
247
|
+
restore_failed: "restore_failed";
|
|
248
|
+
image_unavailable: "image_unavailable";
|
|
249
|
+
source_resolution_failed: "source_resolution_failed";
|
|
250
|
+
secret_resolution_failed: "secret_resolution_failed";
|
|
251
|
+
operation_conflict: "operation_conflict";
|
|
252
|
+
network_policy_failed: "network_policy_failed";
|
|
253
|
+
}>;
|
|
254
|
+
log_tail: z.ZodString;
|
|
255
|
+
log_tail_truncated: z.ZodBoolean;
|
|
256
|
+
last_log_seq: z.ZodNullable<z.ZodNumber>;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
}, z.core.$strip>;
|
|
259
|
+
type WorkspaceResource = z.infer<typeof WorkspaceResourceSchema>;
|
|
260
|
+
declare const TemplateListItemSchema: z.ZodObject<{
|
|
261
|
+
name: z.ZodString;
|
|
262
|
+
version: z.ZodString;
|
|
263
|
+
digest: z.ZodString;
|
|
264
|
+
description: z.ZodOptional<z.ZodString>;
|
|
265
|
+
status: z.ZodEnum<{
|
|
266
|
+
active: "active";
|
|
267
|
+
available: "available";
|
|
268
|
+
retired: "retired";
|
|
269
|
+
}>;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
type TemplateListItem = z.infer<typeof TemplateListItemSchema>;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region ../contracts/src/logs.d.ts
|
|
274
|
+
declare const LogChunkSchema: z.ZodObject<{
|
|
275
|
+
seq: z.ZodNumber;
|
|
276
|
+
stream: z.ZodString;
|
|
277
|
+
occurred_at: z.ZodISODateTime;
|
|
278
|
+
content: z.ZodString;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
type LogChunk = z.infer<typeof LogChunkSchema>;
|
|
281
|
+
//#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
|
|
383
|
+
declare const ServerTerminalMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
384
|
+
type: z.ZodLiteral<"opened">;
|
|
385
|
+
session_id: z.ZodUUID;
|
|
386
|
+
replay_b64: z.ZodOptional<z.ZodString>;
|
|
387
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
388
|
+
type: z.ZodLiteral<"output">;
|
|
389
|
+
data_b64: z.ZodString;
|
|
390
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
391
|
+
type: z.ZodLiteral<"closed">;
|
|
392
|
+
reason: z.ZodEnum<{
|
|
393
|
+
checkpoint: "checkpoint";
|
|
394
|
+
workspace_ended: "workspace_ended";
|
|
395
|
+
exit: "exit";
|
|
396
|
+
idle: "idle";
|
|
397
|
+
agent_detached: "agent_detached";
|
|
398
|
+
}>;
|
|
399
|
+
exit_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
400
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
401
|
+
type: z.ZodLiteral<"status">;
|
|
402
|
+
state: z.ZodEnum<{
|
|
403
|
+
reconnecting: "reconnecting";
|
|
404
|
+
resumed: "resumed";
|
|
405
|
+
}>;
|
|
406
|
+
}, z.core.$strip>], "type">;
|
|
407
|
+
declare const TerminalSessionSchema: z.ZodObject<{
|
|
408
|
+
session_id: z.ZodUUID;
|
|
409
|
+
workspace_id: z.ZodUUID;
|
|
410
|
+
key_id: z.ZodUUID;
|
|
411
|
+
opened_at: z.ZodISODateTime;
|
|
412
|
+
closed_at: z.ZodNullable<z.ZodISODateTime>;
|
|
413
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
414
|
+
close_reason: z.ZodNullable<z.ZodEnum<{
|
|
415
|
+
checkpoint: "checkpoint";
|
|
416
|
+
workspace_ended: "workspace_ended";
|
|
417
|
+
exit: "exit";
|
|
418
|
+
idle: "idle";
|
|
419
|
+
agent_detached: "agent_detached";
|
|
420
|
+
client_closed: "client_closed";
|
|
421
|
+
}>>;
|
|
422
|
+
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
423
|
+
bytes_in: z.ZodNumber;
|
|
424
|
+
bytes_out: z.ZodNumber;
|
|
425
|
+
}, z.core.$strip>;
|
|
426
|
+
type ServerTerminalMessage = z.infer<typeof ServerTerminalMessageSchema>;
|
|
427
|
+
type TerminalSession = z.infer<typeof TerminalSessionSchema>;
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/transport.d.ts
|
|
430
|
+
type FetchLike = typeof fetch;
|
|
431
|
+
type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocket;
|
|
432
|
+
interface PocketCoderClientConfig {
|
|
433
|
+
baseUrl: string;
|
|
434
|
+
apiKey: string;
|
|
435
|
+
timeoutMs?: number;
|
|
436
|
+
maxRetries?: number;
|
|
437
|
+
fetch?: FetchLike;
|
|
438
|
+
webSocket?: WebSocketFactory;
|
|
439
|
+
}
|
|
440
|
+
interface RequestOptions {
|
|
441
|
+
signal?: AbortSignal;
|
|
442
|
+
}
|
|
443
|
+
declare class PocketCoderTransport {
|
|
444
|
+
private readonly baseUrl;
|
|
445
|
+
private readonly apiKey;
|
|
446
|
+
private readonly timeoutMs;
|
|
447
|
+
private readonly maxRetries;
|
|
448
|
+
private readonly fetchImpl;
|
|
449
|
+
private readonly webSocketFactory;
|
|
450
|
+
constructor(config: PocketCoderClientConfig, fetchImpl?: FetchLike);
|
|
451
|
+
webSocket(path: string): WebSocket;
|
|
452
|
+
raw(path: string, init?: RequestInit): Promise<Response>;
|
|
453
|
+
request<T>(path: string, schema: z.ZodType<T>, init?: RequestInit): Promise<T>;
|
|
454
|
+
}
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/admin.d.ts
|
|
457
|
+
declare class AdministrationApi {
|
|
458
|
+
private readonly transport;
|
|
459
|
+
constructor(transport: PocketCoderTransport);
|
|
460
|
+
warmPools(options?: RequestOptions): Promise<{
|
|
461
|
+
items: {
|
|
462
|
+
template: string;
|
|
463
|
+
version: string;
|
|
464
|
+
template_digest: string;
|
|
465
|
+
driver: string;
|
|
466
|
+
desired: number;
|
|
467
|
+
counts: Record<string, number>;
|
|
468
|
+
oldest_ready_age_ms: number | null;
|
|
469
|
+
}[];
|
|
470
|
+
metrics: Record<string, number>;
|
|
471
|
+
}>;
|
|
472
|
+
storageInventory(options?: RequestOptions): Promise<{
|
|
473
|
+
backend: string;
|
|
474
|
+
storage_count: number;
|
|
475
|
+
checkpoint_count: number;
|
|
476
|
+
unknown_storage: string[];
|
|
477
|
+
unknown_checkpoints: string[];
|
|
478
|
+
}>;
|
|
479
|
+
pruneStorage(options?: RequestOptions): Promise<{
|
|
480
|
+
deleted: number;
|
|
481
|
+
skipped: number;
|
|
482
|
+
transcripts_deleted: number;
|
|
483
|
+
}>;
|
|
484
|
+
}
|
|
485
|
+
//#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: "creating" | "ready" | "failed" | "deleting" | "deleted";
|
|
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: "creating" | "ready" | "failed" | "deleting" | "deleted";
|
|
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
|
|
774
|
+
interface WorkspaceCreateInput {
|
|
775
|
+
externalId: string;
|
|
776
|
+
templateName: string;
|
|
777
|
+
templateVersion?: string;
|
|
778
|
+
idempotencyKey?: string;
|
|
779
|
+
launchInput?: WorkspaceCreateRequest["launch_input"];
|
|
780
|
+
metadata?: WorkspaceCreateRequest["metadata"];
|
|
781
|
+
source?: WorkspaceCreateRequest["source"];
|
|
782
|
+
}
|
|
783
|
+
interface WorkspaceListQuery {
|
|
784
|
+
state?: WorkspaceState;
|
|
785
|
+
template?: string;
|
|
786
|
+
externalId?: string;
|
|
787
|
+
limit?: number;
|
|
788
|
+
cursor?: string;
|
|
789
|
+
}
|
|
790
|
+
type WorkspaceSummary = WorkspaceResource;
|
|
791
|
+
declare const TERMINAL_WORKSPACE_STATES: ReadonlySet<WorkspaceState>;
|
|
792
|
+
declare class WorkspacesApi {
|
|
793
|
+
private readonly transport;
|
|
794
|
+
constructor(transport: PocketCoderTransport);
|
|
795
|
+
list(query?: WorkspaceListQuery, options?: RequestOptions): Promise<Page<{
|
|
796
|
+
id: string;
|
|
797
|
+
external_id: string;
|
|
798
|
+
template: {
|
|
799
|
+
name: string;
|
|
800
|
+
version: string;
|
|
801
|
+
digest: string;
|
|
802
|
+
};
|
|
803
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
804
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
806
|
+
change_cursor: number;
|
|
807
|
+
provider_kind: string | null;
|
|
808
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
809
|
+
network: {
|
|
810
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
811
|
+
};
|
|
812
|
+
health: Record<string, string>;
|
|
813
|
+
created_at: string;
|
|
814
|
+
updated_at: string;
|
|
815
|
+
connected_at: string | null;
|
|
816
|
+
ready_at: string | null;
|
|
817
|
+
deadline_at: string;
|
|
818
|
+
terminal_at: string | null;
|
|
819
|
+
metadata: Record<string, string>;
|
|
820
|
+
origin_workspace_id: string | null;
|
|
821
|
+
restored_from_checkpoint_id: string | null;
|
|
822
|
+
source: {
|
|
823
|
+
kind: "git";
|
|
824
|
+
repository: string;
|
|
825
|
+
requested_revision: string;
|
|
826
|
+
resolved_commit: string | null;
|
|
827
|
+
} | null;
|
|
828
|
+
persistence: {
|
|
829
|
+
enabled: boolean;
|
|
830
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
831
|
+
conversation_resume: {
|
|
832
|
+
status: "unknown" | "supported" | "unsupported";
|
|
833
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
834
|
+
};
|
|
835
|
+
latest_checkpoint_id: string | null;
|
|
836
|
+
};
|
|
837
|
+
outputs: Record<string, unknown>;
|
|
838
|
+
failure: {
|
|
839
|
+
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";
|
|
840
|
+
log_tail: string;
|
|
841
|
+
log_tail_truncated: boolean;
|
|
842
|
+
last_log_seq: number | null;
|
|
843
|
+
} | null;
|
|
844
|
+
}>>;
|
|
845
|
+
all(query?: Omit<WorkspaceListQuery, "cursor">, options?: RequestOptions): AsyncGenerator<{
|
|
846
|
+
id: string;
|
|
847
|
+
external_id: string;
|
|
848
|
+
template: {
|
|
849
|
+
name: string;
|
|
850
|
+
version: string;
|
|
851
|
+
digest: string;
|
|
852
|
+
};
|
|
853
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
854
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
856
|
+
change_cursor: number;
|
|
857
|
+
provider_kind: string | null;
|
|
858
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
859
|
+
network: {
|
|
860
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
861
|
+
};
|
|
862
|
+
health: Record<string, string>;
|
|
863
|
+
created_at: string;
|
|
864
|
+
updated_at: string;
|
|
865
|
+
connected_at: string | null;
|
|
866
|
+
ready_at: string | null;
|
|
867
|
+
deadline_at: string;
|
|
868
|
+
terminal_at: string | null;
|
|
869
|
+
metadata: Record<string, string>;
|
|
870
|
+
origin_workspace_id: string | null;
|
|
871
|
+
restored_from_checkpoint_id: string | null;
|
|
872
|
+
source: {
|
|
873
|
+
kind: "git";
|
|
874
|
+
repository: string;
|
|
875
|
+
requested_revision: string;
|
|
876
|
+
resolved_commit: string | null;
|
|
877
|
+
} | null;
|
|
878
|
+
persistence: {
|
|
879
|
+
enabled: boolean;
|
|
880
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
881
|
+
conversation_resume: {
|
|
882
|
+
status: "unknown" | "supported" | "unsupported";
|
|
883
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
884
|
+
};
|
|
885
|
+
latest_checkpoint_id: string | null;
|
|
886
|
+
};
|
|
887
|
+
outputs: Record<string, unknown>;
|
|
888
|
+
failure: {
|
|
889
|
+
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";
|
|
890
|
+
log_tail: string;
|
|
891
|
+
log_tail_truncated: boolean;
|
|
892
|
+
last_log_seq: number | null;
|
|
893
|
+
} | null;
|
|
894
|
+
}, void, unknown>;
|
|
895
|
+
get(id: string, options?: RequestOptions): Promise<{
|
|
896
|
+
id: string;
|
|
897
|
+
external_id: string;
|
|
898
|
+
template: {
|
|
899
|
+
name: string;
|
|
900
|
+
version: string;
|
|
901
|
+
digest: string;
|
|
902
|
+
};
|
|
903
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "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
|
+
create(input: WorkspaceCreateInput, options?: RequestOptions): Promise<{
|
|
946
|
+
id: string;
|
|
947
|
+
external_id: string;
|
|
948
|
+
template: {
|
|
949
|
+
name: string;
|
|
950
|
+
version: string;
|
|
951
|
+
digest: string;
|
|
952
|
+
};
|
|
953
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
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;
|
|
955
|
+
agent_state: "unknown" | "running" | "stable";
|
|
956
|
+
change_cursor: number;
|
|
957
|
+
provider_kind: string | null;
|
|
958
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
959
|
+
network: {
|
|
960
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
961
|
+
};
|
|
962
|
+
health: Record<string, string>;
|
|
963
|
+
created_at: string;
|
|
964
|
+
updated_at: string;
|
|
965
|
+
connected_at: string | null;
|
|
966
|
+
ready_at: string | null;
|
|
967
|
+
deadline_at: string;
|
|
968
|
+
terminal_at: string | null;
|
|
969
|
+
metadata: Record<string, string>;
|
|
970
|
+
origin_workspace_id: string | null;
|
|
971
|
+
restored_from_checkpoint_id: string | null;
|
|
972
|
+
source: {
|
|
973
|
+
kind: "git";
|
|
974
|
+
repository: string;
|
|
975
|
+
requested_revision: string;
|
|
976
|
+
resolved_commit: string | null;
|
|
977
|
+
} | null;
|
|
978
|
+
persistence: {
|
|
979
|
+
enabled: boolean;
|
|
980
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
981
|
+
conversation_resume: {
|
|
982
|
+
status: "unknown" | "supported" | "unsupported";
|
|
983
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
984
|
+
};
|
|
985
|
+
latest_checkpoint_id: string | null;
|
|
986
|
+
};
|
|
987
|
+
outputs: Record<string, unknown>;
|
|
988
|
+
failure: {
|
|
989
|
+
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";
|
|
990
|
+
log_tail: string;
|
|
991
|
+
log_tail_truncated: boolean;
|
|
992
|
+
last_log_seq: number | null;
|
|
993
|
+
} | null;
|
|
994
|
+
}>;
|
|
995
|
+
cancel(id: string, options?: RequestOptions): Promise<{
|
|
996
|
+
id: string;
|
|
997
|
+
external_id: string;
|
|
998
|
+
template: {
|
|
999
|
+
name: string;
|
|
1000
|
+
version: string;
|
|
1001
|
+
digest: string;
|
|
1002
|
+
};
|
|
1003
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
1004
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
1006
|
+
change_cursor: number;
|
|
1007
|
+
provider_kind: string | null;
|
|
1008
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
1009
|
+
network: {
|
|
1010
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
1011
|
+
};
|
|
1012
|
+
health: Record<string, string>;
|
|
1013
|
+
created_at: string;
|
|
1014
|
+
updated_at: string;
|
|
1015
|
+
connected_at: string | null;
|
|
1016
|
+
ready_at: string | null;
|
|
1017
|
+
deadline_at: string;
|
|
1018
|
+
terminal_at: string | null;
|
|
1019
|
+
metadata: Record<string, string>;
|
|
1020
|
+
origin_workspace_id: string | null;
|
|
1021
|
+
restored_from_checkpoint_id: string | null;
|
|
1022
|
+
source: {
|
|
1023
|
+
kind: "git";
|
|
1024
|
+
repository: string;
|
|
1025
|
+
requested_revision: string;
|
|
1026
|
+
resolved_commit: string | null;
|
|
1027
|
+
} | null;
|
|
1028
|
+
persistence: {
|
|
1029
|
+
enabled: boolean;
|
|
1030
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1031
|
+
conversation_resume: {
|
|
1032
|
+
status: "unknown" | "supported" | "unsupported";
|
|
1033
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
1034
|
+
};
|
|
1035
|
+
latest_checkpoint_id: string | null;
|
|
1036
|
+
};
|
|
1037
|
+
outputs: Record<string, unknown>;
|
|
1038
|
+
failure: {
|
|
1039
|
+
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";
|
|
1040
|
+
log_tail: string;
|
|
1041
|
+
log_tail_truncated: boolean;
|
|
1042
|
+
last_log_seq: number | null;
|
|
1043
|
+
} | null;
|
|
1044
|
+
}>;
|
|
1045
|
+
change(id: string, after: number, wait: number, options?: RequestOptions): Promise<{
|
|
1046
|
+
cursor: number;
|
|
1047
|
+
changed: boolean;
|
|
1048
|
+
workspace: {
|
|
1049
|
+
id: string;
|
|
1050
|
+
external_id: string;
|
|
1051
|
+
template: {
|
|
1052
|
+
name: string;
|
|
1053
|
+
version: string;
|
|
1054
|
+
digest: string;
|
|
1055
|
+
};
|
|
1056
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
1057
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
1059
|
+
change_cursor: number;
|
|
1060
|
+
provider_kind: string | null;
|
|
1061
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
1062
|
+
network: {
|
|
1063
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
1064
|
+
};
|
|
1065
|
+
health: Record<string, string>;
|
|
1066
|
+
created_at: string;
|
|
1067
|
+
updated_at: string;
|
|
1068
|
+
connected_at: string | null;
|
|
1069
|
+
ready_at: string | null;
|
|
1070
|
+
deadline_at: string;
|
|
1071
|
+
terminal_at: string | null;
|
|
1072
|
+
metadata: Record<string, string>;
|
|
1073
|
+
origin_workspace_id: string | null;
|
|
1074
|
+
restored_from_checkpoint_id: string | null;
|
|
1075
|
+
source: {
|
|
1076
|
+
kind: "git";
|
|
1077
|
+
repository: string;
|
|
1078
|
+
requested_revision: string;
|
|
1079
|
+
resolved_commit: string | null;
|
|
1080
|
+
} | null;
|
|
1081
|
+
persistence: {
|
|
1082
|
+
enabled: boolean;
|
|
1083
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1084
|
+
conversation_resume: {
|
|
1085
|
+
status: "unknown" | "supported" | "unsupported";
|
|
1086
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
1087
|
+
};
|
|
1088
|
+
latest_checkpoint_id: string | null;
|
|
1089
|
+
};
|
|
1090
|
+
outputs: Record<string, unknown>;
|
|
1091
|
+
failure: {
|
|
1092
|
+
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";
|
|
1093
|
+
log_tail: string;
|
|
1094
|
+
log_tail_truncated: boolean;
|
|
1095
|
+
last_log_seq: number | null;
|
|
1096
|
+
} | null;
|
|
1097
|
+
};
|
|
1098
|
+
}>;
|
|
1099
|
+
waitForReady(initial: WorkspaceResource, timeoutMs: number, options?: RequestOptions & {
|
|
1100
|
+
onTick?: (workspace: WorkspaceResource) => void;
|
|
1101
|
+
}): Promise<{
|
|
1102
|
+
id: string;
|
|
1103
|
+
external_id: string;
|
|
1104
|
+
template: {
|
|
1105
|
+
name: string;
|
|
1106
|
+
version: string;
|
|
1107
|
+
digest: string;
|
|
1108
|
+
};
|
|
1109
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
1110
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
1112
|
+
change_cursor: number;
|
|
1113
|
+
provider_kind: string | null;
|
|
1114
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
1115
|
+
network: {
|
|
1116
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
1117
|
+
};
|
|
1118
|
+
health: Record<string, string>;
|
|
1119
|
+
created_at: string;
|
|
1120
|
+
updated_at: string;
|
|
1121
|
+
connected_at: string | null;
|
|
1122
|
+
ready_at: string | null;
|
|
1123
|
+
deadline_at: string;
|
|
1124
|
+
terminal_at: string | null;
|
|
1125
|
+
metadata: Record<string, string>;
|
|
1126
|
+
origin_workspace_id: string | null;
|
|
1127
|
+
restored_from_checkpoint_id: string | null;
|
|
1128
|
+
source: {
|
|
1129
|
+
kind: "git";
|
|
1130
|
+
repository: string;
|
|
1131
|
+
requested_revision: string;
|
|
1132
|
+
resolved_commit: string | null;
|
|
1133
|
+
} | null;
|
|
1134
|
+
persistence: {
|
|
1135
|
+
enabled: boolean;
|
|
1136
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1137
|
+
conversation_resume: {
|
|
1138
|
+
status: "unknown" | "supported" | "unsupported";
|
|
1139
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
1140
|
+
};
|
|
1141
|
+
latest_checkpoint_id: string | null;
|
|
1142
|
+
};
|
|
1143
|
+
outputs: Record<string, unknown>;
|
|
1144
|
+
failure: {
|
|
1145
|
+
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";
|
|
1146
|
+
log_tail: string;
|
|
1147
|
+
log_tail_truncated: boolean;
|
|
1148
|
+
last_log_seq: number | null;
|
|
1149
|
+
} | null;
|
|
1150
|
+
}>;
|
|
1151
|
+
preserve(id: string, input: PreserveRequest, key: string, options?: RequestOptions): Promise<{
|
|
1152
|
+
workspace: {
|
|
1153
|
+
id: string;
|
|
1154
|
+
external_id: string;
|
|
1155
|
+
template: {
|
|
1156
|
+
name: string;
|
|
1157
|
+
version: string;
|
|
1158
|
+
digest: string;
|
|
1159
|
+
};
|
|
1160
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
1161
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
1163
|
+
change_cursor: number;
|
|
1164
|
+
provider_kind: string | null;
|
|
1165
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
1166
|
+
network: {
|
|
1167
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
1168
|
+
};
|
|
1169
|
+
health: Record<string, string>;
|
|
1170
|
+
created_at: string;
|
|
1171
|
+
updated_at: string;
|
|
1172
|
+
connected_at: string | null;
|
|
1173
|
+
ready_at: string | null;
|
|
1174
|
+
deadline_at: string;
|
|
1175
|
+
terminal_at: string | null;
|
|
1176
|
+
metadata: Record<string, string>;
|
|
1177
|
+
origin_workspace_id: string | null;
|
|
1178
|
+
restored_from_checkpoint_id: string | null;
|
|
1179
|
+
source: {
|
|
1180
|
+
kind: "git";
|
|
1181
|
+
repository: string;
|
|
1182
|
+
requested_revision: string;
|
|
1183
|
+
resolved_commit: string | null;
|
|
1184
|
+
} | null;
|
|
1185
|
+
persistence: {
|
|
1186
|
+
enabled: boolean;
|
|
1187
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1188
|
+
conversation_resume: {
|
|
1189
|
+
status: "unknown" | "supported" | "unsupported";
|
|
1190
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
1191
|
+
};
|
|
1192
|
+
latest_checkpoint_id: string | null;
|
|
1193
|
+
};
|
|
1194
|
+
outputs: Record<string, unknown>;
|
|
1195
|
+
failure: {
|
|
1196
|
+
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";
|
|
1197
|
+
log_tail: string;
|
|
1198
|
+
log_tail_truncated: boolean;
|
|
1199
|
+
last_log_seq: number | null;
|
|
1200
|
+
} | null;
|
|
1201
|
+
};
|
|
1202
|
+
checkpoint: {
|
|
1203
|
+
id: string;
|
|
1204
|
+
workspace_id: string;
|
|
1205
|
+
state: "creating" | "ready" | "failed" | "deleting" | "deleted";
|
|
1206
|
+
reason_code: string | null;
|
|
1207
|
+
template: {
|
|
1208
|
+
name: string;
|
|
1209
|
+
version: string;
|
|
1210
|
+
digest: string;
|
|
1211
|
+
};
|
|
1212
|
+
manifest_digest: string | null;
|
|
1213
|
+
logical_bytes: number | null;
|
|
1214
|
+
stored_bytes: number | null;
|
|
1215
|
+
file_count: number | null;
|
|
1216
|
+
mounts: string[];
|
|
1217
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1218
|
+
label: string | null;
|
|
1219
|
+
created_at: string;
|
|
1220
|
+
ready_at: string | null;
|
|
1221
|
+
expires_at: string | null;
|
|
1222
|
+
};
|
|
1223
|
+
operation: {
|
|
1224
|
+
id: string;
|
|
1225
|
+
kind: "preserve" | "restore" | "verify" | "delete";
|
|
1226
|
+
state: "failed" | "pending" | "running" | "succeeded";
|
|
1227
|
+
workspace_id: string | null;
|
|
1228
|
+
checkpoint_id: string | null;
|
|
1229
|
+
result_workspace_id: string | null;
|
|
1230
|
+
reason_code: string | null;
|
|
1231
|
+
created_at: string;
|
|
1232
|
+
updated_at: string;
|
|
1233
|
+
completed_at: string | null;
|
|
1234
|
+
};
|
|
1235
|
+
}>;
|
|
1236
|
+
recreate(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
|
|
1237
|
+
workspace: {
|
|
1238
|
+
id: string;
|
|
1239
|
+
external_id: string;
|
|
1240
|
+
template: {
|
|
1241
|
+
name: string;
|
|
1242
|
+
version: string;
|
|
1243
|
+
digest: string;
|
|
1244
|
+
};
|
|
1245
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
1246
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
1248
|
+
change_cursor: number;
|
|
1249
|
+
provider_kind: string | null;
|
|
1250
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
1251
|
+
network: {
|
|
1252
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
1253
|
+
};
|
|
1254
|
+
health: Record<string, string>;
|
|
1255
|
+
created_at: string;
|
|
1256
|
+
updated_at: string;
|
|
1257
|
+
connected_at: string | null;
|
|
1258
|
+
ready_at: string | null;
|
|
1259
|
+
deadline_at: string;
|
|
1260
|
+
terminal_at: string | null;
|
|
1261
|
+
metadata: Record<string, string>;
|
|
1262
|
+
origin_workspace_id: string | null;
|
|
1263
|
+
restored_from_checkpoint_id: string | null;
|
|
1264
|
+
source: {
|
|
1265
|
+
kind: "git";
|
|
1266
|
+
repository: string;
|
|
1267
|
+
requested_revision: string;
|
|
1268
|
+
resolved_commit: string | null;
|
|
1269
|
+
} | null;
|
|
1270
|
+
persistence: {
|
|
1271
|
+
enabled: boolean;
|
|
1272
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1273
|
+
conversation_resume: {
|
|
1274
|
+
status: "unknown" | "supported" | "unsupported";
|
|
1275
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
1276
|
+
};
|
|
1277
|
+
latest_checkpoint_id: string | null;
|
|
1278
|
+
};
|
|
1279
|
+
outputs: Record<string, unknown>;
|
|
1280
|
+
failure: {
|
|
1281
|
+
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";
|
|
1282
|
+
log_tail: string;
|
|
1283
|
+
log_tail_truncated: boolean;
|
|
1284
|
+
last_log_seq: number | null;
|
|
1285
|
+
} | null;
|
|
1286
|
+
};
|
|
1287
|
+
operation: {
|
|
1288
|
+
id: string;
|
|
1289
|
+
kind: "preserve" | "restore" | "verify" | "delete";
|
|
1290
|
+
state: "failed" | "pending" | "running" | "succeeded";
|
|
1291
|
+
workspace_id: string | null;
|
|
1292
|
+
checkpoint_id: string | null;
|
|
1293
|
+
result_workspace_id: string | null;
|
|
1294
|
+
reason_code: string | null;
|
|
1295
|
+
created_at: string;
|
|
1296
|
+
updated_at: string;
|
|
1297
|
+
completed_at: string | null;
|
|
1298
|
+
};
|
|
1299
|
+
}>;
|
|
1300
|
+
resume(id: string, input: RestoreRequest, key: string, options?: RequestOptions): Promise<{
|
|
1301
|
+
workspace: {
|
|
1302
|
+
id: string;
|
|
1303
|
+
external_id: string;
|
|
1304
|
+
template: {
|
|
1305
|
+
name: string;
|
|
1306
|
+
version: string;
|
|
1307
|
+
digest: string;
|
|
1308
|
+
};
|
|
1309
|
+
state: "ready" | "failed" | "succeeded" | "queued" | "provisioning" | "connected" | "preserving" | "terminating" | "canceled" | "expired" | "preserved";
|
|
1310
|
+
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
|
+
agent_state: "unknown" | "running" | "stable";
|
|
1312
|
+
change_cursor: number;
|
|
1313
|
+
provider_kind: string | null;
|
|
1314
|
+
provisioning_mode: "cold" | "warm" | null;
|
|
1315
|
+
network: {
|
|
1316
|
+
state: "ready" | "disabled" | "starting" | "degraded";
|
|
1317
|
+
};
|
|
1318
|
+
health: Record<string, string>;
|
|
1319
|
+
created_at: string;
|
|
1320
|
+
updated_at: string;
|
|
1321
|
+
connected_at: string | null;
|
|
1322
|
+
ready_at: string | null;
|
|
1323
|
+
deadline_at: string;
|
|
1324
|
+
terminal_at: string | null;
|
|
1325
|
+
metadata: Record<string, string>;
|
|
1326
|
+
origin_workspace_id: string | null;
|
|
1327
|
+
restored_from_checkpoint_id: string | null;
|
|
1328
|
+
source: {
|
|
1329
|
+
kind: "git";
|
|
1330
|
+
repository: string;
|
|
1331
|
+
requested_revision: string;
|
|
1332
|
+
resolved_commit: string | null;
|
|
1333
|
+
} | null;
|
|
1334
|
+
persistence: {
|
|
1335
|
+
enabled: boolean;
|
|
1336
|
+
conversation_restore: "unknown" | "supported" | "filesystem_only";
|
|
1337
|
+
conversation_resume: {
|
|
1338
|
+
status: "unknown" | "supported" | "unsupported";
|
|
1339
|
+
reason: "filesystem_only" | "capability_unknown" | null;
|
|
1340
|
+
};
|
|
1341
|
+
latest_checkpoint_id: string | null;
|
|
1342
|
+
};
|
|
1343
|
+
outputs: Record<string, unknown>;
|
|
1344
|
+
failure: {
|
|
1345
|
+
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";
|
|
1346
|
+
log_tail: string;
|
|
1347
|
+
log_tail_truncated: boolean;
|
|
1348
|
+
last_log_seq: number | null;
|
|
1349
|
+
} | null;
|
|
1350
|
+
};
|
|
1351
|
+
operation: {
|
|
1352
|
+
id: string;
|
|
1353
|
+
kind: "preserve" | "restore" | "verify" | "delete";
|
|
1354
|
+
state: "failed" | "pending" | "running" | "succeeded";
|
|
1355
|
+
workspace_id: string | null;
|
|
1356
|
+
checkpoint_id: string | null;
|
|
1357
|
+
result_workspace_id: string | null;
|
|
1358
|
+
reason_code: string | null;
|
|
1359
|
+
created_at: string;
|
|
1360
|
+
updated_at: string;
|
|
1361
|
+
completed_at: string | null;
|
|
1362
|
+
};
|
|
1363
|
+
resume: {
|
|
1364
|
+
status: "supported";
|
|
1365
|
+
reason: null;
|
|
1366
|
+
source_workspace_id: string;
|
|
1367
|
+
checkpoint_id: string;
|
|
1368
|
+
};
|
|
1369
|
+
}>;
|
|
1370
|
+
private jsonOperation;
|
|
1371
|
+
}
|
|
1372
|
+
//#endregion
|
|
1373
|
+
//#region src/client.d.ts
|
|
1374
|
+
declare class PocketCoderClient {
|
|
1375
|
+
private readonly transport;
|
|
1376
|
+
readonly templates: TemplatesApi;
|
|
1377
|
+
readonly workspaces: WorkspacesApi;
|
|
1378
|
+
readonly attachments: AttachmentsApi;
|
|
1379
|
+
readonly agent: AgentApi;
|
|
1380
|
+
readonly conversations: ConversationsApi;
|
|
1381
|
+
readonly checkpoints: CheckpointsApi;
|
|
1382
|
+
readonly operations: OperationsApi;
|
|
1383
|
+
readonly logs: LogsApi;
|
|
1384
|
+
readonly networkEvents: NetworkEventsApi;
|
|
1385
|
+
readonly outputs: OutputsApi;
|
|
1386
|
+
readonly administration: AdministrationApi;
|
|
1387
|
+
readonly terminals: TerminalsApi;
|
|
1388
|
+
constructor(config: PocketCoderClientConfig, fetchImpl?: typeof fetch);
|
|
1389
|
+
raw(path: string, init?: RequestInit): Promise<Response>;
|
|
1390
|
+
}
|
|
1391
|
+
//#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
|
+
//#endregion
|
|
1417
|
+
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 RestoreRequest, 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, WorkspacesApi, splitAttachmentManifest };
|