@rivet-dev/agentos-runtime-core 0.0.0-chdir-fix.3d9feab

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 (282) hide show
  1. package/README.md +7 -0
  2. package/commands/[ +0 -0
  3. package/commands/_stubs +0 -0
  4. package/commands/arch +0 -0
  5. package/commands/awk +0 -0
  6. package/commands/b2sum +0 -0
  7. package/commands/base32 +0 -0
  8. package/commands/base64 +0 -0
  9. package/commands/basename +0 -0
  10. package/commands/basenc +0 -0
  11. package/commands/bash +0 -0
  12. package/commands/cat +0 -0
  13. package/commands/chcon +0 -0
  14. package/commands/chgrp +0 -0
  15. package/commands/chmod +0 -0
  16. package/commands/chown +0 -0
  17. package/commands/chroot +0 -0
  18. package/commands/cksum +0 -0
  19. package/commands/codex +0 -0
  20. package/commands/codex-exec +0 -0
  21. package/commands/column +0 -0
  22. package/commands/comm +0 -0
  23. package/commands/cp +0 -0
  24. package/commands/curl +0 -0
  25. package/commands/cut +0 -0
  26. package/commands/date +0 -0
  27. package/commands/dd +0 -0
  28. package/commands/df +0 -0
  29. package/commands/diff +0 -0
  30. package/commands/dir +0 -0
  31. package/commands/dircolors +0 -0
  32. package/commands/dirname +0 -0
  33. package/commands/du +0 -0
  34. package/commands/echo +0 -0
  35. package/commands/egrep +0 -0
  36. package/commands/env +0 -0
  37. package/commands/envsubst +0 -0
  38. package/commands/expand +0 -0
  39. package/commands/expr +0 -0
  40. package/commands/factor +0 -0
  41. package/commands/false +0 -0
  42. package/commands/fd +0 -0
  43. package/commands/fgrep +0 -0
  44. package/commands/file +0 -0
  45. package/commands/find +0 -0
  46. package/commands/fmt +0 -0
  47. package/commands/fold +0 -0
  48. package/commands/git +0 -0
  49. package/commands/git-remote-http +0 -0
  50. package/commands/git-remote-https +0 -0
  51. package/commands/grep +0 -0
  52. package/commands/groups +0 -0
  53. package/commands/gunzip +0 -0
  54. package/commands/gzip +0 -0
  55. package/commands/head +0 -0
  56. package/commands/hostid +0 -0
  57. package/commands/hostname +0 -0
  58. package/commands/http-test +0 -0
  59. package/commands/http_get +0 -0
  60. package/commands/id +0 -0
  61. package/commands/install +0 -0
  62. package/commands/join +0 -0
  63. package/commands/jq +0 -0
  64. package/commands/kill +0 -0
  65. package/commands/link +0 -0
  66. package/commands/ln +0 -0
  67. package/commands/logname +0 -0
  68. package/commands/ls +0 -0
  69. package/commands/md5sum +0 -0
  70. package/commands/mkdir +0 -0
  71. package/commands/mkfifo +0 -0
  72. package/commands/mknod +0 -0
  73. package/commands/mktemp +0 -0
  74. package/commands/more +0 -0
  75. package/commands/mv +0 -0
  76. package/commands/nice +0 -0
  77. package/commands/nl +0 -0
  78. package/commands/nohup +0 -0
  79. package/commands/nproc +0 -0
  80. package/commands/numfmt +0 -0
  81. package/commands/od +0 -0
  82. package/commands/paste +0 -0
  83. package/commands/pathchk +0 -0
  84. package/commands/pinky +0 -0
  85. package/commands/printenv +0 -0
  86. package/commands/printf +0 -0
  87. package/commands/ptx +0 -0
  88. package/commands/pwd +0 -0
  89. package/commands/readlink +0 -0
  90. package/commands/realpath +0 -0
  91. package/commands/rev +0 -0
  92. package/commands/rg +0 -0
  93. package/commands/rm +0 -0
  94. package/commands/rmdir +0 -0
  95. package/commands/runcon +0 -0
  96. package/commands/sed +0 -0
  97. package/commands/seq +0 -0
  98. package/commands/sh +0 -0
  99. package/commands/sha1sum +0 -0
  100. package/commands/sha224sum +0 -0
  101. package/commands/sha256sum +0 -0
  102. package/commands/sha384sum +0 -0
  103. package/commands/sha512sum +0 -0
  104. package/commands/shred +0 -0
  105. package/commands/shuf +0 -0
  106. package/commands/sleep +0 -0
  107. package/commands/sort +0 -0
  108. package/commands/spawn-test-host +0 -0
  109. package/commands/split +0 -0
  110. package/commands/sqlite3 +0 -0
  111. package/commands/stat +0 -0
  112. package/commands/stdbuf +0 -0
  113. package/commands/strings +0 -0
  114. package/commands/stty +0 -0
  115. package/commands/sum +0 -0
  116. package/commands/sync +0 -0
  117. package/commands/tac +0 -0
  118. package/commands/tail +0 -0
  119. package/commands/tar +0 -0
  120. package/commands/tee +0 -0
  121. package/commands/test +0 -0
  122. package/commands/timeout +0 -0
  123. package/commands/touch +0 -0
  124. package/commands/tr +0 -0
  125. package/commands/tree +0 -0
  126. package/commands/true +0 -0
  127. package/commands/truncate +0 -0
  128. package/commands/tsort +0 -0
  129. package/commands/tty +0 -0
  130. package/commands/uname +0 -0
  131. package/commands/unexpand +0 -0
  132. package/commands/uniq +0 -0
  133. package/commands/unlink +0 -0
  134. package/commands/unzip +0 -0
  135. package/commands/uptime +0 -0
  136. package/commands/users +0 -0
  137. package/commands/vdir +0 -0
  138. package/commands/wc +0 -0
  139. package/commands/which +0 -0
  140. package/commands/who +0 -0
  141. package/commands/whoami +0 -0
  142. package/commands/xargs +0 -0
  143. package/commands/xu +0 -0
  144. package/commands/yes +0 -0
  145. package/commands/yq +0 -0
  146. package/commands/zcat +0 -0
  147. package/commands/zip +0 -0
  148. package/dist/binary.d.ts +4 -0
  149. package/dist/binary.js +25 -0
  150. package/dist/bytes.d.ts +2 -0
  151. package/dist/bytes.js +6 -0
  152. package/dist/callbacks.d.ts +41 -0
  153. package/dist/callbacks.js +94 -0
  154. package/dist/cargo.d.ts +2 -0
  155. package/dist/cargo.js +142 -0
  156. package/dist/correlation.d.ts +7 -0
  157. package/dist/correlation.js +46 -0
  158. package/dist/descriptors.d.ts +84 -0
  159. package/dist/descriptors.js +60 -0
  160. package/dist/event-buffer.d.ts +90 -0
  161. package/dist/event-buffer.js +313 -0
  162. package/dist/ext.d.ts +7 -0
  163. package/dist/ext.js +13 -0
  164. package/dist/filesystem.d.ts +41 -0
  165. package/dist/filesystem.js +70 -0
  166. package/dist/frame-payload-codec.d.ts +8 -0
  167. package/dist/frame-payload-codec.js +14 -0
  168. package/dist/frame-rpc.d.ts +45 -0
  169. package/dist/frame-rpc.js +98 -0
  170. package/dist/frame-stream.d.ts +34 -0
  171. package/dist/frame-stream.js +109 -0
  172. package/dist/framing.d.ts +8 -0
  173. package/dist/framing.js +23 -0
  174. package/dist/generated/AcpLimitsConfig.d.ts +4 -0
  175. package/dist/generated/AcpLimitsConfig.js +2 -0
  176. package/dist/generated/CreateVmConfig.d.ts +26 -0
  177. package/dist/generated/CreateVmConfig.js +1 -0
  178. package/dist/generated/FsPermissionRule.d.ts +6 -0
  179. package/dist/generated/FsPermissionRule.js +1 -0
  180. package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
  181. package/dist/generated/FsPermissionRuleSet.js +1 -0
  182. package/dist/generated/FsPermissionScope.d.ts +3 -0
  183. package/dist/generated/FsPermissionScope.js +1 -0
  184. package/dist/generated/HttpLimitsConfig.d.ts +3 -0
  185. package/dist/generated/HttpLimitsConfig.js +2 -0
  186. package/dist/generated/JsModuleResolution.d.ts +1 -0
  187. package/dist/generated/JsModuleResolution.js +2 -0
  188. package/dist/generated/JsRuntimeConfig.d.ts +31 -0
  189. package/dist/generated/JsRuntimeConfig.js +1 -0
  190. package/dist/generated/JsRuntimeLimitsConfig.d.ts +11 -0
  191. package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
  192. package/dist/generated/JsRuntimePlatform.d.ts +1 -0
  193. package/dist/generated/JsRuntimePlatform.js +2 -0
  194. package/dist/generated/MountPluginDescriptor.d.ts +4 -0
  195. package/dist/generated/MountPluginDescriptor.js +2 -0
  196. package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
  197. package/dist/generated/NativeRootFilesystemConfig.js +1 -0
  198. package/dist/generated/PatternPermissionRule.d.ts +6 -0
  199. package/dist/generated/PatternPermissionRule.js +1 -0
  200. package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
  201. package/dist/generated/PatternPermissionRuleSet.js +1 -0
  202. package/dist/generated/PatternPermissionScope.d.ts +3 -0
  203. package/dist/generated/PatternPermissionScope.js +1 -0
  204. package/dist/generated/PermissionMode.d.ts +1 -0
  205. package/dist/generated/PermissionMode.js +2 -0
  206. package/dist/generated/PermissionsPolicy.d.ts +10 -0
  207. package/dist/generated/PermissionsPolicy.js +1 -0
  208. package/dist/generated/PluginLimitsConfig.d.ts +4 -0
  209. package/dist/generated/PluginLimitsConfig.js +2 -0
  210. package/dist/generated/PythonLimitsConfig.d.ts +6 -0
  211. package/dist/generated/PythonLimitsConfig.js +2 -0
  212. package/dist/generated/ResourceLimitsConfig.d.ts +24 -0
  213. package/dist/generated/ResourceLimitsConfig.js +2 -0
  214. package/dist/generated/RootFilesystemConfig.d.ts +9 -0
  215. package/dist/generated/RootFilesystemConfig.js +1 -0
  216. package/dist/generated/RootFilesystemEntry.d.ts +13 -0
  217. package/dist/generated/RootFilesystemEntry.js +1 -0
  218. package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
  219. package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
  220. package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
  221. package/dist/generated/RootFilesystemEntryKind.js +2 -0
  222. package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
  223. package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
  224. package/dist/generated/RootFilesystemMode.d.ts +1 -0
  225. package/dist/generated/RootFilesystemMode.js +2 -0
  226. package/dist/generated/ToolLimitsConfig.d.ts +10 -0
  227. package/dist/generated/ToolLimitsConfig.js +2 -0
  228. package/dist/generated/VmDnsConfig.d.ts +6 -0
  229. package/dist/generated/VmDnsConfig.js +2 -0
  230. package/dist/generated/VmLimitsConfig.d.ts +18 -0
  231. package/dist/generated/VmLimitsConfig.js +1 -0
  232. package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
  233. package/dist/generated/VmListenPolicyConfig.js +2 -0
  234. package/dist/generated/WasmLimitsConfig.d.ts +7 -0
  235. package/dist/generated/WasmLimitsConfig.js +2 -0
  236. package/dist/generated-protocol.d.ts +1196 -0
  237. package/dist/generated-protocol.js +3286 -0
  238. package/dist/index.d.ts +29 -0
  239. package/dist/index.js +28 -0
  240. package/dist/json.d.ts +2 -0
  241. package/dist/json.js +20 -0
  242. package/dist/kernel-proxy.d.ts +166 -0
  243. package/dist/kernel-proxy.js +1787 -0
  244. package/dist/native-client.d.ts +46 -0
  245. package/dist/native-client.js +136 -0
  246. package/dist/node-runtime-options-schema.d.ts +117 -0
  247. package/dist/node-runtime-options-schema.js +121 -0
  248. package/dist/node-runtime.d.ts +593 -0
  249. package/dist/node-runtime.js +914 -0
  250. package/dist/numbers.d.ts +1 -0
  251. package/dist/numbers.js +8 -0
  252. package/dist/ownership.d.ts +18 -0
  253. package/dist/ownership.js +77 -0
  254. package/dist/permissions.d.ts +29 -0
  255. package/dist/permissions.js +68 -0
  256. package/dist/process.d.ts +22 -0
  257. package/dist/process.js +97 -0
  258. package/dist/protocol-client.d.ts +65 -0
  259. package/dist/protocol-client.js +242 -0
  260. package/dist/protocol-frames.d.ts +68 -0
  261. package/dist/protocol-frames.js +139 -0
  262. package/dist/protocol-maps.d.ts +31 -0
  263. package/dist/protocol-maps.js +273 -0
  264. package/dist/protocol-schema.d.ts +10 -0
  265. package/dist/protocol-schema.js +11 -0
  266. package/dist/request-payloads.d.ts +171 -0
  267. package/dist/request-payloads.js +269 -0
  268. package/dist/response-payloads.d.ts +186 -0
  269. package/dist/response-payloads.js +250 -0
  270. package/dist/sidecar-client.d.ts +17 -0
  271. package/dist/sidecar-client.js +1 -0
  272. package/dist/sidecar-errors.d.ts +30 -0
  273. package/dist/sidecar-errors.js +47 -0
  274. package/dist/sidecar-process.d.ts +360 -0
  275. package/dist/sidecar-process.js +1007 -0
  276. package/dist/state.d.ts +40 -0
  277. package/dist/state.js +43 -0
  278. package/dist/test-runtime.d.ts +566 -0
  279. package/dist/test-runtime.js +2170 -0
  280. package/dist/vm-config.d.ts +31 -0
  281. package/dist/vm-config.js +1 -0
  282. package/package.json +204 -0
@@ -0,0 +1,250 @@
1
+ import { fromGeneratedRootFilesystemEntry, } from "./filesystem.js";
2
+ import { fromGeneratedExtEnvelope } from "./ext.js";
3
+ import { bigIntToSafeNumber } from "./numbers.js";
4
+ import { fromGeneratedFilesystemOperation, fromGeneratedGuestFilesystemOperation, fromGeneratedRootFilesystemEntryEncoding, fromGeneratedSignalDispositionAction, } from "./protocol-maps.js";
5
+ import { fromGeneratedGuestFilesystemStat, fromGeneratedProcessSnapshotEntry, fromGeneratedSocketStateEntry, } from "./state.js";
6
+ export function fromGeneratedResponsePayload(payload) {
7
+ switch (payload.tag) {
8
+ case "AuthenticatedResponse":
9
+ return {
10
+ type: "authenticated",
11
+ sidecar_id: payload.val.sidecarId,
12
+ connection_id: payload.val.connectionId,
13
+ max_frame_bytes: payload.val.maxFrameBytes,
14
+ };
15
+ case "SessionOpenedResponse":
16
+ return {
17
+ type: "session_opened",
18
+ session_id: payload.val.sessionId,
19
+ owner_connection_id: payload.val.ownerConnectionId,
20
+ };
21
+ case "VmCreatedResponse":
22
+ return { type: "vm_created", vm_id: payload.val.vmId };
23
+ case "VmDisposedResponse":
24
+ return { type: "vm_disposed", vm_id: payload.val.vmId };
25
+ case "RootFilesystemBootstrappedResponse":
26
+ return {
27
+ type: "root_filesystem_bootstrapped",
28
+ entry_count: payload.val.entryCount,
29
+ };
30
+ case "VmConfiguredResponse":
31
+ return {
32
+ type: "vm_configured",
33
+ applied_mounts: payload.val.appliedMounts,
34
+ applied_software: payload.val.appliedSoftware,
35
+ projected_commands: payload.val.projectedCommands.map((command) => ({
36
+ name: command.name,
37
+ guest_path: command.guestPath,
38
+ })),
39
+ agents: payload.val.agents.map(fromGeneratedAgentosProjectedAgent),
40
+ };
41
+ case "PackageLinkedResponse":
42
+ return {
43
+ type: "package_linked",
44
+ projected_commands: payload.val.projectedCommands.map((command) => ({
45
+ name: command.name,
46
+ guest_path: command.guestPath,
47
+ })),
48
+ agents: payload.val.agents.map(fromGeneratedAgentosProjectedAgent),
49
+ };
50
+ case "ProvidedCommandsResponse":
51
+ return {
52
+ type: "provided_commands_response",
53
+ packages: payload.val.packages.map((pkg) => ({
54
+ package_name: pkg.packageName,
55
+ commands: [...pkg.commands],
56
+ })),
57
+ };
58
+ case "HostCallbacksRegisteredResponse":
59
+ return {
60
+ type: "host_callbacks_registered",
61
+ registration: payload.val.registration,
62
+ command_count: payload.val.commandCount,
63
+ };
64
+ case "LayerCreatedResponse":
65
+ return { type: "layer_created", layer_id: payload.val.layerId };
66
+ case "LayerSealedResponse":
67
+ return { type: "layer_sealed", layer_id: payload.val.layerId };
68
+ case "SnapshotImportedResponse":
69
+ return { type: "snapshot_imported", layer_id: payload.val.layerId };
70
+ case "SnapshotExportedResponse":
71
+ return {
72
+ type: "snapshot_exported",
73
+ layer_id: payload.val.layerId,
74
+ entries: payload.val.entries.map(fromGeneratedRootFilesystemEntry),
75
+ };
76
+ case "OverlayCreatedResponse":
77
+ return { type: "overlay_created", layer_id: payload.val.layerId };
78
+ case "GuestFilesystemResultResponse":
79
+ return {
80
+ type: "guest_filesystem_result",
81
+ operation: fromGeneratedGuestFilesystemOperation(payload.val.operation),
82
+ path: payload.val.path,
83
+ ...(payload.val.content !== null
84
+ ? { content: payload.val.content }
85
+ : {}),
86
+ ...(payload.val.encoding !== null
87
+ ? {
88
+ encoding: fromGeneratedRootFilesystemEntryEncoding(payload.val.encoding),
89
+ }
90
+ : {}),
91
+ ...(payload.val.entries !== null
92
+ ? {
93
+ entries: payload.val.entries.map((entry) => ({
94
+ name: entry.name,
95
+ path: entry.path,
96
+ isDirectory: entry.isDirectory,
97
+ isSymbolicLink: entry.isSymbolicLink,
98
+ size: entry.size,
99
+ })),
100
+ }
101
+ : {}),
102
+ ...(payload.val.stat !== null
103
+ ? { stat: fromGeneratedGuestFilesystemStat(payload.val.stat) }
104
+ : {}),
105
+ ...(payload.val.exists !== null ? { exists: payload.val.exists } : {}),
106
+ ...(payload.val.target !== null ? { target: payload.val.target } : {}),
107
+ };
108
+ case "GuestKernelResultResponse":
109
+ return {
110
+ type: "guest_kernel_result",
111
+ payload: payload.val.payload,
112
+ };
113
+ case "RootFilesystemSnapshotResponse":
114
+ return {
115
+ type: "root_filesystem_snapshot",
116
+ entries: payload.val.entries.map(fromGeneratedRootFilesystemEntry),
117
+ };
118
+ case "ProcessStartedResponse":
119
+ return {
120
+ type: "process_started",
121
+ process_id: payload.val.processId,
122
+ ...(payload.val.pid !== null ? { pid: payload.val.pid } : {}),
123
+ };
124
+ case "StdinWrittenResponse":
125
+ return {
126
+ type: "stdin_written",
127
+ process_id: payload.val.processId,
128
+ accepted_bytes: bigIntToSafeNumber(payload.val.acceptedBytes, "stdin_written.accepted_bytes"),
129
+ };
130
+ case "PtyResizedResponse":
131
+ return {
132
+ type: "pty_resized",
133
+ process_id: payload.val.processId,
134
+ cols: payload.val.cols,
135
+ rows: payload.val.rows,
136
+ };
137
+ case "StdinClosedResponse":
138
+ return { type: "stdin_closed", process_id: payload.val.processId };
139
+ case "ProcessKilledResponse":
140
+ return { type: "process_killed", process_id: payload.val.processId };
141
+ case "ProcessSnapshotResponse":
142
+ return {
143
+ type: "process_snapshot",
144
+ processes: payload.val.processes.map(fromGeneratedProcessSnapshotEntry),
145
+ };
146
+ case "ResourceSnapshotResponse":
147
+ return {
148
+ type: "resource_snapshot",
149
+ running_processes: bigIntToSafeNumber(payload.val.runningProcesses, "resource_snapshot.running_processes"),
150
+ exited_processes: bigIntToSafeNumber(payload.val.exitedProcesses, "resource_snapshot.exited_processes"),
151
+ fd_tables: bigIntToSafeNumber(payload.val.fdTables, "resource_snapshot.fd_tables"),
152
+ open_fds: bigIntToSafeNumber(payload.val.openFds, "resource_snapshot.open_fds"),
153
+ pipes: bigIntToSafeNumber(payload.val.pipes, "resource_snapshot.pipes"),
154
+ pipe_buffered_bytes: bigIntToSafeNumber(payload.val.pipeBufferedBytes, "resource_snapshot.pipe_buffered_bytes"),
155
+ ptys: bigIntToSafeNumber(payload.val.ptys, "resource_snapshot.ptys"),
156
+ pty_buffered_input_bytes: bigIntToSafeNumber(payload.val.ptyBufferedInputBytes, "resource_snapshot.pty_buffered_input_bytes"),
157
+ pty_buffered_output_bytes: bigIntToSafeNumber(payload.val.ptyBufferedOutputBytes, "resource_snapshot.pty_buffered_output_bytes"),
158
+ sockets: bigIntToSafeNumber(payload.val.sockets, "resource_snapshot.sockets"),
159
+ socket_listeners: bigIntToSafeNumber(payload.val.socketListeners, "resource_snapshot.socket_listeners"),
160
+ socket_connections: bigIntToSafeNumber(payload.val.socketConnections, "resource_snapshot.socket_connections"),
161
+ socket_buffered_bytes: bigIntToSafeNumber(payload.val.socketBufferedBytes, "resource_snapshot.socket_buffered_bytes"),
162
+ socket_datagram_queue_len: bigIntToSafeNumber(payload.val.socketDatagramQueueLen, "resource_snapshot.socket_datagram_queue_len"),
163
+ queue_snapshots: payload.val.queueSnapshots.map((queue) => ({
164
+ name: queue.name,
165
+ category: queue.category,
166
+ depth: bigIntToSafeNumber(queue.depth, "resource_snapshot.queue.depth"),
167
+ high_water: bigIntToSafeNumber(queue.highWater, "resource_snapshot.queue.high_water"),
168
+ capacity: bigIntToSafeNumber(queue.capacity, "resource_snapshot.queue.capacity"),
169
+ fill_percent: bigIntToSafeNumber(queue.fillPercent, "resource_snapshot.queue.fill_percent"),
170
+ })),
171
+ };
172
+ case "ListenerSnapshotResponse":
173
+ return {
174
+ type: "listener_snapshot",
175
+ ...(payload.val.listener !== null
176
+ ? { listener: fromGeneratedSocketStateEntry(payload.val.listener) }
177
+ : {}),
178
+ };
179
+ case "BoundUdpSnapshotResponse":
180
+ return {
181
+ type: "bound_udp_snapshot",
182
+ ...(payload.val.socket !== null
183
+ ? { socket: fromGeneratedSocketStateEntry(payload.val.socket) }
184
+ : {}),
185
+ };
186
+ case "SignalStateResponse":
187
+ return {
188
+ type: "signal_state",
189
+ process_id: payload.val.processId,
190
+ handlers: Object.fromEntries([...payload.val.handlers].map(([signal, registration]) => [
191
+ String(signal),
192
+ {
193
+ action: fromGeneratedSignalDispositionAction(registration.action),
194
+ mask: Array.from(registration.mask),
195
+ flags: registration.flags,
196
+ },
197
+ ])),
198
+ };
199
+ case "ZombieTimerCountResponse":
200
+ return {
201
+ type: "zombie_timer_count",
202
+ count: bigIntToSafeNumber(payload.val.count, "zombie_timer_count.count"),
203
+ };
204
+ case "FilesystemResultResponse":
205
+ return {
206
+ type: "filesystem_result",
207
+ operation: fromGeneratedFilesystemOperation(payload.val.operation),
208
+ status: payload.val.status,
209
+ payload_size_bytes: bigIntToSafeNumber(payload.val.payloadSizeBytes, "filesystem_result.payload_size_bytes"),
210
+ };
211
+ case "PermissionDecisionResponse":
212
+ throw new Error("unsupported bare response payload tag: permission_decision");
213
+ case "PersistenceStateResponse":
214
+ return {
215
+ type: "persistence_state",
216
+ key: payload.val.key,
217
+ found: payload.val.found,
218
+ payload_size_bytes: bigIntToSafeNumber(payload.val.payloadSizeBytes, "persistence_state.payload_size_bytes"),
219
+ };
220
+ case "PersistenceFlushedResponse":
221
+ return {
222
+ type: "persistence_flushed",
223
+ key: payload.val.key,
224
+ committed_bytes: bigIntToSafeNumber(payload.val.committedBytes, "persistence_flushed.committed_bytes"),
225
+ };
226
+ case "RejectedResponse":
227
+ return {
228
+ type: "rejected",
229
+ code: payload.val.code,
230
+ message: payload.val.message,
231
+ };
232
+ case "VmFetchResponse":
233
+ return {
234
+ type: "vm_fetch_result",
235
+ response_json: payload.val.responseJson,
236
+ };
237
+ case "ExtEnvelope":
238
+ return {
239
+ type: "ext_result",
240
+ envelope: fromGeneratedExtEnvelope(payload.val),
241
+ };
242
+ }
243
+ }
244
+ function fromGeneratedAgentosProjectedAgent(agent) {
245
+ return {
246
+ id: agent.id,
247
+ acp_entrypoint: agent.acpEntrypoint,
248
+ adapter_entrypoint: agent.adapterEntrypoint,
249
+ };
250
+ }
@@ -0,0 +1,17 @@
1
+ import type { LiveSidecarEventSelector } from "./event-buffer.js";
2
+ import type { LiveOwnershipScope } from "./ownership.js";
3
+ import type { LiveEventFrame, LiveResponseFrame, LiveSidecarRequestHandler } from "./protocol-frames.js";
4
+ import type { LiveRequestPayload } from "./request-payloads.js";
5
+ export interface SidecarProcessTransport {
6
+ setSidecarRequestHandler(handler: LiveSidecarRequestHandler | null): void;
7
+ onEvent(handler: (event: LiveEventFrame) => void): () => void;
8
+ sendRequest(input: {
9
+ ownership: LiveOwnershipScope;
10
+ payload: LiveRequestPayload;
11
+ }): Promise<LiveResponseFrame>;
12
+ waitForEvent(matcher: LiveSidecarEventSelector | ((event: LiveEventFrame) => boolean), timeoutMs?: number, options?: {
13
+ signal?: AbortSignal;
14
+ }): Promise<LiveEventFrame>;
15
+ failPermanently(error: Error): void;
16
+ dispose(): Promise<void>;
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ export declare class SidecarProcessExited extends Error {
2
+ readonly exitCode: number | null;
3
+ readonly signal: string | null;
4
+ readonly stderr: string;
5
+ constructor(options: {
6
+ exitCode: number | null;
7
+ signal: string | null;
8
+ stderr: string;
9
+ });
10
+ }
11
+ /**
12
+ * The silence watchdog fired: the sidecar produced no protocol frames at all —
13
+ * not even its 10s liveness heartbeats — for the full silence window, so the
14
+ * process is dead or wedged (not merely busy: a busy sidecar still heartbeats
15
+ * from a dedicated thread). The host kills the sidecar and rejects every
16
+ * in-flight request with this error.
17
+ */
18
+ export declare class SidecarSilenceTimeout extends Error {
19
+ readonly silenceMs: number;
20
+ readonly stderr: string;
21
+ constructor(options: {
22
+ silenceMs: number;
23
+ stderr: string;
24
+ });
25
+ }
26
+ export declare class SidecarProcessError extends Error {
27
+ readonly childError: Error;
28
+ readonly stderr: string;
29
+ constructor(error: Error, stderr: string);
30
+ }
@@ -0,0 +1,47 @@
1
+ function formatSidecarStderrSuffix(stderr) {
2
+ return stderr ? `\nstderr:\n${stderr}` : "";
3
+ }
4
+ export class SidecarProcessExited extends Error {
5
+ exitCode;
6
+ signal;
7
+ stderr;
8
+ constructor(options) {
9
+ const reason = options.signal !== null
10
+ ? `signal ${options.signal}`
11
+ : options.exitCode !== null
12
+ ? `code ${options.exitCode}`
13
+ : "disconnect";
14
+ super(`sidecar process exited with ${reason}${formatSidecarStderrSuffix(options.stderr)}`);
15
+ this.name = "SidecarProcessExited";
16
+ this.exitCode = options.exitCode;
17
+ this.signal = options.signal;
18
+ this.stderr = options.stderr;
19
+ }
20
+ }
21
+ /**
22
+ * The silence watchdog fired: the sidecar produced no protocol frames at all —
23
+ * not even its 10s liveness heartbeats — for the full silence window, so the
24
+ * process is dead or wedged (not merely busy: a busy sidecar still heartbeats
25
+ * from a dedicated thread). The host kills the sidecar and rejects every
26
+ * in-flight request with this error.
27
+ */
28
+ export class SidecarSilenceTimeout extends Error {
29
+ silenceMs;
30
+ stderr;
31
+ constructor(options) {
32
+ super(`sidecar unresponsive: no protocol frames or heartbeats for ${Math.round(options.silenceMs)}ms; killing sidecar${formatSidecarStderrSuffix(options.stderr)}`);
33
+ this.name = "SidecarSilenceTimeout";
34
+ this.silenceMs = options.silenceMs;
35
+ this.stderr = options.stderr;
36
+ }
37
+ }
38
+ export class SidecarProcessError extends Error {
39
+ childError;
40
+ stderr;
41
+ constructor(error, stderr) {
42
+ super(`sidecar process error: ${error.message}${formatSidecarStderrSuffix(stderr)}`);
43
+ this.name = "SidecarProcessError";
44
+ this.childError = error;
45
+ this.stderr = stderr;
46
+ }
47
+ }