rivetkit 2.1.4 → 2.1.6-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 (333) hide show
  1. package/dist/browser/client.d.ts +593 -588
  2. package/dist/browser/client.js +215 -35
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +109 -10
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/inspector.tar.gz +0 -0
  7. package/dist/tsup/actor/errors.cjs +2 -2
  8. package/dist/tsup/actor/errors.js +1 -1
  9. package/dist/tsup/{actor-router-consts-D29T1Z-K.d.cts → actor-router-consts-DU-1IdQj.d.cts} +1 -1
  10. package/dist/tsup/{actor-router-consts-D29T1Z-K.d.ts → actor-router-consts-DU-1IdQj.d.ts} +1 -1
  11. package/dist/tsup/chunk-2ELYUO6C.cjs +112 -0
  12. package/dist/tsup/chunk-2ELYUO6C.cjs.map +1 -0
  13. package/dist/tsup/chunk-2LY7RW3Y.cjs +2316 -0
  14. package/dist/tsup/chunk-2LY7RW3Y.cjs.map +1 -0
  15. package/dist/tsup/{chunk-L47L3ZWJ.cjs → chunk-6G7ZNM27.cjs} +11 -6
  16. package/dist/tsup/chunk-6G7ZNM27.cjs.map +1 -0
  17. package/dist/tsup/{chunk-LK36OGGO.cjs → chunk-A4KEUCB6.cjs} +84 -34
  18. package/dist/tsup/chunk-A4KEUCB6.cjs.map +1 -0
  19. package/dist/tsup/{chunk-7HTNH26M.js → chunk-AKUJ5OTO.js} +11 -6
  20. package/dist/tsup/chunk-AKUJ5OTO.js.map +1 -0
  21. package/dist/tsup/{chunk-ANKZ2FS6.js → chunk-C22JYHVT.js} +77 -27
  22. package/dist/tsup/chunk-C22JYHVT.js.map +1 -0
  23. package/dist/tsup/chunk-C4EB42ET.js +1459 -0
  24. package/dist/tsup/chunk-C4EB42ET.js.map +1 -0
  25. package/dist/tsup/chunk-CGGGBIDP.cjs +1459 -0
  26. package/dist/tsup/chunk-CGGGBIDP.cjs.map +1 -0
  27. package/dist/tsup/chunk-CMQPDBBR.cjs +1486 -0
  28. package/dist/tsup/chunk-CMQPDBBR.cjs.map +1 -0
  29. package/dist/tsup/{chunk-AQD4CBZ2.cjs → chunk-DH6UINWA.cjs} +4 -4
  30. package/dist/tsup/{chunk-AQD4CBZ2.cjs.map → chunk-DH6UINWA.cjs.map} +1 -1
  31. package/dist/tsup/chunk-DK46YYCJ.js +1486 -0
  32. package/dist/tsup/chunk-DK46YYCJ.js.map +1 -0
  33. package/dist/tsup/chunk-EGWXXBZV.js +2316 -0
  34. package/dist/tsup/chunk-EGWXXBZV.js.map +1 -0
  35. package/dist/tsup/{chunk-HBYEYBIC.js → chunk-EONWXYMN.js} +2 -2
  36. package/dist/tsup/{chunk-N4KRDJ56.js → chunk-GFGRBYO2.js} +35 -6
  37. package/dist/tsup/chunk-GFGRBYO2.js.map +1 -0
  38. package/dist/tsup/{chunk-TEUL4UYN.cjs → chunk-GUHXWPGB.cjs} +1515 -1479
  39. package/dist/tsup/chunk-GUHXWPGB.cjs.map +1 -0
  40. package/dist/tsup/{chunk-3B6PCYJB.cjs → chunk-HNE2AK6C.cjs} +2375 -3713
  41. package/dist/tsup/chunk-HNE2AK6C.cjs.map +1 -0
  42. package/dist/tsup/{chunk-5UEFNG7P.js → chunk-I5I6OALK.js} +2 -2
  43. package/dist/tsup/chunk-IHQAF2HV.cjs +23 -0
  44. package/dist/tsup/chunk-IHQAF2HV.cjs.map +1 -0
  45. package/dist/tsup/{chunk-UWAGLDT6.cjs → chunk-JJNZQDUN.cjs} +667 -2517
  46. package/dist/tsup/chunk-JJNZQDUN.cjs.map +1 -0
  47. package/dist/tsup/{chunk-M6H4XIF4.js → chunk-JJSPHLJN.js} +219 -287
  48. package/dist/tsup/chunk-JJSPHLJN.js.map +1 -0
  49. package/dist/tsup/chunk-JRKPV5NJ.js +481 -0
  50. package/dist/tsup/chunk-JRKPV5NJ.js.map +1 -0
  51. package/dist/tsup/{chunk-VKVNIQRQ.js → chunk-K7MVU5SI.js} +36 -41
  52. package/dist/tsup/chunk-K7MVU5SI.js.map +1 -0
  53. package/dist/tsup/{chunk-KJSYAUOM.js → chunk-MLK3GY6P.js} +43 -27
  54. package/dist/tsup/chunk-MLK3GY6P.js.map +1 -0
  55. package/dist/tsup/{chunk-4KSHPFXF.cjs → chunk-MPLMTJY5.cjs} +123 -23
  56. package/dist/tsup/chunk-MPLMTJY5.cjs.map +1 -0
  57. package/dist/tsup/{chunk-UDMRZR6A.js → chunk-PQWI44WD.js} +1755 -3093
  58. package/dist/tsup/chunk-PQWI44WD.js.map +1 -0
  59. package/dist/tsup/{chunk-SR3KQE7Q.cjs → chunk-SQFCIDCG.cjs} +35 -6
  60. package/dist/tsup/chunk-SQFCIDCG.cjs.map +1 -0
  61. package/dist/tsup/{chunk-3GTO6H3E.js → chunk-SVHJSM2E.js} +110 -24
  62. package/dist/tsup/chunk-SVHJSM2E.js.map +1 -0
  63. package/dist/tsup/chunk-T5KYKM6R.js +49 -0
  64. package/dist/tsup/chunk-T5KYKM6R.js.map +1 -0
  65. package/dist/tsup/{chunk-GXRVSSVD.cjs → chunk-TJ7DKW6F.cjs} +123 -37
  66. package/dist/tsup/chunk-TJ7DKW6F.cjs.map +1 -0
  67. package/dist/tsup/chunk-UQZRMTM3.js +23 -0
  68. package/dist/tsup/chunk-UQZRMTM3.js.map +1 -0
  69. package/dist/tsup/{chunk-QPADHLDU.cjs → chunk-V3JSZR5P.cjs} +3 -3
  70. package/dist/tsup/{chunk-QPADHLDU.cjs.map → chunk-V3JSZR5P.cjs.map} +1 -1
  71. package/dist/tsup/{chunk-HKOSZKKZ.cjs → chunk-VBR35EQF.cjs} +271 -339
  72. package/dist/tsup/chunk-VBR35EQF.cjs.map +1 -0
  73. package/dist/tsup/{chunk-DZXDUGLL.js → chunk-VWYO36X4.js} +117 -17
  74. package/dist/tsup/chunk-VWYO36X4.js.map +1 -0
  75. package/dist/tsup/{chunk-I6PL6QIY.js → chunk-WW27B6DM.js} +1452 -1416
  76. package/dist/tsup/chunk-WW27B6DM.js.map +1 -0
  77. package/dist/tsup/chunk-YAE3MEJM.cjs +49 -0
  78. package/dist/tsup/chunk-YAE3MEJM.cjs.map +1 -0
  79. package/dist/tsup/{chunk-KTWY3K6Z.js → chunk-YGYGANCA.js} +473 -2323
  80. package/dist/tsup/chunk-YGYGANCA.js.map +1 -0
  81. package/dist/tsup/chunk-YZJWZBY5.cjs +481 -0
  82. package/dist/tsup/chunk-YZJWZBY5.cjs.map +1 -0
  83. package/dist/tsup/{chunk-ZFY5J2EP.cjs → chunk-ZZLJ5TSM.cjs} +39 -44
  84. package/dist/tsup/chunk-ZZLJ5TSM.cjs.map +1 -0
  85. package/dist/tsup/client/mod.cjs +10 -7
  86. package/dist/tsup/client/mod.cjs.map +1 -1
  87. package/dist/tsup/client/mod.d.cts +6 -6
  88. package/dist/tsup/client/mod.d.ts +6 -6
  89. package/dist/tsup/client/mod.js +11 -8
  90. package/dist/tsup/common/log.cjs +3 -3
  91. package/dist/tsup/common/log.js +2 -2
  92. package/dist/tsup/common/websocket.cjs +4 -4
  93. package/dist/tsup/common/websocket.js +3 -3
  94. package/dist/tsup/{config-Qj-zLJPc.d.ts → config-C2Wwnc69.d.ts} +142 -208
  95. package/dist/tsup/{config-BiNoIHRs.d.ts → config-DROwzBLT.d.cts} +82 -6
  96. package/dist/tsup/{config-BiNoIHRs.d.cts → config-DROwzBLT.d.ts} +82 -6
  97. package/dist/tsup/{config-iPj5l1bL.d.cts → config-ehT-_3BB.d.cts} +142 -208
  98. package/dist/tsup/{context-DzvH1PBK.d.cts → context-DGMJuAyc.d.ts} +16 -3
  99. package/dist/tsup/{context-CQCMuHND.d.ts → context-Dpp2RJbW.d.cts} +16 -3
  100. package/dist/tsup/db/drizzle/mod.cjs +3 -3
  101. package/dist/tsup/db/drizzle/mod.d.cts +1 -1
  102. package/dist/tsup/db/drizzle/mod.d.ts +1 -1
  103. package/dist/tsup/db/drizzle/mod.js +2 -2
  104. package/dist/tsup/db/mod.cjs +3 -3
  105. package/dist/tsup/db/mod.d.cts +1 -1
  106. package/dist/tsup/db/mod.d.ts +1 -1
  107. package/dist/tsup/db/mod.js +2 -2
  108. package/dist/tsup/{driver-Jo8v-kbU.d.ts → driver-CYZP9QYo.d.ts} +1 -1
  109. package/dist/tsup/{driver-iV8J-WMv.d.cts → driver-CoTFpipv.d.cts} +1 -1
  110. package/dist/tsup/driver-helpers/mod.cjs +7 -5
  111. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  112. package/dist/tsup/driver-helpers/mod.d.cts +17 -18
  113. package/dist/tsup/driver-helpers/mod.d.ts +17 -18
  114. package/dist/tsup/driver-helpers/mod.js +11 -9
  115. package/dist/tsup/driver-test-suite/mod.cjs +1275 -228
  116. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  117. package/dist/tsup/driver-test-suite/mod.d.cts +6 -5
  118. package/dist/tsup/driver-test-suite/mod.d.ts +6 -5
  119. package/dist/tsup/driver-test-suite/mod.js +1581 -534
  120. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  121. package/dist/tsup/inspector/mod.cjs +4 -4
  122. package/dist/tsup/inspector/mod.js +3 -3
  123. package/dist/tsup/mod.cjs +15 -9
  124. package/dist/tsup/mod.cjs.map +1 -1
  125. package/dist/tsup/mod.d.cts +9 -9
  126. package/dist/tsup/mod.d.ts +9 -9
  127. package/dist/tsup/mod.js +19 -13
  128. package/dist/tsup/sandbox/client.cjs +28 -0
  129. package/dist/tsup/sandbox/client.cjs.map +1 -0
  130. package/dist/tsup/sandbox/client.d.cts +88 -0
  131. package/dist/tsup/sandbox/client.d.ts +88 -0
  132. package/dist/tsup/sandbox/client.js +28 -0
  133. package/dist/tsup/sandbox/client.js.map +1 -0
  134. package/dist/tsup/sandbox/index.cjs +761 -0
  135. package/dist/tsup/sandbox/index.cjs.map +1 -0
  136. package/dist/tsup/sandbox/index.d.cts +120 -0
  137. package/dist/tsup/sandbox/index.d.ts +120 -0
  138. package/dist/tsup/sandbox/index.js +761 -0
  139. package/dist/tsup/sandbox/index.js.map +1 -0
  140. package/dist/tsup/sandbox/providers/computesdk.cjs +3 -0
  141. package/dist/tsup/sandbox/providers/computesdk.cjs.map +1 -0
  142. package/dist/tsup/sandbox/providers/computesdk.d.cts +7 -0
  143. package/dist/tsup/sandbox/providers/computesdk.d.ts +7 -0
  144. package/dist/tsup/sandbox/providers/computesdk.js +3 -0
  145. package/dist/tsup/sandbox/providers/computesdk.js.map +1 -0
  146. package/dist/tsup/sandbox/providers/daytona.cjs +3 -0
  147. package/dist/tsup/sandbox/providers/daytona.cjs.map +1 -0
  148. package/dist/tsup/sandbox/providers/daytona.d.cts +1 -0
  149. package/dist/tsup/sandbox/providers/daytona.d.ts +1 -0
  150. package/dist/tsup/sandbox/providers/daytona.js +3 -0
  151. package/dist/tsup/sandbox/providers/daytona.js.map +1 -0
  152. package/dist/tsup/sandbox/providers/docker.cjs +3 -0
  153. package/dist/tsup/sandbox/providers/docker.cjs.map +1 -0
  154. package/dist/tsup/sandbox/providers/docker.d.cts +1 -0
  155. package/dist/tsup/sandbox/providers/docker.d.ts +1 -0
  156. package/dist/tsup/sandbox/providers/docker.js +3 -0
  157. package/dist/tsup/sandbox/providers/docker.js.map +1 -0
  158. package/dist/tsup/sandbox/providers/e2b.cjs +3 -0
  159. package/dist/tsup/sandbox/providers/e2b.cjs.map +1 -0
  160. package/dist/tsup/sandbox/providers/e2b.d.cts +1 -0
  161. package/dist/tsup/sandbox/providers/e2b.d.ts +1 -0
  162. package/dist/tsup/sandbox/providers/e2b.js +3 -0
  163. package/dist/tsup/sandbox/providers/e2b.js.map +1 -0
  164. package/dist/tsup/sandbox/providers/local.cjs +3 -0
  165. package/dist/tsup/sandbox/providers/local.cjs.map +1 -0
  166. package/dist/tsup/sandbox/providers/local.d.cts +1 -0
  167. package/dist/tsup/sandbox/providers/local.d.ts +1 -0
  168. package/dist/tsup/sandbox/providers/local.js +3 -0
  169. package/dist/tsup/sandbox/providers/local.js.map +1 -0
  170. package/dist/tsup/sandbox/providers/modal.cjs +3 -0
  171. package/dist/tsup/sandbox/providers/modal.cjs.map +1 -0
  172. package/dist/tsup/sandbox/providers/modal.d.cts +1 -0
  173. package/dist/tsup/sandbox/providers/modal.d.ts +1 -0
  174. package/dist/tsup/sandbox/providers/modal.js +3 -0
  175. package/dist/tsup/sandbox/providers/modal.js.map +1 -0
  176. package/dist/tsup/sandbox/providers/vercel.cjs +3 -0
  177. package/dist/tsup/sandbox/providers/vercel.cjs.map +1 -0
  178. package/dist/tsup/sandbox/providers/vercel.d.cts +1 -0
  179. package/dist/tsup/sandbox/providers/vercel.d.ts +1 -0
  180. package/dist/tsup/sandbox/providers/vercel.js +3 -0
  181. package/dist/tsup/sandbox/providers/vercel.js.map +1 -0
  182. package/dist/tsup/serve-test-suite/mod.cjs +451 -327
  183. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
  184. package/dist/tsup/serve-test-suite/mod.js +362 -238
  185. package/dist/tsup/serve-test-suite/mod.js.map +1 -1
  186. package/dist/tsup/test/mod.cjs +17 -14
  187. package/dist/tsup/test/mod.cjs.map +1 -1
  188. package/dist/tsup/test/mod.d.cts +4 -4
  189. package/dist/tsup/test/mod.d.ts +4 -4
  190. package/dist/tsup/test/mod.js +14 -11
  191. package/dist/tsup/test/mod.js.map +1 -1
  192. package/dist/tsup/utils.cjs +3 -3
  193. package/dist/tsup/utils.js +2 -2
  194. package/dist/tsup/workflow/mod.cjs +6 -6
  195. package/dist/tsup/workflow/mod.d.cts +13 -9
  196. package/dist/tsup/workflow/mod.d.ts +13 -9
  197. package/dist/tsup/workflow/mod.js +5 -5
  198. package/package.json +113 -14
  199. package/src/actor/config.ts +94 -88
  200. package/src/actor/conn/drivers/websocket.ts +2 -1
  201. package/src/actor/contexts/base/actor.ts +27 -4
  202. package/src/actor/database.ts +6 -1
  203. package/src/actor/driver.ts +27 -8
  204. package/src/actor/errors.ts +10 -5
  205. package/src/actor/instance/connection-manager.ts +4 -3
  206. package/src/actor/instance/kv.ts +52 -9
  207. package/src/actor/instance/mod.ts +135 -84
  208. package/src/actor/instance/queue-manager.ts +2 -5
  209. package/src/actor/instance/queue.ts +31 -29
  210. package/src/actor/instance/state-manager.ts +7 -1
  211. package/src/actor/instance/traces-driver.ts +34 -36
  212. package/src/actor/metrics.ts +137 -0
  213. package/src/actor/protocol/old.ts +9 -12
  214. package/src/actor/router-websocket-endpoints.ts +12 -6
  215. package/src/actor/router.ts +46 -9
  216. package/src/actor/schema.ts +14 -22
  217. package/src/client/actor-common.ts +65 -0
  218. package/src/client/actor-conn.ts +71 -9
  219. package/src/client/actor-handle.ts +22 -5
  220. package/src/client/client.ts +32 -6
  221. package/src/client/config.ts +18 -21
  222. package/src/client/mod.ts +1 -0
  223. package/src/client/queue.ts +8 -6
  224. package/src/common/inline-websocket-adapter.ts +8 -2
  225. package/src/common/router.ts +1 -4
  226. package/src/common/utils.ts +2 -5
  227. package/src/db/config.ts +10 -5
  228. package/src/db/drizzle/mod.ts +51 -41
  229. package/src/db/mod.ts +54 -29
  230. package/src/db/shared.ts +42 -8
  231. package/src/driver-helpers/mod.ts +2 -1
  232. package/src/driver-helpers/sqlite-pool.ts +42 -0
  233. package/src/driver-helpers/utils.ts +0 -20
  234. package/src/driver-test-suite/mod.ts +11 -1
  235. package/src/driver-test-suite/tests/access-control.ts +19 -12
  236. package/src/driver-test-suite/tests/action-features.ts +20 -8
  237. package/src/driver-test-suite/tests/actor-conn.ts +94 -8
  238. package/src/driver-test-suite/tests/actor-db-kv-stats.ts +282 -0
  239. package/src/driver-test-suite/tests/actor-db-raw.ts +6 -2
  240. package/src/driver-test-suite/tests/actor-db.ts +101 -31
  241. package/src/driver-test-suite/tests/actor-inspector.ts +174 -32
  242. package/src/driver-test-suite/tests/actor-kv.ts +79 -33
  243. package/src/driver-test-suite/tests/actor-lifecycle.ts +4 -12
  244. package/src/driver-test-suite/tests/actor-queue.ts +125 -17
  245. package/src/driver-test-suite/tests/actor-run.ts +59 -55
  246. package/src/driver-test-suite/tests/actor-sandbox.ts +78 -0
  247. package/src/driver-test-suite/tests/actor-schedule.ts +1 -4
  248. package/src/driver-test-suite/tests/actor-sleep.ts +111 -0
  249. package/src/driver-test-suite/tests/actor-workflow.ts +387 -3
  250. package/src/driver-test-suite/tests/conn-error-serialization.ts +3 -1
  251. package/src/driver-test-suite/tests/raw-websocket.ts +5 -1
  252. package/src/drivers/default.ts +1 -3
  253. package/src/drivers/engine/actor-driver.ts +94 -21
  254. package/src/drivers/engine/config.ts +4 -12
  255. package/src/drivers/engine/mod.ts +1 -5
  256. package/src/drivers/file-system/actor.ts +43 -8
  257. package/src/drivers/file-system/global-state.ts +180 -64
  258. package/src/drivers/file-system/kv-limits.ts +1 -1
  259. package/src/drivers/file-system/sqlite-runtime.ts +13 -4
  260. package/src/engine-process/mod.ts +5 -1
  261. package/src/inspector/actor-inspector.ts +47 -21
  262. package/src/inspector/config.ts +1 -4
  263. package/src/inspector/mod.browser.ts +2 -2
  264. package/src/inspector/mod.ts +4 -1
  265. package/src/inspector/serve-ui.ts +0 -1
  266. package/src/inspector/workflow-history-json.ts +309 -0
  267. package/src/manager/gateway.ts +6 -2
  268. package/src/manager/router.ts +3 -3
  269. package/src/registry/config/index.ts +65 -12
  270. package/src/registry/config/runner.ts +19 -4
  271. package/src/registry/index.ts +42 -89
  272. package/src/sandbox/actor/db.ts +36 -0
  273. package/src/sandbox/actor/index.ts +476 -0
  274. package/src/sandbox/actor/session.ts +350 -0
  275. package/src/sandbox/actor.test.ts +36 -0
  276. package/src/sandbox/client.test.ts +484 -0
  277. package/src/sandbox/client.ts +707 -0
  278. package/src/sandbox/config.ts +151 -0
  279. package/src/sandbox/index.ts +41 -0
  280. package/src/sandbox/providers/computesdk.ts +1 -0
  281. package/src/sandbox/providers/daytona.ts +1 -0
  282. package/src/sandbox/providers/docker.ts +1 -0
  283. package/src/sandbox/providers/e2b.ts +1 -0
  284. package/src/sandbox/providers/local.ts +1 -0
  285. package/src/sandbox/providers/modal.ts +1 -0
  286. package/src/sandbox/providers/vercel.ts +1 -0
  287. package/src/sandbox/session-persist-driver.ts +180 -0
  288. package/src/sandbox/types.ts +138 -0
  289. package/src/serverless/configure.ts +5 -3
  290. package/src/serverless/router.test.ts +17 -9
  291. package/src/serverless/router.ts +20 -13
  292. package/src/test/mod.ts +3 -4
  293. package/src/utils/endpoint-parser.test.ts +6 -2
  294. package/src/utils/endpoint-parser.ts +6 -2
  295. package/src/utils/env-vars.ts +0 -2
  296. package/src/utils/node.ts +1 -1
  297. package/src/utils/serve.ts +10 -5
  298. package/src/utils.ts +6 -1
  299. package/src/workflow/constants.ts +1 -2
  300. package/src/workflow/context.ts +42 -9
  301. package/src/workflow/driver.ts +57 -23
  302. package/src/workflow/inspector.ts +7 -13
  303. package/src/workflow/mod.ts +91 -4
  304. package/dist/tsup/chunk-3B6PCYJB.cjs.map +0 -1
  305. package/dist/tsup/chunk-3GTO6H3E.js.map +0 -1
  306. package/dist/tsup/chunk-4KSHPFXF.cjs.map +0 -1
  307. package/dist/tsup/chunk-6LJAZ5R4.cjs +0 -96
  308. package/dist/tsup/chunk-6LJAZ5R4.cjs.map +0 -1
  309. package/dist/tsup/chunk-7HTNH26M.js.map +0 -1
  310. package/dist/tsup/chunk-ANKZ2FS6.js.map +0 -1
  311. package/dist/tsup/chunk-DZXDUGLL.js.map +0 -1
  312. package/dist/tsup/chunk-GXRVSSVD.cjs.map +0 -1
  313. package/dist/tsup/chunk-H5TSEPN4.cjs +0 -645
  314. package/dist/tsup/chunk-H5TSEPN4.cjs.map +0 -1
  315. package/dist/tsup/chunk-HKOSZKKZ.cjs.map +0 -1
  316. package/dist/tsup/chunk-I6PL6QIY.js.map +0 -1
  317. package/dist/tsup/chunk-KJSYAUOM.js.map +0 -1
  318. package/dist/tsup/chunk-KTWY3K6Z.js.map +0 -1
  319. package/dist/tsup/chunk-L47L3ZWJ.cjs.map +0 -1
  320. package/dist/tsup/chunk-LK36OGGO.cjs.map +0 -1
  321. package/dist/tsup/chunk-M6H4XIF4.js.map +0 -1
  322. package/dist/tsup/chunk-N4KRDJ56.js.map +0 -1
  323. package/dist/tsup/chunk-SR3KQE7Q.cjs.map +0 -1
  324. package/dist/tsup/chunk-TEFYRRAK.js +0 -645
  325. package/dist/tsup/chunk-TEFYRRAK.js.map +0 -1
  326. package/dist/tsup/chunk-TEUL4UYN.cjs.map +0 -1
  327. package/dist/tsup/chunk-UDMRZR6A.js.map +0 -1
  328. package/dist/tsup/chunk-UWAGLDT6.cjs.map +0 -1
  329. package/dist/tsup/chunk-VKVNIQRQ.js.map +0 -1
  330. package/dist/tsup/chunk-ZFY5J2EP.cjs.map +0 -1
  331. package/src/db/sqlite-vfs.ts +0 -12
  332. /package/dist/tsup/{chunk-HBYEYBIC.js.map → chunk-EONWXYMN.js.map} +0 -0
  333. /package/dist/tsup/{chunk-5UEFNG7P.js.map → chunk-I5I6OALK.js.map} +0 -0
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Lightweight in-memory metrics for actor instances.
3
+ *
4
+ * Metrics are collected per actor wake cycle and are NOT persisted. They reset
5
+ * when the actor sleeps and wakes again.
6
+ */
7
+
8
+ export interface CounterMetric {
9
+ type: "counter";
10
+ help: string;
11
+ value: number;
12
+ }
13
+
14
+ export interface GaugeMetric {
15
+ type: "gauge";
16
+ help: string;
17
+ value: number;
18
+ }
19
+
20
+ export interface LabeledCounterMetric {
21
+ type: "labeled_counter";
22
+ help: string;
23
+ values: Record<string, number>;
24
+ }
25
+
26
+ export interface LabeledTimingMetric {
27
+ type: "labeled_timing";
28
+ help: string;
29
+ values: Record<string, { calls: number; totalMs: number; keys: number }>;
30
+ }
31
+
32
+ export type Metric =
33
+ | CounterMetric
34
+ | GaugeMetric
35
+ | LabeledCounterMetric
36
+ | LabeledTimingMetric;
37
+
38
+ export type MetricsSnapshot = Record<string, Metric>;
39
+
40
+ export class ActorMetrics {
41
+ // KV operations
42
+ kvGet = { calls: 0, keys: 0, totalMs: 0 };
43
+ kvGetBatch = { calls: 0, keys: 0, totalMs: 0 };
44
+ kvPut = { calls: 0, keys: 0, totalMs: 0 };
45
+ kvPutBatch = { calls: 0, keys: 0, totalMs: 0 };
46
+ kvDeleteBatch = { calls: 0, keys: 0, totalMs: 0 };
47
+
48
+ // SQL statements
49
+ sqlSelects = 0;
50
+ sqlInserts = 0;
51
+ sqlUpdates = 0;
52
+ sqlDeletes = 0;
53
+ sqlOther = 0;
54
+ sqlTotalMs = 0;
55
+
56
+ // Actions
57
+ actionCalls = 0;
58
+ actionErrors = 0;
59
+ actionTotalMs = 0;
60
+
61
+ // Connections
62
+ connectionsOpened = 0;
63
+ connectionsClosed = 0;
64
+
65
+ trackSql(query: string, durationMs: number): void {
66
+ const token = query.trimStart().slice(0, 8).toUpperCase();
67
+ if (token.startsWith("SELECT") || token.startsWith("PRAGMA") || token.startsWith("WITH")) {
68
+ this.sqlSelects++;
69
+ } else if (token.startsWith("INSERT")) {
70
+ this.sqlInserts++;
71
+ } else if (token.startsWith("UPDATE")) {
72
+ this.sqlUpdates++;
73
+ } else if (token.startsWith("DELETE")) {
74
+ this.sqlDeletes++;
75
+ } else {
76
+ this.sqlOther++;
77
+ }
78
+ this.sqlTotalMs += durationMs;
79
+ }
80
+
81
+ snapshot(): MetricsSnapshot {
82
+ return {
83
+ kv_operations: {
84
+ type: "labeled_timing",
85
+ help: "KV round trips by operation type",
86
+ values: {
87
+ get: { ...this.kvGet },
88
+ getBatch: { ...this.kvGetBatch },
89
+ put: { ...this.kvPut },
90
+ putBatch: { ...this.kvPutBatch },
91
+ deleteBatch: { ...this.kvDeleteBatch },
92
+ },
93
+ },
94
+ sql_statements: {
95
+ type: "labeled_counter",
96
+ help: "SQL statements executed by type",
97
+ values: {
98
+ select: this.sqlSelects,
99
+ insert: this.sqlInserts,
100
+ update: this.sqlUpdates,
101
+ delete: this.sqlDeletes,
102
+ other: this.sqlOther,
103
+ },
104
+ },
105
+ sql_duration_ms: {
106
+ type: "counter",
107
+ help: "Total SQL execution time in milliseconds",
108
+ value: this.sqlTotalMs,
109
+ },
110
+ action_calls: {
111
+ type: "counter",
112
+ help: "Total action invocations",
113
+ value: this.actionCalls,
114
+ },
115
+ action_errors: {
116
+ type: "counter",
117
+ help: "Total action errors",
118
+ value: this.actionErrors,
119
+ },
120
+ action_duration_ms: {
121
+ type: "counter",
122
+ help: "Total action execution time in milliseconds",
123
+ value: this.actionTotalMs,
124
+ },
125
+ connections_opened: {
126
+ type: "counter",
127
+ help: "Total WebSocket connections opened",
128
+ value: this.connectionsOpened,
129
+ },
130
+ connections_closed: {
131
+ type: "counter",
132
+ help: "Total WebSocket connections closed",
133
+ value: this.connectionsClosed,
134
+ },
135
+ };
136
+ }
137
+ }
@@ -273,18 +273,15 @@ export async function processMessage<
273
273
  subscribe,
274
274
  });
275
275
 
276
- if (subscribe) {
277
- await actor.assertCanSubscribe(
278
- new ActionContext<S, CP, CS, V, I, DB, E, Q>(
279
- actor,
280
- conn,
281
- ),
282
- eventName,
283
- );
284
- await handler.onSubscribe(eventName, conn);
285
- } else {
286
- await handler.onUnsubscribe(eventName, conn);
287
- }
276
+ if (subscribe) {
277
+ await actor.assertCanSubscribe(
278
+ new ActionContext<S, CP, CS, V, I, DB, E, Q>(actor, conn),
279
+ eventName,
280
+ );
281
+ await handler.onSubscribe(eventName, conn);
282
+ } else {
283
+ await handler.onUnsubscribe(eventName, conn);
284
+ }
288
285
 
289
286
  actor.rLog.debug({
290
287
  msg: "subscription request completed",
@@ -86,7 +86,12 @@ export async function routeWebSocket(
86
86
  });
87
87
 
88
88
  // Promise used to wait for the websocket close in `disconnect`
89
- const closePromiseResolvers = promiseWithResolvers<void>((reason) => loggerWithoutContext().warn({ msg: "unhandled websocket close promise rejection", reason }));
89
+ const closePromiseResolvers = promiseWithResolvers<void>((reason) =>
90
+ loggerWithoutContext().warn({
91
+ msg: "unhandled websocket close promise rejection",
92
+ reason,
93
+ }),
94
+ );
90
95
 
91
96
  // Strip query parameters from requestPath for routing purposes.
92
97
  // This handles paths like "/websocket?query=value" which should route
@@ -193,8 +198,8 @@ export async function routeWebSocket(
193
198
  onMessage: (_evt: { data: any }, ws: WSContext) => {
194
199
  ws.close(1011, "actor.not_loaded");
195
200
  },
196
- onClose: (_event: any, _ws: WSContext) => { },
197
- onError: (_error: unknown) => { },
201
+ onClose: (_event: any, _ws: WSContext) => {},
202
+ onError: (_error: unknown) => {},
198
203
  };
199
204
  }
200
205
  }
@@ -240,7 +245,8 @@ export async function handleWebSocketConnect(
240
245
  .then(async () => {
241
246
  const message = await parseMessage(value, {
242
247
  encoding: encoding,
243
- maxIncomingMessageSize: runConfig.maxIncomingMessageSize,
248
+ maxIncomingMessageSize:
249
+ runConfig.maxIncomingMessageSize,
244
250
  });
245
251
  await actor.processMessage(message, conn);
246
252
  })
@@ -339,7 +345,7 @@ export async function handleRawWebSocket(
339
345
  },
340
346
  // Raw websocket messages are handled directly by the actor's event
341
347
  // listeners on the WebSocket object, not through this callback
342
- onMessage: (_evt: any, _ws: any) => { },
348
+ onMessage: (_evt: any, _ws: any) => {},
343
349
  onClose: (evt: any, ws: any) => {
344
350
  // Resolve the close promise
345
351
  closePromiseResolvers.resolve();
@@ -347,7 +353,7 @@ export async function handleRawWebSocket(
347
353
  // Clean up the connection
348
354
  conn.disconnect(evt?.reason);
349
355
  },
350
- onError: (error: any, ws: any) => { },
356
+ onError: (error: any, ws: any) => {},
351
357
  };
352
358
  }
353
359
 
@@ -43,6 +43,8 @@ export type ActorRouter = Hono<{ Bindings: ActorRouterBindings }>;
43
43
  export interface MetadataResponse {
44
44
  runtime: string;
45
45
  version: string;
46
+ /** "local" for development, "deployed" for production */
47
+ type: "local" | "deployed";
46
48
  }
47
49
 
48
50
  /**
@@ -90,6 +92,7 @@ export function createActorRouter(
90
92
  return c.json({
91
93
  runtime: "rivetkit",
92
94
  version: VERSION,
95
+ type: isDev() ? "local" : "deployed",
93
96
  } satisfies MetadataResponse);
94
97
  });
95
98
 
@@ -286,6 +289,38 @@ export function createActorRouter(
286
289
  return c.json(result);
287
290
  });
288
291
 
292
+ router.get("/inspector/database/schema", async (c) => {
293
+ const authResponse = await inspectorAuth(c);
294
+ if (authResponse) return authResponse;
295
+
296
+ const actor = await actorDriver.loadActor(c.env.actorId);
297
+ const schema = await actor.inspector.getDatabaseSchemaJson();
298
+ return c.json({ schema });
299
+ });
300
+
301
+ router.get("/inspector/database/rows", async (c) => {
302
+ const authResponse = await inspectorAuth(c);
303
+ if (authResponse) return authResponse;
304
+
305
+ const actor = await actorDriver.loadActor(c.env.actorId);
306
+ const table = c.req.query("table");
307
+ if (!table) {
308
+ return c.json(
309
+ { error: "Missing required table query parameter" },
310
+ 400,
311
+ );
312
+ }
313
+
314
+ const limit = parseInt(c.req.query("limit") ?? "100", 10);
315
+ const offset = parseInt(c.req.query("offset") ?? "0", 10);
316
+ const rows = await actor.inspector.getDatabaseTableRowsJson(
317
+ table,
318
+ limit,
319
+ offset,
320
+ );
321
+ return c.json({ rows });
322
+ });
323
+
289
324
  router.get("/inspector/summary", async (c) => {
290
325
  const authResponse = await inspectorAuth(c);
291
326
  if (authResponse) return authResponse;
@@ -295,6 +330,8 @@ export function createActorRouter(
295
330
  const isStateEnabled = actor.inspector.isStateEnabled();
296
331
  const isDatabaseEnabled = actor.inspector.isDatabaseEnabled();
297
332
  const isWorkflowEnabled = actor.inspector.isWorkflowEnabled();
333
+ const workflowHistory =
334
+ actor.inspector.getWorkflowHistoryJson().history;
298
335
 
299
336
  const state = isStateEnabled
300
337
  ? actor.inspector.getStateJson()
@@ -302,14 +339,6 @@ export function createActorRouter(
302
339
  const connections = actor.inspector.getConnectionsJson();
303
340
  const rpcs = actor.inspector.getRpcs();
304
341
  const queueSize = actor.inspector.getQueueSize();
305
- const workflowHistory = actor.inspector.getWorkflowHistory();
306
-
307
- // Convert BigInt values in workflow history to numbers for JSON serialization.
308
- const bigIntReplacer = (_key: string, value: unknown) =>
309
- typeof value === "bigint" ? Number(value) : value;
310
- const safeWorkflowHistory = workflowHistory
311
- ? JSON.parse(JSON.stringify(workflowHistory, bigIntReplacer))
312
- : null;
313
342
 
314
343
  return c.json({
315
344
  state,
@@ -319,9 +348,17 @@ export function createActorRouter(
319
348
  isStateEnabled,
320
349
  isDatabaseEnabled,
321
350
  isWorkflowEnabled,
322
- workflowHistory: safeWorkflowHistory,
351
+ workflowHistory,
323
352
  });
324
353
  });
354
+
355
+ router.get("/inspector/metrics", async (c) => {
356
+ const authResponse = await inspectorAuth(c);
357
+ if (authResponse) return authResponse;
358
+
359
+ const actor = await actorDriver.loadActor(c.env.actorId);
360
+ return c.json(actor.metrics.snapshot());
361
+ });
325
362
  }
326
363
 
327
364
  router.post("/action/:action", async (c) => {
@@ -11,11 +11,7 @@ export interface EventTypeToken<T, TContext = any> {
11
11
  readonly schema?: PrimitiveSchema;
12
12
  }
13
13
 
14
- export interface QueueTypeToken<
15
- TMessage,
16
- TComplete = never,
17
- TContext = any,
18
- > {
14
+ export interface QueueTypeToken<TMessage, TComplete = never, TContext = any> {
19
15
  readonly _queueMessage?: TMessage;
20
16
  readonly _queueComplete?: TComplete;
21
17
  readonly canPublish?: SchemaHook<TContext>;
@@ -45,11 +41,7 @@ export function event<T, TContext = any>(
45
41
 
46
42
  export function queue<TMessage, TComplete = never, TContext = any>(
47
43
  options?: QueueOptions<TContext>,
48
- ): QueueTypeToken<
49
- TMessage,
50
- TComplete,
51
- TContext
52
- > {
44
+ ): QueueTypeToken<TMessage, TComplete, TContext> {
53
45
  return (options ?? {}) as QueueTypeToken<TMessage, TComplete, TContext>;
54
46
  }
55
47
 
@@ -87,16 +79,16 @@ export type SchemaConfig = QueueSchemaConfig;
87
79
 
88
80
  export type InferSchema<T> =
89
81
  T extends QueueSchemaDefinition<any>
90
- ? InferSchema<T["message"]>
91
- : T extends QueueTypeToken<infer M, unknown, any>
82
+ ? InferSchema<T["message"]>
83
+ : T extends QueueTypeToken<infer M, unknown, any>
92
84
  ? M
93
85
  : T extends EventSchemaDefinition<any>
94
- ? InferSchema<T["schema"]>
95
- : T extends StandardSchemaV1<any, infer O>
96
- ? O
97
- : T extends EventTypeToken<infer R, any>
98
- ? R
99
- : never;
86
+ ? InferSchema<T["schema"]>
87
+ : T extends StandardSchemaV1<any, infer O>
88
+ ? O
89
+ : T extends EventTypeToken<infer R, any>
90
+ ? R
91
+ : never;
100
92
 
101
93
  export type InferSchemaMap<T extends Record<string, unknown>> = {
102
94
  [K in keyof T]: InferSchema<T[K]>;
@@ -104,10 +96,10 @@ export type InferSchemaMap<T extends Record<string, unknown>> = {
104
96
 
105
97
  export type InferQueueComplete<T> =
106
98
  T extends QueueTypeToken<unknown, infer C, any>
107
- ? [C] extends [never]
108
- ? never
109
- : C
110
- : T extends QueueSchemaDefinition<any>
99
+ ? [C] extends [never]
100
+ ? never
101
+ : C
102
+ : T extends QueueSchemaDefinition<any>
111
103
  ? T["complete"] extends PrimitiveSchema
112
104
  ? InferSchema<T["complete"]>
113
105
  : never
@@ -1,4 +1,16 @@
1
1
  import type { ActorDefinition, AnyActorDefinition } from "@/actor/definition";
2
+ import type {
3
+ EventSchemaConfig,
4
+ InferEventArgs,
5
+ InferQueueCompleteMap,
6
+ InferSchemaMap,
7
+ QueueSchemaConfig,
8
+ } from "@/actor/schema";
9
+ import type {
10
+ QueueSendNoWaitOptions,
11
+ QueueSendResult,
12
+ QueueSendWaitOptions,
13
+ } from "./queue";
2
14
 
3
15
  /**
4
16
  * Action function returned by Actor connections and handles.
@@ -30,3 +42,56 @@ export type ActorDefinitionActions<AD extends AnyActorDefinition> =
30
42
  : never;
31
43
  }
32
44
  : never;
45
+
46
+ type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
47
+ <K extends keyof TQueues & string>(
48
+ name: K,
49
+ body: InferSchemaMap<TQueues>[K],
50
+ options: QueueSendWaitOptions,
51
+ ): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
52
+ <K extends keyof TQueues & string>(
53
+ name: K,
54
+ body: InferSchemaMap<TQueues>[K],
55
+ options?: QueueSendNoWaitOptions,
56
+ ): Promise<void>;
57
+ (
58
+ name: keyof TQueues extends never ? string : never,
59
+ body: unknown,
60
+ options: QueueSendWaitOptions,
61
+ ): Promise<QueueSendResult>;
62
+ (
63
+ name: keyof TQueues extends never ? string : never,
64
+ body: unknown,
65
+ options?: QueueSendNoWaitOptions,
66
+ ): Promise<void>;
67
+ };
68
+
69
+ type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
70
+ <K extends keyof TEvents & string>(
71
+ eventName: K,
72
+ callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void,
73
+ ): () => void;
74
+ (
75
+ eventName: keyof TEvents extends never ? string : never,
76
+ callback: (...args: any[]) => void,
77
+ ): () => void;
78
+ };
79
+
80
+ export type ActorDefinitionQueueSend<AD extends AnyActorDefinition> =
81
+ // biome-ignore lint/suspicious/noExplicitAny: safe to use any here
82
+ AD extends ActorDefinition<any, any, any, any, any, any, any, infer Q, any>
83
+ ? Q extends QueueSchemaConfig
84
+ ? { send: ActorQueueSend<Q> }
85
+ : never
86
+ : never;
87
+
88
+ export type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> =
89
+ // biome-ignore lint/suspicious/noExplicitAny: safe to use any here
90
+ AD extends ActorDefinition<any, any, any, any, any, any, infer E, any, any>
91
+ ? E extends EventSchemaConfig
92
+ ? {
93
+ on: ActorEventSubscribe<E>;
94
+ once: ActorEventSubscribe<E>;
95
+ }
96
+ : never
97
+ : never;
@@ -25,7 +25,11 @@ import {
25
25
  import { deserializeWithEncoding, serializeWithEncoding } from "@/serde";
26
26
  import { bufferToArrayBuffer, promiseWithResolvers } from "@/utils";
27
27
  import { getLogMessage } from "@/utils/env-vars";
28
- import type { ActorDefinitionActions } from "./actor-common";
28
+ import type {
29
+ ActorDefinitionActions,
30
+ ActorDefinitionEventSubscriptions,
31
+ ActorDefinitionQueueSend,
32
+ } from "./actor-common";
29
33
  import { checkForSchedulingError, queryActor } from "./actor-query";
30
34
  import { ACTOR_CONNS_SYMBOL, type ClientRaw } from "./client";
31
35
  import * as errors from "./errors";
@@ -160,6 +164,7 @@ export class ActorConnRaw {
160
164
  #client: ClientRaw;
161
165
  #driver: ManagerDriver;
162
166
  #params: unknown;
167
+ #getParams?: () => Promise<unknown>;
163
168
  #encoding: Encoding;
164
169
  #actorQuery: ActorQuery;
165
170
 
@@ -176,12 +181,14 @@ export class ActorConnRaw {
176
181
  client: ClientRaw,
177
182
  driver: ManagerDriver,
178
183
  params: unknown,
184
+ getParams: (() => Promise<unknown>) | undefined,
179
185
  encoding: Encoding,
180
186
  actorQuery: ActorQuery,
181
187
  ) {
182
188
  this.#client = client;
183
189
  this.#driver = driver;
184
190
  this.#params = params;
191
+ this.#getParams = getParams;
185
192
  this.#encoding = encoding;
186
193
  this.#actorQuery = actorQuery;
187
194
  this.#queueSender = createQueueSender({
@@ -248,7 +255,12 @@ export class ActorConnRaw {
248
255
  const { promise, resolve, reject } = promiseWithResolvers<{
249
256
  id: bigint;
250
257
  output: unknown;
251
- }>((reason) => logger().warn({ msg: "unhandled action promise rejection", reason }));
258
+ }>((reason) =>
259
+ logger().warn({
260
+ msg: "unhandled action promise rejection",
261
+ reason,
262
+ }),
263
+ );
252
264
  this.#actionsInFlight.set(actionId, {
253
265
  name: opts.name,
254
266
  resolve,
@@ -379,7 +391,12 @@ export class ActorConnRaw {
379
391
  // Create promise for open
380
392
  if (this.#onOpenPromise)
381
393
  throw new Error("#onOpenPromise already defined");
382
- this.#onOpenPromise = promiseWithResolvers((reason) => logger().warn({ msg: "unhandled open promise rejection", reason }));
394
+ this.#onOpenPromise = promiseWithResolvers((reason) =>
395
+ logger().warn({
396
+ msg: "unhandled open promise rejection",
397
+ reason,
398
+ }),
399
+ );
383
400
 
384
401
  await this.#connectWebSocket();
385
402
 
@@ -390,6 +407,40 @@ export class ActorConnRaw {
390
407
  }
391
408
  }
392
409
 
410
+ #clearQueuedMessages() {
411
+ if (this.#messageQueue.length === 0) return;
412
+
413
+ logger().debug({
414
+ msg: "clearing queued connection messages",
415
+ queueLength: this.#messageQueue.length,
416
+ });
417
+ this.#messageQueue = [];
418
+ }
419
+
420
+ async #resolveConnectionParams(): Promise<unknown> {
421
+ if (!this.#getParams) {
422
+ return this.#params;
423
+ }
424
+
425
+ try {
426
+ return await this.#getParams();
427
+ } catch (err) {
428
+ const errorMessage = stringifyError(err);
429
+ const error = new errors.ActorError(
430
+ "client",
431
+ "get_params_failed",
432
+ `Failed to resolve connection params: ${errorMessage}`,
433
+ { error: errorMessage },
434
+ );
435
+
436
+ this.#clearQueuedMessages();
437
+ this.#rejectPendingPromises(error, false);
438
+ this.#dispatchActorError(error);
439
+
440
+ throw error;
441
+ }
442
+ }
443
+
393
444
  async #connectWebSocket() {
394
445
  const { actorId } = await queryActor(
395
446
  undefined,
@@ -399,12 +450,13 @@ export class ActorConnRaw {
399
450
 
400
451
  // Store actorId early so we can use it for error lookups
401
452
  this.#actorId = actorId;
453
+ const params = await this.#resolveConnectionParams();
402
454
 
403
455
  const ws = await this.#driver.openWebSocket(
404
456
  PATH_CONNECT,
405
457
  actorId,
406
458
  this.#encoding,
407
- this.#params,
459
+ params,
408
460
  );
409
461
  logger().debug({
410
462
  msg: "opened websocket",
@@ -419,7 +471,7 @@ export class ActorConnRaw {
419
471
  connId: this.#connId,
420
472
  });
421
473
  });
422
- ws.addEventListener("message", async (ev) => {
474
+ ws.addEventListener("message", async (ev: { data: ConnMessage }) => {
423
475
  try {
424
476
  await this.#handleOnMessage(ev.data);
425
477
  } catch (err) {
@@ -429,7 +481,7 @@ export class ActorConnRaw {
429
481
  });
430
482
  }
431
483
  });
432
- ws.addEventListener("close", async (ev) => {
484
+ ws.addEventListener("close", async (ev: Event | CloseEvent) => {
433
485
  try {
434
486
  await this.#handleOnClose(ev);
435
487
  } catch (err) {
@@ -439,7 +491,7 @@ export class ActorConnRaw {
439
491
  });
440
492
  }
441
493
  });
442
- ws.addEventListener("error", (_ev) => {
494
+ ws.addEventListener("error", () => {
443
495
  try {
444
496
  this.#handleOnError();
445
497
  } catch (err) {
@@ -1216,7 +1268,12 @@ export class ActorConnRaw {
1216
1268
  ws.readyState !== 2 /* CLOSING */ &&
1217
1269
  ws.readyState !== 3 /* CLOSED */
1218
1270
  ) {
1219
- const { promise, resolve } = promiseWithResolvers((reason) => logger().warn({ msg: "unhandled websocket close promise rejection", reason }));
1271
+ const { promise, resolve } = promiseWithResolvers((reason) =>
1272
+ logger().warn({
1273
+ msg: "unhandled websocket close promise rejection",
1274
+ reason,
1275
+ }),
1276
+ );
1220
1277
  ws.addEventListener("close", () => resolve(undefined));
1221
1278
  ws.close(1000, "Disposed");
1222
1279
  await promise;
@@ -1258,5 +1315,10 @@ export class ActorConnRaw {
1258
1315
  * @template AD The actor class that this connection is for.
1259
1316
  * @see {@link ActorConnRaw}
1260
1317
  */
1261
- export type ActorConn<AD extends AnyActorDefinition> = ActorConnRaw &
1318
+ export type ActorConn<AD extends AnyActorDefinition> = Omit<
1319
+ ActorConnRaw,
1320
+ "send" | "on" | "once"
1321
+ > &
1322
+ ActorDefinitionQueueSend<AD> &
1323
+ ActorDefinitionEventSubscriptions<AD> &
1262
1324
  ActorDefinitionActions<AD>;