@rivet-dev/agentos-core 0.2.4 → 0.2.5-rc.1

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.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * agentOS package model (Linux-exact, Homebrew-modeled) — client-facing surface.
3
+ *
4
+ * A package is a self-contained directory produced by `@rivet-dev/agentos-toolchain
5
+ * pack`. The HOST no longer projects it: the client forwards only the package
6
+ * directory over the wire and the secure-exec sidecar owns the `/opt/agentos`
7
+ * projection. Package metadata lives in `<dir>/agentos-package.json`.
8
+ *
9
+ * This module is therefore only the client-facing package-dir surface plus the
10
+ * `/opt/agentos` path constants used for agent-config wiring.
11
+ *
12
+ * See `website/src/content/docs/docs/architecture/packages-and-command-resolution.mdx`.
13
+ */
14
+ import type { AgentosPackageManifest, PackageAgentDescriptor, PackageRef as ManifestPackageRef } from "@agentos-software/manifest";
15
+ /** Root of the agentOS package tree inside the VM. */
16
+ export declare const OPT_AGENTOS_ROOT = "/opt/agentos";
17
+ /** The symlink farm on `$PATH` (commands link here). */
18
+ export declare const OPT_AGENTOS_BIN = "/opt/agentos/bin";
19
+ export type AgentBlock = PackageAgentDescriptor;
20
+ export type PackageRef = ManifestPackageRef;
21
+ export interface SoftwarePackageRef {
22
+ packageDir: string;
23
+ }
24
+ /** @deprecated Package software is now represented by its package directory. */
25
+ export type PackageDescriptor = PackageRef;
26
+ /** Discriminate the dir-only package reference. */
27
+ export declare function isPackageDescriptor(value: unknown): value is PackageDescriptor;
28
+ export declare function readAgentosPackageManifest(dir: string): AgentosPackageManifest;
29
+ export declare function tryReadAgentosPackageManifest(dir: string): AgentosPackageManifest | undefined;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * agentOS package model (Linux-exact, Homebrew-modeled) — client-facing surface.
3
+ *
4
+ * A package is a self-contained directory produced by `@rivet-dev/agentos-toolchain
5
+ * pack`. The HOST no longer projects it: the client forwards only the package
6
+ * directory over the wire and the secure-exec sidecar owns the `/opt/agentos`
7
+ * projection. Package metadata lives in `<dir>/agentos-package.json`.
8
+ *
9
+ * This module is therefore only the client-facing package-dir surface plus the
10
+ * `/opt/agentos` path constants used for agent-config wiring.
11
+ *
12
+ * See `website/src/content/docs/docs/architecture/packages-and-command-resolution.mdx`.
13
+ */
14
+ import { readFileSync } from "node:fs";
15
+ import { join } from "node:path";
16
+ /** Root of the agentOS package tree inside the VM. */
17
+ export const OPT_AGENTOS_ROOT = "/opt/agentos";
18
+ /** The symlink farm on `$PATH` (commands link here). */
19
+ export const OPT_AGENTOS_BIN = "/opt/agentos/bin";
20
+ /** Discriminate the dir-only package reference. */
21
+ export function isPackageDescriptor(value) {
22
+ return typeof value === "string";
23
+ }
24
+ export function readAgentosPackageManifest(dir) {
25
+ const manifestPath = join(dir, "agentos-package.json");
26
+ let parsed;
27
+ try {
28
+ parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
29
+ }
30
+ catch (error) {
31
+ const wrapped = new Error(`Failed to read agentOS package manifest at ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`);
32
+ wrapped.code = error.code;
33
+ throw wrapped;
34
+ }
35
+ return validateAgentosPackageManifest(parsed, manifestPath);
36
+ }
37
+ export function tryReadAgentosPackageManifest(dir) {
38
+ try {
39
+ return readAgentosPackageManifest(dir);
40
+ }
41
+ catch (error) {
42
+ if (error instanceof Error &&
43
+ error.code === "ENOENT") {
44
+ return undefined;
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ function validateAgentosPackageManifest(value, source) {
50
+ if (!isPlainObject(value) || typeof value.name !== "string") {
51
+ throw new Error(`Invalid agentOS package manifest at ${source}: missing name`);
52
+ }
53
+ const manifest = { name: value.name };
54
+ if (value.agent !== undefined) {
55
+ if (!isPlainObject(value.agent) ||
56
+ typeof value.agent.acpEntrypoint !== "string") {
57
+ throw new Error(`Invalid agentOS package manifest at ${source}: invalid agent.acpEntrypoint`);
58
+ }
59
+ manifest.agent = {
60
+ acpEntrypoint: value.agent.acpEntrypoint,
61
+ ...(isStringRecord(value.agent.env) ? { env: value.agent.env } : {}),
62
+ ...(Array.isArray(value.agent.launchArgs) &&
63
+ value.agent.launchArgs.every((arg) => typeof arg === "string")
64
+ ? { launchArgs: value.agent.launchArgs }
65
+ : {}),
66
+ ...(typeof value.agent.snapshot === "boolean"
67
+ ? { snapshot: value.agent.snapshot }
68
+ : {}),
69
+ };
70
+ }
71
+ if (value.provides !== undefined) {
72
+ manifest.provides = value.provides;
73
+ }
74
+ return manifest;
75
+ }
76
+ function isPlainObject(value) {
77
+ return typeof value === "object" && value !== null && !Array.isArray(value);
78
+ }
79
+ function isStringRecord(value) {
80
+ return (isPlainObject(value) &&
81
+ Object.values(value).every((entry) => typeof entry === "string"));
82
+ }
package/dist/agents.d.ts CHANGED
@@ -1,8 +1,18 @@
1
1
  export interface AgentConfig {
2
- /** npm package name for the ACP adapter (spawned inside the VM) */
3
- acpAdapter: string;
4
- /** npm package name for the underlying agent */
5
- agentPackage: string;
2
+ /**
3
+ * npm package name for the ACP adapter (spawned inside the VM). Optional: an
4
+ * `/opt/agentos` agent package sets `adapterEntrypoint` instead.
5
+ */
6
+ acpAdapter?: string;
7
+ /** npm package name for the underlying agent (optional for `/opt/agentos` packages). */
8
+ agentPackage?: string;
9
+ /**
10
+ * Pre-resolved guest command path/name for the ACP adapter (e.g.
11
+ * `/opt/agentos/bin/<acpEntrypoint>`). When set, it is used directly as the
12
+ * adapter entrypoint and the npm-package resolution (`acpAdapter` →
13
+ * `/root/node_modules/...`) is bypassed. Set by `/opt/agentos` agent packages.
14
+ */
15
+ adapterEntrypoint?: string;
6
16
  /**
7
17
  * Absolute host path to the software package directory that registered this
8
18
  * agent config. Package-provided agent adapters should resolve their nested
@@ -19,6 +29,12 @@ export interface AgentConfig {
19
29
  */
20
30
  defaultEnv?: Record<string, string>;
21
31
  }
32
+ /**
33
+ * @deprecated npm-era legacy. Agents are `/opt/agentos` packages resolved from
34
+ * `@agentos-software/*` dependency manifests (see `default-software.ts`); this
35
+ * table is no longer consulted by agent resolution and exists only for the
36
+ * exported `AgentType` union and legacy registry-listing metadata.
37
+ */
22
38
  export declare const AGENT_CONFIGS: {
23
39
  pi: {
24
40
  acpAdapter: string;
package/dist/agents.js CHANGED
@@ -1,4 +1,10 @@
1
1
  // Agent configurations for ACP-compatible coding agents
2
+ /**
3
+ * @deprecated npm-era legacy. Agents are `/opt/agentos` packages resolved from
4
+ * `@agentos-software/*` dependency manifests (see `default-software.ts`); this
5
+ * table is no longer consulted by agent resolution and exists only for the
6
+ * exported `AgentType` union and legacy registry-listing metadata.
7
+ */
2
8
  export const AGENT_CONFIGS = {
3
9
  pi: {
4
10
  acpAdapter: "@agentos-software/pi",
@@ -1,5 +1,4 @@
1
- import { type FilesystemEntry } from "./filesystem-snapshot.js";
2
- import { type VirtualFileSystem } from "./runtime-compat.js";
1
+ import type { FilesystemEntry } from "./filesystem-snapshot.js";
3
2
  export interface BaseFilesystemEnvironment {
4
3
  env: Record<string, string>;
5
4
  prompt: string;
@@ -18,17 +17,5 @@ export interface BaseFilesystemSnapshot {
18
17
  entries: BaseFilesystemEntry[];
19
18
  };
20
19
  }
21
- export declare function createBaseLowerFilesystem(): Promise<VirtualFileSystem>;
22
- export declare function createBootstrapAwareFilesystem(filesystem: VirtualFileSystem, existingRoot: VirtualFileSystem, options?: {
23
- readOnlyAfterBootstrap?: boolean;
24
- }): {
25
- filesystem: VirtualFileSystem;
26
- finishKernelBootstrap: () => void;
27
- };
28
- export declare function getBaseFilesystemSnapshot(): BaseFilesystemSnapshot;
20
+ /** The default VM environment (a fresh, mutable copy per call). */
29
21
  export declare function getBaseEnvironment(): Record<string, string>;
30
- export declare function getBaseFilesystemEntries(): BaseFilesystemEntry[];
31
- export declare function createBaseRootFilesystem(): Promise<{
32
- filesystem: VirtualFileSystem;
33
- finishKernelBootstrap: () => void;
34
- }>;
@@ -1,173 +1,25 @@
1
- import { readFileSync } from "node:fs";
2
- import { createRequire } from "node:module";
3
- import * as posixPath from "node:path/posix";
4
- import { createFilesystemFromEntries, } from "./filesystem-snapshot.js";
5
- import { createOverlayBackend } from "./overlay-filesystem.js";
6
- import { KernelError } from "./runtime-compat.js";
7
- const require = createRequire(import.meta.url);
8
- const SNAPSHOT_PATH = require.resolve("@secure-exec/core/fixtures/base-filesystem.json");
9
- const SUPPRESSED_KERNEL_BOOTSTRAP_DIRS = new Set([
10
- "/boot",
11
- "/usr/games",
12
- "/usr/include",
13
- "/usr/libexec",
14
- "/usr/man",
15
- ]);
16
- const SUPPRESSED_KERNEL_BOOTSTRAP_FILES = new Set(["/usr/bin/env"]);
17
- let snapshotCache = null;
18
- function loadSnapshot() {
19
- if (snapshotCache) {
20
- return snapshotCache;
21
- }
22
- snapshotCache = JSON.parse(readFileSync(SNAPSHOT_PATH, "utf-8"));
23
- return snapshotCache;
24
- }
25
- function normalizePath(path) {
26
- const normalized = posixPath.normalize(path);
27
- return normalized === "." ? "/" : normalized;
28
- }
29
- export async function createBaseLowerFilesystem() {
30
- return createFilesystemFromEntries(getBaseFilesystemEntries());
31
- }
32
- export function createBootstrapAwareFilesystem(filesystem, existingRoot, options) {
33
- let bootstrapActive = true;
34
- let writesLocked = false;
35
- function throwReadOnly() {
36
- throw new KernelError("EROFS", "read-only file system");
37
- }
38
- async function rootHasPath(path) {
39
- try {
40
- return await existingRoot.exists(path);
41
- }
42
- catch {
43
- return false;
44
- }
45
- }
46
- const wrapped = {
47
- ...filesystem,
48
- async createDir(path) {
49
- if (writesLocked) {
50
- throwReadOnly();
51
- }
52
- const normalized = normalizePath(path);
53
- if (bootstrapActive &&
54
- SUPPRESSED_KERNEL_BOOTSTRAP_DIRS.has(normalized) &&
55
- !(await rootHasPath(normalized))) {
56
- return;
57
- }
58
- return filesystem.createDir(path);
59
- },
60
- async mkdir(path, options) {
61
- if (writesLocked) {
62
- if (options?.recursive && (await rootHasPath(path))) {
63
- return;
64
- }
65
- throwReadOnly();
66
- }
67
- const normalized = normalizePath(path);
68
- if (bootstrapActive &&
69
- options?.recursive &&
70
- SUPPRESSED_KERNEL_BOOTSTRAP_DIRS.has(normalized) &&
71
- !(await rootHasPath(normalized))) {
72
- return;
73
- }
74
- return filesystem.mkdir(path, options);
75
- },
76
- async writeFile(path, content) {
77
- if (writesLocked) {
78
- throwReadOnly();
79
- }
80
- const normalized = normalizePath(path);
81
- if (bootstrapActive &&
82
- SUPPRESSED_KERNEL_BOOTSTRAP_FILES.has(normalized)) {
83
- return;
84
- }
85
- return filesystem.writeFile(path, content);
86
- },
87
- async removeFile(path) {
88
- if (writesLocked) {
89
- throwReadOnly();
90
- }
91
- return filesystem.removeFile(path);
92
- },
93
- async removeDir(path) {
94
- if (writesLocked) {
95
- throwReadOnly();
96
- }
97
- return filesystem.removeDir(path);
98
- },
99
- async rename(oldPath, newPath) {
100
- if (writesLocked) {
101
- throwReadOnly();
102
- }
103
- return filesystem.rename(oldPath, newPath);
104
- },
105
- async symlink(target, linkPath) {
106
- if (writesLocked) {
107
- throwReadOnly();
108
- }
109
- return filesystem.symlink(target, linkPath);
110
- },
111
- async link(oldPath, newPath) {
112
- if (writesLocked) {
113
- throwReadOnly();
114
- }
115
- return filesystem.link(oldPath, newPath);
116
- },
117
- async chmod(path, mode) {
118
- if (writesLocked) {
119
- throwReadOnly();
120
- }
121
- return filesystem.chmod(path, mode);
122
- },
123
- async chown(path, uid, gid) {
124
- if (writesLocked) {
125
- throwReadOnly();
126
- }
127
- return filesystem.chown(path, uid, gid);
128
- },
129
- async utimes(path, atime, mtime) {
130
- if (writesLocked) {
131
- throwReadOnly();
132
- }
133
- return filesystem.utimes(path, atime, mtime);
134
- },
135
- async truncate(path, length) {
136
- if (writesLocked) {
137
- throwReadOnly();
138
- }
139
- return filesystem.truncate(path, length);
140
- },
141
- async pwrite(path, offset, data) {
142
- if (writesLocked) {
143
- throwReadOnly();
144
- }
145
- return filesystem.pwrite(path, offset, data);
146
- },
147
- };
148
- return {
149
- filesystem: wrapped,
150
- finishKernelBootstrap() {
151
- bootstrapActive = false;
152
- writesLocked = options?.readOnlyAfterBootstrap ?? false;
153
- },
154
- };
155
- }
156
- export function getBaseFilesystemSnapshot() {
157
- return loadSnapshot();
158
- }
1
+ /**
2
+ * The base VM environment, baked in as a constant (verbatim from the single
3
+ * `base-filesystem.json` the sidecar embeds). The host no longer reads that JSON
4
+ * — the sidecar owns the base filesystem, and there is exactly one committed copy
5
+ * of it (`secure-exec/crates/vfs/assets/base-filesystem.json`). Regenerate both
6
+ * this constant and that file together with the build-tools snapshot script.
7
+ */
8
+ const BASE_ENVIRONMENT = Object.freeze({
9
+ CHARSET: "UTF-8",
10
+ HOME: "/home/agentos",
11
+ HOSTNAME: "secure-exec",
12
+ LANG: "C.UTF-8",
13
+ LC_COLLATE: "C",
14
+ LOGNAME: "agentos",
15
+ PAGER: "less",
16
+ PATH: "/usr/local/sbin:/usr/local/bin:/opt/agentos/bin:/usr/sbin:/usr/bin:/sbin:/bin",
17
+ MANPATH: "/opt/agentos/share/man:/usr/local/share/man:/usr/share/man",
18
+ SHELL: "/bin/sh",
19
+ USER: "agentos",
20
+ PS1: "\\h:\\w\\$ ",
21
+ });
22
+ /** The default VM environment (a fresh, mutable copy per call). */
159
23
  export function getBaseEnvironment() {
160
- const snapshot = loadSnapshot();
161
- return {
162
- ...snapshot.environment.env,
163
- PS1: snapshot.environment.prompt,
164
- };
165
- }
166
- export function getBaseFilesystemEntries() {
167
- return loadSnapshot().filesystem.entries;
168
- }
169
- export async function createBaseRootFilesystem() {
170
- const lower = await createBaseLowerFilesystem();
171
- const overlay = createOverlayBackend({ lower });
172
- return createBootstrapAwareFilesystem(overlay, lower);
24
+ return { ...BASE_ENVIRONMENT };
173
25
  }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Default software + on-demand agents — FULLY DYNAMIC, no hardcoded lists.
3
+ *
4
+ * This package's own `@agentos-software/*` runtime dependencies (from
5
+ * `dependencies`, never `devDependencies`) are the entire universe:
6
+ *
7
+ * - `resolveDefaultSoftware()` — the set a bare `AgentOs.create()` projects:
8
+ * every NON-agent dependency's registry-built descriptor (`{ packageDir }`,
9
+ * or an ARRAY for meta-packages like `@agentos-software/common`). Agent
10
+ * packages are deliberately NOT projected by default — each carries a full
11
+ * node closure (and pi a V8 snapshot bundle), so they enter a VM only when a
12
+ * session actually needs them.
13
+ * - `resolveDependencyAgents()` — the agent packages, keyed by their manifest
14
+ * `name` (the `createSession(id)` id). `createSession` links the matching
15
+ * package into the running VM on first use (`linkSoftware`), which registers
16
+ * its entrypoint/env from the package's own `agentos-package.json`.
17
+ *
18
+ * Adding a default command set or an available agent = adding a dependency.
19
+ * Resolution THROWS with build instructions instead of silently skipping: a
20
+ * missing artifact means either `pnpm install` was not run or, with the
21
+ * file-linked deps, the sibling secure-exec registry was not built.
22
+ */
23
+ /** A registry package descriptor: a package dir, or `{ packageDir }`. */
24
+ type SoftwareDescriptor = string | {
25
+ packageDir: string;
26
+ };
27
+ /**
28
+ * The default (non-agent) software set: every `@agentos-software/*`
29
+ * dependency's descriptor(s) whose packed manifest has no `agent` entry.
30
+ * Library deps (e.g. `@agentos-software/manifest`) export no descriptor and
31
+ * are skipped. Opt out with `AgentOs.create({ defaultSoftware: false })`.
32
+ */
33
+ export declare function resolveDefaultSoftware(): Promise<SoftwareDescriptor[]>;
34
+ export interface DependencyAgent {
35
+ /** The dependency package name (e.g. `@agentos-software/pi`). */
36
+ dependency: string;
37
+ /** The packed runtime dir to `linkSoftware`. */
38
+ packageDir: string;
39
+ /** The agent's ACP entrypoint command name. */
40
+ acpEntrypoint: string;
41
+ }
42
+ /**
43
+ * Agent packages among the dependencies, keyed by manifest `name` (the
44
+ * `createSession(id)` id). Sync (no module import — the packed manifest is
45
+ * read straight from `<dep>/dist/package/`). Unbuilt agent deps THROW.
46
+ */
47
+ export declare function resolveDependencyAgents(): Map<string, DependencyAgent>;
48
+ export {};
@@ -0,0 +1,93 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
6
+ const requireFromHere = createRequire(import.meta.url);
7
+ const BUILD_INSTRUCTIONS = "With file-linked deps, build the registry in the sibling secure-exec " +
8
+ "checkout: `just registry-build` (see its registry/README.md).";
9
+ function dependencyNames() {
10
+ const manifest = JSON.parse(readFileSync(join(PACKAGE_ROOT, "package.json"), "utf8"));
11
+ return Object.keys(manifest.dependencies ?? {})
12
+ .filter((name) => name.startsWith("@agentos-software/"))
13
+ .sort();
14
+ }
15
+ function descriptorDir(ref) {
16
+ return typeof ref === "string" ? ref : ref.packageDir;
17
+ }
18
+ function readPackedManifest(dir) {
19
+ const path = join(dir, "agentos-package.json");
20
+ if (!existsSync(path))
21
+ return undefined;
22
+ try {
23
+ return JSON.parse(readFileSync(path, "utf8"));
24
+ }
25
+ catch {
26
+ return undefined;
27
+ }
28
+ }
29
+ function assertBuilt(name, dir) {
30
+ if (!existsSync(join(dir, "package.json"))) {
31
+ throw new Error(`software package ${name} is not BUILT (missing ${dir}). ${BUILD_INSTRUCTIONS}`);
32
+ }
33
+ }
34
+ /**
35
+ * The default (non-agent) software set: every `@agentos-software/*`
36
+ * dependency's descriptor(s) whose packed manifest has no `agent` entry.
37
+ * Library deps (e.g. `@agentos-software/manifest`) export no descriptor and
38
+ * are skipped. Opt out with `AgentOs.create({ defaultSoftware: false })`.
39
+ */
40
+ export async function resolveDefaultSoftware() {
41
+ const software = [];
42
+ for (const name of dependencyNames()) {
43
+ let mod;
44
+ try {
45
+ mod = (await import(name));
46
+ }
47
+ catch (error) {
48
+ throw new Error(`software package ${name} could not be imported — run \`pnpm install\` ` +
49
+ `(it is a dependency of this package): ${String(error)}`);
50
+ }
51
+ if (mod.default === undefined)
52
+ continue; // library dep, not software
53
+ for (const descriptor of [mod.default].flat()) {
54
+ const dir = descriptorDir(descriptor);
55
+ assertBuilt(name, dir);
56
+ if (readPackedManifest(dir)?.agent)
57
+ continue; // agents load lazily
58
+ software.push(descriptor);
59
+ }
60
+ }
61
+ return software;
62
+ }
63
+ /**
64
+ * Agent packages among the dependencies, keyed by manifest `name` (the
65
+ * `createSession(id)` id). Sync (no module import — the packed manifest is
66
+ * read straight from `<dep>/dist/package/`). Unbuilt agent deps THROW.
67
+ */
68
+ export function resolveDependencyAgents() {
69
+ const agents = new Map();
70
+ for (const name of dependencyNames()) {
71
+ let entry;
72
+ try {
73
+ entry = requireFromHere.resolve(name); // -> <pkg>/dist/index.js
74
+ }
75
+ catch {
76
+ continue; // not installed — surfaced by resolveDefaultSoftware/import paths
77
+ }
78
+ const dir = join(dirname(entry), "package");
79
+ const manifest = readPackedManifest(dir);
80
+ if (!manifest?.agent)
81
+ continue;
82
+ if (!manifest.name || !manifest.agent.acpEntrypoint) {
83
+ throw new Error(`agent package ${name} has an invalid packed manifest (${dir}/agentos-package.json) — rebuild it (\`just registry-build\`)`);
84
+ }
85
+ assertBuilt(name, dir);
86
+ agents.set(manifest.name, {
87
+ dependency: name,
88
+ packageDir: dir,
89
+ acpEntrypoint: manifest.agent.acpEntrypoint,
90
+ });
91
+ }
92
+ return agents;
93
+ }
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ export { hostTool, MAX_TOOL_DESCRIPTION_LENGTH, toolKit, validateToolkits, } fro
6
6
  export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, hostToolSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, toolKitSchema, } from "./options-schema.js";
7
7
  export { createInMemoryLayerStore, createSnapshotExport, } from "./layers.js";
8
8
  export { defineSoftware } from "./packages.js";
9
+ export { isPackageDescriptor, OPT_AGENTOS_BIN, OPT_AGENTOS_ROOT, tryReadAgentosPackageManifest, } from "./agentos-package.js";
9
10
  export { isAcpTimeoutErrorData, isUnknownSessionErrorData, } from "./json-rpc.js";
10
11
  export { createInMemoryFileSystem, KernelError } from "./runtime-compat.js";
12
+ export type { ExecOptions, ExecResult, ManagedProcess, ProcessInfo, ShellHandle, VirtualDirEntry, VirtualStat, } from "./runtime.js";
11
13
  export type * from "./types.js";
package/dist/index.js CHANGED
@@ -7,5 +7,6 @@ export { hostTool, MAX_TOOL_DESCRIPTION_LENGTH, toolKit, validateToolkits, } fro
7
7
  export { agentOsLimitsSchema, agentOsOptionFieldSchemas, agentOsOptionsSchema, hostToolSchema, mountConfigSchema, nativeMountConfigSchema, parseAgentOsOptions, permissionsSchema, rootFilesystemConfigSchema, sharedSidecarConfigSchema, sidecarConfigSchema, toolKitSchema, } from "./options-schema.js";
8
8
  export { createInMemoryLayerStore, createSnapshotExport, } from "./layers.js";
9
9
  export { defineSoftware } from "./packages.js";
10
+ export { isPackageDescriptor, OPT_AGENTOS_BIN, OPT_AGENTOS_ROOT, tryReadAgentosPackageManifest, } from "./agentos-package.js";
10
11
  export { isAcpTimeoutErrorData, isUnknownSessionErrorData, } from "./json-rpc.js";
11
12
  export { createInMemoryFileSystem, KernelError } from "./runtime-compat.js";
package/dist/layers.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type BaseFilesystemSnapshot } from "./base-filesystem.js";
1
+ import type { BaseFilesystemSnapshot } from "./base-filesystem.js";
2
2
  import { type FilesystemEntry } from "./filesystem-snapshot.js";
3
3
  import type { VirtualFileSystem } from "./runtime-compat.js";
4
4
  export type OverlayFilesystemMode = "ephemeral" | "read-only";
@@ -49,4 +49,3 @@ export interface LayerStore {
49
49
  }
50
50
  export declare function createSnapshotExport(entries: FilesystemEntry[]): RootSnapshotExport;
51
51
  export declare function createInMemoryLayerStore(): LayerStore;
52
- export declare function createDefaultRootLowerInput(): SnapshotImportSource;
package/dist/layers.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { getBaseFilesystemSnapshot, } from "./base-filesystem.js";
3
2
  import { createFilesystemFromEntries, snapshotVirtualFilesystem, } from "./filesystem-snapshot.js";
4
3
  import { createOverlayBackend } from "./overlay-filesystem.js";
5
4
  function cloneSnapshotHandle(storeId, layerId) {
@@ -193,9 +192,3 @@ export function createInMemoryLayerStore() {
193
192
  };
194
193
  return store;
195
194
  }
196
- export function createDefaultRootLowerInput() {
197
- return {
198
- kind: "base-filesystem-artifact",
199
- source: getBaseFilesystemSnapshot(),
200
- };
201
- }
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod/v4";
2
- import type { AgentOsOptions, AgentStderrHandler, LimitWarningHandler, NativeMountConfig } from "./agent-os.js";
2
+ import type { AgentExitHandler, AgentOsOptions, AgentStderrHandler, LimitWarningHandler, NativeMountConfig } from "./agent-os.js";
3
3
  import type { HostTool, ToolKit } from "./host-tools.js";
4
4
  export declare const permissionsSchema: z.ZodObject<{
5
5
  fs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
@@ -224,6 +224,7 @@ export declare const agentOsOptionFieldSchemas: {
224
224
  readonly defaultSoftware: z.ZodOptional<z.ZodBoolean>;
225
225
  readonly loopbackExemptPorts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
226
226
  readonly allowedNodeBuiltins: z.ZodOptional<z.ZodArray<z.ZodString>>;
227
+ readonly highResolutionTime: z.ZodOptional<z.ZodBoolean>;
227
228
  readonly rootFilesystem: z.ZodOptional<z.ZodObject<{
228
229
  type: z.ZodOptional<z.ZodLiteral<"overlay">>;
229
230
  mode: z.ZodOptional<z.ZodEnum<{
@@ -432,6 +433,7 @@ export declare const agentOsOptionFieldSchemas: {
432
433
  }, z.core.$strict>>;
433
434
  }, z.core.$strict>>;
434
435
  readonly onAgentStderr: z.ZodOptional<z.ZodCustom<AgentStderrHandler, AgentStderrHandler>>;
436
+ readonly onAgentExit: z.ZodOptional<z.ZodCustom<AgentExitHandler, AgentExitHandler>>;
435
437
  readonly onLimitWarning: z.ZodOptional<z.ZodCustom<LimitWarningHandler, LimitWarningHandler>>;
436
438
  };
437
439
  export declare const agentOsOptionsSchema: z.ZodType<AgentOsOptions>;
@@ -236,6 +236,7 @@ export const agentOsOptionFieldSchemas = {
236
236
  defaultSoftware: z.boolean().optional(),
237
237
  loopbackExemptPorts: z.array(z.number().int().min(0).max(65535)).optional(),
238
238
  allowedNodeBuiltins: stringArray.optional(),
239
+ highResolutionTime: z.boolean().optional(),
239
240
  rootFilesystem: rootFilesystemConfigSchema.optional(),
240
241
  mounts: z.array(mountConfigSchema).optional(),
241
242
  moduleAccessCwd: z.string().optional(),
@@ -250,6 +251,7 @@ export const agentOsOptionFieldSchemas = {
250
251
  sidecar: sidecarConfigSchema.optional(),
251
252
  limits: agentOsLimitsSchema.optional(),
252
253
  onAgentStderr: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
254
+ onAgentExit: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
253
255
  onLimitWarning: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
254
256
  };
255
257
  export const agentOsOptionsSchema = z