@agentuity/server 0.1.15 → 0.1.17
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/api/api.d.ts +11 -6
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +19 -12
- package/dist/api/api.js.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/org/env-delete.d.ts +16 -0
- package/dist/api/org/env-delete.d.ts.map +1 -0
- package/dist/api/org/env-delete.js +25 -0
- package/dist/api/org/env-delete.js.map +1 -0
- package/dist/api/org/env-get.d.ts +20 -0
- package/dist/api/org/env-get.d.ts.map +1 -0
- package/dist/api/org/env-get.js +26 -0
- package/dist/api/org/env-get.js.map +1 -0
- package/dist/api/org/env-update.d.ts +17 -0
- package/dist/api/org/env-update.d.ts.map +1 -0
- package/dist/api/org/env-update.js +26 -0
- package/dist/api/org/env-update.js.map +1 -0
- package/dist/api/org/index.d.ts +3 -0
- package/dist/api/org/index.d.ts.map +1 -1
- package/dist/api/org/index.js +3 -0
- package/dist/api/org/index.js.map +1 -1
- package/dist/api/queue/analytics.d.ts +108 -0
- package/dist/api/queue/analytics.d.ts.map +1 -0
- package/dist/api/queue/analytics.js +245 -0
- package/dist/api/queue/analytics.js.map +1 -0
- package/dist/api/queue/destinations.d.ts +108 -0
- package/dist/api/queue/destinations.d.ts.map +1 -0
- package/dist/api/queue/destinations.js +238 -0
- package/dist/api/queue/destinations.js.map +1 -0
- package/dist/api/queue/dlq.d.ts +100 -0
- package/dist/api/queue/dlq.d.ts.map +1 -0
- package/dist/api/queue/dlq.js +204 -0
- package/dist/api/queue/dlq.js.map +1 -0
- package/dist/api/queue/index.d.ts +55 -0
- package/dist/api/queue/index.d.ts.map +1 -0
- package/dist/api/queue/index.js +86 -0
- package/dist/api/queue/index.js.map +1 -0
- package/dist/api/queue/messages.d.ts +332 -0
- package/dist/api/queue/messages.d.ts.map +1 -0
- package/dist/api/queue/messages.js +637 -0
- package/dist/api/queue/messages.js.map +1 -0
- package/dist/api/queue/queues.d.ts +153 -0
- package/dist/api/queue/queues.d.ts.map +1 -0
- package/dist/api/queue/queues.js +319 -0
- package/dist/api/queue/queues.js.map +1 -0
- package/dist/api/queue/sources.d.ts +132 -0
- package/dist/api/queue/sources.d.ts.map +1 -0
- package/dist/api/queue/sources.js +285 -0
- package/dist/api/queue/sources.js.map +1 -0
- package/dist/api/queue/types.d.ts +1129 -0
- package/dist/api/queue/types.d.ts.map +1 -0
- package/dist/api/queue/types.js +949 -0
- package/dist/api/queue/types.js.map +1 -0
- package/dist/api/queue/util.d.ts +262 -0
- package/dist/api/queue/util.d.ts.map +1 -0
- package/dist/api/queue/util.js +171 -0
- package/dist/api/queue/util.js.map +1 -0
- package/dist/api/queue/validation.d.ts +247 -0
- package/dist/api/queue/validation.d.ts.map +1 -0
- package/dist/api/queue/validation.js +513 -0
- package/dist/api/queue/validation.js.map +1 -0
- package/dist/api/sandbox/client.d.ts +56 -2
- package/dist/api/sandbox/client.d.ts.map +1 -1
- package/dist/api/sandbox/client.js +51 -0
- package/dist/api/sandbox/client.js.map +1 -1
- package/dist/api/sandbox/get.d.ts.map +1 -1
- package/dist/api/sandbox/get.js +5 -0
- package/dist/api/sandbox/get.js.map +1 -1
- package/dist/api/sandbox/index.d.ts +3 -3
- package/dist/api/sandbox/index.d.ts.map +1 -1
- package/dist/api/sandbox/index.js +1 -1
- package/dist/api/sandbox/index.js.map +1 -1
- package/dist/api/sandbox/run.d.ts.map +1 -1
- package/dist/api/sandbox/run.js +5 -2
- package/dist/api/sandbox/run.js.map +1 -1
- package/dist/api/sandbox/runtime.d.ts.map +1 -1
- package/dist/api/sandbox/runtime.js +14 -0
- package/dist/api/sandbox/runtime.js.map +1 -1
- package/dist/api/sandbox/snapshot-build.d.ts +2 -0
- package/dist/api/sandbox/snapshot-build.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot-build.js +4 -0
- package/dist/api/sandbox/snapshot-build.js.map +1 -1
- package/dist/api/sandbox/snapshot.d.ts +44 -1
- package/dist/api/sandbox/snapshot.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot.js +77 -4
- package/dist/api/sandbox/snapshot.js.map +1 -1
- package/package.json +4 -4
- package/src/api/api.ts +62 -13
- package/src/api/index.ts +1 -0
- package/src/api/org/env-delete.ts +37 -0
- package/src/api/org/env-get.ts +43 -0
- package/src/api/org/env-update.ts +38 -0
- package/src/api/org/index.ts +3 -0
- package/src/api/queue/analytics.ts +313 -0
- package/src/api/queue/destinations.ts +321 -0
- package/src/api/queue/dlq.ts +283 -0
- package/src/api/queue/index.ts +261 -0
- package/src/api/queue/messages.ts +875 -0
- package/src/api/queue/queues.ts +448 -0
- package/src/api/queue/sources.ts +384 -0
- package/src/api/queue/types.ts +1253 -0
- package/src/api/queue/util.ts +204 -0
- package/src/api/queue/validation.ts +560 -0
- package/src/api/sandbox/client.ts +86 -1
- package/src/api/sandbox/get.ts +5 -0
- package/src/api/sandbox/index.ts +9 -1
- package/src/api/sandbox/run.ts +5 -2
- package/src/api/sandbox/runtime.ts +15 -0
- package/src/api/sandbox/snapshot-build.ts +4 -0
- package/src/api/sandbox/snapshot.ts +96 -5
package/src/api/sandbox/index.ts
CHANGED
|
@@ -21,7 +21,12 @@ export type {
|
|
|
21
21
|
} from './execution';
|
|
22
22
|
export { SandboxResponseError, writeAndDrain } from './util';
|
|
23
23
|
export { SandboxClient } from './client';
|
|
24
|
-
export type {
|
|
24
|
+
export type {
|
|
25
|
+
SandboxClientOptions,
|
|
26
|
+
SandboxClientRunIO,
|
|
27
|
+
SandboxInstance,
|
|
28
|
+
ExecuteOptions,
|
|
29
|
+
} from './client';
|
|
25
30
|
export {
|
|
26
31
|
sandboxWriteFiles,
|
|
27
32
|
sandboxReadFile,
|
|
@@ -57,6 +62,7 @@ export {
|
|
|
57
62
|
snapshotTag,
|
|
58
63
|
snapshotBuildInit,
|
|
59
64
|
snapshotBuildFinalize,
|
|
65
|
+
snapshotUpload,
|
|
60
66
|
} from './snapshot';
|
|
61
67
|
export type {
|
|
62
68
|
SnapshotInfo,
|
|
@@ -70,6 +76,8 @@ export type {
|
|
|
70
76
|
SnapshotBuildInitParams,
|
|
71
77
|
SnapshotBuildInitResponse,
|
|
72
78
|
SnapshotBuildFinalizeParams,
|
|
79
|
+
SnapshotUploadParams,
|
|
80
|
+
SnapshotUploadResponse,
|
|
73
81
|
} from './snapshot';
|
|
74
82
|
export { SnapshotBuildFileSchema } from './snapshot-build';
|
|
75
83
|
export type { SnapshotBuildFile } from './snapshot-build';
|
package/src/api/sandbox/run.ts
CHANGED
|
@@ -138,6 +138,7 @@ export async function sandboxRun(
|
|
|
138
138
|
// Poll for sandbox completion in parallel with streaming
|
|
139
139
|
let attempts = 0;
|
|
140
140
|
let finalStatus: 'terminated' | 'failed' | null = null;
|
|
141
|
+
let finalExitCode: number | undefined;
|
|
141
142
|
|
|
142
143
|
while (attempts < MAX_POLL_ATTEMPTS) {
|
|
143
144
|
if (signal?.aborted) {
|
|
@@ -156,11 +157,13 @@ export async function sandboxRun(
|
|
|
156
157
|
|
|
157
158
|
if (sandboxInfo.status === 'terminated') {
|
|
158
159
|
finalStatus = 'terminated';
|
|
160
|
+
finalExitCode = sandboxInfo.exitCode;
|
|
159
161
|
break;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
if (sandboxInfo.status === 'failed') {
|
|
163
165
|
finalStatus = 'failed';
|
|
166
|
+
finalExitCode = sandboxInfo.exitCode;
|
|
164
167
|
break;
|
|
165
168
|
}
|
|
166
169
|
} catch {
|
|
@@ -179,7 +182,7 @@ export async function sandboxRun(
|
|
|
179
182
|
if (finalStatus === 'terminated') {
|
|
180
183
|
return {
|
|
181
184
|
sandboxId,
|
|
182
|
-
exitCode: 0,
|
|
185
|
+
exitCode: finalExitCode ?? 0,
|
|
183
186
|
durationMs: Date.now() - started,
|
|
184
187
|
};
|
|
185
188
|
}
|
|
@@ -187,7 +190,7 @@ export async function sandboxRun(
|
|
|
187
190
|
if (finalStatus === 'failed') {
|
|
188
191
|
return {
|
|
189
192
|
sandboxId,
|
|
190
|
-
exitCode: 1,
|
|
193
|
+
exitCode: finalExitCode ?? 1,
|
|
191
194
|
durationMs: Date.now() - started,
|
|
192
195
|
};
|
|
193
196
|
}
|
|
@@ -3,14 +3,26 @@ import { APIClient, APIResponseSchema } from '../api';
|
|
|
3
3
|
import { SandboxResponseError, API_VERSION } from './util';
|
|
4
4
|
import type { ListRuntimesParams, ListRuntimesResponse, SandboxRuntime } from '@agentuity/core';
|
|
5
5
|
|
|
6
|
+
const RuntimeRequirementsSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
memory: z.string().optional().describe('Memory requirement (e.g., "1Gi")'),
|
|
9
|
+
cpu: z.string().optional().describe('CPU requirement (e.g., "1")'),
|
|
10
|
+
disk: z.string().optional().describe('Disk requirement (e.g., "500Mi")'),
|
|
11
|
+
networkEnabled: z.boolean().describe('Whether network access is enabled'),
|
|
12
|
+
})
|
|
13
|
+
.describe('Runtime resource requirements');
|
|
14
|
+
|
|
6
15
|
const RuntimeInfoSchema = z
|
|
7
16
|
.object({
|
|
8
17
|
id: z.string().describe('Unique runtime identifier'),
|
|
9
18
|
name: z.string().describe('Runtime name (e.g., "bun:1", "python:3.14")'),
|
|
10
19
|
description: z.string().optional().describe('Optional description'),
|
|
11
20
|
iconUrl: z.string().optional().describe('URL for runtime icon'),
|
|
21
|
+
brandColor: z.string().optional().describe('Brand color for the runtime (hex color code)'),
|
|
12
22
|
url: z.string().optional().describe('URL for runtime documentation or homepage'),
|
|
13
23
|
tags: z.array(z.string()).optional().describe('Optional tags for categorization'),
|
|
24
|
+
requirements: RuntimeRequirementsSchema.optional().describe('Runtime resource requirements'),
|
|
25
|
+
readme: z.string().optional().describe('Readme content in markdown format'),
|
|
14
26
|
})
|
|
15
27
|
.describe('Information about a sandbox runtime');
|
|
16
28
|
|
|
@@ -67,8 +79,11 @@ export async function runtimeList(
|
|
|
67
79
|
name: r.name,
|
|
68
80
|
description: r.description,
|
|
69
81
|
iconUrl: r.iconUrl,
|
|
82
|
+
brandColor: r.brandColor,
|
|
70
83
|
url: r.url,
|
|
71
84
|
tags: r.tags,
|
|
85
|
+
requirements: r.requirements,
|
|
86
|
+
readme: r.readme,
|
|
72
87
|
})
|
|
73
88
|
),
|
|
74
89
|
total: resp.data.total,
|
|
@@ -40,6 +40,10 @@ export const SnapshotBuildFileBaseSchema = z
|
|
|
40
40
|
.describe(
|
|
41
41
|
'User-defined metadata key-value pairs. Use ${VAR} syntax for build-time substitution via --metadata flag'
|
|
42
42
|
),
|
|
43
|
+
public: z
|
|
44
|
+
.boolean()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Whether to make the snapshot publicly accessible (default: false)'),
|
|
43
47
|
})
|
|
44
48
|
.describe('Agentuity Snapshot Build File - defines a reproducible sandbox environment');
|
|
45
49
|
|
|
@@ -6,6 +6,9 @@ const SnapshotFileInfoSchema = z
|
|
|
6
6
|
.object({
|
|
7
7
|
path: z.string().describe('File path within the snapshot'),
|
|
8
8
|
size: z.number().describe('File size in bytes'),
|
|
9
|
+
sha256: z.string().describe('SHA256 hash of the file contents'),
|
|
10
|
+
contentType: z.string().describe('MIME type of the file'),
|
|
11
|
+
mode: z.number().describe('Unix file mode/permissions (e.g., 0o644)'),
|
|
9
12
|
})
|
|
10
13
|
.describe('Information about a file in a snapshot');
|
|
11
14
|
|
|
@@ -22,6 +25,10 @@ const SnapshotInfoSchema = z
|
|
|
22
25
|
.describe(
|
|
23
26
|
'Display name for the snapshot (URL-safe: letters, numbers, underscores, dashes)'
|
|
24
27
|
),
|
|
28
|
+
fullName: z
|
|
29
|
+
.string()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe('Full name with org slug for public snapshots (@slug/name:tag)'),
|
|
25
32
|
description: z.string().nullable().optional().describe('Description of the snapshot'),
|
|
26
33
|
tag: z.string().nullable().optional().describe('Tag for the snapshot (defaults to "latest")'),
|
|
27
34
|
sizeBytes: z.number().describe('Total size of the snapshot in bytes'),
|
|
@@ -31,6 +38,9 @@ const SnapshotInfoSchema = z
|
|
|
31
38
|
.nullable()
|
|
32
39
|
.optional()
|
|
33
40
|
.describe('ID of the parent snapshot (for incremental snapshots)'),
|
|
41
|
+
public: z.boolean().optional().describe('Whether the snapshot is publicly accessible'),
|
|
42
|
+
orgName: z.string().optional().describe('Organization name (for public snapshots)'),
|
|
43
|
+
orgSlug: z.string().optional().describe('Organization slug (for public snapshots)'),
|
|
34
44
|
createdAt: z.string().describe('ISO timestamp when the snapshot was created'),
|
|
35
45
|
downloadUrl: z.string().optional().describe('URL to download the snapshot archive'),
|
|
36
46
|
files: z
|
|
@@ -67,6 +77,10 @@ const _SnapshotCreateParamsSchema = z
|
|
|
67
77
|
name: z.string().optional().describe('Display name for the snapshot'),
|
|
68
78
|
description: z.string().optional().describe('Description of the snapshot'),
|
|
69
79
|
tag: z.string().optional().describe('Tag for the snapshot'),
|
|
80
|
+
public: z
|
|
81
|
+
.boolean()
|
|
82
|
+
.optional()
|
|
83
|
+
.describe('Whether to make the snapshot publicly accessible (default: false)'),
|
|
70
84
|
orgId: z.string().optional().describe('Organization ID'),
|
|
71
85
|
})
|
|
72
86
|
.describe('Parameters for creating a snapshot');
|
|
@@ -131,11 +145,11 @@ export async function snapshotCreate(
|
|
|
131
145
|
client: APIClient,
|
|
132
146
|
params: SnapshotCreateParams
|
|
133
147
|
): Promise<SnapshotInfo> {
|
|
134
|
-
const { sandboxId, name, description, tag, orgId } = params;
|
|
148
|
+
const { sandboxId, name, description, tag, public: isPublic, orgId } = params;
|
|
135
149
|
const queryString = buildQueryString({ orgId });
|
|
136
150
|
const url = `/sandbox/${API_VERSION}/${sandboxId}/snapshot${queryString}`;
|
|
137
151
|
|
|
138
|
-
const body: Record<string, string> = {};
|
|
152
|
+
const body: Record<string, string | boolean> = {};
|
|
139
153
|
if (name) {
|
|
140
154
|
body.name = name;
|
|
141
155
|
}
|
|
@@ -145,6 +159,9 @@ export async function snapshotCreate(
|
|
|
145
159
|
if (tag) {
|
|
146
160
|
body.tag = tag;
|
|
147
161
|
}
|
|
162
|
+
if (isPublic !== undefined) {
|
|
163
|
+
body.public = isPublic;
|
|
164
|
+
}
|
|
148
165
|
|
|
149
166
|
const resp = await client.post<z.infer<typeof SnapshotCreateResponseSchema>>(
|
|
150
167
|
url,
|
|
@@ -283,6 +300,10 @@ const _SnapshotBuildInitParamsSchema = z
|
|
|
283
300
|
.describe('SHA-256 hash of snapshot content for change detection'),
|
|
284
301
|
force: z.boolean().optional().describe('Force rebuild even if content is unchanged'),
|
|
285
302
|
encrypt: z.boolean().optional().describe('Request encryption for the snapshot archive'),
|
|
303
|
+
public: z
|
|
304
|
+
.boolean()
|
|
305
|
+
.optional()
|
|
306
|
+
.describe('Make snapshot public (enables virus scanning, disables encryption)'),
|
|
286
307
|
orgId: z.string().optional().describe('Organization ID'),
|
|
287
308
|
})
|
|
288
309
|
.describe('Parameters for initializing a snapshot build');
|
|
@@ -293,8 +314,7 @@ const SnapshotBuildInitResponseSchema = z
|
|
|
293
314
|
uploadUrl: z
|
|
294
315
|
.string()
|
|
295
316
|
.optional()
|
|
296
|
-
.describe('Pre-signed URL for uploading the snapshot archive'),
|
|
297
|
-
s3Key: z.string().optional().describe('S3 key where the snapshot will be stored'),
|
|
317
|
+
.describe('Pre-signed URL for uploading the snapshot archive (private snapshots only)'),
|
|
298
318
|
publicKey: z
|
|
299
319
|
.string()
|
|
300
320
|
.optional()
|
|
@@ -340,7 +360,8 @@ export async function snapshotBuildInit(
|
|
|
340
360
|
client: APIClient,
|
|
341
361
|
params: SnapshotBuildInitParams
|
|
342
362
|
): Promise<SnapshotBuildInitResponse> {
|
|
343
|
-
const { runtime, name, description, tag, contentHash, force, encrypt, orgId } =
|
|
363
|
+
const { runtime, name, description, tag, contentHash, force, encrypt, public: isPublic, orgId } =
|
|
364
|
+
params;
|
|
344
365
|
const queryString = buildQueryString({ orgId });
|
|
345
366
|
const url = `/sandbox/${API_VERSION}/snapshots/build${queryString}`;
|
|
346
367
|
|
|
@@ -351,6 +372,7 @@ export async function snapshotBuildInit(
|
|
|
351
372
|
if (contentHash) body.contentHash = contentHash;
|
|
352
373
|
if (force) body.force = force;
|
|
353
374
|
if (encrypt) body.encrypt = encrypt;
|
|
375
|
+
if (isPublic !== undefined) body.public = isPublic;
|
|
354
376
|
|
|
355
377
|
const resp = await client.post<z.infer<typeof SnapshotBuildInitAPIResponseSchema>>(
|
|
356
378
|
url,
|
|
@@ -402,3 +424,72 @@ export async function snapshotBuildFinalize(
|
|
|
402
424
|
|
|
403
425
|
throw new SandboxResponseError({ message: resp.message });
|
|
404
426
|
}
|
|
427
|
+
|
|
428
|
+
// ===== Snapshot Upload API (for public snapshots) =====
|
|
429
|
+
|
|
430
|
+
const SnapshotUploadResponseSchema = z
|
|
431
|
+
.object({
|
|
432
|
+
success: z.boolean().describe('Whether the upload was successful'),
|
|
433
|
+
scanned: z.boolean().describe('Whether the upload was virus scanned'),
|
|
434
|
+
message: z.string().optional().describe('Optional message'),
|
|
435
|
+
})
|
|
436
|
+
.describe('Response from snapshot upload API');
|
|
437
|
+
|
|
438
|
+
const _SnapshotUploadAPIResponseSchema = APIResponseSchema(SnapshotUploadResponseSchema);
|
|
439
|
+
|
|
440
|
+
export type SnapshotUploadResponse = z.infer<typeof SnapshotUploadResponseSchema>;
|
|
441
|
+
|
|
442
|
+
export interface SnapshotUploadParams {
|
|
443
|
+
snapshotId: string;
|
|
444
|
+
body: Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string | Blob;
|
|
445
|
+
contentLength: number;
|
|
446
|
+
orgId?: string;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Upload a public snapshot archive via Catalyst (with virus scanning).
|
|
451
|
+
* This should only be used when snapshotBuildInit returns no uploadUrl.
|
|
452
|
+
*
|
|
453
|
+
* @param client - The API client to use for the request
|
|
454
|
+
* @param params - Parameters including snapshotId and the archive body
|
|
455
|
+
* @returns Upload result with scan status
|
|
456
|
+
* @throws {SandboxResponseError} If the upload fails or malware is detected
|
|
457
|
+
*/
|
|
458
|
+
export async function snapshotUpload(
|
|
459
|
+
client: APIClient,
|
|
460
|
+
params: SnapshotUploadParams
|
|
461
|
+
): Promise<SnapshotUploadResponse> {
|
|
462
|
+
const { snapshotId, body, contentLength, orgId } = params;
|
|
463
|
+
const queryString = buildQueryString({ orgId });
|
|
464
|
+
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}/upload${queryString}`;
|
|
465
|
+
|
|
466
|
+
const response = await client.rawPut(url, body, 'application/gzip', undefined, {
|
|
467
|
+
'Content-Length': String(contentLength),
|
|
468
|
+
Accept: 'application/json',
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
if (!response.ok) {
|
|
472
|
+
const text = await response.text();
|
|
473
|
+
let message = `Upload failed: ${response.status} ${response.statusText}`;
|
|
474
|
+
try {
|
|
475
|
+
const json = JSON.parse(text);
|
|
476
|
+
if (json.message) {
|
|
477
|
+
message = json.message;
|
|
478
|
+
} else if (json.error) {
|
|
479
|
+
message = typeof json.error === 'string' ? json.error : JSON.stringify(json.error);
|
|
480
|
+
}
|
|
481
|
+
} catch {
|
|
482
|
+
if (text) {
|
|
483
|
+
message = text;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
throw new SandboxResponseError({ message });
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
const data = (await response.json()) as z.infer<typeof _SnapshotUploadAPIResponseSchema>;
|
|
490
|
+
if (data.success) {
|
|
491
|
+
return data.data;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
throw new SandboxResponseError({ message: data.message });
|
|
495
|
+
}
|