rivetkit 2.0.42 → 2.1.0-rc.1

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 (322) hide show
  1. package/dist/{tsup/config-CLnylLYY.d.ts → browser/client.d.ts} +2127 -1910
  2. package/dist/browser/client.js +5182 -0
  3. package/dist/browser/client.js.map +1 -0
  4. package/dist/browser/inspector/client.d.ts +130 -0
  5. package/dist/browser/inspector/client.js +2854 -0
  6. package/dist/browser/inspector/client.js.map +1 -0
  7. package/dist/browser/v3-DnYObHH3.d.ts +279 -0
  8. package/dist/schemas/actor-inspector/v2.ts +796 -0
  9. package/dist/schemas/actor-inspector/v3.ts +899 -0
  10. package/dist/schemas/actor-persist/v4.ts +406 -0
  11. package/dist/schemas/client-protocol/v3.ts +554 -0
  12. package/dist/schemas/persist/v1.ts +781 -0
  13. package/dist/schemas/transport/v1.ts +697 -0
  14. package/dist/tsup/actor/errors.cjs +27 -3
  15. package/dist/tsup/actor/errors.cjs.map +1 -1
  16. package/dist/tsup/actor/errors.d.cts +37 -1
  17. package/dist/tsup/actor/errors.d.ts +37 -1
  18. package/dist/tsup/actor/errors.js +26 -1
  19. package/dist/tsup/{actor-router-consts-DzI2szci.d.cts → actor-router-consts-D29T1Z-K.d.cts} +1 -1
  20. package/dist/tsup/{actor-router-consts-DzI2szci.d.ts → actor-router-consts-D29T1Z-K.d.ts} +1 -1
  21. package/dist/tsup/chunk-424PT5DM.js +23 -0
  22. package/dist/tsup/chunk-424PT5DM.js.map +1 -0
  23. package/dist/tsup/{chunk-JDAD2YFA.js → chunk-5ESWDTHJ.js} +148 -273
  24. package/dist/tsup/chunk-5ESWDTHJ.js.map +1 -0
  25. package/dist/tsup/{chunk-FJ3KTN4V.js → chunk-6LIBPELE.js} +119 -11
  26. package/dist/tsup/chunk-6LIBPELE.js.map +1 -0
  27. package/dist/tsup/chunk-6LJAZ5R4.cjs +96 -0
  28. package/dist/tsup/chunk-6LJAZ5R4.cjs.map +1 -0
  29. package/dist/tsup/{chunk-LFVF5SCU.js → chunk-7HTNH26M.js} +126 -1
  30. package/dist/tsup/chunk-7HTNH26M.js.map +1 -0
  31. package/dist/tsup/chunk-7K4CYDGD.js +630 -0
  32. package/dist/tsup/chunk-7K4CYDGD.js.map +1 -0
  33. package/dist/tsup/{chunk-XXGJCOL6.js → chunk-A6YIZWTK.js} +2 -2
  34. package/dist/tsup/chunk-AIYEYMX5.cjs +630 -0
  35. package/dist/tsup/chunk-AIYEYMX5.cjs.map +1 -0
  36. package/dist/tsup/{chunk-Q6W7RJJP.js → chunk-DIGBC2VI.js} +211 -2316
  37. package/dist/tsup/chunk-DIGBC2VI.js.map +1 -0
  38. package/dist/tsup/{chunk-RZW2DNND.cjs → chunk-F6JYU5IK.cjs} +1957 -1039
  39. package/dist/tsup/chunk-F6JYU5IK.cjs.map +1 -0
  40. package/dist/tsup/chunk-HAZL2EPK.cjs +534 -0
  41. package/dist/tsup/chunk-HAZL2EPK.cjs.map +1 -0
  42. package/dist/tsup/chunk-HDQ2JUQT.cjs +23 -0
  43. package/dist/tsup/chunk-HDQ2JUQT.cjs.map +1 -0
  44. package/dist/tsup/chunk-HIDX4C5Y.cjs +1036 -0
  45. package/dist/tsup/chunk-HIDX4C5Y.cjs.map +1 -0
  46. package/dist/tsup/chunk-IVG73YCW.js +534 -0
  47. package/dist/tsup/chunk-IVG73YCW.js.map +1 -0
  48. package/dist/tsup/chunk-KJSYAUOM.js +96 -0
  49. package/dist/tsup/chunk-KJSYAUOM.js.map +1 -0
  50. package/dist/tsup/{chunk-2XQS746M.cjs → chunk-L47L3ZWJ.cjs} +127 -2
  51. package/dist/tsup/chunk-L47L3ZWJ.cjs.map +1 -0
  52. package/dist/tsup/{chunk-H4TB4X25.cjs → chunk-LW6KLR7A.cjs} +126 -18
  53. package/dist/tsup/chunk-LW6KLR7A.cjs.map +1 -0
  54. package/dist/tsup/chunk-LXUQ667X.js +2006 -0
  55. package/dist/tsup/chunk-LXUQ667X.js.map +1 -0
  56. package/dist/tsup/{chunk-GMAVRZSF.js → chunk-M2T62AZQ.js} +1790 -872
  57. package/dist/tsup/chunk-M2T62AZQ.js.map +1 -0
  58. package/dist/tsup/chunk-MZ37VV3P.js +5974 -0
  59. package/dist/tsup/chunk-MZ37VV3P.js.map +1 -0
  60. package/dist/tsup/chunk-N4KRDJ56.js +72 -0
  61. package/dist/tsup/chunk-N4KRDJ56.js.map +1 -0
  62. package/dist/tsup/chunk-NIYZDWMW.cjs +2006 -0
  63. package/dist/tsup/chunk-NIYZDWMW.cjs.map +1 -0
  64. package/dist/tsup/chunk-OMEPCQK2.js +649 -0
  65. package/dist/tsup/chunk-OMEPCQK2.js.map +1 -0
  66. package/dist/tsup/chunk-SR3KQE7Q.cjs +72 -0
  67. package/dist/tsup/chunk-SR3KQE7Q.cjs.map +1 -0
  68. package/dist/tsup/chunk-SSEP6DHP.cjs +2657 -0
  69. package/dist/tsup/chunk-SSEP6DHP.cjs.map +1 -0
  70. package/dist/tsup/chunk-T5YCUGVS.js +1036 -0
  71. package/dist/tsup/chunk-T5YCUGVS.js.map +1 -0
  72. package/dist/tsup/{chunk-EJVBH5VF.cjs → chunk-TPGXWFQT.cjs} +3 -3
  73. package/dist/tsup/{chunk-EJVBH5VF.cjs.map → chunk-TPGXWFQT.cjs.map} +1 -1
  74. package/dist/tsup/{chunk-X35U3YNX.cjs → chunk-TYLXNCA5.cjs} +214 -339
  75. package/dist/tsup/chunk-TYLXNCA5.cjs.map +1 -0
  76. package/dist/tsup/chunk-VKVNIQRQ.js +257 -0
  77. package/dist/tsup/chunk-VKVNIQRQ.js.map +1 -0
  78. package/dist/tsup/chunk-XWBAQO5H.cjs +649 -0
  79. package/dist/tsup/chunk-XWBAQO5H.cjs.map +1 -0
  80. package/dist/tsup/chunk-YQ4LDVD6.cjs +5974 -0
  81. package/dist/tsup/chunk-YQ4LDVD6.cjs.map +1 -0
  82. package/dist/tsup/chunk-ZFY5J2EP.cjs +257 -0
  83. package/dist/tsup/chunk-ZFY5J2EP.cjs.map +1 -0
  84. package/dist/tsup/client/mod.cjs +9 -10
  85. package/dist/tsup/client/mod.cjs.map +1 -1
  86. package/dist/tsup/client/mod.d.cts +11 -5
  87. package/dist/tsup/client/mod.d.ts +11 -5
  88. package/dist/tsup/client/mod.js +8 -8
  89. package/dist/tsup/common/log.cjs +4 -4
  90. package/dist/tsup/common/log.d.cts +2 -2
  91. package/dist/tsup/common/log.d.ts +2 -2
  92. package/dist/tsup/common/log.js +3 -2
  93. package/dist/tsup/common/websocket.cjs +5 -5
  94. package/dist/tsup/common/websocket.js +4 -3
  95. package/dist/tsup/config-BFqid9Gr.d.ts +2574 -0
  96. package/dist/tsup/config-BiNoIHRs.d.cts +80 -0
  97. package/dist/tsup/config-BiNoIHRs.d.ts +80 -0
  98. package/dist/tsup/{config-CZB2-W8x.d.cts → config-CAZphOS1.d.cts} +681 -355
  99. package/dist/tsup/db/drizzle/mod.cjs +49 -0
  100. package/dist/tsup/db/drizzle/mod.cjs.map +1 -0
  101. package/dist/tsup/db/drizzle/mod.d.cts +17 -0
  102. package/dist/tsup/db/drizzle/mod.d.ts +17 -0
  103. package/dist/tsup/db/drizzle/mod.js +49 -0
  104. package/dist/tsup/db/drizzle/mod.js.map +1 -0
  105. package/dist/tsup/db/mod.cjs +9 -0
  106. package/dist/tsup/db/mod.cjs.map +1 -0
  107. package/dist/tsup/db/mod.d.cts +9 -0
  108. package/dist/tsup/db/mod.d.ts +9 -0
  109. package/dist/tsup/db/mod.js +9 -0
  110. package/dist/tsup/db/mod.js.map +1 -0
  111. package/dist/tsup/{driver-D0QX9M11.d.ts → driver-Bxv62E2p.d.ts} +2 -2
  112. package/dist/tsup/{driver-q-zqG7fc.d.cts → driver-DYXwJR5D.d.cts} +2 -2
  113. package/dist/tsup/driver-helpers/mod.cjs +12 -6
  114. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  115. package/dist/tsup/driver-helpers/mod.d.cts +12 -5
  116. package/dist/tsup/driver-helpers/mod.d.ts +12 -5
  117. package/dist/tsup/driver-helpers/mod.js +12 -5
  118. package/dist/tsup/driver-test-suite/mod.cjs +1370 -116
  119. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  120. package/dist/tsup/driver-test-suite/mod.d.cts +10 -4
  121. package/dist/tsup/driver-test-suite/mod.d.ts +10 -4
  122. package/dist/tsup/driver-test-suite/mod.js +2093 -838
  123. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  124. package/dist/tsup/inspector/mod.cjs +29 -3
  125. package/dist/tsup/inspector/mod.cjs.map +1 -1
  126. package/dist/tsup/inspector/mod.d.cts +124 -3
  127. package/dist/tsup/inspector/mod.d.ts +124 -3
  128. package/dist/tsup/inspector/mod.js +72 -45
  129. package/dist/tsup/keys-CydblqMh.d.cts +13 -0
  130. package/dist/tsup/keys-CydblqMh.d.ts +13 -0
  131. package/dist/tsup/mod.cjs +16 -10
  132. package/dist/tsup/mod.cjs.map +1 -1
  133. package/dist/tsup/mod.d.cts +26 -14
  134. package/dist/tsup/mod.d.ts +26 -14
  135. package/dist/tsup/mod.js +20 -13
  136. package/dist/tsup/serve-test-suite/mod.cjs +1165 -83
  137. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
  138. package/dist/tsup/serve-test-suite/mod.js +1114 -29
  139. package/dist/tsup/serve-test-suite/mod.js.map +1 -1
  140. package/dist/tsup/test/mod.cjs +84 -11
  141. package/dist/tsup/test/mod.cjs.map +1 -1
  142. package/dist/tsup/test/mod.d.cts +10 -5
  143. package/dist/tsup/test/mod.d.ts +10 -5
  144. package/dist/tsup/test/mod.js +85 -11
  145. package/dist/tsup/test/mod.js.map +1 -1
  146. package/dist/tsup/utils.cjs +10 -4
  147. package/dist/tsup/utils.cjs.map +1 -1
  148. package/dist/tsup/utils.d.cts +72 -2
  149. package/dist/tsup/utils.d.ts +72 -2
  150. package/dist/tsup/utils.js +9 -2
  151. package/dist/tsup/v3-DnYObHH3.d.cts +279 -0
  152. package/dist/tsup/v3-DnYObHH3.d.ts +279 -0
  153. package/dist/tsup/workflow/mod.cjs +16 -0
  154. package/dist/tsup/workflow/mod.cjs.map +1 -0
  155. package/dist/tsup/workflow/mod.d.cts +83 -0
  156. package/dist/tsup/workflow/mod.d.ts +83 -0
  157. package/dist/tsup/workflow/mod.js +16 -0
  158. package/dist/tsup/workflow/mod.js.map +1 -0
  159. package/package.json +62 -5
  160. package/src/actor/config.ts +478 -68
  161. package/src/actor/conn/mod.ts +68 -16
  162. package/src/actor/conn/state-manager.ts +2 -2
  163. package/src/actor/contexts/action.ts +20 -12
  164. package/src/actor/contexts/base/actor.ts +137 -7
  165. package/src/actor/contexts/base/conn-init.ts +27 -7
  166. package/src/actor/contexts/base/conn.ts +27 -18
  167. package/src/actor/contexts/before-action-response.ts +9 -2
  168. package/src/actor/contexts/before-connect.ts +7 -2
  169. package/src/actor/contexts/connect.ts +9 -2
  170. package/src/actor/contexts/create-conn-state.ts +7 -2
  171. package/src/actor/contexts/create-vars.ts +16 -3
  172. package/src/actor/contexts/create.ts +16 -3
  173. package/src/actor/contexts/destroy.ts +9 -3
  174. package/src/actor/contexts/disconnect.ts +10 -4
  175. package/src/actor/contexts/index.ts +4 -3
  176. package/src/actor/contexts/request.ts +23 -6
  177. package/src/actor/contexts/run.ts +47 -0
  178. package/src/actor/contexts/sleep.ts +9 -3
  179. package/src/actor/contexts/state-change.ts +9 -3
  180. package/src/actor/contexts/wake.ts +9 -3
  181. package/src/actor/contexts/websocket.ts +23 -6
  182. package/src/actor/database.ts +8 -18
  183. package/src/actor/definition.ts +20 -6
  184. package/src/actor/driver.ts +32 -3
  185. package/src/actor/errors.ts +127 -0
  186. package/src/actor/instance/connection-manager.ts +183 -80
  187. package/src/actor/instance/event-manager.ts +26 -15
  188. package/src/actor/instance/keys.ts +117 -0
  189. package/src/actor/instance/mod.ts +784 -174
  190. package/src/actor/instance/queue-manager.ts +603 -0
  191. package/src/actor/instance/queue.ts +287 -0
  192. package/src/actor/instance/schedule-manager.ts +49 -7
  193. package/src/actor/instance/state-manager.ts +35 -11
  194. package/src/actor/instance/traces-driver.ts +128 -0
  195. package/src/actor/mod.ts +26 -2
  196. package/src/actor/protocol/old.ts +28 -13
  197. package/src/actor/protocol/serde.ts +1 -1
  198. package/src/actor/router-endpoints.ts +177 -21
  199. package/src/actor/router-websocket-endpoints.ts +18 -29
  200. package/src/actor/router.ts +177 -0
  201. package/src/actor/schema.ts +291 -0
  202. package/src/actor/utils.ts +40 -0
  203. package/src/client/actor-common.ts +1 -1
  204. package/src/client/actor-conn.ts +100 -33
  205. package/src/client/actor-handle.ts +61 -33
  206. package/src/client/client.ts +2 -4
  207. package/src/client/config.ts +1 -1
  208. package/src/client/mod.browser.ts +2 -0
  209. package/src/client/mod.ts +1 -4
  210. package/src/client/queue.ts +146 -0
  211. package/src/client/utils.ts +1 -1
  212. package/src/common/log.ts +1 -1
  213. package/src/common/utils.ts +3 -3
  214. package/src/db/config.ts +100 -0
  215. package/src/db/drizzle/mod.ts +226 -0
  216. package/src/db/drizzle/sqlite-core.ts +22 -0
  217. package/src/db/mod.ts +125 -0
  218. package/src/db/shared.ts +92 -0
  219. package/src/db/sqlite-vfs.ts +12 -0
  220. package/src/driver-helpers/mod.ts +1 -0
  221. package/src/driver-test-suite/mod.ts +69 -43
  222. package/src/driver-test-suite/tests/access-control.ts +218 -0
  223. package/src/driver-test-suite/tests/actor-db-raw.ts +73 -0
  224. package/src/driver-test-suite/tests/actor-db.ts +394 -0
  225. package/src/driver-test-suite/tests/actor-inspector.ts +259 -358
  226. package/src/driver-test-suite/tests/actor-kv.ts +41 -20
  227. package/src/driver-test-suite/tests/actor-queue.ts +324 -0
  228. package/src/driver-test-suite/tests/actor-run.ts +181 -0
  229. package/src/driver-test-suite/tests/actor-schedule.ts +5 -2
  230. package/src/driver-test-suite/tests/actor-sleep.ts +3 -3
  231. package/src/driver-test-suite/tests/actor-stateless.ts +70 -0
  232. package/src/driver-test-suite/tests/actor-workflow.ts +108 -0
  233. package/src/driver-test-suite/tests/manager-driver.ts +11 -0
  234. package/src/driver-test-suite/tests/raw-http-request-properties.ts +1 -1
  235. package/src/driver-test-suite/tests/raw-websocket.ts +12 -12
  236. package/src/drivers/default.ts +7 -2
  237. package/src/drivers/engine/actor-driver.ts +45 -37
  238. package/src/drivers/engine/config.ts +1 -1
  239. package/src/drivers/file-system/actor.ts +20 -2
  240. package/src/drivers/file-system/global-state.ts +569 -258
  241. package/src/drivers/file-system/kv-limits.ts +70 -0
  242. package/src/drivers/file-system/manager.ts +22 -6
  243. package/src/drivers/file-system/mod.ts +39 -16
  244. package/src/drivers/file-system/sqlite-runtime.ts +210 -0
  245. package/src/inspector/actor-inspector.ts +224 -102
  246. package/src/inspector/config.ts +1 -1
  247. package/src/inspector/handler.ts +102 -20
  248. package/src/inspector/mod.browser.ts +8 -0
  249. package/src/inspector/mod.ts +2 -0
  250. package/src/inspector/serve-ui.ts +40 -0
  251. package/src/inspector/transport.ts +18 -0
  252. package/src/inspector/utils.ts +5 -39
  253. package/src/manager/gateway.ts +1 -1
  254. package/src/manager/protocol/mod.ts +1 -1
  255. package/src/manager/protocol/query.ts +1 -1
  256. package/src/manager/router-schema.ts +1 -1
  257. package/src/manager/router.ts +38 -12
  258. package/src/manager-api/actors.ts +1 -1
  259. package/src/manager-api/common.ts +1 -1
  260. package/src/registry/config/driver.ts +1 -1
  261. package/src/registry/config/index.ts +212 -43
  262. package/src/registry/config/legacy-runner.ts +1 -1
  263. package/src/registry/config/runner.ts +1 -1
  264. package/src/registry/config/serverless.ts +1 -1
  265. package/src/registry/index.ts +7 -5
  266. package/src/remote-manager-driver/api-utils.ts +1 -1
  267. package/src/schemas/actor-inspector/mod.ts +1 -1
  268. package/src/schemas/actor-inspector/versioned.ts +195 -8
  269. package/src/schemas/actor-persist/versioned.ts +87 -7
  270. package/src/schemas/client-protocol/mod.ts +1 -1
  271. package/src/schemas/client-protocol/versioned.ts +127 -11
  272. package/src/schemas/client-protocol-zod/mod.ts +16 -1
  273. package/src/schemas/persist/mod.ts +1 -0
  274. package/src/schemas/transport/mod.ts +1 -0
  275. package/src/serde.ts +1 -1
  276. package/src/serve-test-suite/mod.ts +10 -9
  277. package/src/test/mod.ts +15 -56
  278. package/src/utils/endpoint-parser.test.ts +1 -1
  279. package/src/utils/endpoint-parser.ts +1 -1
  280. package/src/utils/env-vars.ts +12 -1
  281. package/src/utils/node.ts +15 -2
  282. package/src/utils.test.ts +34 -0
  283. package/src/utils.ts +140 -6
  284. package/src/workflow/constants.ts +2 -0
  285. package/src/workflow/context.ts +532 -0
  286. package/src/workflow/driver.ts +191 -0
  287. package/src/workflow/inspector.ts +268 -0
  288. package/src/workflow/mod.ts +122 -0
  289. package/dist/tsup/chunk-2IJTYN6K.cjs +0 -278
  290. package/dist/tsup/chunk-2IJTYN6K.cjs.map +0 -1
  291. package/dist/tsup/chunk-2XQS746M.cjs.map +0 -1
  292. package/dist/tsup/chunk-3VP5CSHV.cjs +0 -114
  293. package/dist/tsup/chunk-3VP5CSHV.cjs.map +0 -1
  294. package/dist/tsup/chunk-AQFSQMBG.js +0 -114
  295. package/dist/tsup/chunk-AQFSQMBG.js.map +0 -1
  296. package/dist/tsup/chunk-E6ZE2YEA.js +0 -664
  297. package/dist/tsup/chunk-E6ZE2YEA.js.map +0 -1
  298. package/dist/tsup/chunk-FJ3KTN4V.js.map +0 -1
  299. package/dist/tsup/chunk-GBENOENJ.cjs +0 -8
  300. package/dist/tsup/chunk-GBENOENJ.cjs.map +0 -1
  301. package/dist/tsup/chunk-GD7UXGOE.cjs +0 -4762
  302. package/dist/tsup/chunk-GD7UXGOE.cjs.map +0 -1
  303. package/dist/tsup/chunk-GMAVRZSF.js.map +0 -1
  304. package/dist/tsup/chunk-H4TB4X25.cjs.map +0 -1
  305. package/dist/tsup/chunk-JDAD2YFA.js.map +0 -1
  306. package/dist/tsup/chunk-KCOVZOPS.js +0 -1946
  307. package/dist/tsup/chunk-KCOVZOPS.js.map +0 -1
  308. package/dist/tsup/chunk-KDFWJKMJ.cjs +0 -664
  309. package/dist/tsup/chunk-KDFWJKMJ.cjs.map +0 -1
  310. package/dist/tsup/chunk-LFVF5SCU.js.map +0 -1
  311. package/dist/tsup/chunk-Q6W7RJJP.js.map +0 -1
  312. package/dist/tsup/chunk-RUW5CZ5Z.cjs +0 -1949
  313. package/dist/tsup/chunk-RUW5CZ5Z.cjs.map +0 -1
  314. package/dist/tsup/chunk-RZW2DNND.cjs.map +0 -1
  315. package/dist/tsup/chunk-TCOEBUUE.js +0 -278
  316. package/dist/tsup/chunk-TCOEBUUE.js.map +0 -1
  317. package/dist/tsup/chunk-X35U3YNX.cjs.map +0 -1
  318. package/dist/tsup/keys-Chhy4ylv.d.cts +0 -8
  319. package/dist/tsup/keys-Chhy4ylv.d.ts +0 -8
  320. package/dist/tsup/v1-Gq4avTK3.d.cts +0 -240
  321. package/dist/tsup/v1-Gq4avTK3.d.ts +0 -240
  322. /package/dist/tsup/{chunk-XXGJCOL6.js.map → chunk-A6YIZWTK.js.map} +0 -0
@@ -1,29 +1,6 @@
1
1
  import { createMiddleware } from "hono/factory";
2
- import { inspectorLogger } from "./log";
3
2
  import type { RegistryConfig } from "@/registry/config";
4
-
5
- export function compareSecrets(providedSecret: string, validSecret: string) {
6
- // Early length check to avoid unnecessary processing
7
- if (providedSecret.length !== validSecret.length) {
8
- return false;
9
- }
10
-
11
- const encoder = new TextEncoder();
12
-
13
- const a = encoder.encode(providedSecret);
14
- const b = encoder.encode(validSecret);
15
-
16
- if (a.byteLength !== b.byteLength) {
17
- return false;
18
- }
19
-
20
- // TODO:
21
- // // Perform timing-safe comparison
22
- // if (!crypto.timingSafeEqual(a, b)) {
23
- // return false;
24
- // }
25
- return true;
26
- }
3
+ import { timingSafeEqual } from "@/utils/crypto";
27
4
 
28
5
  export const secureInspector = (config: RegistryConfig) =>
29
6
  createMiddleware(async (c, next) => {
@@ -37,8 +14,7 @@ export const secureInspector = (config: RegistryConfig) =>
37
14
  return c.text("Unauthorized", 401);
38
15
  }
39
16
 
40
- const isValid = compareSecrets(userToken, inspectorToken);
41
- if (!isValid) {
17
+ if (!timingSafeEqual(userToken, inspectorToken)) {
42
18
  return c.text("Unauthorized", 401);
43
19
  }
44
20
  await next();
@@ -50,17 +26,7 @@ export function getInspectorUrl(
50
26
  ): string | undefined {
51
27
  if (!config.inspector.enabled) return undefined;
52
28
 
53
- const url = new URL("https://inspect.rivet.dev");
54
-
55
- // Only override endpoint if using non-default port or custom endpoint is set
56
- const endpoint =
57
- config.inspector.defaultEndpoint ??
58
- (config.managerPort !== 6420
59
- ? `http://127.0.0.1:${managerPort}`
60
- : undefined);
61
- if (endpoint) {
62
- url.searchParams.set("u", endpoint);
63
- }
64
-
65
- return url.href;
29
+ const base =
30
+ config.inspector.defaultEndpoint ?? `http://127.0.0.1:${managerPort}`;
31
+ return new URL("/ui/", base).href;
66
32
  }
@@ -425,7 +425,7 @@ export async function createTestWebSocketProxy(
425
425
  promise: clientToProxyWsPromise,
426
426
  resolve: clientToProxyWsResolve,
427
427
  reject: clientToProxyWsReject,
428
- } = promiseWithResolvers<WSContext>();
428
+ } = promiseWithResolvers<WSContext>((reason) => logger().warn({ msg: "unhandled client websocket promise rejection", reason }));
429
429
  try {
430
430
  // Resolve the client WebSocket promise
431
431
  logger().debug({ msg: "awaiting client websocket promise" });
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import { ActorQuerySchema } from "./query";
3
3
 
4
4
  export * from "./query";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import { EncodingSchema } from "@/actor/protocol/serde";
3
3
  import {
4
4
  HEADER_ACTOR_ID,
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
 
3
3
  export const ServerlessStartHeadersSchema = z.object({
4
4
  endpoint: z.string({
@@ -1,13 +1,11 @@
1
+ import { serveStatic } from "@hono/node-server/serve-static";
1
2
  import { createRoute } from "@hono/zod-openapi";
2
3
  import * as cbor from "cbor-x";
3
-
4
4
  import type { Hono } from "hono";
5
5
  import invariant from "invariant";
6
- import { z } from "zod";
6
+ import { z } from "zod/v4";
7
7
  import { Forbidden, RestrictedFeature } from "@/actor/errors";
8
-
9
- import { serializeActorKey } from "@/actor/keys";
10
-
8
+ import { deserializeActorKey, serializeActorKey } from "@/actor/keys";
11
9
  import type { Encoding } from "@/client/mod";
12
10
  import {
13
11
  HEADER_RIVET_TOKEN,
@@ -23,6 +21,7 @@ import type {
23
21
  TestInlineDriverCallRequest,
24
22
  TestInlineDriverCallResponse,
25
23
  } from "@/driver-test-suite/test-inline-client-driver";
24
+ import { getInspectorDir } from "@/inspector/serve-ui";
26
25
  import {
27
26
  ActorsCreateRequestSchema,
28
27
  type ActorsCreateResponse,
@@ -95,9 +94,9 @@ export function buildManagerRouter(
95
94
 
96
95
  const actorIdsParsed = actor_ids
97
96
  ? actor_ids
98
- .split(",")
99
- .map((id) => id.trim())
100
- .filter((id) => id.length > 0)
97
+ .split(",")
98
+ .map((id) => id.trim())
99
+ .filter((id) => id.length > 0)
101
100
  : undefined;
102
101
 
103
102
  const actors: ActorOutput[] = [];
@@ -171,7 +170,7 @@ export function buildManagerRouter(
171
170
  const actorOutput = await managerDriver.getWithKey({
172
171
  c,
173
172
  name,
174
- key: [key], // Convert string to ActorKey array
173
+ key: deserializeActorKey(key),
175
174
  });
176
175
  if (actorOutput) {
177
176
  actors.push(actorOutput);
@@ -245,7 +244,7 @@ export function buildManagerRouter(
245
244
  const existingActor = await managerDriver.getWithKey({
246
245
  c,
247
246
  name: body.name,
248
- key: [body.key], // Convert string to ActorKey array
247
+ key: deserializeActorKey(body.key),
249
248
  });
250
249
 
251
250
  if (existingActor) {
@@ -259,7 +258,7 @@ export function buildManagerRouter(
259
258
  const newActor = await managerDriver.getOrCreateWithKey({
260
259
  c,
261
260
  name: body.name,
262
- key: [body.key], // Convert string to ActorKey array
261
+ key: deserializeActorKey(body.key),
263
262
  input: body.input
264
263
  ? cbor.decode(Buffer.from(body.input, "base64"))
265
264
  : undefined,
@@ -291,7 +290,7 @@ export function buildManagerRouter(
291
290
  const actorOutput = await managerDriver.createActor({
292
291
  c,
293
292
  name: body.name,
294
- key: [body.key || crypto.randomUUID()], // Generate key if not provided, convert to ActorKey array
293
+ key: deserializeActorKey(body.key || crypto.randomUUID()),
295
294
  input: body.input
296
295
  ? cbor.decode(Buffer.from(body.input, "base64"))
297
296
  : undefined,
@@ -587,6 +586,33 @@ export function buildManagerRouter(
587
586
  });
588
587
  }
589
588
 
589
+ if (config.inspector.enabled) {
590
+ let inspectorRoot: string | undefined;
591
+
592
+
593
+ router.get("/ui/*", async (c, next) => {
594
+ if (!inspectorRoot) {
595
+ inspectorRoot = await getInspectorDir();
596
+ }
597
+ const root = inspectorRoot;
598
+ const rewrite = (path: string) =>
599
+ path.replace(/^\/ui/, "") || "/";
600
+
601
+ return serveStatic({
602
+ root,
603
+ rewriteRequestPath: rewrite,
604
+ onNotFound: async (_path, c) => {
605
+ await serveStatic({ root, path: "index.html" })(
606
+ c,
607
+ next,
608
+ );
609
+ },
610
+ })(c, next);
611
+ });
612
+
613
+ router.get("/ui", (c) => c.redirect("/ui/"));
614
+ }
615
+
590
616
  router.get("/health", (c) => handleHealthRequest(c));
591
617
 
592
618
  router.get("/metadata", (c) =>
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import { RivetIdSchema } from "./common";
3
3
 
4
4
  export const ActorSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
 
3
3
  export const RivetIdSchema = z.string();
4
4
  export type RivetId = z.infer<typeof RivetIdSchema>;
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import { ActorDriverBuilder } from "@/actor/driver";
3
3
  import { ManagerDriverBuilder } from "@/manager/driver";
4
4
 
@@ -1,12 +1,15 @@
1
1
  import { z } from "zod";
2
+ import { getRunMetadata } from "@/actor/config";
2
3
  import type { ActorDefinition, AnyActorDefinition } from "@/actor/definition";
3
4
  import { type Logger, LogLevelSchema } from "@/common/log";
4
5
  import { ENGINE_ENDPOINT } from "@/engine-process/constants";
5
6
  import { InspectorConfigSchema } from "@/inspector/config";
7
+ import { DeepReadonly } from "@/utils";
6
8
  import { tryParseEndpoint } from "@/utils/endpoint-parser";
7
9
  import {
8
10
  getRivetEndpoint,
9
11
  getRivetEngine,
12
+ getRivetkitStoragePath,
10
13
  getRivetNamespace,
11
14
  getRivetToken,
12
15
  isDev,
@@ -14,13 +17,12 @@ import {
14
17
  import { type DriverConfig, DriverConfigSchema } from "./driver";
15
18
  import { RunnerConfigSchema } from "./runner";
16
19
  import { ServerlessConfigSchema } from "./serverless";
17
- import { DeepReadonly } from "@/utils";
18
20
 
19
21
  export { DriverConfigSchema, type DriverConfig };
20
22
 
21
23
  export const ActorsSchema = z.record(
22
24
  z.string(),
23
- z.custom<ActorDefinition<any, any, any, any, any, any, any>>(),
25
+ z.custom<ActorDefinition<any, any, any, any, any, any, any, any, any>>(),
24
26
  );
25
27
  export type RegistryActors = z.infer<typeof ActorsSchema>;
26
28
 
@@ -44,6 +46,17 @@ export const RegistryConfigSchema = z
44
46
 
45
47
  // MARK: Driver
46
48
  driver: DriverConfigSchema.optional(),
49
+ /**
50
+ * Storage path for RivetKit file-system state when using the default driver.
51
+ *
52
+ * If not set, RivetKit uses the platform default data location.
53
+ *
54
+ * Can also be set via RIVETKIT_STORAGE_PATH.
55
+ */
56
+ storagePath: z
57
+ .string()
58
+ .optional()
59
+ .transform((val) => val ?? getRivetkitStoragePath()),
47
60
 
48
61
  // MARK: Networking
49
62
  /** @experimental */
@@ -265,9 +278,21 @@ export type RegistryConfigInput<A extends RegistryActors> = Omit<
265
278
 
266
279
  export function buildActorNames(
267
280
  config: RegistryConfig,
268
- ): Record<string, { metadata: Record<string, any> }> {
281
+ ): Record<string, { metadata: Record<string, unknown> }> {
269
282
  return Object.fromEntries(
270
- Object.keys(config.use).map((name) => [name, { metadata: {} }]),
283
+ Object.keys(config.use).map((actorName) => {
284
+ const definition = config.use[actorName];
285
+ const options = definition.config.options ?? {};
286
+ const runMeta = getRunMetadata(definition.config.run);
287
+ const metadata: Record<string, unknown> = {};
288
+ // Actor options take precedence over run metadata
289
+ metadata.icon = options.icon ?? runMeta.icon;
290
+ metadata.name = options.name ?? runMeta.name;
291
+ // Remove undefined values
292
+ if (!metadata.icon) delete metadata.icon;
293
+ if (!metadata.name) delete metadata.name;
294
+ return [actorName, { metadata }];
295
+ }),
271
296
  );
272
297
  }
273
298
 
@@ -277,9 +302,22 @@ export function buildActorNames(
277
302
 
278
303
  export const DocInspectorConfigSchema = z
279
304
  .object({
280
- enabled: z.boolean().optional().describe("Whether to enable the Rivet Inspector. Defaults to true in development mode."),
281
- token: z.string().optional().describe("Token used to access the Inspector."),
282
- defaultEndpoint: z.string().optional().describe("Default RivetKit server endpoint for Rivet Inspector to connect to."),
305
+ enabled: z
306
+ .boolean()
307
+ .optional()
308
+ .describe(
309
+ "Whether to enable the Rivet Inspector. Defaults to true in development mode.",
310
+ ),
311
+ token: z
312
+ .string()
313
+ .optional()
314
+ .describe("Token used to access the Inspector."),
315
+ defaultEndpoint: z
316
+ .string()
317
+ .optional()
318
+ .describe(
319
+ "Default RivetKit server endpoint for Rivet Inspector to connect to.",
320
+ ),
283
321
  })
284
322
  .optional()
285
323
  .describe("Inspector configuration for debugging and development.");
@@ -287,53 +325,184 @@ export const DocInspectorConfigSchema = z
287
325
  export const DocConfigureRunnerPoolSchema = z
288
326
  .object({
289
327
  name: z.string().optional().describe("Name of the runner pool."),
290
- url: z.string().describe("URL of the serverless platform to configure runners."),
291
- headers: z.record(z.string(), z.string()).optional().describe("Headers to include in requests to the serverless platform."),
292
- maxRunners: z.number().optional().describe("Maximum number of runners in the pool."),
293
- minRunners: z.number().optional().describe("Minimum number of runners to keep warm."),
294
- requestLifespan: z.number().optional().describe("Maximum lifespan of a request in milliseconds."),
295
- runnersMargin: z.number().optional().describe("Buffer margin for scaling runners."),
296
- slotsPerRunner: z.number().optional().describe("Number of actor slots per runner."),
297
- metadata: z.record(z.string(), z.unknown()).optional().describe("Additional metadata to pass to the serverless platform."),
298
- metadataPollInterval: z.number().optional().describe("Interval in milliseconds between metadata polls from the engine. Defaults to 10000 milliseconds (10 seconds)."),
328
+ url: z
329
+ .string()
330
+ .describe("URL of the serverless platform to configure runners."),
331
+ headers: z
332
+ .record(z.string(), z.string())
333
+ .optional()
334
+ .describe(
335
+ "Headers to include in requests to the serverless platform.",
336
+ ),
337
+ maxRunners: z
338
+ .number()
339
+ .optional()
340
+ .describe("Maximum number of runners in the pool."),
341
+ minRunners: z
342
+ .number()
343
+ .optional()
344
+ .describe("Minimum number of runners to keep warm."),
345
+ requestLifespan: z
346
+ .number()
347
+ .optional()
348
+ .describe("Maximum lifespan of a request in milliseconds."),
349
+ runnersMargin: z
350
+ .number()
351
+ .optional()
352
+ .describe("Buffer margin for scaling runners."),
353
+ slotsPerRunner: z
354
+ .number()
355
+ .optional()
356
+ .describe("Number of actor slots per runner."),
357
+ metadata: z
358
+ .record(z.string(), z.unknown())
359
+ .optional()
360
+ .describe(
361
+ "Additional metadata to pass to the serverless platform.",
362
+ ),
363
+ metadataPollInterval: z
364
+ .number()
365
+ .optional()
366
+ .describe(
367
+ "Interval in milliseconds between metadata polls from the engine. Defaults to 10000 milliseconds (10 seconds).",
368
+ ),
299
369
  })
300
370
  .optional();
301
371
 
302
- export const DocServerlessConfigSchema = z.object({
303
- spawnEngine: z.boolean().optional().describe("Downloads and starts the full Rust engine process. Auto-enabled in development mode when no endpoint is provided. Default: false"),
304
- engineVersion: z.string().optional().describe("Version of the engine to download. Defaults to the current RivetKit version."),
305
- configureRunnerPool: DocConfigureRunnerPoolSchema.describe("Automatically configure serverless runners in the engine."),
306
- basePath: z.string().optional().describe("Base path for serverless API routes. Default: '/api/rivet'"),
307
- publicEndpoint: z.string().optional().describe("The endpoint that clients should connect to. Supports URL auth syntax: https://namespace:token@api.rivet.dev"),
308
- publicToken: z.string().optional().describe("Token that clients should use when connecting via the public endpoint."),
309
- }).describe("Configuration for serverless deployment mode.");
310
-
311
- export const DocRunnerConfigSchema = z.object({
312
- totalSlots: z.number().optional().describe("Total number of actor slots available. Default: 100000"),
313
- runnerName: z.string().optional().describe("Name of this runner. Default: 'default'"),
314
- runnerKey: z.string().optional().describe("Authentication key for the runner."),
315
- version: z.number().optional().describe("Version number of this runner. Default: 1"),
316
- }).describe("Configuration for runner mode.");
372
+ export const DocServerlessConfigSchema = z
373
+ .object({
374
+ spawnEngine: z
375
+ .boolean()
376
+ .optional()
377
+ .describe(
378
+ "Downloads and starts the full Rust engine process. Auto-enabled in development mode when no endpoint is provided. Default: false",
379
+ ),
380
+ engineVersion: z
381
+ .string()
382
+ .optional()
383
+ .describe(
384
+ "Version of the engine to download. Defaults to the current RivetKit version.",
385
+ ),
386
+ configureRunnerPool: DocConfigureRunnerPoolSchema.describe(
387
+ "Automatically configure serverless runners in the engine.",
388
+ ),
389
+ basePath: z
390
+ .string()
391
+ .optional()
392
+ .describe(
393
+ "Base path for serverless API routes. Default: '/api/rivet'",
394
+ ),
395
+ publicEndpoint: z
396
+ .string()
397
+ .optional()
398
+ .describe(
399
+ "The endpoint that clients should connect to. Supports URL auth syntax: https://namespace:token@api.rivet.dev",
400
+ ),
401
+ publicToken: z
402
+ .string()
403
+ .optional()
404
+ .describe(
405
+ "Token that clients should use when connecting via the public endpoint.",
406
+ ),
407
+ })
408
+ .describe("Configuration for serverless deployment mode.");
409
+
410
+ export const DocRunnerConfigSchema = z
411
+ .object({
412
+ totalSlots: z
413
+ .number()
414
+ .optional()
415
+ .describe("Total number of actor slots available. Default: 100000"),
416
+ runnerName: z
417
+ .string()
418
+ .optional()
419
+ .describe("Name of this runner. Default: 'default'"),
420
+ runnerKey: z
421
+ .string()
422
+ .optional()
423
+ .describe("Authentication key for the runner."),
424
+ version: z
425
+ .number()
426
+ .optional()
427
+ .describe("Version number of this runner. Default: 1"),
428
+ })
429
+ .describe("Configuration for runner mode.");
317
430
 
318
431
  export const DocRegistryConfigSchema = z
319
432
  .object({
320
- use: z.record(z.string(), z.unknown()).describe("Actor definitions. Keys are actor names, values are actor definitions."),
321
- maxIncomingMessageSize: z.number().optional().describe("Maximum size of incoming WebSocket messages in bytes. Default: 65536"),
322
- maxOutgoingMessageSize: z.number().optional().describe("Maximum size of outgoing WebSocket messages in bytes. Default: 1048576"),
323
- noWelcome: z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
433
+ use: z
434
+ .record(z.string(), z.unknown())
435
+ .describe(
436
+ "Actor definitions. Keys are actor names, values are actor definitions.",
437
+ ),
438
+ storagePath: z
439
+ .string()
440
+ .optional()
441
+ .describe(
442
+ "Storage path for RivetKit file-system state when using the default driver. Can also be set via RIVETKIT_STORAGE_PATH.",
443
+ ),
444
+ maxIncomingMessageSize: z
445
+ .number()
446
+ .optional()
447
+ .describe(
448
+ "Maximum size of incoming WebSocket messages in bytes. Default: 65536",
449
+ ),
450
+ maxOutgoingMessageSize: z
451
+ .number()
452
+ .optional()
453
+ .describe(
454
+ "Maximum size of outgoing WebSocket messages in bytes. Default: 1048576",
455
+ ),
456
+ noWelcome: z
457
+ .boolean()
458
+ .optional()
459
+ .describe("Disable the welcome message on startup. Default: false"),
324
460
  logging: z
325
461
  .object({
326
- level: LogLevelSchema.optional().describe("Log level for RivetKit. Default: 'warn'"),
462
+ level: LogLevelSchema.optional().describe(
463
+ "Log level for RivetKit. Default: 'warn'",
464
+ ),
327
465
  })
328
466
  .optional()
329
467
  .describe("Logging configuration."),
330
- endpoint: z.string().optional().describe("Endpoint URL to connect to Rivet Engine. Supports URL auth syntax: https://namespace:token@api.rivet.dev. Can also be set via RIVET_ENDPOINT environment variable."),
331
- token: z.string().optional().describe("Authentication token for Rivet Engine. Can also be set via RIVET_TOKEN environment variable."),
332
- namespace: z.string().optional().describe("Namespace to use. Default: 'default'. Can also be set via RIVET_NAMESPACE environment variable."),
333
- headers: z.record(z.string(), z.string()).optional().describe("Additional headers to include in requests to Rivet Engine."),
334
- serveManager: z.boolean().optional().describe("Whether to start the local manager server. Auto-determined based on endpoint and NODE_ENV if not specified."),
335
- managerBasePath: z.string().optional().describe("Base path for the manager API. Default: '/'"),
336
- managerPort: z.number().optional().describe("Port to run the manager on. Default: 6420"),
468
+ endpoint: z
469
+ .string()
470
+ .optional()
471
+ .describe(
472
+ "Endpoint URL to connect to Rivet Engine. Supports URL auth syntax: https://namespace:token@api.rivet.dev. Can also be set via RIVET_ENDPOINT environment variable.",
473
+ ),
474
+ token: z
475
+ .string()
476
+ .optional()
477
+ .describe(
478
+ "Authentication token for Rivet Engine. Can also be set via RIVET_TOKEN environment variable.",
479
+ ),
480
+ namespace: z
481
+ .string()
482
+ .optional()
483
+ .describe(
484
+ "Namespace to use. Default: 'default'. Can also be set via RIVET_NAMESPACE environment variable.",
485
+ ),
486
+ headers: z
487
+ .record(z.string(), z.string())
488
+ .optional()
489
+ .describe(
490
+ "Additional headers to include in requests to Rivet Engine.",
491
+ ),
492
+ serveManager: z
493
+ .boolean()
494
+ .optional()
495
+ .describe(
496
+ "Whether to start the local manager server. Auto-determined based on endpoint and NODE_ENV if not specified.",
497
+ ),
498
+ managerBasePath: z
499
+ .string()
500
+ .optional()
501
+ .describe("Base path for the manager API. Default: '/'"),
502
+ managerPort: z
503
+ .number()
504
+ .optional()
505
+ .describe("Port to run the manager on. Default: 6420"),
337
506
  inspector: DocInspectorConfigSchema,
338
507
  serverless: DocServerlessConfigSchema.optional(),
339
508
  runner: DocRunnerConfigSchema.optional(),
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from "pino";
2
- import { z } from "zod";
2
+ import { z } from "zod/v4";
3
3
  import type { ActorDriverBuilder } from "@/actor/driver";
4
4
  import { LogLevelSchema } from "@/common/log";
5
5
  import {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import {
3
3
  isDev,
4
4
  getRivetTotalSlots,
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import { VERSION } from "@/utils";
3
3
  import {
4
4
  getRivetRunEngineVersion,
@@ -1,6 +1,6 @@
1
1
  import type { Client } from "@/client/client";
2
2
  import { createClient } from "@/client/mod";
3
- import { isDev } from "@/utils/env-vars";
3
+ import { getNodeEnv, isDev } from "@/utils/env-vars";
4
4
  import {
5
5
  type RegistryActors,
6
6
  type RegistryConfig,
@@ -49,10 +49,12 @@ export class Registry<A extends RegistryActors> {
49
49
  this.#config = config;
50
50
 
51
51
  // Auto-prepare on next tick (gives time for sync config modification)
52
- setTimeout(() => {
53
- // biome-ignore lint/nursery/noFloatingPromises: fire-and-forget auto-prepare
54
- this.#ensureRuntime();
55
- }, 0);
52
+ if (getNodeEnv() !== "test") {
53
+ setTimeout(() => {
54
+ // biome-ignore lint/nursery/noFloatingPromises: fire-and-forget auto-prepare
55
+ this.#ensureRuntime();
56
+ }, 0);
57
+ }
56
58
  }
57
59
 
58
60
  /** Creates runtime if not already created. Idempotent. */
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v4";
2
2
  import type { ClientConfig } from "@/client/config";
3
3
  import { sendHttpRequest } from "@/client/utils";
4
4
  import { combineUrlPath } from "@/utils";
@@ -1 +1 @@
1
- export * from "../../../dist/schemas/actor-inspector/v1";
1
+ export * from "../../../dist/schemas/actor-inspector/v3";