@rivet-dev/agentos-core 0.2.20 → 0.2.22

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.
@@ -0,0 +1,10 @@
1
+ export type HostFunctionLimitsConfig = {
2
+ defaultTimeoutMs?: number;
3
+ maxTimeoutMs?: number;
4
+ maxRegisteredCollections?: number;
5
+ maxRegisteredFunctionsPerVm?: number;
6
+ maxFunctionsPerCollection?: number;
7
+ maxSchemaBytes?: number;
8
+ maxExamplesPerFunction?: number;
9
+ maxExampleInputBytes?: number;
10
+ };
@@ -6,5 +6,5 @@ export type PermissionsPolicy = {
6
6
  childProcess?: PatternPermissionScope;
7
7
  process?: PatternPermissionScope;
8
8
  env?: PatternPermissionScope;
9
- binding?: PatternPermissionScope;
9
+ hostFunction?: PatternPermissionScope;
10
10
  };
@@ -1,5 +1,5 @@
1
1
  import type { AcpLimitsConfig } from "./AcpLimitsConfig.js";
2
- import type { BindingLimitsConfig } from "./BindingLimitsConfig.js";
2
+ import type { HostFunctionLimitsConfig } from "./HostFunctionLimitsConfig.js";
3
3
  import type { HttpLimitsConfig } from "./HttpLimitsConfig.js";
4
4
  import type { JsRuntimeLimitsConfig } from "./JsRuntimeLimitsConfig.js";
5
5
  import type { PluginLimitsConfig } from "./PluginLimitsConfig.js";
@@ -10,7 +10,7 @@ import type { WasmLimitsConfig } from "./WasmLimitsConfig.js";
10
10
  export type VmLimitsConfig = {
11
11
  resources?: ResourceLimitsConfig;
12
12
  http?: HttpLimitsConfig;
13
- bindings?: BindingLimitsConfig;
13
+ hostFunctions?: HostFunctionLimitsConfig;
14
14
  plugins?: PluginLimitsConfig;
15
15
  acp?: AcpLimitsConfig;
16
16
  jsRuntime?: JsRuntimeLimitsConfig;
@@ -17,11 +17,19 @@ export interface HostDirMountPluginConfig extends MountConfigJsonObject {
17
17
  */
18
18
  export declare function createHostDirBackend(options: HostDirBackendOptions): NativeMountPluginDescriptor<HostDirMountPluginConfig>;
19
19
  /** A native `host_dir` mount, the serializable form `AgentOsOptions.mounts` accepts. */
20
- export interface NodeModulesMountConfig {
20
+ export interface HostDirMountConfig {
21
21
  path: string;
22
22
  plugin: NativeMountPluginDescriptor<HostDirMountPluginConfig>;
23
23
  readOnly: boolean;
24
24
  }
25
+ export type NodeModulesMountConfig = HostDirMountConfig;
26
+ /**
27
+ * Mount a host directory into the VM at `path`. Read-only unless `readOnly` is
28
+ * `false`. The guest sees only the mounted subtree, never the rest of the host.
29
+ */
30
+ export declare function hostDirMount(path: string, hostPath: string, opts?: {
31
+ readOnly?: boolean;
32
+ }): HostDirMountConfig;
25
33
  /**
26
34
  * Mount a host `node_modules` directory into the VM at `/root/node_modules`.
27
35
  *
@@ -13,6 +13,18 @@ export function createHostDirBackend(options) {
13
13
  },
14
14
  };
15
15
  }
16
+ /**
17
+ * Mount a host directory into the VM at `path`. Read-only unless `readOnly` is
18
+ * `false`. The guest sees only the mounted subtree, never the rest of the host.
19
+ */
20
+ export function hostDirMount(path, hostPath, opts) {
21
+ const readOnly = opts?.readOnly ?? true;
22
+ return {
23
+ path,
24
+ plugin: createHostDirBackend({ hostPath, readOnly }),
25
+ readOnly,
26
+ };
27
+ }
16
28
  /**
17
29
  * Mount a host `node_modules` directory into the VM at `/root/node_modules`.
18
30
  *
@@ -25,10 +37,5 @@ export function createHostDirBackend(options) {
25
37
  * @param opts.readOnly Defaults to `true`; the mount is read-only.
26
38
  */
27
39
  export function nodeModulesMount(hostNodeModulesDir, opts) {
28
- const readOnly = opts?.readOnly ?? true;
29
- return {
30
- path: "/root/node_modules",
31
- plugin: createHostDirBackend({ hostPath: hostNodeModulesDir, readOnly }),
32
- readOnly,
33
- };
40
+ return hostDirMount("/root/node_modules", hostNodeModulesDir, opts);
34
41
  }
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
+ export { SidecarProcessError, SidecarProcessExited, SidecarRejectedError, type SidecarRejectionDetail, SidecarSilenceTimeout, } from "@rivet-dev/agentos-runtime-core/sidecar-errors";
1
2
  export { AgentOs, AgentOsSidecar } from "./agent-os.js";
2
- export type * from "./language-execution.js";
3
+ export { isPackageDescriptor, OPT_AGENTOS_BIN, OPT_AGENTOS_ROOT, tryReadAgentosPackageManifest, } from "./agentos-package.js";
3
4
  export { CronManager, InvalidScheduleError, PastScheduleError, TimerScheduleDriver, } from "./cron/index.js";
4
- export { createHostDirBackend, nodeModulesMount } from "./host-dir-mount.js";
5
- export { binding, MAX_BINDING_DESCRIPTION_LENGTH, bindings, validateBindings, } from "./bindings.js";
6
- export type { Binding, BindingExample, Bindings } from "./bindings.js";
7
- export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, bindingSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, bindingsSchema, sidecarRuntimeConfigSchema, } from "./options-schema.js";
5
+ export { createHostDirBackend, hostDirMount, nodeModulesMount, } from "./host-dir-mount.js";
6
+ export type { HostFunction, HostFunctionCollection, HostFunctionCollections, HostFunctionExample, HostFunctionSchemas, ResolvedHostFunctions, } from "@rivet-dev/agentos-runtime-core/host-functions";
7
+ export { hostFunctionCommandName, hostFunctionDescription, resolveHostFunctions, } from "@rivet-dev/agentos-runtime-core/host-functions";
8
+ export type * from "./language-execution.js";
8
9
  export { createSnapshotExport } from "./layers.js";
10
+ export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, hostFunctionCollectionSchema, hostFunctionSchema, hostFunctionsSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, sidecarRuntimeConfigSchema, } from "./options-schema.js";
9
11
  export { defineSoftware } from "./packages.js";
10
- export { isPackageDescriptor, OPT_AGENTOS_BIN, OPT_AGENTOS_ROOT, tryReadAgentosPackageManifest, } from "./agentos-package.js";
11
- export { KernelError } from "./runtime-compat.js";
12
12
  export type { ExecOptions, ExecResult, ManagedProcess, ProcessInfo, ShellHandle, VirtualDirEntry, VirtualStat, } from "./runtime.js";
13
- export { createSandboxBindings, createSandboxFs, getSandboxDisposeHooks, resolveSandboxOptions, } from "./sandbox.js";
13
+ export { KernelError } from "./runtime-compat.js";
14
+ export { createSandboxFs, createSandboxHostFunctions, getSandboxDisposeHooks, resolveSandboxOptions, } from "./sandbox.js";
14
15
  export type * from "./types.js";
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  // @rivet-dev/agentos
2
+ export { SidecarProcessError, SidecarProcessExited, SidecarRejectedError, SidecarSilenceTimeout, } from "@rivet-dev/agentos-runtime-core/sidecar-errors";
2
3
  export { AgentOs, AgentOsSidecar } from "./agent-os.js";
4
+ export { isPackageDescriptor, OPT_AGENTOS_BIN, OPT_AGENTOS_ROOT, tryReadAgentosPackageManifest, } from "./agentos-package.js";
3
5
  export { CronManager, InvalidScheduleError, PastScheduleError, TimerScheduleDriver, } from "./cron/index.js";
4
- export { createHostDirBackend, nodeModulesMount } from "./host-dir-mount.js";
5
- export { binding, MAX_BINDING_DESCRIPTION_LENGTH, bindings, validateBindings, } from "./bindings.js";
6
- export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, bindingSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, bindingsSchema, sidecarRuntimeConfigSchema, } from "./options-schema.js";
6
+ export { createHostDirBackend, hostDirMount, nodeModulesMount, } from "./host-dir-mount.js";
7
+ export { hostFunctionCommandName, hostFunctionDescription, resolveHostFunctions, } from "@rivet-dev/agentos-runtime-core/host-functions";
7
8
  export { createSnapshotExport } from "./layers.js";
9
+ export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, hostFunctionCollectionSchema, hostFunctionSchema, hostFunctionsSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, sidecarRuntimeConfigSchema, } from "./options-schema.js";
8
10
  export { defineSoftware } from "./packages.js";
9
- export { isPackageDescriptor, OPT_AGENTOS_BIN, OPT_AGENTOS_ROOT, tryReadAgentosPackageManifest, } from "./agentos-package.js";
10
11
  export { KernelError } from "./runtime-compat.js";
11
- export { createSandboxBindings, createSandboxFs, getSandboxDisposeHooks, resolveSandboxOptions, } from "./sandbox.js";
12
+ export { createSandboxFs, createSandboxHostFunctions, getSandboxDisposeHooks, resolveSandboxOptions, } from "./sandbox.js";
@@ -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 { Binding, Bindings } from "./bindings.js";
3
+ import type { HostFunction, HostFunctionCollection, HostFunctionCollections } from "@rivet-dev/agentos-runtime-core/host-functions";
4
4
  export declare const permissionsSchema: z.ZodObject<{
5
5
  fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
6
6
  allow: "allow";
@@ -87,7 +87,7 @@ export declare const permissionsSchema: z.ZodObject<{
87
87
  patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
88
  }, z.core.$strict>>;
89
89
  }, z.core.$strict>]>>;
90
- binding: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
90
+ hostFunction: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
91
91
  allow: "allow";
92
92
  deny: "deny";
93
93
  }>, z.ZodObject<{
@@ -134,15 +134,15 @@ export declare const agentOsLimitsSchema: z.ZodObject<{
134
134
  tls: z.ZodOptional<z.ZodObject<{
135
135
  maxBufferedBytes: z.ZodOptional<z.ZodNumber>;
136
136
  }, z.core.$strict>>;
137
- bindings: z.ZodOptional<z.ZodObject<{
138
- defaultBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
139
- maxBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
137
+ hostFunctions: z.ZodOptional<z.ZodObject<{
138
+ defaultTimeoutMs: z.ZodOptional<z.ZodNumber>;
139
+ maxTimeoutMs: z.ZodOptional<z.ZodNumber>;
140
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>;
141
+ maxRegisteredFunctionsPerVm: z.ZodOptional<z.ZodNumber>;
142
+ maxFunctionsPerCollection: z.ZodOptional<z.ZodNumber>;
143
+ maxSchemaBytes: z.ZodOptional<z.ZodNumber>;
144
+ maxExamplesPerFunction: z.ZodOptional<z.ZodNumber>;
145
+ maxExampleInputBytes: z.ZodOptional<z.ZodNumber>;
146
146
  }, z.core.$strict>>;
147
147
  plugins: z.ZodOptional<z.ZodObject<{
148
148
  maxPersistedManifestBytes: z.ZodOptional<z.ZodNumber>;
@@ -275,8 +275,9 @@ export declare const sidecarConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
275
275
  kind: z.ZodLiteral<"explicit">;
276
276
  handle: z.ZodUnknown;
277
277
  }, z.core.$strict>]>;
278
- export declare const bindingSchema: z.ZodType<Binding>;
279
- export declare const bindingsSchema: z.ZodType<Bindings>;
278
+ export declare const hostFunctionSchema: z.ZodType<HostFunction>;
279
+ export declare const hostFunctionCollectionSchema: z.ZodType<HostFunctionCollection>;
280
+ export declare const hostFunctionsSchema: z.ZodType<HostFunctionCollections>;
280
281
  /**
281
282
  * Shared AgentOsOptions field schemas.
282
283
  *
@@ -363,7 +364,7 @@ export declare const agentOsOptionFieldSchemas: {
363
364
  }, z.core.$strict>]>>>;
364
365
  readonly sandbox: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
365
366
  readonly scheduleDriver: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
366
- readonly bindings: z.ZodOptional<z.ZodArray<z.ZodType<Bindings, unknown, z.core.$ZodTypeInternals<Bindings, unknown>>>>;
367
+ readonly hostFunctions: z.ZodOptional<z.ZodType<HostFunctionCollections<import("@rivet-dev/agentos-runtime-core/host-functions").HostFunctionSchemas>, unknown, z.core.$ZodTypeInternals<HostFunctionCollections<import("@rivet-dev/agentos-runtime-core/host-functions").HostFunctionSchemas>, unknown>>>;
367
368
  readonly permissions: z.ZodOptional<z.ZodObject<{
368
369
  fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
369
370
  allow: "allow";
@@ -450,7 +451,7 @@ export declare const agentOsOptionFieldSchemas: {
450
451
  patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
451
452
  }, z.core.$strict>>;
452
453
  }, z.core.$strict>]>>;
453
- binding: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
454
+ hostFunction: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
454
455
  allow: "allow";
455
456
  deny: "deny";
456
457
  }>, z.ZodObject<{
@@ -509,15 +510,15 @@ export declare const agentOsOptionFieldSchemas: {
509
510
  tls: z.ZodOptional<z.ZodObject<{
510
511
  maxBufferedBytes: z.ZodOptional<z.ZodNumber>;
511
512
  }, z.core.$strict>>;
512
- bindings: z.ZodOptional<z.ZodObject<{
513
- defaultBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
514
- maxBindingTimeoutMs: z.ZodOptional<z.ZodNumber>;
513
+ hostFunctions: z.ZodOptional<z.ZodObject<{
514
+ defaultTimeoutMs: z.ZodOptional<z.ZodNumber>;
515
+ maxTimeoutMs: z.ZodOptional<z.ZodNumber>;
515
516
  maxRegisteredCollections: z.ZodOptional<z.ZodNumber>;
516
- maxRegisteredBindingsPerVm: z.ZodOptional<z.ZodNumber>;
517
- maxBindingsPerCollection: z.ZodOptional<z.ZodNumber>;
518
- maxBindingSchemaBytes: z.ZodOptional<z.ZodNumber>;
519
- maxExamplesPerBinding: z.ZodOptional<z.ZodNumber>;
520
- maxBindingExampleInputBytes: z.ZodOptional<z.ZodNumber>;
517
+ maxRegisteredFunctionsPerVm: z.ZodOptional<z.ZodNumber>;
518
+ maxFunctionsPerCollection: z.ZodOptional<z.ZodNumber>;
519
+ maxSchemaBytes: z.ZodOptional<z.ZodNumber>;
520
+ maxExamplesPerFunction: z.ZodOptional<z.ZodNumber>;
521
+ maxExampleInputBytes: z.ZodOptional<z.ZodNumber>;
521
522
  }, z.core.$strict>>;
522
523
  plugins: z.ZodOptional<z.ZodObject<{
523
524
  maxPersistedManifestBytes: z.ZodOptional<z.ZodNumber>;
@@ -85,7 +85,7 @@ export const permissionsSchema = z
85
85
  childProcess: patternPermissionsSchema.optional(),
86
86
  process: patternPermissionsSchema.optional(),
87
87
  env: patternPermissionsSchema.optional(),
88
- binding: patternPermissionsSchema.optional(),
88
+ hostFunction: patternPermissionsSchema.optional(),
89
89
  })
90
90
  .strict();
91
91
  export const agentOsLimitsSchema = z
@@ -123,16 +123,16 @@ export const agentOsLimitsSchema = z
123
123
  .object({ maxBufferedBytes: positiveInteger.optional() })
124
124
  .strict()
125
125
  .optional(),
126
- bindings: z
126
+ hostFunctions: z
127
127
  .object({
128
- defaultBindingTimeoutMs: nonNegativeInteger.optional(),
129
- maxBindingTimeoutMs: nonNegativeInteger.optional(),
128
+ defaultTimeoutMs: nonNegativeInteger.optional(),
129
+ maxTimeoutMs: nonNegativeInteger.optional(),
130
130
  maxRegisteredCollections: positiveInteger.optional(),
131
- maxRegisteredBindingsPerVm: positiveInteger.optional(),
132
- maxBindingsPerCollection: positiveInteger.optional(),
133
- maxBindingSchemaBytes: positiveInteger.optional(),
134
- maxExamplesPerBinding: nonNegativeInteger.optional(),
135
- maxBindingExampleInputBytes: positiveInteger.optional(),
131
+ maxRegisteredFunctionsPerVm: positiveInteger.optional(),
132
+ maxFunctionsPerCollection: positiveInteger.optional(),
133
+ maxSchemaBytes: positiveInteger.optional(),
134
+ maxExamplesPerFunction: nonNegativeInteger.optional(),
135
+ maxExampleInputBytes: positiveInteger.optional(),
136
136
  })
137
137
  .strict()
138
138
  .optional(),
@@ -320,30 +320,24 @@ export const sidecarConfigSchema = z.union([
320
320
  sharedSidecarConfigSchema,
321
321
  explicitSidecarSchema,
322
322
  ]);
323
- const bindingExampleSchema = z
323
+ const hostFunctionExampleSchema = z
324
324
  .object({
325
325
  description: z.string(),
326
326
  input: z.unknown(),
327
327
  })
328
328
  .strict();
329
- export const bindingSchema = z
329
+ export const hostFunctionSchema = z
330
330
  .object({
331
- description: z.string(),
332
331
  inputSchema: z.custom((value) => typeof value === "object" && value !== null, {
333
332
  message: "Expected Zod schema object",
334
333
  }),
335
334
  execute: functionSchema,
336
- examples: z.array(bindingExampleSchema).optional(),
335
+ examples: z.array(hostFunctionExampleSchema).optional(),
337
336
  timeout: nonNegativeInteger.optional(),
338
337
  })
339
338
  .strict();
340
- export const bindingsSchema = z
341
- .object({
342
- name: z.string(),
343
- description: z.string(),
344
- bindings: z.record(z.string(), bindingSchema),
345
- })
346
- .strict();
339
+ export const hostFunctionCollectionSchema = z.record(z.string(), hostFunctionSchema);
340
+ export const hostFunctionsSchema = z.record(z.string(), hostFunctionCollectionSchema);
347
341
  /**
348
342
  * Shared AgentOsOptions field schemas.
349
343
  *
@@ -384,7 +378,7 @@ export const agentOsOptionFieldSchemas = {
384
378
  message: "Expected schedule driver object",
385
379
  })
386
380
  .optional(),
387
- bindings: z.array(bindingsSchema).optional(),
381
+ hostFunctions: hostFunctionsSchema.optional(),
388
382
  permissions: permissionsSchema.optional(),
389
383
  sidecar: sidecarConfigSchema.optional(),
390
384
  limits: agentOsLimitsSchema.optional(),
@@ -87,7 +87,7 @@ export type NetworkPermissions = PermissionMode | RulePermissions<PatternPermiss
87
87
  export type ChildProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
88
88
  export type ProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
89
89
  export type EnvPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
90
- export type BindingPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
90
+ export type HostFunctionPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
91
91
  export interface ProcessInfo {
92
92
  pid: number;
93
93
  ppid: number;
@@ -176,7 +176,7 @@ export interface Permissions {
176
176
  childProcess?: ChildProcessPermissions;
177
177
  process?: ProcessPermissions;
178
178
  env?: EnvPermissions;
179
- binding?: BindingPermissions;
179
+ hostFunction?: HostFunctionPermissions;
180
180
  }
181
181
  export interface ResourceBudgets {
182
182
  maxOutputBytes?: number;
@@ -323,10 +323,10 @@ export interface Kernel extends KernelInterface {
323
323
  readonly timerTable: Record<string, never>;
324
324
  readonly zombieTimerCount: number;
325
325
  }
326
- export interface BindingTree {
327
- [key: string]: BindingFunction | BindingTree;
326
+ export interface HostFunctionTree {
327
+ [key: string]: HostFunctionHandler | HostFunctionTree;
328
328
  }
329
- export type BindingFunction = (...args: unknown[]) => unknown;
329
+ export type HostFunctionHandler = (...args: unknown[]) => unknown;
330
330
  export interface NodeDriverOptions {
331
331
  filesystem?: VirtualFileSystem;
332
332
  networkAdapter?: NetworkAdapter;
@@ -344,7 +344,7 @@ export interface NodeRuntimeOptions {
344
344
  runtimeDriverFactory?: NodeRuntimeDriverFactory;
345
345
  permissions?: Partial<Permissions>;
346
346
  memoryLimit?: number;
347
- bindings?: BindingTree;
347
+ hostFunctions?: HostFunctionTree;
348
348
  loopbackExemptPorts?: number[];
349
349
  }
350
350
  export type NodeRuntimeDriverFactoryOptions = Record<string, never>;
package/dist/runtime.d.ts CHANGED
@@ -81,7 +81,7 @@ export type NetworkPermissions = PermissionMode | RulePermissions<PatternPermiss
81
81
  export type ChildProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
82
82
  export type ProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
83
83
  export type EnvPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
84
- export type BindingPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
84
+ export type HostFunctionPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
85
85
  export interface ProcessInfo {
86
86
  pid: number;
87
87
  ppid: number;
@@ -170,7 +170,7 @@ export interface Permissions {
170
170
  childProcess?: ChildProcessPermissions;
171
171
  process?: ProcessPermissions;
172
172
  env?: EnvPermissions;
173
- binding?: BindingPermissions;
173
+ hostFunction?: HostFunctionPermissions;
174
174
  }
175
175
  export interface ResourceBudgets {
176
176
  maxOutputBytes?: number;
@@ -317,10 +317,10 @@ export interface Kernel extends KernelInterface {
317
317
  readonly timerTable: Record<string, never>;
318
318
  readonly zombieTimerCount: number;
319
319
  }
320
- export interface BindingTree {
321
- [key: string]: BindingFunction | BindingTree;
320
+ export interface HostFunctionTree {
321
+ [key: string]: HostFunctionHandler | HostFunctionTree;
322
322
  }
323
- export type BindingFunction = (...args: unknown[]) => unknown;
323
+ export type HostFunctionHandler = (...args: unknown[]) => unknown;
324
324
  export interface NodeModulesMountConfig {
325
325
  path: string;
326
326
  plugin: {
@@ -349,7 +349,7 @@ export interface NodeRuntimeOptions {
349
349
  runtimeDriverFactory?: NodeRuntimeDriverFactory;
350
350
  permissions?: Partial<Permissions>;
351
351
  memoryLimit?: number;
352
- bindings?: BindingTree;
352
+ hostFunctions?: HostFunctionTree;
353
353
  loopbackExemptPorts?: number[];
354
354
  }
355
355
  export type NodeRuntimeDriverFactoryOptions = Record<string, never>;
package/dist/sandbox.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import { z } from "zod";
1
2
  import type { MountConfig, MountConfigJsonObject, NativeMountPluginDescriptor } from "./agent-os.js";
2
- import type { Bindings } from "./bindings.js";
3
+ import type { HostFunction, HostFunctionCollections } from "@rivet-dev/agentos-runtime-core/host-functions";
3
4
  export interface AgentOsSandboxProcessResult {
4
5
  stdout?: string;
5
6
  stderr?: string;
@@ -86,7 +87,7 @@ declare const sandboxDisposeHooks: unique symbol;
86
87
  type SandboxDisposeHook = () => void | Promise<void>;
87
88
  export type AgentOsSandboxExpandedOptions = {
88
89
  mounts?: MountConfig[];
89
- bindings?: Bindings[];
90
+ hostFunctions?: HostFunctionCollections;
90
91
  [sandboxDisposeHooks]?: SandboxDisposeHook[];
91
92
  };
92
93
  type ResolvedSandboxOptions = AgentOsSandboxCommonOptions & {
@@ -101,12 +102,83 @@ export type SandboxMountPluginConfig = MountConfigJsonObject & {
101
102
  maxFullReadBytes?: number;
102
103
  };
103
104
  export declare function createSandboxFs(input: ResolvedSandboxOptions | AgentOsSandboxClientOptions): NativeMountPluginDescriptor<SandboxMountPluginConfig>;
104
- export declare function createSandboxBindings(input: ResolvedSandboxOptions | AgentOsSandboxClientOptions): Bindings;
105
+ export declare function createSandboxHostFunctions(input: ResolvedSandboxOptions | AgentOsSandboxClientOptions): {
106
+ runCommand: HostFunction<z.ZodObject<{
107
+ command: z.ZodString;
108
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ cwd: z.ZodOptional<z.ZodString>;
110
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
111
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
112
+ }, z.core.$strip>, {
113
+ stdout: string | undefined;
114
+ stderr: string | undefined;
115
+ exitCode: number | null | undefined;
116
+ timedOut: boolean | undefined;
117
+ durationMs: number | undefined;
118
+ }>;
119
+ createProcess: HostFunction<z.ZodObject<{
120
+ command: z.ZodString;
121
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ cwd: z.ZodOptional<z.ZodString>;
123
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
124
+ }, z.core.$strip>, {
125
+ id: string;
126
+ command: string | undefined;
127
+ args: string[] | undefined;
128
+ status: string | undefined;
129
+ pid: number | null | undefined;
130
+ }>;
131
+ listProcesses: HostFunction<z.ZodObject<{}, z.core.$strip>, {
132
+ processes: {
133
+ id: string;
134
+ command: string | undefined;
135
+ args: string[] | undefined;
136
+ status: string | undefined;
137
+ exitCode: number | null | undefined;
138
+ pid: number | null | undefined;
139
+ }[];
140
+ }>;
141
+ stopProcess: HostFunction<z.ZodObject<{
142
+ id: z.ZodString;
143
+ }, z.core.$strip>, {
144
+ id: string;
145
+ status: string | undefined;
146
+ exitCode: number | null | undefined;
147
+ }>;
148
+ killProcess: HostFunction<z.ZodObject<{
149
+ id: z.ZodString;
150
+ }, z.core.$strip>, {
151
+ id: string;
152
+ status: string | undefined;
153
+ exitCode: number | null | undefined;
154
+ }>;
155
+ getProcessLogs: HostFunction<z.ZodObject<{
156
+ id: z.ZodString;
157
+ stream: z.ZodOptional<z.ZodEnum<{
158
+ stderr: "stderr";
159
+ stdout: "stdout";
160
+ combined: "combined";
161
+ }>>;
162
+ tail: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$strip>, {
164
+ logs: {
165
+ data: string;
166
+ stream: string | undefined;
167
+ timestampMs: number | undefined;
168
+ }[];
169
+ }>;
170
+ sendInput: HostFunction<z.ZodObject<{
171
+ id: z.ZodString;
172
+ data: z.ZodString;
173
+ }, z.core.$strip>, {
174
+ sent: boolean;
175
+ }>;
176
+ };
105
177
  export declare function getSandboxDisposeHooks(options: object | undefined): SandboxDisposeHook[];
106
178
  export declare function resolveSandboxOptions<T extends {
107
179
  sandbox?: AgentOsSandboxInput;
108
180
  }>(options: T): Promise<Omit<T, "sandbox"> & {
109
181
  mounts?: MountConfig[];
110
- bindings?: Bindings[];
182
+ hostFunctions?: HostFunctionCollections;
111
183
  }>;
112
184
  export {};