@rivet-dev/agentos-core 0.0.0-feat-on-limit-warning.62a2bc2 → 0.0.0-glibc.4af31c1
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 +4 -7
- package/dist/agent-os.d.ts +116 -46
- package/dist/agent-os.js +740 -541
- 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.js +9 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/layers.d.ts +2 -2
- package/dist/layers.js +19 -10
- package/dist/options-schema.d.ts +19 -4
- package/dist/options-schema.js +30 -22
- 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 +126 -141
- 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 +88 -1
- package/dist/sidecar/agentos-protocol.js +134 -18
- package/dist/sidecar/native-process-client.d.ts +6 -3
- package/dist/sidecar/native-process-client.js +5 -3
- package/dist/sidecar/permissions.d.ts +1 -1
- package/dist/sidecar/permissions.js +3 -3
- 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 +36 -32
- 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
|
@@ -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,6 +194,8 @@ 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
|
}
|
|
193
201
|
export interface AgentStderrEvent {
|
|
@@ -198,6 +206,38 @@ export interface AgentStderrEvent {
|
|
|
198
206
|
chunk: Uint8Array;
|
|
199
207
|
}
|
|
200
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;
|
|
201
241
|
/**
|
|
202
242
|
* A near-capacity warning for one bounded limit (a queue/buffer, a saturating
|
|
203
243
|
* resource cap, or a memory envelope) inside the VM runtime. Delivered the moment
|
|
@@ -205,7 +245,7 @@ export type AgentStderrHandler = (event: AgentStderrEvent) => void;
|
|
|
205
245
|
* runtime applies edge-triggering + hysteresis, so this never spams.
|
|
206
246
|
*/
|
|
207
247
|
export interface LimitWarning {
|
|
208
|
-
/** Stable limit name, e.g. `"
|
|
248
|
+
/** Stable limit name, e.g. `"javascript_event_channel"` or `"vm_open_fds"`. */
|
|
209
249
|
limit: string;
|
|
210
250
|
/** Limit class: `"queue"`, `"resource"`, or `"memory"`. */
|
|
211
251
|
category: string;
|
|
@@ -227,11 +267,8 @@ export type LimitWarningHandler = (warning: LimitWarning) => void;
|
|
|
227
267
|
*/
|
|
228
268
|
export interface AgentOsOptions {
|
|
229
269
|
/**
|
|
230
|
-
* Software to install in the VM. Each entry
|
|
231
|
-
*
|
|
232
|
-
* registry packages like @agentos-software/coreutils) is treated
|
|
233
|
-
* as a WASM command source automatically. Arrays are flattened, so
|
|
234
|
-
* 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.
|
|
235
272
|
*/
|
|
236
273
|
software?: SoftwareInput[];
|
|
237
274
|
/**
|
|
@@ -249,15 +286,18 @@ export interface AgentOsOptions {
|
|
|
249
286
|
* Defaults to the hardened builtin set used by the native sidecar bridge.
|
|
250
287
|
*/
|
|
251
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;
|
|
252
297
|
/** Root filesystem configuration. Defaults to an overlay with the bundled base snapshot as its deepest lower. */
|
|
253
298
|
rootFilesystem?: RootFilesystemConfig;
|
|
254
299
|
/** Filesystems to mount at boot time. */
|
|
255
300
|
mounts?: MountConfig[];
|
|
256
|
-
/**
|
|
257
|
-
* @deprecated Use `mounts: [nodeModulesMount(path)]` instead.
|
|
258
|
-
* Compatibility alias for mounting `<moduleAccessCwd>/node_modules` at `/root/node_modules`.
|
|
259
|
-
*/
|
|
260
|
-
moduleAccessCwd?: string;
|
|
261
301
|
/** Additional instructions appended to the base OS system prompt injected at session start. */
|
|
262
302
|
additionalInstructions?: string;
|
|
263
303
|
/** Custom schedule driver for cron jobs. Defaults to TimerScheduleDriver. */
|
|
@@ -286,6 +326,15 @@ export interface AgentOsOptions {
|
|
|
286
326
|
* `process.stderr`.
|
|
287
327
|
*/
|
|
288
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;
|
|
289
338
|
/**
|
|
290
339
|
* Called when a bounded limit inside the VM runtime approaches capacity
|
|
291
340
|
* (~80%, edge-triggered with hysteresis so it does not spam). Use it to alert
|
|
@@ -395,7 +444,6 @@ export declare class AgentOs {
|
|
|
395
444
|
private _acpTerminals;
|
|
396
445
|
private _acpTerminalCounter;
|
|
397
446
|
private _softwareRoots;
|
|
398
|
-
private _softwareAgentConfigs;
|
|
399
447
|
private _cronManager;
|
|
400
448
|
private _toolKits;
|
|
401
449
|
private _toolReference;
|
|
@@ -403,12 +451,14 @@ export declare class AgentOs {
|
|
|
403
451
|
private _hostMounts;
|
|
404
452
|
private _env;
|
|
405
453
|
private _rootFilesystem;
|
|
454
|
+
private readonly _additionalInstructions;
|
|
406
455
|
private _sidecarLease;
|
|
407
456
|
private readonly _sidecarClient;
|
|
408
457
|
private readonly _sidecarSession;
|
|
409
458
|
private readonly _sidecarVm;
|
|
410
459
|
private readonly _disposeSidecarEventListener;
|
|
411
460
|
private readonly _agentStderrHandler?;
|
|
461
|
+
private readonly _agentExitHandler?;
|
|
412
462
|
private readonly _limitWarningHandler?;
|
|
413
463
|
private constructor();
|
|
414
464
|
static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
|
|
@@ -421,9 +471,9 @@ export declare class AgentOs {
|
|
|
421
471
|
pid: number;
|
|
422
472
|
};
|
|
423
473
|
/** Write data to a process's stdin. */
|
|
424
|
-
writeProcessStdin(pid: number, data: string | Uint8Array): void
|
|
474
|
+
writeProcessStdin(pid: number, data: string | Uint8Array): Promise<void>;
|
|
425
475
|
/** Close a process's stdin stream. */
|
|
426
|
-
closeProcessStdin(pid: number): void
|
|
476
|
+
closeProcessStdin(pid: number): Promise<void>;
|
|
427
477
|
/** Subscribe to stdout data from a process. Returns an unsubscribe function. */
|
|
428
478
|
onProcessStdout(pid: number, handler: (data: Uint8Array) => void): () => void;
|
|
429
479
|
/** Subscribe to stderr data from a process. Returns an unsubscribe function. */
|
|
@@ -435,7 +485,6 @@ export declare class AgentOs {
|
|
|
435
485
|
private _assertSafeAbsolutePath;
|
|
436
486
|
private _assertWritableAbsolutePath;
|
|
437
487
|
private _vfs;
|
|
438
|
-
private _copyPath;
|
|
439
488
|
readFile(path: string): Promise<Uint8Array>;
|
|
440
489
|
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
441
490
|
writeFiles(entries: BatchWriteEntry[]): Promise<BatchWriteResult[]>;
|
|
@@ -464,11 +513,17 @@ export declare class AgentOs {
|
|
|
464
513
|
};
|
|
465
514
|
connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
|
|
466
515
|
/** Write data to a shell's PTY input. */
|
|
467
|
-
writeShell(shellId: string, data: string | Uint8Array): void
|
|
516
|
+
writeShell(shellId: string, data: string | Uint8Array): Promise<void>;
|
|
468
517
|
/** Subscribe to data output from a shell. Returns an unsubscribe function. */
|
|
469
518
|
onShellData(shellId: string, handler: (data: Uint8Array) => void): () => void;
|
|
470
519
|
/** Notify a shell of terminal resize. */
|
|
471
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>;
|
|
472
527
|
/** Kill a shell process and remove it from tracking. */
|
|
473
528
|
closeShell(shellId: string): void;
|
|
474
529
|
private _resolveVmPathToHostPath;
|
|
@@ -488,14 +543,50 @@ export declare class AgentOs {
|
|
|
488
543
|
listSessions(): SessionInfo[];
|
|
489
544
|
/** Internal helper: retrieve a session or throw. */
|
|
490
545
|
private _requireSession;
|
|
491
|
-
/**
|
|
492
|
-
|
|
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[]>;
|
|
493
566
|
private _syncSessionState;
|
|
494
567
|
private _applySessionUpdate;
|
|
495
568
|
private _recordSessionNotification;
|
|
496
569
|
private _dispatchSessionEvent;
|
|
497
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;
|
|
498
588
|
private _recordAgentStderr;
|
|
589
|
+
private _recordAgentExit;
|
|
499
590
|
private _applySyntheticConfigOverrides;
|
|
500
591
|
private _handleSidecarEvent;
|
|
501
592
|
private _handleLimitWarning;
|
|
@@ -511,7 +602,7 @@ export declare class AgentOs {
|
|
|
511
602
|
private _rejectPendingPermissionRepliesFromSession;
|
|
512
603
|
private _closeSessionInternal;
|
|
513
604
|
private _hydrateSessionState;
|
|
514
|
-
createSession(agentType: AgentType
|
|
605
|
+
createSession(agentType: AgentType, options?: CreateSessionOptions): Promise<{
|
|
515
606
|
sessionId: string;
|
|
516
607
|
}>;
|
|
517
608
|
/**
|
|
@@ -529,23 +620,7 @@ export declare class AgentOs {
|
|
|
529
620
|
* Resume depends on a durable root; on a non-durable (default in-memory) root
|
|
530
621
|
* there is no surviving store and the fallback tier always runs.
|
|
531
622
|
*/
|
|
532
|
-
resumeSession(sessionId: string, agentType: AgentType
|
|
533
|
-
/**
|
|
534
|
-
* Resolve the VM bin entry point of an ACP adapter package.
|
|
535
|
-
* Reads from the host filesystem since kernel.readFile() resolves through
|
|
536
|
-
* mounts; adapter package.json is read directly off the host dir backing
|
|
537
|
-
* the relevant mount.
|
|
538
|
-
*/
|
|
539
|
-
private _resolveAdapterBin;
|
|
540
|
-
/**
|
|
541
|
-
* Parent of the host directory backing the `/root/node_modules` mount, if
|
|
542
|
-
* the caller supplied one (e.g. via `nodeModulesMount(...)`). Used as the
|
|
543
|
-
* `resolvePackageDir` start dir for adapter/agent package resolution when no
|
|
544
|
-
* software root matches. `nodeModulesMount` mounts `<dir>/node_modules`, so
|
|
545
|
-
* the start dir is `<dir>` (one level above the node_modules tree).
|
|
546
|
-
*/
|
|
547
|
-
private _nodeModulesHostRoot;
|
|
548
|
-
private _resolvePackageBin;
|
|
623
|
+
resumeSession(sessionId: string, agentType: AgentType, options?: ResumeSessionOptions): Promise<ResumeSessionResult>;
|
|
549
624
|
private _installSidecarRequestHandler;
|
|
550
625
|
private _handleAcpExtSidecarRequest;
|
|
551
626
|
private _dispatchAcpSidecarRequest;
|
|
@@ -572,11 +647,6 @@ export declare class AgentOs {
|
|
|
572
647
|
private _handleAcpReleaseTerminal;
|
|
573
648
|
private _handleAcpResizeTerminal;
|
|
574
649
|
private _handleAcpPermissionCallback;
|
|
575
|
-
/**
|
|
576
|
-
* Resolve an agent config by ID. Package-provided configs take
|
|
577
|
-
* precedence over the hardcoded AGENT_CONFIGS.
|
|
578
|
-
*/
|
|
579
|
-
private _resolveAgentConfig;
|
|
580
650
|
/**
|
|
581
651
|
* Gracefully destroy a session: cancel any pending work, close the client,
|
|
582
652
|
* and remove from tracking. Unlike close() which is abrupt, this attempts
|