@rivet-dev/agentos-core 0.2.8-rc.2 → 0.2.8-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/README.md +40 -37
- package/dist/agent-os.d.ts +184 -230
- package/dist/agent-os.js +751 -1158
- package/dist/agentos-package.d.ts +5 -3
- package/dist/agentos-package.js +5 -2
- package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
- package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
- package/dist/bindings.d.ts +43 -0
- package/dist/bindings.js +34 -0
- package/dist/cron/cron-manager.js +43 -10
- package/dist/cron/index.d.ts +1 -1
- package/dist/cron/types.d.ts +25 -9
- package/dist/filesystem-snapshot.d.ts +1 -2
- package/dist/filesystem-snapshot.js +0 -43
- package/dist/generated/AcpLimitsConfig.d.ts +16 -0
- package/dist/generated/BindingLimitsConfig.d.ts +10 -0
- package/dist/generated/CreateVmConfig.d.ts +2 -0
- package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
- package/dist/generated/ProcessLimitsConfig.js +2 -0
- package/dist/generated/VmGroupConfig.d.ts +5 -0
- package/dist/generated/VmGroupConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +4 -2
- package/dist/generated/VmUserAccountConfig.d.ts +9 -0
- package/dist/generated/VmUserAccountConfig.js +2 -0
- package/dist/generated/VmUserConfig.d.ts +19 -0
- package/dist/generated/WasmLimitsConfig.d.ts +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.js +4 -5
- package/dist/layers.d.ts +5 -2
- package/dist/layers.js +0 -185
- package/dist/options-schema.d.ts +133 -31
- package/dist/options-schema.js +143 -26
- package/dist/runtime-compat.d.ts +4 -35
- package/dist/runtime-compat.js +84 -372
- package/dist/runtime.d.ts +3 -1
- package/dist/sandbox.d.ts +4 -4
- package/dist/sandbox.js +4 -4
- package/dist/session-api.d.ts +180 -0
- package/dist/session-api.js +1 -0
- package/dist/sidecar/agentos-protocol.d.ts +429 -29
- package/dist/sidecar/agentos-protocol.js +691 -93
- package/dist/sidecar/rpc-client.d.ts +18 -6
- package/dist/sidecar/rpc-client.js +66 -18
- package/dist/test/runtime.d.ts +2 -1
- package/dist/test/runtime.js +2 -1
- package/dist/types.d.ts +4 -5
- package/package.json +28 -27
- package/dist/agent-session-types.d.ts +0 -67
- package/dist/generated/ToolLimitsConfig.d.ts +0 -10
- package/dist/host-tools.d.ts +0 -45
- package/dist/host-tools.js +0 -35
- package/dist/overlay-filesystem.d.ts +0 -19
- package/dist/overlay-filesystem.js +0 -645
- /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
- /package/dist/{agent-session-types.js → generated/VmUserConfig.js} +0 -0
package/dist/options-schema.js
CHANGED
|
@@ -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([
|
|
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,16 @@ export const agentOsLimitsSchema = z
|
|
|
76
119
|
.object({ maxFetchResponseBytes: positiveInteger.optional() })
|
|
77
120
|
.strict()
|
|
78
121
|
.optional(),
|
|
79
|
-
|
|
122
|
+
bindings: z
|
|
80
123
|
.object({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
124
|
+
defaultBindingTimeoutMs: nonNegativeInteger.optional(),
|
|
125
|
+
maxBindingTimeoutMs: nonNegativeInteger.optional(),
|
|
126
|
+
maxRegisteredCollections: positiveInteger.optional(),
|
|
127
|
+
maxRegisteredCollectionsPerVm: positiveInteger.optional(),
|
|
128
|
+
maxBindingsPerCollection: positiveInteger.optional(),
|
|
129
|
+
maxBindingSchemaBytes: positiveInteger.optional(),
|
|
130
|
+
maxExamplesPerBinding: nonNegativeInteger.optional(),
|
|
131
|
+
maxBindingExampleInputBytes: positiveInteger.optional(),
|
|
89
132
|
})
|
|
90
133
|
.strict()
|
|
91
134
|
.optional(),
|
|
@@ -100,9 +143,29 @@ export const agentOsLimitsSchema = z
|
|
|
100
143
|
.object({
|
|
101
144
|
maxReadLineBytes: positiveInteger.optional(),
|
|
102
145
|
stdoutBufferByteLimit: positiveInteger.optional(),
|
|
146
|
+
maxCompletedMessageBytes: positiveInteger.optional(),
|
|
147
|
+
maxTurnOutputBytes: positiveInteger.optional(),
|
|
148
|
+
maxPromptBytes: positiveInteger.optional(),
|
|
149
|
+
maxPromptBlocks: positiveInteger.optional(),
|
|
150
|
+
maxFallbackContinuationBytes: positiveInteger.optional(),
|
|
151
|
+
maxSessionHistoryBytes: positiveInteger.optional(),
|
|
152
|
+
maxSessionHistoryEvents: positiveInteger.optional(),
|
|
153
|
+
maxHistoryPageEntries: positiveInteger.optional(),
|
|
154
|
+
maxSessionListEntries: positiveInteger.optional(),
|
|
155
|
+
maxSessionsPerVm: positiveInteger.optional(),
|
|
156
|
+
maxPromptsPerSession: positiveInteger.optional(),
|
|
157
|
+
maxPromptsPerVm: positiveInteger.optional(),
|
|
158
|
+
maxPendingPermissionsPerSession: positiveInteger.optional(),
|
|
159
|
+
maxPendingPermissionsPerVm: positiveInteger.optional(),
|
|
160
|
+
maxPermissionOutcomesPerSession: positiveInteger.optional(),
|
|
161
|
+
maxPermissionOutcomesPerVm: positiveInteger.optional(),
|
|
103
162
|
})
|
|
104
163
|
.strict()
|
|
105
164
|
.optional(),
|
|
165
|
+
sqlite: z
|
|
166
|
+
.object({ maxResultBytes: positiveInteger.optional() })
|
|
167
|
+
.strict()
|
|
168
|
+
.optional(),
|
|
106
169
|
jsRuntime: z
|
|
107
170
|
.object({
|
|
108
171
|
v8HeapLimitMb: positiveInteger.optional(),
|
|
@@ -133,6 +196,17 @@ export const agentOsLimitsSchema = z
|
|
|
133
196
|
syncReadLimitBytes: positiveInteger.optional(),
|
|
134
197
|
prewarmTimeoutMs: positiveInteger.optional(),
|
|
135
198
|
runnerHeapLimitMb: positiveInteger.optional(),
|
|
199
|
+
runnerCpuTimeLimitMs: nonNegativeInteger.optional(),
|
|
200
|
+
})
|
|
201
|
+
.strict()
|
|
202
|
+
.optional(),
|
|
203
|
+
process: z
|
|
204
|
+
.object({
|
|
205
|
+
maxSpawnFileActions: positiveInteger.optional(),
|
|
206
|
+
maxSpawnFileActionBytes: positiveInteger.optional(),
|
|
207
|
+
pendingStdinBytes: positiveInteger.optional(),
|
|
208
|
+
pendingEventCount: positiveInteger.optional(),
|
|
209
|
+
pendingEventBytes: positiveInteger.optional(),
|
|
136
210
|
})
|
|
137
211
|
.strict()
|
|
138
212
|
.optional(),
|
|
@@ -140,9 +214,11 @@ export const agentOsLimitsSchema = z
|
|
|
140
214
|
.strict();
|
|
141
215
|
const rootLowerInputSchema = z.union([
|
|
142
216
|
z.object({ kind: z.literal("bundled-base-filesystem") }).strict(),
|
|
143
|
-
z
|
|
217
|
+
z
|
|
218
|
+
.object({ kind: z.literal("snapshot-export"), source: z.unknown() })
|
|
219
|
+
.strict(),
|
|
144
220
|
]);
|
|
145
|
-
|
|
221
|
+
const overlayRootFilesystemConfigSchema = z
|
|
146
222
|
.object({
|
|
147
223
|
type: z.literal("overlay").optional(),
|
|
148
224
|
mode: z.enum(["ephemeral", "read-only"]).optional(),
|
|
@@ -156,12 +232,25 @@ const nativeMountPluginSchema = z
|
|
|
156
232
|
config: z.unknown().optional(),
|
|
157
233
|
})
|
|
158
234
|
.strict();
|
|
235
|
+
const nativeRootFilesystemConfigSchema = z
|
|
236
|
+
.object({
|
|
237
|
+
type: z.literal("native"),
|
|
238
|
+
plugin: nativeMountPluginSchema,
|
|
239
|
+
readOnly: z.boolean().optional(),
|
|
240
|
+
})
|
|
241
|
+
.strict();
|
|
242
|
+
export const rootFilesystemConfigSchema = z.union([
|
|
243
|
+
overlayRootFilesystemConfigSchema,
|
|
244
|
+
nativeRootFilesystemConfigSchema,
|
|
245
|
+
]);
|
|
159
246
|
const plainMountConfigSchema = z
|
|
160
247
|
.object({
|
|
161
248
|
path: z.string(),
|
|
162
249
|
driver: z.custom((value) => typeof value === "object" && value !== null, {
|
|
163
250
|
message: "Expected filesystem driver object",
|
|
164
251
|
}),
|
|
252
|
+
guestFstype: z.string().min(1).optional(),
|
|
253
|
+
guestSource: z.string().min(1).optional(),
|
|
165
254
|
readOnly: z.boolean().optional(),
|
|
166
255
|
})
|
|
167
256
|
.strict();
|
|
@@ -169,6 +258,8 @@ export const nativeMountConfigSchema = z
|
|
|
169
258
|
.object({
|
|
170
259
|
path: z.string(),
|
|
171
260
|
plugin: nativeMountPluginSchema,
|
|
261
|
+
guestFstype: z.string().min(1).optional(),
|
|
262
|
+
guestSource: z.string().min(1).optional(),
|
|
172
263
|
readOnly: z.boolean().optional(),
|
|
173
264
|
})
|
|
174
265
|
.strict();
|
|
@@ -206,59 +297,85 @@ export const sidecarConfigSchema = z.union([
|
|
|
206
297
|
sharedSidecarConfigSchema,
|
|
207
298
|
explicitSidecarSchema,
|
|
208
299
|
]);
|
|
209
|
-
const
|
|
300
|
+
const bindingExampleSchema = z
|
|
210
301
|
.object({
|
|
211
302
|
description: z.string(),
|
|
212
303
|
input: z.unknown(),
|
|
213
304
|
})
|
|
214
305
|
.strict();
|
|
215
|
-
export const
|
|
306
|
+
export const bindingSchema = z
|
|
216
307
|
.object({
|
|
217
308
|
description: z.string(),
|
|
218
309
|
inputSchema: z.custom((value) => typeof value === "object" && value !== null, {
|
|
219
310
|
message: "Expected Zod schema object",
|
|
220
311
|
}),
|
|
221
312
|
execute: functionSchema,
|
|
222
|
-
examples: z.array(
|
|
313
|
+
examples: z.array(bindingExampleSchema).optional(),
|
|
223
314
|
timeout: nonNegativeInteger.optional(),
|
|
224
315
|
})
|
|
225
316
|
.strict();
|
|
226
|
-
export const
|
|
317
|
+
export const bindingsSchema = z
|
|
227
318
|
.object({
|
|
228
319
|
name: z.string(),
|
|
229
320
|
description: z.string(),
|
|
230
|
-
|
|
321
|
+
bindings: z.record(z.string(), bindingSchema),
|
|
231
322
|
})
|
|
232
323
|
.strict();
|
|
233
324
|
/**
|
|
234
325
|
* Shared AgentOsOptions field schemas.
|
|
235
326
|
*
|
|
236
|
-
* Core
|
|
237
|
-
*
|
|
238
|
-
* `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson` aligned when
|
|
239
|
-
* adding options that cross the native boundary.
|
|
327
|
+
* Core and the TypeScript Rivet actor both use the full object. Runtime-owned
|
|
328
|
+
* behavior is serialized by AgentOs.create() into the sidecar VM config.
|
|
240
329
|
*/
|
|
241
330
|
export const agentOsOptionFieldSchemas = {
|
|
331
|
+
user: vmUserConfigSchema.optional(),
|
|
242
332
|
software: z.array(z.unknown()).optional(),
|
|
243
333
|
defaultSoftware: z.boolean().optional(),
|
|
244
334
|
loopbackExemptPorts: z.array(z.number().int().min(0).max(65535)).optional(),
|
|
245
335
|
allowedNodeBuiltins: stringArray.optional(),
|
|
246
336
|
highResolutionTime: z.boolean().optional(),
|
|
337
|
+
database: z
|
|
338
|
+
.discriminatedUnion("type", [
|
|
339
|
+
z
|
|
340
|
+
.object({
|
|
341
|
+
type: z.literal("actor_uds"),
|
|
342
|
+
path: z.string().min(1),
|
|
343
|
+
})
|
|
344
|
+
.strict(),
|
|
345
|
+
z
|
|
346
|
+
.object({
|
|
347
|
+
type: z.literal("sqlite_file"),
|
|
348
|
+
path: z.string().min(1),
|
|
349
|
+
})
|
|
350
|
+
.strict(),
|
|
351
|
+
])
|
|
352
|
+
.optional(),
|
|
247
353
|
rootFilesystem: rootFilesystemConfigSchema.optional(),
|
|
248
354
|
mounts: z.array(mountConfigSchema).optional(),
|
|
249
|
-
additionalInstructions: z.string().optional(),
|
|
250
355
|
scheduleDriver: z
|
|
251
356
|
.custom((value) => typeof value === "object" && value !== null, {
|
|
252
357
|
message: "Expected schedule driver object",
|
|
253
358
|
})
|
|
254
359
|
.optional(),
|
|
255
|
-
|
|
360
|
+
bindings: z.array(bindingsSchema).optional(),
|
|
256
361
|
permissions: permissionsSchema.optional(),
|
|
257
362
|
sidecar: sidecarConfigSchema.optional(),
|
|
258
363
|
limits: agentOsLimitsSchema.optional(),
|
|
259
|
-
onAgentStderr: z
|
|
260
|
-
|
|
261
|
-
|
|
364
|
+
onAgentStderr: z
|
|
365
|
+
.custom((value) => typeof value === "function", {
|
|
366
|
+
message: "Expected function",
|
|
367
|
+
})
|
|
368
|
+
.optional(),
|
|
369
|
+
onAgentExit: z
|
|
370
|
+
.custom((value) => typeof value === "function", {
|
|
371
|
+
message: "Expected function",
|
|
372
|
+
})
|
|
373
|
+
.optional(),
|
|
374
|
+
onLimitWarning: z
|
|
375
|
+
.custom((value) => typeof value === "function", {
|
|
376
|
+
message: "Expected function",
|
|
377
|
+
})
|
|
378
|
+
.optional(),
|
|
262
379
|
};
|
|
263
380
|
export const agentOsOptionsSchema = z
|
|
264
381
|
.object(agentOsOptionFieldSchemas)
|
package/dist/runtime-compat.d.ts
CHANGED
|
@@ -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
|
|
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>;
|
|
@@ -363,40 +365,6 @@ export declare class KernelError extends Error {
|
|
|
363
365
|
readonly code: string;
|
|
364
366
|
constructor(code: string, message: string);
|
|
365
367
|
}
|
|
366
|
-
export declare class InMemoryFileSystem implements VirtualFileSystem {
|
|
367
|
-
private readonly entries;
|
|
368
|
-
constructor();
|
|
369
|
-
readFile(targetPath: string): Promise<Uint8Array>;
|
|
370
|
-
readTextFile(targetPath: string): Promise<string>;
|
|
371
|
-
readDir(targetPath: string): Promise<string[]>;
|
|
372
|
-
readDirWithTypes(targetPath: string): Promise<VirtualDirEntry[]>;
|
|
373
|
-
writeFile(targetPath: string, content: string | Uint8Array): Promise<void>;
|
|
374
|
-
createDir(targetPath: string): Promise<void>;
|
|
375
|
-
mkdir(targetPath: string, options?: {
|
|
376
|
-
recursive?: boolean;
|
|
377
|
-
}): Promise<void>;
|
|
378
|
-
exists(targetPath: string): Promise<boolean>;
|
|
379
|
-
stat(targetPath: string): Promise<VirtualStat>;
|
|
380
|
-
removeFile(targetPath: string): Promise<void>;
|
|
381
|
-
removeDir(targetPath: string): Promise<void>;
|
|
382
|
-
rename(oldPath: string, newPath: string): Promise<void>;
|
|
383
|
-
realpath(targetPath: string): Promise<string>;
|
|
384
|
-
symlink(target: string, linkPath: string): Promise<void>;
|
|
385
|
-
readlink(targetPath: string): Promise<string>;
|
|
386
|
-
lstat(targetPath: string): Promise<VirtualStat>;
|
|
387
|
-
link(oldPath: string, newPath: string): Promise<void>;
|
|
388
|
-
chmod(targetPath: string, mode: number): Promise<void>;
|
|
389
|
-
chown(targetPath: string, uid: number, gid: number): Promise<void>;
|
|
390
|
-
utimes(targetPath: string, atime: number, mtime: number): Promise<void>;
|
|
391
|
-
truncate(targetPath: string, length: number): Promise<void>;
|
|
392
|
-
pread(targetPath: string, offset: number, length: number): Promise<Uint8Array>;
|
|
393
|
-
pwrite(targetPath: string, offset: number, data: Uint8Array): Promise<void>;
|
|
394
|
-
private resolvePath;
|
|
395
|
-
private resolveEntry;
|
|
396
|
-
private newDirectory;
|
|
397
|
-
private toStat;
|
|
398
|
-
}
|
|
399
|
-
export declare function createInMemoryFileSystem(): InMemoryFileSystem;
|
|
400
368
|
export declare class NodeFileSystem implements VirtualFileSystem {
|
|
401
369
|
readonly rootPath: string;
|
|
402
370
|
constructor(options: {
|
|
@@ -490,4 +458,5 @@ export declare function createKernel(options: {
|
|
|
490
458
|
readOnly?: boolean;
|
|
491
459
|
}>;
|
|
492
460
|
syncFilesystemOnDispose?: boolean;
|
|
461
|
+
maxFilesystemBytes?: number;
|
|
493
462
|
}): Kernel;
|