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

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 (234) hide show
  1. package/README.md +1 -1
  2. package/commands/[ +0 -0
  3. package/commands/_stubs +0 -0
  4. package/commands/acl_tools +0 -0
  5. package/commands/arch +0 -0
  6. package/commands/attr +0 -0
  7. package/commands/awk +0 -0
  8. package/commands/b2sum +0 -0
  9. package/commands/base32 +0 -0
  10. package/commands/base64 +0 -0
  11. package/commands/basename +0 -0
  12. package/commands/basenc +0 -0
  13. package/commands/bash +0 -0
  14. package/commands/bc +0 -0
  15. package/commands/cat +0 -0
  16. package/commands/chacl +0 -0
  17. package/commands/chcon +0 -0
  18. package/commands/chgrp +0 -0
  19. package/commands/chmod +0 -0
  20. package/commands/chown +0 -0
  21. package/commands/chroot +0 -0
  22. package/commands/cksum +0 -0
  23. package/commands/cmp +0 -0
  24. package/commands/column +0 -0
  25. package/commands/comm +0 -0
  26. package/commands/cp +0 -0
  27. package/commands/curl +0 -0
  28. package/commands/cut +0 -0
  29. package/commands/date +0 -0
  30. package/commands/dd +0 -0
  31. package/commands/df +0 -0
  32. package/commands/diff +0 -0
  33. package/commands/dir +0 -0
  34. package/commands/dircolors +0 -0
  35. package/commands/dirname +0 -0
  36. package/commands/du +0 -0
  37. package/commands/echo +0 -0
  38. package/commands/egrep +0 -0
  39. package/commands/env +0 -0
  40. package/commands/envsubst +0 -0
  41. package/commands/expand +0 -0
  42. package/commands/expr +0 -0
  43. package/commands/factor +0 -0
  44. package/commands/false +0 -0
  45. package/commands/fd +0 -0
  46. package/commands/fgrep +0 -0
  47. package/commands/file +0 -0
  48. package/commands/find +0 -0
  49. package/commands/findmnt +0 -0
  50. package/commands/fmt +0 -0
  51. package/commands/fold +0 -0
  52. package/commands/getent +0 -0
  53. package/commands/getfacl +0 -0
  54. package/commands/getfattr +0 -0
  55. package/commands/git +0 -0
  56. package/commands/git-receive-pack +0 -0
  57. package/commands/git-remote-http +0 -0
  58. package/commands/git-remote-https +0 -0
  59. package/commands/git-upload-archive +0 -0
  60. package/commands/git-upload-pack +0 -0
  61. package/commands/grep +0 -0
  62. package/commands/groups +0 -0
  63. package/commands/gunzip +0 -0
  64. package/commands/gzip +0 -0
  65. package/commands/head +0 -0
  66. package/commands/hostid +0 -0
  67. package/commands/hostname +0 -0
  68. package/commands/http-test +0 -0
  69. package/commands/id +0 -0
  70. package/commands/install +0 -0
  71. package/commands/join +0 -0
  72. package/commands/jq +0 -0
  73. package/commands/kill +0 -0
  74. package/commands/link +0 -0
  75. package/commands/ln +0 -0
  76. package/commands/logname +0 -0
  77. package/commands/ls +0 -0
  78. package/commands/md5sum +0 -0
  79. package/commands/mkdir +0 -0
  80. package/commands/mkfifo +0 -0
  81. package/commands/mknod +0 -0
  82. package/commands/mktemp +0 -0
  83. package/commands/more +0 -0
  84. package/commands/mount +0 -0
  85. package/commands/mv +0 -0
  86. package/commands/nice +0 -0
  87. package/commands/nl +0 -0
  88. package/commands/nohup +0 -0
  89. package/commands/nproc +0 -0
  90. package/commands/numfmt +0 -0
  91. package/commands/od +0 -0
  92. package/commands/paste +0 -0
  93. package/commands/pathchk +0 -0
  94. package/commands/pinky +0 -0
  95. package/commands/printenv +0 -0
  96. package/commands/printf +0 -0
  97. package/commands/ptx +0 -0
  98. package/commands/pwd +0 -0
  99. package/commands/readlink +0 -0
  100. package/commands/realpath +0 -0
  101. package/commands/rev +0 -0
  102. package/commands/rg +0 -0
  103. package/commands/rm +0 -0
  104. package/commands/rmdir +0 -0
  105. package/commands/runas +0 -0
  106. package/commands/runcon +0 -0
  107. package/commands/sed +0 -0
  108. package/commands/seq +0 -0
  109. package/commands/setfacl +0 -0
  110. package/commands/setfattr +0 -0
  111. package/commands/sh +0 -0
  112. package/commands/sha1sum +0 -0
  113. package/commands/sha224sum +0 -0
  114. package/commands/sha256sum +0 -0
  115. package/commands/sha384sum +0 -0
  116. package/commands/sha512sum +0 -0
  117. package/commands/shred +0 -0
  118. package/commands/shuf +0 -0
  119. package/commands/sleep +0 -0
  120. package/commands/sort +0 -0
  121. package/commands/spawn-test-host +0 -0
  122. package/commands/split +0 -0
  123. package/commands/sqlite3 +0 -0
  124. package/commands/ssh +0 -0
  125. package/commands/ssh-keysign +0 -0
  126. package/commands/ssh-sk-helper +0 -0
  127. package/commands/stat +0 -0
  128. package/commands/stdbuf +0 -0
  129. package/commands/strings +0 -0
  130. package/commands/stty +0 -0
  131. package/commands/su +0 -0
  132. package/commands/sum +0 -0
  133. package/commands/sync +0 -0
  134. package/commands/tac +0 -0
  135. package/commands/tail +0 -0
  136. package/commands/tar +0 -0
  137. package/commands/tee +0 -0
  138. package/commands/test +0 -0
  139. package/commands/timeout +0 -0
  140. package/commands/touch +0 -0
  141. package/commands/tr +0 -0
  142. package/commands/tree +0 -0
  143. package/commands/true +0 -0
  144. package/commands/truncate +0 -0
  145. package/commands/tsort +0 -0
  146. package/commands/tty +0 -0
  147. package/commands/uname +0 -0
  148. package/commands/unexpand +0 -0
  149. package/commands/uniq +0 -0
  150. package/commands/unlink +0 -0
  151. package/commands/unzip +0 -0
  152. package/commands/uptime +0 -0
  153. package/commands/users +0 -0
  154. package/commands/vdir +0 -0
  155. package/commands/wc +0 -0
  156. package/commands/wget +0 -0
  157. package/commands/which +0 -0
  158. package/commands/who +0 -0
  159. package/commands/whoami +0 -0
  160. package/commands/xargs +0 -0
  161. package/commands/xattr_tools +0 -0
  162. package/commands/xfs_io +0 -0
  163. package/commands/xu +0 -0
  164. package/commands/yes +0 -0
  165. package/commands/yq +0 -0
  166. package/commands/zcat +0 -0
  167. package/commands/zip +0 -0
  168. package/dist/binary.js +4 -3
  169. package/dist/descriptors.d.ts +2 -12
  170. package/dist/descriptors.js +10 -6
  171. package/dist/frame-stream.d.ts +33 -0
  172. package/dist/frame-stream.js +113 -0
  173. package/dist/generated/AcpLimitsConfig.d.ts +16 -0
  174. package/dist/generated/BindingLimitsConfig.d.ts +10 -0
  175. package/dist/generated/CreateVmConfig.d.ts +4 -0
  176. package/dist/generated/Http2LimitsConfig.d.ts +12 -0
  177. package/dist/generated/Http2LimitsConfig.js +2 -0
  178. package/dist/generated/JsRuntimeLimitsConfig.d.ts +1 -0
  179. package/dist/generated/MountPluginDescriptor.d.ts +1 -1
  180. package/dist/generated/ProcessLimitsConfig.d.ts +7 -0
  181. package/dist/generated/ProcessLimitsConfig.js +2 -0
  182. package/dist/generated/ReactorLimitsConfig.d.ts +23 -0
  183. package/dist/generated/ReactorLimitsConfig.js +2 -0
  184. package/dist/generated/SqliteLimitsConfig.d.ts +3 -0
  185. package/dist/generated/SqliteLimitsConfig.js +2 -0
  186. package/dist/generated/TlsLimitsConfig.d.ts +3 -0
  187. package/dist/generated/TlsLimitsConfig.js +2 -0
  188. package/dist/generated/UdpLimitsConfig.d.ts +4 -0
  189. package/dist/generated/UdpLimitsConfig.js +2 -0
  190. package/dist/generated/VmGroupConfig.d.ts +5 -0
  191. package/dist/generated/VmGroupConfig.js +2 -0
  192. package/dist/generated/VmLimitsConfig.d.ts +14 -2
  193. package/dist/generated/VmSqliteDescriptor.d.ts +10 -0
  194. package/dist/generated/VmSqliteDescriptor.js +2 -0
  195. package/dist/generated/VmUserAccountConfig.d.ts +9 -0
  196. package/dist/generated/VmUserAccountConfig.js +2 -0
  197. package/dist/generated/VmUserConfig.d.ts +19 -0
  198. package/dist/generated/VmUserConfig.js +1 -0
  199. package/dist/generated/WasmLimitsConfig.d.ts +1 -0
  200. package/dist/generated-protocol.d.ts +60 -2
  201. package/dist/generated-protocol.js +166 -31
  202. package/dist/kernel-proxy.d.ts +4 -0
  203. package/dist/kernel-proxy.js +53 -20
  204. package/dist/native-client.d.ts +3 -3
  205. package/dist/native-client.js +43 -8
  206. package/dist/node-runtime-options-schema.d.ts +1 -1
  207. package/dist/node-runtime-options-schema.js +43 -1
  208. package/dist/node-runtime.d.ts +12 -3
  209. package/dist/node-runtime.js +8 -7
  210. package/dist/process.d.ts +5 -1
  211. package/dist/process.js +35 -8
  212. package/dist/protocol-client.d.ts +9 -2
  213. package/dist/protocol-client.js +127 -7
  214. package/dist/protocol-frames.d.ts +14 -3
  215. package/dist/protocol-frames.js +26 -1
  216. package/dist/protocol-schema.d.ts +1 -1
  217. package/dist/protocol-schema.js +1 -1
  218. package/dist/request-payloads.d.ts +4 -1
  219. package/dist/request-payloads.js +7 -2
  220. package/dist/response-payloads.d.ts +22 -1
  221. package/dist/response-payloads.js +33 -1
  222. package/dist/sidecar-errors.d.ts +22 -0
  223. package/dist/sidecar-errors.js +10 -0
  224. package/dist/sidecar-process.d.ts +12 -2
  225. package/dist/sidecar-process.js +77 -12
  226. package/dist/test-runtime.d.ts +19 -7
  227. package/dist/test-runtime.js +213 -66
  228. package/dist/vm-config.d.ts +5 -1
  229. package/package.json +11 -6
  230. package/commands/codex +0 -0
  231. package/commands/codex-exec +0 -0
  232. package/commands/http_get +0 -0
  233. package/dist/generated/ToolLimitsConfig.d.ts +0 -10
  234. /package/dist/generated/{ToolLimitsConfig.js → BindingLimitsConfig.js} +0 -0
@@ -784,15 +784,31 @@ export function writeMountPluginDescriptor(bc, x) {
784
784
  export function readMountDescriptor(bc) {
785
785
  return {
786
786
  guestPath: bare.readString(bc),
787
+ guestSource: bare.readString(bc),
788
+ guestFstype: bare.readString(bc),
787
789
  readOnly: bare.readBool(bc),
788
790
  plugin: readMountPluginDescriptor(bc),
789
791
  };
790
792
  }
791
793
  export function writeMountDescriptor(bc, x) {
792
794
  bare.writeString(bc, x.guestPath);
795
+ bare.writeString(bc, x.guestSource);
796
+ bare.writeString(bc, x.guestFstype);
793
797
  bare.writeBool(bc, x.readOnly);
794
798
  writeMountPluginDescriptor(bc, x.plugin);
795
799
  }
800
+ export function readMountInfo(bc) {
801
+ return {
802
+ path: bare.readString(bc),
803
+ kind: bare.readString(bc),
804
+ readOnly: bare.readBool(bc),
805
+ };
806
+ }
807
+ export function writeMountInfo(bc, x) {
808
+ bare.writeString(bc, x.path);
809
+ bare.writeString(bc, x.kind);
810
+ bare.writeBool(bc, x.readOnly);
811
+ }
796
812
  export function readSoftwareDescriptor(bc) {
797
813
  return {
798
814
  packageName: bare.readString(bc),
@@ -1086,7 +1102,7 @@ export function readConfigureVmRequest(bc) {
1086
1102
  packages: read20(bc),
1087
1103
  packagesMountAt: bare.readString(bc),
1088
1104
  bootstrapCommands: read6(bc),
1089
- toolShimCommands: read6(bc),
1105
+ bindingShimCommands: read6(bc),
1090
1106
  };
1091
1107
  }
1092
1108
  export function writeConfigureVmRequest(bc, x) {
@@ -1101,7 +1117,7 @@ export function writeConfigureVmRequest(bc, x) {
1101
1117
  write20(bc, x.packages);
1102
1118
  bare.writeString(bc, x.packagesMountAt);
1103
1119
  write6(bc, x.bootstrapCommands);
1104
- write6(bc, x.toolShimCommands);
1120
+ write6(bc, x.bindingShimCommands);
1105
1121
  }
1106
1122
  export function readRegisteredHostCallbackExample(bc) {
1107
1123
  return {
@@ -1466,6 +1482,14 @@ export function writeGuestKernelCallRequest(bc, x) {
1466
1482
  bare.writeString(bc, x.operation);
1467
1483
  bare.writeData(bc, x.payload);
1468
1484
  }
1485
+ export function readSnapshotRootFilesystemRequest(bc) {
1486
+ return {
1487
+ maxBytes: bare.readU64(bc),
1488
+ };
1489
+ }
1490
+ export function writeSnapshotRootFilesystemRequest(bc, x) {
1491
+ bare.writeU64(bc, x.maxBytes);
1492
+ }
1469
1493
  function read24(bc) {
1470
1494
  return bare.readBool(bc) ? readGuestRuntimeKind(bc) : null;
1471
1495
  }
@@ -1728,7 +1752,7 @@ export function readRequestPayload(bc) {
1728
1752
  case 12:
1729
1753
  return { tag: "GuestFilesystemCallRequest", val: readGuestFilesystemCallRequest(bc) };
1730
1754
  case 13:
1731
- return { tag: "SnapshotRootFilesystemRequest", val: null };
1755
+ return { tag: "SnapshotRootFilesystemRequest", val: readSnapshotRootFilesystemRequest(bc) };
1732
1756
  case 14:
1733
1757
  return { tag: "ExecuteRequest", val: readExecuteRequest(bc) };
1734
1758
  case 15:
@@ -1767,6 +1791,8 @@ export function readRequestPayload(bc) {
1767
1791
  return { tag: "LinkPackageRequest", val: readLinkPackageRequest(bc) };
1768
1792
  case 32:
1769
1793
  return { tag: "ProvidedCommandsRequest", val: null };
1794
+ case 33:
1795
+ return { tag: "ListMountsRequest", val: null };
1770
1796
  default: {
1771
1797
  bc.offset = offset;
1772
1798
  throw new bare.BareError(offset, "invalid tag");
@@ -1841,6 +1867,7 @@ export function writeRequestPayload(bc, x) {
1841
1867
  }
1842
1868
  case "SnapshotRootFilesystemRequest": {
1843
1869
  bare.writeU8(bc, 13);
1870
+ writeSnapshotRootFilesystemRequest(bc, x.val);
1844
1871
  break;
1845
1872
  }
1846
1873
  case "ExecuteRequest": {
@@ -1934,6 +1961,10 @@ export function writeRequestPayload(bc, x) {
1934
1961
  bare.writeU8(bc, 32);
1935
1962
  break;
1936
1963
  }
1964
+ case "ListMountsRequest": {
1965
+ bare.writeU8(bc, 33);
1966
+ break;
1967
+ }
1937
1968
  }
1938
1969
  }
1939
1970
  export function readRequestFrame(bc) {
@@ -2196,6 +2227,31 @@ export function readRootFilesystemSnapshotResponse(bc) {
2196
2227
  export function writeRootFilesystemSnapshotResponse(bc, x) {
2197
2228
  write4(bc, x.entries);
2198
2229
  }
2230
+ function read31(bc) {
2231
+ const len = bare.readUintSafe(bc);
2232
+ if (len === 0) {
2233
+ return [];
2234
+ }
2235
+ const result = [readMountInfo(bc)];
2236
+ for (let i = 1; i < len; i++) {
2237
+ result[i] = readMountInfo(bc);
2238
+ }
2239
+ return result;
2240
+ }
2241
+ function write31(bc, x) {
2242
+ bare.writeUintSafe(bc, x.length);
2243
+ for (let i = 0; i < x.length; i++) {
2244
+ writeMountInfo(bc, x[i]);
2245
+ }
2246
+ }
2247
+ export function readListMountsResponse(bc) {
2248
+ return {
2249
+ mounts: read31(bc),
2250
+ };
2251
+ }
2252
+ export function writeListMountsResponse(bc, x) {
2253
+ write31(bc, x.mounts);
2254
+ }
2199
2255
  export function readProcessStartedResponse(bc) {
2200
2256
  return {
2201
2257
  processId: bare.readString(bc),
@@ -2282,10 +2338,10 @@ export function writeProcessSnapshotStatus(bc, x) {
2282
2338
  }
2283
2339
  }
2284
2340
  }
2285
- function read31(bc) {
2341
+ function read32(bc) {
2286
2342
  return bare.readBool(bc) ? bare.readI32(bc) : null;
2287
2343
  }
2288
- function write31(bc, x) {
2344
+ function write32(bc, x) {
2289
2345
  bare.writeBool(bc, x != null);
2290
2346
  if (x != null) {
2291
2347
  bare.writeI32(bc, x);
@@ -2303,7 +2359,7 @@ export function readProcessSnapshotEntry(bc) {
2303
2359
  args: read6(bc),
2304
2360
  cwd: bare.readString(bc),
2305
2361
  status: readProcessSnapshotStatus(bc),
2306
- exitCode: read31(bc),
2362
+ exitCode: read32(bc),
2307
2363
  };
2308
2364
  }
2309
2365
  export function writeProcessSnapshotEntry(bc, x) {
@@ -2317,9 +2373,9 @@ export function writeProcessSnapshotEntry(bc, x) {
2317
2373
  write6(bc, x.args);
2318
2374
  bare.writeString(bc, x.cwd);
2319
2375
  writeProcessSnapshotStatus(bc, x.status);
2320
- write31(bc, x.exitCode);
2376
+ write32(bc, x.exitCode);
2321
2377
  }
2322
- function read32(bc) {
2378
+ function read33(bc) {
2323
2379
  const len = bare.readUintSafe(bc);
2324
2380
  if (len === 0) {
2325
2381
  return [];
@@ -2330,7 +2386,7 @@ function read32(bc) {
2330
2386
  }
2331
2387
  return result;
2332
2388
  }
2333
- function write32(bc, x) {
2389
+ function write33(bc, x) {
2334
2390
  bare.writeUintSafe(bc, x.length);
2335
2391
  for (let i = 0; i < x.length; i++) {
2336
2392
  writeProcessSnapshotEntry(bc, x[i]);
@@ -2338,11 +2394,11 @@ function write32(bc, x) {
2338
2394
  }
2339
2395
  export function readProcessSnapshotResponse(bc) {
2340
2396
  return {
2341
- processes: read32(bc),
2397
+ processes: read33(bc),
2342
2398
  };
2343
2399
  }
2344
2400
  export function writeProcessSnapshotResponse(bc, x) {
2345
- write32(bc, x.processes);
2401
+ write33(bc, x.processes);
2346
2402
  }
2347
2403
  export function readQueueSnapshotEntry(bc) {
2348
2404
  return {
@@ -2362,7 +2418,7 @@ export function writeQueueSnapshotEntry(bc, x) {
2362
2418
  bare.writeU64(bc, x.capacity);
2363
2419
  bare.writeU64(bc, x.fillPercent);
2364
2420
  }
2365
- function read33(bc) {
2421
+ function read34(bc) {
2366
2422
  const len = bare.readUintSafe(bc);
2367
2423
  if (len === 0) {
2368
2424
  return [];
@@ -2373,7 +2429,7 @@ function read33(bc) {
2373
2429
  }
2374
2430
  return result;
2375
2431
  }
2376
- function write33(bc, x) {
2432
+ function write34(bc, x) {
2377
2433
  bare.writeUintSafe(bc, x.length);
2378
2434
  for (let i = 0; i < x.length; i++) {
2379
2435
  writeQueueSnapshotEntry(bc, x[i]);
@@ -2395,7 +2451,7 @@ export function readResourceSnapshotResponse(bc) {
2395
2451
  socketConnections: bare.readU64(bc),
2396
2452
  socketBufferedBytes: bare.readU64(bc),
2397
2453
  socketDatagramQueueLen: bare.readU64(bc),
2398
- queueSnapshots: read33(bc),
2454
+ queueSnapshots: read34(bc),
2399
2455
  };
2400
2456
  }
2401
2457
  export function writeResourceSnapshotResponse(bc, x) {
@@ -2413,7 +2469,7 @@ export function writeResourceSnapshotResponse(bc, x) {
2413
2469
  bare.writeU64(bc, x.socketConnections);
2414
2470
  bare.writeU64(bc, x.socketBufferedBytes);
2415
2471
  bare.writeU64(bc, x.socketDatagramQueueLen);
2416
- write33(bc, x.queueSnapshots);
2472
+ write34(bc, x.queueSnapshots);
2417
2473
  }
2418
2474
  export function readSocketStateEntry(bc) {
2419
2475
  return {
@@ -2429,10 +2485,10 @@ export function writeSocketStateEntry(bc, x) {
2429
2485
  write26(bc, x.port);
2430
2486
  write0(bc, x.path);
2431
2487
  }
2432
- function read34(bc) {
2488
+ function read35(bc) {
2433
2489
  return bare.readBool(bc) ? readSocketStateEntry(bc) : null;
2434
2490
  }
2435
- function write34(bc, x) {
2491
+ function write35(bc, x) {
2436
2492
  bare.writeBool(bc, x != null);
2437
2493
  if (x != null) {
2438
2494
  writeSocketStateEntry(bc, x);
@@ -2440,19 +2496,19 @@ function write34(bc, x) {
2440
2496
  }
2441
2497
  export function readListenerSnapshotResponse(bc) {
2442
2498
  return {
2443
- listener: read34(bc),
2499
+ listener: read35(bc),
2444
2500
  };
2445
2501
  }
2446
2502
  export function writeListenerSnapshotResponse(bc, x) {
2447
- write34(bc, x.listener);
2503
+ write35(bc, x.listener);
2448
2504
  }
2449
2505
  export function readBoundUdpSnapshotResponse(bc) {
2450
2506
  return {
2451
- socket: read34(bc),
2507
+ socket: read35(bc),
2452
2508
  };
2453
2509
  }
2454
2510
  export function writeBoundUdpSnapshotResponse(bc, x) {
2455
- write34(bc, x.socket);
2511
+ write35(bc, x.socket);
2456
2512
  }
2457
2513
  export var SignalDispositionAction;
2458
2514
  (function (SignalDispositionAction) {
@@ -2504,7 +2560,7 @@ export function writeSignalHandlerRegistration(bc, x) {
2504
2560
  bare.writeU32Array(bc, x.mask);
2505
2561
  bare.writeU32(bc, x.flags);
2506
2562
  }
2507
- function read35(bc) {
2563
+ function read36(bc) {
2508
2564
  const len = bare.readUintSafe(bc);
2509
2565
  const result = new Map();
2510
2566
  for (let i = 0; i < len; i++) {
@@ -2518,7 +2574,7 @@ function read35(bc) {
2518
2574
  }
2519
2575
  return result;
2520
2576
  }
2521
- function write35(bc, x) {
2577
+ function write36(bc, x) {
2522
2578
  bare.writeUintSafe(bc, x.size);
2523
2579
  for (const kv of x) {
2524
2580
  bare.writeU32(bc, kv[0]);
@@ -2528,12 +2584,12 @@ function write35(bc, x) {
2528
2584
  export function readSignalStateResponse(bc) {
2529
2585
  return {
2530
2586
  processId: bare.readString(bc),
2531
- handlers: read35(bc),
2587
+ handlers: read36(bc),
2532
2588
  };
2533
2589
  }
2534
2590
  export function writeSignalStateResponse(bc, x) {
2535
2591
  bare.writeString(bc, x.processId);
2536
- write35(bc, x.handlers);
2592
+ write36(bc, x.handlers);
2537
2593
  }
2538
2594
  export function readZombieTimerCountResponse(bc) {
2539
2595
  return {
@@ -2591,11 +2647,37 @@ export function readRejectedResponse(bc) {
2591
2647
  return {
2592
2648
  code: bare.readString(bc),
2593
2649
  message: bare.readString(bc),
2650
+ limitName: read0(bc),
2651
+ configuredLimit: read21(bc),
2652
+ currentUsage: read21(bc),
2653
+ requested: read21(bc),
2654
+ unit: read0(bc),
2655
+ scope: read0(bc),
2656
+ vmId: read0(bc),
2657
+ sessionGeneration: read21(bc),
2658
+ capabilityId: read21(bc),
2659
+ operation: read0(bc),
2660
+ configurationPath: read0(bc),
2661
+ retryable: read30(bc),
2662
+ errno: read0(bc),
2594
2663
  };
2595
2664
  }
2596
2665
  export function writeRejectedResponse(bc, x) {
2597
2666
  bare.writeString(bc, x.code);
2598
2667
  bare.writeString(bc, x.message);
2668
+ write0(bc, x.limitName);
2669
+ write21(bc, x.configuredLimit);
2670
+ write21(bc, x.currentUsage);
2671
+ write21(bc, x.requested);
2672
+ write0(bc, x.unit);
2673
+ write0(bc, x.scope);
2674
+ write0(bc, x.vmId);
2675
+ write21(bc, x.sessionGeneration);
2676
+ write21(bc, x.capabilityId);
2677
+ write0(bc, x.operation);
2678
+ write0(bc, x.configurationPath);
2679
+ write30(bc, x.retryable);
2680
+ write0(bc, x.errno);
2599
2681
  }
2600
2682
  export function readVmFetchResponse(bc) {
2601
2683
  return {
@@ -2679,6 +2761,8 @@ export function readResponsePayload(bc) {
2679
2761
  return { tag: "PackageLinkedResponse", val: readPackageLinkedResponse(bc) };
2680
2762
  case 34:
2681
2763
  return { tag: "ProvidedCommandsResponse", val: readProvidedCommandsResponse(bc) };
2764
+ case 35:
2765
+ return { tag: "ListMountsResponse", val: readListMountsResponse(bc) };
2682
2766
  default: {
2683
2767
  bc.offset = offset;
2684
2768
  throw new bare.BareError(offset, "invalid tag");
@@ -2862,6 +2946,11 @@ export function writeResponsePayload(bc, x) {
2862
2946
  writeProvidedCommandsResponse(bc, x.val);
2863
2947
  break;
2864
2948
  }
2949
+ case "ListMountsResponse": {
2950
+ bare.writeU8(bc, 35);
2951
+ writeListMountsResponse(bc, x.val);
2952
+ break;
2953
+ }
2865
2954
  }
2866
2955
  }
2867
2956
  export function readResponseFrame(bc) {
@@ -3139,10 +3228,10 @@ export function writeSidecarRequestFrame(bc, x) {
3139
3228
  writeOwnershipScope(bc, x.ownership);
3140
3229
  writeSidecarRequestPayload(bc, x.payload);
3141
3230
  }
3142
- function read36(bc) {
3231
+ function read37(bc) {
3143
3232
  return bare.readBool(bc) ? readJsonUtf8(bc) : null;
3144
3233
  }
3145
- function write36(bc, x) {
3234
+ function write37(bc, x) {
3146
3235
  bare.writeBool(bc, x != null);
3147
3236
  if (x != null) {
3148
3237
  writeJsonUtf8(bc, x);
@@ -3151,25 +3240,25 @@ function write36(bc, x) {
3151
3240
  export function readHostCallbackResultResponse(bc) {
3152
3241
  return {
3153
3242
  invocationId: bare.readString(bc),
3154
- result: read36(bc),
3243
+ result: read37(bc),
3155
3244
  error: read0(bc),
3156
3245
  };
3157
3246
  }
3158
3247
  export function writeHostCallbackResultResponse(bc, x) {
3159
3248
  bare.writeString(bc, x.invocationId);
3160
- write36(bc, x.result);
3249
+ write37(bc, x.result);
3161
3250
  write0(bc, x.error);
3162
3251
  }
3163
3252
  export function readJsBridgeResultResponse(bc) {
3164
3253
  return {
3165
3254
  callId: bare.readString(bc),
3166
- result: read36(bc),
3255
+ result: read37(bc),
3167
3256
  error: read0(bc),
3168
3257
  };
3169
3258
  }
3170
3259
  export function writeJsBridgeResultResponse(bc, x) {
3171
3260
  bare.writeString(bc, x.callId);
3172
- write36(bc, x.result);
3261
+ write37(bc, x.result);
3173
3262
  write0(bc, x.error);
3174
3263
  }
3175
3264
  export function readSidecarResponsePayload(bc) {
@@ -3221,6 +3310,45 @@ export function writeSidecarResponseFrame(bc, x) {
3221
3310
  writeOwnershipScope(bc, x.ownership);
3222
3311
  writeSidecarResponsePayload(bc, x.payload);
3223
3312
  }
3313
+ export function readShutdownControl(bc) {
3314
+ return {
3315
+ reason: bare.readString(bc),
3316
+ };
3317
+ }
3318
+ export function writeShutdownControl(bc, x) {
3319
+ bare.writeString(bc, x.reason);
3320
+ }
3321
+ export function readControlPayload(bc) {
3322
+ const offset = bc.offset;
3323
+ const tag = bare.readU8(bc);
3324
+ switch (tag) {
3325
+ case 0:
3326
+ return { tag: "ShutdownControl", val: readShutdownControl(bc) };
3327
+ default: {
3328
+ bc.offset = offset;
3329
+ throw new bare.BareError(offset, "invalid tag");
3330
+ }
3331
+ }
3332
+ }
3333
+ export function writeControlPayload(bc, x) {
3334
+ switch (x.tag) {
3335
+ case "ShutdownControl": {
3336
+ bare.writeU8(bc, 0);
3337
+ writeShutdownControl(bc, x.val);
3338
+ break;
3339
+ }
3340
+ }
3341
+ }
3342
+ export function readControlFrame(bc) {
3343
+ return {
3344
+ schema: readProtocolSchema(bc),
3345
+ payload: readControlPayload(bc),
3346
+ };
3347
+ }
3348
+ export function writeControlFrame(bc, x) {
3349
+ writeProtocolSchema(bc, x.schema);
3350
+ writeControlPayload(bc, x.payload);
3351
+ }
3224
3352
  export function readProtocolFrame(bc) {
3225
3353
  const offset = bc.offset;
3226
3354
  const tag = bare.readU8(bc);
@@ -3235,6 +3363,8 @@ export function readProtocolFrame(bc) {
3235
3363
  return { tag: "SidecarRequestFrame", val: readSidecarRequestFrame(bc) };
3236
3364
  case 4:
3237
3365
  return { tag: "SidecarResponseFrame", val: readSidecarResponseFrame(bc) };
3366
+ case 5:
3367
+ return { tag: "ControlFrame", val: readControlFrame(bc) };
3238
3368
  default: {
3239
3369
  bc.offset = offset;
3240
3370
  throw new bare.BareError(offset, "invalid tag");
@@ -3268,6 +3398,11 @@ export function writeProtocolFrame(bc, x) {
3268
3398
  writeSidecarResponseFrame(bc, x.val);
3269
3399
  break;
3270
3400
  }
3401
+ case "ControlFrame": {
3402
+ bare.writeU8(bc, 5);
3403
+ writeControlFrame(bc, x.val);
3404
+ break;
3405
+ }
3271
3406
  }
3272
3407
  }
3273
3408
  export function encodeProtocolFrame(x, config) {
@@ -4,11 +4,15 @@ import type { AuthenticatedSession, CreatedVm, SidecarProcess, SidecarMountDescr
4
4
  export interface PlainMountConfig {
5
5
  path: string;
6
6
  driver: VirtualFileSystem;
7
+ guestSource?: string;
8
+ guestFstype?: string;
7
9
  readOnly?: boolean;
8
10
  }
9
11
  export interface NativeMountConfig {
10
12
  path: string;
11
13
  plugin: NativeMountPluginDescriptor;
14
+ guestSource?: string;
15
+ guestFstype?: string;
12
16
  readOnly?: boolean;
13
17
  }
14
18
  export declare function serializeMountConfigForSidecar(mount: PlainMountConfig | NativeMountConfig): SidecarMountDescriptor;
@@ -4,6 +4,8 @@ export function serializeMountConfigForSidecar(mount) {
4
4
  if ("driver" in mount) {
5
5
  return {
6
6
  guestPath: mount.path,
7
+ guestSource: mount.guestSource ?? "js_bridge",
8
+ guestFstype: mount.guestFstype ?? "js_bridge",
7
9
  readOnly: mount.readOnly ?? false,
8
10
  plugin: {
9
11
  id: "js_bridge",
@@ -13,6 +15,8 @@ export function serializeMountConfigForSidecar(mount) {
13
15
  }
14
16
  return {
15
17
  guestPath: mount.path,
18
+ guestSource: mount.guestSource ?? mount.plugin.id,
19
+ guestFstype: mount.guestFstype ?? mount.plugin.id,
16
20
  readOnly: mount.readOnly ?? false,
17
21
  plugin: {
18
22
  id: mount.plugin.id,
@@ -70,6 +74,15 @@ const PREFERRED_SIGNAL_NAMES = [
70
74
  "SIGEMT",
71
75
  "SIGINFO",
72
76
  ];
77
+ const NON_TERMINATING_SIGNALS = new Set([
78
+ "0",
79
+ "SIGCHLD",
80
+ "SIGCONT",
81
+ "SIGSTOP",
82
+ "SIGURG",
83
+ "SIGWINCH",
84
+ ]);
85
+ const LOCALLY_TERMINATING_SIGNALS = new Set(["SIGKILL", "SIGTERM"]);
73
86
  const NON_CANONICAL_SIGNAL_NAMES = new Set([
74
87
  "SIGCLD",
75
88
  "SIGIOT",
@@ -262,7 +275,10 @@ export class NativeSidecarKernelProxy {
262
275
  this.eventPumpAbortController.abort();
263
276
  const liveProcesses = [...this.trackedProcesses.values()].filter((entry) => entry.exitCode === null);
264
277
  await Promise.allSettled(liveProcesses.map((entry) => this.signalProcess(entry, 15)));
265
- await this.client.disposeVm(this.session, this.vm).catch(() => { });
278
+ await Promise.race([
279
+ this.client.disposeVm(this.session, this.vm),
280
+ new Promise((resolve) => setTimeout(resolve, 1000)),
281
+ ]).catch(() => { });
266
282
  for (const entry of liveProcesses) {
267
283
  if (entry.exitCode === null) {
268
284
  // The sidecar dispose path already performs TERM/KILL escalation for any
@@ -477,14 +493,22 @@ export class NativeSidecarKernelProxy {
477
493
  return;
478
494
  }
479
495
  entry.pendingKillSignal = signal;
480
- void entry.startPromise.then(async () => {
481
- if (entry.exitCode !== null || entry.pendingKillSignal === null) {
496
+ void entry.startPromise
497
+ .then(async () => {
498
+ if (entry.pendingKillSignal === null) {
482
499
  return;
483
500
  }
484
501
  const pendingSignal = entry.pendingKillSignal;
485
502
  entry.pendingKillSignal = null;
486
503
  await this.signalProcess(entry, pendingSignal);
504
+ })
505
+ .catch((error) => {
506
+ this.handleBackgroundProcessError(entry, error);
487
507
  });
508
+ if ((signal === 9 || signal === 15) &&
509
+ entry.exitCode === null) {
510
+ this.finishProcess(entry, 128 + signal);
511
+ }
488
512
  },
489
513
  wait: async () => {
490
514
  const exitCode = await this.waitForTrackedProcess(entry);
@@ -1127,15 +1151,6 @@ export class NativeSidecarKernelProxy {
1127
1151
  if (entry.onStdout.size === 0 && entry.onStderr.size === 0) {
1128
1152
  return;
1129
1153
  }
1130
- if (entry.exitViaEvent) {
1131
- // The sidecar drains process output before it emits `process_exited`,
1132
- // the stdio frame stream is FIFO, and this pump dispatches events in
1133
- // order. Once the exit event reaches this entry, no trailing output can
1134
- // follow it; one zero-delay turn is cheap insurance for same-tick
1135
- // listener scheduling.
1136
- await drainTrailingProcessOutputTurn(0);
1137
- return;
1138
- }
1139
1154
  let observedGeneration = entry.outputGeneration;
1140
1155
  let quietTurns = 0;
1141
1156
  let delayMs = 0;
@@ -1306,9 +1321,27 @@ export class NativeSidecarKernelProxy {
1306
1321
  return entry.waitWithFallbackPromise;
1307
1322
  }
1308
1323
  async signalProcess(entry, signal) {
1309
- await this.signalRefreshes.get(entry.pid);
1324
+ const sidecarSignal = toSidecarSignalName(signal);
1325
+ let timedOut = false;
1326
+ const killPromise = this.client.killProcess(this.session, this.vm, entry.processId, sidecarSignal);
1310
1327
  try {
1311
- await this.client.killProcess(this.session, this.vm, entry.processId, toSidecarSignalName(signal));
1328
+ await Promise.race([
1329
+ killPromise,
1330
+ new Promise((resolve) => setTimeout(() => {
1331
+ timedOut = true;
1332
+ resolve();
1333
+ }, 1000)),
1334
+ ]);
1335
+ if (timedOut) {
1336
+ void killPromise.catch(() => { });
1337
+ }
1338
+ const hasGuestHandler = this.signalStates.get(entry.pid)?.handlers.has(signal) ?? false;
1339
+ if (entry.exitCode === null &&
1340
+ !hasGuestHandler &&
1341
+ LOCALLY_TERMINATING_SIGNALS.has(sidecarSignal) &&
1342
+ (entry.driver === "wasmvm" || timedOut)) {
1343
+ this.finishProcess(entry, 128 + signal);
1344
+ }
1312
1345
  }
1313
1346
  catch (error) {
1314
1347
  if (isNoSuchProcessError(error) || isUnknownVmError(error)) {
@@ -1523,12 +1556,12 @@ export class NativeSidecarKernelProxy {
1523
1556
  return this.client.pread(this.session, this.vm, path, offset, length);
1524
1557
  },
1525
1558
  pwrite: async (path, offset, data) => {
1526
- const bytes = await this.createFilesystemView(includeLocalMounts).readFile(path);
1527
- const nextSize = Math.max(bytes.length, offset + data.length);
1528
- const updated = new Uint8Array(nextSize);
1529
- updated.set(bytes);
1530
- updated.set(data, offset);
1531
- await this.createFilesystemView(includeLocalMounts).writeFile(path, updated);
1559
+ const local = includeLocalMounts ? this.resolveLocalMount(path) : null;
1560
+ if (local) {
1561
+ this.assertLocalWritable(local.mount);
1562
+ return local.mount.fs.pwrite(local.relativePath, offset, data);
1563
+ }
1564
+ return this.client.pwrite(this.session, this.vm, path, offset, data);
1532
1565
  },
1533
1566
  };
1534
1567
  }
@@ -1,9 +1,9 @@
1
+ import type { LiveSidecarEventSelector } from "./event-buffer.js";
2
+ import type { LiveOwnershipScope } from "./ownership.js";
1
3
  import { StdioSidecarProcess } from "./process.js";
2
- import type { SidecarProcessTransport } from "./sidecar-client.js";
3
4
  import type { LiveEventFrame, LiveResponseFrame, LiveSidecarRequestHandler, ProtocolFramePayloadCodec } from "./protocol-frames.js";
4
- import type { LiveOwnershipScope } from "./ownership.js";
5
5
  import type { LiveRequestPayload } from "./request-payloads.js";
6
- import type { LiveSidecarEventSelector } from "./event-buffer.js";
6
+ import type { SidecarProcessTransport } from "./sidecar-client.js";
7
7
  export declare const DEFAULT_SIDECAR_EVENT_BUFFER_CAPACITY = 4096;
8
8
  export declare const DEFAULT_SIDECAR_GRACEFUL_EXIT_MS = 5000;
9
9
  export declare const DEFAULT_SIDECAR_FORCE_EXIT_MS = 2000;