@rivet-dev/agentos-core 0.2.14 → 0.2.16-rc.1

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
@@ -1,204 +1,15 @@
1
- # @rivet-dev/agentos-core
1
+ # AgentOS runtime internals
2
2
 
3
- A high-level SDK for running coding agents in isolated VMs. agentOS manages the full lifecycle of virtual machines -- from filesystem setup and process management to launching AI agents via the Agent Client Protocol (ACP).
3
+ `@rivet-dev/agentos-core` is the shared runtime implementation used by the
4
+ public AgentOS packages. It is published only as a transitive dependency and is
5
+ not a supported user-facing install target.
4
6
 
5
- Agents run inside isolated VMs with their own filesystem, process table, and network stack. The host only communicates through well-defined APIs, keeping agent execution fully contained.
7
+ Install the public package instead:
6
8
 
7
- ## Features
8
-
9
- - **VM lifecycle** — create, configure, and dispose isolated virtual machines
10
- - **Sidecar placement** — reuse the default shared sidecar or inject an explicit sidecar handle
11
- - **Agent sessions (ACP)** — launch coding agents (Pi, OpenCode, Claude) via JSON-RPC over stdio
12
- - **Filesystem operations** — read, write, mkdir, stat, move, delete, recursive listing, batch read/write
13
- - **Process management** — spawn, exec, stop, kill processes; inspect process trees across all runtimes
14
- - **Agent registry** — discover available agents and their installation status
15
- - **Networking** — reach services running inside the VM via `fetch()`
16
- - **Shell access** — open interactive shells with PTY support
17
- - **Mount backends** — memory, native host directory mounts, S3, overlay (copy-on-write), or custom VirtualFileSystem
18
-
19
- ## Quick Start
20
-
21
- ```bash
22
- npm install @rivet-dev/agentos-core
23
- # Install an agent adapter + its underlying agent
24
- npm install @agentos-software/pi
25
- ```
26
-
27
- ```typescript
28
- import { AgentOs } from "@rivet-dev/agentos-core";
29
-
30
- // 1. Create a VM
31
- const vm = await AgentOs.create();
32
-
33
- // 2. Create the default agent session
34
- await vm.openSession({ agent: "pi" });
35
-
36
- // 3. Send a prompt
37
- const response = await vm.prompt({
38
- content: [{ type: "text", text: "Write a hello world in TypeScript" }],
39
- });
40
-
41
- // 4. Clean up
42
- await vm.deleteSession();
43
- await vm.dispose();
9
+ ```sh
10
+ # Actors, sessions, and the complete AgentOS SDK
11
+ pnpm add @rivet-dev/agentos
44
12
  ```
45
13
 
46
- ## API Reference
47
-
48
- ### Lifecycle
49
-
50
- | Method | Signature | Description |
51
- |--------|-----------|-------------|
52
- | `create` | `static create(options?: AgentOsOptions): Promise<AgentOs>` | Create and boot a new VM |
53
- | `getSharedSidecar` | `static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>` | Get or create a shared sidecar handle for a pool |
54
- | `createSidecar` | `static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>` | Create an explicit sidecar handle |
55
- | `dispose` | `dispose(): Promise<void>` | Shut down the VM and all sessions |
56
-
57
- ### Sidecars
58
-
59
- | Surface | Signature | Description |
60
- |--------|-----------|-------------|
61
- | `sidecar` | `AgentOsSidecar` | Sidecar handle backing the VM |
62
- | `describe` | `sidecar.describe(): AgentOsSidecarDescription` | Inspect sidecar placement, state, and active VM count |
63
- | `dispose` | `sidecar.dispose(): Promise<void>` | Dispose the sidecar handle and any active VMs leased from it |
64
-
65
- ### Filesystem
66
-
67
- | Method | Signature | Description |
68
- |--------|-----------|-------------|
69
- | `readFile` | `readFile(path: string): Promise<Uint8Array>` | Read a file |
70
- | `writeFile` | `writeFile(path: string, content: string \| Uint8Array): Promise<void>` | Write a file |
71
- | `readFiles` | `readFiles(paths: string[]): Promise<BatchReadResult[]>` | Batch read multiple files |
72
- | `writeFiles` | `writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>` | Batch write multiple files (creates parent dirs) |
73
- | `mkdir` | `mkdir(path: string): Promise<void>` | Create a directory |
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 |
76
- | `readdirRecursive` | `readdirRecursive(path: string, options?: ReaddirRecursiveOptions): Promise<DirEntry[]>` | Recursively list directory contents with metadata |
77
- | `stat` | `stat(path: string): Promise<VirtualStat>` | Get file/directory metadata |
78
- | `exists` | `exists(path: string): Promise<boolean>` | Check if a path exists |
79
- | `move` | `move(from: string, to: string): Promise<void>` | Rename/move a file or directory |
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 |
85
-
86
- ### Process Management
87
-
88
- | Method | Signature | Description |
89
- |--------|-----------|-------------|
90
- | `exec` | `exec(command: string, options?: ExecOptions): Promise<ExecResult>` | Execute a shell command and wait for completion |
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 |
94
- | `listProcesses` | `listProcesses(): SpawnedProcessInfo[]` | List processes started via `spawn()` |
95
- | `allProcesses` | `allProcesses(): ProcessInfo[]` | List all kernel processes across all runtimes |
96
- | `processTree` | `processTree(): ProcessTreeNode[]` | Get processes organized as a parent-child tree |
97
- | `getProcess` | `getProcess(pid: number): SpawnedProcessInfo` | Get info about a specific spawned process |
98
- | `stopProcess` | `stopProcess(pid: number): void` | Send SIGTERM to a process |
99
- | `killProcess` | `killProcess(pid: number): void` | Send SIGKILL to a process |
100
-
101
- ### Network
102
-
103
- | Method | Signature | Description |
104
- |--------|-----------|-------------|
105
- | `httpRequest` | `httpRequest(request: HttpRequest): Promise<HttpResponse>` | Send a buffered HTTP request to a service running inside the VM |
106
-
107
- ### Shell
108
-
109
- | Method | Signature | Description |
110
- |--------|-----------|-------------|
111
- | `connectTerminal` | `connectTerminal(options?: ConnectTerminalOptions): Promise<number>` | Attach a shell directly to the host terminal and wait for exit |
112
- | `openShell` | `openShell(options?: OpenShellOptions): { shellId: string }` | Open an interactive shell with PTY support |
113
- | `writeShell` | `writeShell(shellId: string, data: string \| Uint8Array): void` | Write data to a shell's PTY input |
114
- | `onShellData` | `onShellData(shellId: string, handler: (data: Uint8Array) => void): () => void` | Subscribe to ordered PTY output (stdout and stderr exactly once) |
115
- | `resizeShell` | `resizeShell(shellId: string, cols: number, rows: number): void` | Notify terminal resize |
116
- | `closeShell` | `closeShell(shellId: string): void` | Kill the shell process |
117
-
118
- ### Agent Sessions
119
-
120
- | Method | Signature | Description |
121
- |--------|-----------|-------------|
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 |
127
-
128
- ### Agent Registry
129
-
130
- | Method | Signature | Description |
131
- |--------|-----------|-------------|
132
- | `listAgents` | `listAgents(): AgentRegistryEntry[]` | List registered agents with installation status |
133
-
134
- ### Agent Session Operations
135
-
136
- | Method | Signature | Description |
137
- |--------|-----------|-------------|
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 |
145
-
146
- ### Exported Types
147
-
148
- **VM & Options**
149
- - `AgentOsOptions` — VM creation options (commandDirs, loopbackExemptPorts, mounts). Use `nodeModulesMount(...)` in `mounts` to expose a host `node_modules` tree at `/root/node_modules`.
150
- - `AgentOsSidecarConfig` — shared-pool or explicit-handle sidecar selection for VM creation
151
- - `AgentOsSharedSidecarOptions` — shared sidecar pool selection
152
- - `AgentOsCreateSidecarOptions` — explicit sidecar handle creation options
153
- - `OpenSessionInput` — Durable session identity and creation options (agent, cwd, env, mcpServers, skipOsInstructions, additionalInstructions)
154
-
155
- **Sidecar**
156
- - `AgentOsSidecarDescription` — Sidecar identity, placement, lifecycle state, and active VM count
157
-
158
- **Mount Configurations**
159
- - `MountConfig` — Union of all mount types
160
- - `MountConfigMemory` — In-memory filesystem
161
- - `MountConfigCustom` — Caller-provided VirtualFileSystem
162
- - `NativeMountConfig` — Declarative sidecar mount plugin configuration
163
- - `MountConfigOverlay` — Copy-on-write overlay (lower + upper layers)
164
- - `chunkedS3MountPlugin()` — Declarative S3-compatible native mount plugin descriptor (from `@rivet-dev/agentos-runtime-core/descriptors`)
165
-
166
- **MCP Servers**
167
- - `McpServerConfig` — Union of local and remote MCP configs
168
- - `McpServerConfigLocal` — Local MCP server (command, args, env)
169
- - `McpServerConfigRemote` — Remote MCP server (url, headers)
170
-
171
- **Process**
172
- - `ProcessInfo` — Kernel process info (pid, ppid, pgid, sid, driver, command, args, cwd, status, exitCode, startTime, exitTime)
173
- - `SpawnedProcessInfo` — Info for processes created via `spawn()` (pid, command, args, running, exitCode)
174
- - `ProcessTreeNode` — ProcessInfo with `children: ProcessTreeNode[]`
175
-
176
- **Filesystem**
177
- - `DirEntry` — Directory entry (path, type, size)
178
- - `ReaddirRecursiveOptions` — Options for recursive listing (maxDepth, exclude)
179
- - `BatchWriteEntry` — Entry for batch writes (path, content)
180
- - `BatchWriteResult` — Result of a batch write (path, success, error?)
181
- - `BatchReadResult` — Result of a batch read (path, content, error?)
182
-
183
- **Agent**
184
- - `AgentType` — `string` (a package manifest `name`, e.g. `"pi"`, `"claude"`); agents are resolved dynamically from the configured `/opt/agentos` package manifests, so any manifest `name` is valid
185
- - `AgentConfig` — Agent configuration (adapterEntrypoint, launchArgs, defaultEnv)
186
- - `AgentRegistryEntry` — Registry entry (id, acpAdapter, agentPackage, installed)
187
-
188
- **Session**
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()`
193
- - `SessionConfigOption` — A configuration option the agent supports
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
199
-
200
- **Protocol**
201
- - `JsonRpcRequest`, `JsonRpcResponse`, `JsonRpcNotification`, `JsonRpcError`
202
-
203
- **Backends**
204
- - `HostDirBackendOptions` — Options for the `createHostDirBackend()` native host-dir plugin helper
14
+ See the [AgentOS documentation](https://agentos-sdk.dev/docs) for supported
15
+ APIs.