@agentuity/server 0.1.14 → 0.1.16
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/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/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/index.d.ts +1 -1
- package/dist/api/sandbox/index.d.ts.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/package.json +5 -5
- package/src/api/org/env-delete.ts +40 -0
- package/src/api/org/env-get.ts +46 -0
- package/src/api/org/env-update.ts +41 -0
- package/src/api/org/index.ts +3 -0
- package/src/api/sandbox/client.ts +86 -1
- package/src/api/sandbox/index.ts +1 -1
- package/src/api/sandbox/runtime.ts +15 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient } from '../api';
|
|
3
|
+
declare const _OrgEnvDeleteRequestSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
env: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
|
+
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
type OrgEnvDeleteRequest = z.infer<typeof _OrgEnvDeleteRequestSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* Delete environment variables and/or secrets from an organization.
|
|
11
|
+
* Provide arrays of keys to delete.
|
|
12
|
+
* Requires admin/owner role.
|
|
13
|
+
*/
|
|
14
|
+
export declare function orgEnvDelete(client: APIClient, request: OrgEnvDeleteRequest): Promise<void>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=env-delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-delete.d.ts","sourceRoot":"","sources":["../../../src/api/org/env-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAA2B,MAAM,QAAQ,CAAC;AAG5D,QAAA,MAAM,0BAA0B;;;;iBAI9B,CAAC;AAIH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAGtE;;;;GAIG;AACH,wBAAsB,YAAY,CACjC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchemaNoData } from '../api';
|
|
3
|
+
import { OrgResponseError } from './util';
|
|
4
|
+
const _OrgEnvDeleteRequestSchema = z.object({
|
|
5
|
+
id: z.string().describe('the organization id'),
|
|
6
|
+
env: z.array(z.string()).optional().describe('environment variable keys to delete'),
|
|
7
|
+
secrets: z.array(z.string()).optional().describe('secret keys to delete'),
|
|
8
|
+
});
|
|
9
|
+
const OrgEnvDeleteResponseSchema = APIResponseSchemaNoData();
|
|
10
|
+
/**
|
|
11
|
+
* Delete environment variables and/or secrets from an organization.
|
|
12
|
+
* Provide arrays of keys to delete.
|
|
13
|
+
* Requires admin/owner role.
|
|
14
|
+
*/
|
|
15
|
+
export async function orgEnvDelete(client, request) {
|
|
16
|
+
const { id, env, secrets } = request;
|
|
17
|
+
const resp = await client.request('DELETE', `/cli/organization/${id}/env`, OrgEnvDeleteResponseSchema, {
|
|
18
|
+
env,
|
|
19
|
+
secrets,
|
|
20
|
+
});
|
|
21
|
+
if (!resp.success) {
|
|
22
|
+
throw new OrgResponseError({ message: resp.message ?? 'failed to delete org env' });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=env-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-delete.js","sourceRoot":"","sources":["../../../src/api/org/env-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC9C,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACnF,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;CACzE,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,uBAAuB,EAAE,CAAC;AAK7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,MAAiB,EACjB,OAA4B;IAE5B,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAErC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAChC,QAAQ,EACR,qBAAqB,EAAE,MAAM,EAC7B,0BAA0B,EAC1B;QACC,GAAG;QACH,OAAO;KACP,CACD,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,0BAA0B,EAAE,CAAC,CAAC;IACrF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient } from '../api';
|
|
3
|
+
declare const OrgEnvDataSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
|
+
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
interface OrgEnvGetRequest {
|
|
9
|
+
id: string;
|
|
10
|
+
mask?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type OrgEnv = z.infer<typeof OrgEnvDataSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* Get environment variables and secrets for an organization.
|
|
15
|
+
* Secrets are masked by default unless mask=false is specified.
|
|
16
|
+
* Note: Unmasked values require admin/owner role.
|
|
17
|
+
*/
|
|
18
|
+
export declare function orgEnvGet(client: APIClient, request: OrgEnvGetRequest): Promise<OrgEnv>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=env-get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-get.d.ts","sourceRoot":"","sources":["../../../src/api/org/env-get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAqB,MAAM,QAAQ,CAAC;AAGtD,QAAA,MAAM,gBAAgB;;;;iBAIpB,CAAC;AAIH,UAAU,gBAAgB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAGD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEtD;;;;GAIG;AACH,wBAAsB,SAAS,CAC9B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchema } from '../api';
|
|
3
|
+
import { OrgResponseError } from './util';
|
|
4
|
+
const OrgEnvDataSchema = z.object({
|
|
5
|
+
id: z.string().describe('the organization id'),
|
|
6
|
+
env: z.record(z.string(), z.string()).optional().describe('environment variables'),
|
|
7
|
+
secrets: z.record(z.string(), z.string()).optional().describe('secrets (may be masked)'),
|
|
8
|
+
});
|
|
9
|
+
const OrgEnvGetResponseSchema = APIResponseSchema(OrgEnvDataSchema);
|
|
10
|
+
/**
|
|
11
|
+
* Get environment variables and secrets for an organization.
|
|
12
|
+
* Secrets are masked by default unless mask=false is specified.
|
|
13
|
+
* Note: Unmasked values require admin/owner role.
|
|
14
|
+
*/
|
|
15
|
+
export async function orgEnvGet(client, request) {
|
|
16
|
+
const { id, mask = true } = request;
|
|
17
|
+
const resp = await client.get(`/cli/organization/${id}/env?mask=${mask}`, OrgEnvGetResponseSchema);
|
|
18
|
+
if (!resp.success) {
|
|
19
|
+
throw new OrgResponseError({ message: resp.message ?? 'failed to get org env' });
|
|
20
|
+
}
|
|
21
|
+
if (!resp.data) {
|
|
22
|
+
throw new OrgResponseError({ message: 'failed to get org env: no data returned' });
|
|
23
|
+
}
|
|
24
|
+
return resp.data;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=env-get.js.map
|
|
@@ -0,0 +1 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C;QAChB,MAAM,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient } from '../api';
|
|
3
|
+
declare const _OrgEnvUpdateRequestSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
|
+
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
type OrgEnvUpdateRequest = z.infer<typeof _OrgEnvUpdateRequestSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* Update environment variables and/or secrets for an organization.
|
|
11
|
+
* This will merge the provided env/secrets with existing values.
|
|
12
|
+
* Requires admin/owner role.
|
|
13
|
+
* Keys starting with 'AGENTUITY_' (except AGENTUITY_PUBLIC_) are filtered out.
|
|
14
|
+
*/
|
|
15
|
+
export declare function orgEnvUpdate(client: APIClient, request: OrgEnvUpdateRequest): Promise<void>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=env-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-update.d.ts","sourceRoot":"","sources":["../../../src/api/org/env-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAA2B,MAAM,QAAQ,CAAC;AAG5D,QAAA,MAAM,0BAA0B;;;;iBAI9B,CAAC;AAIH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAGtE;;;;;GAKG;AACH,wBAAsB,YAAY,CACjC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchemaNoData } from '../api';
|
|
3
|
+
import { OrgResponseError } from './util';
|
|
4
|
+
const _OrgEnvUpdateRequestSchema = z.object({
|
|
5
|
+
id: z.string().describe('the organization id'),
|
|
6
|
+
env: z.record(z.string(), z.string()).optional().describe('environment variables to set/update'),
|
|
7
|
+
secrets: z.record(z.string(), z.string()).optional().describe('secrets to set/update'),
|
|
8
|
+
});
|
|
9
|
+
const OrgEnvUpdateResponseSchema = APIResponseSchemaNoData();
|
|
10
|
+
/**
|
|
11
|
+
* Update environment variables and/or secrets for an organization.
|
|
12
|
+
* This will merge the provided env/secrets with existing values.
|
|
13
|
+
* Requires admin/owner role.
|
|
14
|
+
* Keys starting with 'AGENTUITY_' (except AGENTUITY_PUBLIC_) are filtered out.
|
|
15
|
+
*/
|
|
16
|
+
export async function orgEnvUpdate(client, request) {
|
|
17
|
+
const { id, env, secrets } = request;
|
|
18
|
+
const resp = await client.request('PUT', `/cli/organization/${id}/env`, OrgEnvUpdateResponseSchema, {
|
|
19
|
+
env,
|
|
20
|
+
secrets,
|
|
21
|
+
});
|
|
22
|
+
if (!resp.success) {
|
|
23
|
+
throw new OrgResponseError({ message: resp.message ?? 'failed to update org env' });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=env-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-update.js","sourceRoot":"","sources":["../../../src/api/org/env-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC9C,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAChG,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;CACtF,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,uBAAuB,EAAE,CAAC;AAK7D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,MAAiB,EACjB,OAA4B;IAE5B,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAErC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAChC,KAAK,EACL,qBAAqB,EAAE,MAAM,EAC7B,0BAA0B,EAC1B;QACC,GAAG;QACH,OAAO;KACP,CACD,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,0BAA0B,EAAE,CAAC,CAAC;IACrF,CAAC;AACF,CAAC"}
|
package/dist/api/org/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
package/dist/api/org/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Logger, SandboxCreateOptions, SandboxInfo, ExecuteOptions as CoreExecuteOptions, Execution, FileToWrite } from '@agentuity/core';
|
|
2
|
-
import type { Writable } from 'node:stream';
|
|
1
|
+
import type { Logger, SandboxCreateOptions, SandboxInfo, ExecuteOptions as CoreExecuteOptions, Execution, FileToWrite, SandboxRunOptions, SandboxRunResult } from '@agentuity/core';
|
|
2
|
+
import type { Readable, Writable } from 'node:stream';
|
|
3
3
|
import { type SandboxCreateResponse } from './create';
|
|
4
4
|
/**
|
|
5
5
|
* Extended execute options that support piping output to writable streams
|
|
@@ -36,6 +36,31 @@ export interface SandboxClientOptions {
|
|
|
36
36
|
*/
|
|
37
37
|
logger?: Logger;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* I/O options for one-shot sandbox execution via run()
|
|
41
|
+
*/
|
|
42
|
+
export interface SandboxClientRunIO {
|
|
43
|
+
/**
|
|
44
|
+
* AbortSignal to cancel the execution
|
|
45
|
+
*/
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
/**
|
|
48
|
+
* Readable stream for stdin input
|
|
49
|
+
*/
|
|
50
|
+
stdin?: Readable;
|
|
51
|
+
/**
|
|
52
|
+
* Writable stream for stdout output
|
|
53
|
+
*/
|
|
54
|
+
stdout?: Writable;
|
|
55
|
+
/**
|
|
56
|
+
* Writable stream for stderr output
|
|
57
|
+
*/
|
|
58
|
+
stderr?: Writable;
|
|
59
|
+
/**
|
|
60
|
+
* Optional logger override for this run
|
|
61
|
+
*/
|
|
62
|
+
logger?: Logger;
|
|
63
|
+
}
|
|
39
64
|
/**
|
|
40
65
|
* A sandbox instance returned by SandboxClient.create()
|
|
41
66
|
*/
|
|
@@ -74,15 +99,44 @@ export interface SandboxInstance {
|
|
|
74
99
|
*
|
|
75
100
|
* @example
|
|
76
101
|
* ```typescript
|
|
102
|
+
* // Interactive sandbox usage
|
|
77
103
|
* const client = new SandboxClient();
|
|
78
104
|
* const sandbox = await client.create();
|
|
79
105
|
* const result = await sandbox.execute({ command: ['echo', 'hello'] });
|
|
80
106
|
* await sandbox.destroy();
|
|
107
|
+
*
|
|
108
|
+
* // One-shot execution with streaming
|
|
109
|
+
* const result = await client.run(
|
|
110
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
111
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
112
|
+
* );
|
|
81
113
|
* ```
|
|
82
114
|
*/
|
|
83
115
|
export declare class SandboxClient {
|
|
84
116
|
#private;
|
|
85
117
|
constructor(options?: SandboxClientOptions);
|
|
118
|
+
/**
|
|
119
|
+
* Run a one-shot command in a new sandbox (creates, executes, destroys)
|
|
120
|
+
*
|
|
121
|
+
* This is a high-level convenience method that handles the full lifecycle:
|
|
122
|
+
* creating a sandbox, streaming I/O, polling for completion, and cleanup.
|
|
123
|
+
*
|
|
124
|
+
* @param options - Execution options including command and configuration
|
|
125
|
+
* @param io - Optional I/O streams and abort signal
|
|
126
|
+
* @returns The run result including exit code and duration
|
|
127
|
+
* @throws {Error} If stdin is provided without an API key
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const client = new SandboxClient();
|
|
132
|
+
* const result = await client.run(
|
|
133
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
134
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
135
|
+
* );
|
|
136
|
+
* console.log('Exit code:', result.exitCode);
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
run(options: SandboxRunOptions, io?: SandboxClientRunIO): Promise<SandboxRunResult>;
|
|
86
140
|
/**
|
|
87
141
|
* Create a new sandbox instance
|
|
88
142
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,cAAc,IAAI,kBAAkB,EACpC,SAAS,EACT,WAAW,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,cAAc,IAAI,kBAAkB,EACpC,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAkFrE;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACzD;;OAEG;IACH,IAAI,CAAC,EAAE;QACN,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;KAClB,CAAC;CACF;AAED,M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,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IA2EtE;;;;;OAKG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlD;;;;OAIG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;;OAOG;IACG,UAAU,CACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,EAAE,EACpB,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC;IAUlB;;;;;;;OAOG;IACG,QAAQ,CACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;CAQtC"}
|
|
@@ -4,6 +4,7 @@ import { sandboxDestroy } from './destroy';
|
|
|
4
4
|
import { sandboxGet } from './get';
|
|
5
5
|
import { sandboxExecute } from './execute';
|
|
6
6
|
import { sandboxWriteFiles, sandboxReadFile } from './files';
|
|
7
|
+
import { sandboxRun } from './run';
|
|
7
8
|
import { executionGet } from './execution';
|
|
8
9
|
import { ConsoleLogger } from '../../logger';
|
|
9
10
|
import { getServiceUrls } from '../../config';
|
|
@@ -66,15 +67,25 @@ async function pipeStreamToWritable(streamUrl, writable) {
|
|
|
66
67
|
*
|
|
67
68
|
* @example
|
|
68
69
|
* ```typescript
|
|
70
|
+
* // Interactive sandbox usage
|
|
69
71
|
* const client = new SandboxClient();
|
|
70
72
|
* const sandbox = await client.create();
|
|
71
73
|
* const result = await sandbox.execute({ command: ['echo', 'hello'] });
|
|
72
74
|
* await sandbox.destroy();
|
|
75
|
+
*
|
|
76
|
+
* // One-shot execution with streaming
|
|
77
|
+
* const result = await client.run(
|
|
78
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
79
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
80
|
+
* );
|
|
73
81
|
* ```
|
|
74
82
|
*/
|
|
75
83
|
export class SandboxClient {
|
|
76
84
|
#client;
|
|
77
85
|
#orgId;
|
|
86
|
+
#apiKey;
|
|
87
|
+
#region;
|
|
88
|
+
#logger;
|
|
78
89
|
constructor(options = {}) {
|
|
79
90
|
const apiKey = options.apiKey || process.env.AGENTUITY_SDK_KEY || process.env.AGENTUITY_CLI_KEY;
|
|
80
91
|
const region = process.env.AGENTUITY_REGION ?? 'usc';
|
|
@@ -87,6 +98,46 @@ export class SandboxClient {
|
|
|
87
98
|
const logger = options.logger ?? new ConsoleLogger('warn');
|
|
88
99
|
this.#client = new APIClient(url, logger, apiKey ?? '', {});
|
|
89
100
|
this.#orgId = options.orgId;
|
|
101
|
+
this.#apiKey = apiKey;
|
|
102
|
+
this.#region = region;
|
|
103
|
+
this.#logger = logger;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Run a one-shot command in a new sandbox (creates, executes, destroys)
|
|
107
|
+
*
|
|
108
|
+
* This is a high-level convenience method that handles the full lifecycle:
|
|
109
|
+
* creating a sandbox, streaming I/O, polling for completion, and cleanup.
|
|
110
|
+
*
|
|
111
|
+
* @param options - Execution options including command and configuration
|
|
112
|
+
* @param io - Optional I/O streams and abort signal
|
|
113
|
+
* @returns The run result including exit code and duration
|
|
114
|
+
* @throws {Error} If stdin is provided without an API key
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const client = new SandboxClient();
|
|
119
|
+
* const result = await client.run(
|
|
120
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
121
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
122
|
+
* );
|
|
123
|
+
* console.log('Exit code:', result.exitCode);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
async run(options, io = {}) {
|
|
127
|
+
if (io.stdin && !this.#apiKey) {
|
|
128
|
+
throw new Error('SandboxClient.run(): stdin streaming requires an API key');
|
|
129
|
+
}
|
|
130
|
+
return sandboxRun(this.#client, {
|
|
131
|
+
options,
|
|
132
|
+
orgId: this.#orgId,
|
|
133
|
+
region: this.#region,
|
|
134
|
+
apiKey: this.#apiKey,
|
|
135
|
+
signal: io.signal,
|
|
136
|
+
stdin: io.stdin,
|
|
137
|
+
stdout: io.stdout,
|
|
138
|
+
stderr: io.stderr,
|
|
139
|
+
logger: io.logger ?? this.#logger,
|
|
140
|
+
});
|
|
90
141
|
}
|
|
91
142
|
/**
|
|
92
143
|
* Create a new sandbox instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/sandbox/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/sandbox/client.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,aAAa,EAA8B,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,YAAY;AAE7C;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAC9B,MAAiB,EACjB,WAAmB,EACnB,KAAc,EACd,MAAoB;IAEpB,MAAM,SAAS,GAAG,IAAI,CA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AE;YACpC,SAAS;YACT,IAAI;YACJ,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,MAAM;SACN,CAAC,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -16,7 +16,7 @@ export { executionGet, executionList } from './execution';
|
|
|
16
16
|
export type { ExecutionInfo, ExecutionGetParams, ExecutionListParams, ExecutionListResponse, } from './execution';
|
|
17
17
|
export { SandboxResponseError, writeAndDrain } from './util';
|
|
18
18
|
export { SandboxClient } from './client';
|
|
19
|
-
export type { SandboxClientOptions, SandboxInstance, ExecuteOptions } from './client';
|
|
19
|
+
export type { SandboxClientOptions, SandboxClientRunIO, SandboxInstance, ExecuteOptions } from './client';
|
|
20
20
|
export { sandboxWriteFiles, sandboxReadFile, sandboxMkDir, sandboxRmDir, sandboxRmFile, sandboxListFiles, sandboxDownloadArchive, sandboxUploadArchive, sandboxSetEnv, } from './files';
|
|
21
21
|
export type { WriteFilesParams, WriteFilesResult, ReadFileParams, MkDirParams, RmDirParams, RmFileParams, ListFilesParams, ListFilesResult, FileInfo, ArchiveFormat, DownloadArchiveParams, UploadArchiveParams, SetEnvParams, SetEnvResult, } from './files';
|
|
22
22
|
export { snapshotCreate, snapshotGet, snapshotList, snapshotDelete, snapshotTag, snapshotBuildInit, snapshotBuildFinalize, } from './snapshot';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,YAAY,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAA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ACpB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAqB,MAAM,QAAQ,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAkB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAqB,MAAM,QAAQ,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAkB,MAAM,iBAAiB,CAAC;AAkChG,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CAyC/B"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { APIResponseSchema } from '../api';
|
|
3
3
|
import { SandboxResponseError, API_VERSION } from './util';
|
|
4
|
+
const RuntimeRequirementsSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
memory: z.string().optional().describe('Memory requirement (e.g., "1Gi")'),
|
|
7
|
+
cpu: z.string().optional().describe('CPU requirement (e.g., "1")'),
|
|
8
|
+
disk: z.string().optional().describe('Disk requirement (e.g., "500Mi")'),
|
|
9
|
+
networkEnabled: z.boolean().describe('Whether network access is enabled'),
|
|
10
|
+
})
|
|
11
|
+
.describe('Runtime resource requirements');
|
|
4
12
|
const RuntimeInfoSchema = z
|
|
5
13
|
.object({
|
|
6
14
|
id: z.string().describe('Unique runtime identifier'),
|
|
7
15
|
name: z.string().describe('Runtime name (e.g., "bun:1", "python:3.14")'),
|
|
8
16
|
description: z.string().optional().describe('Optional description'),
|
|
9
17
|
iconUrl: z.string().optional().describe('URL for runtime icon'),
|
|
18
|
+
brandColor: z.string().optional().describe('Brand color for the runtime (hex color code)'),
|
|
10
19
|
url: z.string().optional().describe('URL for runtime documentation or homepage'),
|
|
11
20
|
tags: z.array(z.string()).optional().describe('Optional tags for categorization'),
|
|
21
|
+
requirements: RuntimeRequirementsSchema.optional().describe('Runtime resource requirements'),
|
|
22
|
+
readme: z.string().optional().describe('Readme content in markdown format'),
|
|
12
23
|
})
|
|
13
24
|
.describe('Information about a sandbox runtime');
|
|
14
25
|
const ListRuntimesDataSchema = z
|
|
@@ -47,8 +58,11 @@ export async function runtimeList(client, params) {
|
|
|
47
58
|
name: r.name,
|
|
48
59
|
description: r.description,
|
|
49
60
|
iconUrl: r.iconUrl,
|
|
61
|
+
brandColor: r.brandColor,
|
|
50
62
|
url: r.url,
|
|
51
63
|
tags: r.tags,
|
|
64
|
+
requirements: r.requirements,
|
|
65
|
+
readme: r.readme,
|
|
52
66
|
})),
|
|
53
67
|
total: resp.data.total,
|
|
54
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/api/sandbox/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG3D,MAAM,iBAAiB,GAAG,CAAC;KACzB,MAAM,CAAC;IACP,EAAE,EAAE,CAAC,CAAC,MAAM,E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,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,YAAY,EAAE,CAAC,CAAC,YAAY;gBAC5B,MAAM,EAAE,CAAC,CAAC,MAAM;aAChB,CAAC,CACF;YACD,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;SACtB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"clean": "rm -rf dist",
|
|
22
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
23
23
|
"build": "bunx tsc --build --force",
|
|
24
24
|
"typecheck": "bunx tsc --noEmit",
|
|
25
25
|
"prepublishOnly": "bun run clean && bun run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agentuity/core": "0.1.
|
|
29
|
-
"@agentuity/schema": "0.1.
|
|
28
|
+
"@agentuity/core": "0.1.16",
|
|
29
|
+
"@agentuity/schema": "0.1.16",
|
|
30
30
|
"zod": "^4.3.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@agentuity/test-utils": "0.1.
|
|
33
|
+
"@agentuity/test-utils": "0.1.16",
|
|
34
34
|
"@types/bun": "latest",
|
|
35
35
|
"@types/node": "^22.0.0",
|
|
36
36
|
"bun-types": "latest",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient, APIResponseSchemaNoData } from '../api';
|
|
3
|
+
import { OrgResponseError } from './util';
|
|
4
|
+
|
|
5
|
+
const _OrgEnvDeleteRequestSchema = z.object({
|
|
6
|
+
id: z.string().describe('the organization id'),
|
|
7
|
+
env: z.array(z.string()).optional().describe('environment variable keys to delete'),
|
|
8
|
+
secrets: z.array(z.string()).optional().describe('secret keys to delete'),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const OrgEnvDeleteResponseSchema = APIResponseSchemaNoData();
|
|
12
|
+
|
|
13
|
+
type OrgEnvDeleteRequest = z.infer<typeof _OrgEnvDeleteRequestSchema>;
|
|
14
|
+
type OrgEnvDeleteResponse = z.infer<typeof OrgEnvDeleteResponseSchema>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Delete environment variables and/or secrets from an organization.
|
|
18
|
+
* Provide arrays of keys to delete.
|
|
19
|
+
* Requires admin/owner role.
|
|
20
|
+
*/
|
|
21
|
+
export async function orgEnvDelete(
|
|
22
|
+
client: APIClient,
|
|
23
|
+
request: OrgEnvDeleteRequest
|
|
24
|
+
): Promise<void> {
|
|
25
|
+
const { id, env, secrets } = request;
|
|
26
|
+
|
|
27
|
+
const resp = await client.request<OrgEnvDeleteResponse, Omit<OrgEnvDeleteRequest, 'id'>>(
|
|
28
|
+
'DELETE',
|
|
29
|
+
`/cli/organization/${id}/env`,
|
|
30
|
+
OrgEnvDeleteResponseSchema,
|
|
31
|
+
{
|
|
32
|
+
env,
|
|
33
|
+
secrets,
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (!resp.success) {
|
|
38
|
+
throw new OrgResponseError({ message: resp.message ?? 'failed to delete org env' });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient, APIResponseSchema } from '../api';
|
|
3
|
+
import { OrgResponseError } from './util';
|
|
4
|
+
|
|
5
|
+
const OrgEnvDataSchema = z.object({
|
|
6
|
+
id: z.string().describe('the organization id'),
|
|
7
|
+
env: z.record(z.string(), z.string()).optional().describe('environment variables'),
|
|
8
|
+
secrets: z.record(z.string(), z.string()).optional().describe('secrets (may be masked)'),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const OrgEnvGetResponseSchema = APIResponseSchema(OrgEnvDataSchema);
|
|
12
|
+
|
|
13
|
+
interface OrgEnvGetRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
mask?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type OrgEnvGetResponse = z.infer<typeof OrgEnvGetResponseSchema>;
|
|
18
|
+
|
|
19
|
+
export type OrgEnv = z.infer<typeof OrgEnvDataSchema>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get environment variables and secrets for an organization.
|
|
23
|
+
* Secrets are masked by default unless mask=false is specified.
|
|
24
|
+
* Note: Unmasked values require admin/owner role.
|
|
25
|
+
*/
|
|
26
|
+
export async function orgEnvGet(
|
|
27
|
+
client: APIClient,
|
|
28
|
+
request: OrgEnvGetRequest
|
|
29
|
+
): Promise<OrgEnv> {
|
|
30
|
+
const { id, mask = true } = request;
|
|
31
|
+
|
|
32
|
+
const resp = await client.get<OrgEnvGetResponse>(
|
|
33
|
+
`/cli/organization/${id}/env?mask=${mask}`,
|
|
34
|
+
OrgEnvGetResponseSchema
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (!resp.success) {
|
|
38
|
+
throw new OrgResponseError({ message: resp.message ?? 'failed to get org env' });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!resp.data) {
|
|
42
|
+
throw new OrgResponseError({ message: 'failed to get org env: no data returned' });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return resp.data;
|
|
46
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient, APIResponseSchemaNoData } from '../api';
|
|
3
|
+
import { OrgResponseError } from './util';
|
|
4
|
+
|
|
5
|
+
const _OrgEnvUpdateRequestSchema = z.object({
|
|
6
|
+
id: z.string().describe('the organization id'),
|
|
7
|
+
env: z.record(z.string(), z.string()).optional().describe('environment variables to set/update'),
|
|
8
|
+
secrets: z.record(z.string(), z.string()).optional().describe('secrets to set/update'),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const OrgEnvUpdateResponseSchema = APIResponseSchemaNoData();
|
|
12
|
+
|
|
13
|
+
type OrgEnvUpdateRequest = z.infer<typeof _OrgEnvUpdateRequestSchema>;
|
|
14
|
+
type OrgEnvUpdateResponse = z.infer<typeof OrgEnvUpdateResponseSchema>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Update environment variables and/or secrets for an organization.
|
|
18
|
+
* This will merge the provided env/secrets with existing values.
|
|
19
|
+
* Requires admin/owner role.
|
|
20
|
+
* Keys starting with 'AGENTUITY_' (except AGENTUITY_PUBLIC_) are filtered out.
|
|
21
|
+
*/
|
|
22
|
+
export async function orgEnvUpdate(
|
|
23
|
+
client: APIClient,
|
|
24
|
+
request: OrgEnvUpdateRequest
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
const { id, env, secrets } = request;
|
|
27
|
+
|
|
28
|
+
const resp = await client.request<OrgEnvUpdateResponse, Omit<OrgEnvUpdateRequest, 'id'>>(
|
|
29
|
+
'PUT',
|
|
30
|
+
`/cli/organization/${id}/env`,
|
|
31
|
+
OrgEnvUpdateResponseSchema,
|
|
32
|
+
{
|
|
33
|
+
env,
|
|
34
|
+
secrets,
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (!resp.success) {
|
|
39
|
+
throw new OrgResponseError({ message: resp.message ?? 'failed to update org env' });
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/api/org/index.ts
CHANGED
|
@@ -5,14 +5,17 @@ import type {
|
|
|
5
5
|
ExecuteOptions as CoreExecuteOptions,
|
|
6
6
|
Execution,
|
|
7
7
|
FileToWrite,
|
|
8
|
+
SandboxRunOptions,
|
|
9
|
+
SandboxRunResult,
|
|
8
10
|
} from '@agentuity/core';
|
|
9
|
-
import type { Writable } from 'node:stream';
|
|
11
|
+
import type { Readable, Writable } from 'node:stream';
|
|
10
12
|
import { APIClient } from '../api';
|
|
11
13
|
import { sandboxCreate, type SandboxCreateResponse } from './create';
|
|
12
14
|
import { sandboxDestroy } from './destroy';
|
|
13
15
|
import { sandboxGet } from './get';
|
|
14
16
|
import { sandboxExecute } from './execute';
|
|
15
17
|
import { sandboxWriteFiles, sandboxReadFile } from './files';
|
|
18
|
+
import { sandboxRun } from './run';
|
|
16
19
|
import { executionGet, type ExecutionInfo } from './execution';
|
|
17
20
|
import { ConsoleLogger } from '../../logger';
|
|
18
21
|
import { getServiceUrls } from '../../config';
|
|
@@ -129,6 +132,36 @@ export interface SandboxClientOptions {
|
|
|
129
132
|
logger?: Logger;
|
|
130
133
|
}
|
|
131
134
|
|
|
135
|
+
/**
|
|
136
|
+
* I/O options for one-shot sandbox execution via run()
|
|
137
|
+
*/
|
|
138
|
+
export interface SandboxClientRunIO {
|
|
139
|
+
/**
|
|
140
|
+
* AbortSignal to cancel the execution
|
|
141
|
+
*/
|
|
142
|
+
signal?: AbortSignal;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Readable stream for stdin input
|
|
146
|
+
*/
|
|
147
|
+
stdin?: Readable;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Writable stream for stdout output
|
|
151
|
+
*/
|
|
152
|
+
stdout?: Writable;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Writable stream for stderr output
|
|
156
|
+
*/
|
|
157
|
+
stderr?: Writable;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Optional logger override for this run
|
|
161
|
+
*/
|
|
162
|
+
logger?: Logger;
|
|
163
|
+
}
|
|
164
|
+
|
|
132
165
|
/**
|
|
133
166
|
* A sandbox instance returned by SandboxClient.create()
|
|
134
167
|
*/
|
|
@@ -174,15 +207,25 @@ export interface SandboxInstance {
|
|
|
174
207
|
*
|
|
175
208
|
* @example
|
|
176
209
|
* ```typescript
|
|
210
|
+
* // Interactive sandbox usage
|
|
177
211
|
* const client = new SandboxClient();
|
|
178
212
|
* const sandbox = await client.create();
|
|
179
213
|
* const result = await sandbox.execute({ command: ['echo', 'hello'] });
|
|
180
214
|
* await sandbox.destroy();
|
|
215
|
+
*
|
|
216
|
+
* // One-shot execution with streaming
|
|
217
|
+
* const result = await client.run(
|
|
218
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
219
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
220
|
+
* );
|
|
181
221
|
* ```
|
|
182
222
|
*/
|
|
183
223
|
export class SandboxClient {
|
|
184
224
|
readonly #client: APIClient;
|
|
185
225
|
readonly #orgId?: string;
|
|
226
|
+
readonly #apiKey?: string;
|
|
227
|
+
readonly #region: string;
|
|
228
|
+
readonly #logger: Logger;
|
|
186
229
|
|
|
187
230
|
constructor(options: SandboxClientOptions = {}) {
|
|
188
231
|
const apiKey =
|
|
@@ -202,6 +245,48 @@ export class SandboxClient {
|
|
|
202
245
|
|
|
203
246
|
this.#client = new APIClient(url, logger, apiKey ?? '', {});
|
|
204
247
|
this.#orgId = options.orgId;
|
|
248
|
+
this.#apiKey = apiKey;
|
|
249
|
+
this.#region = region;
|
|
250
|
+
this.#logger = logger;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Run a one-shot command in a new sandbox (creates, executes, destroys)
|
|
255
|
+
*
|
|
256
|
+
* This is a high-level convenience method that handles the full lifecycle:
|
|
257
|
+
* creating a sandbox, streaming I/O, polling for completion, and cleanup.
|
|
258
|
+
*
|
|
259
|
+
* @param options - Execution options including command and configuration
|
|
260
|
+
* @param io - Optional I/O streams and abort signal
|
|
261
|
+
* @returns The run result including exit code and duration
|
|
262
|
+
* @throws {Error} If stdin is provided without an API key
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* const client = new SandboxClient();
|
|
267
|
+
* const result = await client.run(
|
|
268
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
269
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
270
|
+
* );
|
|
271
|
+
* console.log('Exit code:', result.exitCode);
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
async run(options: SandboxRunOptions, io: SandboxClientRunIO = {}): Promise<SandboxRunResult> {
|
|
275
|
+
if (io.stdin && !this.#apiKey) {
|
|
276
|
+
throw new Error('SandboxClient.run(): stdin streaming requires an API key');
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return sandboxRun(this.#client, {
|
|
280
|
+
options,
|
|
281
|
+
orgId: this.#orgId,
|
|
282
|
+
region: this.#region,
|
|
283
|
+
apiKey: this.#apiKey,
|
|
284
|
+
signal: io.signal,
|
|
285
|
+
stdin: io.stdin,
|
|
286
|
+
stdout: io.stdout,
|
|
287
|
+
stderr: io.stderr,
|
|
288
|
+
logger: io.logger ?? this.#logger,
|
|
289
|
+
});
|
|
205
290
|
}
|
|
206
291
|
|
|
207
292
|
/**
|
package/src/api/sandbox/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type {
|
|
|
21
21
|
} from './execution';
|
|
22
22
|
export { SandboxResponseError, writeAndDrain } from './util';
|
|
23
23
|
export { SandboxClient } from './client';
|
|
24
|
-
export type { SandboxClientOptions, SandboxInstance, ExecuteOptions } from './client';
|
|
24
|
+
export type { SandboxClientOptions, SandboxClientRunIO, SandboxInstance, ExecuteOptions } from './client';
|
|
25
25
|
export {
|
|
26
26
|
sandboxWriteFiles,
|
|
27
27
|
sandboxReadFile,
|
|
@@ -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,
|