rivetkit 0.0.0-main.41efcce → 0.0.0-main.49693dc

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 (299) hide show
  1. package/dist/browser/client.d.ts +939 -104
  2. package/dist/browser/client.js +1867 -900
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.d.ts +252 -129
  5. package/dist/browser/inspector/client.js +2079 -233
  6. package/dist/browser/inspector/client.js.map +1 -1
  7. package/dist/tsup/actor/errors.cjs +6 -2
  8. package/dist/tsup/actor/errors.cjs.map +1 -1
  9. package/dist/tsup/actor/errors.d.cts +1 -74
  10. package/dist/tsup/actor/errors.d.ts +1 -74
  11. package/dist/tsup/actor/errors.js +5 -1
  12. package/dist/tsup/agent-os/index.cjs +2408 -2029
  13. package/dist/tsup/agent-os/index.cjs.map +1 -1
  14. package/dist/tsup/agent-os/index.d.cts +932 -114
  15. package/dist/tsup/agent-os/index.d.ts +932 -114
  16. package/dist/tsup/agent-os/index.js +2412 -2033
  17. package/dist/tsup/agent-os/index.js.map +1 -1
  18. package/dist/tsup/{chunk-J27CEW6F.js → chunk-2OBVQZX6.js} +6 -6
  19. package/dist/tsup/chunk-2OBVQZX6.js.map +1 -0
  20. package/dist/tsup/chunk-3ZWHWMFJ.js +14 -0
  21. package/dist/tsup/chunk-3ZWHWMFJ.js.map +1 -0
  22. package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-4KGXFC6M.cjs} +238 -22
  23. package/dist/tsup/chunk-4KGXFC6M.cjs.map +1 -0
  24. package/dist/tsup/{chunk-CVHUXINE.js → chunk-5IU3MI7X.js} +594 -72
  25. package/dist/tsup/chunk-5IU3MI7X.js.map +1 -0
  26. package/dist/tsup/{chunk-VD7AZIBR.js → chunk-6CXQMHZR.js} +1161 -361
  27. package/dist/tsup/chunk-6CXQMHZR.js.map +1 -0
  28. package/dist/tsup/{chunk-SBEFJ4IQ.js → chunk-6W2UIH3X.js} +70 -8
  29. package/dist/tsup/chunk-6W2UIH3X.js.map +1 -0
  30. package/dist/tsup/{chunk-7MRGNVSR.js → chunk-6W5VGLFT.js} +237 -21
  31. package/dist/tsup/chunk-6W5VGLFT.js.map +1 -0
  32. package/dist/tsup/{chunk-RF3MEJV6.cjs → chunk-B73TBMMG.cjs} +18 -11
  33. package/dist/tsup/chunk-B73TBMMG.cjs.map +1 -0
  34. package/dist/tsup/chunk-D6TORRA4.js +243 -0
  35. package/dist/tsup/chunk-D6TORRA4.js.map +1 -0
  36. package/dist/tsup/{chunk-PXLJOMJD.js → chunk-FXT3HN32.js} +2 -2
  37. package/dist/tsup/{chunk-ZGWSH7YV.js → chunk-IXBD7BXC.js} +48 -72
  38. package/dist/tsup/chunk-IXBD7BXC.js.map +1 -0
  39. package/dist/tsup/{chunk-3BFYSYRU.js → chunk-JI6GZ2C2.js} +4 -12
  40. package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
  41. package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
  42. package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
  43. package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
  44. package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
  45. package/dist/tsup/{chunk-SPMMF6TR.cjs → chunk-LGOWPZJ5.cjs} +3 -3
  46. package/dist/tsup/chunk-LGOWPZJ5.cjs.map +1 -0
  47. package/dist/tsup/chunk-LYNWTX6R.cjs +14 -0
  48. package/dist/tsup/chunk-LYNWTX6R.cjs.map +1 -0
  49. package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-MYWZCDML.cjs} +4 -12
  50. package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
  51. package/dist/tsup/{chunk-XSC2WWXD.js → chunk-NYDZLWHZ.js} +16 -9
  52. package/dist/tsup/chunk-NYDZLWHZ.js.map +1 -0
  53. package/dist/tsup/{chunk-AV54CVAG.cjs → chunk-RB7WUDX6.cjs} +1290 -490
  54. package/dist/tsup/chunk-RB7WUDX6.cjs.map +1 -0
  55. package/dist/tsup/{chunk-JTL6Y2UN.cjs → chunk-SPJORZMM.cjs} +49 -73
  56. package/dist/tsup/chunk-SPJORZMM.cjs.map +1 -0
  57. package/dist/tsup/chunk-SSMKIYEX.cjs +243 -0
  58. package/dist/tsup/chunk-SSMKIYEX.cjs.map +1 -0
  59. package/dist/tsup/{chunk-TQSL4NJ3.cjs → chunk-TQ4HSX2U.cjs} +72 -10
  60. package/dist/tsup/chunk-TQ4HSX2U.cjs.map +1 -0
  61. package/dist/tsup/{chunk-EVADNK6Z.cjs → chunk-U6ZQELGJ.cjs} +10 -10
  62. package/dist/tsup/chunk-U6ZQELGJ.cjs.map +1 -0
  63. package/dist/tsup/chunk-XLBMKZD3.cjs +1257 -0
  64. package/dist/tsup/chunk-XLBMKZD3.cjs.map +1 -0
  65. package/dist/tsup/client/mod.cjs +8 -9
  66. package/dist/tsup/client/mod.cjs.map +1 -1
  67. package/dist/tsup/client/mod.d.cts +18 -7
  68. package/dist/tsup/client/mod.d.ts +18 -7
  69. package/dist/tsup/client/mod.js +7 -8
  70. package/dist/tsup/common/log.cjs +5 -3
  71. package/dist/tsup/common/log.cjs.map +1 -1
  72. package/dist/tsup/common/log.d.cts +5 -1
  73. package/dist/tsup/common/log.d.ts +5 -1
  74. package/dist/tsup/common/log.js +6 -4
  75. package/dist/tsup/common/websocket.cjs +4 -4
  76. package/dist/tsup/common/websocket.cjs.map +1 -1
  77. package/dist/tsup/common/websocket.js +3 -3
  78. package/dist/tsup/{config-B3RIidaJ.d.ts → config-BXSV17G7.d.cts} +987 -72
  79. package/dist/tsup/{config-D6WxBYjV.d.cts → config-Bi1r6gI7.d.ts} +987 -72
  80. package/dist/tsup/{config-B9qUIHX4.d.ts → config-ey2I2zz5.d.cts} +82 -15
  81. package/dist/tsup/{config-B9qUIHX4.d.cts → config-ey2I2zz5.d.ts} +82 -15
  82. package/dist/tsup/context-4fJemY0D.d.cts +129 -0
  83. package/dist/tsup/context-D4sNYboo.d.ts +129 -0
  84. package/dist/tsup/db/drizzle.cjs +168 -103
  85. package/dist/tsup/db/drizzle.cjs.map +1 -1
  86. package/dist/tsup/db/drizzle.d.cts +8 -4
  87. package/dist/tsup/db/drizzle.d.ts +8 -4
  88. package/dist/tsup/db/drizzle.js +170 -105
  89. package/dist/tsup/db/drizzle.js.map +1 -1
  90. package/dist/tsup/db/mod.cjs +6 -163
  91. package/dist/tsup/db/mod.cjs.map +1 -1
  92. package/dist/tsup/db/mod.d.cts +12 -4
  93. package/dist/tsup/db/mod.d.ts +12 -4
  94. package/dist/tsup/db/mod.js +5 -162
  95. package/dist/tsup/db/mod.js.map +1 -1
  96. package/dist/tsup/dynamic/mod.cjs +24 -0
  97. package/dist/tsup/dynamic/mod.cjs.map +1 -0
  98. package/dist/tsup/dynamic/mod.d.cts +38 -0
  99. package/dist/tsup/dynamic/mod.d.ts +38 -0
  100. package/dist/tsup/dynamic/mod.js +24 -0
  101. package/dist/tsup/dynamic/mod.js.map +1 -0
  102. package/dist/tsup/inspector/mod.cjs +47 -12
  103. package/dist/tsup/inspector/mod.cjs.map +1 -1
  104. package/dist/tsup/inspector/mod.d.cts +26 -136
  105. package/dist/tsup/inspector/mod.d.ts +26 -136
  106. package/dist/tsup/inspector/mod.js +46 -11
  107. package/dist/tsup/inspector/mod.js.map +1 -1
  108. package/dist/tsup/inspector/workflow.cjs +21 -0
  109. package/dist/tsup/inspector/workflow.cjs.map +1 -0
  110. package/dist/tsup/inspector/workflow.d.cts +144 -0
  111. package/dist/tsup/inspector/workflow.d.ts +144 -0
  112. package/dist/tsup/inspector/workflow.js +21 -0
  113. package/dist/tsup/inspector/workflow.js.map +1 -0
  114. package/dist/tsup/inspector-tab/mod.cjs +162 -0
  115. package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
  116. package/dist/tsup/inspector-tab/mod.d.cts +241 -0
  117. package/dist/tsup/inspector-tab/mod.d.ts +241 -0
  118. package/dist/tsup/inspector-tab/mod.js +162 -0
  119. package/dist/tsup/inspector-tab/mod.js.map +1 -0
  120. package/dist/tsup/mod.cjs +4268 -944
  121. package/dist/tsup/mod.cjs.map +1 -1
  122. package/dist/tsup/mod.d.cts +9 -8
  123. package/dist/tsup/mod.d.ts +9 -8
  124. package/dist/tsup/mod.js +4229 -905
  125. package/dist/tsup/mod.js.map +1 -1
  126. package/dist/tsup/test/mod.cjs +26 -21
  127. package/dist/tsup/test/mod.cjs.map +1 -1
  128. package/dist/tsup/test/mod.d.cts +7 -6
  129. package/dist/tsup/test/mod.d.ts +7 -6
  130. package/dist/tsup/test/mod.js +25 -20
  131. package/dist/tsup/test/mod.js.map +1 -1
  132. package/dist/tsup/unstable/migrations.cjs +101 -0
  133. package/dist/tsup/unstable/migrations.cjs.map +1 -0
  134. package/dist/tsup/unstable/migrations.d.cts +29 -0
  135. package/dist/tsup/unstable/migrations.d.ts +29 -0
  136. package/dist/tsup/unstable/migrations.js +101 -0
  137. package/dist/tsup/unstable/migrations.js.map +1 -0
  138. package/dist/tsup/utils-Bbz-3411.d.cts +162 -0
  139. package/dist/tsup/utils-BqdWVlzm.d.ts +162 -0
  140. package/dist/tsup/utils-vvJQyygr.d.cts +109 -0
  141. package/dist/tsup/utils-vvJQyygr.d.ts +109 -0
  142. package/dist/tsup/utils.cjs +7 -3
  143. package/dist/tsup/utils.cjs.map +1 -1
  144. package/dist/tsup/utils.d.cts +4 -147
  145. package/dist/tsup/utils.d.ts +4 -147
  146. package/dist/tsup/utils.js +6 -2
  147. package/dist/tsup/workflow/mod.cjs +517 -412
  148. package/dist/tsup/workflow/mod.cjs.map +1 -1
  149. package/dist/tsup/workflow/mod.d.cts +11 -10
  150. package/dist/tsup/workflow/mod.d.ts +11 -10
  151. package/dist/tsup/workflow/mod.js +511 -406
  152. package/dist/tsup/workflow/mod.js.map +1 -1
  153. package/package.json +62 -14
  154. package/src/actor/actions.ts +119 -0
  155. package/src/actor/config.test.ts +78 -0
  156. package/src/actor/config.ts +518 -96
  157. package/src/actor/contexts/index.ts +7 -2
  158. package/src/actor/definition.ts +38 -26
  159. package/src/actor/errors.ts +101 -89
  160. package/src/actor/keys.ts +2 -1
  161. package/src/actor/mod.ts +32 -21
  162. package/src/actor/schema.ts +2 -2
  163. package/src/agent-os/actor/cron.ts +37 -2
  164. package/src/agent-os/actor/index.ts +39 -19
  165. package/src/agent-os/actor/preview.ts +1 -2
  166. package/src/agent-os/actor/session.ts +2 -2
  167. package/src/agent-os/config.ts +1 -1
  168. package/src/agent-os/fs/database-vfs.ts +1 -1
  169. package/src/agent-os/index.ts +16 -15
  170. package/src/agent-os/types.ts +11 -0
  171. package/src/client/actor-common.ts +106 -53
  172. package/src/client/actor-conn.ts +94 -45
  173. package/src/client/actor-handle.ts +198 -79
  174. package/src/client/actor-query.ts +13 -6
  175. package/src/client/client.ts +43 -15
  176. package/src/client/config.ts +8 -0
  177. package/src/client/errors.ts +4 -2
  178. package/src/client/lifecycle-errors.ts +28 -4
  179. package/src/client/mod.ts +9 -4
  180. package/src/client/query.ts +3 -1
  181. package/src/client/queue.ts +8 -3
  182. package/src/client/raw-utils.ts +24 -16
  183. package/src/client/resolve-gateway-target.ts +3 -1
  184. package/src/client/utils.ts +36 -10
  185. package/src/common/actor-router-consts.ts +7 -0
  186. package/src/common/actor-websocket.ts +3 -1
  187. package/src/common/bare/actor-persist/v1.ts +205 -163
  188. package/src/common/bare/actor-persist/v2.ts +265 -213
  189. package/src/common/bare/actor-persist/v3.ts +176 -172
  190. package/src/common/bare/actor-persist/v4.ts +254 -253
  191. package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
  192. package/src/common/bare/generated/client-protocol/v4.ts +599 -0
  193. package/src/common/bare/generated/inspector/v5.ts +1016 -0
  194. package/src/common/bare/generated/inspector/v6.ts +1367 -0
  195. package/src/common/bare/transport/v1.ts +694 -542
  196. package/src/common/client-protocol-versioned.ts +176 -67
  197. package/src/common/client-protocol-zod.ts +7 -0
  198. package/src/common/client-protocol.ts +1 -1
  199. package/src/common/database/config.ts +103 -10
  200. package/src/common/database/mod.test.ts +364 -0
  201. package/src/common/database/mod.ts +278 -149
  202. package/src/common/database/native-database.test.ts +220 -0
  203. package/src/common/database/native-database.ts +394 -58
  204. package/src/common/database/shared.ts +25 -0
  205. package/src/common/encoding.ts +302 -38
  206. package/src/common/engine.ts +28 -1
  207. package/src/common/eventsource.ts +1 -1
  208. package/src/common/fetch-like.ts +49 -0
  209. package/src/common/inline-websocket-adapter.ts +14 -13
  210. package/src/common/inspector-transport.ts +12 -2
  211. package/src/common/log.ts +117 -14
  212. package/src/common/router.ts +49 -23
  213. package/src/common/utils.ts +23 -203
  214. package/src/common/websocket-interface.ts +1 -1
  215. package/src/db/drizzle.test.ts +164 -0
  216. package/src/db/drizzle.ts +207 -121
  217. package/src/db/mod.ts +6 -1
  218. package/src/devtools-loader/index.ts +4 -7
  219. package/src/devtools-loader/serve-devtools.ts +26 -0
  220. package/src/dynamic/instance.ts +32 -0
  221. package/src/dynamic/internal.ts +50 -0
  222. package/src/dynamic/isolate-runtime.ts +64 -0
  223. package/src/dynamic/mod.ts +32 -0
  224. package/src/engine-client/actor-http-client.ts +23 -4
  225. package/src/engine-client/actor-websocket-client.ts +32 -5
  226. package/src/engine-client/api-endpoints.ts +52 -2
  227. package/src/engine-client/api-utils.ts +2 -2
  228. package/src/engine-client/driver.ts +21 -17
  229. package/src/engine-client/mod.ts +116 -64
  230. package/src/engine-client/ws-proxy.ts +9 -4
  231. package/src/globals.d.ts +4 -0
  232. package/src/inspector/client.browser.ts +127 -15
  233. package/src/inspector/mod.ts +2 -4
  234. package/src/inspector/workflow.ts +61 -0
  235. package/src/inspector-tab/mod.ts +301 -0
  236. package/src/registry/config/envoy.ts +1 -2
  237. package/src/registry/config/index.ts +160 -53
  238. package/src/registry/config/serverless.ts +7 -1
  239. package/src/registry/index.ts +659 -96
  240. package/src/registry/napi-runtime.ts +1154 -0
  241. package/src/registry/native-validation.ts +10 -12
  242. package/src/registry/native.ts +2005 -955
  243. package/src/registry/process-metrics.ts +250 -0
  244. package/src/registry/run-handler-coordinator.test.ts +252 -0
  245. package/src/registry/run-handler-coordinator.ts +219 -0
  246. package/src/registry/runtime.test.ts +50 -0
  247. package/src/registry/runtime.ts +839 -0
  248. package/src/registry/wasm-runtime.ts +1283 -0
  249. package/src/registry/write-through-proxy.ts +141 -0
  250. package/src/serde.ts +8 -2
  251. package/src/serverless/configure.ts +102 -49
  252. package/src/test/mod.ts +2 -17
  253. package/src/test/ready.ts +22 -0
  254. package/src/unstable/migrations.test.ts +170 -0
  255. package/src/unstable/migrations.ts +141 -0
  256. package/src/utils/crypto.ts +14 -0
  257. package/src/utils/endpoint-parser.ts +1 -1
  258. package/src/utils/env-vars.ts +39 -0
  259. package/src/utils/node.ts +44 -28
  260. package/src/utils/router.ts +1 -1
  261. package/src/utils.ts +4 -2
  262. package/src/workflow/context.ts +683 -242
  263. package/src/workflow/driver.test.ts +62 -0
  264. package/src/workflow/driver.ts +246 -119
  265. package/src/workflow/inspector.ts +24 -24
  266. package/src/workflow/mod.ts +76 -84
  267. package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
  268. package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
  269. package/dist/tsup/chunk-6AVUJ52Q.cjs +0 -253
  270. package/dist/tsup/chunk-6AVUJ52Q.cjs.map +0 -1
  271. package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
  272. package/dist/tsup/chunk-7X7RVTFF.cjs +0 -735
  273. package/dist/tsup/chunk-7X7RVTFF.cjs.map +0 -1
  274. package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
  275. package/dist/tsup/chunk-AV54CVAG.cjs.map +0 -1
  276. package/dist/tsup/chunk-CVHUXINE.js.map +0 -1
  277. package/dist/tsup/chunk-EVADNK6Z.cjs.map +0 -1
  278. package/dist/tsup/chunk-J27CEW6F.js.map +0 -1
  279. package/dist/tsup/chunk-JTL6Y2UN.cjs.map +0 -1
  280. package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
  281. package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
  282. package/dist/tsup/chunk-RF3MEJV6.cjs.map +0 -1
  283. package/dist/tsup/chunk-SB4MXRN2.js +0 -253
  284. package/dist/tsup/chunk-SB4MXRN2.js.map +0 -1
  285. package/dist/tsup/chunk-SBEFJ4IQ.js.map +0 -1
  286. package/dist/tsup/chunk-SPMMF6TR.cjs.map +0 -1
  287. package/dist/tsup/chunk-TQSL4NJ3.cjs.map +0 -1
  288. package/dist/tsup/chunk-VD7AZIBR.js.map +0 -1
  289. package/dist/tsup/chunk-XSC2WWXD.js.map +0 -1
  290. package/dist/tsup/chunk-ZGWSH7YV.js.map +0 -1
  291. package/dist/tsup/context-BxvHh9wi.d.cts +0 -92
  292. package/dist/tsup/context-CNIZBIKl.d.ts +0 -92
  293. package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
  294. package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
  295. package/src/actor/driver.ts +0 -141
  296. package/src/actor/instance/mod.ts +0 -2501
  297. package/src/drivers/engine/actor-driver.ts +0 -2470
  298. package/src/utils/serve.ts +0 -217
  299. /package/dist/tsup/{chunk-PXLJOMJD.js.map → chunk-FXT3HN32.js.map} +0 -0
@@ -2,19 +2,27 @@ import type { Context as HonoContext } from "hono";
2
2
  import invariant from "invariant";
3
3
  import { deserializeActorKey, serializeActorKey } from "@/actor/keys";
4
4
  import type { ClientConfig } from "@/client/client";
5
- import { noopNext } from "@/common/utils";
6
5
  import {
7
- type ActorOutput,
8
- type CreateInput,
9
- type GatewayTarget,
10
- type GetForIdInput,
11
- type GetOrCreateWithKeyInput,
12
- type GetWithKeyInput,
13
- type ListActorsInput,
14
- type RuntimeDisplayInformation,
15
- type EngineControlClient,
16
- } from "@/engine-client/driver";
6
+ PATH_CONNECT,
7
+ PATH_WEBSOCKET_BASE,
8
+ PATH_WEBSOCKET_PREFIX,
9
+ } from "@/common/actor-router-consts";
10
+ import type { JsonCompatValue } from "@/common/encoding";
11
+ import { noopNext } from "@/common/utils";
17
12
  import type { Actor as ApiActor } from "@/engine-api/actors";
13
+ import type {
14
+ ActorOutput,
15
+ CreateInput,
16
+ EngineControlClient,
17
+ GatewayRequestOptions,
18
+ GatewayTarget,
19
+ GetForIdInput,
20
+ GetOrCreateWithKeyInput,
21
+ GetWithKeyInput,
22
+ ListActorsInput,
23
+ RuntimeDisplayInformation,
24
+ } from "@/engine-client/driver";
25
+ import { shouldSkipReadyWait } from "@/engine-client/driver";
18
26
  import type { Encoding, UniversalWebSocket } from "@/mod";
19
27
  import { encodeCborCompat, uint8ArrayToBase64 } from "@/serde";
20
28
  import { combineUrlPath, type GetUpgradeWebSocket } from "@/utils";
@@ -32,7 +40,6 @@ import {
32
40
  getActor,
33
41
  getActorByKey,
34
42
  getOrCreateActor,
35
- kvGet,
36
43
  listActorsByName,
37
44
  } from "./api-endpoints";
38
45
  import { EngineApiError, getEndpoint } from "./api-utils";
@@ -160,7 +167,14 @@ export class RemoteEngineControlClient implements EngineControlClient {
160
167
  ): Promise<ActorOutput> {
161
168
  await this.#metadataPromise;
162
169
 
163
- const { name, key, input: actorInput, region, crashPolicy } = input;
170
+ const {
171
+ name,
172
+ key,
173
+ input: actorInput,
174
+ region,
175
+ crashPolicy,
176
+ poolName,
177
+ } = input;
164
178
 
165
179
  logger().info({
166
180
  msg: "getOrCreateWithKey: getting or creating actor via engine api",
@@ -172,9 +186,11 @@ export class RemoteEngineControlClient implements EngineControlClient {
172
186
  datacenter: region,
173
187
  name,
174
188
  key: serializeActorKey(key),
175
- runner_name_selector: this.#config.poolName,
189
+ runner_name_selector: poolName ?? this.#config.poolName,
176
190
  input: actorInput
177
- ? uint8ArrayToBase64(encodeCborCompat(actorInput))
191
+ ? uint8ArrayToBase64(
192
+ encodeCborCompat(actorInput as JsonCompatValue),
193
+ )
178
194
  : undefined,
179
195
  crash_policy: crashPolicy ?? "sleep",
180
196
  });
@@ -196,6 +212,7 @@ export class RemoteEngineControlClient implements EngineControlClient {
196
212
  input,
197
213
  region,
198
214
  crashPolicy,
215
+ poolName,
199
216
  }: CreateInput): Promise<ActorOutput> {
200
217
  await this.#metadataPromise;
201
218
 
@@ -205,10 +222,10 @@ export class RemoteEngineControlClient implements EngineControlClient {
205
222
  const result = await createActor(this.#config, {
206
223
  datacenter: region,
207
224
  name,
208
- runner_name_selector: this.#config.poolName,
225
+ runner_name_selector: poolName ?? this.#config.poolName,
209
226
  key: serializeActorKey(key),
210
227
  input: input
211
- ? uint8ArrayToBase64(encodeCborCompat(input))
228
+ ? uint8ArrayToBase64(encodeCborCompat(input as JsonCompatValue))
212
229
  : undefined,
213
230
  crash_policy: crashPolicy ?? "sleep",
214
231
  });
@@ -246,15 +263,29 @@ export class RemoteEngineControlClient implements EngineControlClient {
246
263
  async sendRequest(
247
264
  target: GatewayTarget,
248
265
  actorRequest: Request,
266
+ options: GatewayRequestOptions = {},
249
267
  ): Promise<Response> {
250
268
  await this.#metadataPromise;
251
269
 
270
+ const path = requestPath(actorRequest);
252
271
  const gatewayUrl = this.#buildGatewayUrlForTarget(
253
272
  target,
254
- requestPath(actorRequest),
273
+ path,
274
+ options,
255
275
  );
276
+ const httpOptions = {
277
+ ...options,
278
+ directActorId: shouldSkipReadyWait(options)
279
+ ? directActorIdFromTarget(target)
280
+ : undefined,
281
+ };
256
282
 
257
- return sendHttpRequestToGateway(this.#config, gatewayUrl, actorRequest);
283
+ return sendHttpRequestToGateway(
284
+ this.#config,
285
+ gatewayUrl,
286
+ actorRequest,
287
+ httpOptions,
288
+ );
258
289
  }
259
290
 
260
291
  async openWebSocket(
@@ -262,22 +293,36 @@ export class RemoteEngineControlClient implements EngineControlClient {
262
293
  target: GatewayTarget,
263
294
  encoding: Encoding,
264
295
  params: unknown,
296
+ options: GatewayRequestOptions = {},
265
297
  ): Promise<UniversalWebSocket> {
266
298
  await this.#metadataPromise;
267
299
 
268
- const gatewayUrl = this.#buildGatewayUrlForTarget(target, path);
300
+ const gatewayUrl = this.#buildGatewayUrlForTarget(
301
+ target,
302
+ path,
303
+ options,
304
+ );
269
305
 
270
306
  return openWebSocketToGateway(
271
307
  this.#config,
272
308
  gatewayUrl,
273
309
  encoding,
274
310
  params,
311
+ {
312
+ ...options,
313
+ directActorId: shouldSkipReadyWait(options)
314
+ ? directActorIdFromTarget(target)
315
+ : undefined,
316
+ },
275
317
  );
276
318
  }
277
319
 
278
- async buildGatewayUrl(target: GatewayTarget): Promise<string> {
320
+ async buildGatewayUrl(
321
+ target: GatewayTarget,
322
+ options: GatewayRequestOptions = {},
323
+ ): Promise<string> {
279
324
  await this.#metadataPromise;
280
- return this.#buildGatewayUrlForTarget(target, "");
325
+ return this.#buildGatewayUrlForTarget(target, "", options);
281
326
  }
282
327
 
283
328
  async proxyRequest(
@@ -334,46 +379,6 @@ export class RemoteEngineControlClient implements EngineControlClient {
334
379
  return await upgradeWebSocket(() => args)(c, noopNext());
335
380
  }
336
381
 
337
- async kvGet(actorId: string, key: Uint8Array): Promise<string | null> {
338
- await this.#metadataPromise;
339
-
340
- logger().debug({ msg: "getting kv value via engine api", key });
341
-
342
- const response = await kvGet(
343
- this.#config,
344
- actorId,
345
- new TextDecoder("utf8").decode(key),
346
- );
347
-
348
- return response.value;
349
- }
350
-
351
- async kvBatchGet(
352
- _actorId: string,
353
- _keys: Uint8Array[],
354
- ): Promise<(Uint8Array | null)[]> {
355
- throw new Error("kvBatchGet not supported on remote engine client");
356
- }
357
-
358
- async kvBatchPut(
359
- _actorId: string,
360
- _entries: [Uint8Array, Uint8Array][],
361
- ): Promise<void> {
362
- throw new Error("kvBatchPut not supported on remote engine client");
363
- }
364
-
365
- async kvBatchDelete(_actorId: string, _keys: Uint8Array[]): Promise<void> {
366
- throw new Error("kvBatchDelete not supported on remote engine client");
367
- }
368
-
369
- async kvDeleteRange(
370
- _actorId: string,
371
- _start: Uint8Array,
372
- _end: Uint8Array,
373
- ): Promise<void> {
374
- throw new Error("kvDeleteRange not supported on remote engine client");
375
- }
376
-
377
382
  displayInformation(): RuntimeDisplayInformation {
378
383
  return { properties: {} };
379
384
  }
@@ -382,9 +387,21 @@ export class RemoteEngineControlClient implements EngineControlClient {
382
387
  this.#config.getUpgradeWebSocket = getUpgradeWebSocket;
383
388
  }
384
389
 
385
- #buildGatewayUrlForTarget(target: GatewayTarget, path: string): string {
390
+ #buildGatewayUrlForTarget(
391
+ target: GatewayTarget,
392
+ path: string,
393
+ options: GatewayRequestOptions = {},
394
+ ): string {
386
395
  const endpoint = getEndpoint(this.#config);
387
396
 
397
+ if (
398
+ shouldSkipReadyWait(options) &&
399
+ directActorIdFromTarget(target) &&
400
+ canUseDirectSkipReadyWaitPath(path)
401
+ ) {
402
+ return combineUrlPath(endpoint, path);
403
+ }
404
+
388
405
  if ("directId" in target) {
389
406
  return buildActorGatewayUrl(
390
407
  endpoint,
@@ -413,8 +430,10 @@ export class RemoteEngineControlClient implements EngineControlClient {
413
430
  this.#config.maxInputSize,
414
431
  undefined,
415
432
  "getOrCreateForKey" in target
416
- ? this.#config.poolName
433
+ ? (target.getOrCreateForKey.poolName ??
434
+ this.#config.poolName)
417
435
  : undefined,
436
+ options,
418
437
  );
419
438
  }
420
439
 
@@ -428,6 +447,39 @@ export class RemoteEngineControlClient implements EngineControlClient {
428
447
  }
429
448
  }
430
449
 
450
+ function canUseDirectSkipReadyWaitPath(path: string): boolean {
451
+ return (
452
+ isActorHttpRequestPath(path) ||
453
+ isPathOrQuery(path, PATH_CONNECT) ||
454
+ isPathOrQuery(path, PATH_WEBSOCKET_BASE) ||
455
+ path.startsWith(PATH_WEBSOCKET_PREFIX)
456
+ );
457
+ }
458
+
459
+ function isPathOrQuery(path: string, basePath: string): boolean {
460
+ return path === basePath || path.startsWith(`${basePath}?`);
461
+ }
462
+
463
+ function isActorHttpRequestPath(path: string): boolean {
464
+ const stripped = path.slice("/request".length);
465
+ return (
466
+ path.startsWith("/request") &&
467
+ (stripped.length === 0 ||
468
+ stripped.startsWith("/") ||
469
+ stripped.startsWith("?"))
470
+ );
471
+ }
472
+
473
+ function directActorIdFromTarget(target: GatewayTarget): string | undefined {
474
+ if ("directId" in target) {
475
+ return target.directId;
476
+ }
477
+ if ("getForId" in target) {
478
+ return target.getForId.actorId;
479
+ }
480
+ return undefined;
481
+ }
482
+
431
483
  function requestPath(req: Request): string {
432
484
  const url = new URL(req.url);
433
485
  return `${url.pathname}${url.search}`;
@@ -9,7 +9,7 @@ import { logger } from "./log";
9
9
  * Returns Hono `upgradeWebSocket` args that will proxy requests from the client to a destination address.
10
10
  */
11
11
  export async function createWebSocketProxy(
12
- c: HonoContext,
12
+ _c: HonoContext,
13
13
  targetUrl: string,
14
14
  protocols: string[],
15
15
  ): Promise<UpgradeWebSocketArgs> {
@@ -23,7 +23,7 @@ export async function createWebSocketProxy(
23
23
  const state: WsState = {};
24
24
 
25
25
  return {
26
- onOpen: async (event: any, clientWs: WSContext) => {
26
+ onOpen: async (_event: any, clientWs: WSContext) => {
27
27
  logger().debug({ msg: "client websocket connected", targetUrl });
28
28
 
29
29
  if (clientWs.readyState !== 1) {
@@ -68,6 +68,11 @@ export async function createWebSocketProxy(
68
68
  reject(error);
69
69
  });
70
70
  });
71
+ // Attach a no-op rejection handler so Node.js does not treat this as
72
+ // an unhandled rejection if onMessage never runs (e.g. the client
73
+ // disconnects before sending a message). The rejection still propagates
74
+ // to any caller that awaits connectPromise directly.
75
+ state.connectPromise.catch(() => {});
71
76
 
72
77
  // Setup bidirectional forwarding
73
78
  state.targetWs.addEventListener("message", (event) => {
@@ -137,7 +142,7 @@ export async function createWebSocketProxy(
137
142
  }
138
143
  },
139
144
 
140
- onClose: (event: any, clientWs: WSContext) => {
145
+ onClose: (event: any, _clientWs: WSContext) => {
141
146
  logger().debug({
142
147
  msg: "client websocket closed",
143
148
  targetUrl,
@@ -159,7 +164,7 @@ export async function createWebSocketProxy(
159
164
  }
160
165
  },
161
166
 
162
- onError: (event: any, clientWs: WSContext) => {
167
+ onError: (event: any, _clientWs: WSContext) => {
163
168
  logger().error({ msg: "client websocket error", targetUrl, event });
164
169
 
165
170
  if (state.targetWs) {
package/src/globals.d.ts CHANGED
@@ -25,6 +25,10 @@ declare global {
25
25
  const navigator: any;
26
26
  const window: Window | undefined;
27
27
 
28
+ namespace WebAssembly {
29
+ class Module {}
30
+ }
31
+
28
32
  const document: {
29
33
  getElementById(id: string): HTMLElement | null;
30
34
  createElement(tag: "script"): HTMLScriptElement;
@@ -3,22 +3,25 @@ import * as v1 from "@/common/bare/generated/inspector/v1";
3
3
  import * as v2 from "@/common/bare/generated/inspector/v2";
4
4
  import * as v3 from "@/common/bare/generated/inspector/v3";
5
5
  import * as v4 from "@/common/bare/generated/inspector/v4";
6
+ import * as v5 from "@/common/bare/generated/inspector/v5";
7
+ import * as v6 from "@/common/bare/generated/inspector/v6";
6
8
  import {
7
9
  decodeWorkflowHistoryTransport,
8
10
  encodeWorkflowHistoryTransport,
9
11
  } from "@/common/inspector-transport";
10
12
 
11
- export * from "@/common/bare/generated/inspector/v4";
13
+ export * from "@/common/bare/generated/inspector/v6";
12
14
  export { decodeWorkflowHistoryTransport, encodeWorkflowHistoryTransport };
13
15
  export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
14
16
 
15
- export const CURRENT_VERSION = 4;
17
+ export const CURRENT_VERSION = 6;
16
18
 
17
19
  const EVENTS_DROPPED_ERROR = "inspector.events_dropped";
18
20
  const WORKFLOW_HISTORY_DROPPED_ERROR = "inspector.workflow_history_dropped";
19
21
  const QUEUE_DROPPED_ERROR = "inspector.queue_dropped";
20
22
  const TRACE_DROPPED_ERROR = "inspector.trace_dropped";
21
23
  const DATABASE_DROPPED_ERROR = "inspector.database_dropped";
24
+ const SCHEDULES_DROPPED_ERROR = "inspector.schedules_dropped";
22
25
 
23
26
  const v1ToClientToV2 = (v1Data: v1.ToClient): v2.ToClient => {
24
27
  if (v1Data.body.tag === "Init") {
@@ -156,6 +159,89 @@ const v4ToClientToV3 = (v4Data: v4.ToClient): v3.ToClient => {
156
159
  return v4Data as unknown as v3.ToClient;
157
160
  };
158
161
 
162
+ const v4ToClientToV5 = (v4Data: v4.ToClient): v5.ToClient => {
163
+ if (v4Data.body.tag === "Init") {
164
+ // A v4 runtime predates tab config in Init; default to an empty list.
165
+ // The client reads that as "no custom tabs" (built-in tabs only).
166
+ const init = v4Data.body.val;
167
+ return {
168
+ body: {
169
+ tag: "Init",
170
+ val: { ...init, tabConfig: [] },
171
+ },
172
+ };
173
+ }
174
+
175
+ return v4Data as unknown as v5.ToClient;
176
+ };
177
+
178
+ const v5ToClientToV4 = (v5Data: v5.ToClient): v4.ToClient => {
179
+ if (v5Data.body.tag === "Init") {
180
+ const { tabConfig: _tabConfig, ...rest } = v5Data.body.val;
181
+ return {
182
+ body: {
183
+ tag: "Init",
184
+ val: rest,
185
+ },
186
+ };
187
+ }
188
+
189
+ return v5Data as unknown as v4.ToClient;
190
+ };
191
+
192
+ const v5ToClientToV6 = (v5Data: v5.ToClient): v6.ToClient => {
193
+ if (v5Data.body.tag === "Init") {
194
+ return {
195
+ body: {
196
+ tag: "Init",
197
+ val: { ...v5Data.body.val, schedules: [] },
198
+ },
199
+ };
200
+ }
201
+ return v5Data as unknown as v6.ToClient;
202
+ };
203
+
204
+ const v6ToClientToV5 = (v6Data: v6.ToClient): v5.ToClient => {
205
+ if (v6Data.body.tag === "Init") {
206
+ const { schedules: _schedules, ...rest } = v6Data.body.val;
207
+ return { body: { tag: "Init", val: rest } };
208
+ }
209
+ if (
210
+ v6Data.body.tag === "SchedulesUpdated" ||
211
+ v6Data.body.tag === "SchedulesResponse" ||
212
+ v6Data.body.tag === "ScheduleHistoryResponse" ||
213
+ v6Data.body.tag === "ScheduleDeleteResponse"
214
+ ) {
215
+ return {
216
+ body: {
217
+ tag: "Error",
218
+ val: { message: SCHEDULES_DROPPED_ERROR },
219
+ },
220
+ };
221
+ }
222
+ return v6Data as unknown as v5.ToClient;
223
+ };
224
+
225
+ const v4ToServerToV5 = (v4Data: v4.ToServer): v5.ToServer =>
226
+ v4Data as unknown as v5.ToServer;
227
+
228
+ const v5ToServerToV4 = (v5Data: v5.ToServer): v4.ToServer =>
229
+ v5Data as unknown as v4.ToServer;
230
+
231
+ const v5ToServerToV6 = (v5Data: v5.ToServer): v6.ToServer =>
232
+ v5Data as unknown as v6.ToServer;
233
+
234
+ const v6ToServerToV5 = (v6Data: v6.ToServer): v5.ToServer => {
235
+ if (
236
+ v6Data.body.tag === "SchedulesRequest" ||
237
+ v6Data.body.tag === "ScheduleHistoryRequest" ||
238
+ v6Data.body.tag === "ScheduleDeleteRequest"
239
+ ) {
240
+ throw new Error("Cannot convert v6-only schedule requests to v5");
241
+ }
242
+ return v6Data as unknown as v5.ToServer;
243
+ };
244
+
159
245
  const v1ToServerToV2 = (v1Data: v1.ToServer): v2.ToServer => {
160
246
  if (
161
247
  v1Data.body.tag === "EventsRequest" ||
@@ -198,13 +284,15 @@ const v3ToServerToV4 = (v3Data: v3.ToServer): v4.ToServer =>
198
284
 
199
285
  const v4ToServerToV3 = (v4Data: v4.ToServer): v3.ToServer => {
200
286
  if (v4Data.body.tag === "WorkflowReplayRequest") {
201
- throw new Error("Cannot convert v4-only workflow replay requests to v3");
287
+ throw new Error(
288
+ "Cannot convert v4-only workflow replay requests to v3",
289
+ );
202
290
  }
203
291
 
204
292
  return v4Data as unknown as v3.ToServer;
205
293
  };
206
294
 
207
- export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
295
+ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v6.ToServer>({
208
296
  serializeVersion: (data, version) => {
209
297
  switch (version) {
210
298
  case 1:
@@ -214,7 +302,11 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
214
302
  case 3:
215
303
  return v3.encodeToServer(data as unknown as v3.ToServer);
216
304
  case 4:
217
- return v4.encodeToServer(data);
305
+ return v4.encodeToServer(data as unknown as v4.ToServer);
306
+ case 5:
307
+ return v5.encodeToServer(data as unknown as v5.ToServer);
308
+ case 6:
309
+ return v6.encodeToServer(data);
218
310
  default:
219
311
  throw new Error(`Unknown version ${version}`);
220
312
  }
@@ -222,13 +314,17 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
222
314
  deserializeVersion: (bytes, version) => {
223
315
  switch (version) {
224
316
  case 1:
225
- return v1.decodeToServer(bytes) as unknown as v4.ToServer;
317
+ return v1.decodeToServer(bytes) as unknown as v5.ToServer;
226
318
  case 2:
227
- return v2.decodeToServer(bytes) as unknown as v4.ToServer;
319
+ return v2.decodeToServer(bytes) as unknown as v5.ToServer;
228
320
  case 3:
229
- return v3.decodeToServer(bytes) as unknown as v4.ToServer;
321
+ return v3.decodeToServer(bytes) as unknown as v5.ToServer;
230
322
  case 4:
231
- return v4.decodeToServer(bytes);
323
+ return v4.decodeToServer(bytes) as unknown as v5.ToServer;
324
+ case 5:
325
+ return v5.decodeToServer(bytes) as unknown as v6.ToServer;
326
+ case 6:
327
+ return v6.decodeToServer(bytes);
232
328
  default:
233
329
  throw new Error(`Unknown version ${version}`);
234
330
  }
@@ -237,15 +333,19 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
237
333
  v1ToServerToV2,
238
334
  v2ToServerToV3,
239
335
  v3ToServerToV4,
336
+ v4ToServerToV5,
337
+ v5ToServerToV6,
240
338
  ],
241
339
  serializeConverters: () => [
340
+ v6ToServerToV5,
341
+ v5ToServerToV4,
242
342
  v4ToServerToV3,
243
343
  v3ToServerToV2,
244
344
  v2ToServerToV1,
245
345
  ],
246
346
  });
247
347
 
248
- export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
348
+ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v6.ToClient>({
249
349
  serializeVersion: (data, version) => {
250
350
  switch (version) {
251
351
  case 1:
@@ -255,7 +355,11 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
255
355
  case 3:
256
356
  return v3.encodeToClient(data as unknown as v3.ToClient);
257
357
  case 4:
258
- return v4.encodeToClient(data);
358
+ return v4.encodeToClient(data as unknown as v4.ToClient);
359
+ case 5:
360
+ return v5.encodeToClient(data as unknown as v5.ToClient);
361
+ case 6:
362
+ return v6.encodeToClient(data);
259
363
  default:
260
364
  throw new Error(`Unknown version ${version}`);
261
365
  }
@@ -263,13 +367,17 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
263
367
  deserializeVersion: (bytes, version) => {
264
368
  switch (version) {
265
369
  case 1:
266
- return v1.decodeToClient(bytes) as unknown as v4.ToClient;
370
+ return v1.decodeToClient(bytes) as unknown as v5.ToClient;
267
371
  case 2:
268
- return v2.decodeToClient(bytes) as unknown as v4.ToClient;
372
+ return v2.decodeToClient(bytes) as unknown as v5.ToClient;
269
373
  case 3:
270
- return v3.decodeToClient(bytes) as unknown as v4.ToClient;
374
+ return v3.decodeToClient(bytes) as unknown as v5.ToClient;
271
375
  case 4:
272
- return v4.decodeToClient(bytes);
376
+ return v4.decodeToClient(bytes) as unknown as v5.ToClient;
377
+ case 5:
378
+ return v5.decodeToClient(bytes) as unknown as v6.ToClient;
379
+ case 6:
380
+ return v6.decodeToClient(bytes);
273
381
  default:
274
382
  throw new Error(`Unknown version ${version}`);
275
383
  }
@@ -278,8 +386,12 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
278
386
  v1ToClientToV2,
279
387
  v2ToClientToV3,
280
388
  v3ToClientToV4,
389
+ v4ToClientToV5,
390
+ v5ToClientToV6,
281
391
  ],
282
392
  serializeConverters: () => [
393
+ v6ToClientToV5,
394
+ v5ToClientToV4,
283
395
  v4ToClientToV3,
284
396
  v3ToClientToV2,
285
397
  v2ToClientToV1,
@@ -1,4 +1,5 @@
1
- export * from "@/common/bare/generated/inspector/v4";
1
+ export * from "@/common/bare/generated/inspector/v5";
2
+ export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
2
3
  export {
3
4
  decodeWorkflowHistoryTransport,
4
5
  encodeWorkflowHistoryTransport,
@@ -7,6 +8,3 @@ export {
7
8
  createWorkflowInspectorAdapter,
8
9
  type WorkflowInspectorAdapter,
9
10
  } from "@/workflow/inspector";
10
- export type {
11
- WorkflowHistory as TransportWorkflowHistory,
12
- } from "@/common/bare/transport/v1";
@@ -0,0 +1,61 @@
1
+ import type { JsonCompatValue } from "@/common/encoding";
2
+ import type { WorkflowHistoryBytes } from "@/common/inspector-transport";
3
+ import { encodeCborCompat } from "@/serde";
4
+ import { bufferToArrayBuffer } from "@/utils";
5
+
6
+ export type {
7
+ WorkflowBranchStatus,
8
+ WorkflowCbor,
9
+ WorkflowEntry,
10
+ WorkflowEntryKind,
11
+ WorkflowEntryMetadata,
12
+ WorkflowHistory,
13
+ WorkflowJoinEntry,
14
+ WorkflowLocation,
15
+ WorkflowLoopEntry,
16
+ WorkflowLoopIterationMarker,
17
+ WorkflowMessageEntry,
18
+ WorkflowNameIndex,
19
+ WorkflowPathSegment,
20
+ WorkflowRaceEntry,
21
+ WorkflowRemovedEntry,
22
+ WorkflowRollbackCheckpointEntry,
23
+ WorkflowSleepEntry,
24
+ WorkflowStepEntry,
25
+ WorkflowVersionCheckEntry,
26
+ } from "@/common/bare/transport/v1";
27
+ export {
28
+ WorkflowBranchStatusType,
29
+ WorkflowEntryStatus,
30
+ WorkflowSleepState,
31
+ } from "@/common/bare/transport/v1";
32
+ export type { WorkflowHistoryBytes } from "@/common/inspector-transport";
33
+ export {
34
+ decodeWorkflowHistoryTransport,
35
+ encodeWorkflowHistoryTransport,
36
+ } from "@/common/inspector-transport";
37
+
38
+ /** @experimental State exposed by a durable workflow run handler to the Inspector. */
39
+ export type WorkflowState =
40
+ | "pending"
41
+ | "running"
42
+ | "sleeping"
43
+ | "failed"
44
+ | "completed"
45
+ | "cancelled"
46
+ | "rolling_back";
47
+
48
+ /** @experimental The raw workflow Inspector adapter consumed by RivetKit's transport. */
49
+ export interface WorkflowInspectorAdapter {
50
+ getHistory: () => WorkflowHistoryBytes | null;
51
+ getState: () => Promise<WorkflowState | null>;
52
+ onHistoryUpdated: (
53
+ listener: (history: WorkflowHistoryBytes) => void,
54
+ ) => () => void;
55
+ replayFromStep: (entryId?: string) => Promise<WorkflowHistoryBytes | null>;
56
+ }
57
+
58
+ /** @experimental Encodes a workflow Inspector value with RivetKit's CBOR-compatible codec. */
59
+ export function encodeWorkflowInspectorValue(value: unknown): ArrayBuffer {
60
+ return bufferToArrayBuffer(encodeCborCompat(value as JsonCompatValue));
61
+ }