@rivet-dev/agentos 0.2.5-rc.3 → 0.2.5-rc.4
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/dist/index.d.ts +22 -4
- package/dist/index.js +14 -113
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -132,7 +132,6 @@ declare const nativeAgentOsOptionsSchema: z.ZodObject<{
|
|
|
132
132
|
}, z.core.$strict>]>>>;
|
|
133
133
|
}, z.core.$strict>>;
|
|
134
134
|
mounts: z.ZodOptional<z.ZodArray<z.ZodType<NativeMountConfig, unknown, z.core.$ZodTypeInternals<NativeMountConfig, unknown>>>>;
|
|
135
|
-
moduleAccessCwd: z.ZodOptional<z.ZodString>;
|
|
136
135
|
additionalInstructions: z.ZodOptional<z.ZodString>;
|
|
137
136
|
permissions: z.ZodOptional<z.ZodObject<{
|
|
138
137
|
fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
@@ -288,6 +287,10 @@ declare const nativeAgentOsOptionsSchema: z.ZodObject<{
|
|
|
288
287
|
}, z.core.$strict>>;
|
|
289
288
|
jsRuntime: z.ZodOptional<z.ZodObject<{
|
|
290
289
|
v8HeapLimitMb: z.ZodOptional<z.ZodNumber>;
|
|
290
|
+
syncRpcWaitTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
291
|
+
cpuTimeLimitMs: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
wallClockLimitMs: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
importCacheMaterializeTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
291
294
|
capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
292
295
|
stdinBufferLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
293
296
|
eventPayloadLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
@@ -296,12 +299,15 @@ declare const nativeAgentOsOptionsSchema: z.ZodObject<{
|
|
|
296
299
|
python: z.ZodOptional<z.ZodObject<{
|
|
297
300
|
outputBufferMaxBytes: z.ZodOptional<z.ZodNumber>;
|
|
298
301
|
executionTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
302
|
+
maxOldSpaceMb: z.ZodOptional<z.ZodNumber>;
|
|
299
303
|
vfsRpcTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
300
304
|
}, z.core.$strict>>;
|
|
301
305
|
wasm: z.ZodOptional<z.ZodObject<{
|
|
302
306
|
maxModuleFileBytes: z.ZodOptional<z.ZodNumber>;
|
|
303
307
|
capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
304
308
|
syncReadLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
309
|
+
prewarmTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
310
|
+
runnerHeapLimitMb: z.ZodOptional<z.ZodNumber>;
|
|
305
311
|
}, z.core.$strict>>;
|
|
306
312
|
}, z.core.$strict>>;
|
|
307
313
|
}, z.core.$strict>;
|
|
@@ -326,7 +332,6 @@ declare const agentOsActorConfigSchema: z.ZodObject<{
|
|
|
326
332
|
}, z.core.$strict>]>>>;
|
|
327
333
|
}, z.core.$strict>>;
|
|
328
334
|
mounts: z.ZodOptional<z.ZodArray<z.ZodType<NativeMountConfig, unknown, z.core.$ZodTypeInternals<NativeMountConfig, unknown>>>>;
|
|
329
|
-
moduleAccessCwd: z.ZodOptional<z.ZodString>;
|
|
330
335
|
additionalInstructions: z.ZodOptional<z.ZodString>;
|
|
331
336
|
permissions: z.ZodOptional<z.ZodObject<{
|
|
332
337
|
fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
@@ -482,6 +487,10 @@ declare const agentOsActorConfigSchema: z.ZodObject<{
|
|
|
482
487
|
}, z.core.$strict>>;
|
|
483
488
|
jsRuntime: z.ZodOptional<z.ZodObject<{
|
|
484
489
|
v8HeapLimitMb: z.ZodOptional<z.ZodNumber>;
|
|
490
|
+
syncRpcWaitTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
491
|
+
cpuTimeLimitMs: z.ZodOptional<z.ZodNumber>;
|
|
492
|
+
wallClockLimitMs: z.ZodOptional<z.ZodNumber>;
|
|
493
|
+
importCacheMaterializeTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
485
494
|
capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
486
495
|
stdinBufferLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
487
496
|
eventPayloadLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
@@ -490,12 +499,15 @@ declare const agentOsActorConfigSchema: z.ZodObject<{
|
|
|
490
499
|
python: z.ZodOptional<z.ZodObject<{
|
|
491
500
|
outputBufferMaxBytes: z.ZodOptional<z.ZodNumber>;
|
|
492
501
|
executionTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
502
|
+
maxOldSpaceMb: z.ZodOptional<z.ZodNumber>;
|
|
493
503
|
vfsRpcTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
494
504
|
}, z.core.$strict>>;
|
|
495
505
|
wasm: z.ZodOptional<z.ZodObject<{
|
|
496
506
|
maxModuleFileBytes: z.ZodOptional<z.ZodNumber>;
|
|
497
507
|
capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
498
508
|
syncReadLimitBytes: z.ZodOptional<z.ZodNumber>;
|
|
509
|
+
prewarmTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
510
|
+
runnerHeapLimitMb: z.ZodOptional<z.ZodNumber>;
|
|
499
511
|
}, z.core.$strict>>;
|
|
500
512
|
}, z.core.$strict>>;
|
|
501
513
|
}, z.core.$strict>>;
|
|
@@ -514,7 +526,7 @@ declare const agentOsActorConfigSchema: z.ZodObject<{
|
|
|
514
526
|
* Keep this in sync with the schema above and the Rust serde mirror at
|
|
515
527
|
* `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson`.
|
|
516
528
|
*/
|
|
517
|
-
type NativeAgentOsOptions = Pick<AgentOsOptions, "software" | "defaultSoftware" | "loopbackExemptPorts" | "allowedNodeBuiltins" | "rootFilesystem" | "
|
|
529
|
+
type NativeAgentOsOptions = Pick<AgentOsOptions, "software" | "defaultSoftware" | "loopbackExemptPorts" | "allowedNodeBuiltins" | "rootFilesystem" | "additionalInstructions" | "permissions" | "limits"> & {
|
|
518
530
|
mounts?: NativeMountConfig[];
|
|
519
531
|
sidecar?: {
|
|
520
532
|
kind: "shared";
|
|
@@ -564,6 +576,11 @@ interface DirEntry {
|
|
|
564
576
|
interface SpawnedProcess {
|
|
565
577
|
pid: number;
|
|
566
578
|
}
|
|
579
|
+
/** Options accepted by `exec` (mirrors the env/cwd subset of `ExecOptions`). */
|
|
580
|
+
interface ExecActionOptions {
|
|
581
|
+
env?: Record<string, string>;
|
|
582
|
+
cwd?: string;
|
|
583
|
+
}
|
|
567
584
|
/** Options accepted by `spawn` (mirrors `SpawnActionOptions`). */
|
|
568
585
|
interface SpawnActionOptions {
|
|
569
586
|
env?: Record<string, string>;
|
|
@@ -639,6 +656,7 @@ interface SoftwareInfo {
|
|
|
639
656
|
/** Kebab-case `SoftwareKind` tag. */
|
|
640
657
|
kind: "wasm-commands" | "agent" | "tool";
|
|
641
658
|
version: string | null;
|
|
659
|
+
commands: string[];
|
|
642
660
|
}
|
|
643
661
|
/**
|
|
644
662
|
* The agentOS VM actor's action map. Keep one method per Rust `dispatch` arm.
|
|
@@ -663,7 +681,7 @@ type AgentOsActions = {
|
|
|
663
681
|
}[]) => Promise<WriteFileResult[]>;
|
|
664
682
|
readFiles: (c: Ctx, paths: string[]) => Promise<ReadFileResult[]>;
|
|
665
683
|
readdirRecursive: (c: Ctx, path: string) => Promise<DirEntry[]>;
|
|
666
|
-
exec: (c: Ctx, command: string) => Promise<ExecResult>;
|
|
684
|
+
exec: (c: Ctx, command: string, options?: ExecActionOptions) => Promise<ExecResult>;
|
|
667
685
|
spawn: (c: Ctx, command: string, args: string[], options?: SpawnActionOptions) => Promise<SpawnedProcess>;
|
|
668
686
|
waitProcess: (c: Ctx, pid: number) => Promise<number>;
|
|
669
687
|
killProcess: (c: Ctx, pid: number) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
// src/actor.ts
|
|
2
|
-
import { readFileSync } from "fs";
|
|
3
2
|
import { dirname as dirname2, join as join2 } from "path";
|
|
4
3
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5
4
|
import common from "@agentos-software/common";
|
|
6
|
-
import {
|
|
7
|
-
OPT_AGENTOS_BIN,
|
|
8
|
-
OPT_AGENTOS_ROOT
|
|
9
|
-
} from "@rivet-dev/agentos-core";
|
|
5
|
+
import { OPT_AGENTOS_ROOT } from "@rivet-dev/agentos-core";
|
|
10
6
|
import { getSidecarPath } from "@rivet-dev/agentos-sidecar";
|
|
11
7
|
import {
|
|
12
8
|
actor
|
|
@@ -27,7 +23,6 @@ var nativeAgentOsOptionsSchema = z.object({
|
|
|
27
23
|
allowedNodeBuiltins: agentOsOptionFieldSchemas.allowedNodeBuiltins,
|
|
28
24
|
rootFilesystem: agentOsOptionFieldSchemas.rootFilesystem,
|
|
29
25
|
mounts: z.array(nativeMountConfigSchema).optional(),
|
|
30
|
-
moduleAccessCwd: agentOsOptionFieldSchemas.moduleAccessCwd,
|
|
31
26
|
additionalInstructions: agentOsOptionFieldSchemas.additionalInstructions,
|
|
32
27
|
permissions: agentOsOptionFieldSchemas.permissions,
|
|
33
28
|
sidecar: sharedSidecarConfigSchema.optional(),
|
|
@@ -135,126 +130,32 @@ function toRecord(value) {
|
|
|
135
130
|
}
|
|
136
131
|
function normalizePackageRef(value) {
|
|
137
132
|
if (typeof value === "string") {
|
|
138
|
-
return {
|
|
133
|
+
return { path: value };
|
|
139
134
|
}
|
|
140
135
|
const record = toRecord(value);
|
|
141
|
-
if (typeof record.
|
|
142
|
-
return {
|
|
143
|
-
dir: record.packageDir,
|
|
144
|
-
legacyManifest: legacyPackageManifest(record)
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
if (typeof record.dir === "string") {
|
|
148
|
-
return {
|
|
149
|
-
dir: record.dir,
|
|
150
|
-
legacyManifest: legacyPackageManifest(record)
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return void 0;
|
|
154
|
-
}
|
|
155
|
-
function legacyPackageManifest(record) {
|
|
156
|
-
if (typeof record.name !== "string") {
|
|
157
|
-
return void 0;
|
|
158
|
-
}
|
|
159
|
-
const manifest = { name: record.name };
|
|
160
|
-
const agent = toRecord(record.agent);
|
|
161
|
-
if (typeof agent.acpEntrypoint === "string") {
|
|
162
|
-
manifest.agent = {
|
|
163
|
-
acpEntrypoint: agent.acpEntrypoint,
|
|
164
|
-
...isStringRecord(agent.env) ? { env: agent.env } : {},
|
|
165
|
-
...Array.isArray(agent.launchArgs) && agent.launchArgs.every((arg) => typeof arg === "string") ? { launchArgs: agent.launchArgs } : {},
|
|
166
|
-
...typeof agent.snapshot === "boolean" ? { snapshot: agent.snapshot } : {}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return manifest;
|
|
170
|
-
}
|
|
171
|
-
function readPackageManifestForClient(ref) {
|
|
172
|
-
return tryReadAgentosPackageManifest(ref.dir) ?? ref.legacyManifest;
|
|
173
|
-
}
|
|
174
|
-
function tryReadAgentosPackageManifest(dir) {
|
|
175
|
-
try {
|
|
176
|
-
return readAgentosPackageManifest(dir);
|
|
177
|
-
} catch (error) {
|
|
178
|
-
if (error instanceof Error && errorCode(error) === "ENOENT") {
|
|
179
|
-
return void 0;
|
|
180
|
-
}
|
|
181
|
-
throw error;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
function readAgentosPackageManifest(dir) {
|
|
185
|
-
const manifestPath = join2(dir, "agentos-package.json");
|
|
186
|
-
let parsed;
|
|
187
|
-
try {
|
|
188
|
-
parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
189
|
-
} catch (error) {
|
|
190
|
-
const wrapped = new Error(
|
|
191
|
-
`Failed to read agentOS package manifest at ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
192
|
-
);
|
|
193
|
-
const code = errorCode(error);
|
|
194
|
-
if (code !== void 0) {
|
|
195
|
-
Object.assign(wrapped, { code });
|
|
196
|
-
}
|
|
197
|
-
throw wrapped;
|
|
198
|
-
}
|
|
199
|
-
return validateAgentosPackageManifest(parsed, manifestPath);
|
|
200
|
-
}
|
|
201
|
-
function errorCode(error) {
|
|
202
|
-
if (!isPlainObject(error)) {
|
|
203
|
-
return void 0;
|
|
136
|
+
if (typeof record.packagePath === "string") {
|
|
137
|
+
return { path: record.packagePath };
|
|
204
138
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
function validateAgentosPackageManifest(value, source) {
|
|
208
|
-
if (!isPlainObject(value) || typeof value.name !== "string") {
|
|
209
|
-
throw new Error(`Invalid agentOS package manifest at ${source}: missing name`);
|
|
210
|
-
}
|
|
211
|
-
const manifest = { name: value.name };
|
|
212
|
-
if (value.agent !== void 0) {
|
|
213
|
-
if (!isPlainObject(value.agent) || typeof value.agent.acpEntrypoint !== "string") {
|
|
139
|
+
for (const legacy of ["packageTar", "packageDir", "dir"]) {
|
|
140
|
+
if (typeof record[legacy] === "string") {
|
|
214
141
|
throw new Error(
|
|
215
|
-
`
|
|
142
|
+
`agentOS package ref uses removed field "${legacy}"; packages are referenced by a single \`packagePath\` \u2014 rebuild @agentos-software/* dependencies or pass { packagePath }`
|
|
216
143
|
);
|
|
217
144
|
}
|
|
218
|
-
manifest.agent = {
|
|
219
|
-
acpEntrypoint: value.agent.acpEntrypoint,
|
|
220
|
-
...isStringRecord(value.agent.env) ? { env: value.agent.env } : {},
|
|
221
|
-
...Array.isArray(value.agent.launchArgs) && value.agent.launchArgs.every((arg) => typeof arg === "string") ? { launchArgs: value.agent.launchArgs } : {},
|
|
222
|
-
...typeof value.agent.snapshot === "boolean" ? { snapshot: value.agent.snapshot } : {}
|
|
223
|
-
};
|
|
224
145
|
}
|
|
225
|
-
return
|
|
226
|
-
}
|
|
227
|
-
function isPlainObject(value) {
|
|
228
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
229
|
-
}
|
|
230
|
-
function isStringRecord(value) {
|
|
231
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string");
|
|
146
|
+
return void 0;
|
|
232
147
|
}
|
|
233
148
|
function normalizedPackageRefs(software) {
|
|
234
149
|
const refs = [];
|
|
235
150
|
const seen = /* @__PURE__ */ new Set();
|
|
236
151
|
for (const entry of software.flat()) {
|
|
237
152
|
const ref = normalizePackageRef(entry);
|
|
238
|
-
if (!ref || seen.has(ref.
|
|
239
|
-
seen.add(ref.
|
|
153
|
+
if (!ref || seen.has(ref.path)) continue;
|
|
154
|
+
seen.add(ref.path);
|
|
240
155
|
refs.push(ref);
|
|
241
156
|
}
|
|
242
157
|
return refs;
|
|
243
158
|
}
|
|
244
|
-
function serializedAgentConfigs(packageRefs) {
|
|
245
|
-
const configs = [];
|
|
246
|
-
for (const ref of packageRefs) {
|
|
247
|
-
const manifest = readPackageManifestForClient(ref);
|
|
248
|
-
if (!manifest?.agent) continue;
|
|
249
|
-
configs.push({
|
|
250
|
-
name: manifest.name,
|
|
251
|
-
adapterEntrypoint: `${OPT_AGENTOS_BIN}/${manifest.agent.acpEntrypoint}`,
|
|
252
|
-
launchArgs: manifest.agent.launchArgs,
|
|
253
|
-
defaultEnv: manifest.agent.env
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return configs;
|
|
257
|
-
}
|
|
258
159
|
function buildConfigJson(parsed) {
|
|
259
160
|
const options = nativeAgentOsOptionsSchema.parse(
|
|
260
161
|
parsed.options ?? {}
|
|
@@ -264,16 +165,16 @@ function buildConfigJson(parsed) {
|
|
|
264
165
|
const packageRefs = normalizedPackageRefs(
|
|
265
166
|
defaultSoftwareEnabled ? [common, ...softwareInput] : softwareInput
|
|
266
167
|
);
|
|
267
|
-
const packages = packageRefs.map((ref) => ({
|
|
268
|
-
const agentConfigs = serializedAgentConfigs(packageRefs);
|
|
168
|
+
const packages = packageRefs.map((ref) => ({ packagePath: ref.path }));
|
|
269
169
|
const mounts = serializeNativeMounts(options.mounts);
|
|
270
170
|
const sidecar = serializeSidecar(options.sidecar);
|
|
271
171
|
return JSON.stringify({
|
|
172
|
+
// The actor forwards ONLY package dirs; the sidecar resolves each agent from
|
|
173
|
+
// the projected `/opt/agentos/<name>/current/agentos-package.json` (no
|
|
174
|
+
// client-side adapter-entrypoint resolution — see root CLAUDE.md).
|
|
272
175
|
packages,
|
|
273
176
|
packagesMountAt: OPT_AGENTOS_ROOT,
|
|
274
|
-
agentConfigs,
|
|
275
177
|
additionalInstructions: options.additionalInstructions,
|
|
276
|
-
moduleAccessCwd: options.moduleAccessCwd,
|
|
277
178
|
loopbackExemptPorts: options.loopbackExemptPorts,
|
|
278
179
|
allowedNodeBuiltins: options.allowedNodeBuiltins,
|
|
279
180
|
permissions: options.permissions,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/actor.ts","../src/config.ts","../src/plugin-binary.ts","../src/index.ts"],"sourcesContent":["/**\n * Rust-backed `agentOS(...)` definition.\n *\n * Produces an `ActorDefinition` whose `nativeFactoryBuilder` constructs a\n * native-actor-plugin factory through `runtime.createNativePluginFactory(...)`\n * (NAPI → `dlopen` of the agent-os actor plugin cdylib, the inverse of the\n * generic host loader). All lifecycle, state, and action dispatch live in the\n * Rust plugin (`crates/agentos-actor-plugin`). This JS shim only validates\n * configuration, resolves the plugin + sidecar binaries, and hands the opaque\n * config envelope across the bridge — it owns no agent-os runtime logic.\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport common from \"@agentos-software/common\";\nimport {\n\tOPT_AGENTOS_BIN,\n\tOPT_AGENTOS_ROOT,\n} from \"@rivet-dev/agentos-core\";\nimport { getSidecarPath } from \"@rivet-dev/agentos-sidecar\";\nimport {\n\tactor,\n\ttype ActorDefinition,\n\ttype ActorFactoryHandle,\n\ttype CoreRuntime,\n\ttype DatabaseProvider,\n\ttype NapiNativePluginOptions,\n\ttype RawAccess,\n} from \"rivetkit\";\nimport {\n\ttype AgentOsActorConfig,\n\ttype AgentOsActorConfigInput,\n\tagentOsActorConfigSchema,\n\tnativeAgentOsOptionsSchema,\n} from \"./config.js\";\nimport { getPluginPath } from \"./plugin-binary.js\";\nimport type { AgentOsActions } from \"./actor-actions.js\";\nimport type { AgentOsActorState, AgentOsActorVars } from \"./types.js\";\n\n/**\n * Build the JSON envelope the Rust plugin consumes. The Rust deserializer\n * uses `deny_unknown_fields`, so the envelope must stay in lock-step with\n * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson`.\n *\n * Software threading: each software ref is flattened (meta packages such as\n * `common` are arrays of refs), normalized to a package dir, and forwarded as\n * `{ dir }` so the sidecar owns the `/opt/agentos` projection. Agent configs\n * are derived from each package's `agentos-package.json`, mirroring\n * `packages/core/src/agent-os.ts`.\n */\ninterface NativeMountLike {\n\tpath: string;\n\tplugin: {\n\t\tid: string;\n\t\tconfig?: unknown;\n\t};\n\treadOnly?: boolean;\n}\n\ninterface PackageAgentManifest {\n\tacpEntrypoint: string;\n\tenv?: Record<string, string>;\n\tlaunchArgs?: string[];\n\tsnapshot?: boolean;\n}\n\ninterface PackageManifest {\n\tname: string;\n\tagent?: PackageAgentManifest;\n}\n\ninterface NormalizedPackageRef {\n\tdir: string;\n\tlegacyManifest?: PackageManifest;\n}\n\ninterface SerializedAgentConfig {\n\tname: string;\n\tadapterEntrypoint: string;\n\tlaunchArgs?: string[];\n\tdefaultEnv?: Record<string, string>;\n}\n\n/**\n * A native `host_dir` mount of a host `node_modules` directory at\n * `/root/node_modules`, the serializable form `agentOS({ options: { mounts } })`\n * accepts across the NAPI boundary.\n */\nexport interface NodeModulesMountConfig {\n\tpath: \"/root/node_modules\";\n\tplugin: { id: \"host_dir\"; config: { hostPath: string; readOnly: boolean } };\n\treadOnly: boolean;\n}\n\n/**\n * Mount a host `node_modules` directory into the VM at `/root/node_modules`.\n *\n * This is the explicit, mount-based replacement for the removed `moduleAccessCwd`\n * mechanism: the VM module resolver reads the mounted tree through the kernel\n * VFS, so the caller supplies exactly the `node_modules` directory whose\n * packages should resolve in the guest.\n *\n * @param hostNodeModulesDir Absolute host path to a `node_modules` directory.\n * @param opts.readOnly Defaults to `true`; the mount is read-only.\n */\nexport function nodeModulesMount(\n\thostNodeModulesDir: string,\n\topts?: { readOnly?: boolean },\n): NodeModulesMountConfig {\n\tconst readOnly = opts?.readOnly ?? true;\n\treturn {\n\t\tpath: \"/root/node_modules\",\n\t\tplugin: {\n\t\t\tid: \"host_dir\",\n\t\t\tconfig: { hostPath: hostNodeModulesDir, readOnly },\n\t\t},\n\t\treadOnly,\n\t};\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n\treturn value && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: {};\n}\n\nfunction normalizePackageRef(value: unknown): NormalizedPackageRef | undefined {\n\tif (typeof value === \"string\") {\n\t\treturn { dir: value };\n\t}\n\tconst record = toRecord(value);\n\tif (typeof record.packageDir === \"string\") {\n\t\treturn {\n\t\t\tdir: record.packageDir,\n\t\t\tlegacyManifest: legacyPackageManifest(record),\n\t\t};\n\t}\n\tif (typeof record.dir === \"string\") {\n\t\treturn {\n\t\t\tdir: record.dir,\n\t\t\tlegacyManifest: legacyPackageManifest(record),\n\t\t};\n\t}\n\treturn undefined;\n}\n\nfunction legacyPackageManifest(\n\trecord: Record<string, unknown>,\n): PackageManifest | undefined {\n\tif (typeof record.name !== \"string\") {\n\t\treturn undefined;\n\t}\n\tconst manifest: PackageManifest = { name: record.name };\n\tconst agent = toRecord(record.agent);\n\tif (typeof agent.acpEntrypoint === \"string\") {\n\t\tmanifest.agent = {\n\t\t\tacpEntrypoint: agent.acpEntrypoint,\n\t\t\t...(isStringRecord(agent.env) ? { env: agent.env } : {}),\n\t\t\t...(Array.isArray(agent.launchArgs) &&\n\t\t\tagent.launchArgs.every((arg) => typeof arg === \"string\")\n\t\t\t\t? { launchArgs: agent.launchArgs }\n\t\t\t\t: {}),\n\t\t\t...(typeof agent.snapshot === \"boolean\" ? { snapshot: agent.snapshot } : {}),\n\t\t};\n\t}\n\treturn manifest;\n}\n\nfunction readPackageManifestForClient(\n\tref: NormalizedPackageRef,\n): PackageManifest | undefined {\n\treturn tryReadAgentosPackageManifest(ref.dir) ?? ref.legacyManifest;\n}\n\nfunction tryReadAgentosPackageManifest(\n\tdir: string,\n): PackageManifest | undefined {\n\ttry {\n\t\treturn readAgentosPackageManifest(dir);\n\t} catch (error) {\n\t\tif (error instanceof Error && errorCode(error) === \"ENOENT\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nfunction readAgentosPackageManifest(dir: string): PackageManifest {\n\tconst manifestPath = join(dir, \"agentos-package.json\");\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(readFileSync(manifestPath, \"utf8\"));\n\t} catch (error) {\n\t\tconst wrapped = new Error(\n\t\t\t`Failed to read agentOS package manifest at ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t\tconst code = errorCode(error);\n\t\tif (code !== undefined) {\n\t\t\tObject.assign(wrapped, { code });\n\t\t}\n\t\tthrow wrapped;\n\t}\n\treturn validateAgentosPackageManifest(parsed, manifestPath);\n}\n\nfunction errorCode(error: unknown): string | undefined {\n\tif (!isPlainObject(error)) {\n\t\treturn undefined;\n\t}\n\treturn typeof error.code === \"string\" ? error.code : undefined;\n}\n\nfunction validateAgentosPackageManifest(\n\tvalue: unknown,\n\tsource: string,\n): PackageManifest {\n\tif (!isPlainObject(value) || typeof value.name !== \"string\") {\n\t\tthrow new Error(`Invalid agentOS package manifest at ${source}: missing name`);\n\t}\n\tconst manifest: PackageManifest = { name: value.name };\n\tif (value.agent !== undefined) {\n\t\tif (\n\t\t\t!isPlainObject(value.agent) ||\n\t\t\ttypeof value.agent.acpEntrypoint !== \"string\"\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid agentOS package manifest at ${source}: invalid agent.acpEntrypoint`,\n\t\t\t);\n\t\t}\n\t\tmanifest.agent = {\n\t\t\tacpEntrypoint: value.agent.acpEntrypoint,\n\t\t\t...(isStringRecord(value.agent.env) ? { env: value.agent.env } : {}),\n\t\t\t...(Array.isArray(value.agent.launchArgs) &&\n\t\t\tvalue.agent.launchArgs.every((arg) => typeof arg === \"string\")\n\t\t\t\t? { launchArgs: value.agent.launchArgs }\n\t\t\t\t: {}),\n\t\t\t...(typeof value.agent.snapshot === \"boolean\"\n\t\t\t\t? { snapshot: value.agent.snapshot }\n\t\t\t\t: {}),\n\t\t};\n\t}\n\treturn manifest;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isStringRecord(value: unknown): value is Record<string, string> {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === \"object\" &&\n\t\t!Array.isArray(value) &&\n\t\tObject.values(value).every((entry) => typeof entry === \"string\")\n\t);\n}\n\nfunction normalizedPackageRefs(software: unknown[]): NormalizedPackageRef[] {\n\tconst refs: NormalizedPackageRef[] = [];\n\tconst seen = new Set<string>();\n\tfor (const entry of software.flat()) {\n\t\tconst ref = normalizePackageRef(entry);\n\t\tif (!ref || seen.has(ref.dir)) continue;\n\t\tseen.add(ref.dir);\n\t\trefs.push(ref);\n\t}\n\treturn refs;\n}\n\nfunction serializedAgentConfigs(\n\tpackageRefs: NormalizedPackageRef[],\n): SerializedAgentConfig[] {\n\tconst configs: SerializedAgentConfig[] = [];\n\tfor (const ref of packageRefs) {\n\t\tconst manifest = readPackageManifestForClient(ref);\n\t\tif (!manifest?.agent) continue;\n\t\tconfigs.push({\n\t\t\tname: manifest.name,\n\t\t\tadapterEntrypoint: `${OPT_AGENTOS_BIN}/${manifest.agent.acpEntrypoint}`,\n\t\t\tlaunchArgs: manifest.agent.launchArgs,\n\t\t\tdefaultEnv: manifest.agent.env,\n\t\t});\n\t}\n\treturn configs;\n}\n\nexport function buildConfigJson<TConnParams>(\n\tparsed: AgentOsActorConfig<TConnParams>,\n): string {\n\tconst options = nativeAgentOsOptionsSchema.parse(\n\t\tparsed.options ?? {},\n\t) as Record<string, unknown>;\n\tconst softwareInput = Array.isArray(options.software) ? options.software : [];\n\tconst defaultSoftwareEnabled = options.defaultSoftware !== false;\n\tconst packageRefs = normalizedPackageRefs(\n\t\tdefaultSoftwareEnabled ? [common, ...softwareInput] : softwareInput,\n\t);\n\tconst packages = packageRefs.map((ref) => ({ dir: ref.dir }));\n\tconst agentConfigs = serializedAgentConfigs(packageRefs);\n\tconst mounts = serializeNativeMounts(options.mounts);\n\tconst sidecar = serializeSidecar(options.sidecar);\n\treturn JSON.stringify({\n\t\tpackages,\n\t\tpackagesMountAt: OPT_AGENTOS_ROOT,\n\t\tagentConfigs,\n\t\tadditionalInstructions: options.additionalInstructions,\n\t\tmoduleAccessCwd: options.moduleAccessCwd,\n\t\tloopbackExemptPorts: options.loopbackExemptPorts,\n\t\tallowedNodeBuiltins: options.allowedNodeBuiltins,\n\t\tpermissions: options.permissions,\n\t\trootFilesystem: options.rootFilesystem,\n\t\tmounts,\n\t\tlimits: options.limits,\n\t\tsidecar,\n\t});\n}\n\nfunction serializeNativeMounts(input: unknown): NativeMountLike[] | undefined {\n\tif (input == null) return undefined;\n\tif (!Array.isArray(input)) {\n\t\tthrow new Error(\"agentOS() options.mounts must be an array\");\n\t}\n\treturn input.map((mount, index) => {\n\t\tif (!mount || typeof mount !== \"object\") {\n\t\t\tthrow new Error(`agentOS() options.mounts[${index}] must be an object`);\n\t\t}\n\t\tconst record = mount as Record<string, unknown>;\n\t\tif (record.driver !== undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"agentOS() only supports Native mounts across the NAPI boundary; Plain mounts with driver callbacks are not serializable\",\n\t\t\t);\n\t\t}\n\t\tif (record.filesystem !== undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"agentOS() only supports Native mounts across the NAPI boundary; Overlay mounts are not serializable\",\n\t\t\t);\n\t\t}\n\t\tconst plugin = record.plugin;\n\t\tif (\n\t\t\ttypeof record.path !== \"string\" ||\n\t\t\t!plugin ||\n\t\t\ttypeof plugin !== \"object\" ||\n\t\t\ttypeof (plugin as Record<string, unknown>).id !== \"string\"\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`agentOS() options.mounts[${index}] must be a Native mount with { path, plugin: { id, config? } }`,\n\t\t\t);\n\t\t}\n\t\treturn {\n\t\t\tpath: record.path,\n\t\t\tplugin: {\n\t\t\t\tid: (plugin as Record<string, unknown>).id as string,\n\t\t\t\tconfig: (plugin as Record<string, unknown>).config,\n\t\t\t},\n\t\t\treadOnly:\n\t\t\t\ttypeof record.readOnly === \"boolean\" ? record.readOnly : undefined,\n\t\t};\n\t});\n}\n\nfunction serializeSidecar(input: unknown): { pool?: string } | undefined {\n\tif (input == null) return undefined;\n\tif (!input || typeof input !== \"object\") {\n\t\tthrow new Error(\"agentOS() options.sidecar must be an object\");\n\t}\n\tconst record = input as Record<string, unknown>;\n\tif (record.kind === \"explicit\" || record.handle !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"agentOS() only supports sidecar shared pool configuration across the NAPI boundary; explicit sidecar handles are not serializable\",\n\t\t);\n\t}\n\tif (record.kind !== undefined && record.kind !== \"shared\") {\n\t\tthrow new Error('agentOS() options.sidecar.kind must be \"shared\"');\n\t}\n\treturn typeof record.pool === \"string\" ? { pool: record.pool } : {};\n}\n\nfunction buildNativeFactoryBuilder<TConnParams>(\n\tparsed: AgentOsActorConfig<TConnParams>,\n): (runtime: CoreRuntime) => ActorFactoryHandle {\n\treturn (runtime) => {\n\t\tif (runtime.kind !== \"napi\") {\n\t\t\tthrow new Error(\n\t\t\t\t`agentOS() is only supported on the native NAPI runtime (current runtime kind: ${runtime.kind})`,\n\t\t\t);\n\t\t}\n\t\tif (!runtime.createNativePluginFactory) {\n\t\t\tthrow new Error(\n\t\t\t\t\"runtime.createNativePluginFactory is not implemented on the active CoreRuntime\",\n\t\t\t);\n\t\t}\n\t\tconst options: NapiNativePluginOptions = {\n\t\t\t// Resolve the prebuilt agent-os actor plugin cdylib; RivetKit `dlopen`s\n\t\t\t// it through the generic native-plugin ABI.\n\t\t\tpluginPath: getPluginPath(),\n\t\t\t// Opaque config envelope the plugin parses (config.rs::AgentOsConfigJson).\n\t\t\tconfigJson: buildConfigJson(parsed),\n\t\t\t// Resolve the prebuilt sidecar binary from the npm package so the plugin\n\t\t\t// spawns the bundled binary rather than relying on `agentos-sidecar`\n\t\t\t// being on PATH.\n\t\t\tsidecarPath: getSidecarPath(),\n\t\t\t// Custom inspector tabs. The native-plugin path bypasses the normal\n\t\t\t// actor-config assembly (`buildActorConfig`/`inspectorTabs`), so the\n\t\t\t// tabs MUST ride on the plugin options: the Rust NAPI binding\n\t\t\t// `from_native_plugin` forwards `inspectorTabs` into the actor config so\n\t\t\t// the dashboard serves `/inspector/custom-tabs/<id>/` and advertises them\n\t\t\t// in `tab-config`. (Setting `actor({ inspector })` alone does nothing for\n\t\t\t// native-plugin actors.)\n\t\t\tinspectorTabs: AGENTOS_INSPECTOR_CONFIG.tabs,\n\t\t} as NapiNativePluginOptions & {\n\t\t\tinspectorTabs: typeof AGENTOS_INSPECTOR_CONFIG.tabs;\n\t\t};\n\t\treturn runtime.createNativePluginFactory(options);\n\t};\n}\n\n/**\n * Type alias for the `agentOS(...)` return type. Events are not typed at the TS\n * surface because the Rust plugin owns the broadcast set, but the ACTIONS are\n * typed via {@link AgentOsActions} — a TS mirror of the Rust dispatch in\n * `crates/agentos-actor-plugin/src/actions/mod.rs`. That is what gives\n * `createClient<typeof registry>()` a fully-typed handle (e.g. `handle.exec()`\n * returns `ExecResult`, not `unknown`). Keep the two in sync.\n */\nexport type AgentOsActorDefinition<TConnParams> = ActorDefinition<\n\tAgentOsActorState,\n\tTConnParams,\n\tundefined,\n\tAgentOsActorVars,\n\tundefined,\n\tDatabaseProvider<RawAccess>,\n\tRecord<never, never>,\n\tRecord<never, never>,\n\tAgentOsActions\n>;\n\n// One hour — far past any normal agent turn, connection setup, or idle gap, but\n// still a finite bound (never `0`/Infinity) per the limits-and-observability\n// policy. Agent turns routinely run minutes; the stock RivetKit defaults\n// (actionTimeout 60s, on{Before,}ConnectTimeout 5s, sleepTimeout 30s) cut them\n// off mid-flight and broke live `sessionEvent` streaming with\n// \"actor websocket connection setup timed out after 5000 ms\".\nconst ACTOR_NEVER_HIT_MS = 60 * 60 * 1000;\n// 512 MiB — large prompts/results stream as single actor messages; the stock\n// 64 KiB incoming / 1 MiB outgoing caps truncate real agent payloads.\nconst ACTOR_NEVER_HIT_MESSAGE_BYTES = 512 * 1024 * 1024;\n\n/**\n * Never-hit-by-normal-use defaults for the AgentOS actor. Every value is a high\n * but finite bound so a long multi-step agent turn, a slow connection setup, a\n * large prompt/result, and live `sessionEvent` streaming all complete without\n * tripping a RivetKit actor default. Callers can still override any single knob\n * via `actorOptions` (their value wins over these defaults).\n */\nexport const DEFAULT_AGENTOS_ACTOR_OPTIONS = {\n\t// Connection/setup lifecycle (stock 5s each) — the websocket setup path that\n\t// was timing out at 5000ms and dropping all streamed events.\n\tonBeforeConnectTimeout: ACTOR_NEVER_HIT_MS,\n\tonConnectTimeout: ACTOR_NEVER_HIT_MS,\n\tcreateVarsTimeout: ACTOR_NEVER_HIT_MS,\n\tcreateConnStateTimeout: ACTOR_NEVER_HIT_MS,\n\tonMigrateTimeout: ACTOR_NEVER_HIT_MS,\n\t// Action/RPC lifecycle (stock 60s) — long multi-step prompt turns.\n\tactionTimeout: ACTOR_NEVER_HIT_MS,\n\t// Idle/keepalive — don't reap a live session or sleep mid-turn (stock\n\t// connectionLivenessTimeout 2.5s, sleepTimeout 30s). The liveness *interval*\n\t// (ping cadence) is intentionally left at its small default.\n\tconnectionLivenessTimeout: ACTOR_NEVER_HIT_MS,\n\tsleepTimeout: ACTOR_NEVER_HIT_MS,\n\t// Payload sizes — large prompts/results. `maxQueueMessageSize` is the\n\t// per-actor message cap (stock 64 KiB); the transport-level\n\t// max{Incoming,Outgoing}MessageSize live on the registry/setup config (see\n\t// AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULTS), not on per-actor options.\n\tmaxQueueSize: 1_000_000,\n\tmaxQueueMessageSize: ACTOR_NEVER_HIT_MESSAGE_BYTES,\n} as const;\n\n// Absolute path to the built inspector-tabs app (the shared Vite bundle). All\n// custom tabs share this one `source` dir; the app routes on the\n// `/inspector/custom-tabs/<id>/` URL segment. Resolves from both `src/` (tsx dev\n// / the demo) and the published `dist/`, since `assets/` sits at the package\n// root in both layouts.\nconst INSPECTOR_TABS_ASSET_DIR = join(\n\tdirname(fileURLToPath(import.meta.url)),\n\t\"..\",\n\t\"assets\",\n\t\"inspector-tabs-app\",\n);\n\n// Custom inspector tabs shipped by agent-os. Ids MUST match the `TABS` registry\n// in `src/inspector-tabs/main.tsx`. The built-in rivetkit tabs are hidden so the\n// dashboard shows only the agent-os tabs.\nconst AGENTOS_INSPECTOR_CONFIG = {\n\ttabs: [\n\t\t{ id: \"transcript\", label: \"Transcript\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"comments\" },\n\t\t{ id: \"filesystem\", label: \"Filesystem\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"folder-tree\" },\n\t\t{ id: \"processes\", label: \"Processes\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"microchip\" },\n\t\t{ id: \"software\", label: \"Software\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"box-archive\" },\n\t\t{ id: \"mounts\", label: \"Mounts\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"hard-drive\" },\n\t\t...([\"workflow\", \"database\", \"state\", \"queue\", \"connections\", \"console\"].map(\n\t\t\t(id) => ({ id, hidden: true as const }),\n\t\t)),\n\t],\n};\n\nexport function createAgentOS<TConnParams = undefined>(\n\tconfig: AgentOsActorConfigInput<TConnParams>,\n): AgentOsActorDefinition<TConnParams> {\n\tconst parsed = agentOsActorConfigSchema.parse(\n\t\tconfig,\n\t) as AgentOsActorConfig<TConnParams>;\n\n\t// Construct a minimal definition through the existing actor() helper, then\n\t// attach the Rust factory builder marker. The actions block stays empty\n\t// because no JS-side action ever runs: the engine driver branches on\n\t// `nativeFactoryBuilder` before reaching the JS dispatch path.\n\tconst userActorOptions = (\n\t\tparsed as { actorOptions?: Record<string, unknown> }\n\t).actorOptions;\n\t// High never-hit defaults, with any caller-supplied option winning.\n\tconst actorOptions = {\n\t\t...DEFAULT_AGENTOS_ACTOR_OPTIONS,\n\t\t...(userActorOptions ?? {}),\n\t};\n\tconst definition = actor({\n\t\tactions: {},\n\t\toptions: actorOptions,\n\t\t// Register the custom agent-os inspector tabs (and hide the built-in\n\t\t// rivetkit tabs) so the dashboard renders the agent-os UI. Without this\n\t\t// the shipped tab assets are never surfaced.\n\t\tinspector: AGENTOS_INSPECTOR_CONFIG,\n\t} as Parameters<\n\t\ttypeof actor\n\t>[0]) as unknown as AgentOsActorDefinition<TConnParams>;\n\tdefinition.nativeFactoryBuilder = buildNativeFactoryBuilder(parsed);\n\treturn definition;\n}\n","import type {\n\tAgentOsOptions,\n\tJsonRpcNotification,\n\tNativeMountConfig,\n\tPermissionRequest,\n} from \"@rivet-dev/agentos-core\";\nimport {\n\tagentOsOptionFieldSchemas,\n\tnativeMountConfigSchema,\n\tsharedSidecarConfigSchema,\n} from \"@rivet-dev/agentos-core\";\nimport type { ActorContext, BeforeConnectContext } from \"rivetkit\";\nimport { z } from \"zod/v4\";\nimport type { AgentOsActorState, AgentOsActorVars } from \"./types.js\";\n\nconst zFunction = <\n\tT extends (...args: any[]) => any = (...args: unknown[]) => unknown,\n>() => z.custom<T>((val) => typeof val === \"function\");\n\nexport const nativeAgentOsOptionsSchema = z\n\t// Native actor options are a JSON-serializable subset of AgentOsOptions.\n\t// Keep this allow-list in sync with buildConfigJson() and\n\t// crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson.\n\t.object({\n\t\tsoftware: agentOsOptionFieldSchemas.software,\n\t\tdefaultSoftware: agentOsOptionFieldSchemas.defaultSoftware,\n\t\tloopbackExemptPorts: agentOsOptionFieldSchemas.loopbackExemptPorts,\n\t\tallowedNodeBuiltins: agentOsOptionFieldSchemas.allowedNodeBuiltins,\n\t\trootFilesystem: agentOsOptionFieldSchemas.rootFilesystem,\n\t\tmounts: z.array(nativeMountConfigSchema).optional(),\n\t\tmoduleAccessCwd: agentOsOptionFieldSchemas.moduleAccessCwd,\n\t\tadditionalInstructions: agentOsOptionFieldSchemas.additionalInstructions,\n\t\tpermissions: agentOsOptionFieldSchemas.permissions,\n\t\tsidecar: sharedSidecarConfigSchema.optional(),\n\t\tlimits: agentOsOptionFieldSchemas.limits,\n\t})\n\t.strict();\n\n/**\n * RivetKit actor lifecycle/transport options forwarded to `actor({ options })`.\n *\n * Validated downstream by RivetKit's own actor config schema, so this stays a\n * permissive pass-through allow-list. `agentOS()` overlays the never-hit\n * defaults in `DEFAULT_AGENTOS_ACTOR_OPTIONS` (see actor.ts) and lets any value\n * here win, so callers can still tighten a bound when they want one.\n */\nexport const agentOsActorOptionsSchema = z\n\t.record(z.string(), z.unknown())\n\t.optional();\n\nexport const agentOsActorConfigSchema = z\n\t.object({\n\t\toptions: nativeAgentOsOptionsSchema.optional(),\n\t\tactorOptions: agentOsActorOptionsSchema,\n\t\tpreview: z\n\t\t\t.object({\n\t\t\t\tdefaultExpiresInSeconds: z.number().positive().default(3600),\n\t\t\t\tmaxExpiresInSeconds: z.number().positive().default(86400),\n\t\t\t})\n\t\t\t.strict()\n\t\t\t.prefault(() => ({})),\n\t\tonBeforeConnect: zFunction().optional(),\n\t\tonSessionEvent: zFunction().optional(),\n\t\tonPermissionRequest: zFunction().optional(),\n\t})\n\t.strict();\n\n// --- Typed config types (generic callbacks overlaid on the Zod schema) ---\n\n/**\n * Type mirror of `nativeAgentOsOptionsSchema`.\n *\n * Keep this in sync with the schema above and the Rust serde mirror at\n * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson`.\n */\nexport type NativeAgentOsOptions = Pick<\n\tAgentOsOptions,\n\t| \"software\"\n\t| \"defaultSoftware\"\n\t| \"loopbackExemptPorts\"\n\t| \"allowedNodeBuiltins\"\n\t| \"rootFilesystem\"\n\t| \"moduleAccessCwd\"\n\t| \"additionalInstructions\"\n\t| \"permissions\"\n\t| \"limits\"\n> & {\n\tmounts?: NativeMountConfig[];\n\tsidecar?: { kind: \"shared\"; pool?: string };\n};\n\ntype AgentOsActorContext<TConnParams> = ActorContext<\n\tAgentOsActorState,\n\tTConnParams,\n\tundefined,\n\tAgentOsActorVars,\n\tundefined,\n\tany\n>;\n\ninterface AgentOsActorConfigCallbacks<TConnParams> {\n\tonBeforeConnect?: (\n\t\tc: BeforeConnectContext<\n\t\t\tAgentOsActorState,\n\t\t\tAgentOsActorVars,\n\t\t\tundefined,\n\t\t\tany\n\t\t>,\n\t\tparams: TConnParams,\n\t) => void | Promise<void>;\n\tonSessionEvent?: (\n\t\tc: AgentOsActorContext<TConnParams>,\n\t\tsessionId: string,\n\t\tevent: JsonRpcNotification,\n\t) => void | Promise<void>;\n\tonPermissionRequest?: (\n\t\tc: AgentOsActorContext<TConnParams>,\n\t\tsessionId: string,\n\t\trequest: PermissionRequest,\n\t) => void | Promise<void>;\n}\n\n// Parsed config (after Zod defaults/transforms applied).\nexport type AgentOsActorConfig<TConnParams = undefined> = Omit<\n\tz.infer<typeof agentOsActorConfigSchema>,\n\t\"options\" | \"onBeforeConnect\" | \"onSessionEvent\" | \"onPermissionRequest\"\n> &\n\t{ options?: NativeAgentOsOptions } &\n\tAgentOsActorConfigCallbacks<TConnParams>;\n\n// Input config (what users pass in before Zod transforms).\nexport type AgentOsActorConfigInput<TConnParams = undefined> = Omit<\n\tz.input<typeof agentOsActorConfigSchema>,\n\t\"options\" | \"onBeforeConnect\" | \"onSessionEvent\" | \"onPermissionRequest\"\n> &\n\t{ options?: NativeAgentOsOptions } &\n\tAgentOsActorConfigCallbacks<TConnParams>;\n","// Platform-specific resolver for the prebuilt agent-os actor plugin cdylib\n// (`libagentos_actor_plugin.{so,dylib,dll}`). Mirrors the sidecar-binary\n// resolver (`@rivet-dev/agentos-sidecar`): the library ships inside one of the\n// `@rivet-dev/agentos-plugin-<platform>` packages, declared as\n// optionalDependencies so npm installs only the one matching the current\n// `os`/`cpu`/`libc` at install time (spec phase 6).\n//\n// Resolution priority:\n// 1. `AGENTOS_PLUGIN_BIN` env var (absolute path override).\n// 2. A cargo build output under the repo `target/{release,debug}/` (dev).\n// 3. The platform-specific `@rivet-dev/agentos-plugin-<platform>` package.\n\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PLUGIN_BIN_ENV = \"AGENTOS_PLUGIN_BIN\";\n\n/** The cdylib filename for the current platform. */\nfunction libraryName(): string {\n\tswitch (process.platform) {\n\t\tcase \"darwin\":\n\t\t\treturn \"libagentos_actor_plugin.dylib\";\n\t\tcase \"win32\":\n\t\t\treturn \"agentos_actor_plugin.dll\";\n\t\tdefault:\n\t\t\treturn \"libagentos_actor_plugin.so\";\n\t}\n}\n\nfunction getPlatformPackageName(): string | null {\n\tconst { platform, arch } = process;\n\tswitch (platform) {\n\t\tcase \"linux\":\n\t\t\tif (arch === \"x64\") return \"@rivet-dev/agentos-plugin-linux-x64-gnu\";\n\t\t\tif (arch === \"arm64\") return \"@rivet-dev/agentos-plugin-linux-arm64-gnu\";\n\t\t\tbreak;\n\t\tcase \"darwin\":\n\t\t\tif (arch === \"x64\") return \"@rivet-dev/agentos-plugin-darwin-x64\";\n\t\t\tif (arch === \"arm64\") return \"@rivet-dev/agentos-plugin-darwin-arm64\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\treturn null;\n}\n\n/**\n * Resolve the absolute path to the agent-os actor plugin cdylib. RivetKit\n * `dlopen`s this path through the generic native-plugin ABI.\n */\nexport function getPluginPath(): string {\n\tconst override = process.env[PLUGIN_BIN_ENV];\n\tif (override) {\n\t\tif (!existsSync(override)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${PLUGIN_BIN_ENV} is set to ${override} but the file does not exist`,\n\t\t\t);\n\t\t}\n\t\treturn override;\n\t}\n\n\tconst lib = libraryName();\n\n\t// Dev: a cargo build output under the repo `target/`. `import.meta.url` is\n\t// `packages/agentos/dist/plugin-binary.js`, so the repo root is three levels up.\n\tconst here = dirname(fileURLToPath(import.meta.url));\n\tfor (const profile of [\"release\", \"debug\"]) {\n\t\tconst candidate = join(here, \"..\", \"..\", \"..\", \"target\", profile, lib);\n\t\tif (existsSync(candidate)) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\t// Prod: the platform-specific package.\n\tconst platformPkg = getPlatformPackageName();\n\tif (!platformPkg) {\n\t\tthrow new Error(\n\t\t\t`@rivet-dev/agentos: unsupported platform ${process.platform}/${process.arch}. ` +\n\t\t\t\t\"The Agent OS actor plugin currently supports linux and darwin on x64 and arm64. \" +\n\t\t\t\t`Set ${PLUGIN_BIN_ENV} to a local cdylib to override.`,\n\t\t);\n\t}\n\n\tconst require = createRequire(import.meta.url);\n\tlet pkgJsonPath: string;\n\ttry {\n\t\tpkgJsonPath = require.resolve(`${platformPkg}/package.json`);\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`@rivet-dev/agentos: platform package ${platformPkg} is not installed.\\n` +\n\t\t\t\t\"This usually means the platform is unsupported or optionalDependencies\\n\" +\n\t\t\t\t`were skipped during install. Try: npm install --include=optional ${platformPkg}\\n` +\n\t\t\t\t`Or set ${PLUGIN_BIN_ENV} to a local cdylib, or build it with\\n` +\n\t\t\t\t\"`cargo build -p agentos-actor-plugin`.\",\n\t\t);\n\t}\n\n\treturn join(dirname(pkgJsonPath), lib);\n}\n","// Rust-backed agent-os actor surface (native actor plugin / cdylib).\n//\n// Only the `agentOS()` definition function, the config schema, the\n// `nodeModulesMount` helper, the plugin-path resolver, and the public domain\n// types are exported. All actor lifecycle + action dispatch live in the Rust\n// plugin (`crates/agentos-actor-plugin`), loaded by RivetKit via the generic\n// native-plugin ABI.\n\nimport type {\n\tAgentOsOptions,\n\tJsonRpcNotification,\n\tPermissionRequest,\n} from \"@rivet-dev/agentos-core\";\nimport {\n\ttype AgentOsActorDefinition,\n\tcreateAgentOS,\n} from \"./actor.js\";\nimport type {\n\tAgentOsActorConfigInput,\n\tNativeAgentOsOptions,\n} from \"./config.js\";\n\nimport { setup as rivetkitSetup } from \"rivetkit\";\n\n// 512 MiB — large agent prompts/results cross the actor websocket transport as\n// single messages; RivetKit's registry-level defaults (maxIncomingMessageSize\n// 64 KiB, maxOutgoingMessageSize 1 MiB) truncate real payloads. Still a finite\n// bound per the limits-and-observability policy.\nconst AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULT = 512 * 1024 * 1024;\n\n/**\n * `setup()` wrapper that defaults the registry transport message-size caps to\n * never-hit-by-normal-use values for AgentOS apps, mirroring the per-actor crank\n * in `DEFAULT_AGENTOS_ACTOR_OPTIONS`. Any caller-supplied value wins, so an app\n * can still tighten the bound when it wants one.\n */\nexport const setup: typeof rivetkitSetup = ((\n\tinput: Parameters<typeof rivetkitSetup>[0],\n) =>\n\trivetkitSetup({\n\t\tmaxIncomingMessageSize: AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULT,\n\t\tmaxOutgoingMessageSize: AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULT,\n\t\t...input,\n\t})) as typeof rivetkitSetup;\n\nexport {\n\tbuildConfigJson,\n\ttype NodeModulesMountConfig,\n\tnodeModulesMount,\n} from \"./actor.js\";\nexport {\n\ttype AgentOsActorConfig,\n\ttype AgentOsActorConfigInput,\n\ttype NativeAgentOsOptions,\n\tagentOsActorConfigSchema,\n\tnativeAgentOsOptionsSchema,\n} from \"./config.js\";\nexport { getPluginPath } from \"./plugin-binary.js\";\n\n// Re-export the software-definition helper so custom agents/tools/commands can\n// be defined without importing @rivet-dev/agentos-core directly.\nexport { defineSoftware } from \"@rivet-dev/agentos-core\";\n\nexport type {\n\tAgentOsActionContext,\n\tAgentOsActorState,\n\tAgentOsActorVars,\n\tAgentOsEvents,\n\tCronEventPayload,\n\tPermissionRequestPayload,\n\tPersistedSessionEvent,\n\tPersistedSessionRecord,\n\tProcessExitPayload,\n\tProcessOutputPayload,\n\tPromptResult,\n\tSerializableCronAction,\n\tSerializableCronJobInfo,\n\tSerializableCronJobOptions,\n\tSessionEventPayload,\n\tSessionRecord,\n\tShellDataPayload,\n\tVmBootedPayload,\n\tVmShutdownPayload,\n} from \"./types.js\";\nexport type {\n\tAgentOsActions,\n\tCreateSessionOptions,\n\tDirEntry,\n\tReadFileResult,\n\tScheduledCronJob,\n\tSignedPreviewUrl,\n\tSpawnedProcess,\n\tVmFetchOptions,\n\tVmFetchResponse,\n\tWriteFileResult,\n} from \"./actor-actions.js\";\n\nexport type AgentOSActorConfigInput<TConnParams = undefined> =\n\tNativeAgentOsOptions &\n\t\tOmit<AgentOsActorConfigInput<TConnParams>, \"options\">;\n\nexport type AgentOSConfigInput<TConnParams = undefined> = AgentOsOptions & {\n\tpreview?: AgentOsActorConfigInput<TConnParams>[\"preview\"];\n\tonBeforeConnect?: AgentOsActorConfigInput<TConnParams>[\"onBeforeConnect\"];\n\tonSessionEvent?: (\n\t\tsessionId: string,\n\t\tevent: JsonRpcNotification,\n\t) => void | Promise<void>;\n\tonPermissionRequest?: (\n\t\tsessionId: string,\n\t\trequest: PermissionRequest,\n\t) => void | Promise<void>;\n};\n\nexport function agentOS<TConnParams = undefined>(\n\tconfig: AgentOSConfigInput<TConnParams> = {},\n): AgentOsActorDefinition<TConnParams> {\n\tconst {\n\t\tpreview,\n\t\tonBeforeConnect,\n\t\tonSessionEvent,\n\t\tonPermissionRequest,\n\t\t...options\n\t} = config;\n\n\treturn createAgentOS({\n\t\toptions,\n\t\tpreview,\n\t\tonBeforeConnect,\n\t\tonSessionEvent: onSessionEvent\n\t\t\t? (_ctx, sessionId, event) => onSessionEvent(sessionId, event)\n\t\t\t: undefined,\n\t\tonPermissionRequest: onPermissionRequest\n\t\t\t? (_ctx, sessionId, request) => onPermissionRequest(sessionId, request)\n\t\t\t: undefined,\n\t} as AgentOsActorConfigInput<TConnParams>);\n}\n"],"mappings":";AAYA,SAAS,oBAAoB;AAC7B,SAAS,WAAAA,UAAS,QAAAC,aAAY;AAC9B,SAAS,iBAAAC,sBAAqB;AAC9B,OAAO,YAAY;AACnB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACC;AAAA,OAOM;;;ACvBP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,SAAS;AAGlB,IAAM,YAAY,MAEX,EAAE,OAAU,CAAC,QAAQ,OAAO,QAAQ,UAAU;AAE9C,IAAM,6BAA6B,EAIxC,OAAO;AAAA,EACP,UAAU,0BAA0B;AAAA,EACpC,iBAAiB,0BAA0B;AAAA,EAC3C,qBAAqB,0BAA0B;AAAA,EAC/C,qBAAqB,0BAA0B;AAAA,EAC/C,gBAAgB,0BAA0B;AAAA,EAC1C,QAAQ,EAAE,MAAM,uBAAuB,EAAE,SAAS;AAAA,EAClD,iBAAiB,0BAA0B;AAAA,EAC3C,wBAAwB,0BAA0B;AAAA,EAClD,aAAa,0BAA0B;AAAA,EACvC,SAAS,0BAA0B,SAAS;AAAA,EAC5C,QAAQ,0BAA0B;AACnC,CAAC,EACA,OAAO;AAUF,IAAM,4BAA4B,EACvC,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC9B,SAAS;AAEJ,IAAM,2BAA2B,EACtC,OAAO;AAAA,EACP,SAAS,2BAA2B,SAAS;AAAA,EAC7C,cAAc;AAAA,EACd,SA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,IACA;AAAA,IACA,GAAG;AAAA,EACJ,IAAI;AAEJ,SAAO,cAAc;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,iBACb,CAAC,MAAM,WAAW,UAAU,eAAe,WAAW,KAAK,IAC3D;AAAA,IACH,qBAAqB,sBAClB,CAAC,MAAM,WAAW,YAAY,oBAAoB,WAAW,OAAO,IACpE;AAAA,EACJ,CAAyC;AAC1C;","names":["dirname","join","fileURLToPath","require","join","dirname","fileURLToPath"]}
|
|
1
|
+
{"version":3,"sources":["../src/actor.ts","../src/config.ts","../src/plugin-binary.ts","../src/index.ts"],"sourcesContent":["/**\n * Rust-backed `agentOS(...)` definition.\n *\n * Produces an `ActorDefinition` whose `nativeFactoryBuilder` constructs a\n * native-actor-plugin factory through `runtime.createNativePluginFactory(...)`\n * (NAPI → `dlopen` of the agent-os actor plugin cdylib, the inverse of the\n * generic host loader). All lifecycle, state, and action dispatch live in the\n * Rust plugin (`crates/agentos-actor-plugin`). This JS shim only validates\n * configuration, resolves the plugin + sidecar binaries, and hands the opaque\n * config envelope across the bridge — it owns no agent-os runtime logic.\n */\n\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport common from \"@agentos-software/common\";\nimport { OPT_AGENTOS_ROOT } from \"@rivet-dev/agentos-core\";\nimport { getSidecarPath } from \"@rivet-dev/agentos-sidecar\";\nimport {\n\tactor,\n\ttype ActorDefinition,\n\ttype ActorFactoryHandle,\n\ttype CoreRuntime,\n\ttype DatabaseProvider,\n\ttype NapiNativePluginOptions,\n\ttype RawAccess,\n} from \"rivetkit\";\nimport {\n\ttype AgentOsActorConfig,\n\ttype AgentOsActorConfigInput,\n\tagentOsActorConfigSchema,\n\tnativeAgentOsOptionsSchema,\n} from \"./config.js\";\nimport { getPluginPath } from \"./plugin-binary.js\";\nimport type { AgentOsActions } from \"./actor-actions.js\";\nimport type { AgentOsActorState, AgentOsActorVars } from \"./types.js\";\n\n/**\n * Build the JSON envelope the Rust plugin consumes. The Rust deserializer\n * uses `deny_unknown_fields`, so the envelope must stay in lock-step with\n * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson`.\n *\n * Software threading: each software ref is flattened (meta packages such as\n * `common` are arrays of refs), normalized to a package dir, and forwarded as\n * `{ dir }` so the sidecar owns the `/opt/agentos` projection. Agent configs\n * are derived from each package's `agentos-package.json`, mirroring\n * `packages/core/src/agent-os.ts`.\n */\ninterface NativeMountLike {\n\tpath: string;\n\tplugin: {\n\t\tid: string;\n\t\tconfig?: unknown;\n\t};\n\treadOnly?: boolean;\n}\n\ninterface NormalizedPackageRef {\n\tpath: string;\n}\n\n/**\n * A native `host_dir` mount of a host `node_modules` directory at\n * `/root/node_modules`, the serializable form `agentOS({ options: { mounts } })`\n * accepts across the NAPI boundary.\n */\nexport interface NodeModulesMountConfig {\n\tpath: \"/root/node_modules\";\n\tplugin: { id: \"host_dir\"; config: { hostPath: string; readOnly: boolean } };\n\treadOnly: boolean;\n}\n\n/**\n * Mount a host `node_modules` directory into the VM at `/root/node_modules`.\n *\n * This is the explicit, mount-based replacement for the removed `moduleAccessCwd`\n * mechanism: the VM module resolver reads the mounted tree through the kernel\n * VFS, so the caller supplies exactly the `node_modules` directory whose\n * packages should resolve in the guest.\n *\n * @param hostNodeModulesDir Absolute host path to a `node_modules` directory.\n * @param opts.readOnly Defaults to `true`; the mount is read-only.\n */\nexport function nodeModulesMount(\n\thostNodeModulesDir: string,\n\topts?: { readOnly?: boolean },\n): NodeModulesMountConfig {\n\tconst readOnly = opts?.readOnly ?? true;\n\treturn {\n\t\tpath: \"/root/node_modules\",\n\t\tplugin: {\n\t\t\tid: \"host_dir\",\n\t\t\tconfig: { hostPath: hostNodeModulesDir, readOnly },\n\t\t},\n\t\treadOnly,\n\t};\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n\treturn value && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: {};\n}\n\nfunction normalizePackageRef(value: unknown): NormalizedPackageRef | undefined {\n\t// Single package reference: `packagePath` (packed `.aospkg` file, or a\n\t// transition package dir); a raw string is shorthand for the same path.\n\tif (typeof value === \"string\") {\n\t\treturn { path: value };\n\t}\n\tconst record = toRecord(value);\n\tif (typeof record.packagePath === \"string\") {\n\t\treturn { path: record.packagePath };\n\t}\n\t// Recognizably-legacy shapes fail loudly instead of silently dropping the\n\t// package from the VM.\n\tfor (const legacy of [\"packageTar\", \"packageDir\", \"dir\"]) {\n\t\tif (typeof record[legacy] === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`agentOS package ref uses removed field \"${legacy}\"; packages are referenced ` +\n\t\t\t\t\t\"by a single `packagePath` — rebuild @agentos-software/* dependencies or pass { packagePath }\",\n\t\t\t);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction normalizedPackageRefs(software: unknown[]): NormalizedPackageRef[] {\n\tconst refs: NormalizedPackageRef[] = [];\n\tconst seen = new Set<string>();\n\tfor (const entry of software.flat()) {\n\t\tconst ref = normalizePackageRef(entry);\n\t\tif (!ref || seen.has(ref.path)) continue;\n\t\tseen.add(ref.path);\n\t\trefs.push(ref);\n\t}\n\treturn refs;\n}\n\nexport function buildConfigJson<TConnParams>(\n\tparsed: AgentOsActorConfig<TConnParams>,\n): string {\n\tconst options = nativeAgentOsOptionsSchema.parse(\n\t\tparsed.options ?? {},\n\t) as Record<string, unknown>;\n\tconst softwareInput = Array.isArray(options.software) ? options.software : [];\n\tconst defaultSoftwareEnabled = options.defaultSoftware !== false;\n\tconst packageRefs = normalizedPackageRefs(\n\t\tdefaultSoftwareEnabled ? [common, ...softwareInput] : softwareInput,\n\t);\n\tconst packages = packageRefs.map((ref) => ({ packagePath: ref.path }));\n\tconst mounts = serializeNativeMounts(options.mounts);\n\tconst sidecar = serializeSidecar(options.sidecar);\n\treturn JSON.stringify({\n\t\t// The actor forwards ONLY package dirs; the sidecar resolves each agent from\n\t\t// the projected `/opt/agentos/<name>/current/agentos-package.json` (no\n\t\t// client-side adapter-entrypoint resolution — see root CLAUDE.md).\n\t\tpackages,\n\t\tpackagesMountAt: OPT_AGENTOS_ROOT,\n\t\tadditionalInstructions: options.additionalInstructions,\n\t\tloopbackExemptPorts: options.loopbackExemptPorts,\n\t\tallowedNodeBuiltins: options.allowedNodeBuiltins,\n\t\tpermissions: options.permissions,\n\t\trootFilesystem: options.rootFilesystem,\n\t\tmounts,\n\t\tlimits: options.limits,\n\t\tsidecar,\n\t});\n}\n\nfunction serializeNativeMounts(input: unknown): NativeMountLike[] | undefined {\n\tif (input == null) return undefined;\n\tif (!Array.isArray(input)) {\n\t\tthrow new Error(\"agentOS() options.mounts must be an array\");\n\t}\n\treturn input.map((mount, index) => {\n\t\tif (!mount || typeof mount !== \"object\") {\n\t\t\tthrow new Error(`agentOS() options.mounts[${index}] must be an object`);\n\t\t}\n\t\tconst record = mount as Record<string, unknown>;\n\t\tif (record.driver !== undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"agentOS() only supports Native mounts across the NAPI boundary; Plain mounts with driver callbacks are not serializable\",\n\t\t\t);\n\t\t}\n\t\tif (record.filesystem !== undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"agentOS() only supports Native mounts across the NAPI boundary; Overlay mounts are not serializable\",\n\t\t\t);\n\t\t}\n\t\tconst plugin = record.plugin;\n\t\tif (\n\t\t\ttypeof record.path !== \"string\" ||\n\t\t\t!plugin ||\n\t\t\ttypeof plugin !== \"object\" ||\n\t\t\ttypeof (plugin as Record<string, unknown>).id !== \"string\"\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`agentOS() options.mounts[${index}] must be a Native mount with { path, plugin: { id, config? } }`,\n\t\t\t);\n\t\t}\n\t\treturn {\n\t\t\tpath: record.path,\n\t\t\tplugin: {\n\t\t\t\tid: (plugin as Record<string, unknown>).id as string,\n\t\t\t\tconfig: (plugin as Record<string, unknown>).config,\n\t\t\t},\n\t\t\treadOnly:\n\t\t\t\ttypeof record.readOnly === \"boolean\" ? record.readOnly : undefined,\n\t\t};\n\t});\n}\n\nfunction serializeSidecar(input: unknown): { pool?: string } | undefined {\n\tif (input == null) return undefined;\n\tif (!input || typeof input !== \"object\") {\n\t\tthrow new Error(\"agentOS() options.sidecar must be an object\");\n\t}\n\tconst record = input as Record<string, unknown>;\n\tif (record.kind === \"explicit\" || record.handle !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"agentOS() only supports sidecar shared pool configuration across the NAPI boundary; explicit sidecar handles are not serializable\",\n\t\t);\n\t}\n\tif (record.kind !== undefined && record.kind !== \"shared\") {\n\t\tthrow new Error('agentOS() options.sidecar.kind must be \"shared\"');\n\t}\n\treturn typeof record.pool === \"string\" ? { pool: record.pool } : {};\n}\n\nfunction buildNativeFactoryBuilder<TConnParams>(\n\tparsed: AgentOsActorConfig<TConnParams>,\n): (runtime: CoreRuntime) => ActorFactoryHandle {\n\treturn (runtime) => {\n\t\tif (runtime.kind !== \"napi\") {\n\t\t\tthrow new Error(\n\t\t\t\t`agentOS() is only supported on the native NAPI runtime (current runtime kind: ${runtime.kind})`,\n\t\t\t);\n\t\t}\n\t\tif (!runtime.createNativePluginFactory) {\n\t\t\tthrow new Error(\n\t\t\t\t\"runtime.createNativePluginFactory is not implemented on the active CoreRuntime\",\n\t\t\t);\n\t\t}\n\t\tconst options: NapiNativePluginOptions = {\n\t\t\t// Resolve the prebuilt agent-os actor plugin cdylib; RivetKit `dlopen`s\n\t\t\t// it through the generic native-plugin ABI.\n\t\t\tpluginPath: getPluginPath(),\n\t\t\t// Opaque config envelope the plugin parses (config.rs::AgentOsConfigJson).\n\t\t\tconfigJson: buildConfigJson(parsed),\n\t\t\t// Resolve the prebuilt sidecar binary from the npm package so the plugin\n\t\t\t// spawns the bundled binary rather than relying on `agentos-sidecar`\n\t\t\t// being on PATH.\n\t\t\tsidecarPath: getSidecarPath(),\n\t\t\t// Custom inspector tabs. The native-plugin path bypasses the normal\n\t\t\t// actor-config assembly (`buildActorConfig`/`inspectorTabs`), so the\n\t\t\t// tabs MUST ride on the plugin options: the Rust NAPI binding\n\t\t\t// `from_native_plugin` forwards `inspectorTabs` into the actor config so\n\t\t\t// the dashboard serves `/inspector/custom-tabs/<id>/` and advertises them\n\t\t\t// in `tab-config`. (Setting `actor({ inspector })` alone does nothing for\n\t\t\t// native-plugin actors.)\n\t\t\tinspectorTabs: AGENTOS_INSPECTOR_CONFIG.tabs,\n\t\t} as NapiNativePluginOptions & {\n\t\t\tinspectorTabs: typeof AGENTOS_INSPECTOR_CONFIG.tabs;\n\t\t};\n\t\treturn runtime.createNativePluginFactory(options);\n\t};\n}\n\n/**\n * Type alias for the `agentOS(...)` return type. Events are not typed at the TS\n * surface because the Rust plugin owns the broadcast set, but the ACTIONS are\n * typed via {@link AgentOsActions} — a TS mirror of the Rust dispatch in\n * `crates/agentos-actor-plugin/src/actions/mod.rs`. That is what gives\n * `createClient<typeof registry>()` a fully-typed handle (e.g. `handle.exec()`\n * returns `ExecResult`, not `unknown`). Keep the two in sync.\n */\nexport type AgentOsActorDefinition<TConnParams> = ActorDefinition<\n\tAgentOsActorState,\n\tTConnParams,\n\tundefined,\n\tAgentOsActorVars,\n\tundefined,\n\tDatabaseProvider<RawAccess>,\n\tRecord<never, never>,\n\tRecord<never, never>,\n\tAgentOsActions\n>;\n\n// One hour — far past any normal agent turn, connection setup, or idle gap, but\n// still a finite bound (never `0`/Infinity) per the limits-and-observability\n// policy. Agent turns routinely run minutes; the stock RivetKit defaults\n// (actionTimeout 60s, on{Before,}ConnectTimeout 5s, sleepTimeout 30s) cut them\n// off mid-flight and broke live `sessionEvent` streaming with\n// \"actor websocket connection setup timed out after 5000 ms\".\nconst ACTOR_NEVER_HIT_MS = 60 * 60 * 1000;\n// 512 MiB — large prompts/results stream as single actor messages; the stock\n// 64 KiB incoming / 1 MiB outgoing caps truncate real agent payloads.\nconst ACTOR_NEVER_HIT_MESSAGE_BYTES = 512 * 1024 * 1024;\n\n/**\n * Never-hit-by-normal-use defaults for the AgentOS actor. Every value is a high\n * but finite bound so a long multi-step agent turn, a slow connection setup, a\n * large prompt/result, and live `sessionEvent` streaming all complete without\n * tripping a RivetKit actor default. Callers can still override any single knob\n * via `actorOptions` (their value wins over these defaults).\n */\nexport const DEFAULT_AGENTOS_ACTOR_OPTIONS = {\n\t// Connection/setup lifecycle (stock 5s each) — the websocket setup path that\n\t// was timing out at 5000ms and dropping all streamed events.\n\tonBeforeConnectTimeout: ACTOR_NEVER_HIT_MS,\n\tonConnectTimeout: ACTOR_NEVER_HIT_MS,\n\tcreateVarsTimeout: ACTOR_NEVER_HIT_MS,\n\tcreateConnStateTimeout: ACTOR_NEVER_HIT_MS,\n\tonMigrateTimeout: ACTOR_NEVER_HIT_MS,\n\t// Action/RPC lifecycle (stock 60s) — long multi-step prompt turns.\n\tactionTimeout: ACTOR_NEVER_HIT_MS,\n\t// Idle/keepalive — don't reap a live session or sleep mid-turn (stock\n\t// connectionLivenessTimeout 2.5s, sleepTimeout 30s). The liveness *interval*\n\t// (ping cadence) is intentionally left at its small default.\n\tconnectionLivenessTimeout: ACTOR_NEVER_HIT_MS,\n\tsleepTimeout: ACTOR_NEVER_HIT_MS,\n\t// Payload sizes — large prompts/results. `maxQueueMessageSize` is the\n\t// per-actor message cap (stock 64 KiB); the transport-level\n\t// max{Incoming,Outgoing}MessageSize live on the registry/setup config (see\n\t// AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULTS), not on per-actor options.\n\tmaxQueueSize: 1_000_000,\n\tmaxQueueMessageSize: ACTOR_NEVER_HIT_MESSAGE_BYTES,\n} as const;\n\n// Absolute path to the built inspector-tabs app (the shared Vite bundle). All\n// custom tabs share this one `source` dir; the app routes on the\n// `/inspector/custom-tabs/<id>/` URL segment. Resolves from both `src/` (tsx dev\n// / the demo) and the published `dist/`, since `assets/` sits at the package\n// root in both layouts.\nconst INSPECTOR_TABS_ASSET_DIR = join(\n\tdirname(fileURLToPath(import.meta.url)),\n\t\"..\",\n\t\"assets\",\n\t\"inspector-tabs-app\",\n);\n\n// Custom inspector tabs shipped by agent-os. Ids MUST match the `TABS` registry\n// in `src/inspector-tabs/main.tsx`. The built-in rivetkit tabs are hidden so the\n// dashboard shows only the agent-os tabs.\nconst AGENTOS_INSPECTOR_CONFIG = {\n\ttabs: [\n\t\t{ id: \"transcript\", label: \"Transcript\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"comments\" },\n\t\t{ id: \"filesystem\", label: \"Filesystem\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"folder-tree\" },\n\t\t{ id: \"processes\", label: \"Processes\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"microchip\" },\n\t\t{ id: \"software\", label: \"Software\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"box-archive\" },\n\t\t{ id: \"mounts\", label: \"Mounts\", source: INSPECTOR_TABS_ASSET_DIR, icon: \"hard-drive\" },\n\t\t...([\"workflow\", \"database\", \"state\", \"queue\", \"connections\", \"console\"].map(\n\t\t\t(id) => ({ id, hidden: true as const }),\n\t\t)),\n\t],\n};\n\nexport function createAgentOS<TConnParams = undefined>(\n\tconfig: AgentOsActorConfigInput<TConnParams>,\n): AgentOsActorDefinition<TConnParams> {\n\tconst parsed = agentOsActorConfigSchema.parse(\n\t\tconfig,\n\t) as AgentOsActorConfig<TConnParams>;\n\n\t// Construct a minimal definition through the existing actor() helper, then\n\t// attach the Rust factory builder marker. The actions block stays empty\n\t// because no JS-side action ever runs: the engine driver branches on\n\t// `nativeFactoryBuilder` before reaching the JS dispatch path.\n\tconst userActorOptions = (\n\t\tparsed as { actorOptions?: Record<string, unknown> }\n\t).actorOptions;\n\t// High never-hit defaults, with any caller-supplied option winning.\n\tconst actorOptions = {\n\t\t...DEFAULT_AGENTOS_ACTOR_OPTIONS,\n\t\t...(userActorOptions ?? {}),\n\t};\n\tconst definition = actor({\n\t\tactions: {},\n\t\toptions: actorOptions,\n\t\t// Register the custom agent-os inspector tabs (and hide the built-in\n\t\t// rivetkit tabs) so the dashboard renders the agent-os UI. Without this\n\t\t// the shipped tab assets are never surfaced.\n\t\tinspector: AGENTOS_INSPECTOR_CONFIG,\n\t} as Parameters<\n\t\ttypeof actor\n\t>[0]) as unknown as AgentOsActorDefinition<TConnParams>;\n\tdefinition.nativeFactoryBuilder = buildNativeFactoryBuilder(parsed);\n\treturn definition;\n}\n","import type {\n\tAgentOsOptions,\n\tJsonRpcNotification,\n\tNativeMountConfig,\n\tPermissionRequest,\n} from \"@rivet-dev/agentos-core\";\nimport {\n\tagentOsOptionFieldSchemas,\n\tnativeMountConfigSchema,\n\tsharedSidecarConfigSchema,\n} from \"@rivet-dev/agentos-core\";\nimport type { ActorContext, BeforeConnectContext } from \"rivetkit\";\nimport { z } from \"zod/v4\";\nimport type { AgentOsActorState, AgentOsActorVars } from \"./types.js\";\n\nconst zFunction = <\n\tT extends (...args: any[]) => any = (...args: unknown[]) => unknown,\n>() => z.custom<T>((val) => typeof val === \"function\");\n\nexport const nativeAgentOsOptionsSchema = z\n\t// Native actor options are a JSON-serializable subset of AgentOsOptions.\n\t// Keep this allow-list in sync with buildConfigJson() and\n\t// crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson.\n\t.object({\n\t\tsoftware: agentOsOptionFieldSchemas.software,\n\t\tdefaultSoftware: agentOsOptionFieldSchemas.defaultSoftware,\n\t\tloopbackExemptPorts: agentOsOptionFieldSchemas.loopbackExemptPorts,\n\t\tallowedNodeBuiltins: agentOsOptionFieldSchemas.allowedNodeBuiltins,\n\t\trootFilesystem: agentOsOptionFieldSchemas.rootFilesystem,\n\t\tmounts: z.array(nativeMountConfigSchema).optional(),\n\t\tadditionalInstructions: agentOsOptionFieldSchemas.additionalInstructions,\n\t\tpermissions: agentOsOptionFieldSchemas.permissions,\n\t\tsidecar: sharedSidecarConfigSchema.optional(),\n\t\tlimits: agentOsOptionFieldSchemas.limits,\n\t})\n\t.strict();\n\n/**\n * RivetKit actor lifecycle/transport options forwarded to `actor({ options })`.\n *\n * Validated downstream by RivetKit's own actor config schema, so this stays a\n * permissive pass-through allow-list. `agentOS()` overlays the never-hit\n * defaults in `DEFAULT_AGENTOS_ACTOR_OPTIONS` (see actor.ts) and lets any value\n * here win, so callers can still tighten a bound when they want one.\n */\nexport const agentOsActorOptionsSchema = z\n\t.record(z.string(), z.unknown())\n\t.optional();\n\nexport const agentOsActorConfigSchema = z\n\t.object({\n\t\toptions: nativeAgentOsOptionsSchema.optional(),\n\t\tactorOptions: agentOsActorOptionsSchema,\n\t\tpreview: z\n\t\t\t.object({\n\t\t\t\tdefaultExpiresInSeconds: z.number().positive().default(3600),\n\t\t\t\tmaxExpiresInSeconds: z.number().positive().default(86400),\n\t\t\t})\n\t\t\t.strict()\n\t\t\t.prefault(() => ({})),\n\t\tonBeforeConnect: zFunction().optional(),\n\t\tonSessionEvent: zFunction().optional(),\n\t\tonPermissionRequest: zFunction().optional(),\n\t})\n\t.strict();\n\n// --- Typed config types (generic callbacks overlaid on the Zod schema) ---\n\n/**\n * Type mirror of `nativeAgentOsOptionsSchema`.\n *\n * Keep this in sync with the schema above and the Rust serde mirror at\n * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson`.\n */\nexport type NativeAgentOsOptions = Pick<\n\tAgentOsOptions,\n\t| \"software\"\n\t| \"defaultSoftware\"\n\t| \"loopbackExemptPorts\"\n\t| \"allowedNodeBuiltins\"\n\t| \"rootFilesystem\"\n\t| \"additionalInstructions\"\n\t| \"permissions\"\n\t| \"limits\"\n> & {\n\tmounts?: NativeMountConfig[];\n\tsidecar?: { kind: \"shared\"; pool?: string };\n};\n\ntype AgentOsActorContext<TConnParams> = ActorContext<\n\tAgentOsActorState,\n\tTConnParams,\n\tundefined,\n\tAgentOsActorVars,\n\tundefined,\n\tany\n>;\n\ninterface AgentOsActorConfigCallbacks<TConnParams> {\n\tonBeforeConnect?: (\n\t\tc: BeforeConnectContext<\n\t\t\tAgentOsActorState,\n\t\t\tAgentOsActorVars,\n\t\t\tundefined,\n\t\t\tany\n\t\t>,\n\t\tparams: TConnParams,\n\t) => void | Promise<void>;\n\tonSessionEvent?: (\n\t\tc: AgentOsActorContext<TConnParams>,\n\t\tsessionId: string,\n\t\tevent: JsonRpcNotification,\n\t) => void | Promise<void>;\n\tonPermissionRequest?: (\n\t\tc: AgentOsActorContext<TConnParams>,\n\t\tsessionId: string,\n\t\trequest: PermissionRequest,\n\t) => void | Promise<void>;\n}\n\n// Parsed config (after Zod defaults/transforms applied).\nexport type AgentOsActorConfig<TConnParams = undefined> = Omit<\n\tz.infer<typeof agentOsActorConfigSchema>,\n\t\"options\" | \"onBeforeConnect\" | \"onSessionEvent\" | \"onPermissionRequest\"\n> &\n\t{ options?: NativeAgentOsOptions } &\n\tAgentOsActorConfigCallbacks<TConnParams>;\n\n// Input config (what users pass in before Zod transforms).\nexport type AgentOsActorConfigInput<TConnParams = undefined> = Omit<\n\tz.input<typeof agentOsActorConfigSchema>,\n\t\"options\" | \"onBeforeConnect\" | \"onSessionEvent\" | \"onPermissionRequest\"\n> &\n\t{ options?: NativeAgentOsOptions } &\n\tAgentOsActorConfigCallbacks<TConnParams>;\n","// Platform-specific resolver for the prebuilt agent-os actor plugin cdylib\n// (`libagentos_actor_plugin.{so,dylib,dll}`). Mirrors the sidecar-binary\n// resolver (`@rivet-dev/agentos-sidecar`): the library ships inside one of the\n// `@rivet-dev/agentos-plugin-<platform>` packages, declared as\n// optionalDependencies so npm installs only the one matching the current\n// `os`/`cpu`/`libc` at install time (spec phase 6).\n//\n// Resolution priority:\n// 1. `AGENTOS_PLUGIN_BIN` env var (absolute path override).\n// 2. A cargo build output under the repo `target/{release,debug}/` (dev).\n// 3. The platform-specific `@rivet-dev/agentos-plugin-<platform>` package.\n\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PLUGIN_BIN_ENV = \"AGENTOS_PLUGIN_BIN\";\n\n/** The cdylib filename for the current platform. */\nfunction libraryName(): string {\n\tswitch (process.platform) {\n\t\tcase \"darwin\":\n\t\t\treturn \"libagentos_actor_plugin.dylib\";\n\t\tcase \"win32\":\n\t\t\treturn \"agentos_actor_plugin.dll\";\n\t\tdefault:\n\t\t\treturn \"libagentos_actor_plugin.so\";\n\t}\n}\n\nfunction getPlatformPackageName(): string | null {\n\tconst { platform, arch } = process;\n\tswitch (platform) {\n\t\tcase \"linux\":\n\t\t\tif (arch === \"x64\") return \"@rivet-dev/agentos-plugin-linux-x64-gnu\";\n\t\t\tif (arch === \"arm64\") return \"@rivet-dev/agentos-plugin-linux-arm64-gnu\";\n\t\t\tbreak;\n\t\tcase \"darwin\":\n\t\t\tif (arch === \"x64\") return \"@rivet-dev/agentos-plugin-darwin-x64\";\n\t\t\tif (arch === \"arm64\") return \"@rivet-dev/agentos-plugin-darwin-arm64\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\treturn null;\n}\n\n/**\n * Resolve the absolute path to the agent-os actor plugin cdylib. RivetKit\n * `dlopen`s this path through the generic native-plugin ABI.\n */\nexport function getPluginPath(): string {\n\tconst override = process.env[PLUGIN_BIN_ENV];\n\tif (override) {\n\t\tif (!existsSync(override)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${PLUGIN_BIN_ENV} is set to ${override} but the file does not exist`,\n\t\t\t);\n\t\t}\n\t\treturn override;\n\t}\n\n\tconst lib = libraryName();\n\n\t// Dev: a cargo build output under the repo `target/`. `import.meta.url` is\n\t// `packages/agentos/dist/plugin-binary.js`, so the repo root is three levels up.\n\tconst here = dirname(fileURLToPath(import.meta.url));\n\tfor (const profile of [\"release\", \"debug\"]) {\n\t\tconst candidate = join(here, \"..\", \"..\", \"..\", \"target\", profile, lib);\n\t\tif (existsSync(candidate)) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\t// Prod: the platform-specific package.\n\tconst platformPkg = getPlatformPackageName();\n\tif (!platformPkg) {\n\t\tthrow new Error(\n\t\t\t`@rivet-dev/agentos: unsupported platform ${process.platform}/${process.arch}. ` +\n\t\t\t\t\"The Agent OS actor plugin currently supports linux and darwin on x64 and arm64. \" +\n\t\t\t\t`Set ${PLUGIN_BIN_ENV} to a local cdylib to override.`,\n\t\t);\n\t}\n\n\tconst require = createRequire(import.meta.url);\n\tlet pkgJsonPath: string;\n\ttry {\n\t\tpkgJsonPath = require.resolve(`${platformPkg}/package.json`);\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`@rivet-dev/agentos: platform package ${platformPkg} is not installed.\\n` +\n\t\t\t\t\"This usually means the platform is unsupported or optionalDependencies\\n\" +\n\t\t\t\t`were skipped during install. Try: npm install --include=optional ${platformPkg}\\n` +\n\t\t\t\t`Or set ${PLUGIN_BIN_ENV} to a local cdylib, or build it with\\n` +\n\t\t\t\t\"`cargo build -p agentos-actor-plugin`.\",\n\t\t);\n\t}\n\n\treturn join(dirname(pkgJsonPath), lib);\n}\n","// Rust-backed agent-os actor surface (native actor plugin / cdylib).\n//\n// Only the `agentOS()` definition function, the config schema, the\n// `nodeModulesMount` helper, the plugin-path resolver, and the public domain\n// types are exported. All actor lifecycle + action dispatch live in the Rust\n// plugin (`crates/agentos-actor-plugin`), loaded by RivetKit via the generic\n// native-plugin ABI.\n\nimport type {\n\tAgentOsOptions,\n\tJsonRpcNotification,\n\tPermissionRequest,\n} from \"@rivet-dev/agentos-core\";\nimport {\n\ttype AgentOsActorDefinition,\n\tcreateAgentOS,\n} from \"./actor.js\";\nimport type {\n\tAgentOsActorConfigInput,\n\tNativeAgentOsOptions,\n} from \"./config.js\";\n\nimport { setup as rivetkitSetup } from \"rivetkit\";\n\n// 512 MiB — large agent prompts/results cross the actor websocket transport as\n// single messages; RivetKit's registry-level defaults (maxIncomingMessageSize\n// 64 KiB, maxOutgoingMessageSize 1 MiB) truncate real payloads. Still a finite\n// bound per the limits-and-observability policy.\nconst AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULT = 512 * 1024 * 1024;\n\n/**\n * `setup()` wrapper that defaults the registry transport message-size caps to\n * never-hit-by-normal-use values for AgentOS apps, mirroring the per-actor crank\n * in `DEFAULT_AGENTOS_ACTOR_OPTIONS`. Any caller-supplied value wins, so an app\n * can still tighten the bound when it wants one.\n */\nexport const setup: typeof rivetkitSetup = ((\n\tinput: Parameters<typeof rivetkitSetup>[0],\n) =>\n\trivetkitSetup({\n\t\tmaxIncomingMessageSize: AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULT,\n\t\tmaxOutgoingMessageSize: AGENTOS_REGISTRY_MESSAGE_SIZE_DEFAULT,\n\t\t...input,\n\t})) as typeof rivetkitSetup;\n\nexport {\n\tbuildConfigJson,\n\ttype NodeModulesMountConfig,\n\tnodeModulesMount,\n} from \"./actor.js\";\nexport {\n\ttype AgentOsActorConfig,\n\ttype AgentOsActorConfigInput,\n\ttype NativeAgentOsOptions,\n\tagentOsActorConfigSchema,\n\tnativeAgentOsOptionsSchema,\n} from \"./config.js\";\nexport { getPluginPath } from \"./plugin-binary.js\";\n\n// Re-export the software-definition helper so custom agents/tools/commands can\n// be defined without importing @rivet-dev/agentos-core directly.\nexport { defineSoftware } from \"@rivet-dev/agentos-core\";\n\nexport type {\n\tAgentOsActionContext,\n\tAgentOsActorState,\n\tAgentOsActorVars,\n\tAgentOsEvents,\n\tCronEventPayload,\n\tPermissionRequestPayload,\n\tPersistedSessionEvent,\n\tPersistedSessionRecord,\n\tProcessExitPayload,\n\tProcessOutputPayload,\n\tPromptResult,\n\tSerializableCronAction,\n\tSerializableCronJobInfo,\n\tSerializableCronJobOptions,\n\tSessionEventPayload,\n\tSessionRecord,\n\tShellDataPayload,\n\tVmBootedPayload,\n\tVmShutdownPayload,\n} from \"./types.js\";\nexport type {\n\tAgentOsActions,\n\tCreateSessionOptions,\n\tDirEntry,\n\tReadFileResult,\n\tScheduledCronJob,\n\tSignedPreviewUrl,\n\tSpawnedProcess,\n\tVmFetchOptions,\n\tVmFetchResponse,\n\tWriteFileResult,\n} from \"./actor-actions.js\";\n\nexport type AgentOSActorConfigInput<TConnParams = undefined> =\n\tNativeAgentOsOptions &\n\t\tOmit<AgentOsActorConfigInput<TConnParams>, \"options\">;\n\nexport type AgentOSConfigInput<TConnParams = undefined> = AgentOsOptions & {\n\tpreview?: AgentOsActorConfigInput<TConnParams>[\"preview\"];\n\tonBeforeConnect?: AgentOsActorConfigInput<TConnParams>[\"onBeforeConnect\"];\n\tonSessionEvent?: (\n\t\tsessionId: string,\n\t\tevent: JsonRpcNotification,\n\t) => void | Promise<void>;\n\tonPermissionRequest?: (\n\t\tsessionId: string,\n\t\trequest: PermissionRequest,\n\t) => void | Promise<void>;\n};\n\nexport function agentOS<TConnParams = undefined>(\n\tconfig: AgentOSConfigInput<TConnParams> = {},\n): AgentOsActorDefinition<TConnParams> {\n\tconst {\n\t\tpreview,\n\t\tonBeforeConnect,\n\t\tonSessionEvent,\n\t\tonPermissionRequest,\n\t\t...options\n\t} = config;\n\n\treturn createAgentOS({\n\t\toptions,\n\t\tpreview,\n\t\tonBeforeConnect,\n\t\tonSessionEvent: onSessionEvent\n\t\t\t? (_ctx, sessionId, event) => onSessionEvent(sessionId, event)\n\t\t\t: undefined,\n\t\tonPermissionRequest: onPermissionRequest\n\t\t\t? (_ctx, sessionId, request) => onPermissionRequest(sessionId, request)\n\t\t\t: undefined,\n\t} as AgentOsActorConfigInput<TConnParams>);\n}\n"],"mappings":";AAYA,SAAS,WAAAA,UAAS,QAAAC,aAAY;AAC9B,SAAS,iBAAAC,sBAAqB;AAC9B,OAAO,YAAY;AACnB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EACC;AAAA,OAOM;;;ACnBP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,SAAS;AAGlB,IAAM,YAAY,MAEX,EAAE,OAAU,CAAC,QAAQ,OAAO,QAAQ,UAAU;AAE9C,IAAM,6BAA6B,EAIxC,OAAO;AAAA,EACP,UAAU,0BAA0B;AAAA,EACpC,iBAAiB,0BA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ACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ,IAAI;AAEJ,SAAO,cAAc;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,iBACb,CAAC,MAAM,WAAW,UAAU,eAAe,WAAW,KAAK,IAC3D;AAAA,IACH,qBAAqB,sBAClB,CAAC,MAAM,WAAW,YAAY,oBAAoB,WAAW,OAAO,IACpE;AAAA,EACJ,CAAyC;AAC1C;","names":["dirname","join","fileURLToPath","require","join","dirname","fileURLToPath"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivet-dev/agentos",
|
|
3
|
-
"version": "0.2.5-rc.
|
|
3
|
+
"version": "0.2.5-rc.4",
|
|
4
4
|
"description": "Agent OS actor for RivetKit - thin TS forwarder that loads the native actor plugin via RivetKit's native-plugin ABI.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"test": "vitest run"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@agentos-software/common": "
|
|
58
|
-
"@rivet-dev/agentos-core": "0.2.5-rc.
|
|
59
|
-
"@rivet-dev/agentos-sidecar": "0.2.5-rc.
|
|
57
|
+
"@agentos-software/common": "workspace:*",
|
|
58
|
+
"@rivet-dev/agentos-core": "0.2.5-rc.4",
|
|
59
|
+
"@rivet-dev/agentos-sidecar": "0.2.5-rc.4",
|
|
60
60
|
"@rivetkit/react": "catalog:rivetkit",
|
|
61
61
|
"rivetkit": "catalog:rivetkit",
|
|
62
62
|
"zod": "^4.1.11"
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
"vitest": "^2.1.8"
|
|
96
96
|
},
|
|
97
97
|
"optionalDependencies": {
|
|
98
|
-
"@rivet-dev/agentos-plugin-darwin-arm64": "0.2.5-rc.
|
|
99
|
-
"@rivet-dev/agentos-plugin-darwin-x64": "0.2.5-rc.
|
|
100
|
-
"@rivet-dev/agentos-plugin-linux-arm64-gnu": "0.2.5-rc.
|
|
101
|
-
"@rivet-dev/agentos-plugin-linux-x64-gnu": "0.2.5-rc.
|
|
98
|
+
"@rivet-dev/agentos-plugin-darwin-arm64": "0.2.5-rc.4",
|
|
99
|
+
"@rivet-dev/agentos-plugin-darwin-x64": "0.2.5-rc.4",
|
|
100
|
+
"@rivet-dev/agentos-plugin-linux-arm64-gnu": "0.2.5-rc.4",
|
|
101
|
+
"@rivet-dev/agentos-plugin-linux-x64-gnu": "0.2.5-rc.4"
|
|
102
102
|
}
|
|
103
103
|
}
|