@rivet-dev/agentos-core 0.0.0-integrate-dylib-into-main.815fcda → 0.0.0-main.29b0797
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 +43 -43
- package/dist/agent-os.d.ts +313 -226
- package/dist/agent-os.js +1418 -1545
- package/dist/agentos-package.d.ts +31 -0
- package/dist/agentos-package.js +91 -0
- package/dist/base-filesystem.d.ts +2 -15
- package/dist/base-filesystem.js +23 -171
- package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
- package/dist/{host-tools-zod.js → bindings-zod.js} +52 -25
- package/dist/bindings.d.ts +43 -0
- package/dist/bindings.js +34 -0
- package/dist/cron/cron-manager.js +43 -10
- package/dist/cron/index.d.ts +1 -1
- package/dist/cron/types.d.ts +26 -10
- package/dist/default-software.d.ts +8 -0
- package/dist/default-software.js +10 -0
- package/dist/filesystem-snapshot.d.ts +1 -2
- package/dist/filesystem-snapshot.js +0 -43
- package/dist/generated/AcpLimitsConfig.d.ts +20 -0
- package/dist/generated/AcpLimitsConfig.js +2 -0
- package/dist/generated/BindingLimitsConfig.d.ts +10 -0
- package/dist/generated/BindingLimitsConfig.js +2 -0
- package/dist/generated/CreateVmConfig.d.ts +28 -0
- package/dist/generated/FsPermissionRule.d.ts +6 -0
- package/dist/generated/FsPermissionRule.js +1 -0
- package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.js +1 -0
- package/dist/generated/FsPermissionScope.d.ts +3 -0
- package/dist/generated/FsPermissionScope.js +1 -0
- package/dist/generated/HttpLimitsConfig.d.ts +3 -0
- package/dist/generated/HttpLimitsConfig.js +2 -0
- package/dist/generated/JsModuleResolution.d.ts +1 -0
- package/dist/generated/JsModuleResolution.js +2 -0
- package/dist/generated/JsRuntimeConfig.d.ts +31 -0
- package/dist/generated/JsRuntimeConfig.js +1 -0
- package/dist/generated/JsRuntimeLimitsConfig.d.ts +11 -0
- package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
- package/dist/generated/JsRuntimePlatform.d.ts +1 -0
- package/dist/generated/JsRuntimePlatform.js +2 -0
- package/dist/generated/MountPluginDescriptor.d.ts +4 -0
- package/dist/generated/MountPluginDescriptor.js +2 -0
- package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
- package/dist/generated/NativeRootFilesystemConfig.js +1 -0
- package/dist/generated/PatternPermissionRule.d.ts +6 -0
- package/dist/generated/PatternPermissionRule.js +1 -0
- package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
- package/dist/generated/PatternPermissionRuleSet.js +1 -0
- package/dist/generated/PatternPermissionScope.d.ts +3 -0
- package/dist/generated/PatternPermissionScope.js +1 -0
- package/dist/generated/PermissionMode.d.ts +1 -0
- package/dist/generated/PermissionMode.js +2 -0
- package/dist/generated/PermissionsPolicy.d.ts +10 -0
- package/dist/generated/PermissionsPolicy.js +1 -0
- package/dist/generated/PluginLimitsConfig.d.ts +4 -0
- package/dist/generated/PluginLimitsConfig.js +2 -0
- package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
- package/dist/generated/ProcessLimitsConfig.js +2 -0
- package/dist/generated/PythonLimitsConfig.d.ts +6 -0
- package/dist/generated/PythonLimitsConfig.js +2 -0
- package/dist/generated/ResourceLimitsConfig.d.ts +24 -0
- package/dist/generated/ResourceLimitsConfig.js +2 -0
- package/dist/generated/RootFilesystemConfig.d.ts +9 -0
- package/dist/generated/RootFilesystemConfig.js +1 -0
- package/dist/generated/RootFilesystemEntry.d.ts +13 -0
- package/dist/generated/RootFilesystemEntry.js +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
- package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryKind.js +2 -0
- package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
- package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
- package/dist/generated/RootFilesystemMode.d.ts +1 -0
- package/dist/generated/RootFilesystemMode.js +2 -0
- package/dist/generated/VmDnsConfig.d.ts +6 -0
- package/dist/generated/VmDnsConfig.js +2 -0
- package/dist/generated/VmGroupConfig.d.ts +5 -0
- package/dist/generated/VmGroupConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +20 -0
- package/dist/generated/VmLimitsConfig.js +1 -0
- package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
- package/dist/generated/VmListenPolicyConfig.js +2 -0
- package/dist/generated/VmUserAccountConfig.d.ts +9 -0
- package/dist/generated/VmUserAccountConfig.js +2 -0
- package/dist/generated/VmUserConfig.d.ts +19 -0
- package/dist/generated/VmUserConfig.js +1 -0
- package/dist/generated/WasmLimitsConfig.d.ts +8 -0
- package/dist/generated/WasmLimitsConfig.js +2 -0
- package/dist/host-dir-mount.d.ts +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -5
- package/dist/layers.d.ts +7 -4
- package/dist/layers.js +0 -176
- package/dist/options-schema.d.ts +556 -0
- package/dist/options-schema.js +386 -0
- package/dist/packages.d.ts +17 -116
- package/dist/packages.js +35 -322
- package/dist/runtime-compat.d.ts +33 -46
- package/dist/runtime-compat.js +197 -511
- package/dist/runtime.d.ts +42 -8
- package/dist/sandbox.d.ts +112 -0
- package/dist/sandbox.js +264 -0
- package/dist/session-api.d.ts +180 -0
- package/dist/session-api.js +1 -0
- package/dist/sidecar/agentos-protocol.d.ts +509 -20
- package/dist/sidecar/agentos-protocol.js +808 -81
- package/dist/sidecar/native-process-client.d.ts +6 -2
- package/dist/sidecar/native-process-client.js +8 -1
- package/dist/sidecar/permissions.d.ts +1 -1
- package/dist/sidecar/permissions.js +4 -4
- package/dist/sidecar/rpc-client.d.ts +100 -9
- package/dist/sidecar/rpc-client.js +445 -110
- package/dist/test/runtime.d.ts +2 -1
- package/dist/test/runtime.js +2 -1
- package/dist/test/terminal-harness.js +0 -3
- package/dist/types.d.ts +13 -7
- package/package.json +46 -35
- package/dist/agent-session-types.d.ts +0 -67
- package/dist/agents.d.ts +0 -63
- package/dist/agents.js +0 -42
- package/dist/host-tools.d.ts +0 -45
- package/dist/host-tools.js +0 -26
- package/dist/overlay-filesystem.d.ts +0 -19
- package/dist/overlay-filesystem.js +0 -645
- package/fixtures/AGENTOS_SYSTEM_PROMPT.md +0 -21
- /package/dist/{agent-session-types.js → generated/CreateVmConfig.js} +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { resolveSchedule, validateScheduleForRegistration, } from "./parse-schedule.js";
|
|
3
|
+
function describeAction(action) {
|
|
4
|
+
switch (action.type) {
|
|
5
|
+
case "session":
|
|
6
|
+
return {
|
|
7
|
+
type: "session",
|
|
8
|
+
agentType: action.agentType,
|
|
9
|
+
prompt: action.prompt,
|
|
10
|
+
...(action.options === undefined
|
|
11
|
+
? {}
|
|
12
|
+
: { options: structuredClone(action.options) }),
|
|
13
|
+
};
|
|
14
|
+
case "exec":
|
|
15
|
+
return {
|
|
16
|
+
type: "exec",
|
|
17
|
+
command: action.command,
|
|
18
|
+
...(action.args === undefined ? {} : { args: [...action.args] }),
|
|
19
|
+
};
|
|
20
|
+
case "callback":
|
|
21
|
+
return { type: "callback" };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
3
24
|
/**
|
|
4
25
|
* Compute the next fire time for a schedule string. Returns undefined if
|
|
5
26
|
* the schedule is a one-shot ISO timestamp in the past or if croner
|
|
@@ -58,10 +79,10 @@ export class CronManager {
|
|
|
58
79
|
result.push({
|
|
59
80
|
id: state.id,
|
|
60
81
|
schedule: state.schedule,
|
|
61
|
-
action: state.action,
|
|
82
|
+
action: describeAction(state.action),
|
|
62
83
|
overlap: state.overlap,
|
|
63
|
-
lastRun: state.lastRun,
|
|
64
|
-
nextRun: state.nextRun,
|
|
84
|
+
lastRun: state.lastRun?.toISOString(),
|
|
85
|
+
nextRun: state.nextRun?.toISOString(),
|
|
65
86
|
runCount: state.runCount,
|
|
66
87
|
running: state.running,
|
|
67
88
|
});
|
|
@@ -103,14 +124,18 @@ export class CronManager {
|
|
|
103
124
|
state.running = true;
|
|
104
125
|
state.lastRun = new Date();
|
|
105
126
|
state.runCount++;
|
|
106
|
-
this.emit({
|
|
127
|
+
this.emit({
|
|
128
|
+
type: "cron:fire",
|
|
129
|
+
jobId: state.id,
|
|
130
|
+
time: new Date().toISOString(),
|
|
131
|
+
});
|
|
107
132
|
const startTime = Date.now();
|
|
108
133
|
try {
|
|
109
134
|
await this.runAction(state.action);
|
|
110
135
|
this.emit({
|
|
111
136
|
type: "cron:complete",
|
|
112
137
|
jobId: state.id,
|
|
113
|
-
time: new Date(),
|
|
138
|
+
time: new Date().toISOString(),
|
|
114
139
|
durationMs: Date.now() - startTime,
|
|
115
140
|
});
|
|
116
141
|
}
|
|
@@ -118,8 +143,8 @@ export class CronManager {
|
|
|
118
143
|
this.emit({
|
|
119
144
|
type: "cron:error",
|
|
120
145
|
jobId: state.id,
|
|
121
|
-
time: new Date(),
|
|
122
|
-
error: error,
|
|
146
|
+
time: new Date().toISOString(),
|
|
147
|
+
error: error instanceof Error ? error.message : String(error),
|
|
123
148
|
});
|
|
124
149
|
}
|
|
125
150
|
finally {
|
|
@@ -135,12 +160,20 @@ export class CronManager {
|
|
|
135
160
|
async runAction(action) {
|
|
136
161
|
switch (action.type) {
|
|
137
162
|
case "session": {
|
|
138
|
-
const
|
|
163
|
+
const sessionId = `cron-${randomUUID()}`;
|
|
164
|
+
await this.vm.openSession({
|
|
165
|
+
...action.options,
|
|
166
|
+
sessionId,
|
|
167
|
+
agent: action.agentType,
|
|
168
|
+
});
|
|
139
169
|
try {
|
|
140
|
-
await this.vm.prompt(
|
|
170
|
+
await this.vm.prompt({
|
|
171
|
+
sessionId,
|
|
172
|
+
content: [{ type: "text", text: action.prompt }],
|
|
173
|
+
});
|
|
141
174
|
}
|
|
142
175
|
finally {
|
|
143
|
-
this.vm.
|
|
176
|
+
await this.vm.deleteSession({ sessionId });
|
|
144
177
|
}
|
|
145
178
|
break;
|
|
146
179
|
}
|
package/dist/cron/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { CronManager } from "./cron-manager.js";
|
|
|
2
2
|
export { InvalidScheduleError, PastScheduleError, } from "./parse-schedule.js";
|
|
3
3
|
export type { ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./schedule-driver.js";
|
|
4
4
|
export { TimerScheduleDriver } from "./timer-driver.js";
|
|
5
|
-
export type { CronAction, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, } from "./types.js";
|
|
5
|
+
export type { CronAction, CronActionInfo, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, } from "./types.js";
|
package/dist/cron/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AgentType } from "../
|
|
1
|
+
import type { OpenSessionInput } from "../session-api.js";
|
|
2
|
+
import type { AgentType } from "../types.js";
|
|
3
3
|
export type CronAction = {
|
|
4
4
|
type: "session";
|
|
5
5
|
agentType: AgentType;
|
|
6
6
|
prompt: string;
|
|
7
|
-
options?:
|
|
7
|
+
options?: Omit<OpenSessionInput, "agent" | "sessionId">;
|
|
8
8
|
} | {
|
|
9
9
|
type: "exec";
|
|
10
10
|
command: string;
|
|
@@ -13,6 +13,22 @@ export type CronAction = {
|
|
|
13
13
|
type: "callback";
|
|
14
14
|
fn: () => void | Promise<void>;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Serializable description of a scheduled action. Callback jobs deliberately
|
|
18
|
+
* expose only their kind: the host closure is execution state, not job data.
|
|
19
|
+
*/
|
|
20
|
+
export type CronActionInfo = {
|
|
21
|
+
type: "session";
|
|
22
|
+
agentType: AgentType;
|
|
23
|
+
prompt: string;
|
|
24
|
+
options?: Omit<OpenSessionInput, "agent" | "sessionId">;
|
|
25
|
+
} | {
|
|
26
|
+
type: "exec";
|
|
27
|
+
command: string;
|
|
28
|
+
args?: string[];
|
|
29
|
+
} | {
|
|
30
|
+
type: "callback";
|
|
31
|
+
};
|
|
16
32
|
export interface CronJobOptions {
|
|
17
33
|
/** Optional ID. Auto-generated UUID if omitted. */
|
|
18
34
|
id?: string;
|
|
@@ -30,26 +46,26 @@ export interface CronJob {
|
|
|
30
46
|
export interface CronJobInfo {
|
|
31
47
|
id: string;
|
|
32
48
|
schedule: string;
|
|
33
|
-
action:
|
|
49
|
+
action: CronActionInfo;
|
|
34
50
|
overlap: "allow" | "skip" | "queue";
|
|
35
|
-
lastRun?:
|
|
36
|
-
nextRun?:
|
|
51
|
+
lastRun?: string;
|
|
52
|
+
nextRun?: string;
|
|
37
53
|
runCount: number;
|
|
38
54
|
running: boolean;
|
|
39
55
|
}
|
|
40
56
|
export type CronEvent = {
|
|
41
57
|
type: "cron:fire";
|
|
42
58
|
jobId: string;
|
|
43
|
-
time:
|
|
59
|
+
time: string;
|
|
44
60
|
} | {
|
|
45
61
|
type: "cron:complete";
|
|
46
62
|
jobId: string;
|
|
47
|
-
time:
|
|
63
|
+
time: string;
|
|
48
64
|
durationMs: number;
|
|
49
65
|
} | {
|
|
50
66
|
type: "cron:error";
|
|
51
67
|
jobId: string;
|
|
52
|
-
time:
|
|
53
|
-
error:
|
|
68
|
+
time: string;
|
|
69
|
+
error: string;
|
|
54
70
|
};
|
|
55
71
|
export type CronEventHandler = (event: CronEvent) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SoftwarePackageRef } from "@agentos-software/manifest";
|
|
2
|
+
/**
|
|
3
|
+
* Default software for a bare `AgentOs.create()`: the `@agentos-software/common`
|
|
4
|
+
* coreutils bundle, imported like any other package. The client makes NO
|
|
5
|
+
* npm/node_modules assumptions (see root CLAUDE.md) — no dep scan, no
|
|
6
|
+
* require.resolve. Opt out with `defaultSoftware: false`; add more via `software`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveDefaultSoftware(): SoftwarePackageRef[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import common from "@agentos-software/common";
|
|
2
|
+
/**
|
|
3
|
+
* Default software for a bare `AgentOs.create()`: the `@agentos-software/common`
|
|
4
|
+
* coreutils bundle, imported like any other package. The client makes NO
|
|
5
|
+
* npm/node_modules assumptions (see root CLAUDE.md) — no dep scan, no
|
|
6
|
+
* require.resolve. Opt out with `defaultSoftware: false`; add more via `software`.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveDefaultSoftware() {
|
|
9
|
+
return [common].flat();
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VirtualFileSystem } from "./runtime-compat.js";
|
|
2
2
|
export interface FilesystemEntry {
|
|
3
3
|
path: string;
|
|
4
4
|
type: "directory" | "file" | "symlink";
|
|
@@ -10,5 +10,4 @@ export interface FilesystemEntry {
|
|
|
10
10
|
target?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare function sortFilesystemEntries(entries: FilesystemEntry[]): FilesystemEntry[];
|
|
13
|
-
export declare function createFilesystemFromEntries(entries: FilesystemEntry[]): Promise<VirtualFileSystem>;
|
|
14
13
|
export declare function snapshotVirtualFilesystem(filesystem: VirtualFileSystem, rootPath?: string): Promise<FilesystemEntry[]>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import * as posixPath from "node:path/posix";
|
|
2
|
-
import { createInMemoryFileSystem, } from "./runtime-compat.js";
|
|
3
|
-
function parseMode(mode) {
|
|
4
|
-
return Number.parseInt(mode, 8);
|
|
5
|
-
}
|
|
6
2
|
export function sortFilesystemEntries(entries) {
|
|
7
3
|
return [...entries].sort((a, b) => {
|
|
8
4
|
const depthA = a.path === "/" ? 0 : a.path.split("/").filter(Boolean).length;
|
|
@@ -13,45 +9,6 @@ export function sortFilesystemEntries(entries) {
|
|
|
13
9
|
return a.path.localeCompare(b.path);
|
|
14
10
|
});
|
|
15
11
|
}
|
|
16
|
-
async function applyDirectory(filesystem, entry) {
|
|
17
|
-
if (entry.path !== "/") {
|
|
18
|
-
await filesystem.mkdir(entry.path, { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
await filesystem.chmod(entry.path, parseMode(entry.mode));
|
|
21
|
-
await filesystem.chown(entry.path, entry.uid, entry.gid);
|
|
22
|
-
}
|
|
23
|
-
async function applyFile(filesystem, entry) {
|
|
24
|
-
const content = entry.content ?? "";
|
|
25
|
-
await filesystem.writeFile(entry.path, entry.encoding === "base64" ? Buffer.from(content, "base64") : content);
|
|
26
|
-
await filesystem.chmod(entry.path, parseMode(entry.mode));
|
|
27
|
-
await filesystem.chown(entry.path, entry.uid, entry.gid);
|
|
28
|
-
}
|
|
29
|
-
async function applySymlink(filesystem, entry) {
|
|
30
|
-
if (!entry.target) {
|
|
31
|
-
throw new Error(`Missing symlink target for ${entry.path}`);
|
|
32
|
-
}
|
|
33
|
-
await filesystem.symlink(entry.target, entry.path);
|
|
34
|
-
}
|
|
35
|
-
export async function createFilesystemFromEntries(entries) {
|
|
36
|
-
const filesystem = createInMemoryFileSystem();
|
|
37
|
-
const sortedEntries = sortFilesystemEntries(entries);
|
|
38
|
-
for (const entry of sortedEntries) {
|
|
39
|
-
if (entry.type === "directory") {
|
|
40
|
-
await applyDirectory(filesystem, entry);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
for (const entry of sortedEntries) {
|
|
44
|
-
if (entry.type === "file") {
|
|
45
|
-
await applyFile(filesystem, entry);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
for (const entry of sortedEntries) {
|
|
49
|
-
if (entry.type === "symlink") {
|
|
50
|
-
await applySymlink(filesystem, entry);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return filesystem;
|
|
54
|
-
}
|
|
55
12
|
function toModeString(mode) {
|
|
56
13
|
return `0${(mode & 0o7777).toString(8)}`;
|
|
57
14
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AcpLimitsConfig = {
|
|
2
|
+
maxReadLineBytes?: number;
|
|
3
|
+
stdoutBufferByteLimit?: number;
|
|
4
|
+
maxCompletedMessageBytes?: number;
|
|
5
|
+
maxTurnOutputBytes?: number;
|
|
6
|
+
maxPromptBytes?: number;
|
|
7
|
+
maxPromptBlocks?: number;
|
|
8
|
+
maxFallbackContinuationBytes?: number;
|
|
9
|
+
maxSessionHistoryBytes?: number;
|
|
10
|
+
maxSessionHistoryEvents?: number;
|
|
11
|
+
maxHistoryPageEntries?: number;
|
|
12
|
+
maxSessionListEntries?: number;
|
|
13
|
+
maxSessionsPerVm?: number;
|
|
14
|
+
maxPromptsPerSession?: number;
|
|
15
|
+
maxPromptsPerVm?: number;
|
|
16
|
+
maxPendingPermissionsPerSession?: number;
|
|
17
|
+
maxPendingPermissionsPerVm?: number;
|
|
18
|
+
maxPermissionOutcomesPerSession?: number;
|
|
19
|
+
maxPermissionOutcomesPerVm?: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type BindingLimitsConfig = {
|
|
2
|
+
defaultBindingTimeoutMs?: number;
|
|
3
|
+
maxBindingTimeoutMs?: number;
|
|
4
|
+
maxRegisteredCollections?: number;
|
|
5
|
+
maxRegisteredBindingsPerVm?: number;
|
|
6
|
+
maxBindingsPerCollection?: number;
|
|
7
|
+
maxBindingSchemaBytes?: number;
|
|
8
|
+
maxExamplesPerBinding?: number;
|
|
9
|
+
maxBindingExampleInputBytes?: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { JsRuntimeConfig } from "./JsRuntimeConfig.js";
|
|
2
|
+
import type { NativeRootFilesystemConfig } from "./NativeRootFilesystemConfig.js";
|
|
3
|
+
import type { PermissionsPolicy } from "./PermissionsPolicy.js";
|
|
4
|
+
import type { RootFilesystemConfig } from "./RootFilesystemConfig.js";
|
|
5
|
+
import type { VmDnsConfig } from "./VmDnsConfig.js";
|
|
6
|
+
import type { VmLimitsConfig } from "./VmLimitsConfig.js";
|
|
7
|
+
import type { VmListenPolicyConfig } from "./VmListenPolicyConfig.js";
|
|
8
|
+
import type { VmUserConfig } from "./VmUserConfig.js";
|
|
9
|
+
/**
|
|
10
|
+
* Canonical Rust-side VM config. Unknown fields must stay rejected here and in
|
|
11
|
+
* the TS preflight schema at
|
|
12
|
+
* `packages/core/src/node-runtime-options-schema.ts`; update both when a
|
|
13
|
+
* public `NodeRuntime.create(...)` option changes the generated VM config.
|
|
14
|
+
*/
|
|
15
|
+
export type CreateVmConfig = {
|
|
16
|
+
cwd?: string;
|
|
17
|
+
env: Record<string, string>;
|
|
18
|
+
user?: VmUserConfig;
|
|
19
|
+
rootFilesystem: RootFilesystemConfig;
|
|
20
|
+
permissions?: PermissionsPolicy;
|
|
21
|
+
limits?: VmLimitsConfig;
|
|
22
|
+
dns?: VmDnsConfig;
|
|
23
|
+
nativeRoot?: NativeRootFilesystemConfig;
|
|
24
|
+
listen?: VmListenPolicyConfig;
|
|
25
|
+
loopbackExemptPorts: Array<number>;
|
|
26
|
+
jsRuntime?: JsRuntimeConfig;
|
|
27
|
+
bootstrapCommands?: Array<string>;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type JsModuleResolution = "node" | "relative" | "none";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { JsModuleResolution } from "./JsModuleResolution.js";
|
|
2
|
+
import type { JsRuntimePlatform } from "./JsRuntimePlatform.js";
|
|
3
|
+
/**
|
|
4
|
+
* Guest JavaScript host-environment configuration.
|
|
5
|
+
*
|
|
6
|
+
* Selects which globals/builtins/module-resolution surface guest JS sees,
|
|
7
|
+
* modeled on esbuild's `platform`. Omitting this preserves full Node.js
|
|
8
|
+
* emulation (`platform = node`).
|
|
9
|
+
*/
|
|
10
|
+
export type JsRuntimeConfig = {
|
|
11
|
+
/**
|
|
12
|
+
* Which host environment to emulate for guest JS. Default `node`.
|
|
13
|
+
*/
|
|
14
|
+
platform: JsRuntimePlatform;
|
|
15
|
+
/**
|
|
16
|
+
* How bare import specifiers resolve. Independent of `platform`.
|
|
17
|
+
* Default `node`.
|
|
18
|
+
*/
|
|
19
|
+
moduleResolution: JsModuleResolution;
|
|
20
|
+
/**
|
|
21
|
+
* Node builtin-module allow-list. Only valid when `platform = node`.
|
|
22
|
+
* `None` => engine default allow-list. `Some([])` => deny all builtins.
|
|
23
|
+
* `Some([..])` => exactly those.
|
|
24
|
+
*/
|
|
25
|
+
allowedBuiltins?: Array<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Opt in to a high-resolution monotonic guest clock. Default false keeps
|
|
28
|
+
* the security-oriented 1ms timer resolution.
|
|
29
|
+
*/
|
|
30
|
+
highResolutionTime?: boolean;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type JsRuntimeLimitsConfig = {
|
|
2
|
+
v8HeapLimitMb?: number;
|
|
3
|
+
syncRpcWaitTimeoutMs?: number;
|
|
4
|
+
cpuTimeLimitMs?: number;
|
|
5
|
+
wallClockLimitMs?: number;
|
|
6
|
+
importCacheMaterializeTimeoutMs?: number;
|
|
7
|
+
capturedOutputLimitBytes?: number;
|
|
8
|
+
stdinBufferLimitBytes?: number;
|
|
9
|
+
eventPayloadLimitBytes?: number;
|
|
10
|
+
v8IpcMaxFrameBytes?: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type JsRuntimePlatform = "node" | "browser" | "neutral" | "bare";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PermissionMode = "allow" | "ask" | "deny";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FsPermissionScope } from "./FsPermissionScope.js";
|
|
2
|
+
import type { PatternPermissionScope } from "./PatternPermissionScope.js";
|
|
3
|
+
export type PermissionsPolicy = {
|
|
4
|
+
fs?: FsPermissionScope;
|
|
5
|
+
network?: PatternPermissionScope;
|
|
6
|
+
childProcess?: PatternPermissionScope;
|
|
7
|
+
process?: PatternPermissionScope;
|
|
8
|
+
env?: PatternPermissionScope;
|
|
9
|
+
binding?: PatternPermissionScope;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ResourceLimitsConfig = {
|
|
2
|
+
cpuCount?: number;
|
|
3
|
+
maxProcesses?: number;
|
|
4
|
+
maxOpenFds?: number;
|
|
5
|
+
maxPipes?: number;
|
|
6
|
+
maxPtys?: number;
|
|
7
|
+
maxSockets?: number;
|
|
8
|
+
maxConnections?: number;
|
|
9
|
+
maxSocketBufferedBytes?: number;
|
|
10
|
+
maxSocketDatagramQueueLen?: number;
|
|
11
|
+
maxFilesystemBytes?: number;
|
|
12
|
+
maxInodeCount?: number;
|
|
13
|
+
maxBlockingReadMs?: number;
|
|
14
|
+
maxPreadBytes?: number;
|
|
15
|
+
maxFdWriteBytes?: number;
|
|
16
|
+
maxProcessArgvBytes?: number;
|
|
17
|
+
maxProcessEnvBytes?: number;
|
|
18
|
+
maxReaddirEntries?: number;
|
|
19
|
+
maxRecursiveFsDepth?: number;
|
|
20
|
+
maxRecursiveFsEntries?: number;
|
|
21
|
+
maxWasmFuel?: number;
|
|
22
|
+
maxWasmMemoryBytes?: number;
|
|
23
|
+
maxWasmStackBytes?: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RootFilesystemEntry } from "./RootFilesystemEntry.js";
|
|
2
|
+
import type { RootFilesystemLowerDescriptor } from "./RootFilesystemLowerDescriptor.js";
|
|
3
|
+
import type { RootFilesystemMode } from "./RootFilesystemMode.js";
|
|
4
|
+
export type RootFilesystemConfig = {
|
|
5
|
+
mode: RootFilesystemMode;
|
|
6
|
+
disableDefaultBaseLayer: boolean;
|
|
7
|
+
lowers: Array<RootFilesystemLowerDescriptor>;
|
|
8
|
+
bootstrapEntries: Array<RootFilesystemEntry>;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RootFilesystemEntryEncoding } from "./RootFilesystemEntryEncoding.js";
|
|
2
|
+
import type { RootFilesystemEntryKind } from "./RootFilesystemEntryKind.js";
|
|
3
|
+
export type RootFilesystemEntry = {
|
|
4
|
+
path: string;
|
|
5
|
+
kind: RootFilesystemEntryKind;
|
|
6
|
+
mode?: number;
|
|
7
|
+
uid?: number;
|
|
8
|
+
gid?: number;
|
|
9
|
+
content?: string;
|
|
10
|
+
encoding?: RootFilesystemEntryEncoding;
|
|
11
|
+
target?: string;
|
|
12
|
+
executable: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RootFilesystemEntryEncoding = "utf8" | "base64";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RootFilesystemEntryKind = "file" | "directory" | "symlink";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|