@agentuity/server 0.1.10 → 0.1.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/api/org/resources.d.ts +3 -0
- package/dist/api/org/resources.d.ts.map +1 -1
- package/dist/api/org/resources.js +1 -0
- package/dist/api/org/resources.js.map +1 -1
- package/dist/api/project/deploy.d.ts.map +1 -1
- package/dist/api/project/deploy.js +3 -1
- package/dist/api/project/deploy.js.map +1 -1
- package/dist/api/region/create.d.ts +18 -0
- package/dist/api/region/create.d.ts.map +1 -1
- package/dist/api/region/create.js +123 -0
- package/dist/api/region/create.js.map +1 -1
- package/dist/api/sandbox/create.d.ts.map +1 -1
- package/dist/api/sandbox/create.js +11 -0
- package/dist/api/sandbox/create.js.map +1 -1
- package/dist/api/sandbox/files.d.ts.map +1 -1
- package/dist/api/sandbox/files.js +9 -1
- 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 +6 -0
- package/dist/api/sandbox/get.js.map +1 -1
- package/dist/api/sandbox/index.d.ts +4 -2
- package/dist/api/sandbox/index.d.ts.map +1 -1
- package/dist/api/sandbox/index.js +2 -1
- package/dist/api/sandbox/index.js.map +1 -1
- package/dist/api/sandbox/list.d.ts.map +1 -1
- package/dist/api/sandbox/list.js +9 -0
- package/dist/api/sandbox/list.js.map +1 -1
- package/dist/api/sandbox/snapshot-build.d.ts +31 -0
- package/dist/api/sandbox/snapshot-build.d.ts.map +1 -0
- package/dist/api/sandbox/snapshot-build.js +48 -0
- package/dist/api/sandbox/snapshot-build.js.map +1 -0
- package/dist/api/sandbox/snapshot.d.ts +129 -47
- package/dist/api/sandbox/snapshot.d.ts.map +1 -1
- package/dist/api/sandbox/snapshot.js +144 -0
- package/dist/api/sandbox/snapshot.js.map +1 -1
- package/dist/api/sandbox/util.d.ts +4 -0
- package/dist/api/sandbox/util.d.ts.map +1 -1
- package/dist/api/sandbox/util.js.map +1 -1
- package/dist/api/session/get.d.ts +1 -1
- package/dist/api/session/get.js +1 -1
- package/dist/api/session/get.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/package.json +4 -4
- package/src/api/org/resources.ts +1 -0
- package/src/api/project/deploy.ts +3 -1
- package/src/api/region/create.ts +130 -1
- package/src/api/sandbox/create.ts +11 -0
- package/src/api/sandbox/files.ts +9 -1
- package/src/api/sandbox/get.ts +6 -0
- package/src/api/sandbox/index.ts +14 -1
- package/src/api/sandbox/list.ts +9 -0
- package/src/api/sandbox/snapshot-build.ts +62 -0
- package/src/api/sandbox/snapshot.ts +177 -48
- package/src/api/sandbox/util.ts +2 -0
- package/src/api/session/get.ts +1 -1
- package/src/config.ts +1 -1
|
@@ -38,6 +38,11 @@ const SnapshotInfoSchema = z
|
|
|
38
38
|
.nullable()
|
|
39
39
|
.optional()
|
|
40
40
|
.describe('List of files in the snapshot'),
|
|
41
|
+
userMetadata: z
|
|
42
|
+
.record(z.string(), z.string())
|
|
43
|
+
.nullable()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('User-defined metadata key-value pairs'),
|
|
41
46
|
})
|
|
42
47
|
.describe('Detailed information about a snapshot');
|
|
43
48
|
|
|
@@ -52,60 +57,56 @@ const SnapshotListDataSchema = z
|
|
|
52
57
|
const SnapshotListResponseSchema = APIResponseSchema(SnapshotListDataSchema);
|
|
53
58
|
const SnapshotDeleteResponseSchema = APIResponseSchemaNoData();
|
|
54
59
|
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface SnapshotInfo {
|
|
61
|
-
snapshotId: string;
|
|
62
|
-
runtimeId?: string | null;
|
|
63
|
-
name: string;
|
|
64
|
-
description?: string | null;
|
|
65
|
-
tag?: string | null;
|
|
66
|
-
sizeBytes: number;
|
|
67
|
-
fileCount: number;
|
|
68
|
-
parentSnapshotId?: string | null;
|
|
69
|
-
createdAt: string;
|
|
70
|
-
downloadUrl?: string;
|
|
71
|
-
files?: SnapshotFileInfo[] | null;
|
|
72
|
-
}
|
|
60
|
+
export type SnapshotFileInfo = z.infer<typeof SnapshotFileInfoSchema>;
|
|
61
|
+
export type SnapshotInfo = z.infer<typeof SnapshotInfoSchema>;
|
|
62
|
+
export type SnapshotListResponse = z.infer<typeof SnapshotListDataSchema>;
|
|
73
63
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
const _SnapshotCreateParamsSchema = z
|
|
65
|
+
.object({
|
|
66
|
+
sandboxId: z.string().describe('ID of the sandbox to snapshot'),
|
|
67
|
+
name: z.string().optional().describe('Display name for the snapshot'),
|
|
68
|
+
description: z.string().optional().describe('Description of the snapshot'),
|
|
69
|
+
tag: z.string().optional().describe('Tag for the snapshot'),
|
|
70
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
71
|
+
})
|
|
72
|
+
.describe('Parameters for creating a snapshot');
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
const _SnapshotGetParamsSchema = z
|
|
75
|
+
.object({
|
|
76
|
+
snapshotId: z.string().describe('ID of the snapshot to retrieve'),
|
|
77
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
78
|
+
})
|
|
79
|
+
.describe('Parameters for getting a snapshot');
|
|
86
80
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
const _SnapshotListParamsSchema = z
|
|
82
|
+
.object({
|
|
83
|
+
sandboxId: z.string().optional().describe('Filter by sandbox ID'),
|
|
84
|
+
limit: z.number().optional().describe('Maximum number of snapshots to return'),
|
|
85
|
+
offset: z.number().optional().describe('Number of snapshots to skip'),
|
|
86
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
87
|
+
})
|
|
88
|
+
.describe('Parameters for listing snapshots');
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
const _SnapshotDeleteParamsSchema = z
|
|
91
|
+
.object({
|
|
92
|
+
snapshotId: z.string().describe('ID of the snapshot to delete'),
|
|
93
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
94
|
+
})
|
|
95
|
+
.describe('Parameters for deleting a snapshot');
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
const _SnapshotTagParamsSchema = z
|
|
98
|
+
.object({
|
|
99
|
+
snapshotId: z.string().describe('ID of the snapshot to tag'),
|
|
100
|
+
tag: z.string().nullable().describe('New tag (or null to remove)'),
|
|
101
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
102
|
+
})
|
|
103
|
+
.describe('Parameters for tagging a snapshot');
|
|
103
104
|
|
|
104
|
-
export
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
export type SnapshotCreateParams = z.infer<typeof _SnapshotCreateParamsSchema>;
|
|
106
|
+
export type SnapshotGetParams = z.infer<typeof _SnapshotGetParamsSchema>;
|
|
107
|
+
export type SnapshotListParams = z.infer<typeof _SnapshotListParamsSchema>;
|
|
108
|
+
export type SnapshotDeleteParams = z.infer<typeof _SnapshotDeleteParamsSchema>;
|
|
109
|
+
export type SnapshotTagParams = z.infer<typeof _SnapshotTagParamsSchema>;
|
|
109
110
|
|
|
110
111
|
function buildQueryString(params: Record<string, string | number | undefined>): string {
|
|
111
112
|
const query = new URLSearchParams();
|
|
@@ -267,3 +268,131 @@ export async function snapshotTag(
|
|
|
267
268
|
|
|
268
269
|
throw new SandboxResponseError({ message: resp.message });
|
|
269
270
|
}
|
|
271
|
+
|
|
272
|
+
// ===== Snapshot Build API =====
|
|
273
|
+
|
|
274
|
+
const _SnapshotBuildInitParamsSchema = z
|
|
275
|
+
.object({
|
|
276
|
+
runtime: z.string().describe('Runtime identifier (name:tag or runtime ID)'),
|
|
277
|
+
name: z.string().optional().describe('Display name for the snapshot'),
|
|
278
|
+
tag: z.string().optional().describe('Tag for the snapshot'),
|
|
279
|
+
description: z.string().optional().describe('Description of the snapshot'),
|
|
280
|
+
contentHash: z
|
|
281
|
+
.string()
|
|
282
|
+
.optional()
|
|
283
|
+
.describe('SHA-256 hash of snapshot content for change detection'),
|
|
284
|
+
force: z.boolean().optional().describe('Force rebuild even if content is unchanged'),
|
|
285
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
286
|
+
})
|
|
287
|
+
.describe('Parameters for initializing a snapshot build');
|
|
288
|
+
|
|
289
|
+
const SnapshotBuildInitResponseSchema = z
|
|
290
|
+
.object({
|
|
291
|
+
snapshotId: z.string().optional().describe('Unique identifier for the snapshot being built'),
|
|
292
|
+
uploadUrl: z
|
|
293
|
+
.string()
|
|
294
|
+
.optional()
|
|
295
|
+
.describe('Pre-signed URL for uploading the snapshot archive'),
|
|
296
|
+
s3Key: z.string().optional().describe('S3 key where the snapshot will be stored'),
|
|
297
|
+
unchanged: z.boolean().optional().describe('True if snapshot content is unchanged'),
|
|
298
|
+
existingId: z.string().optional().describe('ID of existing unchanged snapshot'),
|
|
299
|
+
existingName: z.string().optional().describe('Name of existing unchanged snapshot'),
|
|
300
|
+
existingTag: z.string().optional().describe('Tag of existing unchanged snapshot'),
|
|
301
|
+
})
|
|
302
|
+
.describe('Response from snapshot build init API');
|
|
303
|
+
|
|
304
|
+
const SnapshotBuildInitAPIResponseSchema = APIResponseSchema(SnapshotBuildInitResponseSchema);
|
|
305
|
+
|
|
306
|
+
const _SnapshotBuildFinalizeParamsSchema = z
|
|
307
|
+
.object({
|
|
308
|
+
snapshotId: z.string().describe('Snapshot ID from init response'),
|
|
309
|
+
sizeBytes: z.number().describe('Total size of the snapshot in bytes'),
|
|
310
|
+
fileCount: z.number().describe('Number of files in the snapshot'),
|
|
311
|
+
files: z.array(SnapshotFileInfoSchema).describe('List of files with path and size'),
|
|
312
|
+
dependencies: z.array(z.string()).optional().describe('List of apt packages to install'),
|
|
313
|
+
env: z.record(z.string(), z.string()).optional().describe('Environment variables to set'),
|
|
314
|
+
metadata: z
|
|
315
|
+
.record(z.string(), z.string())
|
|
316
|
+
.optional()
|
|
317
|
+
.describe('User-defined metadata key-value pairs'),
|
|
318
|
+
orgId: z.string().optional().describe('Organization ID'),
|
|
319
|
+
})
|
|
320
|
+
.describe('Parameters for finalizing a snapshot build');
|
|
321
|
+
|
|
322
|
+
export type SnapshotBuildInitParams = z.infer<typeof _SnapshotBuildInitParamsSchema>;
|
|
323
|
+
export type SnapshotBuildInitResponse = z.infer<typeof SnapshotBuildInitResponseSchema>;
|
|
324
|
+
export type SnapshotBuildFinalizeParams = z.infer<typeof _SnapshotBuildFinalizeParamsSchema>;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Initialize a snapshot build by getting a presigned upload URL.
|
|
328
|
+
*
|
|
329
|
+
* @param client - The API client to use for the request
|
|
330
|
+
* @param params - Parameters including runtime and optional name/tag/description
|
|
331
|
+
* @returns Snapshot ID and presigned upload URL
|
|
332
|
+
* @throws {SandboxResponseError} If the initialization fails
|
|
333
|
+
*/
|
|
334
|
+
export async function snapshotBuildInit(
|
|
335
|
+
client: APIClient,
|
|
336
|
+
params: SnapshotBuildInitParams
|
|
337
|
+
): Promise<SnapshotBuildInitResponse> {
|
|
338
|
+
const { runtime, name, description, tag, contentHash, force, orgId } = params;
|
|
339
|
+
const queryString = buildQueryString({ orgId });
|
|
340
|
+
const url = `/sandbox/${API_VERSION}/snapshots/build${queryString}`;
|
|
341
|
+
|
|
342
|
+
const body: Record<string, string | boolean> = { runtime };
|
|
343
|
+
if (name) body.name = name;
|
|
344
|
+
if (description) body.description = description;
|
|
345
|
+
if (tag) body.tag = tag;
|
|
346
|
+
if (contentHash) body.contentHash = contentHash;
|
|
347
|
+
if (force) body.force = force;
|
|
348
|
+
|
|
349
|
+
const resp = await client.post<z.infer<typeof SnapshotBuildInitAPIResponseSchema>>(
|
|
350
|
+
url,
|
|
351
|
+
body,
|
|
352
|
+
SnapshotBuildInitAPIResponseSchema
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
if (resp.success) {
|
|
356
|
+
return resp.data;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
throw new SandboxResponseError({ message: resp.message });
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Finalize a snapshot build after uploading the archive.
|
|
364
|
+
*
|
|
365
|
+
* @param client - The API client to use for the request
|
|
366
|
+
* @param params - Parameters including snapshot details and file metadata
|
|
367
|
+
* @returns The created snapshot information
|
|
368
|
+
* @throws {SandboxResponseError} If the finalization fails
|
|
369
|
+
*/
|
|
370
|
+
export async function snapshotBuildFinalize(
|
|
371
|
+
client: APIClient,
|
|
372
|
+
params: SnapshotBuildFinalizeParams
|
|
373
|
+
): Promise<SnapshotInfo> {
|
|
374
|
+
const { snapshotId, sizeBytes, fileCount, files, dependencies, env, metadata, orgId } = params;
|
|
375
|
+
const queryString = buildQueryString({ orgId });
|
|
376
|
+
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}/finalize${queryString}`;
|
|
377
|
+
|
|
378
|
+
const body: Record<string, unknown> = {
|
|
379
|
+
sizeBytes,
|
|
380
|
+
fileCount,
|
|
381
|
+
files,
|
|
382
|
+
};
|
|
383
|
+
if (dependencies) body.dependencies = dependencies;
|
|
384
|
+
if (env) body.env = env;
|
|
385
|
+
if (metadata) body.metadata = metadata;
|
|
386
|
+
|
|
387
|
+
const resp = await client.post<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
388
|
+
url,
|
|
389
|
+
body,
|
|
390
|
+
SnapshotGetResponseSchema
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
if (resp.success) {
|
|
394
|
+
return resp.data;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
throw new SandboxResponseError({ message: resp.message });
|
|
398
|
+
}
|
package/src/api/sandbox/util.ts
CHANGED
|
@@ -15,6 +15,8 @@ export const SandboxResponseError = StructuredError('SandboxResponseError')<{
|
|
|
15
15
|
sandboxId?: string;
|
|
16
16
|
/** The execution ID associated with the error, if applicable */
|
|
17
17
|
executionId?: string;
|
|
18
|
+
/** The session ID (trace ID) from the x-session-id response header for OTel correlation */
|
|
19
|
+
sessionId?: string | null;
|
|
18
20
|
}>();
|
|
19
21
|
|
|
20
22
|
/** Current sandbox API version */
|
package/src/api/session/get.ts
CHANGED
|
@@ -14,7 +14,7 @@ const EvalRunSchema = z.object({
|
|
|
14
14
|
pending: z.boolean().describe('pending status'),
|
|
15
15
|
success: z.boolean().describe('success status'),
|
|
16
16
|
error: z.string().nullable().describe('error message'),
|
|
17
|
-
result: z.string().nullable().describe('result
|
|
17
|
+
result: z.record(z.string(), z.unknown()).nullable().describe('result object'),
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export interface SpanNode {
|
package/src/config.ts
CHANGED