@rivet-dev/agentos-core 0.2.8-rc.2 → 0.2.8-rc.3

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 (55) hide show
  1. package/README.md +40 -37
  2. package/dist/agent-os.d.ts +184 -230
  3. package/dist/agent-os.js +751 -1158
  4. package/dist/agentos-package.d.ts +5 -3
  5. package/dist/agentos-package.js +5 -2
  6. package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
  7. package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
  8. package/dist/bindings.d.ts +43 -0
  9. package/dist/bindings.js +34 -0
  10. package/dist/cron/cron-manager.js +43 -10
  11. package/dist/cron/index.d.ts +1 -1
  12. package/dist/cron/types.d.ts +25 -9
  13. package/dist/filesystem-snapshot.d.ts +1 -2
  14. package/dist/filesystem-snapshot.js +0 -43
  15. package/dist/generated/AcpLimitsConfig.d.ts +16 -0
  16. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  17. package/dist/generated/CreateVmConfig.d.ts +2 -0
  18. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  19. package/dist/generated/ProcessLimitsConfig.js +2 -0
  20. package/dist/generated/VmGroupConfig.d.ts +5 -0
  21. package/dist/generated/VmGroupConfig.js +2 -0
  22. package/dist/generated/VmLimitsConfig.d.ts +4 -2
  23. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  24. package/dist/generated/VmUserAccountConfig.js +2 -0
  25. package/dist/generated/VmUserConfig.d.ts +19 -0
  26. package/dist/generated/WasmLimitsConfig.d.ts +1 -0
  27. package/dist/index.d.ts +4 -5
  28. package/dist/index.js +4 -5
  29. package/dist/layers.d.ts +5 -2
  30. package/dist/layers.js +0 -185
  31. package/dist/options-schema.d.ts +133 -31
  32. package/dist/options-schema.js +143 -26
  33. package/dist/runtime-compat.d.ts +4 -35
  34. package/dist/runtime-compat.js +84 -372
  35. package/dist/runtime.d.ts +3 -1
  36. package/dist/sandbox.d.ts +4 -4
  37. package/dist/sandbox.js +4 -4
  38. package/dist/session-api.d.ts +180 -0
  39. package/dist/session-api.js +1 -0
  40. package/dist/sidecar/agentos-protocol.d.ts +429 -29
  41. package/dist/sidecar/agentos-protocol.js +691 -93
  42. package/dist/sidecar/rpc-client.d.ts +18 -6
  43. package/dist/sidecar/rpc-client.js +66 -18
  44. package/dist/test/runtime.d.ts +2 -1
  45. package/dist/test/runtime.js +2 -1
  46. package/dist/types.d.ts +4 -5
  47. package/package.json +20 -19
  48. package/dist/agent-session-types.d.ts +0 -67
  49. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  50. package/dist/host-tools.d.ts +0 -45
  51. package/dist/host-tools.js +0 -35
  52. package/dist/overlay-filesystem.d.ts +0 -19
  53. package/dist/overlay-filesystem.js +0 -645
  54. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
  55. /package/dist/{agent-session-types.js → generated/VmUserConfig.js} +0 -0
package/README.md CHANGED
@@ -8,7 +8,7 @@ Agents run inside isolated VMs with their own filesystem, process table, and net
8
8
 
9
9
  - **VM lifecycle** — create, configure, and dispose isolated virtual machines
10
10
  - **Sidecar placement** — reuse the default shared sidecar or inject an explicit sidecar handle
11
- - **Agent sessions (ACP)** — launch coding agents (Pi, Pi CLI, OpenCode, Claude) via JSON-RPC over stdio
11
+ - **Agent sessions (ACP)** — launch coding agents (Pi, OpenCode, Claude) via JSON-RPC over stdio
12
12
  - **Filesystem operations** — read, write, mkdir, stat, move, delete, recursive listing, batch read/write
13
13
  - **Process management** — spawn, exec, stop, kill processes; inspect process trees across all runtimes
14
14
  - **Agent registry** — discover available agents and their installation status
@@ -21,7 +21,7 @@ Agents run inside isolated VMs with their own filesystem, process table, and net
21
21
  ```bash
22
22
  npm install @rivet-dev/agentos-core
23
23
  # Install an agent adapter + its underlying agent
24
- npm install @agentos-software/pi @mariozechner/pi-coding-agent
24
+ npm install @agentos-software/pi
25
25
  ```
26
26
 
27
27
  ```typescript
@@ -30,14 +30,16 @@ import { AgentOs } from "@rivet-dev/agentos-core";
30
30
  // 1. Create a VM
31
31
  const vm = await AgentOs.create();
32
32
 
33
- // 2. Create an agent session
34
- const { sessionId } = await vm.createSession("pi");
33
+ // 2. Create the default agent session
34
+ await vm.openSession({ agent: "pi" });
35
35
 
36
36
  // 3. Send a prompt
37
- const response = await vm.prompt(sessionId, "Write a hello world in TypeScript");
37
+ const response = await vm.prompt({
38
+ content: [{ type: "text", text: "Write a hello world in TypeScript" }],
39
+ });
38
40
 
39
41
  // 4. Clean up
40
- vm.closeSession(sessionId);
42
+ await vm.deleteSession();
41
43
  await vm.dispose();
42
44
  ```
43
45
 
@@ -70,13 +72,16 @@ await vm.dispose();
70
72
  | `writeFiles` | `writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>` | Batch write multiple files (creates parent dirs) |
71
73
  | `mkdir` | `mkdir(path: string): Promise<void>` | Create a directory |
72
74
  | `readdir` | `readdir(path: string): Promise<string[]>` | List directory entries |
75
+ | `readdirEntries` | `readdirEntries(path: string): Promise<ReaddirEntry[]>` | List immediate directory entries and types in one operation |
73
76
  | `readdirRecursive` | `readdirRecursive(path: string, options?: ReaddirRecursiveOptions): Promise<DirEntry[]>` | Recursively list directory contents with metadata |
74
77
  | `stat` | `stat(path: string): Promise<VirtualStat>` | Get file/directory metadata |
75
78
  | `exists` | `exists(path: string): Promise<boolean>` | Check if a path exists |
76
79
  | `move` | `move(from: string, to: string): Promise<void>` | Rename/move a file or directory |
77
- | `delete` | `delete(path: string, options?: { recursive?: boolean }): Promise<void>` | Delete a file or directory |
78
- | `mountFs` | `mountFs(path: string, driver: VirtualFileSystem, options?: { readOnly?: boolean }): void` | Mount a filesystem driver at the given path |
79
- | `unmountFs` | `unmountFs(path: string): void` | Unmount a filesystem |
80
+ | `remove` | `remove(path: string, options?: { recursive?: boolean }): Promise<void>` | Remove a file or directory |
81
+ | `mountFs` | `mountFs(descriptor: DynamicMountDescriptor): Promise<void>` | Mount a sidecar-owned filesystem descriptor |
82
+ | `unmountFs` | `unmountFs(path: string): Promise<void>` | Unmount a filesystem |
83
+ | `listMounts` | `listMounts(): Promise<MountInfo[]>` | Read sanitized live mount metadata from the sidecar |
84
+ | `exportRootFilesystem` | `exportRootFilesystem({ maxBytes }): Promise<RootSnapshotExport>` | Export a bounded root-filesystem snapshot |
80
85
 
81
86
  ### Process Management
82
87
 
@@ -84,6 +89,8 @@ await vm.dispose();
84
89
  |--------|-----------|-------------|
85
90
  | `exec` | `exec(command: string, options?: ExecOptions): Promise<ExecResult>` | Execute a shell command and wait for completion |
86
91
  | `spawn` | `spawn(command: string, args: string[], options?: SpawnOptions): { pid: number }` | Spawn a long-running process |
92
+ | `onProcessOutput` | `onProcessOutput(pid, handler): () => void` | Subscribe to unified stdout/stderr DTOs |
93
+ | `onProcessExit` | `onProcessExit(pid, handler): () => void` | Subscribe to process exit DTOs |
87
94
  | `listProcesses` | `listProcesses(): SpawnedProcessInfo[]` | List processes started via `spawn()` |
88
95
  | `allProcesses` | `allProcesses(): ProcessInfo[]` | List all kernel processes across all runtimes |
89
96
  | `processTree` | `processTree(): ProcessTreeNode[]` | Get processes organized as a parent-child tree |
@@ -95,7 +102,7 @@ await vm.dispose();
95
102
 
96
103
  | Method | Signature | Description |
97
104
  |--------|-----------|-------------|
98
- | `fetch` | `fetch(port: number, request: Request): Promise<Response>` | Send an HTTP request to a service running inside the VM |
105
+ | `httpRequest` | `httpRequest(request: HttpRequest): Promise<HttpResponse>` | Send a buffered HTTP request to a service running inside the VM |
99
106
 
100
107
  ### Shell
101
108
 
@@ -112,9 +119,11 @@ await vm.dispose();
112
119
 
113
120
  | Method | Signature | Description |
114
121
  |--------|-----------|-------------|
115
- | `createSession` | `createSession(agentType: AgentType, options?: CreateSessionOptions): Promise<{ sessionId: string }>` | Launch an agent and return a session ID |
116
- | `listSessions` | `listSessions(): SessionInfo[]` | List active sessions |
117
- | `destroySession` | `destroySession(sessionId: string): Promise<void>` | Gracefully cancel and close a session |
122
+ | `openSession` | `openSession(input: OpenSessionInput): Promise<void>` | Create or restore a durable session with a caller-chosen ID |
123
+ | `getSession` | `getSession(input?: SessionTarget): Promise<SessionInfo>` | Read SQLite metadata without starting an adapter |
124
+ | `listSessions` | `listSessions(input?: ListSessionsInput): Promise<SessionPage>` | Page through SQLite metadata without starting adapters |
125
+ | `unloadSession` | `unloadSession(input?: SessionTarget): Promise<void>` | Stop the adapter while retaining history |
126
+ | `deleteSession` | `deleteSession(input?: SessionTarget): Promise<void>` | Stop the adapter and delete durable state; omitted ID targets main |
118
127
 
119
128
  ### Agent Registry
120
129
 
@@ -126,27 +135,22 @@ await vm.dispose();
126
135
 
127
136
  | Method | Signature | Description |
128
137
  |--------|-----------|-------------|
129
- | `prompt` | `prompt(sessionId: string, text: string): Promise<PromptResult>` | Send a prompt and collect the agent text |
130
- | `cancelSession` | `cancelSession(sessionId: string): Promise<JsonRpcResponse>` | Cancel ongoing agent work |
131
- | `closeSession` | `closeSession(sessionId: string): void` | Kill the agent process and clean up |
132
- | `onSessionEvent` | `onSessionEvent(sessionId: string, handler: SessionEventHandler): () => void` | Subscribe to session update notifications |
133
- | `onPermissionRequest` | `onPermissionRequest(sessionId: string, handler: PermissionRequestHandler): () => void` | Subscribe to permission requests |
134
- | `respondPermission` | `respondPermission(sessionId: string, permissionId: string, reply: PermissionReply): Promise<JsonRpcResponse>` | Reply to a permission request |
135
- | `setSessionMode` | `setSessionMode(sessionId: string, modeId: string): Promise<JsonRpcResponse>` | Set the session mode |
136
- | `getSessionModes` | `getSessionModes(sessionId: string): SessionModeState \| null` | Get available modes |
137
- | `setSessionModel` | `setSessionModel(sessionId: string, model: string): Promise<JsonRpcResponse>` | Set the model |
138
- | `setSessionThoughtLevel` | `setSessionThoughtLevel(sessionId: string, level: string): Promise<JsonRpcResponse>` | Set reasoning level |
139
- | `getSessionConfigOptions` | `getSessionConfigOptions(sessionId: string): SessionConfigOption[]` | Get available config options |
140
- | `rawSend` | `rawSend(sessionId: string, method: string, params?: Record<string, unknown>): Promise<JsonRpcResponse>` | Send an arbitrary ACP request |
138
+ | `prompt` | `prompt(input: PromptInput): Promise<PromptResult>` | Send native ACP content blocks and durably commit the turn |
139
+ | `cancelPrompt` | `cancelPrompt(input?: SessionTarget): Promise<CancelPromptResult>` | Cancel active agent work |
140
+ | `onSessionEvent` | `onSessionEvent(sessionId: string, handler: SessionEventHandler): () => void` | Subscribe to native ACP update and permission request/response variants |
141
+ | `respondPermission` | `respondPermission(input: PermissionResponse): Promise<PermissionResponseResult>` | Select an exact adapter-supplied ACP permission option |
142
+ | `getSessionConfig` | `getSessionConfig(input?: SessionTarget): Promise<SessionConfig>` | Read cached native ACP configuration |
143
+ | `setSessionConfigOption` | `setSessionConfigOption(input: SetSessionConfigOptionInput): Promise<SessionConfig>` | Set a native ACP string or boolean option |
144
+ | `readHistory` | `readHistory(input?: ReadHistoryInput): Promise<HistoryPage>` | Read authoritative durable ACP updates and permission events from SQLite |
141
145
 
142
146
  ### Exported Types
143
147
 
144
148
  **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`.
149
+ - `AgentOsOptions` — VM creation options (commandDirs, loopbackExemptPorts, mounts). Use `nodeModulesMount(...)` in `mounts` to expose a host `node_modules` tree at `/root/node_modules`.
146
150
  - `AgentOsSidecarConfig` — shared-pool or explicit-handle sidecar selection for VM creation
147
151
  - `AgentOsSharedSidecarOptions` — shared sidecar pool selection
148
152
  - `AgentOsCreateSidecarOptions` — explicit sidecar handle creation options
149
- - `CreateSessionOptions` — Session options (cwd, env, mcpServers, skipOsInstructions, additionalInstructions)
153
+ - `OpenSessionInput` — Durable session identity and creation options (agent, cwd, env, mcpServers, skipOsInstructions, additionalInstructions)
150
154
 
151
155
  **Sidecar**
152
156
  - `AgentOsSidecarDescription` — Sidecar identity, placement, lifecycle state, and active VM count
@@ -182,17 +186,16 @@ await vm.dispose();
182
186
  - `AgentRegistryEntry` — Registry entry (id, acpAdapter, agentPackage, installed)
183
187
 
184
188
  **Session**
185
- - `SessionInfo` — Session summary (sessionId, agentType)
186
- - `SessionInitData` — Data from ACP initialize response
187
- - `SessionMode` — A mode the agent supports
188
- - `SessionModeState` — Current mode and available modes
189
+ - `SessionInfo` — Durable session summary and current state
190
+ - `SessionStreamEntry` — Generic live union of durable session updates, permission requests/responses, and ephemeral message deltas
191
+ - `DurableSessionEventEntry` — Durable history/event union keyed by session sequence
192
+ - `HistoryPage` — Cursor-based durable event page returned by `readHistory()`
189
193
  - `SessionConfigOption` — A configuration option the agent supports
190
- - `AgentCapabilities` — Boolean capability flags from the agent
191
- - `AgentInfo` — Agent identity (name, version)
192
- - `PermissionRequest` — Permission request from an agent
193
- - `PermissionReply` — `"once" | "always" | "reject"`
194
- - `PermissionRequestHandler` — Handler for permission requests
195
- - `SessionEventHandler` — Handler for live session update events
194
+ - `SessionCapabilities` — Native ACP capabilities cached for a durable session
195
+ - `SessionAgentInfo` — Native ACP adapter identity
196
+ - `PermissionPolicy` — Sidecar-owned `"allow_all" | "reject_all" | "ask"` strategy
197
+ - `PermissionResponse` / `PermissionResponseResult` — Explicit-session native ACP option selection and its accepted/terminal result
198
+ - `SessionEventHandler` — Handler for the generic live session-event union
196
199
 
197
200
  **Protocol**
198
201
  - `JsonRpcRequest`, `JsonRpcResponse`, `JsonRpcNotification`, `JsonRpcError`