@rivet-dev/agentos-core 0.0.0-nathan-binding-workspace.4640d5c → 0.0.0-nathan-binding-workspace.abc7ec9

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/dist/agents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Agent configurations for ACP-compatible coding agents
2
2
  export const AGENT_CONFIGS = {
3
3
  pi: {
4
- acpAdapter: "@rivet-dev/agentos-pi",
4
+ acpAdapter: "@agentos-software/pi",
5
5
  agentPackage: "@mariozechner/pi-coding-agent",
6
6
  },
7
7
  "pi-cli": {
@@ -9,20 +9,20 @@ export const AGENT_CONFIGS = {
9
9
  agentPackage: "@mariozechner/pi-coding-agent",
10
10
  },
11
11
  opencode: {
12
- acpAdapter: "@rivet-dev/agentos-opencode",
13
- agentPackage: "@rivet-dev/agentos-opencode",
12
+ acpAdapter: "@agentos-software/opencode",
13
+ agentPackage: "@agentos-software/opencode",
14
14
  defaultEnv: {
15
15
  OPENCODE_DISABLE_CONFIG_DEP_INSTALL: "1",
16
16
  OPENCODE_DISABLE_EMBEDDED_WEB_UI: "1",
17
17
  },
18
18
  },
19
19
  claude: {
20
- acpAdapter: "@rivet-dev/agentos-claude",
20
+ acpAdapter: "@agentos-software/claude-code",
21
21
  agentPackage: "@anthropic-ai/claude-agent-sdk",
22
22
  defaultEnv: {
23
23
  CLAUDE_AGENT_SDK_CLIENT_APP: "@rivet-dev/agentos",
24
24
  CLAUDE_CODE_SIMPLE: "1",
25
- CLAUDE_CODE_FORCE_AGENTOS_RIPGREP: "1",
25
+ CLAUDE_CODE_FORCE_AGENT_OS_RIPGREP: "1",
26
26
  CLAUDE_CODE_DEFER_GROWTHBOOK_INIT: "1",
27
27
  CLAUDE_CODE_DISABLE_CWD_PERSIST: "1",
28
28
  CLAUDE_CODE_DISABLE_DEV_NULL_REDIRECT: "1",
@@ -1,8 +1,8 @@
1
- import type { AgentOS } from "../agentos.js";
1
+ import type { AgentOs } from "../agent-os.js";
2
2
  import type { ScheduleDriver } from "./schedule-driver.js";
3
3
  import type { CronEventHandler, CronJob, CronJobInfo, CronJobOptions } from "./types.js";
4
4
  /**
5
- * Internal class that bridges ScheduleDriver and AgentOS. Owns the job
5
+ * Internal class that bridges ScheduleDriver and AgentOs. Owns the job
6
6
  * registry, executes actions, and emits lifecycle events.
7
7
  */
8
8
  export declare class CronManager {
@@ -10,7 +10,7 @@ export declare class CronManager {
10
10
  private driver;
11
11
  private vm;
12
12
  private listeners;
13
- constructor(vm: AgentOS, driver: ScheduleDriver);
13
+ constructor(vm: AgentOs, driver: ScheduleDriver);
14
14
  schedule(options: CronJobOptions): CronJob;
15
15
  cancel(id: string): void;
16
16
  list(): CronJobInfo[];
@@ -9,7 +9,7 @@ function computeNextTime(schedule) {
9
9
  return resolveSchedule(schedule).nextRun;
10
10
  }
11
11
  /**
12
- * Internal class that bridges ScheduleDriver and AgentOS. Owns the job
12
+ * Internal class that bridges ScheduleDriver and AgentOs. Owns the job
13
13
  * registry, executes actions, and emits lifecycle events.
14
14
  */
15
15
  export class CronManager {
@@ -1,4 +1,4 @@
1
- import type { CreateSessionOptions } from "../agentos.js";
1
+ import type { CreateSessionOptions } from "../agent-os.js";
2
2
  import type { AgentType } from "../agents.js";
3
3
  export type CronAction = {
4
4
  type: "session";
@@ -16,7 +16,7 @@ export interface HostDirMountPluginConfig extends MountConfigJsonObject {
16
16
  * mounts through the native `host_dir` plugin instead of a JS VFS backend.
17
17
  */
18
18
  export declare function createHostDirBackend(options: HostDirBackendOptions): NativeMountPluginDescriptor<HostDirMountPluginConfig>;
19
- /** A native `host_dir` mount, the serializable form `AgentOSOptions.mounts` accepts. */
19
+ /** A native `host_dir` mount, the serializable form `AgentOsOptions.mounts` accepts. */
20
20
  export interface NodeModulesMountConfig {
21
21
  path: string;
22
22
  plugin: NativeMountPluginDescriptor<HostDirMountPluginConfig>;
@@ -1,5 +1,5 @@
1
1
  import type { ZodType } from "zod";
2
- export declare class BindingSchemaConversionError extends Error {
2
+ export declare class HostToolSchemaConversionError extends Error {
3
3
  readonly path: string;
4
4
  readonly zodType: string;
5
5
  constructor(path: string, zodType: string, details?: string);
@@ -14,7 +14,7 @@ const UNSUPPORTED_TYPES = new Set([
14
14
  "pipe",
15
15
  "tuple",
16
16
  ]);
17
- export class BindingSchemaConversionError extends Error {
17
+ export class HostToolSchemaConversionError extends Error {
18
18
  path;
19
19
  zodType;
20
20
  constructor(path, zodType, details) {
@@ -24,7 +24,7 @@ export class BindingSchemaConversionError extends Error {
24
24
  ]
25
25
  .filter(Boolean)
26
26
  .join(" "));
27
- this.name = "BindingSchemaConversionError";
27
+ this.name = "HostToolSchemaConversionError";
28
28
  this.path = path;
29
29
  this.zodType = zodType;
30
30
  }
@@ -89,24 +89,24 @@ function isCustomRefinement(check) {
89
89
  }
90
90
  function validateChecks(schema, path, typeName) {
91
91
  if (getChecks(schema).some(isCustomRefinement)) {
92
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "custom refinements cannot be represented faithfully in JSON Schema");
92
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "custom refinements cannot be represented faithfully in JSON Schema");
93
93
  }
94
94
  }
95
95
  function validateSchema(schema, path) {
96
96
  const typeName = normalizeTypeName(schema);
97
97
  if (metadataProducesRefs(schema)) {
98
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "metadata that emits $ref/$defs is not supported");
98
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "metadata that emits $ref/$defs is not supported");
99
99
  }
100
100
  if (UNSUPPORTED_TYPES.has(typeName)) {
101
- throw new BindingSchemaConversionError(path, displayTypeName(typeName));
101
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName));
102
102
  }
103
103
  if (typeName === "discriminatedunion") {
104
- throw new BindingSchemaConversionError(path, displayTypeName(typeName));
104
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName));
105
105
  }
106
106
  if (TRANSPARENT_WRAPPER_TYPES.has(typeName)) {
107
107
  const inner = getInnerSchema(schema);
108
108
  if (!inner) {
109
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "wrapper schema is missing its inner schema");
109
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "wrapper schema is missing its inner schema");
110
110
  }
111
111
  validateSchema(inner, path);
112
112
  return;
@@ -114,7 +114,7 @@ function validateSchema(schema, path) {
114
114
  if (typeName === "nullable") {
115
115
  const inner = getInnerSchema(schema);
116
116
  if (!inner) {
117
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "nullable schema is missing its inner schema");
117
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "nullable schema is missing its inner schema");
118
118
  }
119
119
  validateSchema(inner, path);
120
120
  return;
@@ -133,7 +133,7 @@ function validateSchema(schema, path) {
133
133
  if (typeName === "array") {
134
134
  const itemSchema = getSchemaDef(schema).element;
135
135
  if (!itemSchema) {
136
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "array schema is missing its item schema");
136
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "array schema is missing its item schema");
137
137
  }
138
138
  validateSchema(itemSchema, `${path}[]`);
139
139
  return;
@@ -143,11 +143,11 @@ function validateSchema(schema, path) {
143
143
  const keySchema = def.keyType;
144
144
  const valueSchema = def.valueType;
145
145
  if (!keySchema || !valueSchema) {
146
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "record schema is missing its key or value schema");
146
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "record schema is missing its key or value schema");
147
147
  }
148
148
  const keyTypeName = normalizeTypeName(keySchema);
149
149
  if (keyTypeName !== "string" || getChecks(keySchema).length > 0) {
150
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "record keys must be unconstrained strings");
150
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "record keys must be unconstrained strings");
151
151
  }
152
152
  validateSchema(valueSchema, `${path}<record-value>`);
153
153
  return;
@@ -155,7 +155,7 @@ function validateSchema(schema, path) {
155
155
  if (typeName === "union") {
156
156
  const options = getSchemaDef(schema).options;
157
157
  if (!Array.isArray(options) || options.length === 0) {
158
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "union schema is missing its options");
158
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "union schema is missing its options");
159
159
  }
160
160
  for (let index = 0; index < options.length; index += 1) {
161
161
  validateSchema(options[index], `${path}<union:${index}>`);
@@ -168,7 +168,7 @@ function validateSchema(schema, path) {
168
168
  const [literalValue] = literalValues;
169
169
  if (literalValues.length !== 1 ||
170
170
  !("string number boolean".split(" ").includes(typeof literalValue) || literalValue === null)) {
171
- throw new BindingSchemaConversionError(path, displayTypeName(typeName), "literal values must be JSON primitives");
171
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName), "literal values must be JSON primitives");
172
172
  }
173
173
  return;
174
174
  }
@@ -179,7 +179,7 @@ function validateSchema(schema, path) {
179
179
  typeName === "nativeenum") {
180
180
  return;
181
181
  }
182
- throw new BindingSchemaConversionError(path, displayTypeName(typeName));
182
+ throw new HostToolSchemaConversionError(path, displayTypeName(typeName));
183
183
  }
184
184
  function sanitizeJsonSchema(value) {
185
185
  if (Array.isArray(value)) {
@@ -229,11 +229,11 @@ export function zodToJsonSchema(schema) {
229
229
  validateSchema(schema, "$");
230
230
  const jsonSchema = schema.toJSONSchema?.();
231
231
  if (!jsonSchema) {
232
- throw new BindingSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), "schema does not expose toJSONSchema()");
232
+ throw new HostToolSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), "schema does not expose toJSONSchema()");
233
233
  }
234
234
  const unsupportedKeyword = findUnsupportedGeneratedKeyword(jsonSchema, "$");
235
235
  if (unsupportedKeyword) {
236
- throw new BindingSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), `${unsupportedKeyword.keyword} emitted at ${unsupportedKeyword.path} is not supported`);
236
+ throw new HostToolSchemaConversionError("$", displayTypeName(normalizeTypeName(schema)), `${unsupportedKeyword.keyword} emitted at ${unsupportedKeyword.path} is not supported`);
237
237
  }
238
238
  const sanitized = sanitizeJsonSchema(jsonSchema);
239
239
  const description = getDescription(schema);
@@ -0,0 +1,45 @@
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;
@@ -0,0 +1,26 @@
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
+ /**
12
+ * Validate all description lengths in the given toolkits.
13
+ * Throws if any toolkit or tool description exceeds MAX_TOOL_DESCRIPTION_LENGTH.
14
+ */
15
+ export function validateToolkits(toolKits) {
16
+ for (const tk of toolKits) {
17
+ if (tk.description.length > MAX_TOOL_DESCRIPTION_LENGTH) {
18
+ throw new Error(`Toolkit "${tk.name}" description is ${tk.description.length} characters, max is ${MAX_TOOL_DESCRIPTION_LENGTH}`);
19
+ }
20
+ for (const [toolName, tool] of Object.entries(tk.tools)) {
21
+ if (tool.description.length > MAX_TOOL_DESCRIPTION_LENGTH) {
22
+ throw new Error(`Tool "${tk.name}/${toolName}" description is ${tool.description.length} characters, max is ${MAX_TOOL_DESCRIPTION_LENGTH}`);
23
+ }
24
+ }
25
+ }
26
+ }
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { AgentOS, AgentOSSidecar } from "./agentos.js";
1
+ export { AgentOs, AgentOsSidecar } from "./agent-os.js";
2
2
  export { AGENT_CONFIGS } from "./agents.js";
3
3
  export { CronManager, InvalidScheduleError, PastScheduleError, TimerScheduleDriver, } from "./cron/index.js";
4
4
  export { createHostDirBackend, nodeModulesMount } from "./host-dir-mount.js";
5
- export { binding, bindings, MAX_TOOL_DESCRIPTION_LENGTH, validateBindings, } from "./bindings.js";
5
+ export { hostTool, MAX_TOOL_DESCRIPTION_LENGTH, toolKit, validateToolkits, } from "./host-tools.js";
6
6
  export { createInMemoryLayerStore, createSnapshotExport, } from "./layers.js";
7
7
  export { defineSoftware } from "./packages.js";
8
- export { isAcpTimeoutErrorData } from "./json-rpc.js";
8
+ export { isAcpTimeoutErrorData, isUnknownSessionErrorData, } from "./json-rpc.js";
9
9
  export { createInMemoryFileSystem, KernelError } from "./runtime-compat.js";
10
10
  export type * from "./types.js";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // @rivet-dev/agentos
2
- export { AgentOS, AgentOSSidecar } from "./agentos.js";
2
+ export { AgentOs, AgentOsSidecar } from "./agent-os.js";
3
3
  export { AGENT_CONFIGS } from "./agents.js";
4
4
  export { CronManager, InvalidScheduleError, PastScheduleError, TimerScheduleDriver, } from "./cron/index.js";
5
5
  export { createHostDirBackend, nodeModulesMount } from "./host-dir-mount.js";
6
- export { binding, bindings, MAX_TOOL_DESCRIPTION_LENGTH, validateBindings, } from "./bindings.js";
6
+ export { hostTool, MAX_TOOL_DESCRIPTION_LENGTH, toolKit, validateToolkits, } from "./host-tools.js";
7
7
  export { createInMemoryLayerStore, createSnapshotExport, } from "./layers.js";
8
8
  export { defineSoftware } from "./packages.js";
9
- export { isAcpTimeoutErrorData } from "./json-rpc.js";
9
+ export { isAcpTimeoutErrorData, isUnknownSessionErrorData, } from "./json-rpc.js";
10
10
  export { createInMemoryFileSystem, KernelError } from "./runtime-compat.js";
@@ -8,7 +8,22 @@ export interface AcpTimeoutErrorData {
8
8
  transportState?: string;
9
9
  recentActivity: string[];
10
10
  }
11
- export type JsonRpcErrorData = AcpTimeoutErrorData | Record<string, unknown>;
11
+ /**
12
+ * Structured error payload meaning "the session id is not known to the agent" —
13
+ * e.g. a `session/load` / `session/resume` against a session whose on-disk store did
14
+ * not survive a VM teardown. The sidecar normalizes the adapter's native error into
15
+ * this shape so the resume orchestration can distinguish "fall through to a fresh
16
+ * session" from a transport/timeout error (which must propagate). Mirrors the
17
+ * `acp_timeout` convention.
18
+ */
19
+ export interface UnknownSessionErrorData {
20
+ kind: "unknown_session";
21
+ /** Optional metadata. The discriminator is `kind` alone — the sidecar's
22
+ * normalized error carries only `kind`, so this stays optional to keep the
23
+ * sidecar and client contracts aligned. */
24
+ sessionId?: string;
25
+ }
26
+ export type JsonRpcErrorData = AcpTimeoutErrorData | UnknownSessionErrorData | Record<string, unknown>;
12
27
  export interface JsonRpcRequest {
13
28
  jsonrpc: "2.0";
14
29
  id: number | string | null;
@@ -32,3 +47,4 @@ export interface JsonRpcNotification {
32
47
  params?: unknown;
33
48
  }
34
49
  export declare function isAcpTimeoutErrorData(value: unknown): value is AcpTimeoutErrorData;
50
+ export declare function isUnknownSessionErrorData(value: unknown): value is UnknownSessionErrorData;
package/dist/json-rpc.js CHANGED
@@ -12,3 +12,11 @@ export function isAcpTimeoutErrorData(value) {
12
12
  Array.isArray(record.recentActivity) &&
13
13
  record.recentActivity.every((entry) => typeof entry === "string"));
14
14
  }
15
+ export function isUnknownSessionErrorData(value) {
16
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
17
+ return false;
18
+ }
19
+ const record = value;
20
+ return (record.kind === "unknown_session" &&
21
+ (record.sessionId === undefined || typeof record.sessionId === "string"));
22
+ }
package/dist/packages.js CHANGED
@@ -319,7 +319,7 @@ export function processSoftware(software) {
319
319
  const vmDir = `/root/node_modules/${reqPkg}`;
320
320
  pushPackageSoftwareRoot(softwareRoots, seenSoftwareVmPaths, hostDir, vmDir);
321
321
  }
322
- // Tool bin registration is handled by the caller (AgentOS.create)
322
+ // Tool bin registration is handled by the caller (AgentOs.create)
323
323
  // since it requires kernel access.
324
324
  break;
325
325
  }
@@ -81,7 +81,7 @@ export type NetworkPermissions = PermissionMode | RulePermissions<PatternPermiss
81
81
  export type ChildProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
82
82
  export type ProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
83
83
  export type EnvPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
84
- export type BindingPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
84
+ export type ToolPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
85
85
  export interface ProcessInfo {
86
86
  pid: number;
87
87
  ppid: number;
@@ -168,7 +168,7 @@ export interface Permissions {
168
168
  childProcess?: ChildProcessPermissions;
169
169
  process?: ProcessPermissions;
170
170
  env?: EnvPermissions;
171
- binding?: BindingPermissions;
171
+ tool?: ToolPermissions;
172
172
  }
173
173
  export interface ResourceBudgets {
174
174
  maxOutputBytes?: number;
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
7
7
  import { resolvePublishedSidecarBinary } from "./sidecar/binary.js";
8
8
  import { findCargoBinary, resolveCargoBinary } from "./sidecar/cargo.js";
9
9
  import { serializePermissionsForSidecar } from "./sidecar/permissions.js";
10
- import { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, NativeSidecarKernelProxy, NativeSidecarProcessClient, serializeMountConfigForSidecar, } from "./sidecar/rpc-client.js";
10
+ import { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, NativeSidecarKernelProxy, SidecarProcess, serializeMountConfigForSidecar, } from "./sidecar/rpc-client.js";
11
11
  export const AF_INET = 2;
12
12
  export const AF_UNIX = 1;
13
13
  export const SOCK_STREAM = 1;
@@ -37,7 +37,6 @@ const KERNEL_POSIX_BOOTSTRAP_DIRS = [
37
37
  "/media",
38
38
  "/home",
39
39
  "/home/user",
40
- "/workspace",
41
40
  "/usr",
42
41
  "/usr/bin",
43
42
  "/usr/games",
@@ -1633,7 +1632,7 @@ class NativeKernel {
1633
1632
  constructor(options) {
1634
1633
  this.options = options;
1635
1634
  this.env = { ...(options.env ?? {}) };
1636
- this.cwd = options.cwd ?? "/workspace";
1635
+ this.cwd = options.cwd ?? "/home/user";
1637
1636
  this.socketTable = {
1638
1637
  hasHostNetworkAdapter: () => Boolean(options.hostNetworkAdapter),
1639
1638
  findListener: (request) => this.proxy?.findListener(request) ?? null,
@@ -1903,7 +1902,7 @@ class NativeKernel {
1903
1902
  const requestedPermissions = this.options.permissions;
1904
1903
  const bootstrapPermissions = requestedPermissions ? allowAll : undefined;
1905
1904
  if (this.loopbackExemptPorts.length > 0) {
1906
- createVmEnv.AGENTOS_LOOPBACK_EXEMPT_PORTS = JSON.stringify(this.loopbackExemptPorts);
1905
+ createVmEnv.AGENT_OS_LOOPBACK_EXEMPT_PORTS = JSON.stringify(this.loopbackExemptPorts);
1907
1906
  }
1908
1907
  const rootPassthroughPlan = planNodeFilesystemPassthroughMounts(this.options.filesystem, this.pendingLocalMounts);
1909
1908
  const snapshotEntries = await snapshotFilesystemEntries(this.options.filesystem, "/", [], {
@@ -1922,7 +1921,7 @@ class NativeKernel {
1922
1921
  ],
1923
1922
  bootstrapEntries: [],
1924
1923
  };
1925
- const client = NativeSidecarProcessClient.spawn({
1924
+ const client = SidecarProcess.spawn({
1926
1925
  cwd: REPO_ROOT,
1927
1926
  command: ensureNativeSidecarBinary(),
1928
1927
  args: [],
@@ -1988,7 +1987,7 @@ class NativeKernel {
1988
1987
  vm,
1989
1988
  env: this.env,
1990
1989
  cwd: this.cwd,
1991
- defaultExecCwd: this.options.cwd === undefined ? "/workspace" : this.cwd,
1990
+ defaultExecCwd: this.options.cwd === undefined ? "/home/user" : this.cwd,
1992
1991
  localMounts: this.pendingLocalMounts,
1993
1992
  commandGuestPaths: new Map(),
1994
1993
  onWasmCommandResolved: (command) => {
package/dist/runtime.d.ts CHANGED
@@ -76,7 +76,7 @@ export type NetworkPermissions = PermissionMode | RulePermissions<PatternPermiss
76
76
  export type ChildProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
77
77
  export type ProcessPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
78
78
  export type EnvPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
79
- export type BindingPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
79
+ export type ToolPermissions = PermissionMode | RulePermissions<PatternPermissionRule>;
80
80
  export interface ProcessInfo {
81
81
  pid: number;
82
82
  ppid: number;
@@ -163,7 +163,7 @@ export interface Permissions {
163
163
  childProcess?: ChildProcessPermissions;
164
164
  process?: ProcessPermissions;
165
165
  env?: EnvPermissions;
166
- binding?: BindingPermissions;
166
+ tool?: ToolPermissions;
167
167
  }
168
168
  export interface ResourceBudgets {
169
169
  maxOutputBytes?: number;
@@ -43,6 +43,23 @@ export type AcpCloseSessionRequest = {
43
43
  };
44
44
  export declare function readAcpCloseSessionRequest(bc: bare.ByteCursor): AcpCloseSessionRequest;
45
45
  export declare function writeAcpCloseSessionRequest(bc: bare.ByteCursor, x: AcpCloseSessionRequest): void;
46
+ /**
47
+ * Resume a session that exists in durable storage but is not live in the current
48
+ * VM (e.g. after a Rivet actor slept and woke with a fresh VM). The sidecar runs
49
+ * the stateless resume state machine (native session/load when the agent supports
50
+ * it, else a fresh session/new + transcript continuation preamble). `cwd`/`env`
51
+ * describe the fresh adapter launch used by the fallback tier. `transcriptPath`,
52
+ * when present, is a guest-readable path the fallback preamble points the agent at.
53
+ */
54
+ export type AcpResumeSessionRequest = {
55
+ readonly sessionId: string;
56
+ readonly agentType: string;
57
+ readonly transcriptPath: string | null;
58
+ readonly cwd: string;
59
+ readonly env: ReadonlyMap<string, string>;
60
+ };
61
+ export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest;
62
+ export declare function writeAcpResumeSessionRequest(bc: bare.ByteCursor, x: AcpResumeSessionRequest): void;
46
63
  export type AcpRequest = {
47
64
  readonly tag: "AcpCreateSessionRequest";
48
65
  readonly val: AcpCreateSessionRequest;
@@ -55,6 +72,9 @@ export type AcpRequest = {
55
72
  } | {
56
73
  readonly tag: "AcpCloseSessionRequest";
57
74
  readonly val: AcpCloseSessionRequest;
75
+ } | {
76
+ readonly tag: "AcpResumeSessionRequest";
77
+ readonly val: AcpResumeSessionRequest;
58
78
  };
59
79
  export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
60
80
  export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
@@ -95,6 +115,19 @@ export type AcpSessionClosedResponse = {
95
115
  };
96
116
  export declare function readAcpSessionClosedResponse(bc: bare.ByteCursor): AcpSessionClosedResponse;
97
117
  export declare function writeAcpSessionClosedResponse(bc: bare.ByteCursor, x: AcpSessionClosedResponse): void;
118
+ /**
119
+ * Result of AcpResumeSessionRequest. `sessionId` is the live ACP session id after
120
+ * resume: equal to the requested id for native loads, or the freshly assigned id
121
+ * for the fallback tier (the caller remaps external -> live). `mode` is "native"
122
+ * (session/load|resume succeeded) or "fallback" (a new session was created and the
123
+ * transcript-continuation preamble was armed for the next prompt).
124
+ */
125
+ export type AcpSessionResumedResponse = {
126
+ readonly sessionId: string;
127
+ readonly mode: string;
128
+ };
129
+ export declare function readAcpSessionResumedResponse(bc: bare.ByteCursor): AcpSessionResumedResponse;
130
+ export declare function writeAcpSessionResumedResponse(bc: bare.ByteCursor, x: AcpSessionResumedResponse): void;
98
131
  export type AcpErrorResponse = {
99
132
  readonly code: string;
100
133
  readonly message: string;
@@ -113,6 +146,9 @@ export type AcpResponse = {
113
146
  } | {
114
147
  readonly tag: "AcpSessionClosedResponse";
115
148
  readonly val: AcpSessionClosedResponse;
149
+ } | {
150
+ readonly tag: "AcpSessionResumedResponse";
151
+ readonly val: AcpSessionResumedResponse;
116
152
  } | {
117
153
  readonly tag: "AcpErrorResponse";
118
154
  readonly val: AcpErrorResponse;
@@ -157,6 +157,22 @@ export function readAcpCloseSessionRequest(bc) {
157
157
  export function writeAcpCloseSessionRequest(bc, x) {
158
158
  bare.writeString(bc, x.sessionId);
159
159
  }
160
+ export function readAcpResumeSessionRequest(bc) {
161
+ return {
162
+ sessionId: bare.readString(bc),
163
+ agentType: bare.readString(bc),
164
+ transcriptPath: read2(bc),
165
+ cwd: bare.readString(bc),
166
+ env: read1(bc),
167
+ };
168
+ }
169
+ export function writeAcpResumeSessionRequest(bc, x) {
170
+ bare.writeString(bc, x.sessionId);
171
+ bare.writeString(bc, x.agentType);
172
+ write2(bc, x.transcriptPath);
173
+ bare.writeString(bc, x.cwd);
174
+ write1(bc, x.env);
175
+ }
160
176
  export function readAcpRequest(bc) {
161
177
  const offset = bc.offset;
162
178
  const tag = bare.readU8(bc);
@@ -169,6 +185,8 @@ export function readAcpRequest(bc) {
169
185
  return { tag: "AcpGetSessionStateRequest", val: readAcpGetSessionStateRequest(bc) };
170
186
  case 3:
171
187
  return { tag: "AcpCloseSessionRequest", val: readAcpCloseSessionRequest(bc) };
188
+ case 4:
189
+ return { tag: "AcpResumeSessionRequest", val: readAcpResumeSessionRequest(bc) };
172
190
  default: {
173
191
  bc.offset = offset;
174
192
  throw new bare.BareError(offset, "invalid tag");
@@ -197,6 +215,11 @@ export function writeAcpRequest(bc, x) {
197
215
  writeAcpCloseSessionRequest(bc, x.val);
198
216
  break;
199
217
  }
218
+ case "AcpResumeSessionRequest": {
219
+ bare.writeU8(bc, 4);
220
+ writeAcpResumeSessionRequest(bc, x.val);
221
+ break;
222
+ }
200
223
  }
201
224
  }
202
225
  export function encodeAcpRequest(x, config) {
@@ -310,6 +333,16 @@ export function readAcpSessionClosedResponse(bc) {
310
333
  export function writeAcpSessionClosedResponse(bc, x) {
311
334
  bare.writeString(bc, x.sessionId);
312
335
  }
336
+ export function readAcpSessionResumedResponse(bc) {
337
+ return {
338
+ sessionId: bare.readString(bc),
339
+ mode: bare.readString(bc),
340
+ };
341
+ }
342
+ export function writeAcpSessionResumedResponse(bc, x) {
343
+ bare.writeString(bc, x.sessionId);
344
+ bare.writeString(bc, x.mode);
345
+ }
313
346
  export function readAcpErrorResponse(bc) {
314
347
  return {
315
348
  code: bare.readString(bc),
@@ -333,6 +366,8 @@ export function readAcpResponse(bc) {
333
366
  case 3:
334
367
  return { tag: "AcpSessionClosedResponse", val: readAcpSessionClosedResponse(bc) };
335
368
  case 4:
369
+ return { tag: "AcpSessionResumedResponse", val: readAcpSessionResumedResponse(bc) };
370
+ case 5:
336
371
  return { tag: "AcpErrorResponse", val: readAcpErrorResponse(bc) };
337
372
  default: {
338
373
  bc.offset = offset;
@@ -362,8 +397,13 @@ export function writeAcpResponse(bc, x) {
362
397
  writeAcpSessionClosedResponse(bc, x.val);
363
398
  break;
364
399
  }
365
- case "AcpErrorResponse": {
400
+ case "AcpSessionResumedResponse": {
366
401
  bare.writeU8(bc, 4);
402
+ writeAcpSessionResumedResponse(bc, x.val);
403
+ break;
404
+ }
405
+ case "AcpErrorResponse": {
406
+ bare.writeU8(bc, 5);
367
407
  writeAcpErrorResponse(bc, x.val);
368
408
  break;
369
409
  }
@@ -1,3 +1,3 @@
1
1
  import "@secure-exec/core/native-client";
2
- export { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, SidecarProcess as NativeSidecarProcessClient, SidecarEventBufferOverflow, SidecarProcessError, SidecarProcessExited, } from "@secure-exec/core/sidecar-client";
3
- export type { AuthenticatedSession, CreatedVm, ExtEnvelope, GuestFilesystemStat, RootFilesystemEntry, RootFilesystemLowerDescriptor, SidecarSpawnOptions as NativeSidecarSpawnOptions, SidecarEventSelector, SidecarFsPermissionRule, SidecarMountDescriptor, SidecarMountPluginDescriptor, SidecarPatternPermissionRule, SidecarPermissionMode, SidecarPermissionScope, SidecarPermissionsPolicy, SidecarProcessSnapshotEntry, SidecarProjectedModuleDescriptor, SidecarRegisteredHostCallbackDefinition, SidecarRegisteredHostCallbackExample, SidecarRequestFrame, SidecarRequestHandler, SidecarRequestPayload, SidecarResponseFrame, SidecarResponsePayload, SidecarRulePermissions, SidecarSessionState, SidecarSignalHandlerRegistration, SidecarSignalState, SidecarSocketStateEntry, SidecarSoftwareDescriptor, SidecarZombieTimerCount, } from "@secure-exec/core/sidecar-client";
2
+ export { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, SidecarProcess, SidecarProcess as NativeSidecarProcessClient, SidecarEventBufferOverflow, SidecarProcessError, SidecarProcessExited, } from "@secure-exec/core/sidecar-client";
3
+ export type { AuthenticatedSession, CreatedVm, ExtEnvelope, GuestFilesystemStat, RootFilesystemEntry, RootFilesystemLowerDescriptor, SidecarEventSelector, SidecarFsPermissionRule, SidecarMountDescriptor, SidecarMountPluginDescriptor, SidecarPatternPermissionRule, SidecarPermissionMode, SidecarPermissionScope, SidecarPermissionsPolicy, SidecarProcessSnapshotEntry, SidecarProjectedModuleDescriptor, SidecarRegisteredHostCallbackDefinition, SidecarRegisteredHostCallbackExample, SidecarRequestFrame, SidecarRequestHandler, SidecarRequestPayload, SidecarResponseFrame, SidecarResponsePayload, SidecarRulePermissions, SidecarSessionState, SidecarSignalHandlerRegistration, SidecarSignalState, SidecarSocketStateEntry, SidecarSoftwareDescriptor, SidecarSpawnOptions, SidecarSpawnOptions as NativeSidecarSpawnOptions, SidecarZombieTimerCount, } from "@secure-exec/core/sidecar-client";
@@ -3,4 +3,4 @@
3
3
  // separately-registered factory; importing native-client wires it up so
4
4
  // SidecarProcess.spawn works in this native runtime.
5
5
  import "@secure-exec/core/native-client";
6
- export { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, SidecarProcess as NativeSidecarProcessClient, SidecarEventBufferOverflow, SidecarProcessError, SidecarProcessExited, } from "@secure-exec/core/sidecar-client";
6
+ export { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, SidecarProcess, SidecarProcess as NativeSidecarProcessClient, SidecarEventBufferOverflow, SidecarProcessError, SidecarProcessExited, } from "@secure-exec/core/sidecar-client";
@@ -47,8 +47,8 @@ export function serializePermissionsForSidecar(permissions) {
47
47
  env: typeof permissions.env === "string" || !permissions.env
48
48
  ? permissions.env
49
49
  : serializePatternScope(permissions.env),
50
- binding: typeof permissions.binding === "string" || !permissions.binding
51
- ? permissions.binding
52
- : serializePatternScope(permissions.binding),
50
+ binding: typeof permissions.tool === "string" || !permissions.tool
51
+ ? permissions.tool
52
+ : serializePatternScope(permissions.tool),
53
53
  };
54
54
  }
@@ -1,6 +1,6 @@
1
- import { NativeSidecarProcessClient, type NativeSidecarSpawnOptions } from "./native-process-client.js";
2
- export interface AgentOSSidecarProcessHandle {
3
- client: NativeSidecarProcessClient;
1
+ import { SidecarProcess, type SidecarSpawnOptions } from "./native-process-client.js";
2
+ export interface AgentOsSidecarProcessHandle {
3
+ client: SidecarProcess;
4
4
  dispose(): Promise<void>;
5
5
  }
6
- export declare function spawnAgentOSSidecar(options: NativeSidecarSpawnOptions): AgentOSSidecarProcessHandle;
6
+ export declare function spawnAgentOsSidecar(options: SidecarSpawnOptions): AgentOsSidecarProcessHandle;