@rivet-dev/agentos-core 0.0.0-integrate-dylib-into-main.815fcda → 0.0.0-main.5bf5901
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 +5 -8
- package/dist/agent-os.d.ts +168 -46
- package/dist/agent-os.js +809 -543
- package/dist/agentos-package.d.ts +29 -0
- package/dist/agentos-package.js +88 -0
- package/dist/base-filesystem.d.ts +2 -15
- package/dist/base-filesystem.js +23 -171
- package/dist/cron/types.d.ts +1 -1
- package/dist/default-software.d.ts +8 -0
- package/dist/default-software.js +10 -0
- package/dist/generated/AcpLimitsConfig.d.ts +4 -0
- package/dist/generated/AcpLimitsConfig.js +2 -0
- package/dist/generated/CreateVmConfig.d.ts +26 -0
- package/dist/generated/CreateVmConfig.js +1 -0
- package/dist/generated/FsPermissionRule.d.ts +6 -0
- package/dist/generated/FsPermissionRule.js +1 -0
- package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.js +1 -0
- package/dist/generated/FsPermissionScope.d.ts +3 -0
- package/dist/generated/FsPermissionScope.js +1 -0
- package/dist/generated/HttpLimitsConfig.d.ts +3 -0
- package/dist/generated/HttpLimitsConfig.js +2 -0
- package/dist/generated/JsModuleResolution.d.ts +1 -0
- package/dist/generated/JsModuleResolution.js +2 -0
- package/dist/generated/JsRuntimeConfig.d.ts +31 -0
- package/dist/generated/JsRuntimeConfig.js +1 -0
- package/dist/generated/JsRuntimeLimitsConfig.d.ts +11 -0
- package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
- package/dist/generated/JsRuntimePlatform.d.ts +1 -0
- package/dist/generated/JsRuntimePlatform.js +2 -0
- package/dist/generated/MountPluginDescriptor.d.ts +4 -0
- package/dist/generated/MountPluginDescriptor.js +2 -0
- package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
- package/dist/generated/NativeRootFilesystemConfig.js +1 -0
- package/dist/generated/PatternPermissionRule.d.ts +6 -0
- package/dist/generated/PatternPermissionRule.js +1 -0
- package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
- package/dist/generated/PatternPermissionRuleSet.js +1 -0
- package/dist/generated/PatternPermissionScope.d.ts +3 -0
- package/dist/generated/PatternPermissionScope.js +1 -0
- package/dist/generated/PermissionMode.d.ts +1 -0
- package/dist/generated/PermissionMode.js +2 -0
- package/dist/generated/PermissionsPolicy.d.ts +10 -0
- package/dist/generated/PermissionsPolicy.js +1 -0
- package/dist/generated/PluginLimitsConfig.d.ts +4 -0
- package/dist/generated/PluginLimitsConfig.js +2 -0
- package/dist/generated/PythonLimitsConfig.d.ts +6 -0
- package/dist/generated/PythonLimitsConfig.js +2 -0
- package/dist/generated/ResourceLimitsConfig.d.ts +24 -0
- package/dist/generated/ResourceLimitsConfig.js +2 -0
- package/dist/generated/RootFilesystemConfig.d.ts +9 -0
- package/dist/generated/RootFilesystemConfig.js +1 -0
- package/dist/generated/RootFilesystemEntry.d.ts +13 -0
- package/dist/generated/RootFilesystemEntry.js +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
- package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryKind.js +2 -0
- package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
- package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
- package/dist/generated/RootFilesystemMode.d.ts +1 -0
- package/dist/generated/RootFilesystemMode.js +2 -0
- package/dist/generated/ToolLimitsConfig.d.ts +10 -0
- package/dist/generated/ToolLimitsConfig.js +2 -0
- package/dist/generated/VmDnsConfig.d.ts +6 -0
- package/dist/generated/VmDnsConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +18 -0
- package/dist/generated/VmLimitsConfig.js +1 -0
- package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
- package/dist/generated/VmListenPolicyConfig.js +2 -0
- package/dist/generated/WasmLimitsConfig.d.ts +7 -0
- package/dist/generated/WasmLimitsConfig.js +2 -0
- package/dist/host-dir-mount.d.ts +1 -1
- package/dist/host-tools-zod.js +27 -7
- package/dist/host-tools.js +9 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/layers.d.ts +2 -2
- package/dist/layers.js +19 -10
- package/dist/options-schema.d.ts +453 -0
- package/dist/options-schema.js +268 -0
- package/dist/packages.d.ts +17 -116
- package/dist/packages.js +35 -322
- package/dist/runtime-compat.d.ts +22 -9
- package/dist/runtime-compat.js +130 -144
- package/dist/runtime.d.ts +32 -5
- package/dist/sandbox.d.ts +112 -0
- package/dist/sandbox.js +264 -0
- package/dist/sidecar/agentos-protocol.d.ts +99 -1
- package/dist/sidecar/agentos-protocol.js +155 -18
- package/dist/sidecar/native-process-client.d.ts +6 -2
- package/dist/sidecar/native-process-client.js +8 -1
- package/dist/sidecar/permissions.d.ts +1 -1
- package/dist/sidecar/permissions.js +4 -4
- package/dist/sidecar/rpc-client.d.ts +62 -4
- package/dist/sidecar/rpc-client.js +339 -85
- package/dist/types.d.ts +10 -3
- package/package.json +40 -33
- package/dist/agents.d.ts +0 -63
- package/dist/agents.js +0 -42
- package/fixtures/AGENTOS_SYSTEM_PROMPT.md +0 -21
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 @
|
|
24
|
+
npm install @agentos-software/pi @mariozechner/pi-coding-agent
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
@@ -112,7 +112,7 @@ await vm.dispose();
|
|
|
112
112
|
|
|
113
113
|
| Method | Signature | Description |
|
|
114
114
|
|--------|-----------|-------------|
|
|
115
|
-
| `createSession` | `createSession(agentType: AgentType
|
|
115
|
+
| `createSession` | `createSession(agentType: AgentType, options?: CreateSessionOptions): Promise<{ sessionId: string }>` | Launch an agent and return a session ID |
|
|
116
116
|
| `listSessions` | `listSessions(): SessionInfo[]` | List active sessions |
|
|
117
117
|
| `destroySession` | `destroySession(sessionId: string): Promise<void>` | Gracefully cancel and close a session |
|
|
118
118
|
|
|
@@ -157,10 +157,7 @@ await vm.dispose();
|
|
|
157
157
|
- `MountConfigCustom` — Caller-provided VirtualFileSystem
|
|
158
158
|
- `NativeMountConfig` — Declarative sidecar mount plugin configuration
|
|
159
159
|
- `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`
|
|
160
|
+
- `chunkedS3MountPlugin()` — Declarative S3-compatible native mount plugin descriptor (from `@rivet-dev/agentos-runtime-core/descriptors`)
|
|
164
161
|
|
|
165
162
|
**MCP Servers**
|
|
166
163
|
- `McpServerConfig` — Union of local and remote MCP configs
|
|
@@ -180,8 +177,8 @@ await vm.dispose();
|
|
|
180
177
|
- `BatchReadResult` — Result of a batch read (path, content, error?)
|
|
181
178
|
|
|
182
179
|
**Agent**
|
|
183
|
-
- `AgentType` — `
|
|
184
|
-
- `AgentConfig` — Agent configuration (
|
|
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)
|
|
185
182
|
- `AgentRegistryEntry` — Registry entry (id, acpAdapter, agentPackage, installed)
|
|
186
183
|
|
|
187
184
|
**Session**
|
package/dist/agent-os.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { NativeMountPluginDescriptor } from "@
|
|
1
|
+
import type { NativeMountPluginDescriptor } from "@rivet-dev/agentos-runtime-core/descriptors";
|
|
2
2
|
import type { AgentCapabilities, AgentInfo, PermissionReply, PermissionRequestHandler, SessionConfigOption, SessionEventHandler, SessionModeState } from "./agent-session-types.js";
|
|
3
3
|
import { type ToolKit } from "./host-tools.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
|
-
export type { MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountPluginDescriptor, } from "@
|
|
6
|
+
export type { MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountPluginDescriptor, } from "@rivet-dev/agentos-runtime-core/descriptors";
|
|
7
7
|
export type { AgentCapabilities, AgentInfo, PermissionReply, PermissionRequest, PermissionRequestHandler, SessionConfigOption, SessionEventHandler, SessionInitData, SessionMode, SessionModeState, } from "./agent-session-types.js";
|
|
8
8
|
export type { AcpTimeoutErrorData, JsonRpcError, JsonRpcErrorData, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, } from "./json-rpc.js";
|
|
9
9
|
export { isAcpTimeoutErrorData } from "./json-rpc.js";
|
|
@@ -46,15 +46,16 @@ export interface BatchReadResult {
|
|
|
46
46
|
/** Entry in the agent registry, describing an available agent type. */
|
|
47
47
|
export interface AgentRegistryEntry {
|
|
48
48
|
id: string;
|
|
49
|
-
acpAdapter: string;
|
|
50
|
-
agentPackage: string;
|
|
51
49
|
installed: boolean;
|
|
50
|
+
/** Guest entrypoint the sidecar launches for this agent (`/opt/agentos/bin/<acpEntrypoint>`). */
|
|
51
|
+
adapterEntrypoint: string;
|
|
52
52
|
}
|
|
53
|
-
import {
|
|
53
|
+
import type { AgentType } from "./types.js";
|
|
54
54
|
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 PackageRef, type SoftwarePackageRef } from "./agentos-package.js";
|
|
58
59
|
import { type AgentOsSidecarPlacement } from "./sidecar/rpc-client.js";
|
|
59
60
|
export interface AgentOsSharedSidecarOptions {
|
|
60
61
|
pool?: string;
|
|
@@ -172,6 +173,10 @@ export interface AgentOsLimits {
|
|
|
172
173
|
/** Guest JavaScript runtime buffering limits. */
|
|
173
174
|
jsRuntime?: {
|
|
174
175
|
v8HeapLimitMb?: number;
|
|
176
|
+
syncRpcWaitTimeoutMs?: number;
|
|
177
|
+
cpuTimeLimitMs?: number;
|
|
178
|
+
wallClockLimitMs?: number;
|
|
179
|
+
importCacheMaterializeTimeoutMs?: number;
|
|
175
180
|
capturedOutputLimitBytes?: number;
|
|
176
181
|
stdinBufferLimitBytes?: number;
|
|
177
182
|
eventPayloadLimitBytes?: number;
|
|
@@ -181,6 +186,7 @@ export interface AgentOsLimits {
|
|
|
181
186
|
python?: {
|
|
182
187
|
outputBufferMaxBytes?: number;
|
|
183
188
|
executionTimeoutMs?: number;
|
|
189
|
+
maxOldSpaceMb?: number;
|
|
184
190
|
vfsRpcTimeoutMs?: number;
|
|
185
191
|
};
|
|
186
192
|
/** Guest WASM runtime limits. */
|
|
@@ -188,15 +194,81 @@ export interface AgentOsLimits {
|
|
|
188
194
|
maxModuleFileBytes?: number;
|
|
189
195
|
capturedOutputLimitBytes?: number;
|
|
190
196
|
syncReadLimitBytes?: number;
|
|
197
|
+
prewarmTimeoutMs?: number;
|
|
198
|
+
runnerHeapLimitMb?: number;
|
|
191
199
|
};
|
|
192
200
|
}
|
|
201
|
+
export interface AgentStderrEvent {
|
|
202
|
+
sessionId: string;
|
|
203
|
+
agentType: string;
|
|
204
|
+
processId: string;
|
|
205
|
+
pid: number | null;
|
|
206
|
+
chunk: Uint8Array;
|
|
207
|
+
}
|
|
208
|
+
export type AgentStderrHandler = (event: AgentStderrEvent) => void;
|
|
209
|
+
/**
|
|
210
|
+
* Auto-restart outcome reported on an {@link AgentExitEvent}. Mirrors the
|
|
211
|
+
* sidecar's `AcpAgentExitedEvent.restart` strings:
|
|
212
|
+
* - `"restarted"` — the adapter was respawned and the session was natively
|
|
213
|
+
* re-attached under the same session id; the session stays usable.
|
|
214
|
+
* - `"unsupported"` — the adapter does not advertise a native resume
|
|
215
|
+
* capability (`loadSession`/`resume`); the session was evicted.
|
|
216
|
+
* - `"failed"` — the respawn or re-attach errored; the session was evicted.
|
|
217
|
+
* - `"exhausted"` — the per-session restart budget was already spent; evicted.
|
|
218
|
+
*/
|
|
219
|
+
export type AgentRestartOutcome = "restarted" | "unsupported" | "failed" | "exhausted";
|
|
220
|
+
/**
|
|
221
|
+
* An unexpected ACP adapter process exit — a crash from the host's
|
|
222
|
+
* perspective (any spontaneous exit without `closeSession()`, including exit
|
|
223
|
+
* code 0) — plus the sidecar's bounded auto-restart outcome.
|
|
224
|
+
*/
|
|
225
|
+
export interface AgentExitEvent {
|
|
226
|
+
sessionId: string;
|
|
227
|
+
agentType: string;
|
|
228
|
+
/** Sidecar process id of the adapter that exited. */
|
|
229
|
+
processId: string;
|
|
230
|
+
pid: number | null;
|
|
231
|
+
/** Adapter exit code; `null` when the exit was observed indirectly. */
|
|
232
|
+
exitCode: number | null;
|
|
233
|
+
/** Auto-restart outcome; only `"restarted"` leaves the session usable. */
|
|
234
|
+
restart: AgentRestartOutcome;
|
|
235
|
+
/** Restarts consumed for this session so far. */
|
|
236
|
+
restartCount: number;
|
|
237
|
+
/** Per-session restart budget. */
|
|
238
|
+
maxRestarts: number;
|
|
239
|
+
}
|
|
240
|
+
export type AgentExitHandler = (event: AgentExitEvent) => void;
|
|
241
|
+
/**
|
|
242
|
+
* A near-capacity warning for one bounded limit (a queue/buffer, a saturating
|
|
243
|
+
* resource cap, or a memory envelope) inside the VM runtime. Delivered the moment
|
|
244
|
+
* usage crosses the runtime's warning threshold (~80%), once per crossing — the
|
|
245
|
+
* runtime applies edge-triggering + hysteresis, so this never spams.
|
|
246
|
+
*/
|
|
247
|
+
export interface LimitWarning {
|
|
248
|
+
/** Stable limit name, e.g. `"javascript_event_channel"` or `"vm_open_fds"`. */
|
|
249
|
+
limit: string;
|
|
250
|
+
/** Limit class: `"queue"`, `"resource"`, or `"memory"`. */
|
|
251
|
+
category: string;
|
|
252
|
+
/** Current observed usage. */
|
|
253
|
+
observed: number;
|
|
254
|
+
/** Configured capacity. */
|
|
255
|
+
capacity: number;
|
|
256
|
+
/** Observed fill as a percentage of capacity (0–100). */
|
|
257
|
+
fillPercent: number;
|
|
258
|
+
}
|
|
259
|
+
export type LimitWarningHandler = (warning: LimitWarning) => void;
|
|
260
|
+
/**
|
|
261
|
+
* Public core VM options.
|
|
262
|
+
*
|
|
263
|
+
* Keep this interface in sync with
|
|
264
|
+
* `packages/core/src/options-schema.ts::agentOsOptionsSchema`. The Rivet
|
|
265
|
+
* native actor intentionally accepts only a subset via
|
|
266
|
+
* `packages/agentos/src/config.ts::nativeAgentOsOptionsSchema`.
|
|
267
|
+
*/
|
|
193
268
|
export interface AgentOsOptions {
|
|
194
269
|
/**
|
|
195
|
-
* Software to install in the VM. Each entry
|
|
196
|
-
*
|
|
197
|
-
* registry packages like @agentos-software/coreutils) is treated
|
|
198
|
-
* as a WASM command source automatically. Arrays are flattened, so
|
|
199
|
-
* meta-packages that export arrays of sub-packages work directly.
|
|
270
|
+
* Software to install in the VM. Each entry is a package-dir ref. Arrays are
|
|
271
|
+
* flattened, so meta-packages that export arrays of sub-packages work directly.
|
|
200
272
|
*/
|
|
201
273
|
software?: SoftwareInput[];
|
|
202
274
|
/**
|
|
@@ -214,15 +286,18 @@ export interface AgentOsOptions {
|
|
|
214
286
|
* Defaults to the hardened builtin set used by the native sidecar bridge.
|
|
215
287
|
*/
|
|
216
288
|
allowedNodeBuiltins?: string[];
|
|
289
|
+
/**
|
|
290
|
+
* Opt in to a high-resolution monotonic guest clock (microsecond class)
|
|
291
|
+
* for guest Node processes. Default `false` keeps the security-oriented
|
|
292
|
+
* 1ms timer resolution — untrusted guest code should not get a precise
|
|
293
|
+
* timer (timing side channels). Enable only for trusted benchmarking or
|
|
294
|
+
* profiling workloads.
|
|
295
|
+
*/
|
|
296
|
+
highResolutionTime?: boolean;
|
|
217
297
|
/** Root filesystem configuration. Defaults to an overlay with the bundled base snapshot as its deepest lower. */
|
|
218
298
|
rootFilesystem?: RootFilesystemConfig;
|
|
219
299
|
/** Filesystems to mount at boot time. */
|
|
220
300
|
mounts?: MountConfig[];
|
|
221
|
-
/**
|
|
222
|
-
* @deprecated Use `mounts: [nodeModulesMount(path)]` instead.
|
|
223
|
-
* Compatibility alias for mounting `<moduleAccessCwd>/node_modules` at `/root/node_modules`.
|
|
224
|
-
*/
|
|
225
|
-
moduleAccessCwd?: string;
|
|
226
301
|
/** Additional instructions appended to the base OS system prompt injected at session start. */
|
|
227
302
|
additionalInstructions?: string;
|
|
228
303
|
/** Custom schedule driver for cron jobs. Defaults to TimerScheduleDriver. */
|
|
@@ -244,6 +319,28 @@ export interface AgentOsOptions {
|
|
|
244
319
|
* runtime's historical constants, so omitting this leaves behavior unchanged.
|
|
245
320
|
*/
|
|
246
321
|
limits?: AgentOsLimits;
|
|
322
|
+
/**
|
|
323
|
+
* Called with stderr chunks from the top-level ACP-speaking agent process.
|
|
324
|
+
* The agent process uses stdout for ACP JSON-RPC protocol traffic, so only
|
|
325
|
+
* stderr is forwarded through this hook. Defaults to writing chunks to
|
|
326
|
+
* `process.stderr`.
|
|
327
|
+
*/
|
|
328
|
+
onAgentStderr?: AgentStderrHandler;
|
|
329
|
+
/**
|
|
330
|
+
* Called when the ACP adapter process behind a session exits without
|
|
331
|
+
* `closeSession()` — i.e. an adapter crash. The sidecar auto-restarts the
|
|
332
|
+
* adapter (bounded per session, natively re-attaching the same session id)
|
|
333
|
+
* and reports the outcome on the event; only `restart === "restarted"`
|
|
334
|
+
* leaves the session usable. Defaults to writing a warning line to
|
|
335
|
+
* `process.stderr`.
|
|
336
|
+
*/
|
|
337
|
+
onAgentExit?: AgentExitHandler;
|
|
338
|
+
/**
|
|
339
|
+
* Called when a bounded limit inside the VM runtime approaches capacity
|
|
340
|
+
* (~80%, edge-triggered with hysteresis so it does not spam). Use it to alert
|
|
341
|
+
* on a slow consumer or a runaway guest before the limit is actually hit.
|
|
342
|
+
*/
|
|
343
|
+
onLimitWarning?: LimitWarningHandler;
|
|
247
344
|
}
|
|
248
345
|
/** Configuration for a local MCP server (spawned as a child process). */
|
|
249
346
|
export interface McpServerConfigLocal {
|
|
@@ -297,7 +394,7 @@ export interface ResumeSessionOptions {
|
|
|
297
394
|
* fallback tier arms a continuation preamble pointing the agent at it.
|
|
298
395
|
*/
|
|
299
396
|
transcriptPath?: string;
|
|
300
|
-
/** Working directory for the resumed agent session (default `/
|
|
397
|
+
/** Working directory for the resumed agent session (default `/workspace`). */
|
|
301
398
|
cwd?: string;
|
|
302
399
|
/** Environment variables to pass to the resumed agent process. */
|
|
303
400
|
env?: Record<string, string>;
|
|
@@ -347,7 +444,6 @@ export declare class AgentOs {
|
|
|
347
444
|
private _acpTerminals;
|
|
348
445
|
private _acpTerminalCounter;
|
|
349
446
|
private _softwareRoots;
|
|
350
|
-
private _softwareAgentConfigs;
|
|
351
447
|
private _cronManager;
|
|
352
448
|
private _toolKits;
|
|
353
449
|
private _toolReference;
|
|
@@ -355,11 +451,15 @@ export declare class AgentOs {
|
|
|
355
451
|
private _hostMounts;
|
|
356
452
|
private _env;
|
|
357
453
|
private _rootFilesystem;
|
|
454
|
+
private readonly _additionalInstructions;
|
|
358
455
|
private _sidecarLease;
|
|
359
456
|
private readonly _sidecarClient;
|
|
360
457
|
private readonly _sidecarSession;
|
|
361
458
|
private readonly _sidecarVm;
|
|
362
459
|
private readonly _disposeSidecarEventListener;
|
|
460
|
+
private readonly _agentStderrHandler?;
|
|
461
|
+
private readonly _agentExitHandler?;
|
|
462
|
+
private readonly _limitWarningHandler?;
|
|
363
463
|
private constructor();
|
|
364
464
|
static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
|
|
365
465
|
static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>;
|
|
@@ -371,9 +471,9 @@ export declare class AgentOs {
|
|
|
371
471
|
pid: number;
|
|
372
472
|
};
|
|
373
473
|
/** Write data to a process's stdin. */
|
|
374
|
-
writeProcessStdin(pid: number, data: string | Uint8Array): void
|
|
474
|
+
writeProcessStdin(pid: number, data: string | Uint8Array): Promise<void>;
|
|
375
475
|
/** Close a process's stdin stream. */
|
|
376
|
-
closeProcessStdin(pid: number): void
|
|
476
|
+
closeProcessStdin(pid: number): Promise<void>;
|
|
377
477
|
/** Subscribe to stdout data from a process. Returns an unsubscribe function. */
|
|
378
478
|
onProcessStdout(pid: number, handler: (data: Uint8Array) => void): () => void;
|
|
379
479
|
/** Subscribe to stderr data from a process. Returns an unsubscribe function. */
|
|
@@ -385,7 +485,6 @@ export declare class AgentOs {
|
|
|
385
485
|
private _assertSafeAbsolutePath;
|
|
386
486
|
private _assertWritableAbsolutePath;
|
|
387
487
|
private _vfs;
|
|
388
|
-
private _copyPath;
|
|
389
488
|
readFile(path: string): Promise<Uint8Array>;
|
|
390
489
|
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
391
490
|
writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>;
|
|
@@ -414,11 +513,17 @@ export declare class AgentOs {
|
|
|
414
513
|
};
|
|
415
514
|
connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
|
|
416
515
|
/** Write data to a shell's PTY input. */
|
|
417
|
-
writeShell(shellId: string, data: string | Uint8Array): void
|
|
516
|
+
writeShell(shellId: string, data: string | Uint8Array): Promise<void>;
|
|
418
517
|
/** Subscribe to data output from a shell. Returns an unsubscribe function. */
|
|
419
518
|
onShellData(shellId: string, handler: (data: Uint8Array) => void): () => void;
|
|
420
519
|
/** Notify a shell of terminal resize. */
|
|
421
520
|
resizeShell(shellId: string, cols: number, rows: number): void;
|
|
521
|
+
/**
|
|
522
|
+
* Wait for a shell to exit and return its process exit code. Resolves
|
|
523
|
+
* immediately for a shell that has already exited (within the closed-shell
|
|
524
|
+
* retention window).
|
|
525
|
+
*/
|
|
526
|
+
waitShell(shellId: string): Promise<number>;
|
|
422
527
|
/** Kill a shell process and remove it from tracking. */
|
|
423
528
|
closeShell(shellId: string): void;
|
|
424
529
|
private _resolveVmPathToHostPath;
|
|
@@ -438,15 +543,53 @@ export declare class AgentOs {
|
|
|
438
543
|
listSessions(): SessionInfo[];
|
|
439
544
|
/** Internal helper: retrieve a session or throw. */
|
|
440
545
|
private _requireSession;
|
|
441
|
-
/**
|
|
442
|
-
|
|
546
|
+
/**
|
|
547
|
+
* Dynamically link a software package into the RUNNING VM. The package's
|
|
548
|
+
* `bin/` commands appear under `/opt/agentos/bin` (on `$PATH`) and its `share/man`
|
|
549
|
+
* pages under MANPATH immediately — the `/opt/agentos` mount is host-backed, so
|
|
550
|
+
* writing into its staging dir is reflected live with no reboot. An `agent`
|
|
551
|
+
* block registers the package for `createSession(name)`. Persists for the VM's
|
|
552
|
+
* lifetime (and across a snapshot iff the volume persists).
|
|
553
|
+
*/
|
|
554
|
+
linkSoftware(descriptor: PackageRef | SoftwarePackageRef): Promise<void>;
|
|
555
|
+
providedCommands(): Promise<{
|
|
556
|
+
packageName: string;
|
|
557
|
+
commands: string[];
|
|
558
|
+
}[]>;
|
|
559
|
+
/**
|
|
560
|
+
* Returns all registered agents with their installation status. Thin forwarder:
|
|
561
|
+
* sends `AcpListAgentsRequest` and maps the response. The sidecar enumerates the
|
|
562
|
+
* projected `/opt/agentos` packages (the client parses no manifests). Every such
|
|
563
|
+
* agent is a package materialized into the VM, so `installed` is always `true`.
|
|
564
|
+
*/
|
|
565
|
+
listAgents(): Promise<AgentRegistryEntry[]>;
|
|
443
566
|
private _syncSessionState;
|
|
444
567
|
private _applySessionUpdate;
|
|
445
568
|
private _recordSessionNotification;
|
|
446
569
|
private _dispatchSessionEvent;
|
|
447
570
|
private _subscribeSessionEvents;
|
|
571
|
+
/**
|
|
572
|
+
* Warn once per session (host-visible) that a tool-permission request was
|
|
573
|
+
* auto-denied because no `onPermissionRequest` handler is registered. Shared
|
|
574
|
+
* by both the bare-callback and JSON-RPC permission paths so the message and
|
|
575
|
+
* the once-per-session guard cannot drift between them.
|
|
576
|
+
*/
|
|
577
|
+
private _warnNoPermissionHandlerOnce;
|
|
578
|
+
/** Best-effort human label for the tool named in a permission request. */
|
|
579
|
+
private _permissionToolLabel;
|
|
580
|
+
/**
|
|
581
|
+
* Emit a host-visible warning for a session through the same agent-process log
|
|
582
|
+
* channel that surfaces adapter stderr (`onAgentStderr`, default: process
|
|
583
|
+
* stderr). Used for agent-os-owned diagnostics — e.g. a permission request
|
|
584
|
+
* that was auto-denied because no host hook is registered — so they never fire
|
|
585
|
+
* silently inside the sidecar.
|
|
586
|
+
*/
|
|
587
|
+
private _emitSessionWarning;
|
|
588
|
+
private _recordAgentStderr;
|
|
589
|
+
private _recordAgentExit;
|
|
448
590
|
private _applySyntheticConfigOverrides;
|
|
449
591
|
private _handleSidecarEvent;
|
|
592
|
+
private _handleLimitWarning;
|
|
450
593
|
private _handleAcpExtEvent;
|
|
451
594
|
private _unsupportedConfigResponse;
|
|
452
595
|
private _sendAcpRequest;
|
|
@@ -459,7 +602,7 @@ export declare class AgentOs {
|
|
|
459
602
|
private _rejectPendingPermissionRepliesFromSession;
|
|
460
603
|
private _closeSessionInternal;
|
|
461
604
|
private _hydrateSessionState;
|
|
462
|
-
createSession(agentType: AgentType
|
|
605
|
+
createSession(agentType: AgentType, options?: CreateSessionOptions): Promise<{
|
|
463
606
|
sessionId: string;
|
|
464
607
|
}>;
|
|
465
608
|
/**
|
|
@@ -477,23 +620,7 @@ export declare class AgentOs {
|
|
|
477
620
|
* Resume depends on a durable root; on a non-durable (default in-memory) root
|
|
478
621
|
* there is no surviving store and the fallback tier always runs.
|
|
479
622
|
*/
|
|
480
|
-
resumeSession(sessionId: string, agentType: AgentType
|
|
481
|
-
/**
|
|
482
|
-
* Resolve the VM bin entry point of an ACP adapter package.
|
|
483
|
-
* Reads from the host filesystem since kernel.readFile() resolves through
|
|
484
|
-
* mounts; adapter package.json is read directly off the host dir backing
|
|
485
|
-
* the relevant mount.
|
|
486
|
-
*/
|
|
487
|
-
private _resolveAdapterBin;
|
|
488
|
-
/**
|
|
489
|
-
* Parent of the host directory backing the `/root/node_modules` mount, if
|
|
490
|
-
* the caller supplied one (e.g. via `nodeModulesMount(...)`). Used as the
|
|
491
|
-
* `resolvePackageDir` start dir for adapter/agent package resolution when no
|
|
492
|
-
* software root matches. `nodeModulesMount` mounts `<dir>/node_modules`, so
|
|
493
|
-
* the start dir is `<dir>` (one level above the node_modules tree).
|
|
494
|
-
*/
|
|
495
|
-
private _nodeModulesHostRoot;
|
|
496
|
-
private _resolvePackageBin;
|
|
623
|
+
resumeSession(sessionId: string, agentType: AgentType, options?: ResumeSessionOptions): Promise<ResumeSessionResult>;
|
|
497
624
|
private _installSidecarRequestHandler;
|
|
498
625
|
private _handleAcpExtSidecarRequest;
|
|
499
626
|
private _dispatchAcpSidecarRequest;
|
|
@@ -520,11 +647,6 @@ export declare class AgentOs {
|
|
|
520
647
|
private _handleAcpReleaseTerminal;
|
|
521
648
|
private _handleAcpResizeTerminal;
|
|
522
649
|
private _handleAcpPermissionCallback;
|
|
523
|
-
/**
|
|
524
|
-
* Resolve an agent config by ID. Package-provided configs take
|
|
525
|
-
* precedence over the hardcoded AGENT_CONFIGS.
|
|
526
|
-
*/
|
|
527
|
-
private _resolveAgentConfig;
|
|
528
650
|
/**
|
|
529
651
|
* Gracefully destroy a session: cancel any pending work, close the client,
|
|
530
652
|
* and remove from tracking. Unlike close() which is abrupt, this attempts
|