@rivet-dev/agentos-core 0.0.0-nathan-binding-workspace.dd41c31 → 0.0.0-nathan-binding-workspace.806210d

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 CHANGED
@@ -25,10 +25,10 @@ npm install @rivet-dev/agentos-pi @mariozechner/pi-coding-agent
25
25
  ```
26
26
 
27
27
  ```typescript
28
- import { AgentOS } from "@rivet-dev/agentos-core";
28
+ import { AgentOs } from "@rivet-dev/agentos-core";
29
29
 
30
30
  // 1. Create a VM
31
- const vm = await AgentOS.create();
31
+ const vm = await AgentOs.create();
32
32
 
33
33
  // 2. Create an agent session
34
34
  const { sessionId } = await vm.createSession("pi");
@@ -47,17 +47,17 @@ await vm.dispose();
47
47
 
48
48
  | Method | Signature | Description |
49
49
  |--------|-----------|-------------|
50
- | `create` | `static create(options?: AgentOSOptions): Promise<AgentOS>` | Create and boot a new VM |
51
- | `getSharedSidecar` | `static getSharedSidecar(options?: AgentOSSharedSidecarOptions): Promise<AgentOSSidecar>` | Get or create a shared sidecar handle for a pool |
52
- | `createSidecar` | `static createSidecar(options?: AgentOSCreateSidecarOptions): Promise<AgentOSSidecar>` | Create an explicit sidecar handle |
50
+ | `create` | `static create(options?: AgentOsOptions): Promise<AgentOs>` | Create and boot a new VM |
51
+ | `getSharedSidecar` | `static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>` | Get or create a shared sidecar handle for a pool |
52
+ | `createSidecar` | `static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>` | Create an explicit sidecar handle |
53
53
  | `dispose` | `dispose(): Promise<void>` | Shut down the VM and all sessions |
54
54
 
55
55
  ### Sidecars
56
56
 
57
57
  | Surface | Signature | Description |
58
58
  |--------|-----------|-------------|
59
- | `sidecar` | `AgentOSSidecar` | Sidecar handle backing the VM |
60
- | `describe` | `sidecar.describe(): AgentOSSidecarDescription` | Inspect sidecar placement, state, and active VM count |
59
+ | `sidecar` | `AgentOsSidecar` | Sidecar handle backing the VM |
60
+ | `describe` | `sidecar.describe(): AgentOsSidecarDescription` | Inspect sidecar placement, state, and active VM count |
61
61
  | `dispose` | `sidecar.dispose(): Promise<void>` | Dispose the sidecar handle and any active VMs leased from it |
62
62
 
63
63
  ### Filesystem
@@ -142,14 +142,14 @@ await vm.dispose();
142
142
  ### Exported Types
143
143
 
144
144
  **VM & Options**
145
- - `AgentOSOptions` — VM creation options (commandDirs, loopbackExemptPorts, mounts, additionalInstructions). Use `nodeModulesMount(...)` in `mounts` to expose a host `node_modules` tree at `/root/node_modules`.
146
- - `AgentOSSidecarConfig` — shared-pool or explicit-handle sidecar selection for VM creation
147
- - `AgentOSSharedSidecarOptions` — shared sidecar pool selection
148
- - `AgentOSCreateSidecarOptions` — explicit sidecar handle creation options
145
+ - `AgentOsOptions` — VM creation options (commandDirs, loopbackExemptPorts, mounts, additionalInstructions). Use `nodeModulesMount(...)` in `mounts` to expose a host `node_modules` tree at `/root/node_modules`.
146
+ - `AgentOsSidecarConfig` — shared-pool or explicit-handle sidecar selection for VM creation
147
+ - `AgentOsSharedSidecarOptions` — shared sidecar pool selection
148
+ - `AgentOsCreateSidecarOptions` — explicit sidecar handle creation options
149
149
  - `CreateSessionOptions` — Session options (cwd, env, mcpServers, skipOsInstructions, additionalInstructions)
150
150
 
151
151
  **Sidecar**
152
- - `AgentOSSidecarDescription` — Sidecar identity, placement, lifecycle state, and active VM count
152
+ - `AgentOsSidecarDescription` — Sidecar identity, placement, lifecycle state, and active VM count
153
153
 
154
154
  **Mount Configurations**
155
155
  - `MountConfig` — Union of all mount types
@@ -1,6 +1,6 @@
1
1
  import type { NativeMountPluginDescriptor } from "@secure-exec/core/descriptors";
2
2
  import type { AgentCapabilities, AgentInfo, PermissionReply, PermissionRequestHandler, SessionConfigOption, SessionEventHandler, SessionModeState } from "./agent-session-types.js";
3
- import { type Bindings } from "./bindings.js";
3
+ import { type ToolKit } from "./host-tools.js";
4
4
  import type { JsonRpcResponse } from "./json-rpc.js";
5
5
  import type { ConnectTerminalOptions, Kernel, KernelExecOptions, KernelExecResult, ProcessInfo as KernelProcessInfo, KernelSpawnOptions, OpenShellOptions, Permissions, VirtualFileSystem, VirtualStat } from "./runtime-compat.js";
6
6
  export type { MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountPluginDescriptor, } from "@secure-exec/core/descriptors";
@@ -55,23 +55,23 @@ import type { ScheduleDriver } from "./cron/schedule-driver.js";
55
55
  import type { CronEventHandler, CronJob, CronJobInfo, CronJobOptions } from "./cron/types.js";
56
56
  import { type LayerStore, type OverlayFilesystemMode, type RootSnapshotExport, type SnapshotLayerHandle } from "./layers.js";
57
57
  import { type SoftwareInput } from "./packages.js";
58
- import { type AgentOSSidecarPlacement } from "./sidecar/rpc-client.js";
59
- export interface AgentOSSharedSidecarOptions {
58
+ import { type AgentOsSidecarPlacement } from "./sidecar/rpc-client.js";
59
+ export interface AgentOsSharedSidecarOptions {
60
60
  pool?: string;
61
61
  }
62
- export interface AgentOSCreateSidecarOptions {
62
+ export interface AgentOsCreateSidecarOptions {
63
63
  sidecarId?: string;
64
64
  }
65
- export type AgentOSSidecarConfig = {
65
+ export type AgentOsSidecarConfig = {
66
66
  kind: "shared";
67
67
  pool?: string;
68
68
  } | {
69
69
  kind: "explicit";
70
- handle: AgentOSSidecar;
70
+ handle: AgentOsSidecar;
71
71
  };
72
- export interface AgentOSSidecarDescription {
72
+ export interface AgentOsSidecarDescription {
73
73
  sidecarId: string;
74
- placement: AgentOSSidecarPlacement;
74
+ placement: AgentOsSidecarPlacement;
75
75
  state: "ready" | "disposing" | "disposed";
76
76
  activeVmCount: number;
77
77
  }
@@ -119,7 +119,7 @@ export type MountConfig = PlainMountConfig | NativeMountConfig | OverlayMountCon
119
119
  * forwarded to the native sidecar in the typed create-VM JSON config. Unknown, negative, or
120
120
  * non-integer values are rejected by the sidecar before VM construction.
121
121
  */
122
- export interface AgentOSLimits {
122
+ export interface AgentOsLimits {
123
123
  /** Kernel resource limits (processes, FDs, sockets, filesystem bytes, WASM caps, etc.). */
124
124
  resources?: {
125
125
  cpuCount?: number;
@@ -190,7 +190,7 @@ export interface AgentOSLimits {
190
190
  syncReadLimitBytes?: number;
191
191
  };
192
192
  }
193
- export interface AgentOSOptions {
193
+ export interface AgentOsOptions {
194
194
  /**
195
195
  * Software to install in the VM. Each entry provides agents, tools,
196
196
  * or WASM commands. Any object with a `commandDir` property (e.g.,
@@ -199,6 +199,14 @@ export interface AgentOSOptions {
199
199
  * meta-packages that export arrays of sub-packages work directly.
200
200
  */
201
201
  software?: SoftwareInput[];
202
+ /**
203
+ * Whether to auto-include the default software bundle (`@agentos-software/common`
204
+ * — `sh` + coreutils + the standard CLI tools agents rely on) in addition to
205
+ * any `software` you pass. Defaults to `true`; set `false` for a bare VM with
206
+ * only the software you list explicitly. Entries already present in `software`
207
+ * are not duplicated.
208
+ */
209
+ defaultSoftware?: boolean;
202
210
  /** Loopback ports to exempt from SSRF checks (for testing with host-side mock servers). */
203
211
  loopbackExemptPorts?: number[];
204
212
  /**
@@ -219,8 +227,8 @@ export interface AgentOSOptions {
219
227
  additionalInstructions?: string;
220
228
  /** Custom schedule driver for cron jobs. Defaults to TimerScheduleDriver. */
221
229
  scheduleDriver?: ScheduleDriver;
222
- /** Host-side bindings available to agents inside the VM. */
223
- bindings?: Bindings[];
230
+ /** Host-side toolkits available to agents inside the VM. */
231
+ toolKits?: ToolKit[];
224
232
  /**
225
233
  * Custom permission policy for the kernel. Controls access to filesystem,
226
234
  * network, child process, and environment operations. Defaults to allowAll.
@@ -230,12 +238,12 @@ export interface AgentOSOptions {
230
238
  * Sidecar placement for the VM. Defaults to the shared `default` pool.
231
239
  * Pass an explicit sidecar handle to pin the VM to a caller-managed sidecar.
232
240
  */
233
- sidecar?: AgentOSSidecarConfig;
241
+ sidecar?: AgentOsSidecarConfig;
234
242
  /**
235
243
  * Operator-tunable runtime limits. Unset fields use built-in defaults that match the
236
244
  * runtime's historical constants, so omitting this leaves behavior unchanged.
237
245
  */
238
- limits?: AgentOSLimits;
246
+ limits?: AgentOsLimits;
239
247
  }
240
248
  /** Configuration for a local MCP server (spawned as a child process). */
241
249
  export interface McpServerConfigLocal {
@@ -256,11 +264,11 @@ export interface McpServerConfigRemote {
256
264
  headers?: Record<string, string>;
257
265
  }
258
266
  export type McpServerConfig = McpServerConfigLocal | McpServerConfigRemote;
259
- export interface AgentOSRuntimeAdmin {
267
+ export interface AgentOsRuntimeAdmin {
260
268
  kernel: Kernel;
261
269
  rootView: VirtualFileSystem;
262
270
  env: Record<string, string>;
263
- sidecar: AgentOSSidecar;
271
+ sidecar: AgentOsSidecar;
264
272
  }
265
273
  export interface CreateSessionOptions {
266
274
  /** Working directory for the agent session inside the VM. */
@@ -274,18 +282,49 @@ export interface CreateSessionOptions {
274
282
  /** Additional instructions appended to the base OS instructions. */
275
283
  additionalInstructions?: string;
276
284
  }
285
+ /**
286
+ * Options for {@link AgentOs.resumeSession}.
287
+ *
288
+ * Resume depends on a durable root: after a Rivet actor sleeps (VM destroyed) and
289
+ * wakes (fresh VM, actor SQLite intact) the caller can keep prompting an existing
290
+ * session. On a non-durable (default in-memory) root there is no surviving store,
291
+ * so the sidecar's universal fallback tier always runs and the transcript pointer
292
+ * is the only continuity mechanism.
293
+ */
294
+ export interface ResumeSessionOptions {
295
+ /**
296
+ * Guest-readable path to the reconstructed transcript. When present, the
297
+ * fallback tier arms a continuation preamble pointing the agent at it.
298
+ */
299
+ transcriptPath?: string;
300
+ /** Working directory for the resumed agent session (default `/home/user`). */
301
+ cwd?: string;
302
+ /** Environment variables to pass to the resumed agent process. */
303
+ env?: Record<string, string>;
304
+ }
305
+ /** Result from {@link AgentOs.resumeSession}. */
306
+ export interface ResumeSessionResult {
307
+ /**
308
+ * The live ACP session id in the fresh VM: equal to the requested id for
309
+ * native loads, or a freshly assigned id for the fallback tier — the caller
310
+ * remaps `external -> live`.
311
+ */
312
+ sessionId: string;
313
+ /** `"native"` (session/load|resume) or `"fallback"` (session/new + preamble). */
314
+ mode: string;
315
+ }
277
316
  export interface SessionInfo {
278
317
  sessionId: string;
279
318
  agentType: string;
280
319
  }
281
- /** Result from AgentOS.prompt(). */
320
+ /** Result from AgentOs.prompt(). */
282
321
  export interface PromptResult {
283
322
  /** Raw JSON-RPC response from the ACP adapter. */
284
323
  response: JsonRpcResponse;
285
324
  /** Accumulated agent text output from streamed message chunks. */
286
325
  text: string;
287
326
  }
288
- /** Information about a process spawned via AgentOS.spawn(). */
327
+ /** Information about a process spawned via AgentOs.spawn(). */
289
328
  export interface SpawnedProcessInfo {
290
329
  pid: number;
291
330
  command: string;
@@ -293,9 +332,9 @@ export interface SpawnedProcessInfo {
293
332
  running: boolean;
294
333
  exitCode: number | null;
295
334
  }
296
- export declare class AgentOS {
335
+ export declare class AgentOs {
297
336
  #private;
298
- readonly sidecar: AgentOSSidecar;
337
+ readonly sidecar: AgentOsSidecar;
299
338
  private _sessions;
300
339
  private _closedSessionIds;
301
340
  private _sessionClosePromises;
@@ -310,7 +349,7 @@ export declare class AgentOS {
310
349
  private _softwareRoots;
311
350
  private _softwareAgentConfigs;
312
351
  private _cronManager;
313
- private _bindings;
352
+ private _toolKits;
314
353
  private _toolReference;
315
354
  private _permissions;
316
355
  private _hostMounts;
@@ -322,9 +361,9 @@ export declare class AgentOS {
322
361
  private readonly _sidecarVm;
323
362
  private readonly _disposeSidecarEventListener;
324
363
  private constructor();
325
- static createSidecar(options?: AgentOSCreateSidecarOptions): Promise<AgentOSSidecar>;
326
- static getSharedSidecar(options?: AgentOSSharedSidecarOptions): Promise<AgentOSSidecar>;
327
- static create(options?: AgentOSOptions): Promise<AgentOS>;
364
+ static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
365
+ static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>;
366
+ static create(options?: AgentOsOptions): Promise<AgentOs>;
328
367
  exec(command: string, options?: KernelExecOptions): Promise<KernelExecResult>;
329
368
  execArgv(command: string, args?: readonly string[], options?: KernelExecOptions): Promise<KernelExecResult>;
330
369
  private _trackProcess;
@@ -423,6 +462,22 @@ export declare class AgentOS {
423
462
  createSession(agentType: AgentType | string, options?: CreateSessionOptions): Promise<{
424
463
  sessionId: string;
425
464
  }>;
465
+ /**
466
+ * Resume a session that exists in durable storage but is not live in this VM
467
+ * (e.g. after a Rivet actor slept and woke with a fresh VM). Thin forwarder:
468
+ * resolves the agent config + adapter entrypoint exactly as {@link createSession}
469
+ * does, then forwards a single `AcpResumeSessionRequest` to the sidecar, which
470
+ * owns the resume state machine (native `session/load` when the agent supports
471
+ * it, else `session/new` + a transcript-continuation preamble). The returned
472
+ * `sessionId` is the live id in this VM (equal to the requested id for native
473
+ * loads, freshly assigned for the fallback); the caller remaps `external -> live`.
474
+ * The new live session is registered + hydrated locally so subsequent prompts
475
+ * route to it.
476
+ *
477
+ * Resume depends on a durable root; on a non-durable (default in-memory) root
478
+ * there is no surviving store and the fallback tier always runs.
479
+ */
480
+ resumeSession(sessionId: string, agentType: AgentType | string, options?: ResumeSessionOptions): Promise<ResumeSessionResult>;
426
481
  /**
427
482
  * Resolve the VM bin entry point of an ACP adapter package.
428
483
  * Reads from the host filesystem since kernel.readFile() resolves through
@@ -502,17 +557,17 @@ export declare class AgentOS {
502
557
  onCronEvent(handler: CronEventHandler): void;
503
558
  dispose(): Promise<void>;
504
559
  }
505
- export declare function getAgentOSRuntimeAdmin(vm: AgentOS): AgentOSRuntimeAdmin;
506
- export declare function getAgentOSKernel(vm: AgentOS): Kernel;
507
- export declare class AgentOSSidecar {
508
- constructor(sidecarId: string, placement: AgentOSSidecarPlacement, sharedPool?: string);
509
- describe(): AgentOSSidecarDescription;
560
+ export declare function getAgentOsRuntimeAdmin(vm: AgentOs): AgentOsRuntimeAdmin;
561
+ export declare function getAgentOsKernel(vm: AgentOs): Kernel;
562
+ export declare class AgentOsSidecar {
563
+ constructor(sidecarId: string, placement: AgentOsSidecarPlacement, sharedPool?: string);
564
+ describe(): AgentOsSidecarDescription;
510
565
  dispose(): Promise<void>;
511
566
  }
512
567
  /**
513
568
  * Test-only escape hatch: dispose every cached shared sidecar so vitest
514
569
  * workers can exit cleanly. The shared sidecar is normally process-global and
515
- * keeps its native subprocess alive across `AgentOS.create()` calls; without
570
+ * keeps its native subprocess alive across `AgentOs.create()` calls; without
516
571
  * this hook the vitest worker can hold open piped stdio handles after the
517
572
  * test suite finishes and stall `pnpm test` indefinitely.
518
573
  */