@rivet-dev/agentos-core 0.0.0-nathan-binding-workspace.9be0a88 → 0.0.0-nathan-agentos-combined.e833bb7

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.
@@ -190,6 +190,22 @@ export interface AgentOsLimits {
190
190
  syncReadLimitBytes?: number;
191
191
  };
192
192
  }
193
+ export interface AgentStderrEvent {
194
+ sessionId: string;
195
+ agentType: string;
196
+ processId: string;
197
+ pid: number | null;
198
+ chunk: Uint8Array;
199
+ }
200
+ export type AgentStderrHandler = (event: AgentStderrEvent) => void;
201
+ /**
202
+ * Public core VM options.
203
+ *
204
+ * Keep this interface in sync with
205
+ * `packages/core/src/options-schema.ts::agentOsOptionsSchema`. The Rivet
206
+ * native actor intentionally accepts only a subset via
207
+ * `packages/agentos/src/config.ts::nativeAgentOsOptionsSchema`.
208
+ */
193
209
  export interface AgentOsOptions {
194
210
  /**
195
211
  * Software to install in the VM. Each entry provides agents, tools,
@@ -244,6 +260,13 @@ export interface AgentOsOptions {
244
260
  * runtime's historical constants, so omitting this leaves behavior unchanged.
245
261
  */
246
262
  limits?: AgentOsLimits;
263
+ /**
264
+ * Called with stderr chunks from the top-level ACP-speaking agent process.
265
+ * The agent process uses stdout for ACP JSON-RPC protocol traffic, so only
266
+ * stderr is forwarded through this hook. Defaults to writing chunks to
267
+ * `process.stderr`.
268
+ */
269
+ onAgentStderr?: AgentStderrHandler;
247
270
  }
248
271
  /** Configuration for a local MCP server (spawned as a child process). */
249
272
  export interface McpServerConfigLocal {
@@ -360,6 +383,7 @@ export declare class AgentOs {
360
383
  private readonly _sidecarSession;
361
384
  private readonly _sidecarVm;
362
385
  private readonly _disposeSidecarEventListener;
386
+ private readonly _agentStderrHandler?;
363
387
  private constructor();
364
388
  static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
365
389
  static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>;
@@ -445,6 +469,7 @@ export declare class AgentOs {
445
469
  private _recordSessionNotification;
446
470
  private _dispatchSessionEvent;
447
471
  private _subscribeSessionEvents;
472
+ private _recordAgentStderr;
448
473
  private _applySyntheticConfigOverrides;
449
474
  private _handleSidecarEvent;
450
475
  private _handleAcpExtEvent;
package/dist/agent-os.js CHANGED
@@ -7,6 +7,7 @@ import { fileURLToPath } from "node:url";
7
7
  import commonSoftware from "@agentos-software/common";
8
8
  import { validateToolkits } from "./host-tools.js";
9
9
  import { zodToJsonSchema } from "./host-tools-zod.js";
10
+ import { parseAgentOsOptions } from "./options-schema.js";
10
11
  import { resolvePublishedSidecarBinary } from "./sidecar/binary.js";
11
12
  import { findCargoBinary, resolveCargoBinary } from "./sidecar/cargo.js";
12
13
  export { isAcpTimeoutErrorData } from "./json-rpc.js";
@@ -54,6 +55,9 @@ import { allowAll } from "./runtime-compat.js";
54
55
  import { AcpRuntimeKind, decodeAcpCallback, decodeAcpEvent, decodeAcpResponse, encodeAcpCallbackResponse, encodeAcpRequest, } from "./sidecar/agentos-protocol.js";
55
56
  import { serializePermissionsForSidecar } from "./sidecar/permissions.js";
56
57
  import { createAgentOsSidecarClient, NATIVE_SIDECAR_FRAME_TIMEOUT_MS, NativeSidecarKernelProxy, SidecarProcess, serializeRootFilesystemForSidecar, } from "./sidecar/rpc-client.js";
58
+ function defaultAgentStderrHandler(event) {
59
+ process.stderr.write(event.chunk);
60
+ }
57
61
  const LEGACY_PERMISSION_METHOD = "request/permission";
58
62
  const ACP_PERMISSION_METHOD = "session/request_permission";
59
63
  class AcpDispatchError extends Error {
@@ -367,7 +371,7 @@ const KERNEL_POSIX_BOOTSTRAP_DIRS = [
367
371
  "/mnt",
368
372
  "/media",
369
373
  "/home",
370
- "/home/user",
374
+ "/home/agentos",
371
375
  "/workspace",
372
376
  "/usr",
373
377
  "/usr/bin",
@@ -1404,7 +1408,8 @@ export class AgentOs {
1404
1408
  _sidecarSession;
1405
1409
  _sidecarVm;
1406
1410
  _disposeSidecarEventListener;
1407
- constructor(kernel, sidecar, softwareRoots, softwareAgentConfigs, hostMounts, env, rootFilesystem, sidecarClient, sidecarSession, sidecarVm) {
1411
+ _agentStderrHandler;
1412
+ constructor(kernel, sidecar, softwareRoots, softwareAgentConfigs, hostMounts, env, rootFilesystem, sidecarClient, sidecarSession, sidecarVm, agentStderrHandler) {
1408
1413
  this.#kernel = kernel;
1409
1414
  this.sidecar = sidecar;
1410
1415
  this._softwareRoots = softwareRoots;
@@ -1415,6 +1420,7 @@ export class AgentOs {
1415
1420
  this._sidecarClient = sidecarClient;
1416
1421
  this._sidecarSession = sidecarSession;
1417
1422
  this._sidecarVm = sidecarVm;
1423
+ this._agentStderrHandler = agentStderrHandler;
1418
1424
  this._disposeSidecarEventListener = this._sidecarClient.onEvent((event) => {
1419
1425
  this._handleSidecarEvent(event);
1420
1426
  });
@@ -1432,6 +1438,7 @@ export class AgentOs {
1432
1438
  return getSharedAgentOsSidecarInternal(options);
1433
1439
  }
1434
1440
  static async create(options) {
1441
+ options = parseAgentOsOptions(options);
1435
1442
  const software = options?.defaultSoftware === false
1436
1443
  ? (options.software ?? [])
1437
1444
  : [commonSoftware, ...(options?.software ?? [])];
@@ -1606,7 +1613,7 @@ export class AgentOs {
1606
1613
  createVm: async () => createVmAdmin(),
1607
1614
  });
1608
1615
  const vmAdmin = sidecarLease.admin;
1609
- const vm = new AgentOs(vmAdmin.kernel, sidecar, processed.softwareRoots, processed.agentConfigs, vmAdmin.hostMounts, vmAdmin.env, vmAdmin.rootView, vmAdmin.sidecarClient, vmAdmin.sidecarSession, vmAdmin.sidecarVm);
1616
+ const vm = new AgentOs(vmAdmin.kernel, sidecar, processed.softwareRoots, processed.agentConfigs, vmAdmin.hostMounts, vmAdmin.env, vmAdmin.rootView, vmAdmin.sidecarClient, vmAdmin.sidecarSession, vmAdmin.sidecarVm, options?.onAgentStderr ?? defaultAgentStderrHandler);
1610
1617
  vm._sidecarLease = sidecarLease;
1611
1618
  vm._toolKits = vmAdmin.toolKits;
1612
1619
  vm._toolReference = vmAdmin.toolReference;
@@ -2249,6 +2256,30 @@ export class AgentOs {
2249
2256
  session.eventHandlers.delete(subscriber);
2250
2257
  };
2251
2258
  }
2259
+ _recordAgentStderr(event) {
2260
+ const session = (event.sessionId ? this._sessions.get(event.sessionId) : undefined) ??
2261
+ [...this._sessions.values()].find((candidate) => candidate.processId === event.processId);
2262
+ const sessionId = event.sessionId || session?.sessionId;
2263
+ if (!sessionId) {
2264
+ return;
2265
+ }
2266
+ const handler = this._agentStderrHandler;
2267
+ if (!handler) {
2268
+ return;
2269
+ }
2270
+ try {
2271
+ handler({
2272
+ sessionId,
2273
+ agentType: event.agentType || session?.agentType || "",
2274
+ processId: event.processId,
2275
+ pid: session?.pid ?? null,
2276
+ chunk: new Uint8Array(event.chunk),
2277
+ });
2278
+ }
2279
+ catch {
2280
+ // Ignore subscriber callback failures and keep event delivery moving.
2281
+ }
2282
+ }
2252
2283
  _applySyntheticConfigOverrides(session) {
2253
2284
  if (session.configOverrides.size === 0) {
2254
2285
  return;
@@ -2305,6 +2336,10 @@ export class AgentOs {
2305
2336
  this._recordSessionNotification(session, toJsonRpcNotification(JSON.parse(event.val.notification)));
2306
2337
  return;
2307
2338
  }
2339
+ case "AcpAgentStderrEvent": {
2340
+ this._recordAgentStderr(event.val);
2341
+ return;
2342
+ }
2308
2343
  }
2309
2344
  }
2310
2345
  catch {
@@ -1,3 +1,4 @@
1
+ import { zodToJsonSchema as zodV3ToJsonSchema } from "zod-to-json-schema";
1
2
  const OPTIONAL_WRAPPER_TYPES = new Set(["default", "optional"]);
2
3
  const TRANSPARENT_WRAPPER_TYPES = new Set([
3
4
  ...OPTIONAL_WRAPPER_TYPES,
@@ -30,6 +31,9 @@ export class HostToolSchemaConversionError extends Error {
30
31
  }
31
32
  }
32
33
  function getSchemaDef(schema) {
34
+ if (!schema || typeof schema !== "object") {
35
+ return {};
36
+ }
33
37
  return (schema._def ??
34
38
  schema.def ??
35
39
  {});
@@ -131,7 +135,8 @@ function validateSchema(schema, path) {
131
135
  return;
132
136
  }
133
137
  if (typeName === "array") {
134
- const itemSchema = getSchemaDef(schema).element;
138
+ const def = getSchemaDef(schema);
139
+ const itemSchema = (def.element ?? def.type);
135
140
  if (!itemSchema) {
136
141
  throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "array schema is missing its item schema");
137
142
  }
@@ -163,8 +168,12 @@ function validateSchema(schema, path) {
163
168
  return;
164
169
  }
165
170
  if (typeName === "literal") {
166
- const values = getSchemaDef(schema).values;
167
- const literalValues = Array.isArray(values) ? values : [];
171
+ const def = getSchemaDef(schema);
172
+ const literalValues = Array.isArray(def.values)
173
+ ? def.values
174
+ : "value" in def
175
+ ? [def.value]
176
+ : [];
168
177
  const [literalValue] = literalValues;
169
178
  if (literalValues.length !== 1 ||
170
179
  !("string number boolean".split(" ").includes(typeof literalValue) || literalValue === null)) {
@@ -225,12 +234,23 @@ function findUnsupportedGeneratedKeyword(value, path) {
225
234
  }
226
235
  return null;
227
236
  }
237
+ function generateJsonSchema(schema) {
238
+ const nativeJsonSchema = schema.toJSONSchema?.();
239
+ if (nativeJsonSchema) {
240
+ return nativeJsonSchema;
241
+ }
242
+ const generated = zodV3ToJsonSchema(schema, {
243
+ $refStrategy: "none",
244
+ target: "jsonSchema7",
245
+ });
246
+ if (!generated || (typeof generated === "object" && Object.keys(generated).length === 0)) {
247
+ throw new HostToolSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), "schema cannot be converted to JSON Schema");
248
+ }
249
+ return generated;
250
+ }
228
251
  export function zodToJsonSchema(schema) {
229
252
  validateSchema(schema, "$");
230
- const jsonSchema = schema.toJSONSchema?.();
231
- if (!jsonSchema) {
232
- throw new HostToolSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), "schema does not expose toJSONSchema()");
233
- }
253
+ const jsonSchema = generateJsonSchema(schema);
234
254
  const unsupportedKeyword = findUnsupportedGeneratedKeyword(jsonSchema, "$");
235
255
  if (unsupportedKeyword) {
236
256
  throw new HostToolSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), `${unsupportedKeyword.keyword} emitted at ${unsupportedKeyword.path} is not supported`);
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { AGENT_CONFIGS } from "./agents.js";
3
3
  export { CronManager, InvalidScheduleError, PastScheduleError, TimerScheduleDriver, } from "./cron/index.js";
4
4
  export { createHostDirBackend, nodeModulesMount } from "./host-dir-mount.js";
5
5
  export { hostTool, MAX_TOOL_DESCRIPTION_LENGTH, toolKit, validateToolkits, } from "./host-tools.js";
6
+ export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, hostToolSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, toolKitSchema, } from "./options-schema.js";
6
7
  export { createInMemoryLayerStore, createSnapshotExport, } from "./layers.js";
7
8
  export { defineSoftware } from "./packages.js";
8
9
  export { isAcpTimeoutErrorData, isUnknownSessionErrorData, } from "./json-rpc.js";
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { AGENT_CONFIGS } from "./agents.js";
4
4
  export { CronManager, InvalidScheduleError, PastScheduleError, TimerScheduleDriver, } from "./cron/index.js";
5
5
  export { createHostDirBackend, nodeModulesMount } from "./host-dir-mount.js";
6
6
  export { hostTool, MAX_TOOL_DESCRIPTION_LENGTH, toolKit, validateToolkits, } from "./host-tools.js";
7
+ export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, hostToolSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, toolKitSchema, } from "./options-schema.js";
7
8
  export { createInMemoryLayerStore, createSnapshotExport, } from "./layers.js";
8
9
  export { defineSoftware } from "./packages.js";
9
10
  export { isAcpTimeoutErrorData, isUnknownSessionErrorData, } from "./json-rpc.js";
@@ -0,0 +1,437 @@
1
+ import { z } from "zod/v4";
2
+ import type { AgentOsOptions, AgentStderrHandler, NativeMountConfig } from "./agent-os.js";
3
+ import type { HostTool, ToolKit } from "./host-tools.js";
4
+ export declare const permissionsSchema: z.ZodObject<{
5
+ fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
6
+ allow: "allow";
7
+ deny: "deny";
8
+ }>, z.ZodObject<{
9
+ default: z.ZodOptional<z.ZodEnum<{
10
+ allow: "allow";
11
+ deny: "deny";
12
+ }>>;
13
+ rules: z.ZodArray<z.ZodObject<{
14
+ mode: z.ZodEnum<{
15
+ allow: "allow";
16
+ deny: "deny";
17
+ }>;
18
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
+ }, z.core.$strict>>;
21
+ }, z.core.$strict>]>>;
22
+ network: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
23
+ allow: "allow";
24
+ deny: "deny";
25
+ }>, z.ZodObject<{
26
+ default: z.ZodOptional<z.ZodEnum<{
27
+ allow: "allow";
28
+ deny: "deny";
29
+ }>>;
30
+ rules: z.ZodArray<z.ZodObject<{
31
+ mode: z.ZodEnum<{
32
+ allow: "allow";
33
+ deny: "deny";
34
+ }>;
35
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ }, z.core.$strict>>;
38
+ }, z.core.$strict>]>>;
39
+ childProcess: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
40
+ allow: "allow";
41
+ deny: "deny";
42
+ }>, z.ZodObject<{
43
+ default: z.ZodOptional<z.ZodEnum<{
44
+ allow: "allow";
45
+ deny: "deny";
46
+ }>>;
47
+ rules: z.ZodArray<z.ZodObject<{
48
+ mode: z.ZodEnum<{
49
+ allow: "allow";
50
+ deny: "deny";
51
+ }>;
52
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
53
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
54
+ }, z.core.$strict>>;
55
+ }, z.core.$strict>]>>;
56
+ process: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
57
+ allow: "allow";
58
+ deny: "deny";
59
+ }>, z.ZodObject<{
60
+ default: z.ZodOptional<z.ZodEnum<{
61
+ allow: "allow";
62
+ deny: "deny";
63
+ }>>;
64
+ rules: z.ZodArray<z.ZodObject<{
65
+ mode: z.ZodEnum<{
66
+ allow: "allow";
67
+ deny: "deny";
68
+ }>;
69
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
+ }, z.core.$strict>>;
72
+ }, z.core.$strict>]>>;
73
+ env: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
74
+ allow: "allow";
75
+ deny: "deny";
76
+ }>, z.ZodObject<{
77
+ default: z.ZodOptional<z.ZodEnum<{
78
+ allow: "allow";
79
+ deny: "deny";
80
+ }>>;
81
+ rules: z.ZodArray<z.ZodObject<{
82
+ mode: z.ZodEnum<{
83
+ allow: "allow";
84
+ deny: "deny";
85
+ }>;
86
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ }, z.core.$strict>>;
89
+ }, z.core.$strict>]>>;
90
+ tool: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
91
+ allow: "allow";
92
+ deny: "deny";
93
+ }>, z.ZodObject<{
94
+ default: z.ZodOptional<z.ZodEnum<{
95
+ allow: "allow";
96
+ deny: "deny";
97
+ }>>;
98
+ rules: z.ZodArray<z.ZodObject<{
99
+ mode: z.ZodEnum<{
100
+ allow: "allow";
101
+ deny: "deny";
102
+ }>;
103
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
+ }, z.core.$strict>>;
106
+ }, z.core.$strict>]>>;
107
+ }, z.core.$strict>;
108
+ export declare const agentOsLimitsSchema: z.ZodObject<{
109
+ resources: z.ZodOptional<z.ZodObject<{
110
+ cpuCount: z.ZodOptional<z.ZodNumber>;
111
+ maxProcesses: z.ZodOptional<z.ZodNumber>;
112
+ maxOpenFds: z.ZodOptional<z.ZodNumber>;
113
+ maxPipes: z.ZodOptional<z.ZodNumber>;
114
+ maxPtys: z.ZodOptional<z.ZodNumber>;
115
+ maxSockets: z.ZodOptional<z.ZodNumber>;
116
+ maxConnections: z.ZodOptional<z.ZodNumber>;
117
+ maxSocketBufferedBytes: z.ZodOptional<z.ZodNumber>;
118
+ maxSocketDatagramQueueLen: z.ZodOptional<z.ZodNumber>;
119
+ maxFilesystemBytes: z.ZodOptional<z.ZodNumber>;
120
+ maxInodeCount: z.ZodOptional<z.ZodNumber>;
121
+ maxBlockingReadMs: z.ZodOptional<z.ZodNumber>;
122
+ maxPreadBytes: z.ZodOptional<z.ZodNumber>;
123
+ maxFdWriteBytes: z.ZodOptional<z.ZodNumber>;
124
+ maxProcessArgvBytes: z.ZodOptional<z.ZodNumber>;
125
+ maxProcessEnvBytes: z.ZodOptional<z.ZodNumber>;
126
+ maxReaddirEntries: z.ZodOptional<z.ZodNumber>;
127
+ maxWasmFuel: z.ZodOptional<z.ZodNumber>;
128
+ maxWasmMemoryBytes: z.ZodOptional<z.ZodNumber>;
129
+ maxWasmStackBytes: z.ZodOptional<z.ZodNumber>;
130
+ }, z.core.$strict>>;
131
+ http: z.ZodOptional<z.ZodObject<{
132
+ maxFetchResponseBytes: z.ZodOptional<z.ZodNumber>;
133
+ }, z.core.$strict>>;
134
+ tools: z.ZodOptional<z.ZodObject<{
135
+ defaultToolTimeoutMs: z.ZodOptional<z.ZodNumber>;
136
+ maxToolTimeoutMs: z.ZodOptional<z.ZodNumber>;
137
+ maxRegisteredToolkits: z.ZodOptional<z.ZodNumber>;
138
+ maxRegisteredToolsPerVm: z.ZodOptional<z.ZodNumber>;
139
+ maxToolsPerToolkit: z.ZodOptional<z.ZodNumber>;
140
+ maxToolSchemaBytes: z.ZodOptional<z.ZodNumber>;
141
+ maxToolExamplesPerTool: z.ZodOptional<z.ZodNumber>;
142
+ maxToolExampleInputBytes: z.ZodOptional<z.ZodNumber>;
143
+ }, z.core.$strict>>;
144
+ plugins: z.ZodOptional<z.ZodObject<{
145
+ maxPersistedManifestBytes: z.ZodOptional<z.ZodNumber>;
146
+ maxPersistedManifestFileBytes: z.ZodOptional<z.ZodNumber>;
147
+ }, z.core.$strict>>;
148
+ acp: z.ZodOptional<z.ZodObject<{
149
+ maxReadLineBytes: z.ZodOptional<z.ZodNumber>;
150
+ stdoutBufferByteLimit: z.ZodOptional<z.ZodNumber>;
151
+ }, z.core.$strict>>;
152
+ jsRuntime: z.ZodOptional<z.ZodObject<{
153
+ v8HeapLimitMb: z.ZodOptional<z.ZodNumber>;
154
+ capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
155
+ stdinBufferLimitBytes: z.ZodOptional<z.ZodNumber>;
156
+ eventPayloadLimitBytes: z.ZodOptional<z.ZodNumber>;
157
+ v8IpcMaxFrameBytes: z.ZodOptional<z.ZodNumber>;
158
+ }, z.core.$strict>>;
159
+ python: z.ZodOptional<z.ZodObject<{
160
+ outputBufferMaxBytes: z.ZodOptional<z.ZodNumber>;
161
+ executionTimeoutMs: z.ZodOptional<z.ZodNumber>;
162
+ vfsRpcTimeoutMs: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$strict>>;
164
+ wasm: z.ZodOptional<z.ZodObject<{
165
+ maxModuleFileBytes: z.ZodOptional<z.ZodNumber>;
166
+ capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
167
+ syncReadLimitBytes: z.ZodOptional<z.ZodNumber>;
168
+ }, z.core.$strict>>;
169
+ }, z.core.$strict>;
170
+ export declare const rootFilesystemConfigSchema: z.ZodObject<{
171
+ type: z.ZodOptional<z.ZodLiteral<"overlay">>;
172
+ mode: z.ZodOptional<z.ZodEnum<{
173
+ ephemeral: "ephemeral";
174
+ "read-only": "read-only";
175
+ }>>;
176
+ disableDefaultBaseLayer: z.ZodOptional<z.ZodBoolean>;
177
+ lowers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
178
+ kind: z.ZodLiteral<"bundled-base-filesystem">;
179
+ }, z.core.$strict>, z.ZodObject<{
180
+ kind: z.ZodLiteral<"snapshot-export">;
181
+ source: z.ZodUnknown;
182
+ }, z.core.$strict>]>>>;
183
+ }, z.core.$strict>;
184
+ export declare const nativeMountConfigSchema: z.ZodType<NativeMountConfig>;
185
+ export declare const mountConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
186
+ path: z.ZodString;
187
+ driver: z.ZodCustom<unknown, unknown>;
188
+ readOnly: z.ZodOptional<z.ZodBoolean>;
189
+ }, z.core.$strict>, z.ZodType<NativeMountConfig, unknown, z.core.$ZodTypeInternals<NativeMountConfig, unknown>>, z.ZodObject<{
190
+ path: z.ZodString;
191
+ filesystem: z.ZodObject<{
192
+ type: z.ZodLiteral<"overlay">;
193
+ store: z.ZodUnknown;
194
+ mode: z.ZodOptional<z.ZodEnum<{
195
+ ephemeral: "ephemeral";
196
+ "read-only": "read-only";
197
+ }>>;
198
+ lowers: z.ZodArray<z.ZodUnknown>;
199
+ }, z.core.$strict>;
200
+ }, z.core.$strict>]>;
201
+ export declare const sharedSidecarConfigSchema: z.ZodObject<{
202
+ kind: z.ZodLiteral<"shared">;
203
+ pool: z.ZodOptional<z.ZodString>;
204
+ }, z.core.$strict>;
205
+ export declare const sidecarConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
206
+ kind: z.ZodLiteral<"shared">;
207
+ pool: z.ZodOptional<z.ZodString>;
208
+ }, z.core.$strict>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"explicit">;
210
+ handle: z.ZodUnknown;
211
+ }, z.core.$strict>]>;
212
+ export declare const hostToolSchema: z.ZodType<HostTool>;
213
+ export declare const toolKitSchema: z.ZodType<ToolKit>;
214
+ /**
215
+ * Shared AgentOsOptions field schemas.
216
+ *
217
+ * Core uses the full object. The Rivet/native actor composes a narrower
218
+ * native-safe subset in `packages/agentos/src/config.ts`; keep that subset and
219
+ * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson` aligned when
220
+ * adding options that cross the native boundary.
221
+ */
222
+ export declare const agentOsOptionFieldSchemas: {
223
+ readonly software: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
224
+ readonly defaultSoftware: z.ZodOptional<z.ZodBoolean>;
225
+ readonly loopbackExemptPorts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
226
+ readonly allowedNodeBuiltins: z.ZodOptional<z.ZodArray<z.ZodString>>;
227
+ readonly rootFilesystem: z.ZodOptional<z.ZodObject<{
228
+ type: z.ZodOptional<z.ZodLiteral<"overlay">>;
229
+ mode: z.ZodOptional<z.ZodEnum<{
230
+ ephemeral: "ephemeral";
231
+ "read-only": "read-only";
232
+ }>>;
233
+ disableDefaultBaseLayer: z.ZodOptional<z.ZodBoolean>;
234
+ lowers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
235
+ kind: z.ZodLiteral<"bundled-base-filesystem">;
236
+ }, z.core.$strict>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"snapshot-export">;
238
+ source: z.ZodUnknown;
239
+ }, z.core.$strict>]>>>;
240
+ }, z.core.$strict>>;
241
+ readonly mounts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
242
+ path: z.ZodString;
243
+ driver: z.ZodCustom<unknown, unknown>;
244
+ readOnly: z.ZodOptional<z.ZodBoolean>;
245
+ }, z.core.$strict>, z.ZodType<NativeMountConfig, unknown, z.core.$ZodTypeInternals<NativeMountConfig, unknown>>, z.ZodObject<{
246
+ path: z.ZodString;
247
+ filesystem: z.ZodObject<{
248
+ type: z.ZodLiteral<"overlay">;
249
+ store: z.ZodUnknown;
250
+ mode: z.ZodOptional<z.ZodEnum<{
251
+ ephemeral: "ephemeral";
252
+ "read-only": "read-only";
253
+ }>>;
254
+ lowers: z.ZodArray<z.ZodUnknown>;
255
+ }, z.core.$strict>;
256
+ }, z.core.$strict>]>>>;
257
+ readonly moduleAccessCwd: z.ZodOptional<z.ZodString>;
258
+ readonly additionalInstructions: z.ZodOptional<z.ZodString>;
259
+ readonly scheduleDriver: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
260
+ readonly toolKits: z.ZodOptional<z.ZodArray<z.ZodType<ToolKit, unknown, z.core.$ZodTypeInternals<ToolKit, unknown>>>>;
261
+ readonly permissions: z.ZodOptional<z.ZodObject<{
262
+ fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
263
+ allow: "allow";
264
+ deny: "deny";
265
+ }>, z.ZodObject<{
266
+ default: z.ZodOptional<z.ZodEnum<{
267
+ allow: "allow";
268
+ deny: "deny";
269
+ }>>;
270
+ rules: z.ZodArray<z.ZodObject<{
271
+ mode: z.ZodEnum<{
272
+ allow: "allow";
273
+ deny: "deny";
274
+ }>;
275
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
276
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
277
+ }, z.core.$strict>>;
278
+ }, z.core.$strict>]>>;
279
+ network: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
280
+ allow: "allow";
281
+ deny: "deny";
282
+ }>, z.ZodObject<{
283
+ default: z.ZodOptional<z.ZodEnum<{
284
+ allow: "allow";
285
+ deny: "deny";
286
+ }>>;
287
+ rules: z.ZodArray<z.ZodObject<{
288
+ mode: z.ZodEnum<{
289
+ allow: "allow";
290
+ deny: "deny";
291
+ }>;
292
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
293
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
294
+ }, z.core.$strict>>;
295
+ }, z.core.$strict>]>>;
296
+ childProcess: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
297
+ allow: "allow";
298
+ deny: "deny";
299
+ }>, z.ZodObject<{
300
+ default: z.ZodOptional<z.ZodEnum<{
301
+ allow: "allow";
302
+ deny: "deny";
303
+ }>>;
304
+ rules: z.ZodArray<z.ZodObject<{
305
+ mode: z.ZodEnum<{
306
+ allow: "allow";
307
+ deny: "deny";
308
+ }>;
309
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
310
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
311
+ }, z.core.$strict>>;
312
+ }, z.core.$strict>]>>;
313
+ process: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
314
+ allow: "allow";
315
+ deny: "deny";
316
+ }>, z.ZodObject<{
317
+ default: z.ZodOptional<z.ZodEnum<{
318
+ allow: "allow";
319
+ deny: "deny";
320
+ }>>;
321
+ rules: z.ZodArray<z.ZodObject<{
322
+ mode: z.ZodEnum<{
323
+ allow: "allow";
324
+ deny: "deny";
325
+ }>;
326
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
327
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
328
+ }, z.core.$strict>>;
329
+ }, z.core.$strict>]>>;
330
+ env: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
331
+ allow: "allow";
332
+ deny: "deny";
333
+ }>, z.ZodObject<{
334
+ default: z.ZodOptional<z.ZodEnum<{
335
+ allow: "allow";
336
+ deny: "deny";
337
+ }>>;
338
+ rules: z.ZodArray<z.ZodObject<{
339
+ mode: z.ZodEnum<{
340
+ allow: "allow";
341
+ deny: "deny";
342
+ }>;
343
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
344
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
345
+ }, z.core.$strict>>;
346
+ }, z.core.$strict>]>>;
347
+ tool: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
348
+ allow: "allow";
349
+ deny: "deny";
350
+ }>, z.ZodObject<{
351
+ default: z.ZodOptional<z.ZodEnum<{
352
+ allow: "allow";
353
+ deny: "deny";
354
+ }>>;
355
+ rules: z.ZodArray<z.ZodObject<{
356
+ mode: z.ZodEnum<{
357
+ allow: "allow";
358
+ deny: "deny";
359
+ }>;
360
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
361
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
362
+ }, z.core.$strict>>;
363
+ }, z.core.$strict>]>>;
364
+ }, z.core.$strict>>;
365
+ readonly sidecar: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
366
+ kind: z.ZodLiteral<"shared">;
367
+ pool: z.ZodOptional<z.ZodString>;
368
+ }, z.core.$strict>, z.ZodObject<{
369
+ kind: z.ZodLiteral<"explicit">;
370
+ handle: z.ZodUnknown;
371
+ }, z.core.$strict>]>>;
372
+ readonly limits: z.ZodOptional<z.ZodObject<{
373
+ resources: z.ZodOptional<z.ZodObject<{
374
+ cpuCount: z.ZodOptional<z.ZodNumber>;
375
+ maxProcesses: z.ZodOptional<z.ZodNumber>;
376
+ maxOpenFds: z.ZodOptional<z.ZodNumber>;
377
+ maxPipes: z.ZodOptional<z.ZodNumber>;
378
+ maxPtys: z.ZodOptional<z.ZodNumber>;
379
+ maxSockets: z.ZodOptional<z.ZodNumber>;
380
+ maxConnections: z.ZodOptional<z.ZodNumber>;
381
+ maxSocketBufferedBytes: z.ZodOptional<z.ZodNumber>;
382
+ maxSocketDatagramQueueLen: z.ZodOptional<z.ZodNumber>;
383
+ maxFilesystemBytes: z.ZodOptional<z.ZodNumber>;
384
+ maxInodeCount: z.ZodOptional<z.ZodNumber>;
385
+ maxBlockingReadMs: z.ZodOptional<z.ZodNumber>;
386
+ maxPreadBytes: z.ZodOptional<z.ZodNumber>;
387
+ maxFdWriteBytes: z.ZodOptional<z.ZodNumber>;
388
+ maxProcessArgvBytes: z.ZodOptional<z.ZodNumber>;
389
+ maxProcessEnvBytes: z.ZodOptional<z.ZodNumber>;
390
+ maxReaddirEntries: z.ZodOptional<z.ZodNumber>;
391
+ maxWasmFuel: z.ZodOptional<z.ZodNumber>;
392
+ maxWasmMemoryBytes: z.ZodOptional<z.ZodNumber>;
393
+ maxWasmStackBytes: z.ZodOptional<z.ZodNumber>;
394
+ }, z.core.$strict>>;
395
+ http: z.ZodOptional<z.ZodObject<{
396
+ maxFetchResponseBytes: z.ZodOptional<z.ZodNumber>;
397
+ }, z.core.$strict>>;
398
+ tools: z.ZodOptional<z.ZodObject<{
399
+ defaultToolTimeoutMs: z.ZodOptional<z.ZodNumber>;
400
+ maxToolTimeoutMs: z.ZodOptional<z.ZodNumber>;
401
+ maxRegisteredToolkits: z.ZodOptional<z.ZodNumber>;
402
+ maxRegisteredToolsPerVm: z.ZodOptional<z.ZodNumber>;
403
+ maxToolsPerToolkit: z.ZodOptional<z.ZodNumber>;
404
+ maxToolSchemaBytes: z.ZodOptional<z.ZodNumber>;
405
+ maxToolExamplesPerTool: z.ZodOptional<z.ZodNumber>;
406
+ maxToolExampleInputBytes: z.ZodOptional<z.ZodNumber>;
407
+ }, z.core.$strict>>;
408
+ plugins: z.ZodOptional<z.ZodObject<{
409
+ maxPersistedManifestBytes: z.ZodOptional<z.ZodNumber>;
410
+ maxPersistedManifestFileBytes: z.ZodOptional<z.ZodNumber>;
411
+ }, z.core.$strict>>;
412
+ acp: z.ZodOptional<z.ZodObject<{
413
+ maxReadLineBytes: z.ZodOptional<z.ZodNumber>;
414
+ stdoutBufferByteLimit: z.ZodOptional<z.ZodNumber>;
415
+ }, z.core.$strict>>;
416
+ jsRuntime: z.ZodOptional<z.ZodObject<{
417
+ v8HeapLimitMb: z.ZodOptional<z.ZodNumber>;
418
+ capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
419
+ stdinBufferLimitBytes: z.ZodOptional<z.ZodNumber>;
420
+ eventPayloadLimitBytes: z.ZodOptional<z.ZodNumber>;
421
+ v8IpcMaxFrameBytes: z.ZodOptional<z.ZodNumber>;
422
+ }, z.core.$strict>>;
423
+ python: z.ZodOptional<z.ZodObject<{
424
+ outputBufferMaxBytes: z.ZodOptional<z.ZodNumber>;
425
+ executionTimeoutMs: z.ZodOptional<z.ZodNumber>;
426
+ vfsRpcTimeoutMs: z.ZodOptional<z.ZodNumber>;
427
+ }, z.core.$strict>>;
428
+ wasm: z.ZodOptional<z.ZodObject<{
429
+ maxModuleFileBytes: z.ZodOptional<z.ZodNumber>;
430
+ capturedOutputLimitBytes: z.ZodOptional<z.ZodNumber>;
431
+ syncReadLimitBytes: z.ZodOptional<z.ZodNumber>;
432
+ }, z.core.$strict>>;
433
+ }, z.core.$strict>>;
434
+ readonly onAgentStderr: z.ZodOptional<z.ZodCustom<AgentStderrHandler, AgentStderrHandler>>;
435
+ };
436
+ export declare const agentOsOptionsSchema: z.ZodType<AgentOsOptions>;
437
+ export declare function parseAgentOsOptions(options?: AgentOsOptions): AgentOsOptions;
@@ -0,0 +1,259 @@
1
+ import { z } from "zod/v4";
2
+ const stringArray = z.array(z.string());
3
+ const nonNegativeInteger = z.number().int().nonnegative();
4
+ const positiveInteger = z.number().int().positive();
5
+ const functionSchema = z.custom((value) => typeof value === "function", { message: "Expected function" });
6
+ const permissionModeSchema = z.enum(["allow", "deny"]);
7
+ const fsPermissionRuleSchema = z
8
+ .object({
9
+ mode: permissionModeSchema,
10
+ operations: stringArray.optional(),
11
+ paths: stringArray.optional(),
12
+ })
13
+ .strict();
14
+ const patternPermissionRuleSchema = z
15
+ .object({
16
+ mode: permissionModeSchema,
17
+ operations: stringArray.optional(),
18
+ patterns: stringArray.optional(),
19
+ })
20
+ .strict();
21
+ const fsRulePermissionsSchema = z
22
+ .object({
23
+ default: permissionModeSchema.optional(),
24
+ rules: z.array(fsPermissionRuleSchema),
25
+ })
26
+ .strict();
27
+ const patternRulePermissionsSchema = z
28
+ .object({
29
+ default: permissionModeSchema.optional(),
30
+ rules: z.array(patternPermissionRuleSchema),
31
+ })
32
+ .strict();
33
+ const fsPermissionsSchema = z.union([permissionModeSchema, fsRulePermissionsSchema]);
34
+ const patternPermissionsSchema = z.union([
35
+ permissionModeSchema,
36
+ patternRulePermissionsSchema,
37
+ ]);
38
+ export const permissionsSchema = z
39
+ .object({
40
+ fs: fsPermissionsSchema.optional(),
41
+ network: patternPermissionsSchema.optional(),
42
+ childProcess: patternPermissionsSchema.optional(),
43
+ process: patternPermissionsSchema.optional(),
44
+ env: patternPermissionsSchema.optional(),
45
+ tool: patternPermissionsSchema.optional(),
46
+ })
47
+ .strict();
48
+ export const agentOsLimitsSchema = z
49
+ .object({
50
+ resources: z
51
+ .object({
52
+ cpuCount: positiveInteger.optional(),
53
+ maxProcesses: nonNegativeInteger.optional(),
54
+ maxOpenFds: nonNegativeInteger.optional(),
55
+ maxPipes: nonNegativeInteger.optional(),
56
+ maxPtys: nonNegativeInteger.optional(),
57
+ maxSockets: nonNegativeInteger.optional(),
58
+ maxConnections: nonNegativeInteger.optional(),
59
+ maxSocketBufferedBytes: nonNegativeInteger.optional(),
60
+ maxSocketDatagramQueueLen: nonNegativeInteger.optional(),
61
+ maxFilesystemBytes: nonNegativeInteger.optional(),
62
+ maxInodeCount: nonNegativeInteger.optional(),
63
+ maxBlockingReadMs: nonNegativeInteger.optional(),
64
+ maxPreadBytes: nonNegativeInteger.optional(),
65
+ maxFdWriteBytes: nonNegativeInteger.optional(),
66
+ maxProcessArgvBytes: nonNegativeInteger.optional(),
67
+ maxProcessEnvBytes: nonNegativeInteger.optional(),
68
+ maxReaddirEntries: nonNegativeInteger.optional(),
69
+ maxWasmFuel: nonNegativeInteger.optional(),
70
+ maxWasmMemoryBytes: nonNegativeInteger.optional(),
71
+ maxWasmStackBytes: nonNegativeInteger.optional(),
72
+ })
73
+ .strict()
74
+ .optional(),
75
+ http: z
76
+ .object({ maxFetchResponseBytes: nonNegativeInteger.optional() })
77
+ .strict()
78
+ .optional(),
79
+ tools: z
80
+ .object({
81
+ defaultToolTimeoutMs: nonNegativeInteger.optional(),
82
+ maxToolTimeoutMs: nonNegativeInteger.optional(),
83
+ maxRegisteredToolkits: nonNegativeInteger.optional(),
84
+ maxRegisteredToolsPerVm: nonNegativeInteger.optional(),
85
+ maxToolsPerToolkit: nonNegativeInteger.optional(),
86
+ maxToolSchemaBytes: nonNegativeInteger.optional(),
87
+ maxToolExamplesPerTool: nonNegativeInteger.optional(),
88
+ maxToolExampleInputBytes: nonNegativeInteger.optional(),
89
+ })
90
+ .strict()
91
+ .optional(),
92
+ plugins: z
93
+ .object({
94
+ maxPersistedManifestBytes: nonNegativeInteger.optional(),
95
+ maxPersistedManifestFileBytes: nonNegativeInteger.optional(),
96
+ })
97
+ .strict()
98
+ .optional(),
99
+ acp: z
100
+ .object({
101
+ maxReadLineBytes: nonNegativeInteger.optional(),
102
+ stdoutBufferByteLimit: nonNegativeInteger.optional(),
103
+ })
104
+ .strict()
105
+ .optional(),
106
+ jsRuntime: z
107
+ .object({
108
+ v8HeapLimitMb: nonNegativeInteger.optional(),
109
+ capturedOutputLimitBytes: nonNegativeInteger.optional(),
110
+ stdinBufferLimitBytes: nonNegativeInteger.optional(),
111
+ eventPayloadLimitBytes: nonNegativeInteger.optional(),
112
+ v8IpcMaxFrameBytes: nonNegativeInteger.optional(),
113
+ })
114
+ .strict()
115
+ .optional(),
116
+ python: z
117
+ .object({
118
+ outputBufferMaxBytes: nonNegativeInteger.optional(),
119
+ executionTimeoutMs: nonNegativeInteger.optional(),
120
+ vfsRpcTimeoutMs: nonNegativeInteger.optional(),
121
+ })
122
+ .strict()
123
+ .optional(),
124
+ wasm: z
125
+ .object({
126
+ maxModuleFileBytes: nonNegativeInteger.optional(),
127
+ capturedOutputLimitBytes: nonNegativeInteger.optional(),
128
+ syncReadLimitBytes: nonNegativeInteger.optional(),
129
+ })
130
+ .strict()
131
+ .optional(),
132
+ })
133
+ .strict();
134
+ const rootLowerInputSchema = z.union([
135
+ z.object({ kind: z.literal("bundled-base-filesystem") }).strict(),
136
+ z.object({ kind: z.literal("snapshot-export"), source: z.unknown() }).strict(),
137
+ ]);
138
+ export const rootFilesystemConfigSchema = z
139
+ .object({
140
+ type: z.literal("overlay").optional(),
141
+ mode: z.enum(["ephemeral", "read-only"]).optional(),
142
+ disableDefaultBaseLayer: z.boolean().optional(),
143
+ lowers: z.array(rootLowerInputSchema).optional(),
144
+ })
145
+ .strict();
146
+ const nativeMountPluginSchema = z
147
+ .object({
148
+ id: z.string(),
149
+ config: z.unknown().optional(),
150
+ })
151
+ .strict();
152
+ const plainMountConfigSchema = z
153
+ .object({
154
+ path: z.string(),
155
+ driver: z.custom((value) => typeof value === "object" && value !== null, {
156
+ message: "Expected filesystem driver object",
157
+ }),
158
+ readOnly: z.boolean().optional(),
159
+ })
160
+ .strict();
161
+ export const nativeMountConfigSchema = z
162
+ .object({
163
+ path: z.string(),
164
+ plugin: nativeMountPluginSchema,
165
+ readOnly: z.boolean().optional(),
166
+ })
167
+ .strict();
168
+ const overlayMountConfigSchema = z
169
+ .object({
170
+ path: z.string(),
171
+ filesystem: z
172
+ .object({
173
+ type: z.literal("overlay"),
174
+ store: z.unknown(),
175
+ mode: z.enum(["ephemeral", "read-only"]).optional(),
176
+ lowers: z.array(z.unknown()),
177
+ })
178
+ .strict(),
179
+ })
180
+ .strict();
181
+ export const mountConfigSchema = z.union([
182
+ plainMountConfigSchema,
183
+ nativeMountConfigSchema,
184
+ overlayMountConfigSchema,
185
+ ]);
186
+ export const sharedSidecarConfigSchema = z
187
+ .object({
188
+ kind: z.literal("shared"),
189
+ pool: z.string().optional(),
190
+ })
191
+ .strict();
192
+ const explicitSidecarSchema = z
193
+ .object({
194
+ kind: z.literal("explicit"),
195
+ handle: z.unknown(),
196
+ })
197
+ .strict();
198
+ export const sidecarConfigSchema = z.union([
199
+ sharedSidecarConfigSchema,
200
+ explicitSidecarSchema,
201
+ ]);
202
+ const toolExampleSchema = z
203
+ .object({
204
+ description: z.string(),
205
+ input: z.unknown(),
206
+ })
207
+ .strict();
208
+ export const hostToolSchema = z
209
+ .object({
210
+ description: z.string(),
211
+ inputSchema: z.custom((value) => typeof value === "object" && value !== null, {
212
+ message: "Expected Zod schema object",
213
+ }),
214
+ execute: functionSchema,
215
+ examples: z.array(toolExampleSchema).optional(),
216
+ timeout: nonNegativeInteger.optional(),
217
+ })
218
+ .strict();
219
+ export const toolKitSchema = z
220
+ .object({
221
+ name: z.string(),
222
+ description: z.string(),
223
+ tools: z.record(z.string(), hostToolSchema),
224
+ })
225
+ .strict();
226
+ /**
227
+ * Shared AgentOsOptions field schemas.
228
+ *
229
+ * Core uses the full object. The Rivet/native actor composes a narrower
230
+ * native-safe subset in `packages/agentos/src/config.ts`; keep that subset and
231
+ * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson` aligned when
232
+ * adding options that cross the native boundary.
233
+ */
234
+ export const agentOsOptionFieldSchemas = {
235
+ software: z.array(z.unknown()).optional(),
236
+ defaultSoftware: z.boolean().optional(),
237
+ loopbackExemptPorts: z.array(z.number().int().min(0).max(65535)).optional(),
238
+ allowedNodeBuiltins: stringArray.optional(),
239
+ rootFilesystem: rootFilesystemConfigSchema.optional(),
240
+ mounts: z.array(mountConfigSchema).optional(),
241
+ moduleAccessCwd: z.string().optional(),
242
+ additionalInstructions: z.string().optional(),
243
+ scheduleDriver: z
244
+ .custom((value) => typeof value === "object" && value !== null, {
245
+ message: "Expected schedule driver object",
246
+ })
247
+ .optional(),
248
+ toolKits: z.array(toolKitSchema).optional(),
249
+ permissions: permissionsSchema.optional(),
250
+ sidecar: sidecarConfigSchema.optional(),
251
+ limits: agentOsLimitsSchema.optional(),
252
+ onAgentStderr: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
253
+ };
254
+ export const agentOsOptionsSchema = z
255
+ .object(agentOsOptionFieldSchemas)
256
+ .strict();
257
+ export function parseAgentOsOptions(options) {
258
+ return agentOsOptionsSchema.parse(options ?? {});
259
+ }
@@ -36,7 +36,7 @@ const KERNEL_POSIX_BOOTSTRAP_DIRS = [
36
36
  "/mnt",
37
37
  "/media",
38
38
  "/home",
39
- "/home/user",
39
+ "/home/agentos",
40
40
  "/workspace",
41
41
  "/usr",
42
42
  "/usr/bin",
@@ -163,9 +163,20 @@ export type AcpSessionEvent = {
163
163
  };
164
164
  export declare function readAcpSessionEvent(bc: bare.ByteCursor): AcpSessionEvent;
165
165
  export declare function writeAcpSessionEvent(bc: bare.ByteCursor, x: AcpSessionEvent): void;
166
+ export type AcpAgentStderrEvent = {
167
+ readonly sessionId: string;
168
+ readonly agentType: string;
169
+ readonly processId: string;
170
+ readonly chunk: ArrayBuffer;
171
+ };
172
+ export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent;
173
+ export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void;
166
174
  export type AcpEvent = {
167
175
  readonly tag: "AcpSessionEvent";
168
176
  readonly val: AcpSessionEvent;
177
+ } | {
178
+ readonly tag: "AcpAgentStderrEvent";
179
+ readonly val: AcpAgentStderrEvent;
169
180
  };
170
181
  export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
171
182
  export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
@@ -433,12 +433,28 @@ export function writeAcpSessionEvent(bc, x) {
433
433
  bare.writeString(bc, x.sessionId);
434
434
  writeJsonUtf8(bc, x.notification);
435
435
  }
436
+ export function readAcpAgentStderrEvent(bc) {
437
+ return {
438
+ sessionId: bare.readString(bc),
439
+ agentType: bare.readString(bc),
440
+ processId: bare.readString(bc),
441
+ chunk: bare.readData(bc),
442
+ };
443
+ }
444
+ export function writeAcpAgentStderrEvent(bc, x) {
445
+ bare.writeString(bc, x.sessionId);
446
+ bare.writeString(bc, x.agentType);
447
+ bare.writeString(bc, x.processId);
448
+ bare.writeData(bc, x.chunk);
449
+ }
436
450
  export function readAcpEvent(bc) {
437
451
  const offset = bc.offset;
438
452
  const tag = bare.readU8(bc);
439
453
  switch (tag) {
440
454
  case 0:
441
455
  return { tag: "AcpSessionEvent", val: readAcpSessionEvent(bc) };
456
+ case 1:
457
+ return { tag: "AcpAgentStderrEvent", val: readAcpAgentStderrEvent(bc) };
442
458
  default: {
443
459
  bc.offset = offset;
444
460
  throw new bare.BareError(offset, "invalid tag");
@@ -452,6 +468,11 @@ export function writeAcpEvent(bc, x) {
452
468
  writeAcpSessionEvent(bc, x.val);
453
469
  break;
454
470
  }
471
+ case "AcpAgentStderrEvent": {
472
+ bare.writeU8(bc, 1);
473
+ writeAcpAgentStderrEvent(bc, x.val);
474
+ break;
475
+ }
455
476
  }
456
477
  }
457
478
  export function encodeAcpEvent(x, config) {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { AgentCapabilities, AgentInfo, AgentOsCreateSidecarOptions, AgentOsLimits, AgentOsOptions, AgentOsSharedSidecarOptions, AgentOsSidecarConfig, AgentOsSidecarDescription, AgentRegistryEntry, BatchReadResult, BatchWriteEntry, BatchWriteResult, CreateSessionOptions, DirEntry, McpServerConfig, McpServerConfigLocal, McpServerConfigRemote, MountConfig, MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountConfig, NativeMountPluginDescriptor, OverlayMountConfig, PermissionReply, PermissionRequest, PermissionRequestHandler, PlainMountConfig, ProcessTreeNode, PromptResult, ReaddirRecursiveOptions, ResumeSessionOptions, ResumeSessionResult, RootFilesystemConfig, RootLowerInput, SessionConfigOption, SessionEventHandler, SessionInfo, SessionInitData, SessionMode, SessionModeState, SpawnedProcessInfo, } from "./agent-os.js";
1
+ export type { AgentCapabilities, AgentInfo, AgentOsCreateSidecarOptions, AgentOsLimits, AgentOsOptions, AgentOsSharedSidecarOptions, AgentOsSidecarConfig, AgentOsSidecarDescription, AgentStderrEvent, AgentStderrHandler, AgentRegistryEntry, BatchReadResult, BatchWriteEntry, BatchWriteResult, CreateSessionOptions, DirEntry, McpServerConfig, McpServerConfigLocal, McpServerConfigRemote, MountConfig, MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountConfig, NativeMountPluginDescriptor, OverlayMountConfig, PermissionReply, PermissionRequest, PermissionRequestHandler, PlainMountConfig, ProcessTreeNode, PromptResult, ReaddirRecursiveOptions, ResumeSessionOptions, ResumeSessionResult, RootFilesystemConfig, RootLowerInput, SessionConfigOption, SessionEventHandler, SessionInfo, SessionInitData, SessionMode, SessionModeState, SpawnedProcessInfo, } from "./agent-os.js";
2
2
  export type { AgentConfig, AgentType } from "./agents.js";
3
3
  export type { CronAction, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./cron/index.js";
4
4
  export type { HostDirBackendOptions, HostDirMountPluginConfig, NodeModulesMountConfig, } from "./host-dir-mount.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivet-dev/agentos-core",
3
- "version": "0.0.0-nathan-binding-workspace.9be0a88",
3
+ "version": "0.0.0-nathan-agentos-combined.e833bb7",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -56,16 +56,18 @@
56
56
  "dependencies": {
57
57
  "@agentos-software/common": "0.3.0-rc.2",
58
58
  "@aws-sdk/client-s3": "^3.1019.0",
59
- "@rivet-dev/agentos-sidecar": "0.0.0-nathan-binding-workspace.9be0a88",
59
+ "@rivet-dev/agentos-sidecar": "0.0.0-nathan-agentos-combined.e833bb7",
60
60
  "@rivetkit/bare-ts": "^0.6.2",
61
- "@secure-exec/core": "0.0.0-nathan-workspace-binding-agentos.83db3e3",
61
+ "@secure-exec/core": "0.0.0-codex-native-sidecar-platform-ci.117d645",
62
62
  "@xterm/headless": "^6.0.0",
63
63
  "better-sqlite3": "^12.8.0",
64
64
  "croner": "^10.0.1",
65
65
  "googleapis": "^144.0.0",
66
66
  "isolated-vm": "^6.0.0",
67
67
  "long-timeout": "^0.1.1",
68
- "minimatch": "^10.2.4"
68
+ "minimatch": "^10.2.4",
69
+ "zod": "^4.1.11",
70
+ "zod-to-json-schema": "^3.25.2"
69
71
  },
70
72
  "devDependencies": {
71
73
  "@anthropic-ai/claude-agent-sdk": "^0.2.87",
@@ -77,12 +79,12 @@
77
79
  "@copilotkit/llmock": "^1.6.0",
78
80
  "@rivet-dev/agentos-sandbox": "link:../agentos-sandbox",
79
81
  "@agentos-software/git": "0.3.0-rc.2",
80
- "@secure-exec/google-drive": "0.0.0-nathan-workspace-binding-agentos.83db3e3",
81
- "@secure-exec/s3": "0.0.0-nathan-workspace-binding-agentos.83db3e3",
82
+ "@secure-exec/google-drive": "0.0.0-codex-native-sidecar-platform-ci.117d645",
83
+ "@secure-exec/s3": "0.0.0-codex-native-sidecar-platform-ci.117d645",
82
84
  "@mariozechner/pi-coding-agent": "^0.60.0",
83
- "@agentos-software/claude-code": "link:../../registry/agent/claude",
85
+ "@agentos-software/claude-code": "0.0.0-nathan-binding-workspace.9be0a88",
84
86
  "@agentos-software/codex-cli": "0.3.0-rc.2",
85
- "@agentos-software/codex": "link:../../registry/agent/codex",
87
+ "@agentos-software/codex": "0.3.0-rc.2",
86
88
  "@agentos-software/coreutils": "0.3.0-rc.2",
87
89
  "@agentos-software/curl": "0.3.0-rc.2",
88
90
  "@agentos-software/diffutils": "0.3.0-rc.2",
@@ -93,9 +95,9 @@
93
95
  "@agentos-software/grep": "0.3.0-rc.2",
94
96
  "@agentos-software/gzip": "0.3.0-rc.2",
95
97
  "@agentos-software/jq": "0.3.0-rc.2",
96
- "@agentos-software/opencode": "link:../../registry/agent/opencode",
97
- "@agentos-software/pi": "link:../../registry/agent/pi",
98
- "@agentos-software/pi-cli": "link:../../registry/agent/pi-cli",
98
+ "@agentos-software/opencode": "0.0.0-nathan-binding-workspace.9be0a88",
99
+ "@agentos-software/pi": "0.0.0-nathan-binding-workspace.9be0a88",
100
+ "@agentos-software/pi-cli": "0.0.0-nathan-binding-workspace.9be0a88",
99
101
  "@agentos-software/ripgrep": "0.3.0-rc.2",
100
102
  "@agentos-software/sed": "0.3.0-rc.2",
101
103
  "@agentos-software/tar": "0.3.0-rc.2",
@@ -107,6 +109,6 @@
107
109
  "typescript": "^5.7.2",
108
110
  "vitest": "^2.1.8",
109
111
  "ws": "^8.18.0",
110
- "zod": "^4.1.11"
112
+ "zod3": "npm:zod@^3.25.76"
111
113
  }
112
114
  }