@clearideas/agent-runtime-sandbox 0.4.3 → 0.6.0
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 +20 -2
- package/assets/agent-fs.py +555 -0
- package/dist/bubblewrap.d.ts +59 -0
- package/dist/bubblewrap.js +408 -0
- package/dist/contracts.d.ts +21 -0
- package/dist/contracts.js +3 -0
- package/dist/docker.d.ts +3 -1
- package/dist/docker.js +31 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/policy.d.ts +114 -0
- package/dist/policy.js +649 -0
- package/dist/run-sandbox.d.ts +69 -0
- package/dist/run-sandbox.js +852 -0
- package/dist/testing/host-process-provider.d.ts +28 -0
- package/dist/testing/host-process-provider.js +153 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +1 -0
- package/package.json +8 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { SandboxCommandRecord, ToolCall } from "@clearideas/agent-runtime-contracts";
|
|
2
|
+
import type { AgentTool, ResolvedWorkspace, RunSandboxOpenRequest, RunSandboxProvider, RunSandboxSession } from "@clearideas/agent-runtime-core";
|
|
3
|
+
import { type SandboxProvider } from "./contracts.js";
|
|
4
|
+
import { type RunSandboxCommandEntry, type RunSandboxLimitOverrides, type RunSandboxPolicy, type RunSandboxShellPolicy } from "./policy.js";
|
|
5
|
+
import type { SandboxRuntimeProfile } from "./provider-adapter.js";
|
|
6
|
+
export interface RunSandboxHelperOptions {
|
|
7
|
+
/** Argv used to invoke the helper inside the sandbox. */
|
|
8
|
+
command?: string[];
|
|
9
|
+
/** Host path of a replacement helper; defaults to the bundled script. */
|
|
10
|
+
source?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RunSandboxHostHooks {
|
|
13
|
+
authorizeSandbox?(input: {
|
|
14
|
+
runId: string;
|
|
15
|
+
attempt: number;
|
|
16
|
+
image: string;
|
|
17
|
+
/** Attached (bound read-only) mounts are not enumerated and omit fileCount. */
|
|
18
|
+
mounts: Array<{
|
|
19
|
+
alias: string;
|
|
20
|
+
mode: string;
|
|
21
|
+
fileCount?: number;
|
|
22
|
+
attached: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
}): void | Promise<void>;
|
|
25
|
+
authorizeCommand?(input: {
|
|
26
|
+
record: Pick<SandboxCommandRecord, "kind" | "name" | "policyEntry" | "argv" | "cwd" | "alias" | "workspace">;
|
|
27
|
+
toolCall?: ToolCall;
|
|
28
|
+
}, context: {
|
|
29
|
+
runId: string;
|
|
30
|
+
stepId: string;
|
|
31
|
+
attempt: number;
|
|
32
|
+
}): void | Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export interface ProviderRunSandboxOptions extends RunSandboxHostHooks {
|
|
35
|
+
provider: SandboxProvider;
|
|
36
|
+
/** Image (or provider-specific environment name) for the run sandbox. */
|
|
37
|
+
image: string;
|
|
38
|
+
helper?: RunSandboxHelperOptions;
|
|
39
|
+
commands?: Record<string, RunSandboxCommandEntry> | undefined;
|
|
40
|
+
shell?: Partial<RunSandboxShellPolicy> | undefined;
|
|
41
|
+
limits?: RunSandboxLimitOverrides | undefined;
|
|
42
|
+
/** Runtime profiles for code steps executed in the run sandbox. */
|
|
43
|
+
profiles?: SandboxRuntimeProfile[];
|
|
44
|
+
/** Environment variable names a code step may forward. */
|
|
45
|
+
allowedEnvironment?: string[];
|
|
46
|
+
/** Disable provider-native read-only attachments. */
|
|
47
|
+
attach?: "auto" | "never";
|
|
48
|
+
now?: () => Date;
|
|
49
|
+
}
|
|
50
|
+
export declare const bundledHelperPath: () => string;
|
|
51
|
+
declare class RunSandboxExecutionError extends Error {
|
|
52
|
+
readonly code: string;
|
|
53
|
+
constructor(code: string, message: string);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Opens one provider-backed sandbox per run attempt, stages bound
|
|
57
|
+
* workspaces, executes every workspace command under the host policy, syncs
|
|
58
|
+
* read-write mounts back to their stores after each command, and reports
|
|
59
|
+
* everything through run events and command records.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ProviderRunSandbox implements RunSandboxProvider {
|
|
62
|
+
#private;
|
|
63
|
+
constructor(options: ProviderRunSandboxOptions);
|
|
64
|
+
get policy(): RunSandboxPolicy;
|
|
65
|
+
tools(workspace: ResolvedWorkspace): Promise<AgentTool[]>;
|
|
66
|
+
validate(request: Omit<RunSandboxOpenRequest, "emit" | "artifacts">): Promise<void>;
|
|
67
|
+
open(request: RunSandboxOpenRequest): Promise<RunSandboxSession>;
|
|
68
|
+
}
|
|
69
|
+
export { RunSandboxExecutionError };
|