@rivet-dev/agentos-core 0.0.0-nathan-agentos-combined.e833bb7 → 0.0.0-nathan-agentos-package-resolution.3785b9a

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 CHANGED
@@ -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 `@secure-exec/core/descriptors`)
164
161
 
165
162
  **MCP Servers**
166
163
  - `McpServerConfig` — Union of local and remote MCP configs
@@ -46,8 +46,12 @@ 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;
49
+ /** npm adapter package (legacy agents) — absent for `/opt/agentos` packages. */
50
+ acpAdapter?: string;
51
+ /** npm agent package (legacy agents) — absent for `/opt/agentos` packages. */
52
+ agentPackage?: string;
53
+ /** Pre-resolved adapter command path for an `/opt/agentos` agent package. */
54
+ adapterEntrypoint?: string;
51
55
  installed: boolean;
52
56
  }
53
57
  import { type AgentType } from "./agents.js";
@@ -55,6 +59,7 @@ import type { ScheduleDriver } from "./cron/schedule-driver.js";
55
59
  import type { CronEventHandler, CronJob, CronJobInfo, CronJobOptions } from "./cron/types.js";
56
60
  import { type LayerStore, type OverlayFilesystemMode, type RootSnapshotExport, type SnapshotLayerHandle } from "./layers.js";
57
61
  import { type SoftwareInput } from "./packages.js";
62
+ import { type PackageDescriptor } from "./agentos-package.js";
58
63
  import { type AgentOsSidecarPlacement } from "./sidecar/rpc-client.js";
59
64
  export interface AgentOsSharedSidecarOptions {
60
65
  pool?: string;
@@ -198,6 +203,25 @@ export interface AgentStderrEvent {
198
203
  chunk: Uint8Array;
199
204
  }
200
205
  export type AgentStderrHandler = (event: AgentStderrEvent) => void;
206
+ /**
207
+ * A near-capacity warning for one bounded limit (a queue/buffer, a saturating
208
+ * resource cap, or a memory envelope) inside the VM runtime. Delivered the moment
209
+ * usage crosses the runtime's warning threshold (~80%), once per crossing — the
210
+ * runtime applies edge-triggering + hysteresis, so this never spams.
211
+ */
212
+ export interface LimitWarning {
213
+ /** Stable limit name, e.g. `"javascript_event_channel"` or `"vm_open_fds"`. */
214
+ limit: string;
215
+ /** Limit class: `"queue"`, `"resource"`, or `"memory"`. */
216
+ category: string;
217
+ /** Current observed usage. */
218
+ observed: number;
219
+ /** Configured capacity. */
220
+ capacity: number;
221
+ /** Observed fill as a percentage of capacity (0–100). */
222
+ fillPercent: number;
223
+ }
224
+ export type LimitWarningHandler = (warning: LimitWarning) => void;
201
225
  /**
202
226
  * Public core VM options.
203
227
  *
@@ -267,6 +291,12 @@ export interface AgentOsOptions {
267
291
  * `process.stderr`.
268
292
  */
269
293
  onAgentStderr?: AgentStderrHandler;
294
+ /**
295
+ * Called when a bounded limit inside the VM runtime approaches capacity
296
+ * (~80%, edge-triggered with hysteresis so it does not spam). Use it to alert
297
+ * on a slow consumer or a runaway guest before the limit is actually hit.
298
+ */
299
+ onLimitWarning?: LimitWarningHandler;
270
300
  }
271
301
  /** Configuration for a local MCP server (spawned as a child process). */
272
302
  export interface McpServerConfigLocal {
@@ -367,6 +397,8 @@ export declare class AgentOs {
367
397
  private _closedShellIds;
368
398
  private _pendingShellExitPromises;
369
399
  private _shellCounter;
400
+ /** Command names linked into `/opt/agentos/bin` at runtime (via the sidecar). */
401
+ private _linkedCommands;
370
402
  private _acpTerminals;
371
403
  private _acpTerminalCounter;
372
404
  private _softwareRoots;
@@ -378,12 +410,14 @@ export declare class AgentOs {
378
410
  private _hostMounts;
379
411
  private _env;
380
412
  private _rootFilesystem;
413
+ private readonly _additionalInstructions;
381
414
  private _sidecarLease;
382
415
  private readonly _sidecarClient;
383
416
  private readonly _sidecarSession;
384
417
  private readonly _sidecarVm;
385
418
  private readonly _disposeSidecarEventListener;
386
419
  private readonly _agentStderrHandler?;
420
+ private readonly _limitWarningHandler?;
387
421
  private constructor();
388
422
  static createSidecar(options?: AgentOsCreateSidecarOptions): Promise<AgentOsSidecar>;
389
423
  static getSharedSidecar(options?: AgentOsSharedSidecarOptions): Promise<AgentOsSidecar>;
@@ -395,9 +429,9 @@ export declare class AgentOs {
395
429
  pid: number;
396
430
  };
397
431
  /** Write data to a process's stdin. */
398
- writeProcessStdin(pid: number, data: string | Uint8Array): void;
432
+ writeProcessStdin(pid: number, data: string | Uint8Array): Promise<void>;
399
433
  /** Close a process's stdin stream. */
400
- closeProcessStdin(pid: number): void;
434
+ closeProcessStdin(pid: number): Promise<void>;
401
435
  /** Subscribe to stdout data from a process. Returns an unsubscribe function. */
402
436
  onProcessStdout(pid: number, handler: (data: Uint8Array) => void): () => void;
403
437
  /** Subscribe to stderr data from a process. Returns an unsubscribe function. */
@@ -438,11 +472,13 @@ export declare class AgentOs {
438
472
  };
439
473
  connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
440
474
  /** Write data to a shell's PTY input. */
441
- writeShell(shellId: string, data: string | Uint8Array): void;
475
+ writeShell(shellId: string, data: string | Uint8Array): Promise<void>;
442
476
  /** Subscribe to data output from a shell. Returns an unsubscribe function. */
443
477
  onShellData(shellId: string, handler: (data: Uint8Array) => void): () => void;
444
478
  /** Notify a shell of terminal resize. */
445
479
  resizeShell(shellId: string, cols: number, rows: number): void;
480
+ /** Wait for a shell to exit and return its process exit code. */
481
+ waitShell(shellId: string): Promise<number>;
446
482
  /** Kill a shell process and remove it from tracking. */
447
483
  closeShell(shellId: string): void;
448
484
  private _resolveVmPathToHostPath;
@@ -462,6 +498,15 @@ export declare class AgentOs {
462
498
  listSessions(): SessionInfo[];
463
499
  /** Internal helper: retrieve a session or throw. */
464
500
  private _requireSession;
501
+ /**
502
+ * Dynamically link a software package into the RUNNING VM. The package's
503
+ * `bin/` commands appear under `/opt/agentos/bin` (on `$PATH`) and its `share/man`
504
+ * pages under MANPATH immediately — the `/opt/agentos` mount is host-backed, so
505
+ * writing into its staging dir is reflected live with no reboot. An `agent`
506
+ * block registers the package for `createSession(name)`. Persists for the VM's
507
+ * lifetime (and across a snapshot iff the volume persists).
508
+ */
509
+ linkSoftware(descriptor: PackageDescriptor): Promise<void>;
465
510
  /** Returns all registered agents with their installation status. */
466
511
  listAgents(): AgentRegistryEntry[];
467
512
  private _syncSessionState;
@@ -469,9 +514,27 @@ export declare class AgentOs {
469
514
  private _recordSessionNotification;
470
515
  private _dispatchSessionEvent;
471
516
  private _subscribeSessionEvents;
517
+ /**
518
+ * Warn once per session (host-visible) that a tool-permission request was
519
+ * auto-denied because no `onPermissionRequest` handler is registered. Shared
520
+ * by both the bare-callback and JSON-RPC permission paths so the message and
521
+ * the once-per-session guard cannot drift between them.
522
+ */
523
+ private _warnNoPermissionHandlerOnce;
524
+ /** Best-effort human label for the tool named in a permission request. */
525
+ private _permissionToolLabel;
526
+ /**
527
+ * Emit a host-visible warning for a session through the same agent-process log
528
+ * channel that surfaces adapter stderr (`onAgentStderr`, default: process
529
+ * stderr). Used for agent-os-owned diagnostics — e.g. a permission request
530
+ * that was auto-denied because no host hook is registered — so they never fire
531
+ * silently inside the sidecar.
532
+ */
533
+ private _emitSessionWarning;
472
534
  private _recordAgentStderr;
473
535
  private _applySyntheticConfigOverrides;
474
536
  private _handleSidecarEvent;
537
+ private _handleLimitWarning;
475
538
  private _handleAcpExtEvent;
476
539
  private _unsupportedConfigResponse;
477
540
  private _sendAcpRequest;
@@ -503,22 +566,6 @@ export declare class AgentOs {
503
566
  * there is no surviving store and the fallback tier always runs.
504
567
  */
505
568
  resumeSession(sessionId: string, agentType: AgentType | string, options?: ResumeSessionOptions): Promise<ResumeSessionResult>;
506
- /**
507
- * Resolve the VM bin entry point of an ACP adapter package.
508
- * Reads from the host filesystem since kernel.readFile() resolves through
509
- * mounts; adapter package.json is read directly off the host dir backing
510
- * the relevant mount.
511
- */
512
- private _resolveAdapterBin;
513
- /**
514
- * Parent of the host directory backing the `/root/node_modules` mount, if
515
- * the caller supplied one (e.g. via `nodeModulesMount(...)`). Used as the
516
- * `resolvePackageDir` start dir for adapter/agent package resolution when no
517
- * software root matches. `nodeModulesMount` mounts `<dir>/node_modules`, so
518
- * the start dir is `<dir>` (one level above the node_modules tree).
519
- */
520
- private _nodeModulesHostRoot;
521
- private _resolvePackageBin;
522
569
  private _installSidecarRequestHandler;
523
570
  private _handleAcpExtSidecarRequest;
524
571
  private _dispatchAcpSidecarRequest;