@rivet-dev/agentos-core 0.0.0-main.2f99c77 → 0.0.0-main.5ac5a14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +10 -196
  2. package/dist/agent-os.d.ts +508 -271
  3. package/dist/agent-os.js +2277 -1243
  4. package/dist/agentos-package.d.ts +6 -4
  5. package/dist/agentos-package.js +6 -3
  6. package/dist/base-filesystem.js +2 -2
  7. package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
  8. package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
  9. package/dist/bindings.d.ts +43 -0
  10. package/dist/bindings.js +34 -0
  11. package/dist/code-execution.d.ts +70 -0
  12. package/dist/code-execution.js +115 -0
  13. package/dist/cron/cron-manager.js +43 -10
  14. package/dist/cron/index.d.ts +1 -1
  15. package/dist/cron/types.d.ts +25 -9
  16. package/dist/filesystem-snapshot.d.ts +1 -2
  17. package/dist/filesystem-snapshot.js +0 -43
  18. package/dist/generated/AcpLimitsConfig.d.ts +16 -0
  19. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  20. package/dist/generated/CreateVmConfig.d.ts +2 -0
  21. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  22. package/dist/generated/ProcessLimitsConfig.js +2 -0
  23. package/dist/generated/VmGroupConfig.d.ts +5 -0
  24. package/dist/generated/VmGroupConfig.js +2 -0
  25. package/dist/generated/VmLimitsConfig.d.ts +4 -2
  26. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  27. package/dist/generated/VmUserAccountConfig.js +2 -0
  28. package/dist/generated/VmUserConfig.d.ts +19 -0
  29. package/dist/generated/WasmLimitsConfig.d.ts +1 -0
  30. package/dist/index.d.ts +7 -5
  31. package/dist/index.js +5 -5
  32. package/dist/language-execution.d.ts +170 -0
  33. package/dist/language-execution.js +1 -0
  34. package/dist/layers.d.ts +5 -2
  35. package/dist/layers.js +0 -185
  36. package/dist/options-schema.d.ts +150 -31
  37. package/dist/options-schema.js +159 -26
  38. package/dist/packages.d.ts +1 -1
  39. package/dist/runtime-compat.d.ts +6 -35
  40. package/dist/runtime-compat.js +85 -373
  41. package/dist/runtime.d.ts +5 -1
  42. package/dist/sandbox.d.ts +4 -4
  43. package/dist/sandbox.js +34 -21
  44. package/dist/session-api.d.ts +180 -0
  45. package/dist/session-api.js +1 -0
  46. package/dist/sidecar/agentos-protocol.d.ts +434 -32
  47. package/dist/sidecar/agentos-protocol.js +693 -93
  48. package/dist/sidecar/rpc-client.d.ts +18 -6
  49. package/dist/sidecar/rpc-client.js +88 -39
  50. package/dist/test/runtime.d.ts +2 -1
  51. package/dist/test/runtime.js +2 -1
  52. package/dist/test/terminal-harness.js +0 -3
  53. package/dist/types.d.ts +7 -6
  54. package/package.json +38 -28
  55. package/dist/agent-session-types.d.ts +0 -67
  56. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  57. package/dist/host-tools.d.ts +0 -45
  58. package/dist/host-tools.js +0 -35
  59. package/dist/overlay-filesystem.d.ts +0 -19
  60. package/dist/overlay-filesystem.js +0 -645
  61. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
  62. /package/dist/{agent-session-types.js → generated/VmUserConfig.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  import type { AgentExitHandler, AgentOsOptions, AgentStderrHandler, LimitWarningHandler, NativeMountConfig } from "./agent-os.js";
3
- import type { HostTool, ToolKit } from "./host-tools.js";
3
+ import type { Binding, Bindings } from "./bindings.js";
4
4
  export declare const permissionsSchema: z.ZodObject<{
5
5
  fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
6
6
  allow: "allow";
@@ -131,15 +131,18 @@ export declare const agentOsLimitsSchema: z.ZodObject<{
131
131
  http: z.ZodOptional<z.ZodObject<{
132
132
  maxFetchResponseBytes: z.ZodOptional<z.ZodNumber>;
133
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>;
134
+ tls: z.ZodOptional<z.ZodObject<{
135
+ maxBufferedBytes: z.ZodOptional<z.ZodNumber>;
136
+ }, z.core.$strict>>;
137
+ bindings: z.ZodOptional<z.ZodObject<{
138
+ defaultBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
139
+ maxBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
140
+ maxRegisteredCollections: z.ZodOptional<z.ZodNumber>;
141
+ maxRegisteredBindingsPerVm: z.ZodOptional<z.ZodNumber>;
142
+ maxBindingsPerCollection: z.ZodOptional<z.ZodNumber>;
143
+ maxBindingSchemaBytes: z.ZodOptional<z.ZodNumber>;
144
+ maxExamplesPerBinding: z.ZodOptional<z.ZodNumber>;
145
+ maxBindingExampleInputBytes: z.ZodOptional<z.ZodNumber>;
143
146
  }, z.core.$strict>>;
144
147
  plugins: z.ZodOptional<z.ZodObject<{
145
148
  maxPersistedManifestBytes: z.ZodOptional<z.ZodNumber>;
@@ -148,6 +151,25 @@ export declare const agentOsLimitsSchema: z.ZodObject<{
148
151
  acp: z.ZodOptional<z.ZodObject<{
149
152
  maxReadLineBytes: z.ZodOptional<z.ZodNumber>;
150
153
  stdoutBufferByteLimit: z.ZodOptional<z.ZodNumber>;
154
+ maxCompletedMessageBytes: z.ZodOptional<z.ZodNumber>;
155
+ maxTurnOutputBytes: z.ZodOptional<z.ZodNumber>;
156
+ maxPromptBytes: z.ZodOptional<z.ZodNumber>;
157
+ maxPromptBlocks: z.ZodOptional<z.ZodNumber>;
158
+ maxFallbackContinuationBytes: z.ZodOptional<z.ZodNumber>;
159
+ maxSessionHistoryBytes: z.ZodOptional<z.ZodNumber>;
160
+ maxSessionHistoryEvents: z.ZodOptional<z.ZodNumber>;
161
+ maxHistoryPageEntries: z.ZodOptional<z.ZodNumber>;
162
+ maxSessionListEntries: z.ZodOptional<z.ZodNumber>;
163
+ maxSessionsPerVm: z.ZodOptional<z.ZodNumber>;
164
+ maxPromptsPerSession: z.ZodOptional<z.ZodNumber>;
165
+ maxPromptsPerVm: z.ZodOptional<z.ZodNumber>;
166
+ maxPendingPermissionsPerSession: z.ZodOptional<z.ZodNumber>;
167
+ maxPendingPermissionsPerVm: z.ZodOptional<z.ZodNumber>;
168
+ maxPermissionOutcomesPerSession: z.ZodOptional<z.ZodNumber>;
169
+ maxPermissionOutcomesPerVm: z.ZodOptional<z.ZodNumber>;
170
+ }, z.core.$strict>>;
171
+ sqlite: z.ZodOptional<z.ZodObject<{
172
+ maxResultBytes: z.ZodOptional<z.ZodNumber>;
151
173
  }, z.core.$strict>>;
152
174
  jsRuntime: z.ZodOptional<z.ZodObject<{
153
175
  v8HeapLimitMb: z.ZodOptional<z.ZodNumber>;
@@ -172,9 +194,22 @@ export declare const agentOsLimitsSchema: z.ZodObject<{
172
194
  syncReadLimitBytes: z.ZodOptional<z.ZodNumber>;
173
195
  prewarmTimeoutMs: z.ZodOptional<z.ZodNumber>;
174
196
  runnerHeapLimitMb: z.ZodOptional<z.ZodNumber>;
197
+ runnerCpuTimeLimitMs: z.ZodOptional<z.ZodNumber>;
198
+ }, z.core.$strict>>;
199
+ execution: z.ZodOptional<z.ZodObject<{
200
+ completedTtlMs: z.ZodOptional<z.ZodNumber>;
201
+ maxCompletedExecutions: z.ZodOptional<z.ZodNumber>;
202
+ liveExecutionWarningThreshold: z.ZodOptional<z.ZodNumber>;
203
+ }, z.core.$strict>>;
204
+ process: z.ZodOptional<z.ZodObject<{
205
+ maxSpawnFileActions: z.ZodOptional<z.ZodNumber>;
206
+ maxSpawnFileActionBytes: z.ZodOptional<z.ZodNumber>;
207
+ pendingStdinBytes: z.ZodOptional<z.ZodNumber>;
208
+ pendingEventCount: z.ZodOptional<z.ZodNumber>;
209
+ pendingEventBytes: z.ZodOptional<z.ZodNumber>;
175
210
  }, z.core.$strict>>;
176
211
  }, z.core.$strict>;
177
- export declare const rootFilesystemConfigSchema: z.ZodObject<{
212
+ export declare const rootFilesystemConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
178
213
  type: z.ZodOptional<z.ZodLiteral<"overlay">>;
179
214
  mode: z.ZodOptional<z.ZodEnum<{
180
215
  ephemeral: "ephemeral";
@@ -187,11 +222,20 @@ export declare const rootFilesystemConfigSchema: z.ZodObject<{
187
222
  kind: z.ZodLiteral<"snapshot-export">;
188
223
  source: z.ZodUnknown;
189
224
  }, z.core.$strict>]>>>;
190
- }, z.core.$strict>;
225
+ }, z.core.$strict>, z.ZodObject<{
226
+ type: z.ZodLiteral<"native">;
227
+ plugin: z.ZodObject<{
228
+ id: z.ZodString;
229
+ config: z.ZodOptional<z.ZodUnknown>;
230
+ }, z.core.$strict>;
231
+ readOnly: z.ZodOptional<z.ZodBoolean>;
232
+ }, z.core.$strict>]>;
191
233
  export declare const nativeMountConfigSchema: z.ZodType<NativeMountConfig>;
192
234
  export declare const mountConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
193
235
  path: z.ZodString;
194
236
  driver: z.ZodCustom<unknown, unknown>;
237
+ guestFstype: z.ZodOptional<z.ZodString>;
238
+ guestSource: z.ZodOptional<z.ZodString>;
195
239
  readOnly: z.ZodOptional<z.ZodBoolean>;
196
240
  }, z.core.$strict>, z.ZodType<NativeMountConfig, unknown, z.core.$ZodTypeInternals<NativeMountConfig, unknown>>, z.ZodObject<{
197
241
  path: z.ZodString;
@@ -216,23 +260,54 @@ export declare const sidecarConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
216
260
  kind: z.ZodLiteral<"explicit">;
217
261
  handle: z.ZodUnknown;
218
262
  }, z.core.$strict>]>;
219
- export declare const hostToolSchema: z.ZodType<HostTool>;
220
- export declare const toolKitSchema: z.ZodType<ToolKit>;
263
+ export declare const bindingSchema: z.ZodType<Binding>;
264
+ export declare const bindingsSchema: z.ZodType<Bindings>;
221
265
  /**
222
266
  * Shared AgentOsOptions field schemas.
223
267
  *
224
- * Core uses the full object. The Rivet/native actor composes a narrower
225
- * native-safe subset in `packages/agentos/src/config.ts`; keep that subset and
226
- * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson` aligned when
227
- * adding options that cross the native boundary.
268
+ * Core and the TypeScript Rivet actor both use the full object. Runtime-owned
269
+ * behavior is serialized by AgentOs.create() into the sidecar VM config.
228
270
  */
229
271
  export declare const agentOsOptionFieldSchemas: {
272
+ readonly user: z.ZodOptional<z.ZodObject<{
273
+ uid: z.ZodOptional<z.ZodNumber>;
274
+ gid: z.ZodOptional<z.ZodNumber>;
275
+ euid: z.ZodOptional<z.ZodNumber>;
276
+ egid: z.ZodOptional<z.ZodNumber>;
277
+ username: z.ZodOptional<z.ZodString>;
278
+ homedir: z.ZodOptional<z.ZodString>;
279
+ shell: z.ZodOptional<z.ZodString>;
280
+ gecos: z.ZodOptional<z.ZodString>;
281
+ groupName: z.ZodOptional<z.ZodString>;
282
+ supplementaryGids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
283
+ accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
284
+ uid: z.ZodNumber;
285
+ gid: z.ZodNumber;
286
+ username: z.ZodString;
287
+ homedir: z.ZodString;
288
+ shell: z.ZodString;
289
+ gecos: z.ZodOptional<z.ZodString>;
290
+ supplementaryGids: z.ZodArray<z.ZodNumber>;
291
+ }, z.core.$strict>>>;
292
+ groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
+ gid: z.ZodNumber;
294
+ name: z.ZodString;
295
+ members: z.ZodArray<z.ZodString>;
296
+ }, z.core.$strict>>>;
297
+ }, z.core.$strict>>;
230
298
  readonly software: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
231
299
  readonly defaultSoftware: z.ZodOptional<z.ZodBoolean>;
232
300
  readonly loopbackExemptPorts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
233
301
  readonly allowedNodeBuiltins: z.ZodOptional<z.ZodArray<z.ZodString>>;
234
302
  readonly highResolutionTime: z.ZodOptional<z.ZodBoolean>;
235
- readonly rootFilesystem: z.ZodOptional<z.ZodObject<{
303
+ readonly database: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
304
+ type: z.ZodLiteral<"actor_uds">;
305
+ path: z.ZodString;
306
+ }, z.core.$strict>, z.ZodObject<{
307
+ type: z.ZodLiteral<"sqlite_file">;
308
+ path: z.ZodString;
309
+ }, z.core.$strict>], "type">>;
310
+ readonly rootFilesystem: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
236
311
  type: z.ZodOptional<z.ZodLiteral<"overlay">>;
237
312
  mode: z.ZodOptional<z.ZodEnum<{
238
313
  ephemeral: "ephemeral";
@@ -245,10 +320,19 @@ export declare const agentOsOptionFieldSchemas: {
245
320
  kind: z.ZodLiteral<"snapshot-export">;
246
321
  source: z.ZodUnknown;
247
322
  }, z.core.$strict>]>>>;
248
- }, z.core.$strict>>;
323
+ }, z.core.$strict>, z.ZodObject<{
324
+ type: z.ZodLiteral<"native">;
325
+ plugin: z.ZodObject<{
326
+ id: z.ZodString;
327
+ config: z.ZodOptional<z.ZodUnknown>;
328
+ }, z.core.$strict>;
329
+ readOnly: z.ZodOptional<z.ZodBoolean>;
330
+ }, z.core.$strict>]>>;
249
331
  readonly mounts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
250
332
  path: z.ZodString;
251
333
  driver: z.ZodCustom<unknown, unknown>;
334
+ guestFstype: z.ZodOptional<z.ZodString>;
335
+ guestSource: z.ZodOptional<z.ZodString>;
252
336
  readOnly: z.ZodOptional<z.ZodBoolean>;
253
337
  }, z.core.$strict>, z.ZodType<NativeMountConfig, unknown, z.core.$ZodTypeInternals<NativeMountConfig, unknown>>, z.ZodObject<{
254
338
  path: z.ZodString;
@@ -262,9 +346,9 @@ export declare const agentOsOptionFieldSchemas: {
262
346
  lowers: z.ZodArray<z.ZodUnknown>;
263
347
  }, z.core.$strict>;
264
348
  }, z.core.$strict>]>>>;
265
- readonly additionalInstructions: z.ZodOptional<z.ZodString>;
349
+ readonly sandbox: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
266
350
  readonly scheduleDriver: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
267
- readonly toolKits: z.ZodOptional<z.ZodArray<z.ZodType<ToolKit, unknown, z.core.$ZodTypeInternals<ToolKit, unknown>>>>;
351
+ readonly bindings: z.ZodOptional<z.ZodArray<z.ZodType<Bindings, unknown, z.core.$ZodTypeInternals<Bindings, unknown>>>>;
268
352
  readonly permissions: z.ZodOptional<z.ZodObject<{
269
353
  fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
270
354
  allow: "allow";
@@ -402,15 +486,18 @@ export declare const agentOsOptionFieldSchemas: {
402
486
  http: z.ZodOptional<z.ZodObject<{
403
487
  maxFetchResponseBytes: z.ZodOptional<z.ZodNumber>;
404
488
  }, z.core.$strict>>;
405
- tools: z.ZodOptional<z.ZodObject<{
406
- defaultToolTimeoutMs: z.ZodOptional<z.ZodNumber>;
407
- maxToolTimeoutMs: z.ZodOptional<z.ZodNumber>;
408
- maxRegisteredToolkits: z.ZodOptional<z.ZodNumber>;
409
- maxRegisteredToolsPerVm: z.ZodOptional<z.ZodNumber>;
410
- maxToolsPerToolkit: z.ZodOptional<z.ZodNumber>;
411
- maxToolSchemaBytes: z.ZodOptional<z.ZodNumber>;
412
- maxToolExamplesPerTool: z.ZodOptional<z.ZodNumber>;
413
- maxToolExampleInputBytes: z.ZodOptional<z.ZodNumber>;
489
+ tls: z.ZodOptional<z.ZodObject<{
490
+ maxBufferedBytes: z.ZodOptional<z.ZodNumber>;
491
+ }, z.core.$strict>>;
492
+ bindings: z.ZodOptional<z.ZodObject<{
493
+ defaultBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
494
+ maxBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
495
+ maxRegisteredCollections: z.ZodOptional<z.ZodNumber>;
496
+ maxRegisteredBindingsPerVm: z.ZodOptional<z.ZodNumber>;
497
+ maxBindingsPerCollection: z.ZodOptional<z.ZodNumber>;
498
+ maxBindingSchemaBytes: z.ZodOptional<z.ZodNumber>;
499
+ maxExamplesPerBinding: z.ZodOptional<z.ZodNumber>;
500
+ maxBindingExampleInputBytes: z.ZodOptional<z.ZodNumber>;
414
501
  }, z.core.$strict>>;
415
502
  plugins: z.ZodOptional<z.ZodObject<{
416
503
  maxPersistedManifestBytes: z.ZodOptional<z.ZodNumber>;
@@ -419,6 +506,25 @@ export declare const agentOsOptionFieldSchemas: {
419
506
  acp: z.ZodOptional<z.ZodObject<{
420
507
  maxReadLineBytes: z.ZodOptional<z.ZodNumber>;
421
508
  stdoutBufferByteLimit: z.ZodOptional<z.ZodNumber>;
509
+ maxCompletedMessageBytes: z.ZodOptional<z.ZodNumber>;
510
+ maxTurnOutputBytes: z.ZodOptional<z.ZodNumber>;
511
+ maxPromptBytes: z.ZodOptional<z.ZodNumber>;
512
+ maxPromptBlocks: z.ZodOptional<z.ZodNumber>;
513
+ maxFallbackContinuationBytes: z.ZodOptional<z.ZodNumber>;
514
+ maxSessionHistoryBytes: z.ZodOptional<z.ZodNumber>;
515
+ maxSessionHistoryEvents: z.ZodOptional<z.ZodNumber>;
516
+ maxHistoryPageEntries: z.ZodOptional<z.ZodNumber>;
517
+ maxSessionListEntries: z.ZodOptional<z.ZodNumber>;
518
+ maxSessionsPerVm: z.ZodOptional<z.ZodNumber>;
519
+ maxPromptsPerSession: z.ZodOptional<z.ZodNumber>;
520
+ maxPromptsPerVm: z.ZodOptional<z.ZodNumber>;
521
+ maxPendingPermissionsPerSession: z.ZodOptional<z.ZodNumber>;
522
+ maxPendingPermissionsPerVm: z.ZodOptional<z.ZodNumber>;
523
+ maxPermissionOutcomesPerSession: z.ZodOptional<z.ZodNumber>;
524
+ maxPermissionOutcomesPerVm: z.ZodOptional<z.ZodNumber>;
525
+ }, z.core.$strict>>;
526
+ sqlite: z.ZodOptional<z.ZodObject<{
527
+ maxResultBytes: z.ZodOptional<z.ZodNumber>;
422
528
  }, z.core.$strict>>;
423
529
  jsRuntime: z.ZodOptional<z.ZodObject<{
424
530
  v8HeapLimitMb: z.ZodOptional<z.ZodNumber>;
@@ -443,6 +549,19 @@ export declare const agentOsOptionFieldSchemas: {
443
549
  syncReadLimitBytes: z.ZodOptional<z.ZodNumber>;
444
550
  prewarmTimeoutMs: z.ZodOptional<z.ZodNumber>;
445
551
  runnerHeapLimitMb: z.ZodOptional<z.ZodNumber>;
552
+ runnerCpuTimeLimitMs: z.ZodOptional<z.ZodNumber>;
553
+ }, z.core.$strict>>;
554
+ execution: z.ZodOptional<z.ZodObject<{
555
+ completedTtlMs: z.ZodOptional<z.ZodNumber>;
556
+ maxCompletedExecutions: z.ZodOptional<z.ZodNumber>;
557
+ liveExecutionWarningThreshold: z.ZodOptional<z.ZodNumber>;
558
+ }, z.core.$strict>>;
559
+ process: z.ZodOptional<z.ZodObject<{
560
+ maxSpawnFileActions: z.ZodOptional<z.ZodNumber>;
561
+ maxSpawnFileActionBytes: z.ZodOptional<z.ZodNumber>;
562
+ pendingStdinBytes: z.ZodOptional<z.ZodNumber>;
563
+ pendingEventCount: z.ZodOptional<z.ZodNumber>;
564
+ pendingEventBytes: z.ZodOptional<z.ZodNumber>;
446
565
  }, z.core.$strict>>;
447
566
  }, z.core.$strict>>;
448
567
  readonly onAgentStderr: z.ZodOptional<z.ZodCustom<AgentStderrHandler, AgentStderrHandler>>;
@@ -2,6 +2,46 @@ import { z } from "zod/v4";
2
2
  const stringArray = z.array(z.string());
3
3
  const nonNegativeInteger = z.number().int().nonnegative();
4
4
  const positiveInteger = z.number().int().positive();
5
+ const vmIdSchema = z.number().int().min(0).max(0xffffffff);
6
+ const vmAccountNameSchema = z
7
+ .string()
8
+ .min(1)
9
+ .refine((value) => !/[:\s\0]/u.test(value), "Invalid account name");
10
+ const vmGuestPathSchema = z.string().startsWith("/");
11
+ const vmUserAccountSchema = z
12
+ .object({
13
+ uid: vmIdSchema,
14
+ gid: vmIdSchema,
15
+ username: vmAccountNameSchema,
16
+ homedir: vmGuestPathSchema,
17
+ shell: vmGuestPathSchema,
18
+ gecos: z.string().optional(),
19
+ supplementaryGids: z.array(vmIdSchema).max(64),
20
+ })
21
+ .strict();
22
+ const vmGroupSchema = z
23
+ .object({
24
+ gid: vmIdSchema,
25
+ name: vmAccountNameSchema,
26
+ members: z.array(vmAccountNameSchema),
27
+ })
28
+ .strict();
29
+ const vmUserConfigSchema = z
30
+ .object({
31
+ uid: vmIdSchema.optional(),
32
+ gid: vmIdSchema.optional(),
33
+ euid: vmIdSchema.optional(),
34
+ egid: vmIdSchema.optional(),
35
+ username: z.string().optional(),
36
+ homedir: z.string().optional(),
37
+ shell: z.string().optional(),
38
+ gecos: z.string().optional(),
39
+ groupName: z.string().optional(),
40
+ supplementaryGids: z.array(vmIdSchema).max(64).optional(),
41
+ accounts: z.array(vmUserAccountSchema).max(64).optional(),
42
+ groups: z.array(vmGroupSchema).max(128).optional(),
43
+ })
44
+ .strict();
5
45
  const functionSchema = z.custom((value) => typeof value === "function", { message: "Expected function" });
6
46
  const permissionModeSchema = z.enum(["allow", "deny"]);
7
47
  const fsPermissionRuleSchema = z
@@ -30,7 +70,10 @@ const patternRulePermissionsSchema = z
30
70
  rules: z.array(patternPermissionRuleSchema),
31
71
  })
32
72
  .strict();
33
- const fsPermissionsSchema = z.union([permissionModeSchema, fsRulePermissionsSchema]);
73
+ const fsPermissionsSchema = z.union([
74
+ permissionModeSchema,
75
+ fsRulePermissionsSchema,
76
+ ]);
34
77
  const patternPermissionsSchema = z.union([
35
78
  permissionModeSchema,
36
79
  patternRulePermissionsSchema,
@@ -76,16 +119,20 @@ export const agentOsLimitsSchema = z
76
119
  .object({ maxFetchResponseBytes: positiveInteger.optional() })
77
120
  .strict()
78
121
  .optional(),
79
- tools: z
122
+ tls: z
123
+ .object({ maxBufferedBytes: positiveInteger.optional() })
124
+ .strict()
125
+ .optional(),
126
+ bindings: z
80
127
  .object({
81
- defaultToolTimeoutMs: nonNegativeInteger.optional(),
82
- maxToolTimeoutMs: nonNegativeInteger.optional(),
83
- maxRegisteredToolkits: positiveInteger.optional(),
84
- maxRegisteredToolsPerVm: positiveInteger.optional(),
85
- maxToolsPerToolkit: positiveInteger.optional(),
86
- maxToolSchemaBytes: positiveInteger.optional(),
87
- maxToolExamplesPerTool: nonNegativeInteger.optional(),
88
- maxToolExampleInputBytes: positiveInteger.optional(),
128
+ defaultBindingTimeoutMs: nonNegativeInteger.optional(),
129
+ maxBindingTimeoutMs: nonNegativeInteger.optional(),
130
+ maxRegisteredCollections: positiveInteger.optional(),
131
+ maxRegisteredBindingsPerVm: positiveInteger.optional(),
132
+ maxBindingsPerCollection: positiveInteger.optional(),
133
+ maxBindingSchemaBytes: positiveInteger.optional(),
134
+ maxExamplesPerBinding: nonNegativeInteger.optional(),
135
+ maxBindingExampleInputBytes: positiveInteger.optional(),
89
136
  })
90
137
  .strict()
91
138
  .optional(),
@@ -100,9 +147,29 @@ export const agentOsLimitsSchema = z
100
147
  .object({
101
148
  maxReadLineBytes: positiveInteger.optional(),
102
149
  stdoutBufferByteLimit: positiveInteger.optional(),
150
+ maxCompletedMessageBytes: positiveInteger.optional(),
151
+ maxTurnOutputBytes: positiveInteger.optional(),
152
+ maxPromptBytes: positiveInteger.optional(),
153
+ maxPromptBlocks: positiveInteger.optional(),
154
+ maxFallbackContinuationBytes: positiveInteger.optional(),
155
+ maxSessionHistoryBytes: positiveInteger.optional(),
156
+ maxSessionHistoryEvents: positiveInteger.optional(),
157
+ maxHistoryPageEntries: positiveInteger.optional(),
158
+ maxSessionListEntries: positiveInteger.optional(),
159
+ maxSessionsPerVm: positiveInteger.optional(),
160
+ maxPromptsPerSession: positiveInteger.optional(),
161
+ maxPromptsPerVm: positiveInteger.optional(),
162
+ maxPendingPermissionsPerSession: positiveInteger.optional(),
163
+ maxPendingPermissionsPerVm: positiveInteger.optional(),
164
+ maxPermissionOutcomesPerSession: positiveInteger.optional(),
165
+ maxPermissionOutcomesPerVm: positiveInteger.optional(),
103
166
  })
104
167
  .strict()
105
168
  .optional(),
169
+ sqlite: z
170
+ .object({ maxResultBytes: positiveInteger.optional() })
171
+ .strict()
172
+ .optional(),
106
173
  jsRuntime: z
107
174
  .object({
108
175
  v8HeapLimitMb: positiveInteger.optional(),
@@ -133,6 +200,25 @@ export const agentOsLimitsSchema = z
133
200
  syncReadLimitBytes: positiveInteger.optional(),
134
201
  prewarmTimeoutMs: positiveInteger.optional(),
135
202
  runnerHeapLimitMb: positiveInteger.optional(),
203
+ runnerCpuTimeLimitMs: nonNegativeInteger.optional(),
204
+ })
205
+ .strict()
206
+ .optional(),
207
+ execution: z
208
+ .object({
209
+ completedTtlMs: positiveInteger.optional(),
210
+ maxCompletedExecutions: positiveInteger.optional(),
211
+ liveExecutionWarningThreshold: positiveInteger.optional(),
212
+ })
213
+ .strict()
214
+ .optional(),
215
+ process: z
216
+ .object({
217
+ maxSpawnFileActions: positiveInteger.optional(),
218
+ maxSpawnFileActionBytes: positiveInteger.optional(),
219
+ pendingStdinBytes: positiveInteger.optional(),
220
+ pendingEventCount: positiveInteger.optional(),
221
+ pendingEventBytes: positiveInteger.optional(),
136
222
  })
137
223
  .strict()
138
224
  .optional(),
@@ -140,9 +226,11 @@ export const agentOsLimitsSchema = z
140
226
  .strict();
141
227
  const rootLowerInputSchema = z.union([
142
228
  z.object({ kind: z.literal("bundled-base-filesystem") }).strict(),
143
- z.object({ kind: z.literal("snapshot-export"), source: z.unknown() }).strict(),
229
+ z
230
+ .object({ kind: z.literal("snapshot-export"), source: z.unknown() })
231
+ .strict(),
144
232
  ]);
145
- export const rootFilesystemConfigSchema = z
233
+ const overlayRootFilesystemConfigSchema = z
146
234
  .object({
147
235
  type: z.literal("overlay").optional(),
148
236
  mode: z.enum(["ephemeral", "read-only"]).optional(),
@@ -156,12 +244,25 @@ const nativeMountPluginSchema = z
156
244
  config: z.unknown().optional(),
157
245
  })
158
246
  .strict();
247
+ const nativeRootFilesystemConfigSchema = z
248
+ .object({
249
+ type: z.literal("native"),
250
+ plugin: nativeMountPluginSchema,
251
+ readOnly: z.boolean().optional(),
252
+ })
253
+ .strict();
254
+ export const rootFilesystemConfigSchema = z.union([
255
+ overlayRootFilesystemConfigSchema,
256
+ nativeRootFilesystemConfigSchema,
257
+ ]);
159
258
  const plainMountConfigSchema = z
160
259
  .object({
161
260
  path: z.string(),
162
261
  driver: z.custom((value) => typeof value === "object" && value !== null, {
163
262
  message: "Expected filesystem driver object",
164
263
  }),
264
+ guestFstype: z.string().min(1).optional(),
265
+ guestSource: z.string().min(1).optional(),
165
266
  readOnly: z.boolean().optional(),
166
267
  })
167
268
  .strict();
@@ -169,6 +270,8 @@ export const nativeMountConfigSchema = z
169
270
  .object({
170
271
  path: z.string(),
171
272
  plugin: nativeMountPluginSchema,
273
+ guestFstype: z.string().min(1).optional(),
274
+ guestSource: z.string().min(1).optional(),
172
275
  readOnly: z.boolean().optional(),
173
276
  })
174
277
  .strict();
@@ -206,59 +309,89 @@ export const sidecarConfigSchema = z.union([
206
309
  sharedSidecarConfigSchema,
207
310
  explicitSidecarSchema,
208
311
  ]);
209
- const toolExampleSchema = z
312
+ const bindingExampleSchema = z
210
313
  .object({
211
314
  description: z.string(),
212
315
  input: z.unknown(),
213
316
  })
214
317
  .strict();
215
- export const hostToolSchema = z
318
+ export const bindingSchema = z
216
319
  .object({
217
320
  description: z.string(),
218
321
  inputSchema: z.custom((value) => typeof value === "object" && value !== null, {
219
322
  message: "Expected Zod schema object",
220
323
  }),
221
324
  execute: functionSchema,
222
- examples: z.array(toolExampleSchema).optional(),
325
+ examples: z.array(bindingExampleSchema).optional(),
223
326
  timeout: nonNegativeInteger.optional(),
224
327
  })
225
328
  .strict();
226
- export const toolKitSchema = z
329
+ export const bindingsSchema = z
227
330
  .object({
228
331
  name: z.string(),
229
332
  description: z.string(),
230
- tools: z.record(z.string(), hostToolSchema),
333
+ bindings: z.record(z.string(), bindingSchema),
231
334
  })
232
335
  .strict();
233
336
  /**
234
337
  * Shared AgentOsOptions field schemas.
235
338
  *
236
- * Core uses the full object. The Rivet/native actor composes a narrower
237
- * native-safe subset in `packages/agentos/src/config.ts`; keep that subset and
238
- * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson` aligned when
239
- * adding options that cross the native boundary.
339
+ * Core and the TypeScript Rivet actor both use the full object. Runtime-owned
340
+ * behavior is serialized by AgentOs.create() into the sidecar VM config.
240
341
  */
241
342
  export const agentOsOptionFieldSchemas = {
343
+ user: vmUserConfigSchema.optional(),
242
344
  software: z.array(z.unknown()).optional(),
243
345
  defaultSoftware: z.boolean().optional(),
244
346
  loopbackExemptPorts: z.array(z.number().int().min(0).max(65535)).optional(),
245
347
  allowedNodeBuiltins: stringArray.optional(),
246
348
  highResolutionTime: z.boolean().optional(),
349
+ database: z
350
+ .discriminatedUnion("type", [
351
+ z
352
+ .object({
353
+ type: z.literal("actor_uds"),
354
+ path: z.string().min(1),
355
+ })
356
+ .strict(),
357
+ z
358
+ .object({
359
+ type: z.literal("sqlite_file"),
360
+ path: z.string().min(1),
361
+ })
362
+ .strict(),
363
+ ])
364
+ .optional(),
247
365
  rootFilesystem: rootFilesystemConfigSchema.optional(),
248
366
  mounts: z.array(mountConfigSchema).optional(),
249
- additionalInstructions: z.string().optional(),
367
+ sandbox: z
368
+ .custom((value) => value === undefined ||
369
+ (typeof value === "object" && value !== null && !Array.isArray(value)), { message: "Expected sandbox options object" })
370
+ .optional(),
250
371
  scheduleDriver: z
251
372
  .custom((value) => typeof value === "object" && value !== null, {
252
373
  message: "Expected schedule driver object",
253
374
  })
254
375
  .optional(),
255
- toolKits: z.array(toolKitSchema).optional(),
376
+ bindings: z.array(bindingsSchema).optional(),
256
377
  permissions: permissionsSchema.optional(),
257
378
  sidecar: sidecarConfigSchema.optional(),
258
379
  limits: agentOsLimitsSchema.optional(),
259
- onAgentStderr: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
260
- onAgentExit: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
261
- onLimitWarning: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
380
+ onAgentStderr: z
381
+ .custom((value) => typeof value === "function", {
382
+ message: "Expected function",
383
+ })
384
+ .optional(),
385
+ onAgentExit: z
386
+ .custom((value) => typeof value === "function", {
387
+ message: "Expected function",
388
+ })
389
+ .optional(),
390
+ onLimitWarning: z
391
+ .custom((value) => typeof value === "function", {
392
+ message: "Expected function",
393
+ })
394
+ .optional(),
262
395
  };
263
396
  export const agentOsOptionsSchema = z
264
397
  .object(agentOsOptionFieldSchemas)
@@ -1,7 +1,7 @@
1
1
  import type { SoftwarePackageRef } from "./agentos-package.js";
2
2
  /**
3
3
  * Input type for the `software` option. Software is a self-contained package
4
- * directory that the secure-exec sidecar materializes into the `/opt/agentos`
4
+ * directory that the agentos sidecar materializes into the `/opt/agentos`
5
5
  * projection. Accepts a package-dir ref or an array of refs for meta-packages.
6
6
  */
7
7
  export type SoftwareEntry = SoftwarePackageRef;
@@ -54,7 +54,9 @@ export interface VirtualFileSystem {
54
54
  lstat(path: string): Promise<VirtualStat>;
55
55
  link(oldPath: string, newPath: string): Promise<void>;
56
56
  chmod(path: string, mode: number): Promise<void>;
57
- chown(path: string, uid: number, gid: number): Promise<void>;
57
+ chown(path: string, uid: number, gid: number, options?: {
58
+ followSymlinks?: boolean;
59
+ }): Promise<void>;
58
60
  utimes(path: string, atime: number, mtime: number): Promise<void>;
59
61
  truncate(path: string, length: number): Promise<void>;
60
62
  pread(path: string, offset: number, length: number): Promise<Uint8Array>;
@@ -111,6 +113,7 @@ export interface ManagedProcess {
111
113
  export interface ShellHandle {
112
114
  pid: number;
113
115
  write(data: Uint8Array | string): Promise<void>;
116
+ /** Ordered PTY output containing stdout and stderr exactly once. */
114
117
  onData: ((data: Uint8Array) => void) | null;
115
118
  resize(cols: number, rows: number): void;
116
119
  kill(signal?: number): void;
@@ -123,6 +126,7 @@ export interface OpenShellOptions {
123
126
  cwd?: string;
124
127
  cols?: number;
125
128
  rows?: number;
129
+ /** Optional stderr-only diagnostic tap; do not render it alongside `onData`. */
126
130
  onStderr?: (data: Uint8Array) => void;
127
131
  }
128
132
  export interface ConnectTerminalOptions extends OpenShellOptions {
@@ -361,40 +365,6 @@ export declare class KernelError extends Error {
361
365
  readonly code: string;
362
366
  constructor(code: string, message: string);
363
367
  }
364
- export declare class InMemoryFileSystem implements VirtualFileSystem {
365
- private readonly entries;
366
- constructor();
367
- readFile(targetPath: string): Promise<Uint8Array>;
368
- readTextFile(targetPath: string): Promise<string>;
369
- readDir(targetPath: string): Promise<string[]>;
370
- readDirWithTypes(targetPath: string): Promise<VirtualDirEntry[]>;
371
- writeFile(targetPath: string, content: string | Uint8Array): Promise<void>;
372
- createDir(targetPath: string): Promise<void>;
373
- mkdir(targetPath: string, options?: {
374
- recursive?: boolean;
375
- }): Promise<void>;
376
- exists(targetPath: string): Promise<boolean>;
377
- stat(targetPath: string): Promise<VirtualStat>;
378
- removeFile(targetPath: string): Promise<void>;
379
- removeDir(targetPath: string): Promise<void>;
380
- rename(oldPath: string, newPath: string): Promise<void>;
381
- realpath(targetPath: string): Promise<string>;
382
- symlink(target: string, linkPath: string): Promise<void>;
383
- readlink(targetPath: string): Promise<string>;
384
- lstat(targetPath: string): Promise<VirtualStat>;
385
- link(oldPath: string, newPath: string): Promise<void>;
386
- chmod(targetPath: string, mode: number): Promise<void>;
387
- chown(targetPath: string, uid: number, gid: number): Promise<void>;
388
- utimes(targetPath: string, atime: number, mtime: number): Promise<void>;
389
- truncate(targetPath: string, length: number): Promise<void>;
390
- pread(targetPath: string, offset: number, length: number): Promise<Uint8Array>;
391
- pwrite(targetPath: string, offset: number, data: Uint8Array): Promise<void>;
392
- private resolvePath;
393
- private resolveEntry;
394
- private newDirectory;
395
- private toStat;
396
- }
397
- export declare function createInMemoryFileSystem(): InMemoryFileSystem;
398
368
  export declare class NodeFileSystem implements VirtualFileSystem {
399
369
  readonly rootPath: string;
400
370
  constructor(options: {
@@ -488,4 +458,5 @@ export declare function createKernel(options: {
488
458
  readOnly?: boolean;
489
459
  }>;
490
460
  syncFilesystemOnDispose?: boolean;
461
+ maxFilesystemBytes?: number;
491
462
  }): Kernel;