@rivet-dev/agentos-runtime-sidecar 0.0.0-agent-acp-codex-session-benchmark.62b1f46
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 +19 -0
- package/index.d.ts +12 -0
- package/index.js +113 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @rivet-dev/agentos-runtime-sidecar
|
|
2
|
+
|
|
3
|
+
Platform-specific resolver for the AgentOS native sidecar binary.
|
|
4
|
+
|
|
5
|
+
The compiled `agentos-native-sidecar` binary ships inside one of the
|
|
6
|
+
`@rivet-dev/agentos-runtime-sidecar-<platform>` packages. npm installs only the package
|
|
7
|
+
matching the current `os`/`cpu`/`libc` at install time.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
const { getSidecarPath } = require("@rivet-dev/agentos-runtime-sidecar");
|
|
11
|
+
|
|
12
|
+
const binaryPath = getSidecarPath();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Set `AGENTOS_SIDECAR_BIN` to an absolute path to override resolution for
|
|
16
|
+
development or custom builds.
|
|
17
|
+
|
|
18
|
+
Supported platforms: `linux-x64-gnu`, `linux-arm64-gnu`, `darwin-x64`,
|
|
19
|
+
`darwin-arm64`.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the absolute path to the prebuilt `agentos-native-sidecar` binary for
|
|
3
|
+
* the current platform.
|
|
4
|
+
*
|
|
5
|
+
* Resolution priority:
|
|
6
|
+
* 1. `AGENTOS_SIDECAR_BIN` env var.
|
|
7
|
+
* 2. A `agentos-native-sidecar` binary placed next to this package.
|
|
8
|
+
* 3. The platform-specific `@rivet-dev/agentos-runtime-sidecar-<platform>` package.
|
|
9
|
+
*
|
|
10
|
+
* @throws if the platform is unsupported or no binary can be found.
|
|
11
|
+
*/
|
|
12
|
+
export function getSidecarPath(): string;
|
package/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Platform-specific resolver for the prebuilt `agentos-native-sidecar` binary.
|
|
4
|
+
// The binary itself ships inside one of the `@rivet-dev/agentos-runtime-sidecar-<platform>`
|
|
5
|
+
// packages, declared as optionalDependencies at publish time so npm only
|
|
6
|
+
// installs the package matching the current `os`/`cpu`/`libc`.
|
|
7
|
+
//
|
|
8
|
+
// Resolution priority:
|
|
9
|
+
// 1. `AGENTOS_SIDECAR_BIN` env var.
|
|
10
|
+
// 2. A `agentos-native-sidecar` binary placed next to this package.
|
|
11
|
+
// 3. The platform-specific `@rivet-dev/agentos-runtime-sidecar-<platform>` package.
|
|
12
|
+
|
|
13
|
+
const { existsSync } = require("node:fs");
|
|
14
|
+
const { join, dirname } = require("node:path");
|
|
15
|
+
|
|
16
|
+
const BINARY_BASENAME = "agentos-native-sidecar";
|
|
17
|
+
|
|
18
|
+
// The on-disk binary name carries the `.exe` suffix on Windows; every other
|
|
19
|
+
// platform ships an extension-less ELF/Mach-O binary.
|
|
20
|
+
const BINARY_NAME =
|
|
21
|
+
process.platform === "win32" ? `${BINARY_BASENAME}.exe` : BINARY_BASENAME;
|
|
22
|
+
|
|
23
|
+
// No runtime chmod. Platform packages are published with `npm publish`, which
|
|
24
|
+
// preserves the binary's 0755 executable bit.
|
|
25
|
+
|
|
26
|
+
// Detect whether the current Linux process links glibc or musl. Mirrors the
|
|
27
|
+
// npm `libc` field used to gate the platform packages: glibc reports a glibc
|
|
28
|
+
// version via `process.report`, musl does not.
|
|
29
|
+
function detectLinuxLibc() {
|
|
30
|
+
try {
|
|
31
|
+
const report = process.report?.getReport?.();
|
|
32
|
+
const glibc = report?.header?.glibcVersionRuntime;
|
|
33
|
+
if (glibc) return "glibc";
|
|
34
|
+
} catch {
|
|
35
|
+
// fall through to filesystem probe
|
|
36
|
+
}
|
|
37
|
+
// Fallback: presence of the musl loader implies a musl userland.
|
|
38
|
+
if (existsSync("/lib/ld-musl-x86_64.so.1") || existsSync("/lib/ld-musl-aarch64.so.1")) {
|
|
39
|
+
return "musl";
|
|
40
|
+
}
|
|
41
|
+
return "glibc";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getPlatformPackageName() {
|
|
45
|
+
const { platform, arch } = process;
|
|
46
|
+
switch (platform) {
|
|
47
|
+
case "linux": {
|
|
48
|
+
const libc = detectLinuxLibc();
|
|
49
|
+
if (arch === "x64")
|
|
50
|
+
return libc === "musl"
|
|
51
|
+
? "@rivet-dev/agentos-runtime-sidecar-linux-x64-musl"
|
|
52
|
+
: "@rivet-dev/agentos-runtime-sidecar-linux-x64-gnu";
|
|
53
|
+
if (arch === "arm64")
|
|
54
|
+
return libc === "musl"
|
|
55
|
+
? "@rivet-dev/agentos-runtime-sidecar-linux-arm64-musl"
|
|
56
|
+
: "@rivet-dev/agentos-runtime-sidecar-linux-arm64-gnu";
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "darwin":
|
|
60
|
+
if (arch === "x64") return "@rivet-dev/agentos-runtime-sidecar-darwin-x64";
|
|
61
|
+
if (arch === "arm64") return "@rivet-dev/agentos-runtime-sidecar-darwin-arm64";
|
|
62
|
+
break;
|
|
63
|
+
case "win32":
|
|
64
|
+
if (arch === "x64") return "@rivet-dev/agentos-runtime-sidecar-windows-x64";
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function getSidecarPath() {
|
|
73
|
+
const override = process.env.AGENTOS_SIDECAR_BIN;
|
|
74
|
+
if (override) {
|
|
75
|
+
if (!existsSync(override)) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`AGENTOS_SIDECAR_BIN is set to ${override} but the file does not exist`,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return override;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const localBinary = join(__dirname, BINARY_NAME);
|
|
84
|
+
if (existsSync(localBinary)) {
|
|
85
|
+
return localBinary;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const platformPkg = getPlatformPackageName();
|
|
89
|
+
if (!platformPkg) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
`@rivet-dev/agentos-runtime-sidecar: unsupported platform ${process.platform}/${process.arch}. ` +
|
|
92
|
+
"The AgentOS sidecar supports linux (x64/arm64, glibc/musl), " +
|
|
93
|
+
"macOS (x64/arm64), and Windows (x64). " +
|
|
94
|
+
"Set AGENTOS_SIDECAR_BIN to a local agentos-native-sidecar binary to override.",
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let pkgJsonPath;
|
|
99
|
+
try {
|
|
100
|
+
pkgJsonPath = require.resolve(`${platformPkg}/package.json`);
|
|
101
|
+
} catch {
|
|
102
|
+
throw new Error(
|
|
103
|
+
`@rivet-dev/agentos-runtime-sidecar: platform package ${platformPkg} is not installed.\n` +
|
|
104
|
+
"This usually means the platform is unsupported or optionalDependencies were\n" +
|
|
105
|
+
`skipped during install. Try: npm install --include=optional ${platformPkg}\n` +
|
|
106
|
+
"Or set AGENTOS_SIDECAR_BIN to a local agentos-native-sidecar binary.",
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return join(dirname(pkgJsonPath), BINARY_NAME);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
module.exports = { getSidecarPath };
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rivet-dev/agentos-runtime-sidecar",
|
|
3
|
+
"version": "0.0.0-agent-acp-codex-session-benchmark.62b1f46",
|
|
4
|
+
"description": "Platform-specific resolver for the Secure Exec native sidecar binary",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/rivet-dev/secure-exec.git",
|
|
9
|
+
"directory": "packages/sidecar"
|
|
10
|
+
},
|
|
11
|
+
"main": "./index.js",
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"index.d.ts",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"check-types": "node -e \"process.exit(0)\"",
|
|
20
|
+
"test": "node --test tests/*.test.cjs"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"optionalDependencies": {
|
|
26
|
+
"@rivet-dev/agentos-runtime-sidecar-darwin-arm64": "0.0.0-agent-acp-codex-session-benchmark.62b1f46",
|
|
27
|
+
"@rivet-dev/agentos-runtime-sidecar-darwin-x64": "0.0.0-agent-acp-codex-session-benchmark.62b1f46",
|
|
28
|
+
"@rivet-dev/agentos-runtime-sidecar-linux-arm64-gnu": "0.0.0-agent-acp-codex-session-benchmark.62b1f46",
|
|
29
|
+
"@rivet-dev/agentos-runtime-sidecar-linux-x64-gnu": "0.0.0-agent-acp-codex-session-benchmark.62b1f46"
|
|
30
|
+
}
|
|
31
|
+
}
|