@agentuity/core 2.0.10 → 2.0.12
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/dist/services/api.d.ts +1 -1
- package/dist/services/api.d.ts.map +1 -1
- package/dist/services/api.js +4 -6
- package/dist/services/api.js.map +1 -1
- package/dist/services/coder/agents.d.ts +172 -0
- package/dist/services/coder/agents.d.ts.map +1 -0
- package/dist/services/coder/agents.js +77 -0
- package/dist/services/coder/agents.js.map +1 -0
- package/dist/services/coder/api-reference.d.ts.map +1 -1
- package/dist/services/coder/api-reference.js +459 -39
- package/dist/services/coder/api-reference.js.map +1 -1
- package/dist/services/coder/client.d.ts +47 -1
- package/dist/services/coder/client.d.ts.map +1 -1
- package/dist/services/coder/client.js +94 -1
- package/dist/services/coder/client.js.map +1 -1
- package/dist/services/coder/close-codes.d.ts +76 -0
- package/dist/services/coder/close-codes.d.ts.map +1 -0
- package/dist/services/coder/close-codes.js +77 -0
- package/dist/services/coder/close-codes.js.map +1 -0
- package/dist/services/coder/index.d.ts +10 -3
- package/dist/services/coder/index.d.ts.map +1 -1
- package/dist/services/coder/index.js +6 -1
- package/dist/services/coder/index.js.map +1 -1
- package/dist/services/coder/protocol.d.ts +2225 -0
- package/dist/services/coder/protocol.d.ts.map +1 -0
- package/dist/services/coder/protocol.js +1122 -0
- package/dist/services/coder/protocol.js.map +1 -0
- package/dist/services/coder/sessions.d.ts +31 -0
- package/dist/services/coder/sessions.d.ts.map +1 -1
- package/dist/services/coder/sessions.js +40 -7
- package/dist/services/coder/sessions.js.map +1 -1
- package/dist/services/coder/sse.d.ts +255 -0
- package/dist/services/coder/sse.d.ts.map +1 -0
- package/dist/services/coder/sse.js +788 -0
- package/dist/services/coder/sse.js.map +1 -0
- package/dist/services/coder/types.d.ts +1578 -0
- package/dist/services/coder/types.d.ts.map +1 -1
- package/dist/services/coder/types.js +377 -1
- package/dist/services/coder/types.js.map +1 -1
- package/dist/services/coder/websocket.d.ts +358 -0
- package/dist/services/coder/websocket.d.ts.map +1 -0
- package/dist/services/coder/websocket.js +863 -0
- package/dist/services/coder/websocket.js.map +1 -0
- package/dist/services/oauth/types.d.ts +10 -0
- package/dist/services/oauth/types.d.ts.map +1 -1
- package/dist/services/oauth/types.js +3 -0
- package/dist/services/oauth/types.js.map +1 -1
- package/dist/services/project/deploy.d.ts +1 -1
- package/dist/services/sandbox/api-reference.js +7 -7
- package/dist/services/sandbox/api-reference.js.map +1 -1
- package/dist/services/sandbox/client.d.ts +3 -2
- package/dist/services/sandbox/client.d.ts.map +1 -1
- package/dist/services/sandbox/client.js.map +1 -1
- package/dist/services/sandbox/create.d.ts +5 -0
- package/dist/services/sandbox/create.d.ts.map +1 -1
- package/dist/services/sandbox/create.js +8 -0
- package/dist/services/sandbox/create.js.map +1 -1
- package/dist/services/sandbox/get.d.ts +8 -4
- package/dist/services/sandbox/get.d.ts.map +1 -1
- package/dist/services/sandbox/get.js +28 -3
- package/dist/services/sandbox/get.js.map +1 -1
- package/dist/services/sandbox/getStatus.d.ts +2 -0
- package/dist/services/sandbox/getStatus.d.ts.map +1 -1
- package/dist/services/sandbox/getStatus.js +17 -1
- package/dist/services/sandbox/getStatus.js.map +1 -1
- package/dist/services/sandbox/index.d.ts +1 -1
- package/dist/services/sandbox/index.d.ts.map +1 -1
- package/dist/services/sandbox/list.d.ts +3 -0
- package/dist/services/sandbox/list.d.ts.map +1 -1
- package/dist/services/sandbox/list.js +5 -0
- package/dist/services/sandbox/list.js.map +1 -1
- package/dist/services/sandbox/pause.d.ts +17 -1
- package/dist/services/sandbox/pause.d.ts.map +1 -1
- package/dist/services/sandbox/pause.js +21 -3
- package/dist/services/sandbox/pause.js.map +1 -1
- package/dist/services/sandbox/run.d.ts +3 -2
- package/dist/services/sandbox/run.d.ts.map +1 -1
- package/dist/services/sandbox/run.js +145 -85
- package/dist/services/sandbox/run.js.map +1 -1
- package/dist/services/sandbox/types.d.ts +10 -4
- package/dist/services/sandbox/types.d.ts.map +1 -1
- package/dist/services/sandbox/types.js +10 -0
- package/dist/services/sandbox/types.js.map +1 -1
- package/dist/services/stream/namespaces.d.ts +2 -2
- package/dist/services/stream/namespaces.js +2 -2
- package/dist/services/stream/namespaces.js.map +1 -1
- package/package.json +2 -2
- package/src/services/api.ts +6 -7
- package/src/services/coder/agents.ts +148 -0
- package/src/services/coder/api-reference.ts +479 -43
- package/src/services/coder/client.ts +143 -0
- package/src/services/coder/close-codes.ts +83 -0
- package/src/services/coder/index.ts +32 -1
- package/src/services/coder/protocol.ts +1364 -0
- package/src/services/coder/sessions.ts +66 -10
- package/src/services/coder/sse.ts +955 -0
- package/src/services/coder/types.ts +462 -1
- package/src/services/coder/websocket.ts +1042 -0
- package/src/services/oauth/types.ts +3 -0
- package/src/services/sandbox/api-reference.ts +7 -7
- package/src/services/sandbox/client.ts +4 -4
- package/src/services/sandbox/create.ts +10 -0
- package/src/services/sandbox/get.ts +32 -3
- package/src/services/sandbox/getStatus.ts +20 -1
- package/src/services/sandbox/index.ts +1 -1
- package/src/services/sandbox/list.ts +5 -0
- package/src/services/sandbox/pause.ts +38 -4
- package/src/services/sandbox/run.ts +202 -108
- package/src/services/sandbox/types.ts +15 -2
- package/src/services/stream/namespaces.ts +2 -2
|
@@ -20,6 +20,7 @@ export const OAuthClientSchema = z.object({
|
|
|
20
20
|
id_token_lifetime_seconds: z.number().optional(),
|
|
21
21
|
allowed_user_ids: z.array(z.string()),
|
|
22
22
|
internal: z.boolean().optional().default(false),
|
|
23
|
+
is_public: z.boolean().default(true),
|
|
23
24
|
created_at: z.string(),
|
|
24
25
|
updated_at: z.string(),
|
|
25
26
|
});
|
|
@@ -50,6 +51,7 @@ export const OAuthClientCreateRequestSchema = z.object({
|
|
|
50
51
|
refresh_token_lifetime_seconds: z.number().optional(),
|
|
51
52
|
id_token_lifetime_seconds: z.number().optional(),
|
|
52
53
|
allowed_user_ids: z.array(z.string()).optional(),
|
|
54
|
+
is_public: z.boolean().optional(),
|
|
53
55
|
});
|
|
54
56
|
|
|
55
57
|
export type OAuthClientCreateRequest = z.infer<typeof OAuthClientCreateRequestSchema>;
|
|
@@ -77,6 +79,7 @@ export const OAuthClientUpdateRequestSchema = z.object({
|
|
|
77
79
|
refresh_token_lifetime_seconds: z.number().optional(),
|
|
78
80
|
id_token_lifetime_seconds: z.number().optional(),
|
|
79
81
|
allowed_user_ids: z.array(z.string()).optional(),
|
|
82
|
+
is_public: z.boolean().optional(),
|
|
80
83
|
});
|
|
81
84
|
|
|
82
85
|
export type OAuthClientUpdateRequest = z.infer<typeof OAuthClientUpdateRequestSchema>;
|
|
@@ -887,15 +887,15 @@ const service: Service = {
|
|
|
887
887
|
exampleHeaders: { 'Content-Type': 'application/gzip' },
|
|
888
888
|
exampleBody: '<binary gzip data>',
|
|
889
889
|
},
|
|
890
|
-
// ──
|
|
890
|
+
// ── Sandbox Checkpoints ───────────────────────────────────────────
|
|
891
891
|
{
|
|
892
892
|
id: 'create-checkpoint',
|
|
893
893
|
title: 'Create Checkpoint',
|
|
894
|
-
sectionTitle: '
|
|
894
|
+
sectionTitle: 'Sandbox Checkpoints',
|
|
895
895
|
method: 'POST',
|
|
896
896
|
path: '/sandbox/{sandboxId}/checkpoint',
|
|
897
897
|
description:
|
|
898
|
-
'Create a named checkpoint of the sandbox filesystem. Checkpoint names must be unique — creating a checkpoint with a name that already exists returns 409 Conflict.
|
|
898
|
+
'Create a named checkpoint of the sandbox filesystem. Checkpoint names must be unique — creating a checkpoint with a name that already exists returns 409 Conflict. Checkpoints are persisted across pause/resume cycles.',
|
|
899
899
|
pathParams: [
|
|
900
900
|
{ name: 'sandboxId', type: 'string', description: 'Sandbox ID', required: true },
|
|
901
901
|
],
|
|
@@ -923,11 +923,11 @@ const service: Service = {
|
|
|
923
923
|
{
|
|
924
924
|
id: 'list-checkpoints',
|
|
925
925
|
title: 'List Checkpoints',
|
|
926
|
-
sectionTitle: '
|
|
926
|
+
sectionTitle: 'Sandbox Checkpoints',
|
|
927
927
|
method: 'GET',
|
|
928
928
|
path: '/sandbox/checkpoints/{sandboxId}',
|
|
929
929
|
description:
|
|
930
|
-
'List checkpoints for a specific sandbox.
|
|
930
|
+
'List checkpoints for a specific sandbox. Checkpoints are persisted across pause/resume cycles.',
|
|
931
931
|
pathParams: [
|
|
932
932
|
{ name: 'sandboxId', type: 'string', description: 'Sandbox ID', required: true },
|
|
933
933
|
],
|
|
@@ -947,7 +947,7 @@ const service: Service = {
|
|
|
947
947
|
{
|
|
948
948
|
id: 'restore-checkpoint',
|
|
949
949
|
title: 'Restore Checkpoint',
|
|
950
|
-
sectionTitle: '
|
|
950
|
+
sectionTitle: 'Sandbox Checkpoints',
|
|
951
951
|
method: 'POST',
|
|
952
952
|
path: '/sandbox/{sandboxId}/checkpoint/{checkpointId}/restore',
|
|
953
953
|
description: 'Restore the sandbox filesystem to a checkpoint state.',
|
|
@@ -971,7 +971,7 @@ const service: Service = {
|
|
|
971
971
|
{
|
|
972
972
|
id: 'delete-checkpoint',
|
|
973
973
|
title: 'Delete Checkpoint',
|
|
974
|
-
sectionTitle: '
|
|
974
|
+
sectionTitle: 'Sandbox Checkpoints',
|
|
975
975
|
method: 'DELETE',
|
|
976
976
|
path: '/sandbox/{sandboxId}/checkpoint/{checkpointId}',
|
|
977
977
|
description: 'Delete a checkpoint.',
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
sandboxRmDir,
|
|
35
35
|
sandboxSetEnv,
|
|
36
36
|
} from './files.ts';
|
|
37
|
-
import { sandboxPause } from './pause.ts';
|
|
37
|
+
import { sandboxPause, type SandboxPauseResult } from './pause.ts';
|
|
38
38
|
import { sandboxResume } from './resume.ts';
|
|
39
39
|
import { sandboxRun } from './run.ts';
|
|
40
40
|
import {
|
|
@@ -281,7 +281,7 @@ export interface SandboxInstance {
|
|
|
281
281
|
/**
|
|
282
282
|
* Pause the sandbox, creating a checkpoint of its current state
|
|
283
283
|
*/
|
|
284
|
-
pause(): Promise<
|
|
284
|
+
pause(): Promise<SandboxPauseResult>;
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
287
|
* Resume the sandbox from a paused or evacuated state
|
|
@@ -399,7 +399,7 @@ function createSandboxInstanceMethods(
|
|
|
399
399
|
return sandboxGet(client, { sandboxId, orgId });
|
|
400
400
|
},
|
|
401
401
|
|
|
402
|
-
async pause(): Promise<
|
|
402
|
+
async pause(): Promise<SandboxPauseResult> {
|
|
403
403
|
return sandboxPause(client, { sandboxId, orgId });
|
|
404
404
|
},
|
|
405
405
|
|
|
@@ -725,7 +725,7 @@ export class SandboxClient {
|
|
|
725
725
|
*
|
|
726
726
|
* @param sandboxId - The sandbox ID to pause
|
|
727
727
|
*/
|
|
728
|
-
async pause(sandboxId: string): Promise<
|
|
728
|
+
async pause(sandboxId: string): Promise<SandboxPauseResult> {
|
|
729
729
|
return sandboxPause(this.#client, { sandboxId, orgId: this.#orgId });
|
|
730
730
|
}
|
|
731
731
|
|
|
@@ -49,6 +49,12 @@ export const SandboxCreateRequestSchema = z
|
|
|
49
49
|
.object({
|
|
50
50
|
idle: z.string().optional().describe('Idle timeout duration (e.g., "5m", "1h")'),
|
|
51
51
|
execution: z.string().optional().describe('Maximum execution time (e.g., "30m", "2h")'),
|
|
52
|
+
paused: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe(
|
|
56
|
+
'Maximum time sandbox can remain paused before termination (e.g., "24h", "0s" for infinite)'
|
|
57
|
+
),
|
|
52
58
|
})
|
|
53
59
|
.optional()
|
|
54
60
|
.describe('Timeout settings for the sandbox'),
|
|
@@ -139,6 +145,10 @@ export const SandboxCreateDataSchema = z
|
|
|
139
145
|
'failed',
|
|
140
146
|
])
|
|
141
147
|
.describe('Current status of the sandbox'),
|
|
148
|
+
executionId: z
|
|
149
|
+
.string()
|
|
150
|
+
.optional()
|
|
151
|
+
.describe('Initial execution identifier for oneshot sandbox creation'),
|
|
142
152
|
url: z
|
|
143
153
|
.string()
|
|
144
154
|
.optional()
|
|
@@ -156,7 +156,7 @@ export const SandboxInfoDataSchema = z
|
|
|
156
156
|
user: SandboxUserInfoSchema.optional().describe('User who created the sandbox'),
|
|
157
157
|
agent: SandboxAgentInfoSchema.optional().describe('Agent associated with the sandbox'),
|
|
158
158
|
project: SandboxProjectInfoSchema.optional().describe('Project associated with the sandbox'),
|
|
159
|
-
org: SandboxOrgInfoSchema.describe('Organization associated with the sandbox'),
|
|
159
|
+
org: SandboxOrgInfoSchema.nullish().describe('Organization associated with the sandbox'),
|
|
160
160
|
timeout: z
|
|
161
161
|
.object({
|
|
162
162
|
idle: z.string().optional().describe('Idle timeout duration (e.g., "5m", "1h").'),
|
|
@@ -164,6 +164,10 @@ export const SandboxInfoDataSchema = z
|
|
|
164
164
|
.string()
|
|
165
165
|
.optional()
|
|
166
166
|
.describe('Execution timeout duration (e.g., "30m", "2h").'),
|
|
167
|
+
paused: z
|
|
168
|
+
.string()
|
|
169
|
+
.optional()
|
|
170
|
+
.describe('Paused timeout duration (e.g., "24h", "0s" for infinite).'),
|
|
167
171
|
})
|
|
168
172
|
.optional()
|
|
169
173
|
.describe('Timeout configuration for the sandbox.'),
|
|
@@ -189,6 +193,16 @@ export const SandboxGetParamsSchema = z.object({
|
|
|
189
193
|
.boolean()
|
|
190
194
|
.optional()
|
|
191
195
|
.describe('Whether deleted sandboxes should be included in lookup'),
|
|
196
|
+
waitForStatus: z
|
|
197
|
+
.union([z.string(), z.array(z.string())])
|
|
198
|
+
.optional()
|
|
199
|
+
.describe('Optional desired status or statuses to wait for before responding'),
|
|
200
|
+
waitMs: z
|
|
201
|
+
.number()
|
|
202
|
+
.int()
|
|
203
|
+
.nonnegative()
|
|
204
|
+
.optional()
|
|
205
|
+
.describe('Maximum time in milliseconds to wait for the desired status'),
|
|
192
206
|
});
|
|
193
207
|
|
|
194
208
|
export type SandboxGetParams = z.infer<typeof SandboxGetParamsSchema>;
|
|
@@ -205,7 +219,7 @@ export async function sandboxGet(
|
|
|
205
219
|
client: APIClient,
|
|
206
220
|
params: SandboxGetParams
|
|
207
221
|
): Promise<SandboxInfo> {
|
|
208
|
-
const { sandboxId, orgId, includeDeleted } = params;
|
|
222
|
+
const { sandboxId, orgId, includeDeleted, waitForStatus, waitMs } = params;
|
|
209
223
|
const queryParams = new URLSearchParams();
|
|
210
224
|
if (orgId) {
|
|
211
225
|
queryParams.set('orgId', orgId);
|
|
@@ -213,6 +227,15 @@ export async function sandboxGet(
|
|
|
213
227
|
if (includeDeleted) {
|
|
214
228
|
queryParams.set('includeDeleted', 'true');
|
|
215
229
|
}
|
|
230
|
+
if (waitForStatus) {
|
|
231
|
+
queryParams.set(
|
|
232
|
+
'waitForStatus',
|
|
233
|
+
Array.isArray(waitForStatus) ? waitForStatus.join(',') : waitForStatus
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
if (waitMs != null) {
|
|
237
|
+
queryParams.set('waitMs', String(waitMs));
|
|
238
|
+
}
|
|
216
239
|
const queryString = queryParams.toString();
|
|
217
240
|
const url = `/sandbox/${encodeURIComponent(sandboxId)}${queryString ? `?${queryString}` : ''}`;
|
|
218
241
|
|
|
@@ -222,6 +245,12 @@ export async function sandboxGet(
|
|
|
222
245
|
);
|
|
223
246
|
|
|
224
247
|
if (resp.success) {
|
|
248
|
+
// Newly created sandboxes can be served from the server's pending cache before
|
|
249
|
+
// the backing row and related org hydration are fully available. That response
|
|
250
|
+
// serializes `org: null`, so normalize it to a placeholder object instead of
|
|
251
|
+
// failing response validation for an otherwise valid sandbox status poll.
|
|
252
|
+
const org = resp.data.org ?? { id: orgId ?? '', name: '' };
|
|
253
|
+
|
|
225
254
|
return {
|
|
226
255
|
sandboxId: resp.data.sandboxId,
|
|
227
256
|
identifier: resp.data.identifier,
|
|
@@ -252,7 +281,7 @@ export async function sandboxGet(
|
|
|
252
281
|
user: resp.data.user,
|
|
253
282
|
agent: resp.data.agent,
|
|
254
283
|
project: resp.data.project,
|
|
255
|
-
org
|
|
284
|
+
org,
|
|
256
285
|
timeout: resp.data.timeout,
|
|
257
286
|
command: resp.data.command,
|
|
258
287
|
};
|
|
@@ -13,6 +13,16 @@ const SandboxStatusResponseSchema = APIResponseSchema(SandboxStatusDataSchema);
|
|
|
13
13
|
export const SandboxGetStatusParamsSchema = z.object({
|
|
14
14
|
sandboxId: z.string().describe('Sandbox ID to retrieve status for'),
|
|
15
15
|
orgId: z.string().optional().describe('Optional org id for CLI auth context'),
|
|
16
|
+
waitForStatus: z
|
|
17
|
+
.union([z.string(), z.array(z.string())])
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Optional desired status or statuses to wait for before responding'),
|
|
20
|
+
waitMs: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.nonnegative()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Maximum time in milliseconds to wait for the desired status'),
|
|
16
26
|
});
|
|
17
27
|
|
|
18
28
|
export type SandboxGetStatusParams = z.infer<typeof SandboxGetStatusParamsSchema>;
|
|
@@ -26,11 +36,20 @@ export async function sandboxGetStatus(
|
|
|
26
36
|
client: APIClient,
|
|
27
37
|
params: SandboxGetStatusParams
|
|
28
38
|
): Promise<SandboxStatusResult> {
|
|
29
|
-
const { sandboxId, orgId } = params;
|
|
39
|
+
const { sandboxId, orgId, waitForStatus, waitMs } = params;
|
|
30
40
|
const queryParams = new URLSearchParams();
|
|
31
41
|
if (orgId) {
|
|
32
42
|
queryParams.set('orgId', orgId);
|
|
33
43
|
}
|
|
44
|
+
if (waitForStatus) {
|
|
45
|
+
queryParams.set(
|
|
46
|
+
'waitForStatus',
|
|
47
|
+
Array.isArray(waitForStatus) ? waitForStatus.join(',') : waitForStatus
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (waitMs != null) {
|
|
51
|
+
queryParams.set('waitMs', String(waitMs));
|
|
52
|
+
}
|
|
34
53
|
const queryString = queryParams.toString();
|
|
35
54
|
const url = `/sandbox/status/${sandboxId}${queryString ? `?${queryString}` : ''}`;
|
|
36
55
|
|
|
@@ -52,7 +52,7 @@ export {
|
|
|
52
52
|
diskCheckpointRestore,
|
|
53
53
|
diskCheckpointDelete,
|
|
54
54
|
} from './disk-checkpoint.ts';
|
|
55
|
-
export type { SandboxPauseParams } from './pause.ts';
|
|
55
|
+
export type { SandboxPauseParams, SandboxPauseResult } from './pause.ts';
|
|
56
56
|
export { PauseResponseSchema, SandboxPauseParamsSchema, sandboxPause } from './pause.ts';
|
|
57
57
|
export type { SandboxResumeParams } from './resume.ts';
|
|
58
58
|
export { ResumeResponseSchema, SandboxResumeParamsSchema, sandboxResume } from './resume.ts';
|
|
@@ -112,6 +112,10 @@ export const SandboxInfoSchema = z
|
|
|
112
112
|
.string()
|
|
113
113
|
.optional()
|
|
114
114
|
.describe('Execution timeout duration (e.g., "30m", "2h").'),
|
|
115
|
+
paused: z
|
|
116
|
+
.string()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Paused timeout duration (e.g., "24h", "0s" for infinite).'),
|
|
115
119
|
})
|
|
116
120
|
.optional()
|
|
117
121
|
.describe('Timeout configuration for the sandbox.'),
|
|
@@ -225,6 +229,7 @@ export async function sandboxList(
|
|
|
225
229
|
networkPort: s.networkPort,
|
|
226
230
|
url: s.url,
|
|
227
231
|
org: s.org,
|
|
232
|
+
timeout: s.timeout,
|
|
228
233
|
})),
|
|
229
234
|
total: resp.data.total,
|
|
230
235
|
};
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type APIClient
|
|
2
|
+
import { type APIClient } from '../api.ts';
|
|
3
3
|
import { throwSandboxError } from './util.ts';
|
|
4
4
|
|
|
5
|
-
export const PauseResponseSchema =
|
|
5
|
+
export const PauseResponseSchema = z.discriminatedUnion('success', [
|
|
6
|
+
z.object({
|
|
7
|
+
success: z.literal<false>(false),
|
|
8
|
+
message: z.string(),
|
|
9
|
+
code: z.string().optional(),
|
|
10
|
+
}),
|
|
11
|
+
z.object({
|
|
12
|
+
success: z.literal<true>(true),
|
|
13
|
+
sandboxId: z.string(),
|
|
14
|
+
status: z.string(),
|
|
15
|
+
checkpointId: z.string().optional(),
|
|
16
|
+
terminatesAt: z.string().optional(),
|
|
17
|
+
}),
|
|
18
|
+
]);
|
|
6
19
|
|
|
7
20
|
export const SandboxPauseParamsSchema = z.object({
|
|
8
21
|
sandboxId: z.string().describe('Sandbox ID to pause'),
|
|
@@ -11,14 +24,30 @@ export const SandboxPauseParamsSchema = z.object({
|
|
|
11
24
|
|
|
12
25
|
export type SandboxPauseParams = z.infer<typeof SandboxPauseParamsSchema>;
|
|
13
26
|
|
|
27
|
+
/** Result returned from pausing a sandbox */
|
|
28
|
+
export interface SandboxPauseResult {
|
|
29
|
+
/** The sandbox ID that was paused */
|
|
30
|
+
sandboxId: string;
|
|
31
|
+
/** New status (typically "suspended") */
|
|
32
|
+
status: string;
|
|
33
|
+
/** Checkpoint ID created during pause */
|
|
34
|
+
checkpointId?: string;
|
|
35
|
+
/** ISO 8601 timestamp when sandbox will auto-terminate if not resumed (omitted if no paused timeout) */
|
|
36
|
+
terminatesAt?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
14
39
|
/**
|
|
15
40
|
* Pauses a running sandbox, creating a checkpoint of its current state.
|
|
16
41
|
*
|
|
17
42
|
* @param client - The API client to use for the request
|
|
18
43
|
* @param params - Parameters including the sandbox ID to pause
|
|
44
|
+
* @returns Pause result including terminatesAt if a paused timeout is configured
|
|
19
45
|
* @throws {SandboxResponseError} If the sandbox is not found or pause fails
|
|
20
46
|
*/
|
|
21
|
-
export async function sandboxPause(
|
|
47
|
+
export async function sandboxPause(
|
|
48
|
+
client: APIClient,
|
|
49
|
+
params: SandboxPauseParams
|
|
50
|
+
): Promise<SandboxPauseResult> {
|
|
22
51
|
const { sandboxId, orgId } = params;
|
|
23
52
|
const queryParams = new URLSearchParams();
|
|
24
53
|
if (orgId) {
|
|
@@ -34,7 +63,12 @@ export async function sandboxPause(client: APIClient, params: SandboxPauseParams
|
|
|
34
63
|
);
|
|
35
64
|
|
|
36
65
|
if (resp.success) {
|
|
37
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
sandboxId: resp.sandboxId,
|
|
68
|
+
status: resp.status,
|
|
69
|
+
checkpointId: resp.checkpointId,
|
|
70
|
+
terminatesAt: resp.terminatesAt,
|
|
71
|
+
};
|
|
38
72
|
}
|
|
39
73
|
|
|
40
74
|
throwSandboxError(resp, { sandboxId });
|