secure-exec 0.2.1-rc.1 → 0.2.20

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.
Files changed (59) hide show
  1. package/README.md +129 -5
  2. package/dist/index.d.ts +11 -14
  3. package/dist/index.js +11 -10
  4. package/dist/npm.d.ts +20 -0
  5. package/dist/npm.js +26 -0
  6. package/dist/runtime.d.ts +32 -30
  7. package/dist/runtime.js +104 -67
  8. package/dist/typescript.d.ts +12 -0
  9. package/dist/typescript.js +13 -0
  10. package/package.json +52 -54
  11. package/LICENSE +0 -191
  12. package/dist/bridge-loader.d.ts +0 -1
  13. package/dist/bridge-loader.js +0 -2
  14. package/dist/bridge-setup.d.ts +0 -1
  15. package/dist/bridge-setup.js +0 -2
  16. package/dist/esm-compiler.d.ts +0 -1
  17. package/dist/esm-compiler.js +0 -2
  18. package/dist/fs-helpers.d.ts +0 -2
  19. package/dist/fs-helpers.js +0 -1
  20. package/dist/module-resolver.d.ts +0 -1
  21. package/dist/module-resolver.js +0 -2
  22. package/dist/node/bridge-setup.d.ts +0 -1
  23. package/dist/node/bridge-setup.js +0 -2
  24. package/dist/node/driver.d.ts +0 -2
  25. package/dist/node/driver.js +0 -2
  26. package/dist/node/execution-driver.d.ts +0 -2
  27. package/dist/node/execution-driver.js +0 -2
  28. package/dist/node/isolate-bootstrap.d.ts +0 -2
  29. package/dist/node/isolate-bootstrap.js +0 -1
  30. package/dist/node/module-access.d.ts +0 -2
  31. package/dist/node/module-access.js +0 -2
  32. package/dist/node/module-resolver.d.ts +0 -1
  33. package/dist/node/module-resolver.js +0 -2
  34. package/dist/package-bundler.d.ts +0 -2
  35. package/dist/package-bundler.js +0 -1
  36. package/dist/polyfills.d.ts +0 -1
  37. package/dist/polyfills.js +0 -2
  38. package/dist/runtime-driver.d.ts +0 -1
  39. package/dist/runtime-driver.js +0 -1
  40. package/dist/shared/api-types.d.ts +0 -1
  41. package/dist/shared/api-types.js +0 -1
  42. package/dist/shared/bridge-contract.d.ts +0 -2
  43. package/dist/shared/bridge-contract.js +0 -1
  44. package/dist/shared/console-formatter.d.ts +0 -2
  45. package/dist/shared/console-formatter.js +0 -1
  46. package/dist/shared/errors.d.ts +0 -2
  47. package/dist/shared/errors.js +0 -1
  48. package/dist/shared/esm-utils.d.ts +0 -1
  49. package/dist/shared/esm-utils.js +0 -2
  50. package/dist/shared/global-exposure.d.ts +0 -2
  51. package/dist/shared/global-exposure.js +0 -1
  52. package/dist/shared/in-memory-fs.d.ts +0 -1
  53. package/dist/shared/in-memory-fs.js +0 -2
  54. package/dist/shared/permissions.d.ts +0 -1
  55. package/dist/shared/permissions.js +0 -2
  56. package/dist/shared/require-setup.d.ts +0 -1
  57. package/dist/shared/require-setup.js +0 -2
  58. package/dist/types.d.ts +0 -3
  59. package/dist/types.js +0 -1
package/README.md CHANGED
@@ -1,7 +1,131 @@
1
- # Secure Exec
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/rivet-dev/agentos/main/.github/media/secure-exec-logo.png" alt="Secure Exec" height="160" />
3
+ </p>
2
4
 
3
- Secure Node.js execution without a sandbox. V8 isolate-based code execution with full Node.js and npm compatibility.
5
+ <p align="center">
6
+ Secure Node.js execution without a sandbox.<br/>Run untrusted JavaScript and TypeScript in an isolated VM with real Node.js APIs, npm packages, and a virtual filesystem.<br/>Powered by <a href="https://rivet.dev/agentos">agentOS</a>.
7
+ </p>
4
8
 
5
- - [Website](https://secureexec.dev)
6
- - [Documentation](https://secureexec.dev/docs)
7
- - [GitHub](https://github.com/rivet-dev/secure-exec)
9
+ <p align="center">
10
+ <a href="https://rivet.dev/secure-exec/docs/quickstart">Quickstart</a> | <a href="https://rivet.dev/secure-exec/docs">Documentation</a> | <a href="https://rivet.dev/discord">Discord</a>
11
+ </p>
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install secure-exec
17
+ ```
18
+
19
+ Requires Node.js 22+ on Linux or macOS.
20
+
21
+ ## Run Code
22
+
23
+ Each call runs in a fresh VM that is disposed when the call finishes. Nothing is
24
+ shared between calls.
25
+
26
+ ```ts
27
+ import { evaluate, execute } from "secure-exec";
28
+
29
+ const sum = await evaluate<number>("1 + 2");
30
+ if (sum.outcome === "succeeded") console.log(sum.value); // 3
31
+
32
+ const run = await execute(`console.log("hello")`, {
33
+ output: { capture: "all" },
34
+ timeoutMs: 5_000,
35
+ });
36
+ console.log(run.stdout); // hello
37
+ ```
38
+
39
+ `evaluate` takes one expression and returns its JSON value; wrap several
40
+ statements in a function. `execute` runs a whole module for its side effects.
41
+
42
+ `outcome` is `succeeded`, `failed`, `cancelled`, or `timed_out`. Every outcome
43
+ other than `succeeded` carries an `error`, and guest stack traces arrive on
44
+ `stderr` when you capture it.
45
+
46
+ ## Configure the VM
47
+
48
+ VM options go on the call: `permissions`, `limits`, `mounts`, and the rest of
49
+ the agentOS VM options. The network is denied unless you allow it, and a policy
50
+ is merged over the defaults.
51
+
52
+ ```ts
53
+ await evaluate(
54
+ `(async () => {
55
+ const response = await fetch("https://example.com");
56
+ await response.text();
57
+ return response.status;
58
+ })()`,
59
+ { permissions: { network: "allow" } },
60
+ );
61
+ ```
62
+
63
+ ## Keep state with a context
64
+
65
+ A context is a dedicated VM that keeps variables, imports, files, and installed
66
+ packages between calls. JavaScript and TypeScript share the same state.
67
+
68
+ ```ts
69
+ import { createContext, execute } from "secure-exec";
70
+ import { evaluate } from "secure-exec/typescript";
71
+
72
+ await using context = await createContext({ permissions: { network: "allow" } });
73
+
74
+ await execute("globalThis.total = 40", { context });
75
+ const result = await evaluate<number>("(globalThis.total as number) + 2", { context });
76
+
77
+ await context.reset(); // clear state, keep the VM
78
+ ```
79
+
80
+ Without `await using`, call `context.dispose()` when you are done.
81
+
82
+ ## TypeScript
83
+
84
+ `secure-exec/typescript` has the same `execute` and `evaluate`, plus `check`.
85
+ Running TypeScript strips types without checking them, so check first when it
86
+ matters.
87
+
88
+ ```ts
89
+ import { check, evaluate } from "secure-exec/typescript";
90
+
91
+ const checked = await check(`const total: number = "nope";`);
92
+ for (const diagnostic of checked.diagnostics) console.log(diagnostic.message);
93
+ ```
94
+
95
+ ## npm
96
+
97
+ `secure-exec/npm` installs packages into a context's VM.
98
+
99
+ ```ts
100
+ import { createContext, evaluate } from "secure-exec";
101
+ import { install } from "secure-exec/npm";
102
+
103
+ await using context = await createContext({ permissions: { network: "allow" } });
104
+ await install(["zod"], { context });
105
+
106
+ // Packages install into /workspace. Inline code resolves imports from
107
+ // `filePath`, so place it next to node_modules.
108
+ await evaluate(`import("zod").then(({ z }) => z.string().parse("ok"))`, {
109
+ context,
110
+ filePath: "/workspace/main.mjs",
111
+ });
112
+ ```
113
+
114
+ `runScript` and `runPackage` work like `npm run` and `npx`.
115
+
116
+ ## Warm up
117
+
118
+ The first call starts a shared sidecar process. Call `init()` at startup to pay
119
+ that cost ahead of time.
120
+
121
+ ```ts
122
+ import { init } from "secure-exec";
123
+
124
+ await init();
125
+ ```
126
+
127
+ ## More
128
+
129
+ For processes, filesystem access, Python, and agent sessions, use
130
+ [`@rivet-dev/agentos-core`](https://rivet.dev/agentos) directly. Read the [documentation](https://rivet.dev/secure-exec/docs), or browse the examples in
131
+ [`secure-exec/examples`](https://github.com/rivet-dev/agentos/tree/main/secure-exec/examples).
package/dist/index.d.ts CHANGED
@@ -1,14 +1,11 @@
1
- export { NodeRuntime } from "./runtime.js";
2
- export type { NodeRuntimeOptions } from "./runtime.js";
3
- export type { ResourceBudgets } from "./runtime-driver.js";
4
- export type { NodeRuntimeDriver, NodeRuntimeDriverFactory, NetworkAdapter, Permissions, VirtualFileSystem, } from "./types.js";
5
- export type { DirEntry, StatInfo } from "./fs-helpers.js";
6
- export type { StdioChannel, StdioEvent, StdioHook, ExecOptions, ExecResult, OSConfig, ProcessConfig, RunResult, TimingMitigation, } from "./shared/api-types.js";
7
- export { createDefaultNetworkAdapter, createNodeDriver, createNodeHostCommandExecutor, createNodeRuntimeDriverFactory, NodeExecutionDriver, NodeFileSystem, } from "@secure-exec/nodejs";
8
- export type { DefaultNetworkAdapterOptions, ModuleAccessOptions, NodeRuntimeDriverFactoryOptions, } from "@secure-exec/nodejs";
9
- export { createKernel } from "@secure-exec/core";
10
- export type { Kernel, KernelInterface } from "@secure-exec/core";
11
- export { createNodeRuntime } from "@secure-exec/nodejs";
12
- export type { BindingTree, BindingFunction } from "@secure-exec/nodejs";
13
- export { createInMemoryFileSystem } from "./shared/in-memory-fs.js";
14
- export { allowAll, allowAllChildProcess, allowAllEnv, allowAllFs, allowAllNetwork, } from "./shared/permissions.js";
1
+ import type { CodeEvaluationResult, CodeExecutionResult, JavaScriptEvaluationOptions, JavaScriptExecutionOptions, JsonValue } from "@rivet-dev/agentos-core";
2
+ import { type Target } from "./runtime.js";
3
+ export type { CodeEvaluationResult, CodeExecutionResult, ExecutionErrorData, ExecutionOutputOptions, JsonValue, LimitWarning, MountConfig, OutputCapture, Permissions, } from "@rivet-dev/agentos-core";
4
+ export { createHostDirBackend, nodeModulesMount, } from "@rivet-dev/agentos-core";
5
+ export { type Context, createContext, init, type Target, type VmOptions, } from "./runtime.js";
6
+ export type ExecuteOptions = Omit<JavaScriptExecutionOptions, "contextId"> & Target;
7
+ export type EvaluateOptions = Omit<JavaScriptEvaluationOptions, "contextId"> & Target;
8
+ /** Run JavaScript for its side effects and captured output. */
9
+ export declare function execute(source: string, options?: ExecuteOptions): Promise<CodeExecutionResult>;
10
+ /** Evaluate one JavaScript expression and return its JSON value. */
11
+ export declare function evaluate<T = JsonValue>(source: string, options?: EvaluateOptions): Promise<CodeEvaluationResult<T>>;
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
- // Re-export core runtime surface.
2
- export { NodeRuntime } from "./runtime.js";
3
- // Re-export Node driver factories.
4
- export { createDefaultNetworkAdapter, createNodeDriver, createNodeHostCommandExecutor, createNodeRuntimeDriverFactory, NodeExecutionDriver, NodeFileSystem, } from "@secure-exec/nodejs";
5
- // Re-export kernel API.
6
- export { createKernel } from "@secure-exec/core";
7
- // Re-export kernel Node runtime factory.
8
- export { createNodeRuntime } from "@secure-exec/nodejs";
9
- export { createInMemoryFileSystem } from "./shared/in-memory-fs.js";
10
- export { allowAll, allowAllChildProcess, allowAllEnv, allowAllFs, allowAllNetwork, } from "./shared/permissions.js";
1
+ import { run } from "./runtime.js";
2
+ export { createHostDirBackend, nodeModulesMount, } from "@rivet-dev/agentos-core";
3
+ export { createContext, init, } from "./runtime.js";
4
+ /** Run JavaScript for its side effects and captured output. */
5
+ export function execute(source, options) {
6
+ return run(options, (vm, operationOptions) => vm.javascript.execute(source, operationOptions));
7
+ }
8
+ /** Evaluate one JavaScript expression and return its JSON value. */
9
+ export function evaluate(source, options) {
10
+ return run(options, (vm, operationOptions) => vm.javascript.evaluate(source, operationOptions));
11
+ }
package/dist/npm.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { CodeExecutionResult, LanguageExecutionOptions, NpmPackageInstallOptions, NpmProjectInstallOptions } from "@rivet-dev/agentos-core";
2
+ import { type Context } from "./runtime.js";
3
+ type InContext<O> = Omit<O, "contextId"> & {
4
+ context: Context;
5
+ };
6
+ export type InstallProjectOptions = InContext<NpmProjectInstallOptions>;
7
+ export type InstallPackagesOptions = InContext<NpmPackageInstallOptions>;
8
+ export type RunScriptOptions = InContext<LanguageExecutionOptions>;
9
+ export type RunPackageOptions = InContext<LanguageExecutionOptions & {
10
+ binary?: string;
11
+ }>;
12
+ /** Install the dependencies of the `package.json` in the context's working directory. */
13
+ export declare function install(options: InstallProjectOptions): Promise<CodeExecutionResult>;
14
+ /** Install packages into the context's VM. */
15
+ export declare function install(packages: string | string[], options: InstallPackagesOptions): Promise<CodeExecutionResult>;
16
+ /** Run a `package.json` script, like `npm run`. */
17
+ export declare function runScript(script: string, options: RunScriptOptions): Promise<CodeExecutionResult>;
18
+ /** Run a package's binary, like `npx`. */
19
+ export declare function runPackage(packageSpec: string, options: RunPackageOptions): Promise<CodeExecutionResult>;
20
+ export {};
package/dist/npm.js ADDED
@@ -0,0 +1,26 @@
1
+ import { contextVm } from "./runtime.js";
2
+ export function install(packagesOrOptions, packageOptions) {
3
+ if (typeof packagesOrOptions === "string" ||
4
+ Array.isArray(packagesOrOptions)) {
5
+ const { context, ...options } = requireContext(packageOptions);
6
+ return contextVm(context).javascript.npm.install(packagesOrOptions, options);
7
+ }
8
+ const { context, ...options } = requireContext(packagesOrOptions);
9
+ return contextVm(context).javascript.npm.install(options);
10
+ }
11
+ /** Run a `package.json` script, like `npm run`. */
12
+ export function runScript(script, options) {
13
+ const { context, ...rest } = requireContext(options);
14
+ return contextVm(context).javascript.npm.runScript(script, rest);
15
+ }
16
+ /** Run a package's binary, like `npx`. */
17
+ export function runPackage(packageSpec, options) {
18
+ const { context, ...rest } = requireContext(options);
19
+ return contextVm(context).javascript.npm.runPackage(packageSpec, rest);
20
+ }
21
+ function requireContext(options) {
22
+ if (!options?.context) {
23
+ throw new TypeError("npm operations require a context; create one with createContext()");
24
+ }
25
+ return options;
26
+ }
package/dist/runtime.d.ts CHANGED
@@ -1,31 +1,33 @@
1
- import type { NetworkAdapter, NodeRuntimeDriverFactory, SystemDriver } from "@secure-exec/core";
2
- import type { StdioHook, ExecOptions, ExecResult, RunResult, TimingMitigation } from "@secure-exec/core";
3
- import type { ResourceBudgets } from "@secure-exec/core";
4
- export interface NodeRuntimeOptions {
5
- systemDriver: SystemDriver;
6
- runtimeDriverFactory: NodeRuntimeDriverFactory;
7
- memoryLimit?: number;
8
- cpuTimeLimitMs?: number;
9
- timingMitigation?: TimingMitigation;
10
- onStdio?: StdioHook;
11
- payloadLimits?: {
12
- base64TransferBytes?: number;
13
- jsonPayloadBytes?: number;
14
- };
15
- resourceBudgets?: ResourceBudgets;
16
- }
17
- export declare class NodeRuntime {
18
- private readonly runtimeDriver;
19
- constructor(options: NodeRuntimeOptions);
20
- get network(): Pick<NetworkAdapter, "fetch" | "dnsLookup" | "httpRequest">;
21
- get __unsafeIsoalte(): unknown;
22
- __unsafeCreateContext(options?: {
23
- env?: Record<string, string>;
24
- cwd?: string;
25
- filePath?: string;
26
- }): Promise<unknown>;
27
- run<T = unknown>(code: string, filePath?: string): Promise<RunResult<T>>;
28
- exec(code: string, options?: ExecOptions): Promise<ExecResult>;
29
- dispose(): void;
30
- terminate(): Promise<void>;
1
+ import { AgentOs, type AgentOsOptions } from "@rivet-dev/agentos-core";
2
+ /** Options for the VM that runs the code: permissions, limits, mounts, and so on. */
3
+ export type VmOptions = AgentOsOptions;
4
+ /**
5
+ * Retained language state inside a dedicated VM. Pass it as `context` to run
6
+ * code against that state; dispose it to release the VM.
7
+ */
8
+ export interface Context extends AsyncDisposable {
9
+ readonly contextId: string;
10
+ /** Clear the retained state. The VM and its filesystem are kept. */
11
+ reset(): Promise<void>;
12
+ /** Dispose the VM that backs this context. */
13
+ dispose(): Promise<void>;
31
14
  }
15
+ /**
16
+ * Where an operation runs: in an existing context, or, when `context` is
17
+ * omitted, in a fresh VM configured by these options and disposed afterwards.
18
+ */
19
+ export type Target = ({
20
+ context: Context;
21
+ } & {
22
+ [K in keyof VmOptions]?: never;
23
+ }) | ({
24
+ context?: never;
25
+ } & VmOptions);
26
+ /** Start the shared sidecar process now so the first operation does not pay for it. */
27
+ export declare function init(): Promise<void>;
28
+ export declare function createContext(options?: VmOptions): Promise<Context>;
29
+ export declare function contextVm(context: Context): AgentOs;
30
+ /** Run `operation` in the target's context VM, or in a fresh VM disposed afterwards. */
31
+ export declare function run<O extends object, R>(options: (O & Target) | undefined, operation: (vm: AgentOs, options: O & {
32
+ contextId?: string;
33
+ }) => Promise<R>): Promise<R>;
package/dist/runtime.js CHANGED
@@ -1,77 +1,114 @@
1
- import { createNetworkStub, filterEnv } from "@secure-exec/core";
2
- import { createSandboxCommandExecutor } from "@secure-exec/nodejs";
3
- const DEFAULT_SANDBOX_CWD = "/root";
4
- const DEFAULT_SANDBOX_HOME = "/root";
5
- const DEFAULT_SANDBOX_TMPDIR = "/tmp";
6
- export class NodeRuntime {
7
- runtimeDriver;
8
- constructor(options) {
9
- const { runtimeDriverFactory } = options;
10
- // Auto-inject sandbox command executor when none is configured
11
- const systemDriver = options.systemDriver.commandExecutor
12
- ? options.systemDriver
13
- : {
14
- ...options.systemDriver,
15
- commandExecutor: createSandboxCommandExecutor(runtimeDriverFactory, options.systemDriver),
16
- };
17
- const processConfig = {
18
- ...(systemDriver.runtime.process ?? {}),
19
- };
20
- processConfig.cwd ??= DEFAULT_SANDBOX_CWD;
21
- processConfig.env = filterEnv(processConfig.env, systemDriver.permissions);
22
- const osConfig = {
23
- ...(systemDriver.runtime.os ?? {}),
24
- };
25
- osConfig.homedir ??= DEFAULT_SANDBOX_HOME;
26
- osConfig.tmpdir ??= DEFAULT_SANDBOX_TMPDIR;
27
- this.runtimeDriver = runtimeDriverFactory.createRuntimeDriver({
28
- system: systemDriver,
29
- runtime: {
30
- process: processConfig,
31
- os: osConfig,
32
- },
33
- memoryLimit: options.memoryLimit,
34
- cpuTimeLimitMs: options.cpuTimeLimitMs,
35
- timingMitigation: options.timingMitigation,
36
- onStdio: options.onStdio,
37
- payloadLimits: options.payloadLimits,
38
- resourceBudgets: options.resourceBudgets,
39
- });
1
+ import { AgentOs, } from "@rivet-dev/agentos-core";
2
+ // Keep in sync with `AgentOsOptions`. The record type makes a missing or
3
+ // unknown key a compile error.
4
+ const VM_OPTION_KEYS = Object.keys({
5
+ user: true,
6
+ software: true,
7
+ defaultSoftware: true,
8
+ loopbackExemptPorts: true,
9
+ allowedNodeBuiltins: true,
10
+ highResolutionTime: true,
11
+ database: true,
12
+ rootFilesystem: true,
13
+ mounts: true,
14
+ sandbox: true,
15
+ scheduleDriver: true,
16
+ bindings: true,
17
+ permissions: true,
18
+ sidecar: true,
19
+ limits: true,
20
+ onAgentStderr: true,
21
+ onAgentExit: true,
22
+ onLimitWarning: true,
23
+ });
24
+ // The documented agentOS baseline: everything virtualized is allowed, the
25
+ // network is denied, and a caller's policy is merged over it. The Rust client
26
+ // applies this itself; the TypeScript core client instead allows everything
27
+ // when `permissions` is omitted and denies every scope a partial policy leaves
28
+ // out, so apply it here until core matches.
29
+ const BASE_PERMISSIONS = {
30
+ fs: "allow",
31
+ network: "deny",
32
+ childProcess: "allow",
33
+ process: "allow",
34
+ env: "allow",
35
+ binding: "allow",
36
+ };
37
+ function createVm(options = {}) {
38
+ return AgentOs.create({
39
+ ...options,
40
+ permissions: { ...BASE_PERMISSIONS, ...options.permissions },
41
+ });
42
+ }
43
+ const contextVms = new WeakMap();
44
+ /** Start the shared sidecar process now so the first operation does not pay for it. */
45
+ export async function init() {
46
+ // A bare VM is enough to start the sidecar; skip projecting default software.
47
+ const vm = await createVm({ defaultSoftware: false });
48
+ await vm.dispose();
49
+ }
50
+ export async function createContext(options) {
51
+ const vm = await createVm(options);
52
+ const contextId = crypto.randomUUID();
53
+ try {
54
+ await vm.createContext(contextId);
40
55
  }
41
- get network() {
42
- const adapter = this.runtimeDriver.network ?? createNetworkStub();
43
- return {
44
- fetch: (url, options) => adapter.fetch(url, options),
45
- dnsLookup: (hostname) => adapter.dnsLookup(hostname),
46
- httpRequest: (url, options) => adapter.httpRequest(url, options),
47
- };
56
+ catch (error) {
57
+ throw await disposeAfterFailure(vm, error);
48
58
  }
49
- get __unsafeIsoalte() {
50
- if (this.runtimeDriver.unsafeIsolate === undefined) {
51
- throw new Error("Driver runtime does not expose unsafe isolate access");
52
- }
53
- return this.runtimeDriver.unsafeIsolate;
59
+ const context = {
60
+ contextId,
61
+ reset: () => vm.contexts.reset(contextId),
62
+ dispose: () => vm.dispose(),
63
+ [Symbol.asyncDispose]: () => vm.dispose(),
64
+ };
65
+ contextVms.set(context, vm);
66
+ return context;
67
+ }
68
+ export function contextVm(context) {
69
+ const vm = contextVms.get(context);
70
+ if (!vm) {
71
+ throw new TypeError("context must be created by createContext()");
54
72
  }
55
- async __unsafeCreateContext(options = {}) {
56
- if (!this.runtimeDriver.createUnsafeContext) {
57
- throw new Error("Driver runtime does not expose unsafe context creation");
73
+ return vm;
74
+ }
75
+ /** Run `operation` in the target's context VM, or in a fresh VM disposed afterwards. */
76
+ export async function run(options, operation) {
77
+ const vmOptions = {};
78
+ const operationOptions = {};
79
+ for (const [key, value] of Object.entries(options ?? {})) {
80
+ const isVmOption = VM_OPTION_KEYS.includes(key);
81
+ (isVmOption ? vmOptions : operationOptions)[key] = value;
82
+ }
83
+ const { context, ...rest } = operationOptions;
84
+ if (context) {
85
+ const configured = Object.keys(vmOptions);
86
+ if (configured.length > 0) {
87
+ throw new TypeError(`${configured.join(", ")} cannot be combined with context; pass VM options to createContext()`);
58
88
  }
59
- return this.runtimeDriver.createUnsafeContext(options);
89
+ return operation(contextVm(context), {
90
+ ...rest,
91
+ contextId: context.contextId,
92
+ });
60
93
  }
61
- async run(code, filePath) {
62
- return this.runtimeDriver.run(code, filePath);
94
+ const vm = await createVm(vmOptions);
95
+ let result;
96
+ try {
97
+ result = await operation(vm, rest);
63
98
  }
64
- async exec(code, options) {
65
- return this.runtimeDriver.exec(code, options);
99
+ catch (error) {
100
+ throw await disposeAfterFailure(vm, error);
66
101
  }
67
- dispose() {
68
- this.runtimeDriver.dispose();
102
+ await vm.dispose();
103
+ return result;
104
+ }
105
+ /** Dispose `vm` and return the error to throw, keeping both if disposal also fails. */
106
+ async function disposeAfterFailure(vm, error) {
107
+ try {
108
+ await vm.dispose();
109
+ return error;
69
110
  }
70
- async terminate() {
71
- if (this.runtimeDriver.terminate) {
72
- await this.runtimeDriver.terminate();
73
- return;
74
- }
75
- this.runtimeDriver.dispose();
111
+ catch (disposeError) {
112
+ return new AggregateError([error, disposeError], "secure-exec operation and VM cleanup failed");
76
113
  }
77
114
  }
@@ -0,0 +1,12 @@
1
+ import type { CodeEvaluationResult, CodeExecutionResult, JsonValue, TypeScriptCheckOptions, TypeScriptCheckResult, TypeScriptEvaluationOptions, TypeScriptExecutionOptions } from "@rivet-dev/agentos-core";
2
+ import { type Target } from "./runtime.js";
3
+ export type { TypeScriptCheckResult, TypeScriptDiagnostic, } from "@rivet-dev/agentos-core";
4
+ export type ExecuteOptions = Omit<TypeScriptExecutionOptions, "contextId"> & Target;
5
+ export type EvaluateOptions = Omit<TypeScriptEvaluationOptions, "contextId"> & Target;
6
+ export type CheckOptions = Omit<TypeScriptCheckOptions, "contextId"> & Target;
7
+ /** Run TypeScript for its side effects and captured output. Types are stripped, not checked. */
8
+ export declare function execute(source: string, options?: ExecuteOptions): Promise<CodeExecutionResult>;
9
+ /** Evaluate one TypeScript expression and return its JSON value. Types are stripped, not checked. */
10
+ export declare function evaluate<T = JsonValue>(source: string, options?: EvaluateOptions): Promise<CodeEvaluationResult<T>>;
11
+ /** Type-check TypeScript without running it. */
12
+ export declare function check(source: string, options?: CheckOptions): Promise<TypeScriptCheckResult>;
@@ -0,0 +1,13 @@
1
+ import { run } from "./runtime.js";
2
+ /** Run TypeScript for its side effects and captured output. Types are stripped, not checked. */
3
+ export function execute(source, options) {
4
+ return run(options, (vm, operationOptions) => vm.typescript.execute(source, operationOptions));
5
+ }
6
+ /** Evaluate one TypeScript expression and return its JSON value. Types are stripped, not checked. */
7
+ export function evaluate(source, options) {
8
+ return run(options, (vm, operationOptions) => vm.typescript.evaluate(source, operationOptions));
9
+ }
10
+ /** Type-check TypeScript without running it. */
11
+ export function check(source, options) {
12
+ return run(options, (vm, operationOptions) => vm.typescript.check(source, operationOptions));
13
+ }
package/package.json CHANGED
@@ -1,55 +1,53 @@
1
1
  {
2
- "name": "secure-exec",
3
- "version": "0.2.1-rc.1",
4
- "type": "module",
5
- "license": "Apache-2.0",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "files": [
9
- "dist",
10
- "README.md"
11
- ],
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/rivet-dev/secure-exec.git",
15
- "directory": "packages/secure-exec"
16
- },
17
- "exports": {
18
- ".": {
19
- "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js",
21
- "default": "./dist/index.js"
22
- }
23
- },
24
- "dependencies": {
25
- "@secure-exec/core": "0.2.1-rc.1",
26
- "@secure-exec/nodejs": "0.2.1-rc.1"
27
- },
28
- "devDependencies": {
29
- "@mariozechner/pi-coding-agent": "^0.60.0",
30
- "@opencode-ai/sdk": "^1.2.27",
31
- "@types/node": "^22.10.2",
32
- "@vitest/browser": "^2.1.8",
33
- "@xterm/headless": "^6.0.0",
34
- "minimatch": "^10.2.4",
35
- "node-pty": "^1.1.0",
36
- "opencode-ai": "1.3.3",
37
- "playwright": "^1.52.0",
38
- "tsx": "^4.19.2",
39
- "typescript": "^5.7.2",
40
- "vitest": "^2.1.8",
41
- "@secure-exec/v8": "0.2.1-rc.1"
42
- },
43
- "scripts": {
44
- "check-types": "tsc --noEmit",
45
- "check-types:test": "vitest --typecheck --run tests/types/",
46
- "build": "tsc",
47
- "test:test-suite": "vitest run tests/test-suite/node.test.ts",
48
- "test:runtime-driver": "vitest run tests/runtime-driver/node/",
49
- "test:integration:node": "pnpm run test:test-suite && pnpm run test:runtime-driver",
50
- "test:project-matrix": "vitest run tests/project-matrix.test.ts",
51
- "test:e2e-docker": "vitest run tests/e2e-docker.test.ts",
52
- "test": "vitest run",
53
- "test:watch": "vitest"
54
- }
55
- }
2
+ "name": "secure-exec",
3
+ "version": "0.2.20",
4
+ "description": "Secure Node.js execution for AI agents: run untrusted JavaScript and TypeScript in an isolated VM.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./typescript": {
16
+ "types": "./dist/typescript.d.ts",
17
+ "import": "./dist/typescript.js"
18
+ },
19
+ "./npm": {
20
+ "types": "./dist/npm.d.ts",
21
+ "import": "./dist/npm.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/rivet-dev/agentos.git",
31
+ "directory": "packages/secure-exec"
32
+ },
33
+ "homepage": "https://rivet.dev/secure-exec",
34
+ "engines": {
35
+ "node": ">=22.0.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc",
42
+ "check-types": "tsc --noEmit",
43
+ "test": "vitest run"
44
+ },
45
+ "dependencies": {
46
+ "@rivet-dev/agentos-core": "0.2.20"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^22.19.15",
50
+ "typescript": "^5.7.3",
51
+ "vitest": "^2.1.8"
52
+ }
53
+ }
package/LICENSE DELETED
@@ -1,191 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to the Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by the Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding any notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- Copyright 2025 Rivet Gaming, Inc.
180
-
181
- Licensed under the Apache License, Version 2.0 (the "License");
182
- you may not use this file except in compliance with the License.
183
- You may obtain a copy of the License at
184
-
185
- http://www.apache.org/licenses/LICENSE-2.0
186
-
187
- Unless required by applicable law or agreed to in writing, software
188
- distributed under the License is distributed on an "AS IS" BASIS,
189
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
- See the License for the specific language governing permissions and
191
- limitations under the License.
@@ -1 +0,0 @@
1
- export { getRawBridgeCode, getBridgeAttachCode } from "@secure-exec/nodejs/internal/bridge-loader";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs — canonical source is packages/nodejs/src/bridge-loader.ts
2
- export { getRawBridgeCode, getBridgeAttachCode } from "@secure-exec/nodejs/internal/bridge-loader";
@@ -1 +0,0 @@
1
- export { getInitialBridgeGlobalsSetupCode } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core — canonical source is packages/core/src/bridge-setup.ts
2
- export { getInitialBridgeGlobalsSetupCode } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { getStaticBuiltinWrapperSource, createBuiltinESMWrapper, getEmptyBuiltinESMWrapper, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core — canonical source moved to packages/nodejs/src/esm-compiler.ts (US-003)
2
- export { getStaticBuiltinWrapperSource, createBuiltinESMWrapper, getEmptyBuiltinESMWrapper, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- export type { DirEntry, StatInfo } from "@secure-exec/core";
2
- export { exists, stat, rename, readDirWithTypes, mkdir } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { exists, stat, rename, readDirWithTypes, mkdir } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { BUILTIN_NAMED_EXPORTS, normalizeBuiltinSpecifier, getPathDir, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core — canonical source moved to packages/nodejs/src/builtin-modules.ts (US-003)
2
- export { BUILTIN_NAMED_EXPORTS, normalizeBuiltinSpecifier, getPathDir, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { emitConsoleEvent, stripDangerousEnv, createProcessConfigForExecution, } from "@secure-exec/nodejs";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs
2
- export { emitConsoleEvent, stripDangerousEnv, createProcessConfigForExecution, } from "@secure-exec/nodejs";
@@ -1,2 +0,0 @@
1
- export { createDefaultNetworkAdapter, createNodeDriver, createNodeRuntimeDriverFactory, NodeFileSystem, NodeExecutionDriver, filterEnv, isPrivateIp, } from "@secure-exec/nodejs";
2
- export type { NodeDriverOptions, NodeRuntimeDriverFactoryOptions, ModuleAccessOptions, } from "@secure-exec/nodejs";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs — canonical source is packages/nodejs/src/driver.ts
2
- export { createDefaultNetworkAdapter, createNodeDriver, createNodeRuntimeDriverFactory, NodeFileSystem, NodeExecutionDriver, filterEnv, isPrivateIp, } from "@secure-exec/nodejs";
@@ -1,2 +0,0 @@
1
- export { NodeExecutionDriver } from "@secure-exec/nodejs/internal/execution-driver";
2
- export type { NodeExecutionDriverOptions } from "@secure-exec/nodejs/internal/isolate-bootstrap";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs
2
- export { NodeExecutionDriver } from "@secure-exec/nodejs/internal/execution-driver";
@@ -1,2 +0,0 @@
1
- export type { NodeExecutionDriverOptions, BudgetState, DriverDeps, } from "@secure-exec/nodejs/internal/isolate-bootstrap";
2
- export { DEFAULT_BRIDGE_BASE64_TRANSFER_BYTES, DEFAULT_ISOLATE_JSON_PAYLOAD_BYTES, MIN_CONFIGURED_PAYLOAD_BYTES, MAX_CONFIGURED_PAYLOAD_BYTES, PAYLOAD_LIMIT_ERROR_CODE, RESOURCE_BUDGET_ERROR_CODE, DEFAULT_SANDBOX_CWD, DEFAULT_SANDBOX_HOME, DEFAULT_SANDBOX_TMPDIR, PayloadLimitError, normalizePayloadLimit, getUtf8ByteLength, getBase64EncodedByteLength, assertPayloadByteLength, assertTextPayloadSize, createBudgetState, checkBridgeBudget, parseJsonWithLimit, getExecutionTimeoutMs, getTimingMitigation, polyfillCodeCache, polyfillNamedExportsCache, hostBuiltinNamedExportsCache, hostRequire, isValidExportName, getHostBuiltinNamedExports, } from "@secure-exec/nodejs/internal/isolate-bootstrap";
@@ -1 +0,0 @@
1
- export { DEFAULT_BRIDGE_BASE64_TRANSFER_BYTES, DEFAULT_ISOLATE_JSON_PAYLOAD_BYTES, MIN_CONFIGURED_PAYLOAD_BYTES, MAX_CONFIGURED_PAYLOAD_BYTES, PAYLOAD_LIMIT_ERROR_CODE, RESOURCE_BUDGET_ERROR_CODE, DEFAULT_SANDBOX_CWD, DEFAULT_SANDBOX_HOME, DEFAULT_SANDBOX_TMPDIR, PayloadLimitError, normalizePayloadLimit, getUtf8ByteLength, getBase64EncodedByteLength, assertPayloadByteLength, assertTextPayloadSize, createBudgetState, checkBridgeBudget, parseJsonWithLimit, getExecutionTimeoutMs, getTimingMitigation, polyfillCodeCache, polyfillNamedExportsCache, hostBuiltinNamedExportsCache, hostRequire, isValidExportName, getHostBuiltinNamedExports, } from "@secure-exec/nodejs/internal/isolate-bootstrap";
@@ -1,2 +0,0 @@
1
- export { ModuleAccessFileSystem } from "@secure-exec/nodejs/internal/module-access";
2
- export type { ModuleAccessOptions } from "@secure-exec/nodejs/internal/module-access";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs — canonical source is packages/nodejs/src/module-access.ts
2
- export { ModuleAccessFileSystem } from "@secure-exec/nodejs/internal/module-access";
@@ -1 +0,0 @@
1
- export { getNearestPackageType, getModuleFormat, shouldRunAsESM, resolveReferrerDirectory, resolveESMPath, } from "@secure-exec/nodejs/internal/module-resolver";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs — canonical source is packages/nodejs/src/module-resolver.ts
2
- export { getNearestPackageType, getModuleFormat, shouldRunAsESM, resolveReferrerDirectory, resolveESMPath, } from "@secure-exec/nodejs/internal/module-resolver";
@@ -1,2 +0,0 @@
1
- export type { ResolutionCache } from "@secure-exec/core";
2
- export { createResolutionCache, resolveModule, loadFile, bundlePackage, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { createResolutionCache, resolveModule, loadFile, bundlePackage, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { bundlePolyfill, getAvailableStdlib, hasPolyfill, prebundleAllPolyfills, } from "@secure-exec/nodejs/internal/polyfills";
package/dist/polyfills.js DELETED
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/nodejs — canonical source is packages/nodejs/src/polyfills.ts
2
- export { bundlePolyfill, getAvailableStdlib, hasPolyfill, prebundleAllPolyfills, } from "@secure-exec/nodejs/internal/polyfills";
@@ -1 +0,0 @@
1
- export type { DriverRuntimeConfig, NodeRuntimeDriver, NodeRuntimeDriverFactory, PythonRuntimeDriver, PythonRuntimeDriverFactory, ResourceBudgets, RuntimeDriver, RuntimeDriverFactory, RuntimeDriverOptions, SharedRuntimeDriver, SystemDriver, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export type { ExecOptions, ExecResult, ExecutionStatus, OSConfig, ProcessConfig, PythonRunOptions, PythonRunResult, RunResult, StdioChannel, StdioEvent, StdioHook, TimingMitigation, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export type { BridgeApplyRef, BridgeApplySyncPromiseRef, BridgeApplySyncRef, BridgeGlobalKey, ChildProcessKillBridgeRef, ChildProcessSpawnStartBridgeRef, ChildProcessSpawnSyncBridgeRef, ChildProcessStdinCloseBridgeRef, ChildProcessStdinWriteBridgeRef, CryptoRandomFillBridgeRef, CryptoRandomUuidBridgeRef, DynamicImportBridgeRef, FsChmodBridgeRef, FsChownBridgeRef, FsExistsBridgeRef, FsFacadeBridge, FsLinkBridgeRef, FsLstatBridgeRef, FsMkdirBridgeRef, FsReadDirBridgeRef, FsReadFileBinaryBridgeRef, FsReadFileBridgeRef, FsReadlinkBridgeRef, FsRenameBridgeRef, FsRmdirBridgeRef, FsStatBridgeRef, FsSymlinkBridgeRef, FsTruncateBridgeRef, FsUnlinkBridgeRef, FsUtimesBridgeRef, FsWriteFileBinaryBridgeRef, FsWriteFileBridgeRef, HostBridgeGlobalKey, LoadFileBridgeRef, LoadPolyfillBridgeRef, ModuleCacheBridgeRecord, NetworkDnsLookupRawBridgeRef, NetworkFetchRawBridgeRef, NetworkHttpRequestRawBridgeRef, NetworkHttpServerCloseRawBridgeRef, NetworkHttpServerListenRawBridgeRef, UpgradeSocketWriteRawBridgeRef, UpgradeSocketEndRawBridgeRef, UpgradeSocketDestroyRawBridgeRef, ProcessErrorBridgeRef, ProcessLogBridgeRef, RegisterHandleBridgeFn, RequireFromBridgeFn, ResolveModuleBridgeRef, RuntimeBridgeGlobalKey, ScheduleTimerBridgeRef, UnregisterHandleBridgeFn, ValueOf, } from "@secure-exec/core";
2
- export { BRIDGE_GLOBAL_KEY_LIST, HOST_BRIDGE_GLOBAL_KEY_LIST, HOST_BRIDGE_GLOBAL_KEYS, RUNTIME_BRIDGE_GLOBAL_KEY_LIST, RUNTIME_BRIDGE_GLOBAL_KEYS, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { BRIDGE_GLOBAL_KEY_LIST, HOST_BRIDGE_GLOBAL_KEY_LIST, HOST_BRIDGE_GLOBAL_KEYS, RUNTIME_BRIDGE_GLOBAL_KEY_LIST, RUNTIME_BRIDGE_GLOBAL_KEYS, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- export type { ConsoleSerializationBudget } from "@secure-exec/core";
2
- export { DEFAULT_CONSOLE_SERIALIZATION_BUDGET, formatConsoleArgs, getConsoleSetupCode, safeStringifyConsoleValue, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { DEFAULT_CONSOLE_SERIALIZATION_BUDGET, formatConsoleArgs, getConsoleSetupCode, safeStringifyConsoleValue, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- export type { SystemError } from "@secure-exec/core";
2
- export { createEaccesError, createEnosysError, createSystemError, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { createEaccesError, createEnosysError, createSystemError, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { extractCjsNamedExports, extractDynamicImportSpecifiers, isESM, transformDynamicImport, wrapCJSForESM, wrapCJSForESMWithModulePath, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core
2
- export { extractCjsNamedExports, extractDynamicImportSpecifiers, isESM, transformDynamicImport, wrapCJSForESM, wrapCJSForESMWithModulePath, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- export type { CustomGlobalClassification, CustomGlobalInventoryEntry, } from "@secure-exec/core";
2
- export { exposeCustomGlobal, exposeGlobalBinding, exposeMutableRuntimeStateGlobal, HARDENED_NODE_CUSTOM_GLOBALS, ISOLATE_GLOBAL_EXPOSURE_HELPER_SOURCE, MUTABLE_NODE_CUSTOM_GLOBALS, NODE_CUSTOM_GLOBAL_INVENTORY, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { exposeCustomGlobal, exposeGlobalBinding, exposeMutableRuntimeStateGlobal, HARDENED_NODE_CUSTOM_GLOBALS, ISOLATE_GLOBAL_EXPOSURE_HELPER_SOURCE, MUTABLE_NODE_CUSTOM_GLOBALS, NODE_CUSTOM_GLOBAL_INVENTORY, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { createInMemoryFileSystem } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core
2
- export { createInMemoryFileSystem } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { allowAll, allowAllChildProcess, allowAllEnv, allowAllFs, allowAllNetwork, createCommandExecutorStub, createFsStub, createNetworkStub, envAccessAllowed, filterEnv, wrapCommandExecutor, wrapFileSystem, wrapNetworkAdapter, } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core
2
- export { allowAll, allowAllChildProcess, allowAllEnv, allowAllFs, allowAllNetwork, createCommandExecutorStub, createFsStub, createNetworkStub, envAccessAllowed, filterEnv, wrapCommandExecutor, wrapFileSystem, wrapNetworkAdapter, } from "@secure-exec/core";
@@ -1 +0,0 @@
1
- export { getRequireSetupCode } from "@secure-exec/core";
@@ -1,2 +0,0 @@
1
- // Re-exported from @secure-exec/core
2
- export { getRequireSetupCode } from "@secure-exec/core";
package/dist/types.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export type { ChildProcessAccessRequest, EnvAccessRequest, FsAccessRequest, NetworkAccessRequest, PermissionCheck, PermissionDecision, Permissions, VirtualDirEntry, VirtualFileSystem, VirtualStat, } from "@secure-exec/core";
2
- export type { CommandExecutor, NetworkAdapter, NetworkServerAddress, NetworkServerListenOptions, NetworkServerRequest, NetworkServerResponse, SpawnedProcess, } from "@secure-exec/core";
3
- export type { DriverRuntimeConfig, NodeRuntimeDriver, NodeRuntimeDriverFactory, PythonRuntimeDriver, PythonRuntimeDriverFactory, RuntimeDriver, RuntimeDriverFactory, RuntimeDriverOptions, SharedRuntimeDriver, SystemDriver, } from "@secure-exec/core";
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};