@rivet-dev/agentos-core 0.0.0-main.2f99c77 → 0.0.0-main.5ac5a14
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 +10 -196
- package/dist/agent-os.d.ts +508 -271
- package/dist/agent-os.js +2277 -1243
- package/dist/agentos-package.d.ts +6 -4
- package/dist/agentos-package.js +6 -3
- package/dist/base-filesystem.js +2 -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/code-execution.d.ts +70 -0
- package/dist/code-execution.js +115 -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 +7 -5
- package/dist/index.js +5 -5
- package/dist/language-execution.d.ts +170 -0
- package/dist/language-execution.js +1 -0
- package/dist/layers.d.ts +5 -2
- package/dist/layers.js +0 -185
- package/dist/options-schema.d.ts +150 -31
- package/dist/options-schema.js +159 -26
- package/dist/packages.d.ts +1 -1
- package/dist/runtime-compat.d.ts +6 -35
- package/dist/runtime-compat.js +85 -373
- package/dist/runtime.d.ts +5 -1
- package/dist/sandbox.d.ts +4 -4
- package/dist/sandbox.js +34 -21
- package/dist/session-api.d.ts +180 -0
- package/dist/session-api.js +1 -0
- package/dist/sidecar/agentos-protocol.d.ts +434 -32
- package/dist/sidecar/agentos-protocol.js +693 -93
- package/dist/sidecar/rpc-client.d.ts +18 -6
- package/dist/sidecar/rpc-client.js +88 -39
- package/dist/test/runtime.d.ts +2 -1
- package/dist/test/runtime.js +2 -1
- package/dist/test/terminal-harness.js +0 -3
- package/dist/types.d.ts +7 -6
- package/package.json +38 -28
- 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/README.md
CHANGED
|
@@ -1,201 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AgentOS runtime internals
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
7
|
+
Install the public package instead:
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
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 @mariozechner/pi-coding-agent
|
|
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 an agent session
|
|
34
|
-
const { sessionId } = await vm.createSession("pi");
|
|
35
|
-
|
|
36
|
-
// 3. Send a prompt
|
|
37
|
-
const response = await vm.prompt(sessionId, "Write a hello world in TypeScript");
|
|
38
|
-
|
|
39
|
-
// 4. Clean up
|
|
40
|
-
vm.closeSession(sessionId);
|
|
41
|
-
await vm.dispose();
|
|
9
|
+
```sh
|
|
10
|
+
# Actors, sessions, and the complete AgentOS SDK
|
|
11
|
+
pnpm add @rivet-dev/agentos
|
|
42
12
|
```
|
|
43
13
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Lifecycle
|
|
47
|
-
|
|
48
|
-
| Method | Signature | Description |
|
|
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 |
|
|
53
|
-
| `dispose` | `dispose(): Promise<void>` | Shut down the VM and all sessions |
|
|
54
|
-
|
|
55
|
-
### Sidecars
|
|
56
|
-
|
|
57
|
-
| Surface | Signature | Description |
|
|
58
|
-
|--------|-----------|-------------|
|
|
59
|
-
| `sidecar` | `AgentOsSidecar` | Sidecar handle backing the VM |
|
|
60
|
-
| `describe` | `sidecar.describe(): AgentOsSidecarDescription` | Inspect sidecar placement, state, and active VM count |
|
|
61
|
-
| `dispose` | `sidecar.dispose(): Promise<void>` | Dispose the sidecar handle and any active VMs leased from it |
|
|
62
|
-
|
|
63
|
-
### Filesystem
|
|
64
|
-
|
|
65
|
-
| Method | Signature | Description |
|
|
66
|
-
|--------|-----------|-------------|
|
|
67
|
-
| `readFile` | `readFile(path: string): Promise<Uint8Array>` | Read a file |
|
|
68
|
-
| `writeFile` | `writeFile(path: string, content: string \| Uint8Array): Promise<void>` | Write a file |
|
|
69
|
-
| `readFiles` | `readFiles(paths: string[]): Promise<BatchReadResult[]>` | Batch read multiple files |
|
|
70
|
-
| `writeFiles` | `writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>` | Batch write multiple files (creates parent dirs) |
|
|
71
|
-
| `mkdir` | `mkdir(path: string): Promise<void>` | Create a directory |
|
|
72
|
-
| `readdir` | `readdir(path: string): Promise<string[]>` | List directory entries |
|
|
73
|
-
| `readdirRecursive` | `readdirRecursive(path: string, options?: ReaddirRecursiveOptions): Promise<DirEntry[]>` | Recursively list directory contents with metadata |
|
|
74
|
-
| `stat` | `stat(path: string): Promise<VirtualStat>` | Get file/directory metadata |
|
|
75
|
-
| `exists` | `exists(path: string): Promise<boolean>` | Check if a path exists |
|
|
76
|
-
| `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
|
-
|
|
81
|
-
### Process Management
|
|
82
|
-
|
|
83
|
-
| Method | Signature | Description |
|
|
84
|
-
|--------|-----------|-------------|
|
|
85
|
-
| `exec` | `exec(command: string, options?: ExecOptions): Promise<ExecResult>` | Execute a shell command and wait for completion |
|
|
86
|
-
| `spawn` | `spawn(command: string, args: string[], options?: SpawnOptions): { pid: number }` | Spawn a long-running process |
|
|
87
|
-
| `listProcesses` | `listProcesses(): SpawnedProcessInfo[]` | List processes started via `spawn()` |
|
|
88
|
-
| `allProcesses` | `allProcesses(): ProcessInfo[]` | List all kernel processes across all runtimes |
|
|
89
|
-
| `processTree` | `processTree(): ProcessTreeNode[]` | Get processes organized as a parent-child tree |
|
|
90
|
-
| `getProcess` | `getProcess(pid: number): SpawnedProcessInfo` | Get info about a specific spawned process |
|
|
91
|
-
| `stopProcess` | `stopProcess(pid: number): void` | Send SIGTERM to a process |
|
|
92
|
-
| `killProcess` | `killProcess(pid: number): void` | Send SIGKILL to a process |
|
|
93
|
-
|
|
94
|
-
### Network
|
|
95
|
-
|
|
96
|
-
| Method | Signature | Description |
|
|
97
|
-
|--------|-----------|-------------|
|
|
98
|
-
| `fetch` | `fetch(port: number, request: Request): Promise<Response>` | Send an HTTP request to a service running inside the VM |
|
|
99
|
-
|
|
100
|
-
### Shell
|
|
101
|
-
|
|
102
|
-
| Method | Signature | Description |
|
|
103
|
-
|--------|-----------|-------------|
|
|
104
|
-
| `connectTerminal` | `connectTerminal(options?: ConnectTerminalOptions): Promise<number>` | Attach a shell directly to the host terminal and wait for exit |
|
|
105
|
-
| `openShell` | `openShell(options?: OpenShellOptions): { shellId: string }` | Open an interactive shell with PTY support |
|
|
106
|
-
| `writeShell` | `writeShell(shellId: string, data: string \| Uint8Array): void` | Write data to a shell's PTY input |
|
|
107
|
-
| `onShellData` | `onShellData(shellId: string, handler: (data: Uint8Array) => void): () => void` | Subscribe to shell output data |
|
|
108
|
-
| `resizeShell` | `resizeShell(shellId: string, cols: number, rows: number): void` | Notify terminal resize |
|
|
109
|
-
| `closeShell` | `closeShell(shellId: string): void` | Kill the shell process |
|
|
110
|
-
|
|
111
|
-
### Agent Sessions
|
|
112
|
-
|
|
113
|
-
| Method | Signature | Description |
|
|
114
|
-
|--------|-----------|-------------|
|
|
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 |
|
|
118
|
-
|
|
119
|
-
### Agent Registry
|
|
120
|
-
|
|
121
|
-
| Method | Signature | Description |
|
|
122
|
-
|--------|-----------|-------------|
|
|
123
|
-
| `listAgents` | `listAgents(): AgentRegistryEntry[]` | List registered agents with installation status |
|
|
124
|
-
|
|
125
|
-
### Agent Session Operations
|
|
126
|
-
|
|
127
|
-
| Method | Signature | Description |
|
|
128
|
-
|--------|-----------|-------------|
|
|
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 |
|
|
141
|
-
|
|
142
|
-
### Exported Types
|
|
143
|
-
|
|
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
|
|
149
|
-
- `CreateSessionOptions` — Session options (cwd, env, mcpServers, skipOsInstructions, additionalInstructions)
|
|
150
|
-
|
|
151
|
-
**Sidecar**
|
|
152
|
-
- `AgentOsSidecarDescription` — Sidecar identity, placement, lifecycle state, and active VM count
|
|
153
|
-
|
|
154
|
-
**Mount Configurations**
|
|
155
|
-
- `MountConfig` — Union of all mount types
|
|
156
|
-
- `MountConfigMemory` — In-memory filesystem
|
|
157
|
-
- `MountConfigCustom` — Caller-provided VirtualFileSystem
|
|
158
|
-
- `NativeMountConfig` — Declarative sidecar mount plugin configuration
|
|
159
|
-
- `MountConfigOverlay` — Copy-on-write overlay (lower + upper layers)
|
|
160
|
-
- `chunkedS3MountPlugin()` — Declarative S3-compatible native mount plugin descriptor (from `@rivet-dev/agentos-runtime-core/descriptors`)
|
|
161
|
-
|
|
162
|
-
**MCP Servers**
|
|
163
|
-
- `McpServerConfig` — Union of local and remote MCP configs
|
|
164
|
-
- `McpServerConfigLocal` — Local MCP server (command, args, env)
|
|
165
|
-
- `McpServerConfigRemote` — Remote MCP server (url, headers)
|
|
166
|
-
|
|
167
|
-
**Process**
|
|
168
|
-
- `ProcessInfo` — Kernel process info (pid, ppid, pgid, sid, driver, command, args, cwd, status, exitCode, startTime, exitTime)
|
|
169
|
-
- `SpawnedProcessInfo` — Info for processes created via `spawn()` (pid, command, args, running, exitCode)
|
|
170
|
-
- `ProcessTreeNode` — ProcessInfo with `children: ProcessTreeNode[]`
|
|
171
|
-
|
|
172
|
-
**Filesystem**
|
|
173
|
-
- `DirEntry` — Directory entry (path, type, size)
|
|
174
|
-
- `ReaddirRecursiveOptions` — Options for recursive listing (maxDepth, exclude)
|
|
175
|
-
- `BatchWriteEntry` — Entry for batch writes (path, content)
|
|
176
|
-
- `BatchWriteResult` — Result of a batch write (path, success, error?)
|
|
177
|
-
- `BatchReadResult` — Result of a batch read (path, content, error?)
|
|
178
|
-
|
|
179
|
-
**Agent**
|
|
180
|
-
- `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
|
|
181
|
-
- `AgentConfig` — Agent configuration (adapterEntrypoint, launchArgs, defaultEnv)
|
|
182
|
-
- `AgentRegistryEntry` — Registry entry (id, acpAdapter, agentPackage, installed)
|
|
183
|
-
|
|
184
|
-
**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
|
-
- `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
|
|
196
|
-
|
|
197
|
-
**Protocol**
|
|
198
|
-
- `JsonRpcRequest`, `JsonRpcResponse`, `JsonRpcNotification`, `JsonRpcError`
|
|
199
|
-
|
|
200
|
-
**Backends**
|
|
201
|
-
- `HostDirBackendOptions` — Options for the `createHostDirBackend()` native host-dir plugin helper
|
|
14
|
+
See the [AgentOS documentation](https://agentos-sdk.dev/docs) for supported
|
|
15
|
+
APIs.
|