@rivet-dev/agentos-runtime-core 0.0.0-main.29b0797 → 0.0.0-main.5ac5a14
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 +1 -1
- package/commands/[ +0 -0
- package/commands/_stubs +0 -0
- package/commands/awk +0 -0
- package/commands/bash +0 -0
- package/commands/chcon +0 -0
- package/commands/chroot +0 -0
- package/commands/column +0 -0
- package/commands/diff +0 -0
- package/commands/du +0 -0
- package/commands/egrep +0 -0
- package/commands/env +0 -0
- package/commands/expr +0 -0
- package/commands/fgrep +0 -0
- package/commands/file +0 -0
- package/commands/groups +0 -0
- package/commands/gunzip +0 -0
- package/commands/gzip +0 -0
- package/commands/hostid +0 -0
- package/commands/http-test +0 -0
- package/commands/install +0 -0
- package/commands/jq +0 -0
- package/commands/nice +0 -0
- package/commands/nohup +0 -0
- package/commands/pinky +0 -0
- package/commands/rev +0 -0
- package/commands/rg +0 -0
- package/commands/runcon +0 -0
- package/commands/sh +0 -0
- package/commands/sleep +0 -0
- package/commands/spawn-test-host +0 -0
- package/commands/ssh +0 -0
- package/commands/stdbuf +0 -0
- package/commands/strings +0 -0
- package/commands/stty +0 -0
- package/commands/sync +0 -0
- package/commands/tar +0 -0
- package/commands/test +0 -0
- package/commands/timeout +0 -0
- package/commands/tty +0 -0
- package/commands/unzip +0 -0
- package/commands/uptime +0 -0
- package/commands/users +0 -0
- package/commands/wget +0 -0
- package/commands/which +0 -0
- package/commands/who +0 -0
- package/commands/whoami +0 -0
- package/commands/yq +0 -0
- package/commands/zcat +0 -0
- package/commands/zip +0 -0
- package/dist/event-buffer.d.ts +14 -0
- package/dist/event-buffer.js +30 -1
- package/dist/frame-stream.d.ts +1 -0
- package/dist/frame-stream.js +8 -0
- package/dist/generated/ExecutionLimitsConfig.d.ts +5 -0
- package/dist/generated/ExecutionLimitsConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +2 -0
- package/dist/generated/VmSqliteDescriptor.d.ts +0 -1
- package/dist/generated-protocol.d.ts +550 -0
- package/dist/generated-protocol.js +1446 -122
- package/dist/kernel-proxy.js +1 -1
- package/dist/native-client.js +22 -9
- package/dist/node-runtime.js +5 -5
- package/dist/process.d.ts +4 -2
- package/dist/process.js +11 -3
- package/dist/protocol-client.d.ts +2 -0
- package/dist/protocol-client.js +29 -0
- package/dist/request-payloads.d.ts +96 -0
- package/dist/request-payloads.js +66 -0
- package/dist/response-payloads.d.ts +27 -0
- package/dist/response-payloads.js +18 -0
- package/dist/sidecar-process.d.ts +8 -1
- package/dist/sidecar-process.js +27 -2
- package/dist/test-runtime.d.ts +7 -1
- package/dist/test-runtime.js +95 -14
- package/package.json +10 -3
package/dist/test-runtime.js
CHANGED
|
@@ -5,9 +5,9 @@ import * as path from "node:path";
|
|
|
5
5
|
import * as posixPath from "node:path/posix";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import "./native-client.js";
|
|
8
|
-
import { NativeSidecarKernelProxy, SidecarProcess, serializeMountConfigForSidecar, } from "./kernel-proxy.js";
|
|
9
8
|
import { resolvePublishedSidecarBinary } from "./binary.js";
|
|
10
9
|
import { findCargoBinary, resolveCargoBinary } from "./cargo.js";
|
|
10
|
+
import { NativeSidecarKernelProxy, SidecarProcess, serializeMountConfigForSidecar, } from "./kernel-proxy.js";
|
|
11
11
|
export const AF_INET = 2;
|
|
12
12
|
export const AF_UNIX = 1;
|
|
13
13
|
export const SOCK_STREAM = 1;
|
|
@@ -1161,7 +1161,7 @@ class WasmVmRuntimeDescriptor {
|
|
|
1161
1161
|
if (dirOffset === undefined) {
|
|
1162
1162
|
continue;
|
|
1163
1163
|
}
|
|
1164
|
-
guestPaths.set(name, `/
|
|
1164
|
+
guestPaths.set(name, `/__agentos/commands/${startIndex + dirOffset}/${name}`);
|
|
1165
1165
|
}
|
|
1166
1166
|
return guestPaths;
|
|
1167
1167
|
}
|
|
@@ -1263,9 +1263,13 @@ function createBootstrapEntries(commandNames) {
|
|
|
1263
1263
|
...KERNEL_POSIX_BOOTSTRAP_DIRS.map((entryPath) => ({
|
|
1264
1264
|
path: entryPath,
|
|
1265
1265
|
kind: "directory",
|
|
1266
|
-
mode: entryPath === "/tmp" || entryPath === "/var/tmp"
|
|
1267
|
-
|
|
1268
|
-
|
|
1266
|
+
mode: entryPath === "/tmp" || entryPath === "/var/tmp"
|
|
1267
|
+
? 0o1777
|
|
1268
|
+
: entryPath === "/home/agentos"
|
|
1269
|
+
? 0o2755
|
|
1270
|
+
: 0o755,
|
|
1271
|
+
uid: entryPath === "/home/agentos" || entryPath === "/workspace" ? 1000 : 0,
|
|
1272
|
+
gid: entryPath === "/home/agentos" || entryPath === "/workspace" ? 1000 : 0,
|
|
1269
1273
|
})),
|
|
1270
1274
|
{
|
|
1271
1275
|
path: "/usr/bin/env",
|
|
@@ -1414,17 +1418,88 @@ function planNodeFilesystemPassthroughMounts(filesystem, existingMounts) {
|
|
|
1414
1418
|
fs: new NodeFileSystem({ root: hostPath }),
|
|
1415
1419
|
readOnly: true,
|
|
1416
1420
|
});
|
|
1421
|
+
if (directoryName === "node_modules") {
|
|
1422
|
+
appendNodeModulesSymlinkTargetMounts(mounts, existingGuestPaths, guestPath, hostPath);
|
|
1423
|
+
}
|
|
1417
1424
|
}
|
|
1418
1425
|
return {
|
|
1419
1426
|
mounts,
|
|
1420
1427
|
passthroughDirectories,
|
|
1421
1428
|
};
|
|
1422
1429
|
}
|
|
1430
|
+
function appendNodeModulesSymlinkTargetMounts(mounts, existingGuestPaths, guestRoot, hostRoot) {
|
|
1431
|
+
let canonicalHostRoot;
|
|
1432
|
+
try {
|
|
1433
|
+
canonicalHostRoot = fsSync.realpathSync(hostRoot);
|
|
1434
|
+
}
|
|
1435
|
+
catch {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
const appendTarget = (guestPath, symlinkPath) => {
|
|
1439
|
+
if (existingGuestPaths.has(guestPath))
|
|
1440
|
+
return;
|
|
1441
|
+
try {
|
|
1442
|
+
const target = fsSync.realpathSync(symlinkPath);
|
|
1443
|
+
if (!fsSync.statSync(target).isDirectory())
|
|
1444
|
+
return;
|
|
1445
|
+
const relativeTarget = path.relative(canonicalHostRoot, target);
|
|
1446
|
+
if (relativeTarget === "" ||
|
|
1447
|
+
(!relativeTarget.startsWith(`..${path.sep}`) &&
|
|
1448
|
+
relativeTarget !== ".." &&
|
|
1449
|
+
!path.isAbsolute(relativeTarget))) {
|
|
1450
|
+
// pnpm and similar stores deliberately use links that remain inside
|
|
1451
|
+
// node_modules. Keeping those on the root mount preserves the realpath
|
|
1452
|
+
// ancestry needed to resolve their nested dependency links.
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
mounts.push({
|
|
1456
|
+
path: guestPath,
|
|
1457
|
+
fs: new NodeFileSystem({ root: target }),
|
|
1458
|
+
readOnly: true,
|
|
1459
|
+
});
|
|
1460
|
+
existingGuestPaths.add(guestPath);
|
|
1461
|
+
}
|
|
1462
|
+
catch {
|
|
1463
|
+
// Broken or concurrently-removed links remain unavailable, matching Node.
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
let entries;
|
|
1467
|
+
try {
|
|
1468
|
+
entries = fsSync.readdirSync(hostRoot, { withFileTypes: true });
|
|
1469
|
+
}
|
|
1470
|
+
catch {
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
for (const entry of entries) {
|
|
1474
|
+
if (entry.name.startsWith("."))
|
|
1475
|
+
continue;
|
|
1476
|
+
const entryPath = path.join(hostRoot, entry.name);
|
|
1477
|
+
if (entry.isSymbolicLink()) {
|
|
1478
|
+
appendTarget(`${guestRoot}/${entry.name}`, entryPath);
|
|
1479
|
+
continue;
|
|
1480
|
+
}
|
|
1481
|
+
if (!entry.isDirectory() || !entry.name.startsWith("@"))
|
|
1482
|
+
continue;
|
|
1483
|
+
let scopedEntries;
|
|
1484
|
+
try {
|
|
1485
|
+
scopedEntries = fsSync.readdirSync(entryPath, { withFileTypes: true });
|
|
1486
|
+
}
|
|
1487
|
+
catch {
|
|
1488
|
+
continue;
|
|
1489
|
+
}
|
|
1490
|
+
for (const scopedEntry of scopedEntries) {
|
|
1491
|
+
if (scopedEntry.name.startsWith(".") || !scopedEntry.isSymbolicLink()) {
|
|
1492
|
+
continue;
|
|
1493
|
+
}
|
|
1494
|
+
appendTarget(`${guestRoot}/${entry.name}/${scopedEntry.name}`, path.join(entryPath, scopedEntry.name));
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1423
1498
|
function collectGuestCommandPaths(commandDirs, startIndex = 0) {
|
|
1424
1499
|
const guestPaths = new Map();
|
|
1425
1500
|
for (const entry of discoverWasmCommandEntries(commandDirs)) {
|
|
1426
1501
|
if (!guestPaths.has(entry.name)) {
|
|
1427
|
-
guestPaths.set(entry.name, `/
|
|
1502
|
+
guestPaths.set(entry.name, `/__agentos/commands/${startIndex + entry.dirOffset}/${entry.name}`);
|
|
1428
1503
|
}
|
|
1429
1504
|
}
|
|
1430
1505
|
return guestPaths;
|
|
@@ -1435,10 +1510,7 @@ async function ensureCommandStubs(proxy, commands) {
|
|
|
1435
1510
|
// `/bin` supports PATH-based test commands. `/opt/agentos/bin` mirrors
|
|
1436
1511
|
// the package projection used by production VMs and is required by
|
|
1437
1512
|
// upstream tools that exec private helpers via an absolute libexec path.
|
|
1438
|
-
for (const stubPath of [
|
|
1439
|
-
`/bin/${command}`,
|
|
1440
|
-
`/opt/agentos/bin/${command}`,
|
|
1441
|
-
]) {
|
|
1513
|
+
for (const stubPath of [`/bin/${command}`, `/opt/agentos/bin/${command}`]) {
|
|
1442
1514
|
await rootView.writeFile(stubPath, KERNEL_COMMAND_STUB);
|
|
1443
1515
|
await rootView.chmod(stubPath, 0o755);
|
|
1444
1516
|
}
|
|
@@ -1605,9 +1677,15 @@ async function syncLiveFilesystemToBoundMethods(live, methods, paths, maxBytes)
|
|
|
1605
1677
|
}
|
|
1606
1678
|
async function snapshotLiveFilesystemPath(live, targetPath, snapshot, usage, maxBytes, knownEntry) {
|
|
1607
1679
|
const stat = knownEntry ??
|
|
1608
|
-
(targetPath === "/"
|
|
1680
|
+
(targetPath === "/"
|
|
1681
|
+
? await live.stat(targetPath)
|
|
1682
|
+
: await live.lstat(targetPath));
|
|
1609
1683
|
if (stat.isSymbolicLink) {
|
|
1610
|
-
snapshot.push({
|
|
1684
|
+
snapshot.push({
|
|
1685
|
+
kind: "symlink",
|
|
1686
|
+
path: targetPath,
|
|
1687
|
+
target: await live.readlink(targetPath),
|
|
1688
|
+
});
|
|
1611
1689
|
return;
|
|
1612
1690
|
}
|
|
1613
1691
|
if (stat.isDirectory) {
|
|
@@ -1639,7 +1717,9 @@ async function snapshotLiveFilesystemPath(live, targetPath, snapshot, usage, max
|
|
|
1639
1717
|
}
|
|
1640
1718
|
async function applyLiveFilesystemSnapshotEntry(methods, entry) {
|
|
1641
1719
|
if (entry.kind === "directory") {
|
|
1642
|
-
await callBoundFilesystemMethod(methods, "mkdir", entry.path, {
|
|
1720
|
+
await callBoundFilesystemMethod(methods, "mkdir", entry.path, {
|
|
1721
|
+
recursive: true,
|
|
1722
|
+
});
|
|
1643
1723
|
return;
|
|
1644
1724
|
}
|
|
1645
1725
|
await ensureBoundParentDirectory(methods, entry.path);
|
|
@@ -1784,7 +1864,7 @@ class NativeKernel {
|
|
|
1784
1864
|
collectGuestCommandPaths(commandDirs, startIndex);
|
|
1785
1865
|
const allCommandDirs = [...this.mountedCommandDirs, ...commandDirs];
|
|
1786
1866
|
const sidecarMounts = allCommandDirs.map((commandDir, index) => serializeMountConfigForSidecar({
|
|
1787
|
-
path: `/
|
|
1867
|
+
path: `/__agentos/commands/${index}`,
|
|
1788
1868
|
readOnly: true,
|
|
1789
1869
|
plugin: {
|
|
1790
1870
|
id: "host_dir",
|
|
@@ -2137,6 +2217,7 @@ class NativeKernel {
|
|
|
2137
2217
|
? { permissions: bootstrapPermissions }
|
|
2138
2218
|
: {}),
|
|
2139
2219
|
loopbackExemptPorts: this.loopbackExemptPorts,
|
|
2220
|
+
...(this.options.limits ? { limits: this.options.limits } : {}),
|
|
2140
2221
|
...(this.options.jsRuntime
|
|
2141
2222
|
? { jsRuntime: this.options.jsRuntime }
|
|
2142
2223
|
: {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivet-dev/agentos-runtime-core",
|
|
3
|
-
"version": "0.0.0-main.
|
|
3
|
+
"version": "0.0.0-main.5ac5a14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -192,10 +192,12 @@
|
|
|
192
192
|
"test": "vitest run --exclude '**/*.nightly.test.ts'",
|
|
193
193
|
"test:pr": "vitest run --exclude '**/*.nightly.test.ts' --fileParallelism=false",
|
|
194
194
|
"test:nightly": "vitest run tests/integration/*.nightly.test.ts --passWithNoTests",
|
|
195
|
-
"test:ecosystem": "AGENTOS_ECOSYSTEM_E2E=1 vitest run tests/integration/e2e-project-matrix.nightly.test.ts -t 'required Node ecosystem reactor matrix' --reporter=verbose"
|
|
195
|
+
"test:ecosystem": "AGENTOS_ECOSYSTEM_E2E=1 vitest run tests/integration/e2e-project-matrix.nightly.test.ts -t 'required Node ecosystem reactor matrix' --reporter=verbose",
|
|
196
|
+
"test:ecosystem:full": "AGENTOS_ECOSYSTEM_FULL_E2E=1 vitest run tests/integration/e2e-project-matrix.nightly.test.ts -t 'full Node ecosystem matrix through kernel' --reporter=verbose",
|
|
197
|
+
"test:npm-workflows": "AGENTOS_NPM_WORKFLOWS_E2E=1 vitest run tests/integration/e2e-npm-*.nightly.test.ts tests/integration/e2e-npx-and-pipes.nightly.test.ts tests/integration/e2e-concurrently.nightly.test.ts tests/integration/e2e-nextjs-build.nightly.test.ts --reporter=verbose"
|
|
196
198
|
},
|
|
197
199
|
"dependencies": {
|
|
198
|
-
"@rivet-dev/agentos-runtime-sidecar": "0.0.0-main.
|
|
200
|
+
"@rivet-dev/agentos-runtime-sidecar": "0.0.0-main.5ac5a14",
|
|
199
201
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
200
202
|
"zod": "^4.1.11"
|
|
201
203
|
},
|
|
@@ -203,5 +205,10 @@
|
|
|
203
205
|
"@types/node": "^22.10.2",
|
|
204
206
|
"typescript": "^5.7.2",
|
|
205
207
|
"vitest": "^2.1.8"
|
|
208
|
+
},
|
|
209
|
+
"repository": {
|
|
210
|
+
"type": "git",
|
|
211
|
+
"url": "https://github.com/rivet-dev/agentos.git",
|
|
212
|
+
"directory": "packages/runtime-core"
|
|
206
213
|
}
|
|
207
214
|
}
|