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
@@ -1,15 +1,15 @@
1
1
  import { z as z$1 } from 'zod/v4';
2
2
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
3
- import { A as AnyDatabaseProvider, D as DatabaseProvider, a as RawDatabaseClient } from './config-BiNoIHRs.cjs';
3
+ import { A as AnyDatabaseProvider, D as DatabaseProvider, a as RawDatabaseClient, b as ActorMetrics } from './config-DROwzBLT.cjs';
4
4
  import { Traces, OtlpExportTraceServiceRequestJson, SpanHandle, SpanStatusInput } from '@rivetkit/traces';
5
5
  import { Env, Context, Hono } from 'hono';
6
6
  import { VersionedDataHandler } from 'vbare';
7
- import { Logger } from 'pino';
8
7
  import { GetUpgradeWebSocket } from './utils.cjs';
9
- import { SqliteVfs } from '@rivetkit/sqlite-vfs';
8
+ import { StandardSchemaV1 } from '@standard-schema/spec';
9
+ import { ISqliteVfs } from '@rivetkit/sqlite-vfs';
10
10
  import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
11
11
  import { z } from 'zod';
12
- import { StandardSchemaV1 } from '@standard-schema/spec';
12
+ import { Logger } from 'pino';
13
13
  import * as nanoevents from 'nanoevents';
14
14
  import { W as WorkflowHistory, k as QueueStatus } from './v3-DnYObHH3.cjs';
15
15
 
@@ -98,8 +98,18 @@ interface ActorDriver {
98
98
  kvBatchGet(actorId: string, keys: Uint8Array[]): Promise<(Uint8Array | null)[]>;
99
99
  /** Batch delete multiple keys. */
100
100
  kvBatchDelete(actorId: string, keys: Uint8Array[]): Promise<void>;
101
+ /** Delete all keys in the half-open range [start, end). */
102
+ kvDeleteRange(actorId: string, start: Uint8Array, end: Uint8Array): Promise<void>;
101
103
  /** List all keys with a given prefix. */
102
- kvListPrefix(actorId: string, prefix: Uint8Array): Promise<[Uint8Array, Uint8Array][]>;
104
+ kvListPrefix(actorId: string, prefix: Uint8Array, options?: {
105
+ reverse?: boolean;
106
+ limit?: number;
107
+ }): Promise<[Uint8Array, Uint8Array][]>;
108
+ /** List all keys in the half-open range [start, end). */
109
+ kvListRange(actorId: string, start: Uint8Array, end: Uint8Array, options?: {
110
+ reverse?: boolean;
111
+ limit?: number;
112
+ }): Promise<[Uint8Array, Uint8Array][]>;
103
113
  /** ActorInstance ensure that only one instance of setAlarm is called in parallel at a time. */
104
114
  setAlarm(actor: AnyActorInstance, timestamp: number): Promise<void>;
105
115
  /**
@@ -118,13 +128,12 @@ interface ActorDriver {
118
128
  * Creates a SQLite VFS instance for creating KV-backed databases.
119
129
  * If not provided, the database provider will need an override.
120
130
  *
121
- * @rivetkit/sqlite's async build is not re-entrant per module instance. Drivers
122
- * should return a new instance per call for actor-level isolation.
131
+ * Drivers may use the actorId for pool-based instance assignment.
123
132
  *
124
133
  * This is a method (not a property) so drivers can use dynamic imports,
125
134
  * keeping the core driver tree-shakeable from @rivetkit/sqlite.
126
135
  */
127
- createSqliteVfs?(): SqliteVfs | Promise<SqliteVfs>;
136
+ createSqliteVfs?(actorId: string): ISqliteVfs | Promise<ISqliteVfs>;
128
137
  /**
129
138
  * Requests the actor to go to sleep.
130
139
  *
@@ -171,6 +180,10 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
171
180
  autoStartActorDriver: z.ZodBoolean;
172
181
  }, z.core.$strip>>;
173
182
  storagePath: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
183
+ sqlitePool: z.ZodDefault<z.ZodOptional<z.ZodObject<{
184
+ actorsPerInstance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
185
+ idleDestroyMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
186
+ }, z.core.$strip>>>;
174
187
  maxIncomingMessageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
175
188
  maxOutgoingMessageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
176
189
  noWelcome: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -191,6 +204,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
191
204
  namespace: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
192
205
  headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
193
206
  serveManager: z.ZodOptional<z.ZodBoolean>;
207
+ publicDir: z.ZodOptional<z.ZodString>;
194
208
  managerBasePath: z.ZodDefault<z.ZodOptional<z.ZodString>>;
195
209
  managerPort: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
196
210
  managerHost: z.ZodOptional<z.ZodString>;
@@ -222,7 +236,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
222
236
  runner: z.ZodDefault<z.ZodOptional<z.ZodObject<{
223
237
  totalSlots: z.ZodDefault<z.ZodNumber>;
224
238
  runnerName: z.ZodDefault<z.ZodString>;
225
- runnerKey: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
239
+ runnerKey: z.ZodOptional<z.ZodString>;
226
240
  version: z.ZodDefault<z.ZodNumber>;
227
241
  }, z.core.$strip>>>;
228
242
  }, z.core.$strip>, z.ZodTransform<{
@@ -270,6 +284,10 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
270
284
  enabled: boolean;
271
285
  };
272
286
  storagePath: string | undefined;
287
+ sqlitePool: {
288
+ actorsPerInstance: number;
289
+ idleDestroyMs: number;
290
+ };
273
291
  maxIncomingMessageSize: number;
274
292
  maxOutgoingMessageSize: number;
275
293
  noWelcome: boolean;
@@ -283,8 +301,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
283
301
  runner: {
284
302
  totalSlots: number;
285
303
  runnerName: string;
286
- runnerKey: string | undefined;
287
304
  version: number;
305
+ runnerKey?: string | undefined;
288
306
  };
289
307
  driver?: {
290
308
  name: string;
@@ -293,6 +311,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
293
311
  actor: ActorDriverBuilder;
294
312
  autoStartActorDriver: boolean;
295
313
  } | undefined;
314
+ publicDir?: string | undefined;
296
315
  managerHost?: string | undefined;
297
316
  }, {
298
317
  use: Record<string, AnyActorDefinition>;
@@ -300,6 +319,10 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
300
319
  enabled: boolean;
301
320
  };
302
321
  storagePath: string | undefined;
322
+ sqlitePool: {
323
+ actorsPerInstance: number;
324
+ idleDestroyMs: number;
325
+ };
303
326
  maxIncomingMessageSize: number;
304
327
  maxOutgoingMessageSize: number;
305
328
  noWelcome: boolean;
@@ -341,8 +364,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
341
364
  runner: {
342
365
  totalSlots: number;
343
366
  runnerName: string;
344
- runnerKey: string | undefined;
345
367
  version: number;
368
+ runnerKey?: string | undefined;
346
369
  };
347
370
  driver?: {
348
371
  name: string;
@@ -352,6 +375,7 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
352
375
  autoStartActorDriver: boolean;
353
376
  } | undefined;
354
377
  serveManager?: boolean | undefined;
378
+ publicDir?: string | undefined;
355
379
  managerHost?: string | undefined;
356
380
  }>>;
357
381
  type RegistryConfig = z.infer<typeof RegistryConfigSchema>;
@@ -406,6 +430,10 @@ declare const DocRunnerConfigSchema: z.ZodObject<{
406
430
  declare const DocRegistryConfigSchema: z.ZodObject<{
407
431
  use: z.ZodRecord<z.ZodString, z.ZodUnknown>;
408
432
  storagePath: z.ZodOptional<z.ZodString>;
433
+ sqlitePool: z.ZodOptional<z.ZodObject<{
434
+ actorsPerInstance: z.ZodOptional<z.ZodNumber>;
435
+ idleDestroyMs: z.ZodOptional<z.ZodNumber>;
436
+ }, z.core.$strip>>;
409
437
  maxIncomingMessageSize: z.ZodOptional<z.ZodNumber>;
410
438
  maxOutgoingMessageSize: z.ZodOptional<z.ZodNumber>;
411
439
  noWelcome: z.ZodOptional<z.ZodBoolean>;
@@ -425,6 +453,7 @@ declare const DocRegistryConfigSchema: z.ZodObject<{
425
453
  namespace: z.ZodOptional<z.ZodString>;
426
454
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
427
455
  serveManager: z.ZodOptional<z.ZodBoolean>;
456
+ publicDir: z.ZodOptional<z.ZodString>;
428
457
  managerBasePath: z.ZodOptional<z.ZodString>;
429
458
  managerPort: z.ZodOptional<z.ZodNumber>;
430
459
  inspector: z.ZodOptional<z.ZodObject<{
@@ -540,175 +569,10 @@ declare class CachedSerializer<TBare, TJson, T = TBare> {
540
569
  serialize(encoding: Encoding): OutputData;
541
570
  }
542
571
 
543
- declare const LegacyRunnerConfigSchema: z$1.ZodDefault<z$1.ZodPipe<z$1.ZodObject<{
544
- driver: z$1.ZodOptional<z$1.ZodObject<{
545
- name: z$1.ZodString;
546
- manager: z$1.ZodCustom<ManagerDriverBuilder, ManagerDriverBuilder>;
547
- actor: z$1.ZodCustom<ActorDriverBuilder, ActorDriverBuilder>;
548
- }, z$1.core.$strip>>;
549
- maxIncomingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
550
- maxOutgoingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
551
- inspector: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
552
- enabled: z$1.ZodDefault<z$1.ZodBoolean>;
553
- token: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodCustom<() => string, () => string>>>;
554
- defaultEndpoint: z$1.ZodOptional<z$1.ZodString>;
555
- }, z$1.core.$strip>>>;
556
- disableDefaultServer: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
557
- defaultServerPort: z$1.ZodDefault<z$1.ZodNumber>;
558
- runEngine: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
559
- runEngineVersion: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
560
- overrideServerAddress: z$1.ZodOptional<z$1.ZodString>;
561
- disableActorDriver: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
562
- runnerKind: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
563
- serverless: "serverless";
564
- normal: "normal";
565
- }>>>;
566
- basePath: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
567
- noWelcome: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
568
- logging: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
569
- baseLogger: z$1.ZodOptional<z$1.ZodCustom<Logger, Logger>>;
570
- level: z$1.ZodOptional<z$1.ZodEnum<{
571
- error: "error";
572
- trace: "trace";
573
- fatal: "fatal";
574
- warn: "warn";
575
- info: "info";
576
- debug: "debug";
577
- silent: "silent";
578
- }>>;
579
- }, z$1.core.$strip>>>;
580
- autoConfigureServerless: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodObject<{
581
- url: z$1.ZodOptional<z$1.ZodString>;
582
- headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
583
- maxRunners: z$1.ZodOptional<z$1.ZodNumber>;
584
- minRunners: z$1.ZodOptional<z$1.ZodNumber>;
585
- requestLifespan: z$1.ZodOptional<z$1.ZodNumber>;
586
- runnersMargin: z$1.ZodOptional<z$1.ZodNumber>;
587
- slotsPerRunner: z$1.ZodOptional<z$1.ZodNumber>;
588
- metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
589
- }, z$1.core.$strip>]>>;
590
- endpoint: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string, string | undefined>>;
591
- token: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
592
- namespace: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
593
- runnerName: z$1.ZodDefault<z$1.ZodString>;
594
- encoding: z$1.ZodDefault<z$1.ZodEnum<{
595
- json: "json";
596
- cbor: "cbor";
597
- bare: "bare";
598
- }>>;
599
- headers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>>;
600
- getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodCustom<GetUpgradeWebSocket, GetUpgradeWebSocket>>;
601
- disableMetadataLookup: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
602
- devtools: z$1.ZodDefault<z$1.ZodBoolean>;
603
- runnerKey: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
604
- totalSlots: z$1.ZodDefault<z$1.ZodNumber>;
605
- }, z$1.core.$strip>, z$1.ZodTransform<{
606
- runnerKey: string | undefined;
607
- endpoint: string | undefined;
608
- namespace: string;
609
- token: string | undefined;
610
- runnerName: string;
611
- encoding: "json" | "cbor" | "bare";
612
- headers: Record<string, string>;
613
- disableMetadataLookup: boolean;
614
- devtools: boolean;
615
- getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
616
- maxIncomingMessageSize: number;
617
- maxOutgoingMessageSize: number;
618
- inspector: {
619
- enabled: boolean;
620
- token: () => string;
621
- defaultEndpoint?: string | undefined;
622
- };
623
- disableDefaultServer: boolean;
624
- defaultServerPort: number;
625
- runEngine: boolean;
626
- runEngineVersion: string;
627
- disableActorDriver: boolean;
628
- runnerKind: "serverless" | "normal";
629
- basePath: string;
630
- noWelcome: boolean;
631
- logging: {
632
- baseLogger?: Logger | undefined;
633
- level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent" | undefined;
634
- };
635
- totalSlots: number;
636
- driver?: {
637
- name: string;
638
- manager: ManagerDriverBuilder;
639
- actor: ActorDriverBuilder;
640
- } | undefined;
641
- overrideServerAddress?: string | undefined;
642
- autoConfigureServerless?: boolean | {
643
- url?: string | undefined;
644
- headers?: Record<string, string> | undefined;
645
- maxRunners?: number | undefined;
646
- minRunners?: number | undefined;
647
- requestLifespan?: number | undefined;
648
- runnersMargin?: number | undefined;
649
- slotsPerRunner?: number | undefined;
650
- metadata?: Record<string, unknown> | undefined;
651
- } | undefined;
652
- }, {
653
- maxIncomingMessageSize: number;
654
- maxOutgoingMessageSize: number;
655
- inspector: {
656
- enabled: boolean;
657
- token: () => string;
658
- defaultEndpoint?: string | undefined;
659
- };
660
- disableDefaultServer: boolean;
661
- defaultServerPort: number;
662
- runEngine: boolean;
663
- runEngineVersion: string;
664
- disableActorDriver: boolean;
665
- runnerKind: "serverless" | "normal";
666
- basePath: string;
667
- noWelcome: boolean;
668
- logging: {
669
- baseLogger?: Logger | undefined;
670
- level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent" | undefined;
671
- };
672
- endpoint: string;
673
- token: string | undefined;
674
- namespace: string | undefined;
675
- runnerName: string;
676
- encoding: "json" | "cbor" | "bare";
677
- headers: Record<string, string>;
678
- disableMetadataLookup: boolean;
679
- devtools: boolean;
680
- runnerKey: string | undefined;
681
- totalSlots: number;
682
- driver?: {
683
- name: string;
684
- manager: ManagerDriverBuilder;
685
- actor: ActorDriverBuilder;
686
- } | undefined;
687
- overrideServerAddress?: string | undefined;
688
- autoConfigureServerless?: boolean | {
689
- url?: string | undefined;
690
- headers?: Record<string, string> | undefined;
691
- maxRunners?: number | undefined;
692
- minRunners?: number | undefined;
693
- requestLifespan?: number | undefined;
694
- runnersMargin?: number | undefined;
695
- slotsPerRunner?: number | undefined;
696
- metadata?: Record<string, unknown> | undefined;
697
- } | undefined;
698
- getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
699
- }>>>;
700
- type LegacyRunnerConfigInput = z$1.input<typeof LegacyRunnerConfigSchema>;
701
-
702
572
  type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
703
573
  interface ServerlessHandler {
704
574
  fetch: FetchHandler;
705
575
  }
706
- interface LegacyStartServerOutput<A extends Registry<any>> {
707
- /** Client to communicate with the actors. */
708
- client: Client<A>;
709
- /** Fetch handler to manually route requests to the Rivet manager API. */
710
- fetch: FetchHandler;
711
- }
712
576
  declare class Registry<A extends RegistryActors> {
713
577
  #private;
714
578
  get config(): RegistryConfigInput<A>;
@@ -739,11 +603,22 @@ declare class Registry<A extends RegistryActors> {
739
603
  */
740
604
  startRunner(): void;
741
605
  /**
742
- * Runs the registry for a server.
606
+ * Starts the server, serving both the actor API and static files.
743
607
  *
744
- * @deprecated Use {@link Registry.startRunner} for long-running servers or {@link Registry.handler} for serverless deployments.
608
+ * This is the simplest way to run RivetKit. It starts a local manager
609
+ * server, serves static files from the configured `publicDir` (default
610
+ * `"public"`), and starts the actor runner.
611
+ *
612
+ * When an endpoint is configured (via config or RIVET_ENDPOINT env var),
613
+ * operates in serverless mode connected to the remote engine instead.
614
+ *
615
+ * @example
616
+ * ```ts
617
+ * const registry = setup({ use: { counter } });
618
+ * registry.start();
619
+ * ```
745
620
  */
746
- start(inputConfig?: LegacyRunnerConfigInput): LegacyStartServerOutput<this>;
621
+ start(): void;
747
622
  }
748
623
  declare function setup<A extends RegistryActors>(input: RegistryConfigInput<A>): Registry<A>;
749
624
 
@@ -786,6 +661,21 @@ type ActorQuery = z$1.infer<typeof ActorQuerySchema>;
786
661
  */
787
662
  type CreateRequest = z$1.infer<typeof CreateRequestSchema>;
788
663
 
664
+ interface QueueSendWaitOptions {
665
+ wait: true;
666
+ timeout?: number;
667
+ signal?: AbortSignal;
668
+ }
669
+ interface QueueSendNoWaitOptions {
670
+ wait?: false;
671
+ timeout?: never;
672
+ signal?: AbortSignal;
673
+ }
674
+ interface QueueSendResult<TResponse = unknown> {
675
+ status: "completed" | "timedOut";
676
+ response?: TResponse;
677
+ }
678
+
789
679
  /**
790
680
  * Action function returned by Actor connections and handles.
791
681
  *
@@ -802,6 +692,23 @@ type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unk
802
692
  type ActorDefinitionActions<AD extends AnyActorDefinition> = AD extends ActorDefinition<any, any, any, any, any, any, any, any, infer R> ? {
803
693
  [K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
804
694
  } : never;
695
+ type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
696
+ <K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
697
+ <K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
698
+ (name: keyof TQueues extends never ? string : never, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
699
+ (name: keyof TQueues extends never ? string : never, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
700
+ };
701
+ type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
702
+ <K extends keyof TEvents & string>(eventName: K, callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void): () => void;
703
+ (eventName: keyof TEvents extends never ? string : never, callback: (...args: any[]) => void): () => void;
704
+ };
705
+ type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = AD extends ActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
706
+ send: ActorQueueSend<Q>;
707
+ } : never : never;
708
+ type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = AD extends ActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
709
+ on: ActorEventSubscribe<E>;
710
+ once: ActorEventSubscribe<E>;
711
+ } : never : never;
805
712
 
806
713
  declare class ActorClientError extends Error {
807
714
  }
@@ -824,21 +731,6 @@ declare class ActorConnDisposed extends ActorClientError {
824
731
  constructor();
825
732
  }
826
733
 
827
- interface QueueSendWaitOptions {
828
- wait: true;
829
- timeout?: number;
830
- signal?: AbortSignal;
831
- }
832
- interface QueueSendNoWaitOptions {
833
- wait?: false;
834
- timeout?: never;
835
- signal?: AbortSignal;
836
- }
837
- interface QueueSendResult {
838
- status: "completed" | "timedOut";
839
- response?: unknown;
840
- }
841
-
842
734
  /**
843
735
  * Connection status for an actor connection.
844
736
  *
@@ -887,7 +779,7 @@ declare class ActorConnRaw {
887
779
  *
888
780
  * @protected
889
781
  */
890
- constructor(client: ClientRaw, driver: ManagerDriver, params: unknown, encoding: Encoding, actorQuery: ActorQuery);
782
+ constructor(client: ClientRaw, driver: ManagerDriver, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorQuery: ActorQuery);
891
783
  send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
892
784
  send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
893
785
  /**
@@ -1002,7 +894,7 @@ declare class ActorConnRaw {
1002
894
  * @template AD The actor class that this connection is for.
1003
895
  * @see {@link ActorConnRaw}
1004
896
  */
1005
- type ActorConn<AD extends AnyActorDefinition> = ActorConnRaw & ActorDefinitionActions<AD>;
897
+ type ActorConn<AD extends AnyActorDefinition> = Omit<ActorConnRaw, "send" | "on" | "once"> & ActorDefinitionQueueSend<AD> & ActorDefinitionEventSubscriptions<AD> & ActorDefinitionActions<AD>;
1006
898
 
1007
899
  /**
1008
900
  * Provides underlying functions for stateless {@link ActorHandle} for action calls.
@@ -1019,7 +911,7 @@ declare class ActorHandleRaw {
1019
911
  *
1020
912
  * @protected
1021
913
  */
1022
- constructor(client: any, driver: ManagerDriver, params: unknown, encoding: Encoding, actorQuery: ActorQuery);
914
+ constructor(client: any, driver: ManagerDriver, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorQuery: ActorQuery);
1023
915
  send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
1024
916
  send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
1025
917
  /**
@@ -1075,10 +967,10 @@ declare class ActorHandleRaw {
1075
967
  * @template AD The actor class that this handle is for.
1076
968
  * @see {@link ActorHandleRaw}
1077
969
  */
1078
- type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect"> & {
970
+ type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect" | "send"> & {
1079
971
  connect(): ActorConn<AD>;
1080
972
  resolve(): Promise<string>;
1081
- } & ActorDefinitionActions<AD>;
973
+ } & ActorDefinitionQueueSend<AD> & ActorDefinitionActions<AD>;
1082
974
 
1083
975
  /** Extract the actor registry from the registry definition. */
1084
976
  type ExtractActorsFromRegistry<A extends Registry<any>> = A extends Registry<infer Actors> ? Actors : never;
@@ -1136,6 +1028,11 @@ interface ActorAccessor<AD extends AnyActorDefinition> {
1136
1028
  interface QueryOptions {
1137
1029
  /** Parameters to pass to the connection. */
1138
1030
  params?: unknown;
1031
+ /**
1032
+ * Lazily resolves connection parameters for `.connect()` and `.webSocket()`.
1033
+ * This is called each time a new connection is opened.
1034
+ */
1035
+ getParams?: () => Promise<unknown>;
1139
1036
  /** Signal to abort the request. */
1140
1037
  signal?: AbortSignal;
1141
1038
  }
@@ -1303,6 +1200,8 @@ declare class ActorInspector {
1303
1200
  executeAction(name: string, params: ArrayBuffer): Promise<ArrayBuffer>;
1304
1201
  getStateJson(): unknown;
1305
1202
  setStateJson(state: unknown): Promise<void>;
1203
+ getDatabaseSchemaJson(): Promise<unknown>;
1204
+ getDatabaseTableRowsJson(table: string, limit: number, offset: number): Promise<unknown[]>;
1306
1205
  getConnectionsJson(): {
1307
1206
  id: string;
1308
1207
  details: unknown;
@@ -1352,6 +1251,8 @@ type KvValueOptions<T extends KvValueType = "text"> = {
1352
1251
  };
1353
1252
  type KvListOptions<T extends KvValueType = "text", K extends KvKeyType = "text"> = KvValueOptions<T> & {
1354
1253
  keyType?: K;
1254
+ reverse?: boolean;
1255
+ limit?: number;
1355
1256
  };
1356
1257
  declare class ActorKv {
1357
1258
  #private;
@@ -1380,11 +1281,19 @@ declare class ActorKv {
1380
1281
  * Delete multiple keys.
1381
1282
  */
1382
1283
  deleteBatch(keys: KvKey[]): Promise<void>;
1284
+ /**
1285
+ * Delete all keys in the half-open range [start, end).
1286
+ */
1287
+ deleteRange(start: KvKey, end: KvKey): Promise<void>;
1383
1288
  /**
1384
1289
  * List all keys with a given prefix.
1385
1290
  * Returns key-value pairs where keys have the user prefix removed.
1386
1291
  */
1387
1292
  list<T extends KvValueType = "text", K extends KvKeyType = "text">(prefix: KvKeyTypeMap[K], options?: KvListOptions<T, K>): Promise<[KvKeyTypeMap[K], KvValueTypeMap[T]][]>;
1293
+ /**
1294
+ * List all key-value pairs in the half-open range [start, end).
1295
+ */
1296
+ listRange<T extends KvValueType = "text", K extends KvKeyType = "text">(start: KvKeyTypeMap[K], end: KvKeyTypeMap[K], options?: KvListOptions<T, K>): Promise<[KvKeyTypeMap[K], KvValueTypeMap[T]][]>;
1388
1297
  }
1389
1298
 
1390
1299
  interface QueueMessage {
@@ -1572,7 +1481,7 @@ declare class ActorContext<TState, TConnParams, TConnState, TVars, TInput, TData
1572
1481
  /**
1573
1482
  * Returns the client for the given registry.
1574
1483
  */
1575
- client<R extends Registry<any>>(): Client<R>;
1484
+ client<R extends Registry<any> = Registry<any>>(): Client<R>;
1576
1485
  /**
1577
1486
  * Gets the database.
1578
1487
  *
@@ -1590,16 +1499,33 @@ declare class ActorContext<TState, TConnParams, TConnState, TVars, TInput, TData
1590
1499
  saveState(opts: SaveStateOptions): Promise<void>;
1591
1500
  /**
1592
1501
  * Prevents the actor from sleeping until promise is complete.
1502
+ *
1503
+ * @deprecated Use `onSleep` for shutdown or flush work, or
1504
+ * `c.setPreventSleep(true)` while work is active if the actor must stay
1505
+ * awake until it finishes.
1593
1506
  */
1594
1507
  waitUntil(promise: Promise<void>): void;
1595
1508
  /**
1596
- * Prevents the actor from sleeping while the given promise is running.
1509
+ * Prevents the actor from automatically sleeping until cleared.
1597
1510
  *
1598
- * Use this when performing async operations in the `run` handler or other
1599
- * background contexts where you need to ensure the actor stays awake.
1511
+ * @experimental
1512
+ */
1513
+ setPreventSleep(prevent: boolean): void;
1514
+ /**
1515
+ * True when the actor is explicitly blocking automatic sleep.
1516
+ *
1517
+ * @experimental
1518
+ */
1519
+ get preventSleep(): boolean;
1520
+ /**
1521
+ * Prevents the actor from sleeping while the given promise is running.
1600
1522
  *
1601
1523
  * Returns the resolved value and resets the sleep timer on completion.
1602
1524
  * Errors are propagated to the caller.
1525
+ *
1526
+ * @deprecated Use `c.setPreventSleep(true)` while work is active, or move
1527
+ * shutdown and flush work to `onSleep` if it can wait until the actor is
1528
+ * sleeping.
1603
1529
  */
1604
1530
  keepAwake<T>(promise: Promise<T>): Promise<T>;
1605
1531
  /**
@@ -2068,6 +1994,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E e
2068
1994
  get inspector(): ActorInspector;
2069
1995
  get traces(): Traces<OtlpExportTraceServiceRequestJson>;
2070
1996
  get inspectorToken(): string | undefined;
1997
+ get metrics(): ActorMetrics;
2071
1998
  getCurrentTraceSpan(): SpanHandle | null;
2072
1999
  startTraceSpan(name: string, attributes?: Record<string, unknown>): SpanHandle;
2073
2000
  endTraceSpan(handle: SpanHandle, status?: SpanStatusInput): void;
@@ -2076,6 +2003,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E e
2076
2003
  get conns(): Map<ConnId, Conn<S, CP, CS, V, I, DB, E, Q>>;
2077
2004
  get schedule(): Schedule;
2078
2005
  get abortSignal(): AbortSignal;
2006
+ get preventSleep(): boolean;
2079
2007
  get actions(): string[];
2080
2008
  get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
2081
2009
  get persist(): PersistedActor<S, I>;
@@ -2128,6 +2056,7 @@ declare class ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E e
2128
2056
  * Errors are propagated to the caller.
2129
2057
  */
2130
2058
  keepAwake<T>(promise: Promise<T>): Promise<T>;
2059
+ setPreventSleep(prevent: boolean): void;
2131
2060
  beginQueueWait(): void;
2132
2061
  endQueueWait(): void;
2133
2062
  resetSleepTimer(): void;
@@ -2422,19 +2351,24 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
2422
2351
  * - Custom workflow logic
2423
2352
  *
2424
2353
  * **Important:** The actor may go to sleep at any time during the `run`
2425
- * handler. Use `c.keepAwake(promise)` to wrap async operations that should
2426
- * not be interrupted by sleep.
2354
+ * handler. Use `c.setPreventSleep(true)` while work is active, then clear
2355
+ * it with `c.setPreventSleep(false)` once the actor can sleep again.
2427
2356
  *
2428
2357
  * The handler receives an abort signal via `c.abortSignal` and a
2429
2358
  * `c.aborted` alias for loop checks. Use these to gracefully exit.
2430
2359
  *
2431
- * If this handler exits or throws, the actor will crash and reschedule.
2360
+ * If this handler exits, the actor will follow the normal idle sleep timeout
2361
+ * once it becomes idle.
2362
+ * If this handler throws, the actor logs the error and then sleeps once it
2363
+ * becomes idle.
2364
+ * Call `c.destroy()` explicitly if a run handler should destroy the actor.
2365
+ *
2432
2366
  * On shutdown, the actor waits for this handler to complete with a
2433
2367
  * configurable timeout (options.runStopTimeout, default 15s).
2434
2368
  *
2435
2369
  * Can be either a function or a RunConfig object with optional name/icon metadata.
2436
2370
  *
2437
- * @returns Void or a Promise. If the promise exits, the actor crashes.
2371
+ * @returns Void or a Promise.
2438
2372
  */
2439
2373
  run?: ((c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>) | RunConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2440
2374
  /**
@@ -2602,4 +2536,4 @@ declare const DocActorConfigSchema: z$1.ZodObject<{
2602
2536
  }, z$1.core.$strip>>;
2603
2537
  }, z$1.core.$strip>;
2604
2538
 
2605
- export { DocRunnerConfigSchema as $, type ActorDriver as A, BeforeActionResponseContext as B, type Client as C, ConnContext as D, type Encoding as E, type ConnContextOf as F, ConnInitContext as G, type ConnInitContextOf as H, ConnectContext as I, type ConnectContextOf as J, CreateConnStateContext as K, type CreateConnStateContextOf as L, CreateContext as M, type CreateContextOf as N, CreateVarsContext as O, type CreateVarsContextOf as P, type QueueSchemaConfig as Q, type RegistryConfig as R, DestroyContext as S, type DestroyContextOf as T, DisconnectContext as U, type DisconnectContextOf as V, DocActorConfigSchema as W, DocActorOptionsSchema as X, DocConfigureRunnerPoolSchema as Y, DocInspectorConfigSchema as Z, DocRegistryConfigSchema as _, type AnyConn as a, ActorInstance as a$, DocServerlessConfigSchema as a0, type FetchHandler as a1, type InspectorUnsubscribe as a2, type LegacyStartServerOutput as a3, RUN_FUNCTION_CONFIG_SYMBOL as a4, Registry as a5, type RegistryActors as a6, type RegistryConfigInput as a7, RegistryConfigSchema as a8, RequestContext as a9, test as aA, type ActorAccessor as aB, type ActorActionFunction as aC, ActorClientError as aD, type ActorConn as aE, ActorConnDisposed as aF, ActorConnRaw as aG, type ActorConnStatus as aH, ActorError as aI, type ActorHandle as aJ, ActorHandleRaw as aK, ClientRaw as aL, type ConnectionStateCallback as aM, type CreateOptions as aN, type CreateRequest as aO, type EventUnsubscribe as aP, type ExtractActorsFromRegistry as aQ, type ExtractRegistryFromClient as aR, type GetOptions as aS, type GetWithIdOptions as aT, InternalError as aU, MalformedResponseMessage as aV, ManagerError as aW, type QueryOptions as aX, type Region as aY, type StatusChangeCallback as aZ, type ManagerDriver as a_, type RequestContextOf as aa, type RunConfig as ab, RunConfigSchema as ac, RunContext as ad, type RunContextOf as ae, type RunInspectorConfig as af, type ServerlessHandler as ag, SleepContext as ah, type SleepContextOf as ai, StateChangeContext as aj, type StateChangeContextOf as ak, type TestConfig as al, TestConfigSchema as am, type Type as an, WakeContext as ao, type WakeContextOf as ap, WebSocketContext as aq, type WebSocketContextOf as ar, type WorkflowInspectorConfig as as, buildActorNames as at, createClientWithDriver as au, getRunFunction as av, getRunInspectorConfig as aw, getRunMetadata as ax, lookupInRegistry as ay, setup as az, type AnyActorInstance as b, type ActorOutput as b0, type CreateInput as b1, type GetForIdInput as b2, type GetOrCreateWithKeyInput as b3, type GetWithKeyInput as b4, type ListActorsInput as b5, type ManagerDisplayInformation as b6, type ManagerDriverBuilder as b7, type ActorDriverBuilder as b8, type QueueFilterName as b9, type QueueNextOptions as ba, type QueueResultMessageForName as bb, type QueueNextBatchOptions as bc, type InferSchemaMap as bd, type InferDatabaseClient as be, type InferEventArgs as bf, type EventSchemaConfig as c, type Actions as d, type ActorConfigInput as e, ActorDefinition as f, event as g, ActionContext as h, type ActionContextOf as i, type ActorConfig as j, ActorConfigSchema as k, ActorContext as l, type ActorContextOf as m, type ActorKey as n, ActorKv as o, type ActorQuery as p, queue as q, type ActorTypes as r, ActorsSchema as s, type AnyActorDefinition as t, type AnyClient as u, type AuthIntent as v, type BeforeActionResponseContextOf as w, BeforeConnectContext as x, type BeforeConnectContextOf as y, Conn as z };
2539
+ export { type ManagerDisplayInformation as $, type ActorDriverBuilder as A, type ExtractRegistryFromClient as B, type Client as C, type GetWithIdOptions as D, type Encoding as E, InternalError as F, type GetOptions as G, MalformedResponseMessage as H, type InferSchemaMap as I, ManagerError as J, type QueryOptions as K, type Region as L, type ManagerDriverBuilder as M, type RegistryConfig as N, type ManagerDriver as O, type ActorDriver as P, type QueueSchemaConfig as Q, Registry as R, type StatusChangeCallback as S, ActorInstance as T, type ActorOutput as U, type AnyActorInstance as V, type CreateInput as W, type GetForIdInput as X, type GetOrCreateWithKeyInput as Y, type GetWithKeyInput as Z, type ListActorsInput as _, type EventSchemaConfig as a, type TestConfig as a$, ActionContext as a0, BeforeConnectContext as a1, ActorContext as a2, type Actions as a3, type AnyConn as a4, type ActorConfigInput as a5, event as a6, queue as a7, type ActionContextOf as a8, type ActorConfig as a9, type DestroyContextOf as aA, DisconnectContext as aB, type DisconnectContextOf as aC, DocActorConfigSchema as aD, DocActorOptionsSchema as aE, DocConfigureRunnerPoolSchema as aF, DocInspectorConfigSchema as aG, DocRegistryConfigSchema as aH, DocRunnerConfigSchema as aI, DocServerlessConfigSchema as aJ, type FetchHandler as aK, type InspectorUnsubscribe as aL, RUN_FUNCTION_CONFIG_SYMBOL as aM, type RegistryActors as aN, type RegistryConfigInput as aO, RegistryConfigSchema as aP, RequestContext as aQ, type RequestContextOf as aR, type RunConfig as aS, RunConfigSchema as aT, type RunContextOf as aU, type RunInspectorConfig as aV, type ServerlessHandler as aW, SleepContext as aX, type SleepContextOf as aY, StateChangeContext as aZ, type StateChangeContextOf as a_, ActorConfigSchema as aa, type ActorContextOf as ab, type ActorKey as ac, ActorKv as ad, type ActorQuery as ae, type ActorTypes as af, ActorsSchema as ag, type AnyClient as ah, type AuthIntent as ai, BeforeActionResponseContext as aj, type BeforeActionResponseContextOf as ak, type BeforeConnectContextOf as al, Conn as am, ConnContext as an, type ConnContextOf as ao, ConnInitContext as ap, type ConnInitContextOf as aq, ConnectContext as ar, type ConnectContextOf as as, CreateConnStateContext as at, type CreateConnStateContextOf as au, CreateContext as av, type CreateContextOf as aw, CreateVarsContext as ax, type CreateVarsContextOf as ay, DestroyContext as az, RunContext as b, TestConfigSchema as b0, type Type as b1, WakeContext as b2, type WakeContextOf as b3, WebSocketContext as b4, type WebSocketContextOf as b5, type WorkflowInspectorConfig as b6, buildActorNames as b7, createClientWithDriver as b8, getRunFunction as b9, getRunInspectorConfig as ba, getRunMetadata as bb, lookupInRegistry as bc, setup as bd, test as be, type AnyActorDefinition as c, ActorDefinition as d, type QueueFilterName as e, type QueueNextOptions as f, type QueueResultMessageForName as g, type QueueNextBatchOptions as h, type InferDatabaseClient as i, type InferEventArgs as j, type ActorAccessor as k, type ActorActionFunction as l, ActorClientError as m, type ActorConn as n, ActorConnDisposed as o, ActorConnRaw as p, type ActorConnStatus as q, ActorError as r, type ActorHandle as s, ActorHandleRaw as t, ClientRaw as u, type ConnectionStateCallback as v, type CreateOptions as w, type CreateRequest as x, type EventUnsubscribe as y, type ExtractActorsFromRegistry as z };