@rivet-dev/agentos-core 0.2.8-rc.2 → 0.2.8-rc.4

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 (55) hide show
  1. package/README.md +40 -37
  2. package/dist/agent-os.d.ts +184 -230
  3. package/dist/agent-os.js +751 -1158
  4. package/dist/agentos-package.d.ts +5 -3
  5. package/dist/agentos-package.js +5 -2
  6. package/dist/{host-tools-zod.d.ts → bindings-zod.d.ts} +1 -1
  7. package/dist/{host-tools-zod.js → bindings-zod.js} +27 -20
  8. package/dist/bindings.d.ts +43 -0
  9. package/dist/bindings.js +34 -0
  10. package/dist/cron/cron-manager.js +43 -10
  11. package/dist/cron/index.d.ts +1 -1
  12. package/dist/cron/types.d.ts +25 -9
  13. package/dist/filesystem-snapshot.d.ts +1 -2
  14. package/dist/filesystem-snapshot.js +0 -43
  15. package/dist/generated/AcpLimitsConfig.d.ts +16 -0
  16. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  17. package/dist/generated/CreateVmConfig.d.ts +2 -0
  18. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  19. package/dist/generated/ProcessLimitsConfig.js +2 -0
  20. package/dist/generated/VmGroupConfig.d.ts +5 -0
  21. package/dist/generated/VmGroupConfig.js +2 -0
  22. package/dist/generated/VmLimitsConfig.d.ts +4 -2
  23. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  24. package/dist/generated/VmUserAccountConfig.js +2 -0
  25. package/dist/generated/VmUserConfig.d.ts +19 -0
  26. package/dist/generated/WasmLimitsConfig.d.ts +1 -0
  27. package/dist/index.d.ts +4 -5
  28. package/dist/index.js +4 -5
  29. package/dist/layers.d.ts +5 -2
  30. package/dist/layers.js +0 -185
  31. package/dist/options-schema.d.ts +133 -31
  32. package/dist/options-schema.js +143 -26
  33. package/dist/runtime-compat.d.ts +4 -35
  34. package/dist/runtime-compat.js +84 -372
  35. package/dist/runtime.d.ts +3 -1
  36. package/dist/sandbox.d.ts +4 -4
  37. package/dist/sandbox.js +4 -4
  38. package/dist/session-api.d.ts +180 -0
  39. package/dist/session-api.js +1 -0
  40. package/dist/sidecar/agentos-protocol.d.ts +429 -29
  41. package/dist/sidecar/agentos-protocol.js +691 -93
  42. package/dist/sidecar/rpc-client.d.ts +18 -6
  43. package/dist/sidecar/rpc-client.js +66 -18
  44. package/dist/test/runtime.d.ts +2 -1
  45. package/dist/test/runtime.js +2 -1
  46. package/dist/types.d.ts +4 -5
  47. package/package.json +28 -27
  48. package/dist/agent-session-types.d.ts +0 -67
  49. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  50. package/dist/host-tools.d.ts +0 -45
  51. package/dist/host-tools.js +0 -35
  52. package/dist/overlay-filesystem.d.ts +0 -19
  53. package/dist/overlay-filesystem.js +0 -645
  54. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
  55. /package/dist/{agent-session-types.js → generated/VmUserConfig.js} +0 -0
@@ -40,11 +40,11 @@ interface NativeSidecarKernelProxyOptions {
40
40
  * `configure_vm` rebuilds the whole VM configuration from each payload, so
41
41
  * every runtime mount reconfigure must resend these or a post-boot
42
42
  * `mountFs()` silently drops the `/opt/agentos` package projections and
43
- * tool shim commands applied at boot.
43
+ * binding shim commands applied at boot.
44
44
  */
45
45
  packages?: Parameters<SidecarProcess["configureVm"]>[2]["packages"];
46
46
  packagesMountAt?: string;
47
- toolShimCommands?: string[];
47
+ bindingShimCommands?: string[];
48
48
  commandGuestPaths: ReadonlyMap<string, string>;
49
49
  onWasmCommandResolved?: (command: string) => void;
50
50
  onDispose?: () => Promise<void>;
@@ -70,12 +70,13 @@ export declare class NativeSidecarKernelProxy {
70
70
  private readonly ownsClient;
71
71
  private readonly localMounts;
72
72
  private readonly baseSidecarMounts;
73
+ private readonly dynamicSidecarMounts;
73
74
  private readonly permissions;
74
75
  private readonly commandPermissions;
75
76
  private readonly loopbackExemptPorts;
76
77
  private packages;
77
78
  private readonly packagesMountAt;
78
- private readonly toolShimCommands;
79
+ private readonly bindingShimCommands;
79
80
  private readonly commandDrivers;
80
81
  private readonly onWasmCommandResolved;
81
82
  private readonly onDispose;
@@ -161,6 +162,13 @@ export declare class NativeSidecarKernelProxy {
161
162
  sidecarMount?: SidecarMountDescriptor;
162
163
  }): Promise<void>;
163
164
  unmountFs(path: string): Promise<void>;
165
+ mountDescriptor(mount: SidecarMountDescriptor): Promise<void>;
166
+ unmountDescriptor(path: string): Promise<void>;
167
+ listMounts(): Promise<Array<{
168
+ path: string;
169
+ kind: string;
170
+ readOnly: boolean;
171
+ }>>;
164
172
  private desiredSidecarMounts;
165
173
  private reconfigureSidecarMounts;
166
174
  private waitForMountReconfigure;
@@ -175,6 +183,7 @@ export declare class NativeSidecarKernelProxy {
175
183
  port?: number;
176
184
  }): KernelSocketSnapshot | null;
177
185
  getSignalState(pid: number): KernelSignalState;
186
+ private scheduleSignalStateRefresh;
178
187
  private refreshSocketLookup;
179
188
  private refreshSignalState;
180
189
  private refreshProcessSnapshot;
@@ -262,7 +271,7 @@ export interface AgentOsSidecarTransport {
262
271
  dispose(): Promise<void>;
263
272
  }
264
273
  export interface AgentOsSidecarClientOptions {
265
- createSessionTransport(bootstrap: AgentOsSidecarSessionBootstrap): Promise<AgentOsSidecarTransport>;
274
+ createOwnershipTransport(bootstrap: AgentOsSidecarSessionBootstrap): Promise<AgentOsSidecarTransport>;
266
275
  createId?: () => string;
267
276
  now?: () => number;
268
277
  }
@@ -284,13 +293,14 @@ export declare class AgentOsSidecarSessionHandle {
284
293
  dispose(): Promise<void>;
285
294
  }
286
295
  export declare class AgentOsSidecarClient {
287
- private readonly createSessionTransport;
296
+ private readonly createOwnershipTransport;
288
297
  private readonly createId;
289
298
  private readonly now;
290
299
  private readonly sessions;
291
300
  private disposed;
292
301
  constructor(options: AgentOsSidecarClientOptions);
293
- createSession(options?: AgentOsSidecarSessionOptions): Promise<AgentOsSidecarSessionHandle>;
302
+ /** Open a physical sidecar ownership scope, not a durable ACP session. */
303
+ createOwnershipSession(options?: AgentOsSidecarSessionOptions): Promise<AgentOsSidecarSessionHandle>;
294
304
  listSessions(): AgentOsSidecarSessionLifecycle[];
295
305
  requireSessionLifecycle(sessionId: string): AgentOsSidecarSessionLifecycle;
296
306
  listVms(sessionId: string): AgentOsSidecarVmLifecycle[];
@@ -315,6 +325,8 @@ export interface SidecarMountPluginDescriptor {
315
325
  }
316
326
  export interface SidecarMountDescriptor {
317
327
  guestPath: string;
328
+ guestSource?: string;
329
+ guestFstype?: string;
318
330
  readOnly: boolean;
319
331
  plugin: SidecarMountPluginDescriptor;
320
332
  }
@@ -20,7 +20,9 @@ function formatStructuredSidecarDetail(detail) {
20
20
  if (entries.length === 0) {
21
21
  return "";
22
22
  }
23
- return entries.map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(" ");
23
+ return entries
24
+ .map(([key, value]) => `${key}=${JSON.stringify(value)}`)
25
+ .join(" ");
24
26
  }
25
27
  function logStructuredSidecarEvent(name, detail) {
26
28
  if (!shouldLogStructuredSidecarEvent(name)) {
@@ -211,6 +213,7 @@ export class NativeSidecarKernelProxy {
211
213
  ownsClient;
212
214
  localMounts;
213
215
  baseSidecarMounts;
216
+ dynamicSidecarMounts = [];
214
217
  permissions;
215
218
  commandPermissions;
216
219
  loopbackExemptPorts;
@@ -218,7 +221,7 @@ export class NativeSidecarKernelProxy {
218
221
  // later mount reconfigures resend linked packages too, not just boot ones.
219
222
  packages;
220
223
  packagesMountAt;
221
- toolShimCommands;
224
+ bindingShimCommands;
222
225
  commandDrivers;
223
226
  onWasmCommandResolved;
224
227
  onDispose;
@@ -257,7 +260,7 @@ export class NativeSidecarKernelProxy {
257
260
  this.loopbackExemptPorts = options.loopbackExemptPorts;
258
261
  this.packages = options.packages ? [...options.packages] : [];
259
262
  this.packagesMountAt = options.packagesMountAt;
260
- this.toolShimCommands = options.toolShimCommands;
263
+ this.bindingShimCommands = options.bindingShimCommands;
261
264
  this.commandDrivers = buildCommandMap(options.commandGuestPaths);
262
265
  this.onWasmCommandResolved = options.onWasmCommandResolved;
263
266
  this.onDispose = options.onDispose;
@@ -1163,9 +1166,34 @@ export class NativeSidecarKernelProxy {
1163
1166
  applied.catch(() => { });
1164
1167
  return applied;
1165
1168
  }
1169
+ mountDescriptor(mount) {
1170
+ const normalized = posixPath.normalize(mount.guestPath);
1171
+ if (this.desiredSidecarMounts().some((existing) => posixPath.normalize(existing.guestPath) === normalized)) {
1172
+ return Promise.reject(new Error(`mount already exists: ${normalized}`));
1173
+ }
1174
+ this.dynamicSidecarMounts.push({ ...mount, guestPath: normalized });
1175
+ const applied = this.reconfigureSidecarMounts();
1176
+ applied.catch(() => { });
1177
+ return applied;
1178
+ }
1179
+ unmountDescriptor(path) {
1180
+ const normalized = posixPath.normalize(path);
1181
+ const index = this.dynamicSidecarMounts.findIndex((mount) => posixPath.normalize(mount.guestPath) === normalized);
1182
+ if (index < 0)
1183
+ return Promise.resolve();
1184
+ this.dynamicSidecarMounts.splice(index, 1);
1185
+ const applied = this.reconfigureSidecarMounts();
1186
+ applied.catch(() => { });
1187
+ return applied;
1188
+ }
1189
+ async listMounts() {
1190
+ await this.waitForMountReconfigure();
1191
+ return this.client.listMounts(this.session, this.vm);
1192
+ }
1166
1193
  desiredSidecarMounts() {
1167
1194
  return [
1168
1195
  ...this.baseSidecarMounts,
1196
+ ...this.dynamicSidecarMounts,
1169
1197
  ...this.localMounts.map((mount) => mount.sidecarMount ?? {
1170
1198
  guestPath: mount.path,
1171
1199
  readOnly: mount.readOnly,
@@ -1182,8 +1210,8 @@ export class NativeSidecarKernelProxy {
1182
1210
  return;
1183
1211
  }
1184
1212
  // Rust `configure_vm` rebuilds the whole VM configuration from this
1185
- // payload, so resend the boot packages / tool shim commands too —
1186
- // omitting them here strips the `/opt/agentos` projections and tool
1213
+ // payload, so resend the boot packages / binding shim commands too —
1214
+ // omitting them here strips the `/opt/agentos` projections and binding
1187
1215
  // shims from the VM as a side effect of a runtime mount change.
1188
1216
  await this.client.configureVm(this.session, this.vm, {
1189
1217
  mounts: this.desiredSidecarMounts(),
@@ -1192,7 +1220,7 @@ export class NativeSidecarKernelProxy {
1192
1220
  loopbackExemptPorts: this.loopbackExemptPorts,
1193
1221
  packages: this.packages,
1194
1222
  packagesMountAt: this.packagesMountAt,
1195
- toolShimCommands: this.toolShimCommands,
1223
+ bindingShimCommands: this.bindingShimCommands,
1196
1224
  });
1197
1225
  };
1198
1226
  const previous = this.mountReconfigurePromise ?? Promise.resolve();
@@ -1237,11 +1265,17 @@ export class NativeSidecarKernelProxy {
1237
1265
  }
1238
1266
  getSignalState(pid) {
1239
1267
  const entry = this.trackedProcesses.get(pid);
1240
- if (entry && !this.signalRefreshes.has(pid)) {
1241
- this.signalRefreshes.set(pid, this.refreshSignalState(entry));
1242
- }
1268
+ if (entry)
1269
+ this.scheduleSignalStateRefresh(entry);
1243
1270
  return this.signalStates.get(pid) ?? { handlers: new Map() };
1244
1271
  }
1272
+ scheduleSignalStateRefresh(entry) {
1273
+ if (this.signalRefreshes.has(entry.pid))
1274
+ return;
1275
+ const refresh = this.refreshSignalState(entry);
1276
+ this.signalRefreshes.set(entry.pid, refresh);
1277
+ void refresh.catch(() => { });
1278
+ }
1245
1279
  async refreshSocketLookup(cache, key, lookup) {
1246
1280
  try {
1247
1281
  const socket = await lookup();
@@ -1333,7 +1367,11 @@ export class NativeSidecarKernelProxy {
1333
1367
  entry.started = true;
1334
1368
  this.updateTrackedProcessSnapshot(entry);
1335
1369
  void this.refreshProcessSnapshot().catch(() => { });
1336
- await this.refreshSignalState(entry);
1370
+ // Signal metadata is advisory and must not hold process startup behind a
1371
+ // second sidecar RPC. Very short binding commands can finish while the
1372
+ // original execute response is still in flight; synchronously refreshing
1373
+ // here creates a circular wait with their output/exit delivery.
1374
+ this.scheduleSignalStateRefresh(entry);
1337
1375
  void this.flushPendingStdin(entry).catch((error) => {
1338
1376
  this.handleBackgroundProcessError(entry, error);
1339
1377
  });
@@ -1361,10 +1399,7 @@ export class NativeSidecarKernelProxy {
1361
1399
  }
1362
1400
  entry.outputGeneration += 1;
1363
1401
  void this.refreshProcessSnapshot().catch(() => { });
1364
- if (!this.signalRefreshes.has(entry.pid)) {
1365
- this.signalRefreshes.set(entry.pid, this.refreshSignalState(entry));
1366
- await this.signalRefreshes.get(entry.pid);
1367
- }
1402
+ this.scheduleSignalStateRefresh(entry);
1368
1403
  const chunk = event.payload.chunk;
1369
1404
  const listeners = event.payload.channel === "stdout"
1370
1405
  ? entry.onStdout
@@ -2082,17 +2117,18 @@ export class AgentOsSidecarSessionHandle {
2082
2117
  }
2083
2118
  }
2084
2119
  export class AgentOsSidecarClient {
2085
- createSessionTransport;
2120
+ createOwnershipTransport;
2086
2121
  createId;
2087
2122
  now;
2088
2123
  sessions = new Map();
2089
2124
  disposed = false;
2090
2125
  constructor(options) {
2091
- this.createSessionTransport = options.createSessionTransport;
2126
+ this.createOwnershipTransport = options.createOwnershipTransport;
2092
2127
  this.createId = options.createId ?? randomUUID;
2093
2128
  this.now = options.now ?? Date.now;
2094
2129
  }
2095
- async createSession(options = {}) {
2130
+ /** Open a physical sidecar ownership scope, not a durable ACP session. */
2131
+ async createOwnershipSession(options = {}) {
2096
2132
  this.assertActive();
2097
2133
  const sessionId = this.createId();
2098
2134
  const placement = clonePlacement(options.placement);
@@ -2111,7 +2147,7 @@ export class AgentOsSidecarClient {
2111
2147
  };
2112
2148
  this.sessions.set(sessionId, entry);
2113
2149
  try {
2114
- entry.transport = await this.createSessionTransport({
2150
+ entry.transport = await this.createOwnershipTransport({
2115
2151
  sessionId,
2116
2152
  placement: clonePlacement(placement),
2117
2153
  metadata: cloneMetadata(metadata),
@@ -2277,6 +2313,8 @@ export function serializeMountConfigForSidecar(mount) {
2277
2313
  if ("driver" in mount) {
2278
2314
  return {
2279
2315
  guestPath: mount.path,
2316
+ guestSource: mount.guestSource ?? "js_bridge",
2317
+ guestFstype: mount.guestFstype ?? "js_bridge",
2280
2318
  readOnly: mount.readOnly ?? false,
2281
2319
  plugin: {
2282
2320
  id: "js_bridge",
@@ -2286,6 +2324,8 @@ export function serializeMountConfigForSidecar(mount) {
2286
2324
  }
2287
2325
  return {
2288
2326
  guestPath: mount.path,
2327
+ guestSource: mount.guestSource ?? mount.plugin.id,
2328
+ guestFstype: mount.guestFstype ?? mount.plugin.id,
2289
2329
  readOnly: mount.readOnly ?? false,
2290
2330
  plugin: {
2291
2331
  id: mount.plugin.id,
@@ -2294,6 +2334,14 @@ export function serializeMountConfigForSidecar(mount) {
2294
2334
  };
2295
2335
  }
2296
2336
  export function serializeRootFilesystemForSidecar(config, bootstrapLower) {
2337
+ if (config?.type === "native") {
2338
+ return {
2339
+ mode: "ephemeral",
2340
+ disableDefaultBaseLayer: true,
2341
+ lowers: [],
2342
+ bootstrapEntries: [],
2343
+ };
2344
+ }
2297
2345
  const lowerInputs = [
2298
2346
  ...(config?.lowers ?? []),
2299
2347
  ...(bootstrapLower ? [bootstrapLower] : []),
@@ -7,5 +7,6 @@
7
7
  export { type AgentOsRuntimeAdmin, getAgentOsKernel, getAgentOsRuntimeAdmin, } from "../agent-os.js";
8
8
  export type { PermissionTier, WasmVmRuntimeOptions, } from "../runtime.js";
9
9
  export type { DriverProcess, Kernel, KernelInterface, KernelRuntimeDriver, ProcessContext, VirtualFileSystem, } from "../runtime-compat.js";
10
- export { AF_INET, AF_UNIX, allowAll, createInMemoryFileSystem, createKernel, createNodeHostNetworkAdapter, createNodeRuntime, createWasmVmRuntime, DEFAULT_FIRST_PARTY_TIERS, NodeFileSystem, SIGTERM, SOCK_DGRAM, SOCK_STREAM, WASMVM_COMMANDS, } from "../runtime-compat.js";
10
+ export { AF_INET, AF_UNIX, allowAll, createKernel, createNodeHostNetworkAdapter, createNodeRuntime, createWasmVmRuntime, DEFAULT_FIRST_PARTY_TIERS, NodeFileSystem, SIGTERM, SOCK_DGRAM, SOCK_STREAM, WASMVM_COMMANDS, } from "../runtime-compat.js";
11
+ export { createInMemoryFileSystem } from "@rivet-dev/agentos-runtime-core/test-runtime";
11
12
  export { TerminalHarness } from "./terminal-harness.js";
@@ -5,5 +5,6 @@
5
5
  * while the public SDK removes the raw vm.kernel escape hatch.
6
6
  */
7
7
  export { getAgentOsKernel, getAgentOsRuntimeAdmin, } from "../agent-os.js";
8
- export { AF_INET, AF_UNIX, allowAll, createInMemoryFileSystem, createKernel, createNodeHostNetworkAdapter, createNodeRuntime, createWasmVmRuntime, DEFAULT_FIRST_PARTY_TIERS, NodeFileSystem, SIGTERM, SOCK_DGRAM, SOCK_STREAM, WASMVM_COMMANDS, } from "../runtime-compat.js";
8
+ export { AF_INET, AF_UNIX, allowAll, createKernel, createNodeHostNetworkAdapter, createNodeRuntime, createWasmVmRuntime, DEFAULT_FIRST_PARTY_TIERS, NodeFileSystem, SIGTERM, SOCK_DGRAM, SOCK_STREAM, WASMVM_COMMANDS, } from "../runtime-compat.js";
9
+ export { createInMemoryFileSystem } from "@rivet-dev/agentos-runtime-core/test-runtime";
9
10
  export { TerminalHarness } from "./terminal-harness.js";
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export type { AgentCapabilities, AgentInfo, AgentOsCreateSidecarOptions, AgentOsLimits, AgentOsOptions, AgentOsSharedSidecarOptions, AgentOsSidecarConfig, AgentOsSidecarDescription, AgentExitEvent, AgentExitHandler, AgentRestartOutcome, AgentStderrEvent, AgentStderrHandler, AgentRegistryEntry, BatchReadResult, BatchWriteEntry, BatchWriteResult, CreateSessionOptions, DirEntry, LimitWarning, LimitWarningHandler, McpServerConfig, McpServerConfigLocal, McpServerConfigRemote, MountConfig, MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountConfig, NativeMountPluginDescriptor, OverlayMountConfig, PermissionReply, PermissionRequest, PermissionRequestHandler, PlainMountConfig, ProcessTreeNode, PromptResult, ReaddirRecursiveOptions, ResumeSessionOptions, ResumeSessionResult, RootFilesystemConfig, RootLowerInput, SessionConfigOption, SessionEventHandler, SessionInfo, SessionInitData, SessionMode, SessionModeState, SpawnedProcessInfo, } from "./agent-os.js";
1
+ export type { AgentOsCreateSidecarOptions, AgentOsLimits, AgentOsOptions, AgentOsSharedSidecarOptions, AgentOsSidecarConfig, AgentOsSidecarDescription, AgentExitEvent, AgentExitHandler, AgentRestartOutcome, AgentStderrEvent, AgentStderrHandler, AgentRegistryEntry, BatchReadResult, BatchWriteEntry, BatchWriteResult, DirEntry, DynamicMountDescriptor, ExportRootFilesystemOptions, HttpRequest, HttpResponse, LimitWarning, LimitWarningHandler, MountConfig, MountInfo, MountConfigJsonObject, MountConfigJsonPrimitive, MountConfigJsonValue, NativeMountConfig, NativeMountPluginDescriptor, NativeRootFilesystemConfig, OverlayMountConfig, OverlayRootFilesystemConfig, PlainMountConfig, ProcessTreeNode, ProcessExit, ProcessOutput, ReaddirEntry, ReaddirRecursiveOptions, RootFilesystemConfig, RootLowerInput, SpawnedProcessInfo, SpawnOptions, ShellData, ShellExit, ShellOptions, } from "./agent-os.js";
2
+ export type * from "./session-api.js";
2
3
  /**
3
4
  * An agent type id — the `name` of an `/opt/agentos` agent package manifest
4
5
  * (e.g. `"pi"`, `"claude"`). Agents are resolved by the SIDECAR from the projected
@@ -6,12 +7,10 @@ export type { AgentCapabilities, AgentInfo, AgentOsCreateSidecarOptions, AgentOs
6
7
  * passes only the name, so any manifest `name` is a valid agent type.
7
8
  */
8
9
  export type AgentType = string;
9
- export type { CronAction, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./cron/index.js";
10
+ export type { CronAction, CronActionInfo, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./cron/index.js";
10
11
  export type { HostDirBackendOptions, HostDirMountPluginConfig, NodeModulesMountConfig, } from "./host-dir-mount.js";
11
- export type { HostTool, ToolExample, ToolKit } from "./host-tools.js";
12
- export type { AcpTimeoutErrorData, JsonRpcError, JsonRpcErrorData, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, UnknownSessionErrorData, } from "./json-rpc.js";
12
+ export type { Binding, BindingExample, Bindings } from "./bindings.js";
13
13
  export type { FilesystemSnapshotExport, LayerHandle, LayerStore, OverlayFilesystemMode, RootSnapshotExport, SnapshotImportSource, SnapshotLayerHandle, WritableLayerHandle, } from "./layers.js";
14
14
  export type { SoftwareInput, SoftwareRoot } from "./packages.js";
15
15
  export type { AgentBlock, PackageDescriptor, PackageRef, SoftwarePackageRef, } from "./agentos-package.js";
16
16
  export type { ChildProcessPermissions, ConnectTerminalOptions, EnvPermissions, ExecOptions, ExecResult, FsPermissionRule, FsPermissions, KernelExecOptions, KernelExecResult, KernelSpawnOptions, NetworkAccessRequest, NetworkPermissions, OpenShellOptions, PatternPermissionRule, PermissionDecision, PermissionMode, Permissions, ProcessInfo, RulePermissions, StdioChannel, TimingMitigation, VirtualDirEntry, VirtualFileSystem, VirtualStat, } from "./runtime.js";
17
- export type { PromptCapabilities } from "./agent-session-types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivet-dev/agentos-core",
3
- "version": "0.2.8-rc.2",
3
+ "version": "0.2.8-rc.4",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -46,24 +46,27 @@
46
46
  }
47
47
  },
48
48
  "scripts": {
49
- "check-types": "pnpm run build:protocols && tsc --noEmit",
49
+ "check-types": "pnpm run build:protocols && tsc --noEmit && tsc -p tsconfig.type-tests.json",
50
50
  "build": "pnpm run build:protocols && tsc",
51
51
  "build:agentos-protocol": "node ./scripts/compile-agentos-protocol.mjs",
52
52
  "build:protocols": "pnpm run build:agentos-protocol",
53
- "test": "vitest run --reporter=verbose"
53
+ "test": "vitest run --exclude '**/*.nightly.test.ts' --reporter=verbose",
54
+ "test:unit": "vitest run tests/agent-exit-event.test.ts tests/agentos-package.test.ts tests/agentos-protocol.test.ts tests/allowed-node-builtins.test.ts tests/bindings-zod.test.ts tests/bindings.test.ts tests/cron-manager.test.ts tests/cron-timer-driver.test.ts tests/generated-protocol.test.ts tests/leak-agent-os-processes.test.ts tests/leak-rpc-client.test.ts tests/mount-descriptors.test.ts tests/mount-reconfigure.test.ts tests/options-schema.test.ts tests/public-api-exports.test.ts tests/root-filesystem-descriptors.test.ts tests/runtime-compat-mount.test.ts tests/session-event-ordering.test.ts tests/session-permission-surface.test.ts tests/sidecar-client.test.ts tests/sidecar-permission-descriptors.test.ts tests/wasm-permission-tiers.test.ts --fileParallelism=false",
55
+ "test:pr": "pnpm test:unit && vitest run tests/migration-parity.test.ts --fileParallelism=false --reporter=verbose",
56
+ "test:nightly": "vitest run tests/*.nightly.test.ts --reporter=verbose --passWithNoTests"
54
57
  },
55
58
  "dependencies": {
56
- "@agentos-software/claude-code": "0.2.8-rc.2",
59
+ "@agentclientprotocol/sdk": "0.16.1",
60
+ "@agentos-software/claude-code": "0.2.7",
57
61
  "@agentos-software/codex-cli": "0.3.4",
58
- "@agentos-software/common": "0.2.8-rc.2",
59
- "@agentos-software/manifest": "0.2.8-rc.2",
60
- "@agentos-software/opencode": "0.2.8-rc.2",
61
- "@agentos-software/pi": "0.2.8-rc.2",
62
- "@agentos-software/pi-cli": "0.2.8-rc.2",
62
+ "@agentos-software/common": "0.2.8-rc.4",
63
+ "@agentos-software/manifest": "0.2.8-rc.4",
64
+ "@agentos-software/opencode": "0.2.7",
65
+ "@agentos-software/pi": "0.2.7",
63
66
  "@aws-sdk/client-s3": "^3.1019.0",
64
- "@rivet-dev/agentos-sidecar": "0.2.8-rc.2",
67
+ "@rivet-dev/agentos-sidecar": "0.2.8-rc.4",
65
68
  "@rivetkit/bare-ts": "^0.6.2",
66
- "@rivet-dev/agentos-runtime-core": "0.2.8-rc.2",
69
+ "@rivet-dev/agentos-runtime-core": "0.2.8-rc.4",
67
70
  "@xterm/headless": "^6.0.0",
68
71
  "better-sqlite3": "^12.8.0",
69
72
  "croner": "^10.0.1",
@@ -75,30 +78,30 @@
75
78
  "zod-to-json-schema": "^3.25.2"
76
79
  },
77
80
  "devDependencies": {
78
- "@agentos-software/claude-code": "0.2.8-rc.2",
79
- "@agentos-software/codex": "0.2.8-rc.2",
80
- "@agentos-software/coreutils": "0.3.3",
81
+ "@agentos-software/claude-code": "0.2.7",
82
+ "@agentos-software/codex": "0.2.7",
83
+ "@agentos-software/coreutils": "0.3.4",
81
84
  "@agentos-software/curl": "0.3.3",
82
- "@agentos-software/diffutils": "0.3.3",
85
+ "@agentos-software/diffutils": "0.3.4",
83
86
  "@agentos-software/duckdb": "0.3.3",
84
87
  "@agentos-software/fd": "0.3.3",
85
88
  "@agentos-software/file": "0.3.3",
86
- "@agentos-software/findutils": "0.3.3",
87
- "@agentos-software/gawk": "0.3.3",
89
+ "@agentos-software/findutils": "0.3.4",
90
+ "@agentos-software/gawk": "0.3.4",
88
91
  "@agentos-software/git": "0.3.3",
89
- "@agentos-software/grep": "0.3.3",
90
- "@agentos-software/gzip": "0.3.3",
91
- "@agentos-software/http-get": "0.3.3",
92
+ "@agentos-software/grep": "0.3.4",
93
+ "@agentos-software/gzip": "0.3.4",
92
94
  "@agentos-software/jq": "0.3.3",
93
- "@agentos-software/opencode": "0.2.8-rc.2",
94
- "@agentos-software/pi": "0.2.8-rc.2",
95
- "@agentos-software/pi-cli": "0.2.8-rc.2",
95
+ "@agentos-software/opencode": "0.2.7",
96
+ "@agentos-software/pi": "0.2.7",
96
97
  "@agentos-software/ripgrep": "0.3.3",
97
- "@agentos-software/sed": "0.3.3",
98
- "@agentos-software/tar": "0.3.3",
98
+ "@agentos-software/sed": "0.3.4",
99
+ "@agentos-software/tar": "0.3.4",
99
100
  "@agentos-software/tree": "0.3.3",
100
101
  "@agentos-software/vim": "0.3.3",
102
+ "@agentos-software/wget": "0.3.3",
101
103
  "@agentos-software/yq": "0.3.3",
104
+ "@rivet-dev/agentos-test-harness": "0.2.8-rc.4",
102
105
  "@anthropic-ai/claude-agent-sdk": "^0.2.87",
103
106
  "@anthropic-ai/claude-code": "^2.1.86",
104
107
  "@bare-ts/tools": "0.15.0",
@@ -106,9 +109,7 @@
106
109
  "@browserbasehq/cli": "0.5.4",
107
110
  "@browserbasehq/sdk": "2.10.0",
108
111
  "@copilotkit/llmock": "^1.6.0",
109
- "@mariozechner/pi-coding-agent": "^0.60.0",
110
112
  "@types/node": "^22.10.2",
111
- "pi-acp": "^0.0.23",
112
113
  "sandbox-agent": "^0.4.2",
113
114
  "typescript": "^5.7.2",
114
115
  "vitest": "^2.1.8",
@@ -1,67 +0,0 @@
1
- import type { JsonRpcNotification } from "./json-rpc.js";
2
- export type SessionEventHandler = (event: JsonRpcNotification) => void;
3
- export interface PermissionRequest {
4
- permissionId: string;
5
- description?: string;
6
- params: Record<string, unknown>;
7
- }
8
- export type PermissionReply = "once" | "always" | "reject";
9
- export type PermissionRequestHandler = (request: PermissionRequest) => void;
10
- export interface SessionMode {
11
- id: string;
12
- name?: string;
13
- label?: string;
14
- description?: string;
15
- [key: string]: unknown;
16
- }
17
- export interface SessionModeState {
18
- currentModeId: string;
19
- availableModes: SessionMode[];
20
- }
21
- export interface SessionConfigOption {
22
- id: string;
23
- category?: string;
24
- label?: string;
25
- description?: string;
26
- currentValue?: string;
27
- allowedValues?: Array<{
28
- id: string;
29
- label?: string;
30
- }>;
31
- readOnly?: boolean;
32
- }
33
- export interface PromptCapabilities {
34
- audio?: boolean;
35
- embeddedContext?: boolean;
36
- image?: boolean;
37
- [key: string]: unknown;
38
- }
39
- export interface AgentCapabilities {
40
- permissions?: boolean;
41
- plan_mode?: boolean;
42
- questions?: boolean;
43
- tool_calls?: boolean;
44
- text_messages?: boolean;
45
- images?: boolean;
46
- file_attachments?: boolean;
47
- session_lifecycle?: boolean;
48
- error_events?: boolean;
49
- reasoning?: boolean;
50
- status?: boolean;
51
- streaming_deltas?: boolean;
52
- mcp_tools?: boolean;
53
- promptCapabilities?: PromptCapabilities;
54
- [key: string]: unknown;
55
- }
56
- export interface AgentInfo {
57
- name: string;
58
- title?: string;
59
- version?: string;
60
- [key: string]: unknown;
61
- }
62
- export interface SessionInitData {
63
- modes?: SessionModeState;
64
- configOptions?: SessionConfigOption[];
65
- capabilities?: AgentCapabilities;
66
- agentInfo?: AgentInfo;
67
- }
@@ -1,10 +0,0 @@
1
- export type ToolLimitsConfig = {
2
- defaultToolTimeoutMs?: number;
3
- maxToolTimeoutMs?: number;
4
- maxRegisteredToolkits?: number;
5
- maxRegisteredToolsPerVm?: number;
6
- maxToolsPerToolkit?: number;
7
- maxToolSchemaBytes?: number;
8
- maxToolExamplesPerTool?: number;
9
- maxToolExampleInputBytes?: number;
10
- };
@@ -1,45 +0,0 @@
1
- import type { ZodType } from "zod";
2
- /** Maximum length for tool and toolkit descriptions (characters). */
3
- export declare const MAX_TOOL_DESCRIPTION_LENGTH = 200;
4
- /**
5
- * A single tool that executes on the host.
6
- * Mirrors the shape of AI SDK's tool() but with host-execution semantics.
7
- */
8
- export interface HostTool<INPUT = any, OUTPUT = any> {
9
- /** Description shown to the agent in --help and prompt docs. Max 200 characters. */
10
- description: string;
11
- /** Zod schema for the input. Drives CLI flag generation and validation. */
12
- inputSchema: ZodType<INPUT>;
13
- /** Runs on the host when the agent invokes the tool. */
14
- execute: (input: INPUT) => Promise<OUTPUT> | OUTPUT;
15
- /** Examples included in auto-generated prompt docs. */
16
- examples?: ToolExample<INPUT>[];
17
- /** Timeout in ms. Default: 30000. */
18
- timeout?: number;
19
- }
20
- export interface ToolExample<INPUT = any> {
21
- /** Human description of what this example does. */
22
- description: string;
23
- /** The input args for the example. */
24
- input: INPUT;
25
- }
26
- /**
27
- * A named group of tools. Becomes a CLI binary: agentos-{name}.
28
- */
29
- export interface ToolKit {
30
- /** Toolkit name. Must be lowercase alphanumeric + hyphens. Becomes the CLI suffix: agentos-{name}. */
31
- name: string;
32
- /** Description shown in `agentos list-tools` and prompt docs. */
33
- description: string;
34
- /** The tools in this toolkit. Keys become subcommands. */
35
- tools: Record<string, HostTool>;
36
- }
37
- /** Helper to create a HostTool with type inference. */
38
- export declare function hostTool<INPUT, OUTPUT>(def: HostTool<INPUT, OUTPUT>): HostTool<INPUT, OUTPUT>;
39
- /** Helper to create a ToolKit. */
40
- export declare function toolKit(def: ToolKit): ToolKit;
41
- /**
42
- * Validate all description lengths in the given toolkits.
43
- * Throws if any toolkit or tool description exceeds MAX_TOOL_DESCRIPTION_LENGTH.
44
- */
45
- export declare function validateToolkits(toolKits: ToolKit[]): void;
@@ -1,35 +0,0 @@
1
- /** Maximum length for tool and toolkit descriptions (characters). */
2
- export const MAX_TOOL_DESCRIPTION_LENGTH = 200;
3
- /** Helper to create a HostTool with type inference. */
4
- export function hostTool(def) {
5
- return def;
6
- }
7
- /** Helper to create a ToolKit. */
8
- export function toolKit(def) {
9
- return def;
10
- }
11
- const TOOLKIT_COMMAND_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
12
- function validateToolCommandName(kind, name) {
13
- if (TOOLKIT_COMMAND_NAME_RE.test(name)) {
14
- return;
15
- }
16
- throw new Error(`${kind} name "${name}" must be lowercase alphanumeric with optional single hyphen separators`);
17
- }
18
- /**
19
- * Validate all description lengths in the given toolkits.
20
- * Throws if any toolkit or tool description exceeds MAX_TOOL_DESCRIPTION_LENGTH.
21
- */
22
- export function validateToolkits(toolKits) {
23
- for (const tk of toolKits) {
24
- validateToolCommandName("Toolkit", tk.name);
25
- if (tk.description.length > MAX_TOOL_DESCRIPTION_LENGTH) {
26
- throw new Error(`Toolkit "${tk.name}" description is ${tk.description.length} characters, max is ${MAX_TOOL_DESCRIPTION_LENGTH}`);
27
- }
28
- for (const [toolName, tool] of Object.entries(tk.tools)) {
29
- validateToolCommandName("Tool", toolName);
30
- if (tool.description.length > MAX_TOOL_DESCRIPTION_LENGTH) {
31
- throw new Error(`Tool "${tk.name}/${toolName}" description is ${tool.description.length} characters, max is ${MAX_TOOL_DESCRIPTION_LENGTH}`);
32
- }
33
- }
34
- }
35
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Overlay (copy-on-write) filesystem backend.
3
- *
4
- * Layers an optional writable upper filesystem over zero or more lower
5
- * filesystems. Reads resolve from highest precedence to lowest. Writes
6
- * go to the writable upper only, with copy-up and whiteout behavior.
7
- */
8
- import { type VirtualFileSystem } from "./runtime-compat.js";
9
- export interface OverlayBackendOptions {
10
- /** Legacy single lower layer. */
11
- lower?: VirtualFileSystem;
12
- /** Lower layers ordered highest-precedence first. */
13
- lowers?: VirtualFileSystem[];
14
- /** Writable upper layer. Defaults to a fresh in-memory filesystem in ephemeral mode. */
15
- upper?: VirtualFileSystem;
16
- /** Overlay mode. Defaults to ephemeral. */
17
- mode?: "ephemeral" | "read-only";
18
- }
19
- export declare function createOverlayBackend(options: OverlayBackendOptions): VirtualFileSystem;