@rivet-dev/agentos-runtime-core 0.2.14 → 0.2.15

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 (66) hide show
  1. package/README.md +1 -1
  2. package/commands/[ +0 -0
  3. package/commands/_stubs +0 -0
  4. package/commands/awk +0 -0
  5. package/commands/bash +0 -0
  6. package/commands/chcon +0 -0
  7. package/commands/chroot +0 -0
  8. package/commands/column +0 -0
  9. package/commands/diff +0 -0
  10. package/commands/du +0 -0
  11. package/commands/egrep +0 -0
  12. package/commands/env +0 -0
  13. package/commands/expr +0 -0
  14. package/commands/fgrep +0 -0
  15. package/commands/file +0 -0
  16. package/commands/groups +0 -0
  17. package/commands/gunzip +0 -0
  18. package/commands/gzip +0 -0
  19. package/commands/hostid +0 -0
  20. package/commands/http-test +0 -0
  21. package/commands/install +0 -0
  22. package/commands/jq +0 -0
  23. package/commands/nice +0 -0
  24. package/commands/pinky +0 -0
  25. package/commands/rev +0 -0
  26. package/commands/rg +0 -0
  27. package/commands/runcon +0 -0
  28. package/commands/sh +0 -0
  29. package/commands/sleep +0 -0
  30. package/commands/spawn-test-host +0 -0
  31. package/commands/ssh +0 -0
  32. package/commands/stdbuf +0 -0
  33. package/commands/strings +0 -0
  34. package/commands/stty +0 -0
  35. package/commands/sync +0 -0
  36. package/commands/tar +0 -0
  37. package/commands/test +0 -0
  38. package/commands/timeout +0 -0
  39. package/commands/tty +0 -0
  40. package/commands/unzip +0 -0
  41. package/commands/uptime +0 -0
  42. package/commands/users +0 -0
  43. package/commands/wget +0 -0
  44. package/commands/which +0 -0
  45. package/commands/who +0 -0
  46. package/commands/whoami +0 -0
  47. package/commands/yq +0 -0
  48. package/commands/zcat +0 -0
  49. package/commands/zip +0 -0
  50. package/dist/event-buffer.d.ts +14 -0
  51. package/dist/event-buffer.js +30 -1
  52. package/dist/generated/ExecutionLimitsConfig.d.ts +5 -0
  53. package/dist/generated/ExecutionLimitsConfig.js +2 -0
  54. package/dist/generated/VmLimitsConfig.d.ts +2 -0
  55. package/dist/generated-protocol.d.ts +546 -0
  56. package/dist/generated-protocol.js +1438 -122
  57. package/dist/kernel-proxy.js +1 -1
  58. package/dist/node-runtime.js +5 -5
  59. package/dist/request-payloads.d.ts +92 -0
  60. package/dist/request-payloads.js +62 -0
  61. package/dist/response-payloads.d.ts +27 -0
  62. package/dist/response-payloads.js +18 -0
  63. package/dist/sidecar-process.d.ts +4 -1
  64. package/dist/sidecar-process.js +15 -2
  65. package/dist/test-runtime.js +3 -3
  66. package/package.json +2 -2
@@ -26,7 +26,7 @@ export function serializeMountConfigForSidecar(mount) {
26
26
  }
27
27
  const SYNTHETIC_PID_BASE = 1_000_000;
28
28
  const MISSING_EXIT_EVENT_GRACE_MS = 500;
29
- const PROTECTED_READ_ONLY_GUEST_ROOTS = ["/etc/secure-exec"];
29
+ const PROTECTED_READ_ONLY_GUEST_ROOTS = ["/etc/agentos"];
30
30
  const TRAILING_OUTPUT_DRAIN_INTERVAL_MS = 10;
31
31
  const TRAILING_OUTPUT_DRAIN_MAX_MS = 250;
32
32
  const TRAILING_OUTPUT_DRAIN_QUIET_TURNS = 2;
@@ -35,7 +35,7 @@ const REPO_COMMANDS_DIR = path.join(REPO_ROOT, "toolchain/target/wasm32-wasip1/r
35
35
  /**
36
36
  * Commands vendored into the published `@rivet-dev/agentos-runtime-core` package by
37
37
  * `scripts/copy-wasm-commands.mjs` (listed in `files` as `commands`). This is
38
- * the directory a real `npm install secure-exec` resolves: from the compiled
38
+ * the directory a real `npm install agentos` resolves: from the compiled
39
39
  * `dist/node-runtime.js` it sits at `<package>/commands`. This is the analogue
40
40
  * of how the sidecar binary ships inside `@rivet-dev/agentos-runtime-sidecar`.
41
41
  */
@@ -222,7 +222,7 @@ export class NodeRuntime {
222
222
  * `node <file>`; it runs as standard ESM (top-level `await`, `import`).
223
223
  */
224
224
  async exec(code, options = {}) {
225
- const programPath = `/tmp/secure-exec-program-${nextProgramId++}.mjs`;
225
+ const programPath = `/tmp/agentos-program-${nextProgramId++}.mjs`;
226
226
  await this.kernel.writeFile(programPath, withBindingPreamble(code));
227
227
  return this.runProgram(programPath, options);
228
228
  }
@@ -328,7 +328,7 @@ export class NodeRuntime {
328
328
  * ```
329
329
  */
330
330
  async spawn(code, options = {}) {
331
- const programPath = `/tmp/secure-exec-program-${nextProgramId++}.mjs`;
331
+ const programPath = `/tmp/agentos-program-${nextProgramId++}.mjs`;
332
332
  await this.kernel.writeFile(programPath, withBindingPreamble(code));
333
333
  const proc = this.kernel.spawn("node", [programPath], {
334
334
  env: options.env,
@@ -442,8 +442,8 @@ export class NodeRuntime {
442
442
  */
443
443
  async run(code, options = {}) {
444
444
  const id = nextProgramId++;
445
- const resultPath = `/tmp/secure-exec-result-${id}.json`;
446
- const programPath = `/tmp/secure-exec-program-${id}.mjs`;
445
+ const resultPath = `/tmp/agentos-result-${id}.json`;
446
+ const programPath = `/tmp/agentos-program-${id}.mjs`;
447
447
  // Inject the __return helper as a module-level preamble, then the user
448
448
  // code at module top level. Import declarations (preamble's and the
449
449
  // user's) are hoisted, so __return is defined before the user's
@@ -171,6 +171,98 @@ export type LiveRequestPayload = {
171
171
  type: "persistence_flush";
172
172
  key: string;
173
173
  payload_size_bytes: number;
174
+ } | {
175
+ type: "shell_execution";
176
+ request: protocol.ShellExecutionRequest;
177
+ } | {
178
+ type: "argv_execution";
179
+ request: protocol.ArgvExecutionRequest;
180
+ } | {
181
+ type: "javascript_execution";
182
+ request: protocol.JavaScriptExecutionRequest;
183
+ } | {
184
+ type: "javascript_evaluation";
185
+ request: protocol.JavaScriptEvaluationRequest;
186
+ } | {
187
+ type: "javascript_file_execution";
188
+ request: protocol.JavaScriptFileExecutionRequest;
189
+ } | {
190
+ type: "typescript_execution";
191
+ request: protocol.TypeScriptExecutionRequest;
192
+ } | {
193
+ type: "typescript_evaluation";
194
+ request: protocol.TypeScriptEvaluationRequest;
195
+ } | {
196
+ type: "typescript_file_execution";
197
+ request: protocol.TypeScriptFileExecutionRequest;
198
+ } | {
199
+ type: "typescript_check";
200
+ request: protocol.TypeScriptCheckRequest;
201
+ } | {
202
+ type: "typescript_project_check";
203
+ request: protocol.TypeScriptProjectCheckRequest;
204
+ } | {
205
+ type: "npm_project_install";
206
+ request: protocol.NpmProjectInstallRequest;
207
+ } | {
208
+ type: "npm_package_install";
209
+ request: protocol.NpmPackageInstallRequest;
210
+ } | {
211
+ type: "npm_script_execution";
212
+ request: protocol.NpmScriptExecutionRequest;
213
+ } | {
214
+ type: "npm_package_execution";
215
+ request: protocol.NpmPackageExecutionRequest;
216
+ } | {
217
+ type: "python_execution";
218
+ request: protocol.PythonExecutionRequest;
219
+ } | {
220
+ type: "python_evaluation";
221
+ request: protocol.PythonEvaluationRequest;
222
+ } | {
223
+ type: "python_file_execution";
224
+ request: protocol.PythonFileExecutionRequest;
225
+ } | {
226
+ type: "python_module_execution";
227
+ request: protocol.PythonModuleExecutionRequest;
228
+ } | {
229
+ type: "python_install";
230
+ request: protocol.PythonInstallRequest;
231
+ } | {
232
+ type: "create_context";
233
+ request: protocol.CreateContextRequest;
234
+ } | {
235
+ type: "get_execution";
236
+ request: protocol.GetExecutionRequest;
237
+ } | {
238
+ type: "list_executions";
239
+ } | {
240
+ type: "wait_execution";
241
+ request: protocol.WaitExecutionRequest;
242
+ } | {
243
+ type: "cancel_execution";
244
+ request: protocol.CancelExecutionRequest;
245
+ } | {
246
+ type: "signal_execution";
247
+ request: protocol.SignalExecutionRequest;
248
+ } | {
249
+ type: "reset_execution";
250
+ request: protocol.ResetExecutionRequest;
251
+ } | {
252
+ type: "delete_execution";
253
+ request: protocol.DeleteExecutionRequest;
254
+ } | {
255
+ type: "write_execution_stdin";
256
+ request: protocol.WriteExecutionStdinRequest;
257
+ } | {
258
+ type: "close_execution_stdin";
259
+ request: protocol.CloseExecutionStdinRequest;
260
+ } | {
261
+ type: "resize_execution_pty";
262
+ request: protocol.ResizeExecutionPtyRequest;
263
+ } | {
264
+ type: "read_execution_output";
265
+ request: protocol.ReadExecutionOutputRequest;
174
266
  } | {
175
267
  type: "ext";
176
268
  envelope: LiveExtEnvelope;
@@ -266,6 +266,68 @@ export function toGeneratedRequestPayload(payload) {
266
266
  payloadSizeBytes: BigInt(payload.payload_size_bytes),
267
267
  },
268
268
  };
269
+ case "shell_execution":
270
+ return { tag: "ShellExecutionRequest", val: payload.request };
271
+ case "argv_execution":
272
+ return { tag: "ArgvExecutionRequest", val: payload.request };
273
+ case "javascript_execution":
274
+ return { tag: "JavaScriptExecutionRequest", val: payload.request };
275
+ case "javascript_evaluation":
276
+ return { tag: "JavaScriptEvaluationRequest", val: payload.request };
277
+ case "javascript_file_execution":
278
+ return { tag: "JavaScriptFileExecutionRequest", val: payload.request };
279
+ case "typescript_execution":
280
+ return { tag: "TypeScriptExecutionRequest", val: payload.request };
281
+ case "typescript_evaluation":
282
+ return { tag: "TypeScriptEvaluationRequest", val: payload.request };
283
+ case "typescript_file_execution":
284
+ return { tag: "TypeScriptFileExecutionRequest", val: payload.request };
285
+ case "typescript_check":
286
+ return { tag: "TypeScriptCheckRequest", val: payload.request };
287
+ case "typescript_project_check":
288
+ return { tag: "TypeScriptProjectCheckRequest", val: payload.request };
289
+ case "npm_project_install":
290
+ return { tag: "NpmProjectInstallRequest", val: payload.request };
291
+ case "npm_package_install":
292
+ return { tag: "NpmPackageInstallRequest", val: payload.request };
293
+ case "npm_script_execution":
294
+ return { tag: "NpmScriptExecutionRequest", val: payload.request };
295
+ case "npm_package_execution":
296
+ return { tag: "NpmPackageExecutionRequest", val: payload.request };
297
+ case "python_execution":
298
+ return { tag: "PythonExecutionRequest", val: payload.request };
299
+ case "python_evaluation":
300
+ return { tag: "PythonEvaluationRequest", val: payload.request };
301
+ case "python_file_execution":
302
+ return { tag: "PythonFileExecutionRequest", val: payload.request };
303
+ case "python_module_execution":
304
+ return { tag: "PythonModuleExecutionRequest", val: payload.request };
305
+ case "python_install":
306
+ return { tag: "PythonInstallRequest", val: payload.request };
307
+ case "create_context":
308
+ return { tag: "CreateContextRequest", val: payload.request };
309
+ case "get_execution":
310
+ return { tag: "GetExecutionRequest", val: payload.request };
311
+ case "list_executions":
312
+ return { tag: "ListExecutionsRequest", val: null };
313
+ case "wait_execution":
314
+ return { tag: "WaitExecutionRequest", val: payload.request };
315
+ case "cancel_execution":
316
+ return { tag: "CancelExecutionRequest", val: payload.request };
317
+ case "signal_execution":
318
+ return { tag: "SignalExecutionRequest", val: payload.request };
319
+ case "reset_execution":
320
+ return { tag: "ResetExecutionRequest", val: payload.request };
321
+ case "delete_execution":
322
+ return { tag: "DeleteExecutionRequest", val: payload.request };
323
+ case "write_execution_stdin":
324
+ return { tag: "WriteExecutionStdinRequest", val: payload.request };
325
+ case "close_execution_stdin":
326
+ return { tag: "CloseExecutionStdinRequest", val: payload.request };
327
+ case "resize_execution_pty":
328
+ return { tag: "ResizeExecutionPtyRequest", val: payload.request };
329
+ case "read_execution_output":
330
+ return { tag: "ReadExecutionOutputRequest", val: payload.request };
269
331
  case "ext":
270
332
  return {
271
333
  tag: "ExtEnvelope",
@@ -200,6 +200,33 @@ export type LiveResponsePayload = {
200
200
  configuration_path: string | null;
201
201
  retryable: boolean | null;
202
202
  errno: string | null;
203
+ } | {
204
+ type: "execution_accepted";
205
+ response: protocol.ExecutionAcceptedResponse;
206
+ } | {
207
+ type: "execution_completed";
208
+ response: protocol.ExecutionCompletedResponse;
209
+ } | {
210
+ type: "execution_evaluation";
211
+ response: protocol.ExecutionEvaluationResponse;
212
+ } | {
213
+ type: "typescript_check";
214
+ response: protocol.TypeScriptCheckResponse;
215
+ } | {
216
+ type: "execution_descriptor";
217
+ response: protocol.ExecutionDescriptorResponse;
218
+ } | {
219
+ type: "execution_list";
220
+ response: protocol.ExecutionListResponse;
221
+ } | {
222
+ type: "execution_deleted";
223
+ response: protocol.ExecutionDeletedResponse;
224
+ } | {
225
+ type: "execution_io";
226
+ response: protocol.ExecutionIoResponse;
227
+ } | {
228
+ type: "execution_output_page";
229
+ response: protocol.ExecutionOutputPageResponse;
203
230
  } | {
204
231
  type: "ext_result";
205
232
  envelope: LiveExtEnvelope;
@@ -271,6 +271,24 @@ export function fromGeneratedResponsePayload(payload) {
271
271
  type: "ext_result",
272
272
  envelope: fromGeneratedExtEnvelope(payload.val),
273
273
  };
274
+ case "ExecutionAcceptedResponse":
275
+ return { type: "execution_accepted", response: payload.val };
276
+ case "ExecutionCompletedResponse":
277
+ return { type: "execution_completed", response: payload.val };
278
+ case "ExecutionEvaluationResponse":
279
+ return { type: "execution_evaluation", response: payload.val };
280
+ case "TypeScriptCheckResponse":
281
+ return { type: "typescript_check", response: payload.val };
282
+ case "ExecutionDescriptorResponse":
283
+ return { type: "execution_descriptor", response: payload.val };
284
+ case "ExecutionListResponse":
285
+ return { type: "execution_list", response: payload.val };
286
+ case "ExecutionDeletedResponse":
287
+ return { type: "execution_deleted", response: payload.val };
288
+ case "ExecutionIoResponse":
289
+ return { type: "execution_io", response: payload.val };
290
+ case "ExecutionOutputPageResponse":
291
+ return { type: "execution_output_page", response: payload.val };
274
292
  }
275
293
  }
276
294
  function fromGeneratedAgentosProjectedAgent(agent) {
@@ -7,7 +7,8 @@ import type { SidecarProcessTransport } from "./sidecar-client.js";
7
7
  import { type LiveFsPermissionRule, type LivePatternPermissionRule, type LivePermissionMode, type LivePermissionScope, type LiveRulePermissions } from "./permissions.js";
8
8
  import type { LiveFilesystemOperation, LiveGuestRuntimeKind, LiveWasmPermissionTier } from "./protocol-maps.js";
9
9
  import { type LiveEventFrame, type LiveSidecarRequestHandler, type LiveSidecarRequestFrame, type LiveSidecarResponseFrame, type ProtocolFramePayloadCodec } from "./protocol-frames.js";
10
- import type { LiveGuestDirEntry } from "./response-payloads.js";
10
+ import { type LiveRequestPayload } from "./request-payloads.js";
11
+ import type { LiveGuestDirEntry, LiveResponsePayload } from "./response-payloads.js";
11
12
  import { type LiveGuestFilesystemStat } from "./state.js";
12
13
  export { SidecarProcessError, SidecarProcessExited, SidecarSilenceTimeout, } from "./sidecar-errors.js";
13
14
  export { SidecarEventBufferOverflow } from "./event-buffer.js";
@@ -368,6 +369,8 @@ export declare class SidecarProcess {
368
369
  waitForEvent(matcher: SidecarEventSelector | ((event: EventFrame) => boolean), timeoutMs?: number, options?: {
369
370
  signal?: AbortSignal;
370
371
  }): Promise<EventFrame>;
372
+ /** Internal semantic request entrypoint used by the AgentOS client surface. */
373
+ sendVmRequest(session: AuthenticatedSession, vm: CreatedVm, payload: LiveRequestPayload): Promise<LiveResponsePayload>;
371
374
  dispose(): Promise<void>;
372
375
  private sendRequest;
373
376
  private guestFilesystemCall;
@@ -53,8 +53,8 @@ export class SidecarProcess {
53
53
  },
54
54
  payload: {
55
55
  type: "authenticate",
56
- client_name: "secure-exec-core-client",
57
- auth_token: "secure-exec-core-client-token",
56
+ client_name: "agentos-core-client",
57
+ auth_token: "agentos-core-client-token",
58
58
  protocol_version: SIDECAR_PROTOCOL_SCHEMA.version,
59
59
  bridge_version: BRIDGE_CONTRACT_VERSION,
60
60
  },
@@ -946,6 +946,19 @@ export class SidecarProcess {
946
946
  async waitForEvent(matcher, timeoutMs, options) {
947
947
  return await this.protocolClient.waitForEvent(matcher, timeoutMs, options);
948
948
  }
949
+ /** Internal semantic request entrypoint used by the AgentOS client surface. */
950
+ async sendVmRequest(session, vm, payload) {
951
+ const response = await this.sendRequest({
952
+ ownership: {
953
+ scope: "vm",
954
+ connection_id: session.connectionId,
955
+ session_id: session.sessionId,
956
+ vm_id: vm.vmId,
957
+ },
958
+ payload,
959
+ });
960
+ return response.payload;
961
+ }
949
962
  async dispose() {
950
963
  await this.protocolClient.dispose();
951
964
  }
@@ -1161,7 +1161,7 @@ class WasmVmRuntimeDescriptor {
1161
1161
  if (dirOffset === undefined) {
1162
1162
  continue;
1163
1163
  }
1164
- guestPaths.set(name, `/__secure_exec/commands/${startIndex + dirOffset}/${name}`);
1164
+ guestPaths.set(name, `/__agentos/commands/${startIndex + dirOffset}/${name}`);
1165
1165
  }
1166
1166
  return guestPaths;
1167
1167
  }
@@ -1499,7 +1499,7 @@ function collectGuestCommandPaths(commandDirs, startIndex = 0) {
1499
1499
  const guestPaths = new Map();
1500
1500
  for (const entry of discoverWasmCommandEntries(commandDirs)) {
1501
1501
  if (!guestPaths.has(entry.name)) {
1502
- guestPaths.set(entry.name, `/__secure_exec/commands/${startIndex + entry.dirOffset}/${entry.name}`);
1502
+ guestPaths.set(entry.name, `/__agentos/commands/${startIndex + entry.dirOffset}/${entry.name}`);
1503
1503
  }
1504
1504
  }
1505
1505
  return guestPaths;
@@ -1864,7 +1864,7 @@ class NativeKernel {
1864
1864
  collectGuestCommandPaths(commandDirs, startIndex);
1865
1865
  const allCommandDirs = [...this.mountedCommandDirs, ...commandDirs];
1866
1866
  const sidecarMounts = allCommandDirs.map((commandDir, index) => serializeMountConfigForSidecar({
1867
- path: `/__secure_exec/commands/${index}`,
1867
+ path: `/__agentos/commands/${index}`,
1868
1868
  readOnly: true,
1869
1869
  plugin: {
1870
1870
  id: "host_dir",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivet-dev/agentos-runtime-core",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -197,7 +197,7 @@
197
197
  "test:npm-workflows": "AGENTOS_NPM_WORKFLOWS_E2E=1 vitest run tests/integration/e2e-npm-*.nightly.test.ts tests/integration/e2e-npx-and-pipes.nightly.test.ts tests/integration/e2e-concurrently.nightly.test.ts tests/integration/e2e-nextjs-build.nightly.test.ts --reporter=verbose"
198
198
  },
199
199
  "dependencies": {
200
- "@rivet-dev/agentos-runtime-sidecar": "0.2.14",
200
+ "@rivet-dev/agentos-runtime-sidecar": "0.2.15",
201
201
  "@rivetkit/bare-ts": "^0.6.2",
202
202
  "zod": "^4.1.11"
203
203
  },