@rivet-dev/agentos-core 0.0.0-integrate-dylib-into-main.815fcda → 0.0.0-nathan-binding-workspace.dd41c31
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 +12 -12
- package/dist/{agent-os.d.ts → agentos.d.ts} +30 -85
- package/dist/{agent-os.js → agentos.js} +126 -185
- package/dist/agents.d.ts +1 -1
- package/dist/agents.js +1 -1
- package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
- package/dist/{host-tools-zod.js → bindings-zod.js} +16 -16
- package/dist/bindings.d.ts +45 -0
- package/dist/bindings.js +26 -0
- package/dist/cron/cron-manager.d.ts +3 -3
- package/dist/cron/cron-manager.js +1 -1
- package/dist/cron/types.d.ts +1 -1
- package/dist/host-dir-mount.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/json-rpc.d.ts +1 -17
- package/dist/json-rpc.js +0 -8
- package/dist/packages.js +1 -1
- package/dist/runtime-compat.d.ts +2 -2
- package/dist/runtime-compat.js +6 -5
- package/dist/runtime.d.ts +2 -2
- package/dist/sidecar/agentos-protocol.d.ts +0 -36
- package/dist/sidecar/agentos-protocol.js +1 -41
- package/dist/sidecar/native-process-client.d.ts +3 -2
- package/dist/sidecar/native-process-client.js +6 -1
- package/dist/sidecar/permissions.js +4 -4
- package/dist/sidecar/process.d.ts +4 -4
- package/dist/sidecar/process.js +3 -3
- package/dist/sidecar/rpc-client.d.ts +40 -40
- package/dist/sidecar/rpc-client.js +8 -8
- package/dist/test/runtime.d.ts +1 -1
- package/dist/test/runtime.js +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +6 -5
- package/dist/host-tools.d.ts +0 -45
- package/dist/host-tools.js +0 -26
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 {
|
|
28
|
+
import { AgentOS } from "@rivet-dev/agentos-core";
|
|
29
29
|
|
|
30
30
|
// 1. Create a VM
|
|
31
|
-
const vm = await
|
|
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?:
|
|
51
|
-
| `getSharedSidecar` | `static getSharedSidecar(options?:
|
|
52
|
-
| `createSidecar` | `static createSidecar(options?:
|
|
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` | `
|
|
60
|
-
| `describe` | `sidecar.describe():
|
|
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
|
-
- `
|
|
146
|
-
- `
|
|
147
|
-
- `
|
|
148
|
-
- `
|
|
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
|
-
- `
|
|
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
|
|
3
|
+
import { type Bindings } from "./bindings.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
|
|
59
|
-
export interface
|
|
58
|
+
import { type AgentOSSidecarPlacement } from "./sidecar/rpc-client.js";
|
|
59
|
+
export interface AgentOSSharedSidecarOptions {
|
|
60
60
|
pool?: string;
|
|
61
61
|
}
|
|
62
|
-
export interface
|
|
62
|
+
export interface AgentOSCreateSidecarOptions {
|
|
63
63
|
sidecarId?: string;
|
|
64
64
|
}
|
|
65
|
-
export type
|
|
65
|
+
export type AgentOSSidecarConfig = {
|
|
66
66
|
kind: "shared";
|
|
67
67
|
pool?: string;
|
|
68
68
|
} | {
|
|
69
69
|
kind: "explicit";
|
|
70
|
-
handle:
|
|
70
|
+
handle: AgentOSSidecar;
|
|
71
71
|
};
|
|
72
|
-
export interface
|
|
72
|
+
export interface AgentOSSidecarDescription {
|
|
73
73
|
sidecarId: string;
|
|
74
|
-
placement:
|
|
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
|
|
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
|
|
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,14 +199,6 @@ 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;
|
|
210
202
|
/** Loopback ports to exempt from SSRF checks (for testing with host-side mock servers). */
|
|
211
203
|
loopbackExemptPorts?: number[];
|
|
212
204
|
/**
|
|
@@ -227,8 +219,8 @@ export interface AgentOsOptions {
|
|
|
227
219
|
additionalInstructions?: string;
|
|
228
220
|
/** Custom schedule driver for cron jobs. Defaults to TimerScheduleDriver. */
|
|
229
221
|
scheduleDriver?: ScheduleDriver;
|
|
230
|
-
/** Host-side
|
|
231
|
-
|
|
222
|
+
/** Host-side bindings available to agents inside the VM. */
|
|
223
|
+
bindings?: Bindings[];
|
|
232
224
|
/**
|
|
233
225
|
* Custom permission policy for the kernel. Controls access to filesystem,
|
|
234
226
|
* network, child process, and environment operations. Defaults to allowAll.
|
|
@@ -238,12 +230,12 @@ export interface AgentOsOptions {
|
|
|
238
230
|
* Sidecar placement for the VM. Defaults to the shared `default` pool.
|
|
239
231
|
* Pass an explicit sidecar handle to pin the VM to a caller-managed sidecar.
|
|
240
232
|
*/
|
|
241
|
-
sidecar?:
|
|
233
|
+
sidecar?: AgentOSSidecarConfig;
|
|
242
234
|
/**
|
|
243
235
|
* Operator-tunable runtime limits. Unset fields use built-in defaults that match the
|
|
244
236
|
* runtime's historical constants, so omitting this leaves behavior unchanged.
|
|
245
237
|
*/
|
|
246
|
-
limits?:
|
|
238
|
+
limits?: AgentOSLimits;
|
|
247
239
|
}
|
|
248
240
|
/** Configuration for a local MCP server (spawned as a child process). */
|
|
249
241
|
export interface McpServerConfigLocal {
|
|
@@ -264,11 +256,11 @@ export interface McpServerConfigRemote {
|
|
|
264
256
|
headers?: Record<string, string>;
|
|
265
257
|
}
|
|
266
258
|
export type McpServerConfig = McpServerConfigLocal | McpServerConfigRemote;
|
|
267
|
-
export interface
|
|
259
|
+
export interface AgentOSRuntimeAdmin {
|
|
268
260
|
kernel: Kernel;
|
|
269
261
|
rootView: VirtualFileSystem;
|
|
270
262
|
env: Record<string, string>;
|
|
271
|
-
sidecar:
|
|
263
|
+
sidecar: AgentOSSidecar;
|
|
272
264
|
}
|
|
273
265
|
export interface CreateSessionOptions {
|
|
274
266
|
/** Working directory for the agent session inside the VM. */
|
|
@@ -282,49 +274,18 @@ export interface CreateSessionOptions {
|
|
|
282
274
|
/** Additional instructions appended to the base OS instructions. */
|
|
283
275
|
additionalInstructions?: string;
|
|
284
276
|
}
|
|
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
|
-
}
|
|
316
277
|
export interface SessionInfo {
|
|
317
278
|
sessionId: string;
|
|
318
279
|
agentType: string;
|
|
319
280
|
}
|
|
320
|
-
/** Result from
|
|
281
|
+
/** Result from AgentOS.prompt(). */
|
|
321
282
|
export interface PromptResult {
|
|
322
283
|
/** Raw JSON-RPC response from the ACP adapter. */
|
|
323
284
|
response: JsonRpcResponse;
|
|
324
285
|
/** Accumulated agent text output from streamed message chunks. */
|
|
325
286
|
text: string;
|
|
326
287
|
}
|
|
327
|
-
/** Information about a process spawned via
|
|
288
|
+
/** Information about a process spawned via AgentOS.spawn(). */
|
|
328
289
|
export interface SpawnedProcessInfo {
|
|
329
290
|
pid: number;
|
|
330
291
|
command: string;
|
|
@@ -332,9 +293,9 @@ export interface SpawnedProcessInfo {
|
|
|
332
293
|
running: boolean;
|
|
333
294
|
exitCode: number | null;
|
|
334
295
|
}
|
|
335
|
-
export declare class
|
|
296
|
+
export declare class AgentOS {
|
|
336
297
|
#private;
|
|
337
|
-
readonly sidecar:
|
|
298
|
+
readonly sidecar: AgentOSSidecar;
|
|
338
299
|
private _sessions;
|
|
339
300
|
private _closedSessionIds;
|
|
340
301
|
private _sessionClosePromises;
|
|
@@ -349,7 +310,7 @@ export declare class AgentOs {
|
|
|
349
310
|
private _softwareRoots;
|
|
350
311
|
private _softwareAgentConfigs;
|
|
351
312
|
private _cronManager;
|
|
352
|
-
private
|
|
313
|
+
private _bindings;
|
|
353
314
|
private _toolReference;
|
|
354
315
|
private _permissions;
|
|
355
316
|
private _hostMounts;
|
|
@@ -361,9 +322,9 @@ export declare class AgentOs {
|
|
|
361
322
|
private readonly _sidecarVm;
|
|
362
323
|
private readonly _disposeSidecarEventListener;
|
|
363
324
|
private constructor();
|
|
364
|
-
static createSidecar(options?:
|
|
365
|
-
static getSharedSidecar(options?:
|
|
366
|
-
static create(options?:
|
|
325
|
+
static createSidecar(options?: AgentOSCreateSidecarOptions): Promise<AgentOSSidecar>;
|
|
326
|
+
static getSharedSidecar(options?: AgentOSSharedSidecarOptions): Promise<AgentOSSidecar>;
|
|
327
|
+
static create(options?: AgentOSOptions): Promise<AgentOS>;
|
|
367
328
|
exec(command: string, options?: KernelExecOptions): Promise<KernelExecResult>;
|
|
368
329
|
execArgv(command: string, args?: readonly string[], options?: KernelExecOptions): Promise<KernelExecResult>;
|
|
369
330
|
private _trackProcess;
|
|
@@ -462,22 +423,6 @@ export declare class AgentOs {
|
|
|
462
423
|
createSession(agentType: AgentType | string, options?: CreateSessionOptions): Promise<{
|
|
463
424
|
sessionId: string;
|
|
464
425
|
}>;
|
|
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>;
|
|
481
426
|
/**
|
|
482
427
|
* Resolve the VM bin entry point of an ACP adapter package.
|
|
483
428
|
* Reads from the host filesystem since kernel.readFile() resolves through
|
|
@@ -557,17 +502,17 @@ export declare class AgentOs {
|
|
|
557
502
|
onCronEvent(handler: CronEventHandler): void;
|
|
558
503
|
dispose(): Promise<void>;
|
|
559
504
|
}
|
|
560
|
-
export declare function
|
|
561
|
-
export declare function
|
|
562
|
-
export declare class
|
|
563
|
-
constructor(sidecarId: string, placement:
|
|
564
|
-
describe():
|
|
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;
|
|
565
510
|
dispose(): Promise<void>;
|
|
566
511
|
}
|
|
567
512
|
/**
|
|
568
513
|
* Test-only escape hatch: dispose every cached shared sidecar so vitest
|
|
569
514
|
* workers can exit cleanly. The shared sidecar is normally process-global and
|
|
570
|
-
* keeps its native subprocess alive across `
|
|
515
|
+
* keeps its native subprocess alive across `AgentOS.create()` calls; without
|
|
571
516
|
* this hook the vitest worker can hold open piped stdio handles after the
|
|
572
517
|
* test suite finishes and stall `pnpm test` indefinitely.
|
|
573
518
|
*/
|