@rivet-dev/agentos-core 0.0.0-integrate-dylib-into-main.815fcda → 0.0.0-main.29b0797

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 (125) hide show
  1. package/README.md +43 -43
  2. package/dist/agent-os.d.ts +313 -226
  3. package/dist/agent-os.js +1418 -1545
  4. package/dist/agentos-package.d.ts +31 -0
  5. package/dist/agentos-package.js +91 -0
  6. package/dist/base-filesystem.d.ts +2 -15
  7. package/dist/base-filesystem.js +23 -171
  8. package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
  9. package/dist/{host-tools-zod.js → bindings-zod.js} +52 -25
  10. package/dist/bindings.d.ts +43 -0
  11. package/dist/bindings.js +34 -0
  12. package/dist/cron/cron-manager.js +43 -10
  13. package/dist/cron/index.d.ts +1 -1
  14. package/dist/cron/types.d.ts +26 -10
  15. package/dist/default-software.d.ts +8 -0
  16. package/dist/default-software.js +10 -0
  17. package/dist/filesystem-snapshot.d.ts +1 -2
  18. package/dist/filesystem-snapshot.js +0 -43
  19. package/dist/generated/AcpLimitsConfig.d.ts +20 -0
  20. package/dist/generated/AcpLimitsConfig.js +2 -0
  21. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  22. package/dist/generated/BindingLimitsConfig.js +2 -0
  23. package/dist/generated/CreateVmConfig.d.ts +28 -0
  24. package/dist/generated/FsPermissionRule.d.ts +6 -0
  25. package/dist/generated/FsPermissionRule.js +1 -0
  26. package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
  27. package/dist/generated/FsPermissionRuleSet.js +1 -0
  28. package/dist/generated/FsPermissionScope.d.ts +3 -0
  29. package/dist/generated/FsPermissionScope.js +1 -0
  30. package/dist/generated/HttpLimitsConfig.d.ts +3 -0
  31. package/dist/generated/HttpLimitsConfig.js +2 -0
  32. package/dist/generated/JsModuleResolution.d.ts +1 -0
  33. package/dist/generated/JsModuleResolution.js +2 -0
  34. package/dist/generated/JsRuntimeConfig.d.ts +31 -0
  35. package/dist/generated/JsRuntimeConfig.js +1 -0
  36. package/dist/generated/JsRuntimeLimitsConfig.d.ts +11 -0
  37. package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
  38. package/dist/generated/JsRuntimePlatform.d.ts +1 -0
  39. package/dist/generated/JsRuntimePlatform.js +2 -0
  40. package/dist/generated/MountPluginDescriptor.d.ts +4 -0
  41. package/dist/generated/MountPluginDescriptor.js +2 -0
  42. package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
  43. package/dist/generated/NativeRootFilesystemConfig.js +1 -0
  44. package/dist/generated/PatternPermissionRule.d.ts +6 -0
  45. package/dist/generated/PatternPermissionRule.js +1 -0
  46. package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
  47. package/dist/generated/PatternPermissionRuleSet.js +1 -0
  48. package/dist/generated/PatternPermissionScope.d.ts +3 -0
  49. package/dist/generated/PatternPermissionScope.js +1 -0
  50. package/dist/generated/PermissionMode.d.ts +1 -0
  51. package/dist/generated/PermissionMode.js +2 -0
  52. package/dist/generated/PermissionsPolicy.d.ts +10 -0
  53. package/dist/generated/PermissionsPolicy.js +1 -0
  54. package/dist/generated/PluginLimitsConfig.d.ts +4 -0
  55. package/dist/generated/PluginLimitsConfig.js +2 -0
  56. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  57. package/dist/generated/ProcessLimitsConfig.js +2 -0
  58. package/dist/generated/PythonLimitsConfig.d.ts +6 -0
  59. package/dist/generated/PythonLimitsConfig.js +2 -0
  60. package/dist/generated/ResourceLimitsConfig.d.ts +24 -0
  61. package/dist/generated/ResourceLimitsConfig.js +2 -0
  62. package/dist/generated/RootFilesystemConfig.d.ts +9 -0
  63. package/dist/generated/RootFilesystemConfig.js +1 -0
  64. package/dist/generated/RootFilesystemEntry.d.ts +13 -0
  65. package/dist/generated/RootFilesystemEntry.js +1 -0
  66. package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
  67. package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
  68. package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
  69. package/dist/generated/RootFilesystemEntryKind.js +2 -0
  70. package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
  71. package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
  72. package/dist/generated/RootFilesystemMode.d.ts +1 -0
  73. package/dist/generated/RootFilesystemMode.js +2 -0
  74. package/dist/generated/VmDnsConfig.d.ts +6 -0
  75. package/dist/generated/VmDnsConfig.js +2 -0
  76. package/dist/generated/VmGroupConfig.d.ts +5 -0
  77. package/dist/generated/VmGroupConfig.js +2 -0
  78. package/dist/generated/VmLimitsConfig.d.ts +20 -0
  79. package/dist/generated/VmLimitsConfig.js +1 -0
  80. package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
  81. package/dist/generated/VmListenPolicyConfig.js +2 -0
  82. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  83. package/dist/generated/VmUserAccountConfig.js +2 -0
  84. package/dist/generated/VmUserConfig.d.ts +19 -0
  85. package/dist/generated/VmUserConfig.js +1 -0
  86. package/dist/generated/WasmLimitsConfig.d.ts +8 -0
  87. package/dist/generated/WasmLimitsConfig.js +2 -0
  88. package/dist/host-dir-mount.d.ts +1 -1
  89. package/dist/index.d.ts +6 -5
  90. package/dist/index.js +5 -5
  91. package/dist/layers.d.ts +7 -4
  92. package/dist/layers.js +0 -176
  93. package/dist/options-schema.d.ts +556 -0
  94. package/dist/options-schema.js +386 -0
  95. package/dist/packages.d.ts +17 -116
  96. package/dist/packages.js +35 -322
  97. package/dist/runtime-compat.d.ts +33 -46
  98. package/dist/runtime-compat.js +197 -511
  99. package/dist/runtime.d.ts +42 -8
  100. package/dist/sandbox.d.ts +112 -0
  101. package/dist/sandbox.js +264 -0
  102. package/dist/session-api.d.ts +180 -0
  103. package/dist/session-api.js +1 -0
  104. package/dist/sidecar/agentos-protocol.d.ts +509 -20
  105. package/dist/sidecar/agentos-protocol.js +808 -81
  106. package/dist/sidecar/native-process-client.d.ts +6 -2
  107. package/dist/sidecar/native-process-client.js +8 -1
  108. package/dist/sidecar/permissions.d.ts +1 -1
  109. package/dist/sidecar/permissions.js +4 -4
  110. package/dist/sidecar/rpc-client.d.ts +100 -9
  111. package/dist/sidecar/rpc-client.js +445 -110
  112. package/dist/test/runtime.d.ts +2 -1
  113. package/dist/test/runtime.js +2 -1
  114. package/dist/test/terminal-harness.js +0 -3
  115. package/dist/types.d.ts +13 -7
  116. package/package.json +46 -35
  117. package/dist/agent-session-types.d.ts +0 -67
  118. package/dist/agents.d.ts +0 -63
  119. package/dist/agents.js +0 -42
  120. package/dist/host-tools.d.ts +0 -45
  121. package/dist/host-tools.js +0 -26
  122. package/dist/overlay-filesystem.d.ts +0 -19
  123. package/dist/overlay-filesystem.js +0 -645
  124. package/fixtures/AGENTOS_SYSTEM_PROMPT.md +0 -21
  125. /package/dist/{agent-session-types.js → generated/CreateVmConfig.js} +0 -0
package/README.md CHANGED
@@ -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 @rivet-dev/agentos-pi @mariozechner/pi-coding-agent
24
+ npm install @agentos-software/pi @mariozechner/pi-coding-agent
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
 
@@ -104,7 +111,7 @@ await vm.dispose();
104
111
  | `connectTerminal` | `connectTerminal(options?: ConnectTerminalOptions): Promise<number>` | Attach a shell directly to the host terminal and wait for exit |
105
112
  | `openShell` | `openShell(options?: OpenShellOptions): { shellId: string }` | Open an interactive shell with PTY support |
106
113
  | `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 |
114
+ | `onShellData` | `onShellData(shellId: string, handler: (data: Uint8Array) => void): () => void` | Subscribe to ordered PTY output (stdout and stderr exactly once) |
108
115
  | `resizeShell` | `resizeShell(shellId: string, cols: number, rows: number): void` | Notify terminal resize |
109
116
  | `closeShell` | `closeShell(shellId: string): void` | Kill the shell process |
110
117
 
@@ -112,9 +119,11 @@ await vm.dispose();
112
119
 
113
120
  | Method | Signature | Description |
114
121
  |--------|-----------|-------------|
115
- | `createSession` | `createSession(agentType: AgentType \| string, 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
@@ -157,10 +161,7 @@ await vm.dispose();
157
161
  - `MountConfigCustom` — Caller-provided VirtualFileSystem
158
162
  - `NativeMountConfig` — Declarative sidecar mount plugin configuration
159
163
  - `MountConfigOverlay` — Copy-on-write overlay (lower + upper layers)
160
-
161
- **Companion Filesystem Packages**
162
- - `createGoogleDriveBackend()` — Declarative Google Drive native mount helper from `@secure-exec/google-drive`
163
- - `createS3Backend()` — Declarative S3-compatible native mount helper from `@secure-exec/s3`
164
+ - `chunkedS3MountPlugin()` — Declarative S3-compatible native mount plugin descriptor (from `@rivet-dev/agentos-runtime-core/descriptors`)
164
165
 
165
166
  **MCP Servers**
166
167
  - `McpServerConfig` — Union of local and remote MCP configs
@@ -180,22 +181,21 @@ await vm.dispose();
180
181
  - `BatchReadResult` — Result of a batch read (path, content, error?)
181
182
 
182
183
  **Agent**
183
- - `AgentType` — `"pi" | "pi-cli" | "opencode" | "claude"`
184
- - `AgentConfig` — Agent configuration (acpAdapter, agentPackage, prepareInstructions)
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)
185
186
  - `AgentRegistryEntry` — Registry entry (id, acpAdapter, agentPackage, installed)
186
187
 
187
188
  **Session**
188
- - `SessionInfo` — Session summary (sessionId, agentType)
189
- - `SessionInitData` — Data from ACP initialize response
190
- - `SessionMode` — A mode the agent supports
191
- - `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()`
192
193
  - `SessionConfigOption` — A configuration option the agent supports
193
- - `AgentCapabilities` — Boolean capability flags from the agent
194
- - `AgentInfo` — Agent identity (name, version)
195
- - `PermissionRequest` — Permission request from an agent
196
- - `PermissionReply` — `"once" | "always" | "reject"`
197
- - `PermissionRequestHandler` — Handler for permission requests
198
- - `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
199
199
 
200
200
  **Protocol**
201
201
  - `JsonRpcRequest`, `JsonRpcResponse`, `JsonRpcNotification`, `JsonRpcError`