@agentuity/server 0.0.110 → 0.0.112
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 +5 -0
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +23 -4
- package/dist/api/api.js.map +1 -1
- package/dist/api/project/deploy.d.ts +37 -1
- package/dist/api/project/deploy.d.ts.map +1 -1
- package/dist/api/project/deploy.js +49 -1
- package/dist/api/project/deploy.js.map +1 -1
- package/dist/api/sandbox/create.d.ts.map +1 -1
- package/dist/api/sandbox/create.js +7 -0
- package/dist/api/sandbox/create.js.map +1 -1
- package/dist/api/sandbox/files.d.ts +120 -0
- package/dist/api/sandbox/files.d.ts.map +1 -1
- package/dist/api/sandbox/files.js +287 -0
- package/dist/api/sandbox/files.js.map +1 -1
- package/dist/api/sandbox/get.d.ts.map +1 -1
- package/dist/api/sandbox/get.js +14 -0
- package/dist/api/sandbox/get.js.map +1 -1
- package/dist/api/sandbox/index.d.ts +2 -2
- 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/snapshot.d.ts +0 -1
- package/dist/api/sandbox/snapshot.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot.js +6 -8
- package/dist/api/sandbox/snapshot.js.map +1 -1
- package/dist/config.d.ts +7 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -4
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -1
- package/dist/schema.js.map +1 -1
- package/package.json +5 -5
- package/src/api/api.ts +40 -4
- package/src/api/project/deploy.ts +97 -1
- package/src/api/sandbox/create.ts +7 -0
- package/src/api/sandbox/files.ts +450 -0
- package/src/api/sandbox/get.ts +15 -0
- package/src/api/sandbox/index.ts +27 -2
- package/src/api/sandbox/snapshot.ts +6 -10
- package/src/config.ts +21 -4
- package/src/index.ts +1 -1
- package/src/schema.ts +3 -1
package/src/api/sandbox/get.ts
CHANGED
|
@@ -3,6 +3,14 @@ import { APIClient, APIResponseSchema } from '../api';
|
|
|
3
3
|
import { SandboxResponseError, API_VERSION } from './util';
|
|
4
4
|
import type { SandboxInfo, SandboxStatus } from '@agentuity/core';
|
|
5
5
|
|
|
6
|
+
const SandboxResourcesSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
memory: z.string().optional().describe('Memory limit (e.g., "512Mi", "1Gi")'),
|
|
9
|
+
cpu: z.string().optional().describe('CPU limit in millicores (e.g., "500m", "1000m")'),
|
|
10
|
+
disk: z.string().optional().describe('Disk limit (e.g., "1Gi", "10Gi")'),
|
|
11
|
+
})
|
|
12
|
+
.describe('Resource limits for the sandbox');
|
|
13
|
+
|
|
6
14
|
const SandboxInfoDataSchema = z
|
|
7
15
|
.object({
|
|
8
16
|
sandboxId: z.string().describe('Unique identifier for the sandbox'),
|
|
@@ -20,6 +28,11 @@ const SandboxInfoDataSchema = z
|
|
|
20
28
|
.array(z.string())
|
|
21
29
|
.optional()
|
|
22
30
|
.describe('Apt packages installed in the sandbox'),
|
|
31
|
+
metadata: z
|
|
32
|
+
.record(z.string(), z.unknown())
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('User-defined metadata associated with the sandbox'),
|
|
35
|
+
resources: SandboxResourcesSchema.optional().describe('Resource limits for this sandbox'),
|
|
23
36
|
})
|
|
24
37
|
.describe('Detailed information about a sandbox');
|
|
25
38
|
|
|
@@ -67,6 +80,8 @@ export async function sandboxGet(
|
|
|
67
80
|
stdoutStreamUrl: resp.data.stdoutStreamUrl,
|
|
68
81
|
stderrStreamUrl: resp.data.stderrStreamUrl,
|
|
69
82
|
dependencies: resp.data.dependencies,
|
|
83
|
+
metadata: resp.data.metadata as Record<string, unknown> | undefined,
|
|
84
|
+
resources: resp.data.resources,
|
|
70
85
|
};
|
|
71
86
|
}
|
|
72
87
|
|
package/src/api/sandbox/index.ts
CHANGED
|
@@ -20,8 +20,33 @@ export type {
|
|
|
20
20
|
export { SandboxResponseError, writeAndDrain } from './util';
|
|
21
21
|
export { SandboxClient } from './client';
|
|
22
22
|
export type { SandboxClientOptions, SandboxInstance, ExecuteOptions } from './client';
|
|
23
|
-
export {
|
|
24
|
-
|
|
23
|
+
export {
|
|
24
|
+
sandboxWriteFiles,
|
|
25
|
+
sandboxReadFile,
|
|
26
|
+
sandboxMkDir,
|
|
27
|
+
sandboxRmDir,
|
|
28
|
+
sandboxRmFile,
|
|
29
|
+
sandboxListFiles,
|
|
30
|
+
sandboxDownloadArchive,
|
|
31
|
+
sandboxUploadArchive,
|
|
32
|
+
sandboxSetEnv,
|
|
33
|
+
} from './files';
|
|
34
|
+
export type {
|
|
35
|
+
WriteFilesParams,
|
|
36
|
+
WriteFilesResult,
|
|
37
|
+
ReadFileParams,
|
|
38
|
+
MkDirParams,
|
|
39
|
+
RmDirParams,
|
|
40
|
+
RmFileParams,
|
|
41
|
+
ListFilesParams,
|
|
42
|
+
ListFilesResult,
|
|
43
|
+
FileInfo,
|
|
44
|
+
ArchiveFormat,
|
|
45
|
+
DownloadArchiveParams,
|
|
46
|
+
UploadArchiveParams,
|
|
47
|
+
SetEnvParams,
|
|
48
|
+
SetEnvResult,
|
|
49
|
+
} from './files';
|
|
25
50
|
export { snapshotCreate, snapshotGet, snapshotList, snapshotDelete, snapshotTag } from './snapshot';
|
|
26
51
|
export type {
|
|
27
52
|
SnapshotInfo,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { APIClient, APIResponseSchema, APIResponseSchemaNoData } from '../api';
|
|
3
|
-
import { SandboxResponseError } from './util';
|
|
4
|
-
|
|
5
|
-
const SNAPSHOT_API_VERSION = '2025-06-26';
|
|
3
|
+
import { SandboxResponseError, API_VERSION } from './util';
|
|
6
4
|
|
|
7
5
|
const SnapshotFileInfoSchema = z
|
|
8
6
|
.object({
|
|
@@ -14,7 +12,6 @@ const SnapshotFileInfoSchema = z
|
|
|
14
12
|
const SnapshotInfoSchema = z
|
|
15
13
|
.object({
|
|
16
14
|
snapshotId: z.string().describe('Unique identifier for the snapshot'),
|
|
17
|
-
sandboxId: z.string().describe('ID of the sandbox this snapshot was created from'),
|
|
18
15
|
tag: z.string().nullable().optional().describe('User-defined tag for the snapshot'),
|
|
19
16
|
sizeBytes: z.number().describe('Total size of the snapshot in bytes'),
|
|
20
17
|
fileCount: z.number().describe('Number of files in the snapshot'),
|
|
@@ -47,7 +44,6 @@ export interface SnapshotFileInfo {
|
|
|
47
44
|
|
|
48
45
|
export interface SnapshotInfo {
|
|
49
46
|
snapshotId: string;
|
|
50
|
-
sandboxId: string;
|
|
51
47
|
tag?: string | null;
|
|
52
48
|
sizeBytes: number;
|
|
53
49
|
fileCount: number;
|
|
@@ -116,7 +112,7 @@ export async function snapshotCreate(
|
|
|
116
112
|
): Promise<SnapshotInfo> {
|
|
117
113
|
const { sandboxId, tag, orgId } = params;
|
|
118
114
|
const queryString = buildQueryString({ orgId });
|
|
119
|
-
const url = `/sandbox/${
|
|
115
|
+
const url = `/sandbox/${API_VERSION}/${sandboxId}/snapshot${queryString}`;
|
|
120
116
|
|
|
121
117
|
const body: Record<string, string> = {};
|
|
122
118
|
if (tag) {
|
|
@@ -150,7 +146,7 @@ export async function snapshotGet(
|
|
|
150
146
|
): Promise<SnapshotInfo> {
|
|
151
147
|
const { snapshotId, orgId } = params;
|
|
152
148
|
const queryString = buildQueryString({ orgId });
|
|
153
|
-
const url = `/sandbox/${
|
|
149
|
+
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}${queryString}`;
|
|
154
150
|
|
|
155
151
|
const resp = await client.get<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
156
152
|
url,
|
|
@@ -178,7 +174,7 @@ export async function snapshotList(
|
|
|
178
174
|
): Promise<SnapshotListResponse> {
|
|
179
175
|
const { sandboxId, limit, offset, orgId } = params;
|
|
180
176
|
const queryString = buildQueryString({ sandboxId, limit, offset, orgId });
|
|
181
|
-
const url = `/sandbox/${
|
|
177
|
+
const url = `/sandbox/${API_VERSION}/snapshots${queryString}`;
|
|
182
178
|
|
|
183
179
|
const resp = await client.get<z.infer<typeof SnapshotListResponseSchema>>(
|
|
184
180
|
url,
|
|
@@ -205,7 +201,7 @@ export async function snapshotDelete(
|
|
|
205
201
|
): Promise<void> {
|
|
206
202
|
const { snapshotId, orgId } = params;
|
|
207
203
|
const queryString = buildQueryString({ orgId });
|
|
208
|
-
const url = `/sandbox/${
|
|
204
|
+
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}${queryString}`;
|
|
209
205
|
|
|
210
206
|
const resp = await client.delete<z.infer<typeof SnapshotDeleteResponseSchema>>(
|
|
211
207
|
url,
|
|
@@ -231,7 +227,7 @@ export async function snapshotTag(
|
|
|
231
227
|
): Promise<SnapshotInfo> {
|
|
232
228
|
const { snapshotId, tag, orgId } = params;
|
|
233
229
|
const queryString = buildQueryString({ orgId });
|
|
234
|
-
const url = `/sandbox/${
|
|
230
|
+
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}${queryString}`;
|
|
235
231
|
|
|
236
232
|
const resp = await client.patch<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
237
233
|
url,
|
package/src/config.ts
CHANGED
|
@@ -8,17 +8,34 @@ export interface ServiceUrls {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Resolve the region from the provided value or AGENTUITY_REGION environment variable.
|
|
12
|
+
* Throws an error if no region can be resolved.
|
|
13
|
+
*/
|
|
14
|
+
export function resolveRegion(region?: string): string {
|
|
15
|
+
const resolved = region ?? process.env.AGENTUITY_REGION;
|
|
16
|
+
if (!resolved) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
'Region is required but not provided. Set the AGENTUITY_REGION environment variable or pass region as a parameter.'
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return resolved;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get service URLs from environment variables with fallback defaults.
|
|
26
|
+
* Throws an error if region cannot be resolved (neither passed as parameter nor set via AGENTUITY_REGION).
|
|
12
27
|
*/
|
|
13
28
|
export function getServiceUrls(region?: string): ServiceUrls {
|
|
14
|
-
const
|
|
29
|
+
const resolvedRegion = resolveRegion(region);
|
|
30
|
+
const transportUrl =
|
|
31
|
+
process.env.AGENTUITY_TRANSPORT_URL || buildRegionalURL(resolvedRegion, 'catalyst');
|
|
15
32
|
|
|
16
33
|
return {
|
|
17
34
|
keyvalue: process.env.AGENTUITY_KEYVALUE_URL || transportUrl,
|
|
18
|
-
stream: process.env.AGENTUITY_STREAM_URL || buildRegionalURL(
|
|
35
|
+
stream: process.env.AGENTUITY_STREAM_URL || buildRegionalURL(resolvedRegion, 'streams'),
|
|
19
36
|
vector: process.env.AGENTUITY_VECTOR_URL || transportUrl,
|
|
20
37
|
catalyst: process.env.AGENTUITY_CATALYST_URL || transportUrl,
|
|
21
|
-
otel: process.env.AGENTUITY_OTLP_URL || buildRegionalURL(
|
|
38
|
+
otel: process.env.AGENTUITY_OTLP_URL || buildRegionalURL(resolvedRegion, 'otel'),
|
|
22
39
|
sandbox: process.env.AGENTUITY_SANDBOX_URL || transportUrl,
|
|
23
40
|
};
|
|
24
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export * from './api';
|
|
3
3
|
|
|
4
4
|
// config.ts exports
|
|
5
|
-
export { type ServiceUrls, getServiceUrls } from './config';
|
|
5
|
+
export { type ServiceUrls, getServiceUrls, resolveRegion } from './config';
|
|
6
6
|
|
|
7
7
|
// logger.ts exports
|
|
8
8
|
export { type ColorScheme, ConsoleLogger, createLogger } from './logger';
|
package/src/schema.ts
CHANGED
|
@@ -13,7 +13,9 @@ export const toJSONSchema = (schema: any): JSONSchema => {
|
|
|
13
13
|
return agentuityToJSONSchema(schema);
|
|
14
14
|
}
|
|
15
15
|
// Check if it's a Zod schema
|
|
16
|
-
|
|
16
|
+
// Zod 3 uses _def.typeName (e.g., "ZodObject")
|
|
17
|
+
// Zod 4 uses _def.type (e.g., "object")
|
|
18
|
+
if (schema?._def?.typeName || schema?._def?.type) {
|
|
17
19
|
try {
|
|
18
20
|
return z.toJSONSchema(schema) as JSONSchema;
|
|
19
21
|
} catch {
|