rivetkit 0.0.0-skip-ready-wait-flatten-client-options.1cae221 → 0.0.0-sqlite-uds.4e59a38

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 (253) hide show
  1. package/dist/browser/client.d.ts +561 -89
  2. package/dist/browser/client.js +1063 -430
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.d.ts +22 -2
  5. package/dist/browser/inspector/client.js +1036 -232
  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 +2218 -2082
  13. package/dist/tsup/agent-os/index.cjs.map +1 -1
  14. package/dist/tsup/agent-os/index.d.cts +556 -85
  15. package/dist/tsup/agent-os/index.d.ts +556 -85
  16. package/dist/tsup/agent-os/index.js +2220 -2084
  17. package/dist/tsup/agent-os/index.js.map +1 -1
  18. package/dist/tsup/{chunk-NFC5VU36.cjs → chunk-3GC3EP6D.cjs} +18 -10
  19. package/dist/tsup/chunk-3GC3EP6D.cjs.map +1 -0
  20. package/dist/tsup/{chunk-7MRGNVSR.js → chunk-3GLNEWGY.js} +78 -6
  21. package/dist/tsup/chunk-3GLNEWGY.js.map +1 -0
  22. package/dist/tsup/{chunk-V3QNBJ7N.cjs → chunk-4FC7TVS6.cjs} +35 -10
  23. package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
  24. package/dist/tsup/{chunk-POTPHU3P.cjs → chunk-62LSMTP2.cjs} +3 -3
  25. package/dist/tsup/{chunk-POTPHU3P.cjs.map → chunk-62LSMTP2.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-OIKOPSXQ.js → chunk-7IVUT2JT.js} +12 -4
  27. package/dist/tsup/chunk-7IVUT2JT.js.map +1 -0
  28. package/dist/tsup/{chunk-22XU3BVY.cjs → chunk-GEYQLGXC.cjs} +925 -328
  29. package/dist/tsup/chunk-GEYQLGXC.cjs.map +1 -0
  30. package/dist/tsup/{chunk-D2TLG75Y.cjs → chunk-GMN45CQ6.cjs} +10 -10
  31. package/dist/tsup/chunk-GMN45CQ6.cjs.map +1 -0
  32. package/dist/tsup/{chunk-3BFYSYRU.js → chunk-HXUEHHJF.js} +3 -2
  33. package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
  34. package/dist/tsup/{chunk-IOYKCB6Y.cjs → chunk-I336PMWT.cjs} +44 -9
  35. package/dist/tsup/chunk-I336PMWT.cjs.map +1 -0
  36. package/dist/tsup/{chunk-RZEJJJKU.js → chunk-IB73AMGJ.js} +42 -7
  37. package/dist/tsup/chunk-IB73AMGJ.js.map +1 -0
  38. package/dist/tsup/{chunk-4ZIWB4CQ.js → chunk-ITWJ6Y7G.js} +2 -2
  39. package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
  40. package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
  41. package/dist/tsup/{chunk-W54QCENI.js → chunk-KTNBYGRU.js} +134 -20
  42. package/dist/tsup/chunk-KTNBYGRU.js.map +1 -0
  43. package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-OAPVVVTX.cjs} +79 -7
  44. package/dist/tsup/chunk-OAPVVVTX.cjs.map +1 -0
  45. package/dist/tsup/{chunk-TPBHXFB2.cjs → chunk-OUDV3ITX.cjs} +138 -24
  46. package/dist/tsup/chunk-OUDV3ITX.cjs.map +1 -0
  47. package/dist/tsup/{chunk-XNZR7UD2.cjs → chunk-PRXTIERO.cjs} +90 -65
  48. package/dist/tsup/chunk-PRXTIERO.cjs.map +1 -0
  49. package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-VE2X4KMG.cjs} +3 -2
  50. package/dist/tsup/chunk-VE2X4KMG.cjs.map +1 -0
  51. package/dist/tsup/{chunk-KSG2COSQ.js → chunk-WRZEVVLL.js} +6 -6
  52. package/dist/tsup/chunk-WRZEVVLL.js.map +1 -0
  53. package/dist/tsup/{chunk-LNMB25HW.js → chunk-XAIMHUPG.js} +780 -183
  54. package/dist/tsup/chunk-XAIMHUPG.js.map +1 -0
  55. package/dist/tsup/{chunk-D4TSTM6C.js → chunk-XZ62SWSC.js} +83 -58
  56. package/dist/tsup/chunk-XZ62SWSC.js.map +1 -0
  57. package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
  58. package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
  59. package/dist/tsup/{chunk-K34B3OVG.js → chunk-ZZ3WBRPD.js} +34 -9
  60. package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
  61. package/dist/tsup/client/mod.cjs +9 -9
  62. package/dist/tsup/client/mod.cjs.map +1 -1
  63. package/dist/tsup/client/mod.d.cts +8 -9
  64. package/dist/tsup/client/mod.d.ts +8 -9
  65. package/dist/tsup/client/mod.js +8 -8
  66. package/dist/tsup/common/log.cjs +5 -3
  67. package/dist/tsup/common/log.cjs.map +1 -1
  68. package/dist/tsup/common/log.d.cts +5 -1
  69. package/dist/tsup/common/log.d.ts +5 -1
  70. package/dist/tsup/common/log.js +6 -4
  71. package/dist/tsup/common/websocket.cjs +4 -4
  72. package/dist/tsup/common/websocket.js +3 -3
  73. package/dist/tsup/{config-CRdGwwbr.d.cts → config-CxG53eQo.d.cts} +577 -36
  74. package/dist/tsup/{config-kxXbtrJU.d.ts → config-DLOxy81E.d.cts} +5 -5
  75. package/dist/tsup/{config-kxXbtrJU.d.cts → config-DLOxy81E.d.ts} +5 -5
  76. package/dist/tsup/{config-DIpBWm5C.d.ts → config-Ds6DCRhV.d.ts} +577 -36
  77. package/dist/tsup/context-8KlcOYIs.d.cts +129 -0
  78. package/dist/tsup/context-Cfbm4QLr.d.ts +129 -0
  79. package/dist/tsup/db/drizzle.cjs +151 -79
  80. package/dist/tsup/db/drizzle.cjs.map +1 -1
  81. package/dist/tsup/db/drizzle.d.cts +2 -2
  82. package/dist/tsup/db/drizzle.d.ts +2 -2
  83. package/dist/tsup/db/drizzle.js +151 -79
  84. package/dist/tsup/db/drizzle.js.map +1 -1
  85. package/dist/tsup/db/mod.cjs +79 -24
  86. package/dist/tsup/db/mod.cjs.map +1 -1
  87. package/dist/tsup/db/mod.d.cts +2 -2
  88. package/dist/tsup/db/mod.d.ts +2 -2
  89. package/dist/tsup/db/mod.js +78 -23
  90. package/dist/tsup/db/mod.js.map +1 -1
  91. package/dist/tsup/dynamic/mod.cjs +24 -0
  92. package/dist/tsup/dynamic/mod.cjs.map +1 -0
  93. package/dist/tsup/dynamic/mod.d.cts +37 -0
  94. package/dist/tsup/dynamic/mod.d.ts +37 -0
  95. package/dist/tsup/dynamic/mod.js +24 -0
  96. package/dist/tsup/dynamic/mod.js.map +1 -0
  97. package/dist/tsup/inspector/mod.cjs +47 -12
  98. package/dist/tsup/inspector/mod.cjs.map +1 -1
  99. package/dist/tsup/inspector/mod.d.cts +37 -15
  100. package/dist/tsup/inspector/mod.d.ts +37 -15
  101. package/dist/tsup/inspector/mod.js +46 -11
  102. package/dist/tsup/inspector/mod.js.map +1 -1
  103. package/dist/tsup/inspector-tab/mod.cjs +162 -0
  104. package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
  105. package/dist/tsup/inspector-tab/mod.d.cts +240 -0
  106. package/dist/tsup/inspector-tab/mod.d.ts +240 -0
  107. package/dist/tsup/inspector-tab/mod.js +162 -0
  108. package/dist/tsup/inspector-tab/mod.js.map +1 -0
  109. package/dist/tsup/mod.cjs +1078 -479
  110. package/dist/tsup/mod.cjs.map +1 -1
  111. package/dist/tsup/mod.d.cts +5 -6
  112. package/dist/tsup/mod.d.ts +5 -6
  113. package/dist/tsup/mod.js +996 -397
  114. package/dist/tsup/mod.js.map +1 -1
  115. package/dist/tsup/test/mod.cjs +21 -18
  116. package/dist/tsup/test/mod.cjs.map +1 -1
  117. package/dist/tsup/test/mod.d.cts +4 -5
  118. package/dist/tsup/test/mod.d.ts +4 -5
  119. package/dist/tsup/test/mod.js +18 -15
  120. package/dist/tsup/test/mod.js.map +1 -1
  121. package/dist/tsup/utils-CqDnC_PS.d.cts +104 -0
  122. package/dist/tsup/utils-CqDnC_PS.d.ts +104 -0
  123. package/dist/tsup/utils.cjs +3 -3
  124. package/dist/tsup/utils.d.cts +1 -1
  125. package/dist/tsup/utils.d.ts +1 -1
  126. package/dist/tsup/utils.js +2 -2
  127. package/dist/tsup/workflow/mod.cjs +386 -322
  128. package/dist/tsup/workflow/mod.cjs.map +1 -1
  129. package/dist/tsup/workflow/mod.d.cts +8 -9
  130. package/dist/tsup/workflow/mod.d.ts +8 -9
  131. package/dist/tsup/workflow/mod.js +363 -299
  132. package/dist/tsup/workflow/mod.js.map +1 -1
  133. package/package.json +35 -14
  134. package/src/actor/config.ts +188 -59
  135. package/src/actor/contexts/index.ts +7 -2
  136. package/src/actor/definition.ts +17 -19
  137. package/src/actor/driver.ts +3 -3
  138. package/src/actor/errors.ts +70 -7
  139. package/src/actor/instance/mod.ts +39 -56
  140. package/src/actor/keys.ts +2 -1
  141. package/src/actor/mod.ts +22 -20
  142. package/src/actor/schema.ts +2 -2
  143. package/src/agent-os/actor/index.ts +38 -18
  144. package/src/agent-os/actor/preview.ts +1 -2
  145. package/src/agent-os/actor/session.ts +2 -2
  146. package/src/agent-os/config.ts +1 -1
  147. package/src/agent-os/fs/database-vfs.ts +1 -1
  148. package/src/agent-os/index.ts +16 -15
  149. package/src/client/actor-common.ts +88 -62
  150. package/src/client/actor-conn.ts +58 -63
  151. package/src/client/actor-handle.ts +125 -71
  152. package/src/client/actor-query.ts +5 -5
  153. package/src/client/config.ts +3 -3
  154. package/src/client/errors.ts +2 -1
  155. package/src/client/lifecycle-errors.ts +2 -4
  156. package/src/client/query.ts +1 -1
  157. package/src/client/queue.ts +8 -3
  158. package/src/client/raw-utils.ts +10 -10
  159. package/src/client/resolve-gateway-target.ts +1 -1
  160. package/src/client/utils.ts +34 -10
  161. package/src/common/actor-router-consts.ts +7 -4
  162. package/src/common/actor-websocket.ts +3 -1
  163. package/src/common/bare/actor-persist/v1.ts +205 -163
  164. package/src/common/bare/actor-persist/v2.ts +265 -213
  165. package/src/common/bare/actor-persist/v3.ts +176 -172
  166. package/src/common/bare/actor-persist/v4.ts +254 -253
  167. package/src/common/bare/generated/client-protocol/v4.ts +599 -0
  168. package/src/common/bare/generated/inspector/v5.ts +1016 -0
  169. package/src/common/bare/transport/v1.ts +694 -542
  170. package/src/common/client-protocol-versioned.ts +176 -67
  171. package/src/common/client-protocol-zod.ts +7 -0
  172. package/src/common/client-protocol.ts +1 -1
  173. package/src/common/database/config.ts +16 -5
  174. package/src/common/database/mod.test.ts +83 -16
  175. package/src/common/database/mod.ts +86 -30
  176. package/src/common/database/native-database.test.ts +35 -22
  177. package/src/common/database/native-database.ts +26 -10
  178. package/src/common/database/shared.ts +1 -0
  179. package/src/common/encoding.ts +250 -16
  180. package/src/common/engine.ts +28 -1
  181. package/src/common/eventsource.ts +1 -1
  182. package/src/common/inline-websocket-adapter.ts +14 -13
  183. package/src/common/log.ts +15 -8
  184. package/src/common/router.ts +49 -23
  185. package/src/common/utils.ts +10 -202
  186. package/src/common/websocket-interface.ts +1 -1
  187. package/src/db/drizzle.ts +173 -96
  188. package/src/db/mod.ts +1 -1
  189. package/src/devtools-loader/index.ts +4 -7
  190. package/src/devtools-loader/serve-devtools.ts +26 -0
  191. package/src/drivers/engine/actor-driver.ts +76 -73
  192. package/src/dynamic/instance.ts +32 -0
  193. package/src/dynamic/internal.ts +50 -0
  194. package/src/dynamic/isolate-runtime.ts +66 -0
  195. package/src/dynamic/mod.ts +32 -0
  196. package/src/engine-client/actor-http-client.ts +6 -9
  197. package/src/engine-client/actor-websocket-client.ts +14 -13
  198. package/src/engine-client/api-endpoints.ts +51 -2
  199. package/src/engine-client/api-utils.ts +2 -2
  200. package/src/engine-client/driver.ts +3 -4
  201. package/src/engine-client/mod.ts +17 -10
  202. package/src/engine-client/ws-proxy.ts +9 -4
  203. package/src/inspector/client.browser.ts +66 -15
  204. package/src/inspector/mod.ts +2 -4
  205. package/src/inspector-tab/mod.ts +300 -0
  206. package/src/registry/config/envoy.ts +1 -2
  207. package/src/registry/config/index.ts +46 -20
  208. package/src/registry/index.ts +364 -87
  209. package/src/registry/napi-runtime.ts +97 -8
  210. package/src/registry/native-validation.ts +10 -12
  211. package/src/registry/native.ts +592 -343
  212. package/src/registry/process-metrics.ts +250 -0
  213. package/src/registry/runtime.ts +85 -6
  214. package/src/registry/wasm-runtime.ts +72 -3
  215. package/src/registry/write-through-proxy.ts +40 -0
  216. package/src/serde.ts +2 -2
  217. package/src/serverless/configure.ts +19 -8
  218. package/src/test/mod.ts +11 -8
  219. package/src/utils/crypto.ts +14 -0
  220. package/src/utils/endpoint-parser.ts +1 -1
  221. package/src/utils/env-vars.ts +37 -0
  222. package/src/utils/router.ts +1 -1
  223. package/src/utils.ts +1 -2
  224. package/src/workflow/context.ts +703 -240
  225. package/src/workflow/driver.ts +23 -12
  226. package/src/workflow/inspector.ts +12 -3
  227. package/src/workflow/mod.ts +37 -23
  228. package/dist/tsup/chunk-22XU3BVY.cjs.map +0 -1
  229. package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
  230. package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
  231. package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
  232. package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
  233. package/dist/tsup/chunk-D2TLG75Y.cjs.map +0 -1
  234. package/dist/tsup/chunk-D4TSTM6C.js.map +0 -1
  235. package/dist/tsup/chunk-IOYKCB6Y.cjs.map +0 -1
  236. package/dist/tsup/chunk-K34B3OVG.js.map +0 -1
  237. package/dist/tsup/chunk-KSG2COSQ.js.map +0 -1
  238. package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
  239. package/dist/tsup/chunk-LNMB25HW.js.map +0 -1
  240. package/dist/tsup/chunk-NFC5VU36.cjs.map +0 -1
  241. package/dist/tsup/chunk-OIKOPSXQ.js.map +0 -1
  242. package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
  243. package/dist/tsup/chunk-RZEJJJKU.js.map +0 -1
  244. package/dist/tsup/chunk-TPBHXFB2.cjs.map +0 -1
  245. package/dist/tsup/chunk-V3QNBJ7N.cjs.map +0 -1
  246. package/dist/tsup/chunk-W54QCENI.js.map +0 -1
  247. package/dist/tsup/chunk-XNZR7UD2.cjs.map +0 -1
  248. package/dist/tsup/context-B7G6sk7x.d.ts +0 -92
  249. package/dist/tsup/context-DzMRHkjC.d.cts +0 -92
  250. package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
  251. package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
  252. package/src/utils/serve.ts +0 -217
  253. /package/dist/tsup/{chunk-4ZIWB4CQ.js.map → chunk-ITWJ6Y7G.js.map} +0 -0
@@ -2,26 +2,24 @@ import {
2
2
  type ClientConfig,
3
3
  DEFAULT_MAX_QUERY_INPUT_SIZE,
4
4
  } from "@/client/config";
5
+ import type { ActorGatewayQuery, CrashPolicy } from "@/client/query";
5
6
  import {
7
+ WS_PROTOCOL_ACTOR,
6
8
  WS_PROTOCOL_CONN_PARAMS,
7
9
  WS_PROTOCOL_ENCODING,
8
10
  WS_PROTOCOL_STANDARD as WS_PROTOCOL_RIVETKIT,
11
+ WS_PROTOCOL_SKIP_READY_WAIT,
9
12
  WS_PROTOCOL_TARGET,
10
- WS_PROTOCOL_ACTOR,
11
- WS_PROTOCOL_BYPASS_CONNECTABLE,
12
13
  WS_PROTOCOL_TEST_ACK_HOOK,
13
14
  WS_PROTOCOL_TOKEN,
14
15
  } from "@/common/actor-router-consts";
16
+ import type { JsonCompatValue } from "@/common/encoding";
15
17
  import { importWebSocket } from "@/common/websocket";
16
18
  import { setRemoteHibernatableWebSocketAckTestHooks } from "@/common/websocket-test-hooks";
17
- import type { ActorGatewayQuery, CrashPolicy } from "@/client/query";
18
19
  import type { Encoding, UniversalWebSocket } from "@/mod";
19
20
  import { encodeCborCompat, uint8ArrayToBase64 } from "@/serde";
20
21
  import { combineUrlPath } from "@/utils";
21
- import {
22
- shouldBypassConnectable,
23
- type GatewayRequestOptions,
24
- } from "./driver";
22
+ import { type GatewayRequestOptions, shouldSkipReadyWait } from "./driver";
25
23
  import { logger } from "./log";
26
24
 
27
25
  class BufferedRemoteWebSocket implements UniversalWebSocket {
@@ -272,8 +270,8 @@ export function buildActorQueryGatewayUrl(
272
270
  if (token !== undefined) {
273
271
  params.append("rvt-token", token);
274
272
  }
275
- if (shouldBypassConnectable(options)) {
276
- params.append("rvt-bypass_connectable", "true");
273
+ if (shouldSkipReadyWait(options)) {
274
+ params.append("rvt-skip-ready-wait", "true");
277
275
  }
278
276
 
279
277
  const queryString = params.toString();
@@ -305,7 +303,7 @@ function pushInputQueryParam(
305
303
  return;
306
304
  }
307
305
 
308
- const encodedInput = encodeCborCompat(input);
306
+ const encodedInput = encodeCborCompat(input as JsonCompatValue);
309
307
  if (encodedInput.byteLength > maxInputSize) {
310
308
  throw new Error(
311
309
  `Actor query input exceeds maxInputSize (${encodedInput.byteLength} > ${maxInputSize} bytes). Increase client maxInputSize to allow larger query payloads.`,
@@ -378,7 +376,7 @@ export async function openWebSocketToGateway(
378
376
  }
379
377
 
380
378
  export function buildWebSocketProtocols(
381
- _runConfig: ClientConfig,
379
+ runConfig: ClientConfig,
382
380
  encoding: Encoding,
383
381
  params?: unknown,
384
382
  ackHookToken?: string,
@@ -394,9 +392,12 @@ export function buildWebSocketProtocols(
394
392
  if (target) {
395
393
  protocols.push(`${WS_PROTOCOL_TARGET}${target.target}`);
396
394
  protocols.push(`${WS_PROTOCOL_ACTOR}${target.actorId}`);
395
+ if (runConfig.token) {
396
+ protocols.push(`${WS_PROTOCOL_TOKEN}${runConfig.token}`);
397
+ }
397
398
  }
398
- if (shouldBypassConnectable(options)) {
399
- protocols.push(WS_PROTOCOL_BYPASS_CONNECTABLE);
399
+ if (shouldSkipReadyWait(options)) {
400
+ protocols.push(WS_PROTOCOL_SKIP_READY_WAIT);
400
401
  }
401
402
  if (params) {
402
403
  protocols.push(
@@ -107,12 +107,59 @@ export async function getDatacenters(
107
107
  return apiCall<never, DatacentersResponse>(config, "GET", `/datacenters`);
108
108
  }
109
109
 
110
+ // MARK: Get runner configs
111
+ export interface RunnerConfig {
112
+ normal?: {
113
+ drain_on_version_upgrade?: boolean;
114
+ actor_eviction_period?: number;
115
+ actor_eviction_rate?: number;
116
+ };
117
+ serverless?: {
118
+ url: string;
119
+ headers: Record<string, string>;
120
+ drain_grace_period?: number;
121
+ max_runners: number;
122
+ min_runners: number;
123
+ request_lifespan: number;
124
+ runners_margin: number;
125
+ slots_per_runner: number;
126
+ metadata_poll_interval?: number;
127
+ drain_on_version_upgrade?: boolean;
128
+ actor_eviction_period?: number;
129
+ actor_eviction_rate?: number;
130
+ };
131
+ protocol_version?: number;
132
+ }
133
+
134
+ export interface RunnerConfigDatacenters {
135
+ datacenters: Record<string, RunnerConfig>;
136
+ }
137
+
138
+ export interface RunnerConfigsResponse {
139
+ runner_configs: Record<string, RunnerConfigDatacenters>;
140
+ }
141
+
142
+ export async function getRunnerConfig(
143
+ config: ClientConfig,
144
+ name: string,
145
+ ): Promise<RunnerConfigsResponse> {
146
+ return apiCall<never, RunnerConfigsResponse>(
147
+ config,
148
+ "GET",
149
+ `/runner-configs?runner_name=${name}`,
150
+ );
151
+ }
152
+
110
153
  // MARK: Update runner config
111
154
  export interface RegistryConfigRequest {
112
155
  datacenters: Record<
113
156
  string,
114
157
  {
115
- normal?: Record<string, unknown>;
158
+ normal?: {
159
+ drain_on_version_upgrade?: boolean;
160
+ actor_eviction_period?: number;
161
+ actor_eviction_rate?: number;
162
+ };
116
163
  serverless?: {
117
164
  url: string;
118
165
  headers: Record<string, string>;
@@ -123,9 +170,11 @@ export interface RegistryConfigRequest {
123
170
  runners_margin: number;
124
171
  slots_per_runner: number;
125
172
  metadata_poll_interval?: number;
173
+ drain_on_version_upgrade?: boolean;
174
+ actor_eviction_period?: number;
175
+ actor_eviction_rate?: number;
126
176
  };
127
177
  metadata?: Record<string, unknown>;
128
- drain_on_version_upgrade?: boolean;
129
178
  }
130
179
  >;
131
180
  }
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod/v4";
2
+ import { RivetError } from "@/actor/errors";
2
3
  import type { ClientConfig } from "@/client/config";
3
4
  import { sendHttpRequest } from "@/client/utils";
4
- import { RivetError } from "@/actor/errors";
5
+ import type { RegistryConfig } from "@/registry/config";
5
6
  import { combineUrlPath } from "@/utils";
6
7
  import { logger } from "./log";
7
- import { RegistryConfig } from "@/registry/config";
8
8
 
9
9
  export { RivetError as EngineApiError };
10
10
 
@@ -1,20 +1,19 @@
1
1
  import type { Hono, Context as HonoContext } from "hono";
2
2
  import type { ActorKey, Encoding, UniversalWebSocket } from "@/actor/mod";
3
+ import type { ActorQuery, CrashPolicy } from "@/client/query";
3
4
  import type { RegistryConfig } from "@/registry/config";
4
5
  import type { GetUpgradeWebSocket } from "@/utils";
5
- import type { ActorQuery, CrashPolicy } from "@/client/query";
6
6
 
7
7
  export type GatewayTarget = { directId: string } | ActorQuery;
8
8
 
9
9
  export interface GatewayRequestOptions {
10
- bypassConnectable?: boolean;
11
10
  skipReadyWait?: boolean;
12
11
  }
13
12
 
14
- export function shouldBypassConnectable(
13
+ export function shouldSkipReadyWait(
15
14
  options: GatewayRequestOptions = {},
16
15
  ): boolean {
17
- return options.bypassConnectable === true || options.skipReadyWait === true;
16
+ return options.skipReadyWait === true;
18
17
  }
19
18
 
20
19
  export interface EngineControlClient {
@@ -7,9 +7,9 @@ import {
7
7
  PATH_WEBSOCKET_BASE,
8
8
  PATH_WEBSOCKET_PREFIX,
9
9
  } from "@/common/actor-router-consts";
10
+ import type { JsonCompatValue } from "@/common/encoding";
10
11
  import { noopNext } from "@/common/utils";
11
12
  import type { Actor as ApiActor } from "@/engine-api/actors";
12
- import { shouldBypassConnectable } from "@/engine-client/driver";
13
13
  import type {
14
14
  ActorOutput,
15
15
  CreateInput,
@@ -22,6 +22,7 @@ import type {
22
22
  ListActorsInput,
23
23
  RuntimeDisplayInformation,
24
24
  } from "@/engine-client/driver";
25
+ import { shouldSkipReadyWait } from "@/engine-client/driver";
25
26
  import type { Encoding, UniversalWebSocket } from "@/mod";
26
27
  import { encodeCborCompat, uint8ArrayToBase64 } from "@/serde";
27
28
  import { combineUrlPath, type GetUpgradeWebSocket } from "@/utils";
@@ -181,7 +182,9 @@ export class RemoteEngineControlClient implements EngineControlClient {
181
182
  key: serializeActorKey(key),
182
183
  runner_name_selector: this.#config.poolName,
183
184
  input: actorInput
184
- ? uint8ArrayToBase64(encodeCborCompat(actorInput))
185
+ ? uint8ArrayToBase64(
186
+ encodeCborCompat(actorInput as JsonCompatValue),
187
+ )
185
188
  : undefined,
186
189
  crash_policy: crashPolicy ?? "sleep",
187
190
  });
@@ -215,7 +218,7 @@ export class RemoteEngineControlClient implements EngineControlClient {
215
218
  runner_name_selector: this.#config.poolName,
216
219
  key: serializeActorKey(key),
217
220
  input: input
218
- ? uint8ArrayToBase64(encodeCborCompat(input))
221
+ ? uint8ArrayToBase64(encodeCborCompat(input as JsonCompatValue))
219
222
  : undefined,
220
223
  crash_policy: crashPolicy ?? "sleep",
221
224
  });
@@ -265,7 +268,7 @@ export class RemoteEngineControlClient implements EngineControlClient {
265
268
  );
266
269
  const httpOptions = {
267
270
  ...options,
268
- directActorId: shouldBypassConnectable(options)
271
+ directActorId: shouldSkipReadyWait(options)
269
272
  ? directActorIdFromTarget(target)
270
273
  : undefined,
271
274
  };
@@ -300,7 +303,7 @@ export class RemoteEngineControlClient implements EngineControlClient {
300
303
  params,
301
304
  {
302
305
  ...options,
303
- directActorId: shouldBypassConnectable(options)
306
+ directActorId: shouldSkipReadyWait(options)
304
307
  ? directActorIdFromTarget(target)
305
308
  : undefined,
306
309
  },
@@ -425,9 +428,9 @@ export class RemoteEngineControlClient implements EngineControlClient {
425
428
  const endpoint = getEndpoint(this.#config);
426
429
 
427
430
  if (
428
- shouldBypassConnectable(options) &&
431
+ shouldSkipReadyWait(options) &&
429
432
  directActorIdFromTarget(target) &&
430
- canUseDirectBypassPath(path)
433
+ canUseDirectSkipReadyWaitPath(path)
431
434
  ) {
432
435
  return combineUrlPath(endpoint, path);
433
436
  }
@@ -476,15 +479,19 @@ export class RemoteEngineControlClient implements EngineControlClient {
476
479
  }
477
480
  }
478
481
 
479
- function canUseDirectBypassPath(path: string): boolean {
482
+ function canUseDirectSkipReadyWaitPath(path: string): boolean {
480
483
  return (
481
484
  isActorHttpRequestPath(path) ||
482
- path === PATH_CONNECT ||
483
- path === PATH_WEBSOCKET_BASE ||
485
+ isPathOrQuery(path, PATH_CONNECT) ||
486
+ isPathOrQuery(path, PATH_WEBSOCKET_BASE) ||
484
487
  path.startsWith(PATH_WEBSOCKET_PREFIX)
485
488
  );
486
489
  }
487
490
 
491
+ function isPathOrQuery(path: string, basePath: string): boolean {
492
+ return path === basePath || path.startsWith(`${basePath}?`);
493
+ }
494
+
488
495
  function isActorHttpRequestPath(path: string): boolean {
489
496
  const stripped = path.slice("/request".length);
490
497
  return (
@@ -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) {
@@ -3,16 +3,17 @@ 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";
6
7
  import {
7
8
  decodeWorkflowHistoryTransport,
8
9
  encodeWorkflowHistoryTransport,
9
10
  } from "@/common/inspector-transport";
10
11
 
11
- export * from "@/common/bare/generated/inspector/v4";
12
+ export * from "@/common/bare/generated/inspector/v5";
12
13
  export { decodeWorkflowHistoryTransport, encodeWorkflowHistoryTransport };
13
14
  export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
14
15
 
15
- export const CURRENT_VERSION = 4;
16
+ export const CURRENT_VERSION = 5;
16
17
 
17
18
  const EVENTS_DROPPED_ERROR = "inspector.events_dropped";
18
19
  const WORKFLOW_HISTORY_DROPPED_ERROR = "inspector.workflow_history_dropped";
@@ -156,6 +157,42 @@ const v4ToClientToV3 = (v4Data: v4.ToClient): v3.ToClient => {
156
157
  return v4Data as unknown as v3.ToClient;
157
158
  };
158
159
 
160
+ const v4ToClientToV5 = (v4Data: v4.ToClient): v5.ToClient => {
161
+ if (v4Data.body.tag === "Init") {
162
+ // A v4 runtime predates tab config in Init; default to an empty list.
163
+ // The client reads that as "no custom tabs" (built-in tabs only).
164
+ const init = v4Data.body.val;
165
+ return {
166
+ body: {
167
+ tag: "Init",
168
+ val: { ...init, tabConfig: [] },
169
+ },
170
+ };
171
+ }
172
+
173
+ return v4Data as unknown as v5.ToClient;
174
+ };
175
+
176
+ const v5ToClientToV4 = (v5Data: v5.ToClient): v4.ToClient => {
177
+ if (v5Data.body.tag === "Init") {
178
+ const { tabConfig: _tabConfig, ...rest } = v5Data.body.val;
179
+ return {
180
+ body: {
181
+ tag: "Init",
182
+ val: rest,
183
+ },
184
+ };
185
+ }
186
+
187
+ return v5Data as unknown as v4.ToClient;
188
+ };
189
+
190
+ const v4ToServerToV5 = (v4Data: v4.ToServer): v5.ToServer =>
191
+ v4Data as unknown as v5.ToServer;
192
+
193
+ const v5ToServerToV4 = (v5Data: v5.ToServer): v4.ToServer =>
194
+ v5Data as unknown as v4.ToServer;
195
+
159
196
  const v1ToServerToV2 = (v1Data: v1.ToServer): v2.ToServer => {
160
197
  if (
161
198
  v1Data.body.tag === "EventsRequest" ||
@@ -198,13 +235,15 @@ const v3ToServerToV4 = (v3Data: v3.ToServer): v4.ToServer =>
198
235
 
199
236
  const v4ToServerToV3 = (v4Data: v4.ToServer): v3.ToServer => {
200
237
  if (v4Data.body.tag === "WorkflowReplayRequest") {
201
- throw new Error("Cannot convert v4-only workflow replay requests to v3");
238
+ throw new Error(
239
+ "Cannot convert v4-only workflow replay requests to v3",
240
+ );
202
241
  }
203
242
 
204
243
  return v4Data as unknown as v3.ToServer;
205
244
  };
206
245
 
207
- export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
246
+ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v5.ToServer>({
208
247
  serializeVersion: (data, version) => {
209
248
  switch (version) {
210
249
  case 1:
@@ -214,7 +253,9 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
214
253
  case 3:
215
254
  return v3.encodeToServer(data as unknown as v3.ToServer);
216
255
  case 4:
217
- return v4.encodeToServer(data);
256
+ return v4.encodeToServer(data as unknown as v4.ToServer);
257
+ case 5:
258
+ return v5.encodeToServer(data);
218
259
  default:
219
260
  throw new Error(`Unknown version ${version}`);
220
261
  }
@@ -222,13 +263,15 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
222
263
  deserializeVersion: (bytes, version) => {
223
264
  switch (version) {
224
265
  case 1:
225
- return v1.decodeToServer(bytes) as unknown as v4.ToServer;
266
+ return v1.decodeToServer(bytes) as unknown as v5.ToServer;
226
267
  case 2:
227
- return v2.decodeToServer(bytes) as unknown as v4.ToServer;
268
+ return v2.decodeToServer(bytes) as unknown as v5.ToServer;
228
269
  case 3:
229
- return v3.decodeToServer(bytes) as unknown as v4.ToServer;
270
+ return v3.decodeToServer(bytes) as unknown as v5.ToServer;
230
271
  case 4:
231
- return v4.decodeToServer(bytes);
272
+ return v4.decodeToServer(bytes) as unknown as v5.ToServer;
273
+ case 5:
274
+ return v5.decodeToServer(bytes);
232
275
  default:
233
276
  throw new Error(`Unknown version ${version}`);
234
277
  }
@@ -237,15 +280,17 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
237
280
  v1ToServerToV2,
238
281
  v2ToServerToV3,
239
282
  v3ToServerToV4,
283
+ v4ToServerToV5,
240
284
  ],
241
285
  serializeConverters: () => [
286
+ v5ToServerToV4,
242
287
  v4ToServerToV3,
243
288
  v3ToServerToV2,
244
289
  v2ToServerToV1,
245
290
  ],
246
291
  });
247
292
 
248
- export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
293
+ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v5.ToClient>({
249
294
  serializeVersion: (data, version) => {
250
295
  switch (version) {
251
296
  case 1:
@@ -255,7 +300,9 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
255
300
  case 3:
256
301
  return v3.encodeToClient(data as unknown as v3.ToClient);
257
302
  case 4:
258
- return v4.encodeToClient(data);
303
+ return v4.encodeToClient(data as unknown as v4.ToClient);
304
+ case 5:
305
+ return v5.encodeToClient(data);
259
306
  default:
260
307
  throw new Error(`Unknown version ${version}`);
261
308
  }
@@ -263,13 +310,15 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
263
310
  deserializeVersion: (bytes, version) => {
264
311
  switch (version) {
265
312
  case 1:
266
- return v1.decodeToClient(bytes) as unknown as v4.ToClient;
313
+ return v1.decodeToClient(bytes) as unknown as v5.ToClient;
267
314
  case 2:
268
- return v2.decodeToClient(bytes) as unknown as v4.ToClient;
315
+ return v2.decodeToClient(bytes) as unknown as v5.ToClient;
269
316
  case 3:
270
- return v3.decodeToClient(bytes) as unknown as v4.ToClient;
317
+ return v3.decodeToClient(bytes) as unknown as v5.ToClient;
271
318
  case 4:
272
- return v4.decodeToClient(bytes);
319
+ return v4.decodeToClient(bytes) as unknown as v5.ToClient;
320
+ case 5:
321
+ return v5.decodeToClient(bytes);
273
322
  default:
274
323
  throw new Error(`Unknown version ${version}`);
275
324
  }
@@ -278,8 +327,10 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
278
327
  v1ToClientToV2,
279
328
  v2ToClientToV3,
280
329
  v3ToClientToV4,
330
+ v4ToClientToV5,
281
331
  ],
282
332
  serializeConverters: () => [
333
+ v5ToClientToV4,
283
334
  v4ToClientToV3,
284
335
  v3ToClientToV2,
285
336
  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";