@rivet-dev/agentos-core 0.0.0-abc-fixes-1.d8c4d95 → 0.0.0-agent-acp-codex-session-benchmark.62b1f46

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.
Files changed (128) hide show
  1. package/README.md +48 -48
  2. package/dist/agent-os.d.ts +215 -161
  3. package/dist/agent-os.js +1300 -2576
  4. package/dist/agentos-package.d.ts +27 -0
  5. package/dist/agentos-package.js +21 -0
  6. package/dist/base-filesystem.d.ts +1 -16
  7. package/dist/base-filesystem.js +1 -173
  8. package/dist/cron/cron-manager.d.ts +39 -14
  9. package/dist/cron/cron-manager.js +289 -128
  10. package/dist/cron/errors.d.ts +8 -0
  11. package/dist/cron/errors.js +16 -0
  12. package/dist/cron/index.d.ts +1 -3
  13. package/dist/cron/index.js +1 -2
  14. package/dist/cron/types.d.ts +2 -2
  15. package/dist/default-software.d.ts +8 -0
  16. package/dist/default-software.js +10 -0
  17. package/dist/filesystem-snapshot.d.ts +1 -1
  18. package/dist/filesystem-snapshot.js +1 -1
  19. package/dist/generated/AcpLimitsConfig.d.ts +4 -0
  20. package/dist/generated/AcpLimitsConfig.js +2 -0
  21. package/dist/generated/CreateVmConfig.d.ts +29 -0
  22. package/dist/generated/FsPermissionRule.d.ts +6 -0
  23. package/dist/generated/FsPermissionRule.js +1 -0
  24. package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
  25. package/dist/generated/FsPermissionRuleSet.js +1 -0
  26. package/dist/generated/FsPermissionScope.d.ts +3 -0
  27. package/dist/generated/FsPermissionScope.js +1 -0
  28. package/dist/generated/HttpLimitsConfig.d.ts +3 -0
  29. package/dist/generated/HttpLimitsConfig.js +2 -0
  30. package/dist/generated/JsModuleResolution.d.ts +1 -0
  31. package/dist/generated/JsModuleResolution.js +2 -0
  32. package/dist/generated/JsRuntimeConfig.d.ts +31 -0
  33. package/dist/generated/JsRuntimeConfig.js +1 -0
  34. package/dist/generated/JsRuntimeLimitsConfig.d.ts +8 -0
  35. package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
  36. package/dist/generated/JsRuntimePlatform.d.ts +1 -0
  37. package/dist/generated/JsRuntimePlatform.js +2 -0
  38. package/dist/generated/MountPluginDescriptor.d.ts +4 -0
  39. package/dist/generated/MountPluginDescriptor.js +2 -0
  40. package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
  41. package/dist/generated/NativeRootFilesystemConfig.js +1 -0
  42. package/dist/generated/PatternPermissionRule.d.ts +6 -0
  43. package/dist/generated/PatternPermissionRule.js +1 -0
  44. package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
  45. package/dist/generated/PatternPermissionRuleSet.js +1 -0
  46. package/dist/generated/PatternPermissionScope.d.ts +3 -0
  47. package/dist/generated/PatternPermissionScope.js +1 -0
  48. package/dist/generated/PermissionMode.d.ts +1 -0
  49. package/dist/generated/PermissionMode.js +2 -0
  50. package/dist/generated/PermissionsPolicy.d.ts +10 -0
  51. package/dist/generated/PermissionsPolicy.js +1 -0
  52. package/dist/generated/PluginLimitsConfig.d.ts +4 -0
  53. package/dist/generated/PluginLimitsConfig.js +2 -0
  54. package/dist/generated/PythonLimitsConfig.d.ts +6 -0
  55. package/dist/generated/PythonLimitsConfig.js +2 -0
  56. package/dist/generated/ResourceLimitsConfig.d.ts +25 -0
  57. package/dist/generated/ResourceLimitsConfig.js +2 -0
  58. package/dist/generated/RootFilesystemConfig.d.ts +9 -0
  59. package/dist/generated/RootFilesystemConfig.js +1 -0
  60. package/dist/generated/RootFilesystemEntry.d.ts +13 -0
  61. package/dist/generated/RootFilesystemEntry.js +1 -0
  62. package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
  63. package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
  64. package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
  65. package/dist/generated/RootFilesystemEntryKind.js +2 -0
  66. package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
  67. package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
  68. package/dist/generated/RootFilesystemMode.d.ts +1 -0
  69. package/dist/generated/RootFilesystemMode.js +2 -0
  70. package/dist/generated/ToolLimitsConfig.d.ts +10 -0
  71. package/dist/generated/ToolLimitsConfig.js +2 -0
  72. package/dist/generated/VmDnsConfig.d.ts +6 -0
  73. package/dist/generated/VmDnsConfig.js +2 -0
  74. package/dist/generated/VmLimitsConfig.d.ts +18 -0
  75. package/dist/generated/VmLimitsConfig.js +1 -0
  76. package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
  77. package/dist/generated/VmListenPolicyConfig.js +2 -0
  78. package/dist/generated/WasmLimitsConfig.d.ts +7 -0
  79. package/dist/generated/WasmLimitsConfig.js +2 -0
  80. package/dist/host-dir-mount.d.ts +5 -5
  81. package/dist/host-dir-mount.js +4 -4
  82. package/dist/host-tools-zod.js +27 -7
  83. package/dist/host-tools.d.ts +2 -9
  84. package/dist/host-tools.js +0 -18
  85. package/dist/index.d.ts +7 -4
  86. package/dist/index.js +6 -4
  87. package/dist/layers.d.ts +3 -3
  88. package/dist/layers.js +19 -10
  89. package/dist/memory-filesystem.d.ts +39 -0
  90. package/dist/memory-filesystem.js +375 -0
  91. package/dist/options-schema.d.ts +452 -0
  92. package/dist/options-schema.js +269 -0
  93. package/dist/overlay-filesystem.d.ts +1 -1
  94. package/dist/overlay-filesystem.js +3 -3
  95. package/dist/packages.d.ts +10 -123
  96. package/dist/packages.js +3 -329
  97. package/dist/runtime.d.ts +41 -184
  98. package/dist/sidecar/agentos-protocol.d.ts +232 -29
  99. package/dist/sidecar/agentos-protocol.js +456 -120
  100. package/dist/sidecar/binary.d.ts +2 -2
  101. package/dist/sidecar/binary.js +2 -2
  102. package/dist/sidecar/native-process-client.d.ts +5 -3
  103. package/dist/sidecar/native-process-client.js +5 -3
  104. package/dist/sidecar/permissions.d.ts +4 -3
  105. package/dist/sidecar/permissions.js +6 -23
  106. package/dist/sidecar/rpc-client.d.ts +74 -86
  107. package/dist/sidecar/rpc-client.js +422 -1418
  108. package/dist/test/file-system.d.ts +1 -1
  109. package/dist/test/file-system.js +3 -1
  110. package/dist/test/runtime.d.ts +2 -3
  111. package/dist/test/runtime.js +1 -1
  112. package/dist/test/terminal-harness.d.ts +5 -4
  113. package/dist/test/terminal-harness.js +12 -7
  114. package/dist/types.d.ts +12 -5
  115. package/package.json +37 -41
  116. package/dist/agents.d.ts +0 -63
  117. package/dist/agents.js +0 -42
  118. package/dist/cron/parse-schedule.d.ts +0 -25
  119. package/dist/cron/parse-schedule.js +0 -66
  120. package/dist/cron/schedule-driver.d.ts +0 -19
  121. package/dist/cron/timer-driver.d.ts +0 -17
  122. package/dist/cron/timer-driver.js +0 -61
  123. package/dist/runtime-compat.d.ts +0 -475
  124. package/dist/runtime-compat.js +0 -2010
  125. package/dist/sidecar/cargo.d.ts +0 -2
  126. package/dist/sidecar/cargo.js +0 -142
  127. package/fixtures/AGENTOS_SYSTEM_PROMPT.md +0 -21
  128. /package/dist/{cron/schedule-driver.js → generated/CreateVmConfig.js} +0 -0
@@ -0,0 +1,269 @@
1
+ import { z } from "zod/v4";
2
+ const stringArray = z.array(z.string());
3
+ const nonNegativeInteger = z.number().int().nonnegative();
4
+ const positiveInteger = z.number().int().positive();
5
+ const functionSchema = z.custom((value) => typeof value === "function", { message: "Expected function" });
6
+ const permissionModeSchema = z.enum(["allow", "deny"]);
7
+ const fsPermissionRuleSchema = z
8
+ .object({
9
+ mode: permissionModeSchema,
10
+ operations: stringArray.optional(),
11
+ paths: stringArray.optional(),
12
+ })
13
+ .strict();
14
+ const patternPermissionRuleSchema = z
15
+ .object({
16
+ mode: permissionModeSchema,
17
+ operations: stringArray.optional(),
18
+ patterns: stringArray.optional(),
19
+ })
20
+ .strict();
21
+ const fsRulePermissionsSchema = z
22
+ .object({
23
+ default: permissionModeSchema.optional(),
24
+ rules: z.array(fsPermissionRuleSchema),
25
+ })
26
+ .strict();
27
+ const patternRulePermissionsSchema = z
28
+ .object({
29
+ default: permissionModeSchema.optional(),
30
+ rules: z.array(patternPermissionRuleSchema),
31
+ })
32
+ .strict();
33
+ const fsPermissionsSchema = z.union([permissionModeSchema, fsRulePermissionsSchema]);
34
+ const patternPermissionsSchema = z.union([
35
+ permissionModeSchema,
36
+ patternRulePermissionsSchema,
37
+ ]);
38
+ export const permissionsSchema = z
39
+ .object({
40
+ fs: fsPermissionsSchema.optional(),
41
+ network: patternPermissionsSchema.optional(),
42
+ childProcess: patternPermissionsSchema.optional(),
43
+ process: patternPermissionsSchema.optional(),
44
+ env: patternPermissionsSchema.optional(),
45
+ binding: patternPermissionsSchema.optional(),
46
+ })
47
+ .strict();
48
+ export const agentOsLimitsSchema = z
49
+ .object({
50
+ resources: z
51
+ .object({
52
+ cpuCount: positiveInteger.optional(),
53
+ maxProcesses: nonNegativeInteger.optional(),
54
+ maxCapturedOutputBytes: positiveInteger.optional(),
55
+ maxOpenFds: nonNegativeInteger.optional(),
56
+ maxPipes: nonNegativeInteger.optional(),
57
+ maxPtys: nonNegativeInteger.optional(),
58
+ maxSockets: nonNegativeInteger.optional(),
59
+ maxConnections: nonNegativeInteger.optional(),
60
+ maxSocketBufferedBytes: nonNegativeInteger.optional(),
61
+ maxSocketDatagramQueueLen: nonNegativeInteger.optional(),
62
+ maxFilesystemBytes: nonNegativeInteger.optional(),
63
+ maxInodeCount: nonNegativeInteger.optional(),
64
+ maxBlockingReadMs: nonNegativeInteger.optional(),
65
+ maxPreadBytes: nonNegativeInteger.optional(),
66
+ maxFdWriteBytes: nonNegativeInteger.optional(),
67
+ maxProcessArgvBytes: nonNegativeInteger.optional(),
68
+ maxProcessEnvBytes: nonNegativeInteger.optional(),
69
+ maxReaddirEntries: nonNegativeInteger.optional(),
70
+ maxWasmFuel: nonNegativeInteger.optional(),
71
+ maxWasmMemoryBytes: nonNegativeInteger.optional(),
72
+ maxWasmStackBytes: nonNegativeInteger.optional(),
73
+ })
74
+ .strict()
75
+ .optional(),
76
+ http: z
77
+ .object({ maxFetchResponseBytes: positiveInteger.optional() })
78
+ .strict()
79
+ .optional(),
80
+ tools: z
81
+ .object({
82
+ defaultToolTimeoutMs: nonNegativeInteger.optional(),
83
+ maxToolTimeoutMs: nonNegativeInteger.optional(),
84
+ maxRegisteredToolkits: positiveInteger.optional(),
85
+ maxRegisteredToolsPerVm: positiveInteger.optional(),
86
+ maxToolsPerToolkit: positiveInteger.optional(),
87
+ maxToolSchemaBytes: positiveInteger.optional(),
88
+ maxToolExamplesPerTool: nonNegativeInteger.optional(),
89
+ maxToolExampleInputBytes: positiveInteger.optional(),
90
+ })
91
+ .strict()
92
+ .optional(),
93
+ plugins: z
94
+ .object({
95
+ maxPersistedManifestBytes: positiveInteger.optional(),
96
+ maxPersistedManifestFileBytes: nonNegativeInteger.optional(),
97
+ })
98
+ .strict()
99
+ .optional(),
100
+ acp: z
101
+ .object({
102
+ maxReadLineBytes: positiveInteger.optional(),
103
+ stdoutBufferByteLimit: positiveInteger.optional(),
104
+ })
105
+ .strict()
106
+ .optional(),
107
+ jsRuntime: z
108
+ .object({
109
+ v8HeapLimitMb: positiveInteger.optional(),
110
+ syncRpcWaitTimeoutMs: nonNegativeInteger.optional(),
111
+ cpuTimeLimitMs: nonNegativeInteger.optional(),
112
+ wallClockLimitMs: nonNegativeInteger.optional(),
113
+ importCacheMaterializeTimeoutMs: positiveInteger.optional(),
114
+ capturedOutputLimitBytes: positiveInteger.optional(),
115
+ })
116
+ .strict()
117
+ .optional(),
118
+ python: z
119
+ .object({
120
+ outputBufferMaxBytes: positiveInteger.optional(),
121
+ executionTimeoutMs: positiveInteger.optional(),
122
+ maxOldSpaceMb: nonNegativeInteger.optional(),
123
+ vfsRpcTimeoutMs: positiveInteger.optional(),
124
+ })
125
+ .strict()
126
+ .optional(),
127
+ wasm: z
128
+ .object({
129
+ maxModuleFileBytes: positiveInteger.optional(),
130
+ capturedOutputLimitBytes: positiveInteger.optional(),
131
+ syncReadLimitBytes: positiveInteger.optional(),
132
+ prewarmTimeoutMs: positiveInteger.optional(),
133
+ runnerHeapLimitMb: positiveInteger.optional(),
134
+ })
135
+ .strict()
136
+ .optional(),
137
+ })
138
+ .strict();
139
+ const rootLowerInputSchema = z.union([
140
+ z.object({ kind: z.literal("bundled-base-filesystem") }).strict(),
141
+ z.object({ kind: z.literal("snapshot-export"), source: z.unknown() }).strict(),
142
+ ]);
143
+ export const rootFilesystemConfigSchema = z
144
+ .object({
145
+ type: z.literal("overlay").optional(),
146
+ mode: z.enum(["ephemeral", "read-only"]).optional(),
147
+ disableDefaultBaseLayer: z.boolean().optional(),
148
+ lowers: z.array(rootLowerInputSchema).optional(),
149
+ })
150
+ .strict();
151
+ const nativeMountPluginSchema = z
152
+ .object({
153
+ id: z.string(),
154
+ config: z.unknown().optional(),
155
+ })
156
+ .strict();
157
+ const plainMountConfigSchema = z
158
+ .object({
159
+ path: z.string(),
160
+ driver: z.custom((value) => typeof value === "object" && value !== null, {
161
+ message: "Expected filesystem driver object",
162
+ }),
163
+ readOnly: z.boolean().optional(),
164
+ })
165
+ .strict();
166
+ export const nativeMountConfigSchema = z
167
+ .object({
168
+ path: z.string(),
169
+ plugin: nativeMountPluginSchema,
170
+ readOnly: z.boolean().optional(),
171
+ })
172
+ .strict();
173
+ const overlayMountConfigSchema = z
174
+ .object({
175
+ path: z.string(),
176
+ filesystem: z
177
+ .object({
178
+ type: z.literal("overlay"),
179
+ store: z.unknown(),
180
+ mode: z.enum(["ephemeral", "read-only"]).optional(),
181
+ lowers: z.array(z.unknown()),
182
+ })
183
+ .strict(),
184
+ })
185
+ .strict();
186
+ export const mountConfigSchema = z.union([
187
+ plainMountConfigSchema,
188
+ nativeMountConfigSchema,
189
+ overlayMountConfigSchema,
190
+ ]);
191
+ export const sharedSidecarConfigSchema = z
192
+ .object({
193
+ kind: z.literal("shared"),
194
+ pool: z.string().optional(),
195
+ })
196
+ .strict();
197
+ const explicitSidecarSchema = z
198
+ .object({
199
+ kind: z.literal("explicit"),
200
+ handle: z.unknown(),
201
+ })
202
+ .strict();
203
+ export const sidecarConfigSchema = z.union([
204
+ sharedSidecarConfigSchema,
205
+ explicitSidecarSchema,
206
+ ]);
207
+ const toolExampleSchema = z
208
+ .object({
209
+ description: z.string(),
210
+ input: z.unknown(),
211
+ })
212
+ .strict();
213
+ export const hostToolSchema = z
214
+ .object({
215
+ description: z.string(),
216
+ inputSchema: z.custom((value) => typeof value === "object" && value !== null, {
217
+ message: "Expected Zod schema object",
218
+ }),
219
+ execute: functionSchema,
220
+ examples: z.array(toolExampleSchema).optional(),
221
+ timeout: nonNegativeInteger.optional(),
222
+ })
223
+ .strict();
224
+ export const toolKitSchema = z
225
+ .object({
226
+ name: z.string(),
227
+ description: z.string(),
228
+ tools: z.record(z.string(), hostToolSchema),
229
+ })
230
+ .strict();
231
+ const softwarePackageRefSchema = z.union([
232
+ z.string(),
233
+ z.object({ packagePath: z.string() }),
234
+ ]);
235
+ const softwareInputSchema = z.union([
236
+ softwarePackageRefSchema,
237
+ z.array(softwarePackageRefSchema),
238
+ ]);
239
+ /**
240
+ * Shared AgentOsOptions field schemas.
241
+ *
242
+ * Core uses the full object. The Rivet/native actor composes a narrower
243
+ * native-safe subset in `packages/agentos/src/config.ts`; keep that subset and
244
+ * `crates/agentos-actor-plugin/src/config.rs::AgentOsConfigJson` aligned when
245
+ * adding options that cross the native boundary.
246
+ */
247
+ export const agentOsOptionFieldSchemas = {
248
+ software: z.array(softwareInputSchema).optional(),
249
+ defaultSoftware: z.boolean().optional(),
250
+ loopbackExemptPorts: z.array(z.number().int().min(0).max(65535)).optional(),
251
+ allowedNodeBuiltins: stringArray.optional(),
252
+ highResolutionTime: z.boolean().optional(),
253
+ rootFilesystem: rootFilesystemConfigSchema.optional(),
254
+ mounts: z.array(mountConfigSchema).optional(),
255
+ additionalInstructions: z.string().optional(),
256
+ toolKits: z.array(toolKitSchema).optional(),
257
+ permissions: permissionsSchema.optional(),
258
+ sidecar: sidecarConfigSchema.optional(),
259
+ limits: agentOsLimitsSchema.optional(),
260
+ onAgentStderr: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
261
+ onAgentExit: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
262
+ onLimitWarning: z.custom((value) => typeof value === "function", { message: "Expected function" }).optional(),
263
+ };
264
+ export const agentOsOptionsSchema = z
265
+ .object(agentOsOptionFieldSchemas)
266
+ .strict();
267
+ export function parseAgentOsOptions(options) {
268
+ return agentOsOptionsSchema.parse(options ?? {});
269
+ }
@@ -5,7 +5,7 @@
5
5
  * filesystems. Reads resolve from highest precedence to lowest. Writes
6
6
  * go to the writable upper only, with copy-up and whiteout behavior.
7
7
  */
8
- import { type VirtualFileSystem } from "./runtime-compat.js";
8
+ import type { VirtualFileSystem } from "./runtime.js";
9
9
  export interface OverlayBackendOptions {
10
10
  /** Legacy single lower layer. */
11
11
  lower?: VirtualFileSystem;
@@ -6,7 +6,7 @@
6
6
  * go to the writable upper only, with copy-up and whiteout behavior.
7
7
  */
8
8
  import * as posixPath from "node:path/posix";
9
- import { createInMemoryFileSystem, KernelError, } from "./runtime-compat.js";
9
+ import { createInMemoryFileSystem, KernelError } from "./memory-filesystem.js";
10
10
  const OVERLAY_METADATA_ROOT = "/.secure-exec-overlay";
11
11
  const OVERLAY_WHITEOUT_DIR = "/.secure-exec-overlay/whiteouts";
12
12
  const OVERLAY_OPAQUE_DIR = "/.secure-exec-overlay/opaque";
@@ -44,7 +44,7 @@ export function createOverlayBackend(options) {
44
44
  function throwMetadataAccessDenied(path, op) {
45
45
  throw new KernelError("EPERM", `operation not permitted, ${op} '${path}'`);
46
46
  }
47
- async function ensureMetadataDirectoriesInUpper(path) {
47
+ async function ensureMetadataDirectoriesInUpper() {
48
48
  if (!upper) {
49
49
  throwReadOnly();
50
50
  }
@@ -67,7 +67,7 @@ export function createOverlayBackend(options) {
67
67
  }
68
68
  const pathForMarker = markerPath(kind, path);
69
69
  if (present) {
70
- await ensureMetadataDirectoriesInUpper(path);
70
+ await ensureMetadataDirectoriesInUpper();
71
71
  await upper.writeFile(pathForMarker, normPath(path));
72
72
  return;
73
73
  }
@@ -1,127 +1,14 @@
1
- import type { PermissionTier } from "./runtime.js";
1
+ import type { SoftwarePackageRef } from "./agentos-package.js";
2
2
  /**
3
- * Resolve a package directory by walking up the directory tree.
4
- * Supports both nested (pnpm) and flat (npm) node_modules layouts.
3
+ * Input type for the `software` option. Software is a self-contained package
4
+ * directory that the secure-exec sidecar materializes into the `/opt/agentos`
5
+ * projection. Accepts a package-dir ref or an array of refs for meta-packages.
5
6
  */
6
- export declare function resolvePackageDir(startDir: string, packageName: string): string;
7
- import type { AgentConfig } from "./agents.js";
8
- export interface SoftwareDescriptor {
9
- name: string;
10
- type: "agent" | "tool" | "wasm-commands";
11
- }
12
- export interface AgentSoftwareDescriptor extends SoftwareDescriptor {
13
- type: "agent";
14
- /**
15
- * Root directory of this npm package on the host. Used to resolve
16
- * dependencies listed in `requires` from this package's node_modules/.
17
- */
18
- packageDir: string;
19
- /** npm packages that must be available inside the VM. */
20
- requires: string[];
21
- agent: {
22
- /** Unique agent ID used in createSession(id). */
23
- id: string;
24
- /** npm package name of the ACP adapter. Must be in requires. */
25
- acpAdapter: string;
26
- /** npm package name of the agent CLI. Must be in requires. */
27
- agentPackage: string;
28
- /** Static env vars passed when spawning the adapter. */
29
- staticEnv?: Record<string, string>;
30
- /** Dynamic env vars computed at boot time. */
31
- env?: (ctx: SoftwareContext) => Record<string, string>;
32
- /** Additional CLI args prepended when launching the ACP adapter. */
33
- launchArgs?: string[];
34
- };
35
- }
36
- export interface ToolSoftwareDescriptor extends SoftwareDescriptor {
37
- type: "tool";
38
- /**
39
- * Root directory of this npm package on the host. Used to resolve
40
- * dependencies listed in `requires` from this package's node_modules/.
41
- */
42
- packageDir: string;
43
- /** npm packages that must be available inside the VM. */
44
- requires: string[];
45
- /** Map of bin command name -> npm package name. */
46
- bins: Record<string, string>;
47
- }
48
- export interface WasmCommandSoftwareDescriptor extends SoftwareDescriptor {
49
- type: "wasm-commands";
50
- /** Absolute path to directory containing WASM command binaries on the host. */
51
- commandDir: string;
52
- /** Symlink aliases: aliasName -> targetCommandName. */
53
- aliases?: Record<string, string>;
54
- /** Permission tier assignments. */
55
- permissions?: {
56
- full?: string[];
57
- readWrite?: string[];
58
- readOnly?: string[] | "*";
59
- isolated?: string[];
60
- };
61
- }
7
+ export type SoftwareEntry = SoftwarePackageRef;
8
+ export type SoftwareInput = SoftwareEntry | SoftwareEntry[];
62
9
  /**
63
- * Any object with a commandDir property is treated as a WASM command package.
64
- * This allows registry packages (e.g., @agentos-software/coreutils) to be
65
- * passed directly to the `software` option without wrapping.
10
+ * Define a software descriptor. A type-safe identity function that validates the
11
+ * package-dir reference at compile time. The sidecar materializes the package into
12
+ * the `/opt/agentos` projection.
66
13
  */
67
- export interface WasmCommandDirDescriptor {
68
- readonly commandDir: string;
69
- [key: string]: unknown;
70
- }
71
- export type AnySoftwareDescriptor = AgentSoftwareDescriptor | ToolSoftwareDescriptor | WasmCommandSoftwareDescriptor | WasmCommandDirDescriptor;
72
- /** Input type for the `software` option. Accepts descriptors or arrays of descriptors (for meta-packages). */
73
- export type SoftwareInput = AnySoftwareDescriptor | AnySoftwareDescriptor[];
74
- export interface SoftwareContext {
75
- /**
76
- * Resolve the bin entry for an npm package to a VM-side path.
77
- * Uses require.resolve on the HOST, then maps to /root/node_modules/...
78
- *
79
- * Example: ctx.resolveBin("@mariozechner/pi-coding-agent", "pi")
80
- * -> "/root/node_modules/@mariozechner/pi-coding-agent/dist/cli.js"
81
- */
82
- resolveBin(packageName: string, binName?: string): string;
83
- /**
84
- * Resolve a package's root directory to a VM-side path.
85
- *
86
- * Example: ctx.resolvePackage("pi-acp")
87
- * -> "/root/node_modules/pi-acp"
88
- */
89
- resolvePackage(packageName: string): string;
90
- }
91
- /** Host-to-VM path mapping for a software package's `/root/node_modules/<pkg>` mount. */
92
- export interface SoftwareRoot {
93
- hostPath: string;
94
- vmPath: string;
95
- }
96
- export interface CommandPackageMetadata {
97
- commandDir: string;
98
- declaredCommands: string[];
99
- aliases: Record<string, string>;
100
- }
101
- /**
102
- * Define a software descriptor. This is a type-safe identity function that
103
- * validates the descriptor shape at compile time.
104
- */
105
- export declare function defineSoftware<T extends AnySoftwareDescriptor>(desc: T): T;
106
- /** Result of processing all software descriptors at boot time. */
107
- export interface ProcessedSoftware {
108
- /** WASM command directories to pass to the WasmVM driver. */
109
- commandDirs: string[];
110
- /** Per-package command metadata used to preserve command availability on the sidecar path. */
111
- commandPackages: CommandPackageMetadata[];
112
- /** Per-command permission tiers propagated into the WasmVM runtime. */
113
- commandPermissions: Record<string, PermissionTier>;
114
- /** Host-to-VM path mappings for software-package `/root/node_modules/<pkg>` mounts. */
115
- softwareRoots: SoftwareRoot[];
116
- /** Agent configs registered by agent software. */
117
- agentConfigs: Map<string, AgentConfig>;
118
- }
119
- /**
120
- * Process an array of software descriptors at boot time.
121
- * Collects WASM command dirs, module access roots, and agent configurations.
122
- *
123
- * Any object with a `commandDir` property (e.g., registry packages) is treated
124
- * as a WASM command source. Typed descriptors with `type: "agent"` or `type: "tool"`
125
- * are processed for module mounting and agent registration.
126
- */
127
- export declare function processSoftware(software: SoftwareInput[]): ProcessedSoftware;
14
+ export declare function defineSoftware<T extends SoftwareEntry>(desc: T): T;