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

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.
@@ -60,6 +60,21 @@ export type AcpResumeSessionRequest = {
60
60
  };
61
61
  export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest;
62
62
  export declare function writeAcpResumeSessionRequest(bc: bare.ByteCursor, x: AcpResumeSessionRequest): void;
63
+ /**
64
+ * Browser RESUMABLE path only (AGENTOS-WEB-ASYNC-AGENTS.md §3.2.1): the kernel
65
+ * worker feeds a chunk of the agent's stdout into the in-flight create_session /
66
+ * session/prompt handshake. The synchronous sidecar would block inside one
67
+ * pushFrame; the resumable browser path returns between steps so the worker can
68
+ * service the agent's own syscalls (incl. pi's net call for inference) on fresh,
69
+ * non-nested pushFrames. `processId` is the handshake handle returned in the
70
+ * AcpPendingResponse for the originating create/prompt request.
71
+ */
72
+ export type AcpDeliverAgentOutputRequest = {
73
+ readonly processId: string;
74
+ readonly chunk: ArrayBuffer;
75
+ };
76
+ export declare function readAcpDeliverAgentOutputRequest(bc: bare.ByteCursor): AcpDeliverAgentOutputRequest;
77
+ export declare function writeAcpDeliverAgentOutputRequest(bc: bare.ByteCursor, x: AcpDeliverAgentOutputRequest): void;
63
78
  export type AcpRequest = {
64
79
  readonly tag: "AcpCreateSessionRequest";
65
80
  readonly val: AcpCreateSessionRequest;
@@ -75,6 +90,9 @@ export type AcpRequest = {
75
90
  } | {
76
91
  readonly tag: "AcpResumeSessionRequest";
77
92
  readonly val: AcpResumeSessionRequest;
93
+ } | {
94
+ readonly tag: "AcpDeliverAgentOutputRequest";
95
+ readonly val: AcpDeliverAgentOutputRequest;
78
96
  };
79
97
  export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest;
80
98
  export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void;
@@ -134,6 +152,18 @@ export type AcpErrorResponse = {
134
152
  };
135
153
  export declare function readAcpErrorResponse(bc: bare.ByteCursor): AcpErrorResponse;
136
154
  export declare function writeAcpErrorResponse(bc: bare.ByteCursor, x: AcpErrorResponse): void;
155
+ /**
156
+ * Browser RESUMABLE path: the create_session / session/prompt request (and each
157
+ * AcpDeliverAgentOutputRequest that has not yet completed the handshake) returns
158
+ * this, carrying the `processId` handle the kernel worker drives the interaction
159
+ * with. The real result (AcpSessionCreatedResponse / AcpSessionRpcResponse) is
160
+ * delivered as the response to the AcpDeliverAgentOutputRequest that completes it.
161
+ */
162
+ export type AcpPendingResponse = {
163
+ readonly processId: string;
164
+ };
165
+ export declare function readAcpPendingResponse(bc: bare.ByteCursor): AcpPendingResponse;
166
+ export declare function writeAcpPendingResponse(bc: bare.ByteCursor, x: AcpPendingResponse): void;
137
167
  export type AcpResponse = {
138
168
  readonly tag: "AcpSessionCreatedResponse";
139
169
  readonly val: AcpSessionCreatedResponse;
@@ -152,6 +182,9 @@ export type AcpResponse = {
152
182
  } | {
153
183
  readonly tag: "AcpErrorResponse";
154
184
  readonly val: AcpErrorResponse;
185
+ } | {
186
+ readonly tag: "AcpPendingResponse";
187
+ readonly val: AcpPendingResponse;
155
188
  };
156
189
  export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse;
157
190
  export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void;
@@ -171,12 +204,40 @@ export type AcpAgentStderrEvent = {
171
204
  };
172
205
  export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent;
173
206
  export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void;
207
+ /**
208
+ * Emitted when the ACP adapter process exits without an explicit close_session —
209
+ * a crash from the host's perspective (any spontaneous exit, including code 0).
210
+ * `restart` reports the sidecar's bounded auto-restart outcome:
211
+ * "restarted" — adapter respawned and the session was natively re-attached
212
+ * (session/load | session/resume) under the same sessionId;
213
+ * the session stays live.
214
+ * "unsupported" — the respawned adapter does not advertise a native resume
215
+ * capability; the session record was evicted.
216
+ * "failed" — the respawn or the native re-attach errored; evicted.
217
+ * "exhausted" — maxRestarts was already spent for this session; evicted.
218
+ * `exitCode` is absent when the exit was observed indirectly (e.g. a write to
219
+ * the adapter's stdin failed because the process was already gone).
220
+ */
221
+ export type AcpAgentExitedEvent = {
222
+ readonly sessionId: string;
223
+ readonly agentType: string;
224
+ readonly processId: string;
225
+ readonly exitCode: i32 | null;
226
+ readonly restart: string;
227
+ readonly restartCount: u32;
228
+ readonly maxRestarts: u32;
229
+ };
230
+ export declare function readAcpAgentExitedEvent(bc: bare.ByteCursor): AcpAgentExitedEvent;
231
+ export declare function writeAcpAgentExitedEvent(bc: bare.ByteCursor, x: AcpAgentExitedEvent): void;
174
232
  export type AcpEvent = {
175
233
  readonly tag: "AcpSessionEvent";
176
234
  readonly val: AcpSessionEvent;
177
235
  } | {
178
236
  readonly tag: "AcpAgentStderrEvent";
179
237
  readonly val: AcpAgentStderrEvent;
238
+ } | {
239
+ readonly tag: "AcpAgentExitedEvent";
240
+ readonly val: AcpAgentExitedEvent;
180
241
  };
181
242
  export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent;
182
243
  export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void;
@@ -173,6 +173,16 @@ export function writeAcpResumeSessionRequest(bc, x) {
173
173
  bare.writeString(bc, x.cwd);
174
174
  write1(bc, x.env);
175
175
  }
176
+ export function readAcpDeliverAgentOutputRequest(bc) {
177
+ return {
178
+ processId: bare.readString(bc),
179
+ chunk: bare.readData(bc),
180
+ };
181
+ }
182
+ export function writeAcpDeliverAgentOutputRequest(bc, x) {
183
+ bare.writeString(bc, x.processId);
184
+ bare.writeData(bc, x.chunk);
185
+ }
176
186
  export function readAcpRequest(bc) {
177
187
  const offset = bc.offset;
178
188
  const tag = bare.readU8(bc);
@@ -187,6 +197,8 @@ export function readAcpRequest(bc) {
187
197
  return { tag: "AcpCloseSessionRequest", val: readAcpCloseSessionRequest(bc) };
188
198
  case 4:
189
199
  return { tag: "AcpResumeSessionRequest", val: readAcpResumeSessionRequest(bc) };
200
+ case 5:
201
+ return { tag: "AcpDeliverAgentOutputRequest", val: readAcpDeliverAgentOutputRequest(bc) };
190
202
  default: {
191
203
  bc.offset = offset;
192
204
  throw new bare.BareError(offset, "invalid tag");
@@ -220,6 +232,11 @@ export function writeAcpRequest(bc, x) {
220
232
  writeAcpResumeSessionRequest(bc, x.val);
221
233
  break;
222
234
  }
235
+ case "AcpDeliverAgentOutputRequest": {
236
+ bare.writeU8(bc, 5);
237
+ writeAcpDeliverAgentOutputRequest(bc, x.val);
238
+ break;
239
+ }
223
240
  }
224
241
  }
225
242
  export function encodeAcpRequest(x, config) {
@@ -353,6 +370,14 @@ export function writeAcpErrorResponse(bc, x) {
353
370
  bare.writeString(bc, x.code);
354
371
  bare.writeString(bc, x.message);
355
372
  }
373
+ export function readAcpPendingResponse(bc) {
374
+ return {
375
+ processId: bare.readString(bc),
376
+ };
377
+ }
378
+ export function writeAcpPendingResponse(bc, x) {
379
+ bare.writeString(bc, x.processId);
380
+ }
356
381
  export function readAcpResponse(bc) {
357
382
  const offset = bc.offset;
358
383
  const tag = bare.readU8(bc);
@@ -369,6 +394,8 @@ export function readAcpResponse(bc) {
369
394
  return { tag: "AcpSessionResumedResponse", val: readAcpSessionResumedResponse(bc) };
370
395
  case 5:
371
396
  return { tag: "AcpErrorResponse", val: readAcpErrorResponse(bc) };
397
+ case 6:
398
+ return { tag: "AcpPendingResponse", val: readAcpPendingResponse(bc) };
372
399
  default: {
373
400
  bc.offset = offset;
374
401
  throw new bare.BareError(offset, "invalid tag");
@@ -407,6 +434,11 @@ export function writeAcpResponse(bc, x) {
407
434
  writeAcpErrorResponse(bc, x.val);
408
435
  break;
409
436
  }
437
+ case "AcpPendingResponse": {
438
+ bare.writeU8(bc, 6);
439
+ writeAcpPendingResponse(bc, x.val);
440
+ break;
441
+ }
410
442
  }
411
443
  }
412
444
  export function encodeAcpResponse(x, config) {
@@ -447,6 +479,26 @@ export function writeAcpAgentStderrEvent(bc, x) {
447
479
  bare.writeString(bc, x.processId);
448
480
  bare.writeData(bc, x.chunk);
449
481
  }
482
+ export function readAcpAgentExitedEvent(bc) {
483
+ return {
484
+ sessionId: bare.readString(bc),
485
+ agentType: bare.readString(bc),
486
+ processId: bare.readString(bc),
487
+ exitCode: read6(bc),
488
+ restart: bare.readString(bc),
489
+ restartCount: bare.readU32(bc),
490
+ maxRestarts: bare.readU32(bc),
491
+ };
492
+ }
493
+ export function writeAcpAgentExitedEvent(bc, x) {
494
+ bare.writeString(bc, x.sessionId);
495
+ bare.writeString(bc, x.agentType);
496
+ bare.writeString(bc, x.processId);
497
+ write6(bc, x.exitCode);
498
+ bare.writeString(bc, x.restart);
499
+ bare.writeU32(bc, x.restartCount);
500
+ bare.writeU32(bc, x.maxRestarts);
501
+ }
450
502
  export function readAcpEvent(bc) {
451
503
  const offset = bc.offset;
452
504
  const tag = bare.readU8(bc);
@@ -455,6 +507,8 @@ export function readAcpEvent(bc) {
455
507
  return { tag: "AcpSessionEvent", val: readAcpSessionEvent(bc) };
456
508
  case 1:
457
509
  return { tag: "AcpAgentStderrEvent", val: readAcpAgentStderrEvent(bc) };
510
+ case 2:
511
+ return { tag: "AcpAgentExitedEvent", val: readAcpAgentExitedEvent(bc) };
458
512
  default: {
459
513
  bc.offset = offset;
460
514
  throw new bare.BareError(offset, "invalid tag");
@@ -473,6 +527,11 @@ export function writeAcpEvent(bc, x) {
473
527
  writeAcpAgentStderrEvent(bc, x.val);
474
528
  break;
475
529
  }
530
+ case "AcpAgentExitedEvent": {
531
+ bare.writeU8(bc, 2);
532
+ writeAcpAgentExitedEvent(bc, x.val);
533
+ break;
534
+ }
476
535
  }
477
536
  }
478
537
  export function encodeAcpEvent(x, config) {
@@ -7,6 +7,30 @@ const PROTECTED_READ_ONLY_GUEST_ROOTS = ["/etc/agentos"];
7
7
  const TRAILING_OUTPUT_DRAIN_INTERVAL_MS = 10;
8
8
  const TRAILING_OUTPUT_DRAIN_MAX_MS = 250;
9
9
  const TRAILING_OUTPUT_DRAIN_QUIET_TURNS = 2;
10
+ function shouldLogStructuredSidecarEvent(name) {
11
+ const normalized = name.toLowerCase();
12
+ return (normalized === "limit_warning" ||
13
+ normalized.startsWith("security.") ||
14
+ normalized.includes("warning") ||
15
+ normalized.includes("failed") ||
16
+ normalized.includes("error"));
17
+ }
18
+ function formatStructuredSidecarDetail(detail) {
19
+ const entries = Object.entries(detail);
20
+ if (entries.length === 0) {
21
+ return "";
22
+ }
23
+ return entries.map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(" ");
24
+ }
25
+ function logStructuredSidecarEvent(name, detail) {
26
+ if (!shouldLogStructuredSidecarEvent(name)) {
27
+ return;
28
+ }
29
+ const formatted = formatStructuredSidecarDetail(detail);
30
+ console.warn(formatted
31
+ ? `[agent-os] sidecar ${name}: ${formatted}`
32
+ : `[agent-os] sidecar ${name}`);
33
+ }
10
34
  async function drainTrailingProcessOutputTurn(delayMs = 0) {
11
35
  // Native-sidecar `process_output` events can lag one macrotask behind the
12
36
  // terminal `process_exited` notification for very short-lived processes, and
@@ -142,7 +166,10 @@ function parseSimpleExecCommand(command) {
142
166
  return tokens;
143
167
  }
144
168
  function canUseDirectExec(driver, commandName) {
145
- return driver === "wasmvm" || (driver === "node" && commandName === "node");
169
+ return (driver === "wasmvm" ||
170
+ (driver === "node" && commandName === "node") ||
171
+ (driver === "python" &&
172
+ (commandName === "python" || commandName === "python3")));
146
173
  }
147
174
  function shellSingleQuote(value) {
148
175
  if (value.length === 0) {
@@ -494,7 +521,11 @@ export class NativeSidecarKernelProxy {
494
521
  processId,
495
522
  command: spawnCommand,
496
523
  args: spawnArgs,
497
- driver: spawnCommand === "node" ? "node" : "wasmvm",
524
+ driver: spawnCommand === "node"
525
+ ? "node"
526
+ : spawnCommand === "python" || spawnCommand === "python3"
527
+ ? "python"
528
+ : "wasmvm",
498
529
  cwd: options?.cwd ?? this.cwd,
499
530
  env: {
500
531
  ...(options?.env ?? {}),
@@ -526,16 +557,16 @@ export class NativeSidecarKernelProxy {
526
557
  pid,
527
558
  writeStdin: (data) => {
528
559
  if (entry.exitCode !== null) {
529
- return;
560
+ return Promise.resolve();
530
561
  }
531
562
  entry.pendingStdin.push(data);
532
- void this.flushPendingStdin(entry).catch((error) => {
563
+ return this.flushPendingStdin(entry).catch((error) => {
533
564
  this.handleBackgroundProcessError(entry, error);
534
565
  });
535
566
  },
536
567
  closeStdin: () => {
537
568
  entry.pendingCloseStdin = true;
538
- void this.closeTrackedStdin(entry).catch((error) => {
569
+ return this.closeTrackedStdin(entry).catch((error) => {
539
570
  this.handleBackgroundProcessError(entry, error);
540
571
  });
541
572
  },
@@ -579,7 +610,6 @@ export class NativeSidecarKernelProxy {
579
610
  const args = options?.args ??
580
611
  (command === "sh" || command === "/bin/sh" ? ["-i"] : []);
581
612
  const synthesizePrompt = !options?.command && !options?.args;
582
- const autoCloseExplicitCommandStdin = Boolean(options?.command) && !["sh", "/bin/sh", "bash"].includes(command);
583
613
  const promptText = "sh-0.4$ ";
584
614
  const textEncoder = new TextEncoder();
585
615
  const textDecoder = new TextDecoder();
@@ -589,14 +619,18 @@ export class NativeSidecarKernelProxy {
589
619
  .replace(/\u001b\[[0-9;]*m/g, "")
590
620
  .replace(/^.*WARN could not retrieve pid for child process\n?/gm, "")
591
621
  .replace(/^ProcessExitError:.*\n(?:\s+at .*\n)*/gm, "");
622
+ const sanitizeNativeShellOutput = (chunk) => {
623
+ const text = textDecoder.decode(chunk);
624
+ const sanitized = text.replace(/^.*WARN could not retrieve pid for child process\n?/gm, "");
625
+ return sanitized.length > 0 ? textEncoder.encode(sanitized) : null;
626
+ };
592
627
  let bufferedInput = "";
593
628
  let bufferedCommand = "";
594
629
  let activeForegroundProcess = null;
595
- let shellEnv = { ...(options?.env ?? {}) };
630
+ let shellEnv = { ...(options?.env ?? {}), AGENTOS_EXEC_TTY: "1" };
596
631
  let shellCwd = options?.cwd ?? this.cwd;
597
632
  let syntheticCommandQueue = Promise.resolve();
598
633
  let promptTimer = null;
599
- let closeStdinTimer = null;
600
634
  let commandInFlight = false;
601
635
  let syntheticCursorAtLineStart = true;
602
636
  const syntheticPid = this.nextSyntheticPid++;
@@ -611,12 +645,6 @@ export class NativeSidecarKernelProxy {
611
645
  promptTimer = null;
612
646
  }
613
647
  };
614
- const clearCloseStdinTimer = () => {
615
- if (closeStdinTimer !== null) {
616
- clearTimeout(closeStdinTimer);
617
- closeStdinTimer = null;
618
- }
619
- };
620
648
  const normalizeSyntheticTerminalText = (text) => text.replace(/\r?\n/g, "\r\n");
621
649
  const updateSyntheticCursor = (text) => {
622
650
  if (!text) {
@@ -712,15 +740,36 @@ export class NativeSidecarKernelProxy {
712
740
  }
713
741
  return parsed;
714
742
  };
715
- const writeForegroundInput = (proc, data) => {
743
+ const writeForegroundInput = async (proc, data) => {
716
744
  if (typeof data === "string") {
717
745
  for (const character of data) {
718
- proc.writeStdin(character);
746
+ await proc.writeStdin(character);
719
747
  }
720
748
  return;
721
749
  }
722
750
  for (const byte of data) {
723
- proc.writeStdin(new Uint8Array([byte]));
751
+ await proc.writeStdin(new Uint8Array([byte]));
752
+ }
753
+ };
754
+ const appendSyntheticInput = (input) => {
755
+ for (const character of input) {
756
+ if (character === "\u0004") {
757
+ continue;
758
+ }
759
+ if (character === "\b" || character === "\u007f") {
760
+ if (bufferedInput.length > 0) {
761
+ bufferedInput = bufferedInput.slice(0, -1);
762
+ emitSyntheticTerminal("\b \b");
763
+ }
764
+ continue;
765
+ }
766
+ bufferedInput += character;
767
+ if (character === "\n") {
768
+ emitSyntheticTerminal("\n");
769
+ }
770
+ else if (character >= " ") {
771
+ emitSyntheticTerminal(character);
772
+ }
724
773
  }
725
774
  };
726
775
  let onData = null;
@@ -732,7 +781,7 @@ export class NativeSidecarKernelProxy {
732
781
  schedulePrompt(0);
733
782
  return {
734
783
  pid: syntheticPid,
735
- write(data) {
784
+ async write(data) {
736
785
  if (syntheticExitCode !== null) {
737
786
  return;
738
787
  }
@@ -743,13 +792,13 @@ export class NativeSidecarKernelProxy {
743
792
  if (rawText.includes("\u0003")) {
744
793
  const [beforeInterrupt] = rawText.split("\u0003");
745
794
  if (beforeInterrupt) {
746
- writeForegroundInput(activeForegroundProcess, beforeInterrupt);
795
+ await writeForegroundInput(activeForegroundProcess, beforeInterrupt);
747
796
  }
748
797
  emitSyntheticTerminal("^C\n");
749
798
  activeForegroundProcess.kill(2);
750
799
  return;
751
800
  }
752
- writeForegroundInput(activeForegroundProcess, data);
801
+ await writeForegroundInput(activeForegroundProcess, data);
753
802
  return;
754
803
  }
755
804
  const rawText = typeof data === "string"
@@ -772,7 +821,7 @@ export class NativeSidecarKernelProxy {
772
821
  finishSyntheticShell(0);
773
822
  return;
774
823
  }
775
- bufferedInput += text.replace(/\u0004/g, "");
824
+ appendSyntheticInput(text.replace(/\r\n/g, "\n").replace(/\r/g, "\n"));
776
825
  while (true) {
777
826
  const newlineIndex = bufferedInput.indexOf("\n");
778
827
  if (newlineIndex < 0) {
@@ -782,7 +831,6 @@ export class NativeSidecarKernelProxy {
782
831
  .slice(0, newlineIndex)
783
832
  .replace(/\r$/, "");
784
833
  bufferedInput = bufferedInput.slice(newlineIndex + 1);
785
- emitSyntheticStdout(`${line}\n`);
786
834
  const nextCommand = bufferedCommand
787
835
  ? `${bufferedCommand}\n${line}`
788
836
  : line;
@@ -881,20 +929,33 @@ export class NativeSidecarKernelProxy {
881
929
  };
882
930
  }
883
931
  const proc = this.spawn(command, args, {
884
- env: options?.env,
932
+ env: {
933
+ ...(options?.env ?? {}),
934
+ ...(options?.cols ? { COLUMNS: String(Math.trunc(options.cols)) } : {}),
935
+ ...(options?.rows ? { LINES: String(Math.trunc(options.rows)) } : {}),
936
+ AGENTOS_EXEC_TTY: "1",
937
+ },
885
938
  cwd: options?.cwd,
886
939
  streamStdin: true,
887
940
  onStdout: (chunk) => {
941
+ const sanitized = sanitizeNativeShellOutput(chunk);
942
+ if (!sanitized) {
943
+ return;
944
+ }
888
945
  for (const handler of stdoutHandlers) {
889
- handler(chunk);
946
+ handler(sanitized);
890
947
  }
891
948
  if (commandInFlight) {
892
949
  schedulePrompt(120);
893
950
  }
894
951
  },
895
952
  onStderr: (chunk) => {
953
+ const sanitized = sanitizeNativeShellOutput(chunk);
954
+ if (!sanitized) {
955
+ return;
956
+ }
896
957
  for (const handler of stderrHandlers) {
897
- handler(chunk);
958
+ handler(sanitized);
898
959
  }
899
960
  if (commandInFlight) {
900
961
  schedulePrompt(120);
@@ -903,18 +964,11 @@ export class NativeSidecarKernelProxy {
903
964
  });
904
965
  return {
905
966
  pid: proc.pid,
906
- write(data) {
967
+ async write(data) {
907
968
  if (synthesizePrompt) {
908
969
  return;
909
970
  }
910
- proc.writeStdin(data);
911
- if (autoCloseExplicitCommandStdin) {
912
- clearCloseStdinTimer();
913
- closeStdinTimer = setTimeout(() => {
914
- closeStdinTimer = null;
915
- proc.closeStdin();
916
- }, 100);
917
- }
971
+ await proc.writeStdin(data);
918
972
  if (synthesizePrompt &&
919
973
  typeof data === "string" &&
920
974
  (data.includes("\n") || data.includes("\r"))) {
@@ -928,11 +982,18 @@ export class NativeSidecarKernelProxy {
928
982
  set onData(handler) {
929
983
  onData = handler;
930
984
  },
931
- resize() {
932
- // The current stdio-native path is process-backed rather than PTY-backed.
985
+ resize: (cols, rows) => {
986
+ const entry = this.trackedProcesses.get(proc.pid);
987
+ if (!entry || entry.exitCode !== null) {
988
+ return;
989
+ }
990
+ void entry.startPromise
991
+ .then(() => this.client.resizePty(this.session, this.vm, entry.processId, Math.trunc(cols), Math.trunc(rows)))
992
+ .catch((error) => {
993
+ this.handleBackgroundProcessError(entry, error);
994
+ });
933
995
  },
934
996
  kill(signal) {
935
- clearCloseStdinTimer();
936
997
  clearPromptTimer();
937
998
  proc.kill(signal);
938
999
  },
@@ -1282,6 +1343,10 @@ export class NativeSidecarKernelProxy {
1282
1343
  }
1283
1344
  void this.refreshProcessSnapshot().catch(() => { });
1284
1345
  this.finishProcess(entry, event.payload.exit_code);
1346
+ continue;
1347
+ }
1348
+ if (event.payload.type === "structured") {
1349
+ logStructuredSidecarEvent(event.payload.name, event.payload.detail);
1285
1350
  }
1286
1351
  }
1287
1352
  catch (error) {
@@ -1779,6 +1844,10 @@ function buildCommandMap(commandGuestPaths) {
1779
1844
  ["node", "node"],
1780
1845
  ["npm", "node"],
1781
1846
  ["npx", "node"],
1847
+ // `python` / `python3` are served by the embedded Pyodide runtime,
1848
+ // mirroring how `node` is served by the embedded V8 runtime.
1849
+ ["python", "python"],
1850
+ ["python3", "python"],
1782
1851
  ]);
1783
1852
  for (const name of commandGuestPaths.keys()) {
1784
1853
  commands.set(name, "wasmvm");
package/dist/types.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- export type { AgentCapabilities, AgentInfo, AgentOsCreateSidecarOptions, AgentOsLimits, AgentOsOptions, AgentOsSharedSidecarOptions, AgentOsSidecarConfig, AgentOsSidecarDescription, 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 { 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";
2
2
  export type { AgentConfig, AgentType } from "./agents.js";
3
3
  export type { CronAction, CronEvent, CronEventHandler, CronJob, CronJobInfo, CronJobOptions, ScheduleDriver, ScheduleEntry, ScheduleHandle, } from "./cron/index.js";
4
4
  export type { HostDirBackendOptions, HostDirMountPluginConfig, NodeModulesMountConfig, } from "./host-dir-mount.js";
5
5
  export type { HostTool, ToolExample, ToolKit } from "./host-tools.js";
6
6
  export type { AcpTimeoutErrorData, JsonRpcError, JsonRpcErrorData, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, UnknownSessionErrorData, } from "./json-rpc.js";
7
7
  export type { FilesystemSnapshotExport, LayerHandle, LayerStore, OverlayFilesystemMode, RootSnapshotExport, SnapshotImportSource, SnapshotLayerHandle, WritableLayerHandle, } from "./layers.js";
8
- export type { AgentSoftwareDescriptor, AnySoftwareDescriptor, SoftwareContext, SoftwareDescriptor, SoftwareInput, SoftwareRoot, ToolSoftwareDescriptor, WasmCommandDirDescriptor, WasmCommandSoftwareDescriptor, } from "./packages.js";
8
+ export type { SoftwareInput, SoftwareRoot } from "./packages.js";
9
+ export type { AgentBlock, PackageDescriptor, PackageRef, SoftwarePackageRef, } from "./agentos-package.js";
9
10
  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";
10
11
  export type { PromptCapabilities } from "./agent-session-types.js";
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@rivet-dev/agentos-core",
3
- "version": "0.2.4",
3
+ "version": "0.2.5-rc.2",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "files": [
9
- "dist",
10
- "fixtures"
9
+ "dist"
11
10
  ],
12
11
  "exports": {
13
12
  ".": {
@@ -54,11 +53,17 @@
54
53
  "test": "vitest run --reporter=verbose"
55
54
  },
56
55
  "dependencies": {
57
- "@agentos-software/common": "0.3.0",
56
+ "@agentos-software/claude-code": "0.3.1",
57
+ "@agentos-software/codex-cli": "0.3.1",
58
+ "@agentos-software/common": "0.3.1",
59
+ "@agentos-software/manifest": "0.3.1",
60
+ "@agentos-software/opencode": "0.3.1",
61
+ "@agentos-software/pi": "0.3.1",
62
+ "@agentos-software/pi-cli": "0.3.1",
58
63
  "@aws-sdk/client-s3": "^3.1019.0",
59
- "@rivet-dev/agentos-sidecar": "0.2.4",
64
+ "@rivet-dev/agentos-sidecar": "0.2.5-rc.2",
60
65
  "@rivetkit/bare-ts": "^0.6.2",
61
- "@secure-exec/core": "0.3.3",
66
+ "@secure-exec/core": "0.3.4-rc.1",
62
67
  "@xterm/headless": "^6.0.0",
63
68
  "better-sqlite3": "^12.8.0",
64
69
  "croner": "^10.0.1",
@@ -70,39 +75,39 @@
70
75
  "zod-to-json-schema": "^3.25.2"
71
76
  },
72
77
  "devDependencies": {
78
+ "@agentos-software/claude-code": "0.3.1",
79
+ "@agentos-software/codex": "0.3.1",
80
+ "@agentos-software/coreutils": "0.3.1",
81
+ "@agentos-software/curl": "0.3.1",
82
+ "@agentos-software/diffutils": "0.3.1",
83
+ "@agentos-software/duckdb": "0.0.0-nathan-agentos-package-resolution.efc374f",
84
+ "@agentos-software/fd": "0.3.1",
85
+ "@agentos-software/file": "0.3.1",
86
+ "@agentos-software/findutils": "0.3.1",
87
+ "@agentos-software/gawk": "0.3.1",
88
+ "@agentos-software/git": "0.3.1",
89
+ "@agentos-software/grep": "0.3.1",
90
+ "@agentos-software/gzip": "0.3.1",
91
+ "@agentos-software/http-get": "0.3.1",
92
+ "@agentos-software/jq": "0.3.1",
93
+ "@agentos-software/opencode": "0.3.1",
94
+ "@agentos-software/pi": "0.3.1",
95
+ "@agentos-software/pi-cli": "0.3.1",
96
+ "@agentos-software/ripgrep": "0.3.1",
97
+ "@agentos-software/sed": "0.3.1",
98
+ "@agentos-software/tar": "0.3.1",
99
+ "@agentos-software/tree": "0.3.1",
100
+ "@agentos-software/vim": "0.3.1",
101
+ "@agentos-software/yq": "0.3.1",
73
102
  "@anthropic-ai/claude-agent-sdk": "^0.2.87",
74
103
  "@anthropic-ai/claude-code": "^2.1.86",
104
+ "@bare-ts/tools": "0.15.0",
75
105
  "@browserbasehq/browse-cli": "0.5.0",
76
106
  "@browserbasehq/cli": "0.5.4",
77
107
  "@browserbasehq/sdk": "2.10.0",
78
- "@bare-ts/tools": "0.15.0",
79
108
  "@copilotkit/llmock": "^1.6.0",
80
- "@rivet-dev/agentos-sandbox": "link:../agentos-sandbox",
81
- "@agentos-software/git": "0.3.0",
82
- "@secure-exec/google-drive": "0.3.3",
83
- "@secure-exec/s3": "0.3.3",
84
109
  "@mariozechner/pi-coding-agent": "^0.60.0",
85
- "@agentos-software/claude-code": "0.2.1",
86
- "@agentos-software/codex-cli": "0.3.0",
87
- "@agentos-software/codex": "0.2.0",
88
- "@agentos-software/coreutils": "0.3.0",
89
- "@agentos-software/curl": "0.3.0",
90
- "@agentos-software/diffutils": "0.3.0",
91
- "@agentos-software/fd": "0.3.0",
92
- "@agentos-software/file": "0.3.0",
93
- "@agentos-software/findutils": "0.3.0",
94
- "@agentos-software/gawk": "0.3.0",
95
- "@agentos-software/grep": "0.3.0",
96
- "@agentos-software/gzip": "0.3.0",
97
- "@agentos-software/jq": "0.3.0",
98
- "@agentos-software/opencode": "0.2.1",
99
- "@agentos-software/pi": "0.2.1",
100
- "@agentos-software/pi-cli": "0.2.1",
101
- "@agentos-software/ripgrep": "0.3.0",
102
- "@agentos-software/sed": "0.3.0",
103
- "@agentos-software/tar": "0.3.0",
104
- "@agentos-software/tree": "0.3.0",
105
- "@agentos-software/yq": "0.3.0",
110
+ "@rivet-dev/agentos-sandbox": "link:../agentos-sandbox",
106
111
  "@types/node": "^22.10.2",
107
112
  "pi-acp": "^0.0.23",
108
113
  "sandbox-agent": "^0.4.2",