@agent-relay/sandbox 0.0.0 → 0.1.1
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/README.md +8 -4
- package/dist/daytona/runtime.d.ts +118 -0
- package/dist/daytona/runtime.d.ts.map +1 -0
- package/dist/daytona/runtime.js +811 -0
- package/dist/daytona/runtime.js.map +1 -0
- package/dist/e2b/runtime.d.ts +167 -0
- package/dist/e2b/runtime.d.ts.map +1 -0
- package/dist/e2b/runtime.js +362 -0
- package/dist/e2b/runtime.js.map +1 -0
- package/dist/index.d.ts +26 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/local/runtime.d.ts +63 -0
- package/dist/local/runtime.d.ts.map +1 -0
- package/dist/local/runtime.js +315 -0
- package/dist/local/runtime.js.map +1 -0
- package/dist/mount-script.d.ts +162 -0
- package/dist/mount-script.d.ts.map +1 -0
- package/dist/mount-script.js +461 -0
- package/dist/mount-script.js.map +1 -0
- package/dist/orchestrator.d.ts +110 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +553 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/port.d.ts +126 -0
- package/dist/port.d.ts.map +1 -0
- package/dist/port.js +35 -0
- package/dist/port.js.map +1 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +16 -1
package/README.md
CHANGED
|
@@ -53,10 +53,14 @@ Requires Node.js 20 or newer.
|
|
|
53
53
|
|
|
54
54
|
## Releasing
|
|
55
55
|
|
|
56
|
-
Publishing is manual-dispatch only, via the `Publish` workflow
|
|
57
|
-
dry run
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
Publishing is manual-dispatch only, via the `Publish` workflow, and defaults to
|
|
57
|
+
a dry run. Nothing publishes automatically on push or merge.
|
|
58
|
+
|
|
59
|
+
Authentication is npm OIDC trusted publishing — there is no publish token to
|
|
60
|
+
store. A real publish requires the repository owner to register this repository
|
|
61
|
+
and workflow as a trusted publisher for the package on npmjs.org; releases carry
|
|
62
|
+
[provenance](https://docs.npmjs.com/generating-provenance-statements) attesting
|
|
63
|
+
the commit and workflow they were built from.
|
|
60
64
|
|
|
61
65
|
## License
|
|
62
66
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Daytona, Sandbox } from '@daytonaio/sdk';
|
|
2
|
+
import type { ExecOptions, ExecResult, AsyncExecStartResult, AsyncExecStatus, LaunchOptions, RuntimeCapabilities, RuntimeHandle, WorkflowRuntime } from '../types.js';
|
|
3
|
+
export interface DaytonaRuntimeOptions {
|
|
4
|
+
daytona: Daytona;
|
|
5
|
+
snapshot?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Home directory inside the sandbox image. Required: it is image-specific,
|
|
8
|
+
* so there is no default that is correct for every consumer.
|
|
9
|
+
*/
|
|
10
|
+
defaultHomeDir: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class SnapshotNotFoundError extends Error {
|
|
13
|
+
readonly snapshot: string;
|
|
14
|
+
constructor(snapshot: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
export interface DaytonaAttachedSandboxOptions {
|
|
17
|
+
homeDir?: string;
|
|
18
|
+
workdir?: string;
|
|
19
|
+
owned?: boolean;
|
|
20
|
+
states?: readonly string[] | null;
|
|
21
|
+
}
|
|
22
|
+
export interface DaytonaFindByLabelsOptions extends DaytonaAttachedSandboxOptions {
|
|
23
|
+
states?: readonly string[] | null;
|
|
24
|
+
limit?: number;
|
|
25
|
+
/** @deprecated Use limit. */
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
/** Sandbox IDs to skip before performing the per-ID rehydration request. */
|
|
28
|
+
excludeIds?: readonly string[];
|
|
29
|
+
/** Total deadline for listing, rehydration, and home-directory resolution. */
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface DaytonaCountByLabelsOptions {
|
|
33
|
+
states?: readonly string[] | null;
|
|
34
|
+
limit?: number;
|
|
35
|
+
/** @deprecated Use limit. */
|
|
36
|
+
pageSize?: number;
|
|
37
|
+
/** Stop counting once this total is reached. */
|
|
38
|
+
maxCount?: number;
|
|
39
|
+
/** Total deadline for cursor iteration. */
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface DaytonaRunScriptOptions extends ExecOptions {
|
|
43
|
+
command: string;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
useSession?: boolean;
|
|
46
|
+
suppressInputEcho?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface DaytonaRunScriptResult {
|
|
49
|
+
output: string;
|
|
50
|
+
stdout?: string;
|
|
51
|
+
stderr?: string;
|
|
52
|
+
exitCode: number | null;
|
|
53
|
+
cmdId?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DaytonaBundleFile {
|
|
56
|
+
source: string | Buffer;
|
|
57
|
+
destination: string;
|
|
58
|
+
}
|
|
59
|
+
export interface DaytonaUploadBundleOptions {
|
|
60
|
+
files: DaytonaBundleFile[];
|
|
61
|
+
manifest?: unknown;
|
|
62
|
+
manifestPath?: string;
|
|
63
|
+
}
|
|
64
|
+
export declare class DaytonaRuntime implements WorkflowRuntime {
|
|
65
|
+
readonly id = "daytona";
|
|
66
|
+
readonly capabilities: RuntimeCapabilities;
|
|
67
|
+
private readonly sandboxes;
|
|
68
|
+
private readonly daytona;
|
|
69
|
+
private readonly snapshot?;
|
|
70
|
+
private readonly defaultHomeDir;
|
|
71
|
+
constructor(options: DaytonaRuntimeOptions);
|
|
72
|
+
launch(options?: LaunchOptions): Promise<RuntimeHandle>;
|
|
73
|
+
launchDetached(options?: LaunchOptions): Promise<RuntimeHandle>;
|
|
74
|
+
getById(id: string, options?: DaytonaAttachedSandboxOptions): Promise<RuntimeHandle | null>;
|
|
75
|
+
findByLabels(labels: Record<string, string>, options?: DaytonaFindByLabelsOptions): Promise<RuntimeHandle | null>;
|
|
76
|
+
countByLabels(labels: Record<string, string>, options?: DaytonaCountByLabelsOptions): Promise<number>;
|
|
77
|
+
findAllByLabels(labels: Record<string, string>, options?: DaytonaFindByLabelsOptions): Promise<RuntimeHandle[]>;
|
|
78
|
+
attachSandbox(sandbox: Sandbox, options?: DaytonaAttachedSandboxOptions): RuntimeHandle;
|
|
79
|
+
exec(handle: RuntimeHandle, command: string, options?: ExecOptions): Promise<ExecResult>;
|
|
80
|
+
runScript(handle: RuntimeHandle, options: DaytonaRunScriptOptions): Promise<DaytonaRunScriptResult>;
|
|
81
|
+
startScript(handle: RuntimeHandle, options: DaytonaRunScriptOptions): Promise<AsyncExecStartResult>;
|
|
82
|
+
getScriptStatus(handle: RuntimeHandle, sessionId: string, commandId: string): Promise<AsyncExecStatus>;
|
|
83
|
+
getScriptLogs(handle: RuntimeHandle, sessionId: string, commandId: string): Promise<DaytonaRunScriptResult>;
|
|
84
|
+
startExec(handle: RuntimeHandle, command: string, options?: ExecOptions & {
|
|
85
|
+
sessionId?: string;
|
|
86
|
+
}): Promise<AsyncExecStartResult>;
|
|
87
|
+
getExecStatus(handle: RuntimeHandle, sessionId: string, commandId: string): Promise<AsyncExecStatus>;
|
|
88
|
+
getExecLogs(handle: RuntimeHandle, sessionId: string, commandId: string): Promise<ExecResult>;
|
|
89
|
+
uploadFile(handle: RuntimeHandle, source: string | Buffer, destination: string): Promise<void>;
|
|
90
|
+
uploadBundle(handle: RuntimeHandle, options: DaytonaUploadBundleOptions): Promise<void>;
|
|
91
|
+
downloadFile(handle: RuntimeHandle, source: string, destination?: string): Promise<Buffer | void>;
|
|
92
|
+
getHomeDir(handle: RuntimeHandle): Promise<string>;
|
|
93
|
+
destroy(handle: RuntimeHandle): Promise<void>;
|
|
94
|
+
stop(handle: RuntimeHandle): Promise<void>;
|
|
95
|
+
start(handle: RuntimeHandle): Promise<RuntimeHandle>;
|
|
96
|
+
private createSandbox;
|
|
97
|
+
private createSandboxDetached;
|
|
98
|
+
private buildCreateParams;
|
|
99
|
+
private buildCreateOptions;
|
|
100
|
+
private createWithOptions;
|
|
101
|
+
private createDetachedWithOptions;
|
|
102
|
+
private listSandboxes;
|
|
103
|
+
private registerSandbox;
|
|
104
|
+
private requireSandbox;
|
|
105
|
+
private supportsSessionExec;
|
|
106
|
+
private buildScriptCommand;
|
|
107
|
+
private scriptLogPath;
|
|
108
|
+
private scriptStatusPath;
|
|
109
|
+
private matchesState;
|
|
110
|
+
private readSandboxState;
|
|
111
|
+
private uploadParentDirectories;
|
|
112
|
+
private uploadDestinations;
|
|
113
|
+
private ensureUploadParentDirectories;
|
|
114
|
+
private verifyUploadedBundleFiles;
|
|
115
|
+
private resolveHomeDir;
|
|
116
|
+
private msToSeconds;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/daytona/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAsB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAQ9C;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CA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