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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/dist/browser/client.d.ts +939 -104
  2. package/dist/browser/client.js +1867 -900
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.d.ts +252 -129
  5. package/dist/browser/inspector/client.js +2079 -233
  6. package/dist/browser/inspector/client.js.map +1 -1
  7. package/dist/tsup/actor/errors.cjs +6 -2
  8. package/dist/tsup/actor/errors.cjs.map +1 -1
  9. package/dist/tsup/actor/errors.d.cts +1 -74
  10. package/dist/tsup/actor/errors.d.ts +1 -74
  11. package/dist/tsup/actor/errors.js +5 -1
  12. package/dist/tsup/agent-os/index.cjs +2408 -2029
  13. package/dist/tsup/agent-os/index.cjs.map +1 -1
  14. package/dist/tsup/agent-os/index.d.cts +932 -114
  15. package/dist/tsup/agent-os/index.d.ts +932 -114
  16. package/dist/tsup/agent-os/index.js +2412 -2033
  17. package/dist/tsup/agent-os/index.js.map +1 -1
  18. package/dist/tsup/{chunk-J27CEW6F.js → chunk-2OBVQZX6.js} +6 -6
  19. package/dist/tsup/chunk-2OBVQZX6.js.map +1 -0
  20. package/dist/tsup/chunk-3ZWHWMFJ.js +14 -0
  21. package/dist/tsup/chunk-3ZWHWMFJ.js.map +1 -0
  22. package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-4KGXFC6M.cjs} +238 -22
  23. package/dist/tsup/chunk-4KGXFC6M.cjs.map +1 -0
  24. package/dist/tsup/{chunk-CVHUXINE.js → chunk-5IU3MI7X.js} +594 -72
  25. package/dist/tsup/chunk-5IU3MI7X.js.map +1 -0
  26. package/dist/tsup/{chunk-VD7AZIBR.js → chunk-6CXQMHZR.js} +1161 -361
  27. package/dist/tsup/chunk-6CXQMHZR.js.map +1 -0
  28. package/dist/tsup/{chunk-SBEFJ4IQ.js → chunk-6W2UIH3X.js} +70 -8
  29. package/dist/tsup/chunk-6W2UIH3X.js.map +1 -0
  30. package/dist/tsup/{chunk-7MRGNVSR.js → chunk-6W5VGLFT.js} +237 -21
  31. package/dist/tsup/chunk-6W5VGLFT.js.map +1 -0
  32. package/dist/tsup/{chunk-RF3MEJV6.cjs → chunk-B73TBMMG.cjs} +18 -11
  33. package/dist/tsup/chunk-B73TBMMG.cjs.map +1 -0
  34. package/dist/tsup/chunk-D6TORRA4.js +243 -0
  35. package/dist/tsup/chunk-D6TORRA4.js.map +1 -0
  36. package/dist/tsup/{chunk-PXLJOMJD.js → chunk-FXT3HN32.js} +2 -2
  37. package/dist/tsup/{chunk-ZGWSH7YV.js → chunk-IXBD7BXC.js} +48 -72
  38. package/dist/tsup/chunk-IXBD7BXC.js.map +1 -0
  39. package/dist/tsup/{chunk-3BFYSYRU.js → chunk-JI6GZ2C2.js} +4 -12
  40. package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
  41. package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
  42. package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
  43. package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
  44. package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
  45. package/dist/tsup/{chunk-SPMMF6TR.cjs → chunk-LGOWPZJ5.cjs} +3 -3
  46. package/dist/tsup/chunk-LGOWPZJ5.cjs.map +1 -0
  47. package/dist/tsup/chunk-LYNWTX6R.cjs +14 -0
  48. package/dist/tsup/chunk-LYNWTX6R.cjs.map +1 -0
  49. package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-MYWZCDML.cjs} +4 -12
  50. package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
  51. package/dist/tsup/{chunk-XSC2WWXD.js → chunk-NYDZLWHZ.js} +16 -9
  52. package/dist/tsup/chunk-NYDZLWHZ.js.map +1 -0
  53. package/dist/tsup/{chunk-AV54CVAG.cjs → chunk-RB7WUDX6.cjs} +1290 -490
  54. package/dist/tsup/chunk-RB7WUDX6.cjs.map +1 -0
  55. package/dist/tsup/{chunk-JTL6Y2UN.cjs → chunk-SPJORZMM.cjs} +49 -73
  56. package/dist/tsup/chunk-SPJORZMM.cjs.map +1 -0
  57. package/dist/tsup/chunk-SSMKIYEX.cjs +243 -0
  58. package/dist/tsup/chunk-SSMKIYEX.cjs.map +1 -0
  59. package/dist/tsup/{chunk-TQSL4NJ3.cjs → chunk-TQ4HSX2U.cjs} +72 -10
  60. package/dist/tsup/chunk-TQ4HSX2U.cjs.map +1 -0
  61. package/dist/tsup/{chunk-EVADNK6Z.cjs → chunk-U6ZQELGJ.cjs} +10 -10
  62. package/dist/tsup/chunk-U6ZQELGJ.cjs.map +1 -0
  63. package/dist/tsup/chunk-XLBMKZD3.cjs +1257 -0
  64. package/dist/tsup/chunk-XLBMKZD3.cjs.map +1 -0
  65. package/dist/tsup/client/mod.cjs +8 -9
  66. package/dist/tsup/client/mod.cjs.map +1 -1
  67. package/dist/tsup/client/mod.d.cts +18 -7
  68. package/dist/tsup/client/mod.d.ts +18 -7
  69. package/dist/tsup/client/mod.js +7 -8
  70. package/dist/tsup/common/log.cjs +5 -3
  71. package/dist/tsup/common/log.cjs.map +1 -1
  72. package/dist/tsup/common/log.d.cts +5 -1
  73. package/dist/tsup/common/log.d.ts +5 -1
  74. package/dist/tsup/common/log.js +6 -4
  75. package/dist/tsup/common/websocket.cjs +4 -4
  76. package/dist/tsup/common/websocket.cjs.map +1 -1
  77. package/dist/tsup/common/websocket.js +3 -3
  78. package/dist/tsup/{config-B3RIidaJ.d.ts → config-BXSV17G7.d.cts} +987 -72
  79. package/dist/tsup/{config-D6WxBYjV.d.cts → config-Bi1r6gI7.d.ts} +987 -72
  80. package/dist/tsup/{config-B9qUIHX4.d.ts → config-ey2I2zz5.d.cts} +82 -15
  81. package/dist/tsup/{config-B9qUIHX4.d.cts → config-ey2I2zz5.d.ts} +82 -15
  82. package/dist/tsup/context-4fJemY0D.d.cts +129 -0
  83. package/dist/tsup/context-D4sNYboo.d.ts +129 -0
  84. package/dist/tsup/db/drizzle.cjs +168 -103
  85. package/dist/tsup/db/drizzle.cjs.map +1 -1
  86. package/dist/tsup/db/drizzle.d.cts +8 -4
  87. package/dist/tsup/db/drizzle.d.ts +8 -4
  88. package/dist/tsup/db/drizzle.js +170 -105
  89. package/dist/tsup/db/drizzle.js.map +1 -1
  90. package/dist/tsup/db/mod.cjs +6 -163
  91. package/dist/tsup/db/mod.cjs.map +1 -1
  92. package/dist/tsup/db/mod.d.cts +12 -4
  93. package/dist/tsup/db/mod.d.ts +12 -4
  94. package/dist/tsup/db/mod.js +5 -162
  95. package/dist/tsup/db/mod.js.map +1 -1
  96. package/dist/tsup/dynamic/mod.cjs +24 -0
  97. package/dist/tsup/dynamic/mod.cjs.map +1 -0
  98. package/dist/tsup/dynamic/mod.d.cts +38 -0
  99. package/dist/tsup/dynamic/mod.d.ts +38 -0
  100. package/dist/tsup/dynamic/mod.js +24 -0
  101. package/dist/tsup/dynamic/mod.js.map +1 -0
  102. package/dist/tsup/inspector/mod.cjs +47 -12
  103. package/dist/tsup/inspector/mod.cjs.map +1 -1
  104. package/dist/tsup/inspector/mod.d.cts +26 -136
  105. package/dist/tsup/inspector/mod.d.ts +26 -136
  106. package/dist/tsup/inspector/mod.js +46 -11
  107. package/dist/tsup/inspector/mod.js.map +1 -1
  108. package/dist/tsup/inspector/workflow.cjs +21 -0
  109. package/dist/tsup/inspector/workflow.cjs.map +1 -0
  110. package/dist/tsup/inspector/workflow.d.cts +144 -0
  111. package/dist/tsup/inspector/workflow.d.ts +144 -0
  112. package/dist/tsup/inspector/workflow.js +21 -0
  113. package/dist/tsup/inspector/workflow.js.map +1 -0
  114. package/dist/tsup/inspector-tab/mod.cjs +162 -0
  115. package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
  116. package/dist/tsup/inspector-tab/mod.d.cts +241 -0
  117. package/dist/tsup/inspector-tab/mod.d.ts +241 -0
  118. package/dist/tsup/inspector-tab/mod.js +162 -0
  119. package/dist/tsup/inspector-tab/mod.js.map +1 -0
  120. package/dist/tsup/mod.cjs +4268 -944
  121. package/dist/tsup/mod.cjs.map +1 -1
  122. package/dist/tsup/mod.d.cts +9 -8
  123. package/dist/tsup/mod.d.ts +9 -8
  124. package/dist/tsup/mod.js +4229 -905
  125. package/dist/tsup/mod.js.map +1 -1
  126. package/dist/tsup/test/mod.cjs +26 -21
  127. package/dist/tsup/test/mod.cjs.map +1 -1
  128. package/dist/tsup/test/mod.d.cts +7 -6
  129. package/dist/tsup/test/mod.d.ts +7 -6
  130. package/dist/tsup/test/mod.js +25 -20
  131. package/dist/tsup/test/mod.js.map +1 -1
  132. package/dist/tsup/unstable/migrations.cjs +101 -0
  133. package/dist/tsup/unstable/migrations.cjs.map +1 -0
  134. package/dist/tsup/unstable/migrations.d.cts +29 -0
  135. package/dist/tsup/unstable/migrations.d.ts +29 -0
  136. package/dist/tsup/unstable/migrations.js +101 -0
  137. package/dist/tsup/unstable/migrations.js.map +1 -0
  138. package/dist/tsup/utils-Bbz-3411.d.cts +162 -0
  139. package/dist/tsup/utils-BqdWVlzm.d.ts +162 -0
  140. package/dist/tsup/utils-vvJQyygr.d.cts +109 -0
  141. package/dist/tsup/utils-vvJQyygr.d.ts +109 -0
  142. package/dist/tsup/utils.cjs +7 -3
  143. package/dist/tsup/utils.cjs.map +1 -1
  144. package/dist/tsup/utils.d.cts +4 -147
  145. package/dist/tsup/utils.d.ts +4 -147
  146. package/dist/tsup/utils.js +6 -2
  147. package/dist/tsup/workflow/mod.cjs +517 -412
  148. package/dist/tsup/workflow/mod.cjs.map +1 -1
  149. package/dist/tsup/workflow/mod.d.cts +11 -10
  150. package/dist/tsup/workflow/mod.d.ts +11 -10
  151. package/dist/tsup/workflow/mod.js +511 -406
  152. package/dist/tsup/workflow/mod.js.map +1 -1
  153. package/package.json +62 -14
  154. package/src/actor/actions.ts +119 -0
  155. package/src/actor/config.test.ts +78 -0
  156. package/src/actor/config.ts +518 -96
  157. package/src/actor/contexts/index.ts +7 -2
  158. package/src/actor/definition.ts +38 -26
  159. package/src/actor/errors.ts +101 -89
  160. package/src/actor/keys.ts +2 -1
  161. package/src/actor/mod.ts +32 -21
  162. package/src/actor/schema.ts +2 -2
  163. package/src/agent-os/actor/cron.ts +37 -2
  164. package/src/agent-os/actor/index.ts +39 -19
  165. package/src/agent-os/actor/preview.ts +1 -2
  166. package/src/agent-os/actor/session.ts +2 -2
  167. package/src/agent-os/config.ts +1 -1
  168. package/src/agent-os/fs/database-vfs.ts +1 -1
  169. package/src/agent-os/index.ts +16 -15
  170. package/src/agent-os/types.ts +11 -0
  171. package/src/client/actor-common.ts +106 -53
  172. package/src/client/actor-conn.ts +94 -45
  173. package/src/client/actor-handle.ts +198 -79
  174. package/src/client/actor-query.ts +13 -6
  175. package/src/client/client.ts +43 -15
  176. package/src/client/config.ts +8 -0
  177. package/src/client/errors.ts +4 -2
  178. package/src/client/lifecycle-errors.ts +28 -4
  179. package/src/client/mod.ts +9 -4
  180. package/src/client/query.ts +3 -1
  181. package/src/client/queue.ts +8 -3
  182. package/src/client/raw-utils.ts +24 -16
  183. package/src/client/resolve-gateway-target.ts +3 -1
  184. package/src/client/utils.ts +36 -10
  185. package/src/common/actor-router-consts.ts +7 -0
  186. package/src/common/actor-websocket.ts +3 -1
  187. package/src/common/bare/actor-persist/v1.ts +205 -163
  188. package/src/common/bare/actor-persist/v2.ts +265 -213
  189. package/src/common/bare/actor-persist/v3.ts +176 -172
  190. package/src/common/bare/actor-persist/v4.ts +254 -253
  191. package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
  192. package/src/common/bare/generated/client-protocol/v4.ts +599 -0
  193. package/src/common/bare/generated/inspector/v5.ts +1016 -0
  194. package/src/common/bare/generated/inspector/v6.ts +1367 -0
  195. package/src/common/bare/transport/v1.ts +694 -542
  196. package/src/common/client-protocol-versioned.ts +176 -67
  197. package/src/common/client-protocol-zod.ts +7 -0
  198. package/src/common/client-protocol.ts +1 -1
  199. package/src/common/database/config.ts +103 -10
  200. package/src/common/database/mod.test.ts +364 -0
  201. package/src/common/database/mod.ts +278 -149
  202. package/src/common/database/native-database.test.ts +220 -0
  203. package/src/common/database/native-database.ts +394 -58
  204. package/src/common/database/shared.ts +25 -0
  205. package/src/common/encoding.ts +302 -38
  206. package/src/common/engine.ts +28 -1
  207. package/src/common/eventsource.ts +1 -1
  208. package/src/common/fetch-like.ts +49 -0
  209. package/src/common/inline-websocket-adapter.ts +14 -13
  210. package/src/common/inspector-transport.ts +12 -2
  211. package/src/common/log.ts +117 -14
  212. package/src/common/router.ts +49 -23
  213. package/src/common/utils.ts +23 -203
  214. package/src/common/websocket-interface.ts +1 -1
  215. package/src/db/drizzle.test.ts +164 -0
  216. package/src/db/drizzle.ts +207 -121
  217. package/src/db/mod.ts +6 -1
  218. package/src/devtools-loader/index.ts +4 -7
  219. package/src/devtools-loader/serve-devtools.ts +26 -0
  220. package/src/dynamic/instance.ts +32 -0
  221. package/src/dynamic/internal.ts +50 -0
  222. package/src/dynamic/isolate-runtime.ts +64 -0
  223. package/src/dynamic/mod.ts +32 -0
  224. package/src/engine-client/actor-http-client.ts +23 -4
  225. package/src/engine-client/actor-websocket-client.ts +32 -5
  226. package/src/engine-client/api-endpoints.ts +52 -2
  227. package/src/engine-client/api-utils.ts +2 -2
  228. package/src/engine-client/driver.ts +21 -17
  229. package/src/engine-client/mod.ts +116 -64
  230. package/src/engine-client/ws-proxy.ts +9 -4
  231. package/src/globals.d.ts +4 -0
  232. package/src/inspector/client.browser.ts +127 -15
  233. package/src/inspector/mod.ts +2 -4
  234. package/src/inspector/workflow.ts +61 -0
  235. package/src/inspector-tab/mod.ts +301 -0
  236. package/src/registry/config/envoy.ts +1 -2
  237. package/src/registry/config/index.ts +160 -53
  238. package/src/registry/config/serverless.ts +7 -1
  239. package/src/registry/index.ts +659 -96
  240. package/src/registry/napi-runtime.ts +1154 -0
  241. package/src/registry/native-validation.ts +10 -12
  242. package/src/registry/native.ts +2005 -955
  243. package/src/registry/process-metrics.ts +250 -0
  244. package/src/registry/run-handler-coordinator.test.ts +252 -0
  245. package/src/registry/run-handler-coordinator.ts +219 -0
  246. package/src/registry/runtime.test.ts +50 -0
  247. package/src/registry/runtime.ts +839 -0
  248. package/src/registry/wasm-runtime.ts +1283 -0
  249. package/src/registry/write-through-proxy.ts +141 -0
  250. package/src/serde.ts +8 -2
  251. package/src/serverless/configure.ts +102 -49
  252. package/src/test/mod.ts +2 -17
  253. package/src/test/ready.ts +22 -0
  254. package/src/unstable/migrations.test.ts +170 -0
  255. package/src/unstable/migrations.ts +141 -0
  256. package/src/utils/crypto.ts +14 -0
  257. package/src/utils/endpoint-parser.ts +1 -1
  258. package/src/utils/env-vars.ts +39 -0
  259. package/src/utils/node.ts +44 -28
  260. package/src/utils/router.ts +1 -1
  261. package/src/utils.ts +4 -2
  262. package/src/workflow/context.ts +683 -242
  263. package/src/workflow/driver.test.ts +62 -0
  264. package/src/workflow/driver.ts +246 -119
  265. package/src/workflow/inspector.ts +24 -24
  266. package/src/workflow/mod.ts +76 -84
  267. package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
  268. package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
  269. package/dist/tsup/chunk-6AVUJ52Q.cjs +0 -253
  270. package/dist/tsup/chunk-6AVUJ52Q.cjs.map +0 -1
  271. package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
  272. package/dist/tsup/chunk-7X7RVTFF.cjs +0 -735
  273. package/dist/tsup/chunk-7X7RVTFF.cjs.map +0 -1
  274. package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
  275. package/dist/tsup/chunk-AV54CVAG.cjs.map +0 -1
  276. package/dist/tsup/chunk-CVHUXINE.js.map +0 -1
  277. package/dist/tsup/chunk-EVADNK6Z.cjs.map +0 -1
  278. package/dist/tsup/chunk-J27CEW6F.js.map +0 -1
  279. package/dist/tsup/chunk-JTL6Y2UN.cjs.map +0 -1
  280. package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
  281. package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
  282. package/dist/tsup/chunk-RF3MEJV6.cjs.map +0 -1
  283. package/dist/tsup/chunk-SB4MXRN2.js +0 -253
  284. package/dist/tsup/chunk-SB4MXRN2.js.map +0 -1
  285. package/dist/tsup/chunk-SBEFJ4IQ.js.map +0 -1
  286. package/dist/tsup/chunk-SPMMF6TR.cjs.map +0 -1
  287. package/dist/tsup/chunk-TQSL4NJ3.cjs.map +0 -1
  288. package/dist/tsup/chunk-VD7AZIBR.js.map +0 -1
  289. package/dist/tsup/chunk-XSC2WWXD.js.map +0 -1
  290. package/dist/tsup/chunk-ZGWSH7YV.js.map +0 -1
  291. package/dist/tsup/context-BxvHh9wi.d.cts +0 -92
  292. package/dist/tsup/context-CNIZBIKl.d.ts +0 -92
  293. package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
  294. package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
  295. package/src/actor/driver.ts +0 -141
  296. package/src/actor/instance/mod.ts +0 -2501
  297. package/src/drivers/engine/actor-driver.ts +0 -2470
  298. package/src/utils/serve.ts +0 -217
  299. /package/dist/tsup/{chunk-PXLJOMJD.js.map → chunk-FXT3HN32.js.map} +0 -0
@@ -1,12 +1,14 @@
1
1
  import { z } from 'zod/v4';
2
- import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
3
- import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-B9qUIHX4.cjs';
2
+ import { A as AnyDatabaseProvider, a as SqliteProfilingOptions, f as SqliteNativeMetrics, I as InferDatabaseClient } from './config-ey2I2zz5.js';
3
+ import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
4
4
  import { z as z$1 } from 'zod';
5
5
  import { Logger } from 'pino';
6
+ import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
7
+ import { WorkflowState } from './inspector/workflow.js';
6
8
  import { StandardSchemaV1 } from '@standard-schema/spec';
9
+ import { E as Encoding, G as GetUpgradeWebSocket } from './utils-BqdWVlzm.js';
7
10
  import { Context, Hono } from 'hono';
8
- import { GetUpgradeWebSocket } from './utils.cjs';
9
- import { ActorError as RivetError } from './actor/errors.cjs';
11
+ import { R as RivetError } from './utils-vvJQyygr.js';
10
12
 
11
13
  declare const ActorKeySchema: z.ZodArray<z.ZodString>;
12
14
  type ActorKey = z.infer<typeof ActorKeySchema>;
@@ -27,6 +29,7 @@ declare const CreateRequestSchema: z.ZodObject<{
27
29
  key: z.ZodArray<z.ZodString>;
28
30
  input: z.ZodOptional<z.ZodUnknown>;
29
31
  region: z.ZodOptional<z.ZodString>;
32
+ poolName: z.ZodOptional<z.ZodString>;
30
33
  }, z.core.$strip>;
31
34
  declare const ActorQuerySchema: z.ZodUnion<readonly [z.ZodObject<{
32
35
  getForId: z.ZodObject<{
@@ -44,6 +47,7 @@ declare const ActorQuerySchema: z.ZodUnion<readonly [z.ZodObject<{
44
47
  key: z.ZodArray<z.ZodString>;
45
48
  input: z.ZodOptional<z.ZodUnknown>;
46
49
  region: z.ZodOptional<z.ZodString>;
50
+ poolName: z.ZodOptional<z.ZodString>;
47
51
  }, z.core.$strip>;
48
52
  }, z.core.$strip>, z.ZodObject<{
49
53
  create: z.ZodObject<{
@@ -51,6 +55,7 @@ declare const ActorQuerySchema: z.ZodUnion<readonly [z.ZodObject<{
51
55
  key: z.ZodArray<z.ZodString>;
52
56
  input: z.ZodOptional<z.ZodUnknown>;
53
57
  region: z.ZodOptional<z.ZodString>;
58
+ poolName: z.ZodOptional<z.ZodString>;
54
59
  }, z.core.$strip>;
55
60
  }, z.core.$strip>]>;
56
61
  type ActorQuery = z.infer<typeof ActorQuerySchema>;
@@ -59,29 +64,81 @@ type ActorQuery = z.infer<typeof ActorQuerySchema>;
59
64
  */
60
65
  type CreateRequest = z.infer<typeof CreateRequestSchema>;
61
66
 
62
- declare const EncodingSchema: z.ZodEnum<{
63
- json: "json";
64
- cbor: "cbor";
65
- bare: "bare";
66
- }>;
67
- /**
68
- * Encoding used to communicate between the client & actor.
69
- */
70
- type Encoding = z.infer<typeof EncodingSchema>;
71
-
72
- declare const ActorsSchema: z$1.ZodRecord<z$1.ZodString, z$1.ZodCustom<BaseActorDefinition<any, any, any, any, any, any, any, any, any>, BaseActorDefinition<any, any, any, any, any, any, any, any, any>>>;
67
+ declare const ActorsSchema: z$1.ZodRecord<z$1.ZodString, z$1.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
73
68
  type RegistryActors = z$1.infer<typeof ActorsSchema>;
69
+ declare const RuntimeKindSchema: z$1.ZodEnum<{
70
+ auto: "auto";
71
+ native: "native";
72
+ wasm: "wasm";
73
+ }>;
74
+ type RuntimeKind = z$1.infer<typeof RuntimeKindSchema>;
75
+ type WasmRuntimeBindings = typeof _rivetkit_rivetkit_wasm;
76
+ type WasmRuntimeInitInput = Parameters<WasmRuntimeBindings["default"]>[0];
77
+ declare const SqliteBackendSchema: z$1.ZodEnum<{
78
+ local: "local";
79
+ remote: "remote";
80
+ }>;
81
+ type SqliteBackend = z$1.infer<typeof SqliteBackendSchema>;
74
82
  declare const TestConfigSchema: z$1.ZodObject<{
75
- enabled: z$1.ZodBoolean;
83
+ enabled: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
84
+ sqliteBackend: z$1.ZodOptional<z$1.ZodEnum<{
85
+ local: "local";
86
+ remote: "remote";
87
+ }>>;
76
88
  }, z$1.core.$strip>;
77
89
  type TestConfig = z$1.infer<typeof TestConfigSchema>;
90
+ declare const WasmRuntimeConfigSchema: z$1.ZodObject<{
91
+ bindings: z$1.ZodOptional<z$1.ZodCustom<typeof _rivetkit_rivetkit_wasm, typeof _rivetkit_rivetkit_wasm>>;
92
+ initInput: z$1.ZodOptional<z$1.ZodCustom<any, any>>;
93
+ }, z$1.core.$strip>;
94
+ type WasmRuntimeConfig = z$1.infer<typeof WasmRuntimeConfigSchema>;
95
+ declare const SqliteConfigSchema: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodEnum<{
96
+ local: "local";
97
+ remote: "remote";
98
+ }>, z$1.ZodObject<{
99
+ backend: z$1.ZodEnum<{
100
+ local: "local";
101
+ remote: "remote";
102
+ }>;
103
+ }, z$1.core.$strip>]>>, z$1.ZodTransform<{
104
+ backend: "local" | "remote";
105
+ } | undefined, "local" | "remote" | {
106
+ backend: "local" | "remote";
107
+ } | undefined>>;
108
+ type SqliteConfig = z$1.infer<typeof SqliteConfigSchema>;
78
109
  declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
79
110
  use: z$1.ZodRecord<z$1.ZodString, z$1.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
80
111
  test: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
81
- enabled: z$1.ZodBoolean;
112
+ enabled: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
113
+ sqliteBackend: z$1.ZodOptional<z$1.ZodEnum<{
114
+ local: "local";
115
+ remote: "remote";
116
+ }>>;
82
117
  }, z$1.core.$strip>>>;
83
118
  maxIncomingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
84
119
  maxOutgoingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
120
+ runtime: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodEnum<{
121
+ auto: "auto";
122
+ native: "native";
123
+ wasm: "wasm";
124
+ }>>, z$1.ZodTransform<"auto" | "native" | "wasm", "auto" | "native" | "wasm" | undefined>>;
125
+ wasm: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
126
+ bindings: z$1.ZodOptional<z$1.ZodCustom<typeof _rivetkit_rivetkit_wasm, typeof _rivetkit_rivetkit_wasm>>;
127
+ initInput: z$1.ZodOptional<z$1.ZodCustom<any, any>>;
128
+ }, z$1.core.$strip>>>;
129
+ sqlite: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodEnum<{
130
+ local: "local";
131
+ remote: "remote";
132
+ }>, z$1.ZodObject<{
133
+ backend: z$1.ZodEnum<{
134
+ local: "local";
135
+ remote: "remote";
136
+ }>;
137
+ }, z$1.core.$strip>]>>, z$1.ZodTransform<{
138
+ backend: "local" | "remote";
139
+ } | undefined, "local" | "remote" | {
140
+ backend: "local" | "remote";
141
+ } | undefined>>;
85
142
  noWelcome: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
86
143
  logging: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
87
144
  baseLogger: z$1.ZodOptional<z$1.ZodCustom<Logger, Logger>>;
@@ -104,12 +161,15 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
104
161
  httpPort: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
105
162
  httpHost: z$1.ZodOptional<z$1.ZodString>;
106
163
  startEngine: z$1.ZodDefault<z$1.ZodBoolean>;
164
+ engineHost: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
165
+ enginePort: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
107
166
  engineVersion: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
108
167
  configurePool: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodObject<{
109
168
  name: z$1.ZodOptional<z$1.ZodString>;
110
169
  url: z$1.ZodString;
111
170
  headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
112
171
  requestLifespan: z$1.ZodOptional<z$1.ZodNumber>;
172
+ drainGracePeriod: z$1.ZodOptional<z$1.ZodNumber>;
113
173
  metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
114
174
  metadataPollInterval: z$1.ZodOptional<z$1.ZodNumber>;
115
175
  drainOnVersionUpgrade: z$1.ZodOptional<z$1.ZodBoolean>;
@@ -127,10 +187,13 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
127
187
  envoyKey: z$1.ZodOptional<z$1.ZodString>;
128
188
  }, z$1.core.$strip>>>;
129
189
  shutdown: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
130
- gracePeriodMs: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
190
+ gracePeriodMs: z$1.ZodOptional<z$1.ZodNumber>;
131
191
  disableSignalHandlers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
132
192
  }, z$1.core.$strip>>>;
133
193
  }, z$1.core.$strip>, z$1.ZodTransform<{
194
+ sqlite: {
195
+ backend: "local" | "remote";
196
+ } | undefined;
134
197
  endpoint: string | undefined;
135
198
  namespace: string;
136
199
  token: string | undefined;
@@ -147,9 +210,15 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
147
210
  use: Record<string, AnyActorDefinition>;
148
211
  test: {
149
212
  enabled: boolean;
213
+ sqliteBackend?: "local" | "remote" | undefined;
150
214
  };
151
215
  maxIncomingMessageSize: number;
152
216
  maxOutgoingMessageSize: number;
217
+ runtime: "auto" | "native" | "wasm";
218
+ wasm: {
219
+ bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
220
+ initInput?: any;
221
+ };
153
222
  noWelcome: boolean;
154
223
  logging: {
155
224
  baseLogger?: Logger | undefined;
@@ -159,6 +228,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
159
228
  httpBasePath: string;
160
229
  httpPort: number;
161
230
  startEngine: boolean;
231
+ engineHost: string;
232
+ enginePort: number;
162
233
  engineVersion: string;
163
234
  envoy: {
164
235
  poolName: string;
@@ -167,8 +238,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
167
238
  envoyKey?: string | undefined;
168
239
  };
169
240
  shutdown: {
170
- gracePeriodMs: number;
171
241
  disableSignalHandlers: boolean;
242
+ gracePeriodMs?: number | undefined;
172
243
  };
173
244
  staticDir?: string | undefined;
174
245
  httpHost?: string | undefined;
@@ -177,6 +248,7 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
177
248
  name?: string | undefined;
178
249
  headers?: Record<string, string> | undefined;
179
250
  requestLifespan?: number | undefined;
251
+ drainGracePeriod?: number | undefined;
180
252
  metadata?: Record<string, unknown> | undefined;
181
253
  metadataPollInterval?: number | undefined;
182
254
  drainOnVersionUpgrade?: boolean | undefined;
@@ -185,9 +257,18 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
185
257
  use: Record<string, AnyActorDefinition>;
186
258
  test: {
187
259
  enabled: boolean;
260
+ sqliteBackend?: "local" | "remote" | undefined;
188
261
  };
189
262
  maxIncomingMessageSize: number;
190
263
  maxOutgoingMessageSize: number;
264
+ runtime: "auto" | "native" | "wasm";
265
+ wasm: {
266
+ bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
267
+ initInput?: any;
268
+ };
269
+ sqlite: {
270
+ backend: "local" | "remote";
271
+ } | undefined;
191
272
  noWelcome: boolean;
192
273
  logging: {
193
274
  baseLogger?: Logger | undefined;
@@ -200,6 +281,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
200
281
  httpBasePath: string;
201
282
  httpPort: number;
202
283
  startEngine: boolean;
284
+ engineHost: string;
285
+ enginePort: number;
203
286
  engineVersion: string;
204
287
  serverless: {
205
288
  basePath: string;
@@ -214,8 +297,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
214
297
  envoyKey?: string | undefined;
215
298
  };
216
299
  shutdown: {
217
- gracePeriodMs: number;
218
300
  disableSignalHandlers: boolean;
301
+ gracePeriodMs?: number | undefined;
219
302
  };
220
303
  staticDir?: string | undefined;
221
304
  httpHost?: string | undefined;
@@ -224,6 +307,7 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
224
307
  name?: string | undefined;
225
308
  headers?: Record<string, string> | undefined;
226
309
  requestLifespan?: number | undefined;
310
+ drainGracePeriod?: number | undefined;
227
311
  metadata?: Record<string, unknown> | undefined;
228
312
  metadataPollInterval?: number | undefined;
229
313
  drainOnVersionUpgrade?: boolean | undefined;
@@ -241,6 +325,7 @@ declare const DocConfigurePoolSchema: z$1.ZodOptional<z$1.ZodObject<{
241
325
  url: z$1.ZodString;
242
326
  headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
243
327
  requestLifespan: z$1.ZodOptional<z$1.ZodNumber>;
328
+ drainGracePeriod: z$1.ZodOptional<z$1.ZodNumber>;
244
329
  metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
245
330
  metadataPollInterval: z$1.ZodOptional<z$1.ZodNumber>;
246
331
  drainOnVersionUpgrade: z$1.ZodOptional<z$1.ZodBoolean>;
@@ -257,11 +342,23 @@ declare const DocEnvoyConfigSchema: z$1.ZodObject<{
257
342
  envoyKey: z$1.ZodOptional<z$1.ZodString>;
258
343
  version: z$1.ZodOptional<z$1.ZodNumber>;
259
344
  }, z$1.core.$strip>;
345
+ declare const DocSqliteConfigSchema: z$1.ZodOptional<z$1.ZodObject<{
346
+ backend: z$1.ZodOptional<z$1.ZodEnum<{
347
+ local: "local";
348
+ remote: "remote";
349
+ }>>;
350
+ }, z$1.core.$strip>>;
260
351
  declare const DocRegistryConfigSchema: z$1.ZodObject<{
261
352
  use: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
262
353
  maxIncomingMessageSize: z$1.ZodOptional<z$1.ZodNumber>;
263
354
  maxOutgoingMessageSize: z$1.ZodOptional<z$1.ZodNumber>;
264
355
  noWelcome: z$1.ZodOptional<z$1.ZodBoolean>;
356
+ sqlite: z$1.ZodOptional<z$1.ZodObject<{
357
+ backend: z$1.ZodOptional<z$1.ZodEnum<{
358
+ local: "local";
359
+ remote: "remote";
360
+ }>>;
361
+ }, z$1.core.$strip>>;
265
362
  logging: z$1.ZodOptional<z$1.ZodObject<{
266
363
  level: z$1.ZodOptional<z$1.ZodEnum<{
267
364
  fatal: "fatal";
@@ -288,6 +385,7 @@ declare const DocRegistryConfigSchema: z$1.ZodObject<{
288
385
  url: z$1.ZodString;
289
386
  headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
290
387
  requestLifespan: z$1.ZodOptional<z$1.ZodNumber>;
388
+ drainGracePeriod: z$1.ZodOptional<z$1.ZodNumber>;
291
389
  metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
292
390
  metadataPollInterval: z$1.ZodOptional<z$1.ZodNumber>;
293
391
  drainOnVersionUpgrade: z$1.ZodOptional<z$1.ZodBoolean>;
@@ -346,7 +444,7 @@ interface QueueSchemaDefinition<TContext = any> {
346
444
  type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
347
445
  type QueueSchema = PrimitiveSchema | QueueSchemaDefinition<any> | QueueTypeToken<unknown, unknown, any>;
348
446
  type EventSchemaConfig<TContext = any> = Record<string, EventSchema<TContext>>;
349
- type QueueSchemaConfig<TContext = any> = Record<string, QueueSchema>;
447
+ type QueueSchemaConfig<_TContext = any> = Record<string, QueueSchema>;
350
448
  type InferSchema<T> = T extends QueueSchemaDefinition<any> ? InferSchema<T["message"]> : T extends QueueTypeToken<infer M, unknown, any> ? M : T extends EventSchemaDefinition<any> ? InferSchema<T["schema"]> : T extends StandardSchemaV1<any, infer O> ? O : T extends EventTypeToken<infer R, any> ? R : never;
351
449
  type InferSchemaMap<T extends Record<string, unknown>> = {
352
450
  [K in keyof T]: InferSchema<T[K]>;
@@ -357,15 +455,17 @@ type InferQueueCompleteMap<T extends QueueSchemaConfig> = {
357
455
  };
358
456
  type InferEventArgs<T> = T extends readonly unknown[] ? number extends T["length"] ? [T] : T : [T];
359
457
 
360
- interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> {
361
- readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
458
+ interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, _R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> {
459
+ readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
460
+ }
461
+ interface AnyActorDefinition {
462
+ readonly config: any;
362
463
  }
363
- type AnyActorDefinition = BaseActorDefinition<any, any, any, any, any, any, any, any, any>;
364
464
  type AnyStaticActorDefinition = ActorDefinition<any, any, any, any, any, any, any, any, any>;
365
465
  declare class ActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> implements BaseActorDefinition<S, CP, CS, V, I, DB, E, Q, R> {
366
466
  #private;
367
- constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>);
368
- get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
467
+ constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>);
468
+ get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
369
469
  }
370
470
  interface BaseActorInstance<S = any, CP = any, CS = any, V = any, I = any, DB extends AnyDatabaseProvider = AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>> {
371
471
  id: string;
@@ -383,17 +483,20 @@ declare function lookupInRegistry(config: RegistryConfig, name: string): AnyActo
383
483
  type GatewayTarget = {
384
484
  directId: string;
385
485
  } | ActorQuery;
486
+ interface GatewayRequestOptions {
487
+ skipReadyWait?: boolean;
488
+ }
386
489
  interface EngineControlClient {
387
490
  getForId(input: GetForIdInput): Promise<ActorOutput | undefined>;
388
491
  getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
389
492
  getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
390
493
  createActor(input: CreateInput): Promise<ActorOutput>;
391
494
  listActors(input: ListActorsInput): Promise<ActorOutput[]>;
392
- sendRequest(target: GatewayTarget, actorRequest: Request): Promise<Response>;
393
- openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown): Promise<UniversalWebSocket>;
495
+ sendRequest(target: GatewayTarget, actorRequest: Request, options?: GatewayRequestOptions): Promise<Response>;
496
+ openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown, options?: GatewayRequestOptions): Promise<UniversalWebSocket>;
394
497
  proxyRequest(c: Context, actorRequest: Request, actorId: string): Promise<Response>;
395
498
  proxyWebSocket(c: Context, path: string, actorId: string, encoding: Encoding, params: unknown): Promise<Response>;
396
- buildGatewayUrl(target: GatewayTarget): Promise<string>;
499
+ buildGatewayUrl(target: GatewayTarget, options?: GatewayRequestOptions): Promise<string>;
397
500
  displayInformation(): RuntimeDisplayInformation;
398
501
  extraStartupLog?: () => Record<string, unknown>;
399
502
  modifyRuntimeRouter?: (config: RegistryConfig, router: Hono) => void;
@@ -403,11 +506,6 @@ interface EngineControlClient {
403
506
  * Test-only helper that simulates an abrupt actor crash.
404
507
  */
405
508
  hardCrashActor?(actorId: string): Promise<void>;
406
- kvGet(actorId: string, key: Uint8Array): Promise<string | null>;
407
- kvBatchGet(actorId: string, keys: Uint8Array[]): Promise<(Uint8Array | null)[]>;
408
- kvBatchPut(actorId: string, entries: [Uint8Array, Uint8Array][]): Promise<void>;
409
- kvBatchDelete(actorId: string, keys: Uint8Array[]): Promise<void>;
410
- kvDeleteRange(actorId: string, start: Uint8Array, end: Uint8Array): Promise<void>;
411
509
  }
412
510
  interface RuntimeDisplayInformation {
413
511
  properties: Record<string, string>;
@@ -429,6 +527,8 @@ interface GetOrCreateWithKeyInput {
429
527
  input?: unknown;
430
528
  region?: string;
431
529
  crashPolicy?: CrashPolicy;
530
+ /** Overrides the client's configured pool name for this actor. */
531
+ poolName?: string;
432
532
  }
433
533
  interface CreateInput {
434
534
  c?: Context | undefined;
@@ -437,6 +537,8 @@ interface CreateInput {
437
537
  input?: unknown;
438
538
  region?: string;
439
539
  crashPolicy?: CrashPolicy;
540
+ /** Overrides the client's configured pool name for this actor. */
541
+ poolName?: string;
440
542
  }
441
543
  interface ListActorsInput {
442
544
  c?: Context | undefined;
@@ -456,15 +558,457 @@ interface ActorOutput {
456
558
  error?: unknown;
457
559
  }
458
560
 
561
+ declare const handleBrand: unique symbol;
562
+ type OpaqueHandle<Name extends string> = {
563
+ readonly [handleBrand]: Name;
564
+ };
565
+ type RegistryHandle = OpaqueHandle<"registry">;
566
+ type ActorFactoryHandle = OpaqueHandle<"actorFactory">;
567
+ type ActorContextHandle = OpaqueHandle<"actorContext">;
568
+ type ConnHandle = OpaqueHandle<"conn">;
569
+ type WebSocketHandle = OpaqueHandle<"webSocket">;
570
+ type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
571
+ type ActorStateTransactionHandle = OpaqueHandle<"actorStateTransaction">;
572
+ type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
573
+ type RuntimeBytes = Uint8Array;
574
+ interface RuntimeActorKeySegment {
575
+ kind: string;
576
+ stringValue?: string;
577
+ numberValue?: number;
578
+ }
579
+ interface RuntimeHttpRequest {
580
+ method: string;
581
+ uri: string;
582
+ headers?: Record<string, string>;
583
+ body?: RuntimeBytes;
584
+ }
585
+ interface RuntimeStateDeltaPayload {
586
+ state?: RuntimeBytes;
587
+ connHibernation: Array<{
588
+ connId: string;
589
+ bytes: RuntimeBytes;
590
+ }>;
591
+ connHibernationRemoved: string[];
592
+ }
593
+ interface RuntimeWorkflowKvWrite {
594
+ key: RuntimeBytes;
595
+ value: RuntimeBytes;
596
+ }
597
+ interface RuntimeRequestSaveOpts {
598
+ immediate?: boolean;
599
+ maxWaitMs?: number;
600
+ }
601
+ interface RuntimeInspectorSnapshot {
602
+ stateRevision: number;
603
+ connectionsRevision: number;
604
+ queueRevision: number;
605
+ activeConnections: number;
606
+ queueSize: number;
607
+ connectedClients: number;
608
+ }
609
+ interface RuntimeQueueMessage {
610
+ id(): bigint;
611
+ name(): string;
612
+ body(): RuntimeBytes;
613
+ createdAt(): number;
614
+ isCompletable(): boolean;
615
+ complete(response?: RuntimeBytes | undefined | null): Promise<void>;
616
+ }
617
+ interface RuntimeQueueInspectMessage {
618
+ id: number;
619
+ name: string;
620
+ createdAtMs: number;
621
+ }
622
+ interface RuntimeScheduledEventInfo {
623
+ id: string;
624
+ action: string;
625
+ args: RuntimeBytes;
626
+ runAt: number;
627
+ }
628
+ interface RuntimeCronJobInfo {
629
+ name: string;
630
+ kind: "cron" | "every";
631
+ action: string;
632
+ args: RuntimeBytes;
633
+ nextRunAt: number;
634
+ lastRunAt?: number;
635
+ expression?: string;
636
+ timezone?: string;
637
+ intervalMs?: number;
638
+ maxHistory: number;
639
+ }
640
+ interface RuntimeScheduleErrorInfo {
641
+ group: string;
642
+ code: string;
643
+ message: string;
644
+ metadata?: unknown;
645
+ }
646
+ interface RuntimeCronFire {
647
+ action: string;
648
+ scheduledAt: number;
649
+ firedAt: number;
650
+ finishedAt?: number;
651
+ result: "running" | "ok" | "error" | "skipped";
652
+ error?: RuntimeScheduleErrorInfo;
653
+ }
654
+ interface RuntimeQueueNextBatchOptions {
655
+ names?: string[];
656
+ count?: number;
657
+ timeoutMs?: number;
658
+ completable?: boolean;
659
+ }
660
+ interface RuntimeQueueWaitOptions {
661
+ timeoutMs?: number;
662
+ completable?: boolean;
663
+ }
664
+ interface RuntimeQueueEnqueueAndWaitOptions {
665
+ timeoutMs?: number;
666
+ }
667
+ interface RuntimeQueueTryNextBatchOptions {
668
+ names?: string[];
669
+ count?: number;
670
+ completable?: boolean;
671
+ }
672
+ interface RuntimeKvListOptions {
673
+ reverse?: boolean;
674
+ limit?: number;
675
+ }
676
+ interface RuntimeKvEntry {
677
+ key: RuntimeBytes;
678
+ value: RuntimeBytes;
679
+ }
680
+ type RuntimeSqlBindNoValues = {
681
+ intValue?: never;
682
+ floatValue?: never;
683
+ textValue?: never;
684
+ blobValue?: never;
685
+ };
686
+ type RuntimeSqlBindParam = ({
687
+ kind: "null";
688
+ } & RuntimeSqlBindNoValues) | {
689
+ kind: "int";
690
+ intValue: number;
691
+ floatValue?: never;
692
+ textValue?: never;
693
+ blobValue?: never;
694
+ } | {
695
+ kind: "float";
696
+ intValue?: never;
697
+ floatValue: number;
698
+ textValue?: never;
699
+ blobValue?: never;
700
+ } | {
701
+ kind: "text";
702
+ intValue?: never;
703
+ floatValue?: never;
704
+ textValue: string;
705
+ blobValue?: never;
706
+ } | {
707
+ kind: "blob";
708
+ intValue?: never;
709
+ floatValue?: never;
710
+ textValue?: never;
711
+ blobValue: RuntimeBytes;
712
+ };
713
+ type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
714
+ interface RuntimeActorRuntimeSocketEndpointInfo {
715
+ path: string;
716
+ }
717
+ interface RuntimeSqlQueryResult {
718
+ columns: string[];
719
+ rows: unknown[][];
720
+ }
721
+ type RuntimeSqlExecResult = RuntimeSqlQueryResult;
722
+ interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
723
+ changes: number;
724
+ lastInsertRowId?: number | null;
725
+ }
726
+ interface RuntimeSqlBatchStatement {
727
+ sql: string;
728
+ params?: RuntimeSqlBindParams;
729
+ }
730
+ interface RuntimeSqlRunResult {
731
+ changes: number;
732
+ }
733
+ interface RuntimeActorConfig {
734
+ name?: string;
735
+ icon?: string;
736
+ hasDatabase?: boolean;
737
+ remoteSqlite?: boolean;
738
+ sqliteProfiling?: SqliteProfilingOptions;
739
+ enableActorRuntimeSocket?: boolean;
740
+ hasState?: boolean;
741
+ canHibernateWebsocket?: boolean;
742
+ stateSaveIntervalMs?: number;
743
+ createStateTimeoutMs?: number;
744
+ onCreateTimeoutMs?: number;
745
+ createVarsTimeoutMs?: number;
746
+ createConnStateTimeoutMs?: number;
747
+ onBeforeConnectTimeoutMs?: number;
748
+ onConnectTimeoutMs?: number;
749
+ onMigrateTimeoutMs?: number;
750
+ onWakeTimeoutMs?: number;
751
+ onBeforeActorStartTimeoutMs?: number;
752
+ actionTimeoutMs?: number;
753
+ onRequestTimeoutMs?: number;
754
+ sleepTimeoutMs?: number;
755
+ noSleep?: boolean;
756
+ sleepGracePeriodMs?: number;
757
+ connectionLivenessTimeoutMs?: number;
758
+ connectionLivenessIntervalMs?: number;
759
+ maxQueueSize?: number;
760
+ maxSchedules?: number;
761
+ maxQueueMessageSize?: number;
762
+ maxIncomingMessageSize?: number;
763
+ maxOutgoingMessageSize?: number;
764
+ preloadMaxWorkflowBytes?: number;
765
+ preloadMaxConnectionsBytes?: number;
766
+ actions?: Array<{
767
+ name: string;
768
+ }>;
769
+ inspectorTabs?: Array<RuntimeInspectorTabEntry>;
770
+ }
771
+ interface RuntimeInspectorTabEntry {
772
+ id: string;
773
+ /** Required for custom entries; omitted for built-in hides. */
774
+ label?: string;
775
+ /**
776
+ * Required for custom entries — absolute path to the source directory.
777
+ * Resolved on the TS side before being handed to the runtime.
778
+ */
779
+ source?: string;
780
+ /** Optional icon id for custom entries. */
781
+ icon?: string;
782
+ /** Set to true for built-in hide entries. */
783
+ hidden?: boolean;
784
+ }
785
+ interface RuntimeServeConfig {
786
+ version: number;
787
+ endpoint: string;
788
+ token?: string;
789
+ namespace: string;
790
+ poolName: string;
791
+ engineBinaryPath?: string;
792
+ engineHost?: string;
793
+ enginePort?: number;
794
+ handleInspectorHttpInRuntime?: boolean;
795
+ inspectorTestToken?: string;
796
+ serverlessBasePath?: string;
797
+ serverlessPackageVersion: string;
798
+ serverlessClientEndpoint?: string;
799
+ serverlessClientNamespace?: string;
800
+ serverlessClientToken?: string;
801
+ serverlessValidateEndpoint: boolean;
802
+ serverlessMaxStartPayloadBytes: number;
803
+ }
804
+ interface RuntimeListenerConfig {
805
+ port: number;
806
+ host?: string;
807
+ publicDir?: string;
808
+ application?: RuntimeApplicationFetch;
809
+ }
810
+ interface RuntimeServerlessRequest {
811
+ method: string;
812
+ url: string;
813
+ headers: Record<string, string>;
814
+ body: RuntimeBytes;
815
+ }
816
+ interface RuntimeApplicationResponse {
817
+ status: number;
818
+ headers: Record<string, string>;
819
+ body: RuntimeBytes;
820
+ }
821
+ type RuntimeApplicationFetch = (request: RuntimeServerlessRequest) => Promise<RuntimeApplicationResponse>;
822
+ interface RuntimeApplicationListenerConfig extends RuntimeListenerConfig {
823
+ application: RuntimeApplicationFetch;
824
+ }
825
+ interface RuntimeServerlessResponseHead {
826
+ status: number;
827
+ headers: Record<string, string>;
828
+ }
829
+ interface RuntimeRegistryRouteResponse {
830
+ status: number;
831
+ headers: Record<string, string>;
832
+ body: RuntimeBytes;
833
+ }
834
+ type RuntimeServerlessStreamEvent = {
835
+ kind: "chunk";
836
+ chunk?: RuntimeBytes;
837
+ } | {
838
+ kind: "end";
839
+ error?: {
840
+ group: string;
841
+ code: string;
842
+ message: string;
843
+ };
844
+ };
845
+ type RuntimeServerlessStreamCallback = (error: unknown, event?: RuntimeServerlessStreamEvent) => unknown;
846
+ type RuntimeWebSocketEvent = {
847
+ kind: "message";
848
+ data: string | RuntimeBytes;
849
+ binary: boolean;
850
+ messageIndex?: number;
851
+ } | {
852
+ kind: "close";
853
+ code: number;
854
+ reason: string;
855
+ wasClean: boolean;
856
+ };
857
+ interface CoreRuntime {
858
+ readonly kind: "napi" | "wasm";
859
+ createRegistry(): RegistryHandle;
860
+ registerActor(registry: RegistryHandle, name: string, factory: ActorFactoryHandle): void;
861
+ serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
862
+ waitRegistryReady(registry: RegistryHandle): Promise<void>;
863
+ shutdownRegistry(registry: RegistryHandle): Promise<void>;
864
+ registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
865
+ handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
866
+ serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
867
+ serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
868
+ registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
869
+ registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
870
+ registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
871
+ createActorFactory(callbacks: object, config?: RuntimeActorConfig | undefined | null): ActorFactoryHandle;
872
+ createCancellationToken(): CancellationTokenHandle;
873
+ cancellationTokenAborted(token: CancellationTokenHandle): boolean;
874
+ cancelCancellationToken(token: CancellationTokenHandle): void;
875
+ onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
876
+ actorState(ctx: ActorContextHandle): RuntimeBytes;
877
+ actorBeginOnStateChange(ctx: ActorContextHandle): void;
878
+ actorEndOnStateChange(ctx: ActorContextHandle): void;
879
+ actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
880
+ actorSetRunWakeAt(ctx: ActorContextHandle, timestampMs?: number | undefined | null): Promise<void>;
881
+ actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
882
+ actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
883
+ actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
884
+ actorDecodeInspectorRequest(ctx: ActorContextHandle, bytes: RuntimeBytes, advertisedVersion: number): RuntimeBytes;
885
+ actorEncodeInspectorResponse(ctx: ActorContextHandle, bytes: RuntimeBytes, targetVersion: number): RuntimeBytes;
886
+ actorVerifyInspectorAuth(ctx: ActorContextHandle, bearerToken?: string | undefined | null): Promise<void>;
887
+ actorQueueHibernationRemoval(ctx: ActorContextHandle, connId: string): void;
888
+ actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
889
+ actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
890
+ actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
891
+ actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
892
+ actorId(ctx: ActorContextHandle): string;
893
+ actorName(ctx: ActorContextHandle): string;
894
+ actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
895
+ actorRegion(ctx: ActorContextHandle): string;
896
+ actorSleep(ctx: ActorContextHandle): void;
897
+ actorDestroy(ctx: ActorContextHandle): void;
898
+ actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
899
+ actorConns(ctx: ActorContextHandle): ConnHandle[];
900
+ actorConnectConn(ctx: ActorContextHandle, params: RuntimeBytes, request?: RuntimeHttpRequest | undefined | null): Promise<ConnHandle>;
901
+ actorBroadcast(ctx: ActorContextHandle, name: string, args: RuntimeBytes): void;
902
+ actorWaitUntil(ctx: ActorContextHandle, promise: Promise<unknown>): void;
903
+ actorWaitForTrackedShutdownWork(ctx: ActorContextHandle): Promise<boolean>;
904
+ actorWaitForTrackedShutdownWorkUnbounded(ctx: ActorContextHandle): Promise<void>;
905
+ actorKeepAwake(ctx: ActorContextHandle, promise: Promise<unknown>): void;
906
+ actorBeginKeepAwake(ctx: ActorContextHandle): number;
907
+ actorEndKeepAwake(ctx: ActorContextHandle, regionId: number): void;
908
+ actorRegisterTask(ctx: ActorContextHandle, promise: Promise<unknown>): void;
909
+ actorRuntimeState(ctx: ActorContextHandle): object;
910
+ actorClearRuntimeState(ctx: ActorContextHandle): void;
911
+ actorRestartRunHandler(ctx: ActorContextHandle): void;
912
+ actorBeginWebsocketCallback(ctx: ActorContextHandle): number;
913
+ actorEndWebsocketCallback(ctx: ActorContextHandle, regionId: number): void;
914
+ actorKvGet(ctx: ActorContextHandle, key: RuntimeBytes): Promise<RuntimeBytes | null>;
915
+ actorKvPut(ctx: ActorContextHandle, key: RuntimeBytes, value: RuntimeBytes): Promise<void>;
916
+ actorKvDelete(ctx: ActorContextHandle, key: RuntimeBytes): Promise<void>;
917
+ actorKvDeleteRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes): Promise<void>;
918
+ actorKvListPrefix(ctx: ActorContextHandle, prefix: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
919
+ actorKvListRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
920
+ actorKvBatchGet(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<Array<RuntimeBytes | undefined | null>>;
921
+ actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
922
+ actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
923
+ actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
924
+ actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
925
+ actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
926
+ actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
927
+ actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
928
+ actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
929
+ actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
930
+ actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
931
+ actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
932
+ actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
933
+ actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
934
+ actorStateTransactionRollback(transaction: ActorStateTransactionHandle): Promise<void>;
935
+ actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
936
+ actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
937
+ actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
938
+ actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
939
+ actorSqlClose(ctx: ActorContextHandle): Promise<void>;
940
+ actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
941
+ actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
942
+ actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
943
+ actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
944
+ actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
945
+ actorQueueCompletePersisted(ctx: ActorContextHandle, messageId: bigint, expectedName: string, response?: RuntimeBytes | undefined | null): Promise<boolean>;
946
+ actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
947
+ actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
948
+ actorQueueMaxSize(ctx: ActorContextHandle): number;
949
+ actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
950
+ actorQueueReset(ctx: ActorContextHandle): Promise<void>;
951
+ actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
952
+ actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
953
+ actorScheduleCancel(ctx: ActorContextHandle, id: string): Promise<boolean>;
954
+ actorScheduleGet(ctx: ActorContextHandle, id: string): Promise<RuntimeScheduledEventInfo | undefined>;
955
+ actorScheduleList(ctx: ActorContextHandle): Promise<RuntimeScheduledEventInfo[]>;
956
+ actorCronSet(ctx: ActorContextHandle, name: string, expression: string, timezone: string | undefined, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
957
+ actorCronEvery(ctx: ActorContextHandle, name: string, intervalMs: number, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
958
+ actorCronGet(ctx: ActorContextHandle, name: string): Promise<RuntimeCronJobInfo | undefined>;
959
+ actorCronList(ctx: ActorContextHandle): Promise<RuntimeCronJobInfo[]>;
960
+ actorCronDelete(ctx: ActorContextHandle, name: string): Promise<boolean>;
961
+ actorCronHistory(ctx: ActorContextHandle, name: string, limit: number | undefined): Promise<RuntimeCronFire[]>;
962
+ connId(conn: ConnHandle): string;
963
+ connParams(conn: ConnHandle): RuntimeBytes;
964
+ connState(conn: ConnHandle): RuntimeBytes;
965
+ connSetState(conn: ConnHandle, state: RuntimeBytes): void;
966
+ connIsHibernatable(conn: ConnHandle): boolean;
967
+ connSend(conn: ConnHandle, name: string, args: RuntimeBytes): void;
968
+ connDisconnect(conn: ConnHandle, reason?: string | undefined | null): Promise<void>;
969
+ webSocketSend(ws: WebSocketHandle, data: RuntimeBytes, binary: boolean): void;
970
+ webSocketClose(ws: WebSocketHandle, code?: number | undefined | null, reason?: string | undefined | null): Promise<void>;
971
+ webSocketSetEventCallback(ws: WebSocketHandle, callback: (event: RuntimeWebSocketEvent) => void): void;
972
+ }
973
+
974
+ declare function buildConfiguredRegistry(config: RegistryConfig): Promise<{
975
+ runtime: CoreRuntime;
976
+ registry: RegistryHandle;
977
+ serveConfig: RuntimeServeConfig;
978
+ }>;
979
+
459
980
  type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
460
981
  interface ServerlessHandler {
461
982
  fetch: FetchHandler;
462
983
  }
984
+ interface RegistryApplication {
985
+ fetch: FetchHandler;
986
+ }
987
+ interface RegistryListenOptions {
988
+ port?: number;
989
+ host?: string;
990
+ publicDir?: string;
991
+ application?: RegistryApplication;
992
+ }
993
+ interface RegistryRoutes {
994
+ health(): Promise<Response>;
995
+ metadata(): Promise<Response>;
996
+ prometheusMetrics(request?: Request): Promise<Response>;
997
+ }
998
+ /**
999
+ * Injectable dependencies for {@link Registry}. Production code uses the
1000
+ * defaults. Tests override `buildConfiguredRegistry` to drive lifecycle
1001
+ * orchestration against a fake `CoreRuntime` without an engine.
1002
+ */
1003
+ interface RegistryDeps {
1004
+ buildConfiguredRegistry: typeof buildConfiguredRegistry;
1005
+ }
463
1006
  declare class Registry<A extends RegistryActors> {
464
1007
  #private;
1008
+ readonly routes: RegistryRoutes;
465
1009
  get config(): RegistryConfigInput<A>;
466
1010
  parseConfig(): RegistryConfig;
467
- constructor(config: RegistryConfigInput<A>);
1011
+ constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>);
468
1012
  /**
469
1013
  * Handle an incoming HTTP request for serverless deployments.
470
1014
  *
@@ -485,9 +1029,63 @@ declare class Registry<A extends RegistryActors> {
485
1029
  * ```
486
1030
  */
487
1031
  serve(): ServerlessHandler;
1032
+ /**
1033
+ * Bind an HTTP listener provided by the native (Rust) runtime and serve
1034
+ * the registry's serverless endpoints over it. Resolves only after the
1035
+ * registry is shut down (SIGINT/SIGTERM or `nativeRegistry.shutdown()`).
1036
+ *
1037
+ * @param opts.port Port to listen on. Defaults to `process.env.RIVET_PORT`
1038
+ * if set, otherwise 3000.
1039
+ * @param opts.host Address to bind. Defaults to `0.0.0.0`.
1040
+ * @param opts.publicDir If set, serves static files from this directory
1041
+ * as a fallback below the framework routes.
1042
+ * @param opts.application If set, handles requests that do not match a
1043
+ * framework route.
1044
+ *
1045
+ * @example
1046
+ * ```ts
1047
+ * await registry.listen();
1048
+ * await registry.listen({ application: app });
1049
+ * ```
1050
+ */
1051
+ listen(opts?: RegistryListenOptions): Promise<void>;
1052
+ /**
1053
+ * Gracefully drains all live registries.
1054
+ *
1055
+ * Programmatic counterpart to the SIGINT/SIGTERM handlers: tears down
1056
+ * every live `CoreRegistry` (both `start()` and `handler()` modes) and
1057
+ * waits for the serve promise to resolve, all bounded by the shutdown
1058
+ * grace period. Unlike a signal-driven shutdown, this does not re-raise a
1059
+ * signal or exit the process. The caller owns process lifetime.
1060
+ *
1061
+ * Idempotent: concurrent or repeated calls share a single drain. Safe to
1062
+ * call even if nothing has been started.
1063
+ *
1064
+ * @example
1065
+ * ```ts
1066
+ * const registry = setup({ use: { counter } });
1067
+ * registry.start();
1068
+ * // ...later, on your own shutdown trigger:
1069
+ * await registry.shutdown();
1070
+ * ```
1071
+ */
1072
+ shutdown(): Promise<void>;
488
1073
  startEnvoy(): void;
489
1074
  /**
490
- * Starts the native actor envoy for standalone server deployments.
1075
+ * Starts the serverful registry if needed and waits until its envoy has
1076
+ * registered with the Engine. Repeated and concurrent calls share one
1077
+ * startup lifecycle and readiness promise.
1078
+ *
1079
+ * Unlike {@link start}, this reports startup failures and does not resolve
1080
+ * merely because an HTTP health endpoint is listening.
1081
+ */
1082
+ startAndWait(): Promise<void>;
1083
+ /**
1084
+ * Starts the actor envoy for standalone server deployments.
1085
+ *
1086
+ * Set `RIVETKIT_RUNTIME_MODE=serverless` to instead bind an HTTP listener
1087
+ * via `listen()` (Mode B). Mode A (envoy) and Mode B (listener) are
1088
+ * mutually exclusive per registry instance.
491
1089
  *
492
1090
  * @example
493
1091
  * ```ts
@@ -524,12 +1122,27 @@ interface QueueSendResult<TResponse = unknown> {
524
1122
  * @returns {Promise<Response>}
525
1123
  */
526
1124
  type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unknown> = (...args: Args extends [unknown, ...infer Rest] ? Rest : Args) => Promise<Response>;
1125
+ type IsAny<T> = 0 extends 1 & T ? true : false;
1126
+ type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => void) => () => void;
1127
+ type ActorActionMap<R> = {
1128
+ [K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : NonNullable<R>[K] extends Record<string, unknown> ? ActorActionMap<NonNullable<R>[K]> : never;
1129
+ };
1130
+ type ActionsOf<AD extends AnyActorDefinition> = AD["config"] extends {
1131
+ actions?: infer R;
1132
+ } ? R : never;
1133
+ interface ActorGatewayOptions {
1134
+ skipReadyWait?: boolean;
1135
+ }
1136
+ interface ActorActionOptions extends ActorGatewayOptions {
1137
+ signal?: AbortSignal;
1138
+ }
1139
+ type ActorConnectOptions = ActorGatewayOptions;
1140
+ type ActorFetchInit = RequestInit & ActorGatewayOptions;
1141
+ type ActorWebSocketOptions = ActorGatewayOptions;
527
1142
  /**
528
1143
  * Maps action methods from actor definition to typed function signatures.
529
1144
  */
530
- type ActorDefinitionActions<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? {
531
- [K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
532
- } : never;
1145
+ type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
533
1146
  type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
534
1147
  <K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
535
1148
  <K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
@@ -540,13 +1153,31 @@ type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
540
1153
  <K extends keyof TEvents & string>(eventName: K, callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void): () => void;
541
1154
  (eventName: keyof TEvents extends never ? string : never, callback: (...args: any[]) => void): () => void;
542
1155
  };
543
- type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
1156
+ type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
1157
+ send: ActorQueueSend<Record<string, any>>;
1158
+ } : AD extends {
1159
+ config: {
1160
+ queues?: infer Q;
1161
+ };
1162
+ } ? Q extends QueueSchemaConfig ? {
1163
+ send: ActorQueueSend<Q>;
1164
+ } : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
544
1165
  send: ActorQueueSend<Q>;
545
- } : never : never;
546
- type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
1166
+ } : {} : {};
1167
+ type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
1168
+ on: LooseEventSubscribe;
1169
+ once: LooseEventSubscribe;
1170
+ } : AD extends {
1171
+ config: {
1172
+ events?: infer E;
1173
+ };
1174
+ } ? E extends EventSchemaConfig ? {
547
1175
  on: ActorEventSubscribe<E>;
548
1176
  once: ActorEventSubscribe<E>;
549
- } : never : never;
1177
+ } : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
1178
+ on: ActorEventSubscribe<E>;
1179
+ once: ActorEventSubscribe<E>;
1180
+ } : {} : {};
550
1181
 
551
1182
  type ActorResolutionState = ActorQuery;
552
1183
 
@@ -598,7 +1229,7 @@ declare class ActorConnRaw {
598
1229
  *
599
1230
  * @protected
600
1231
  */
601
- constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState);
1232
+ constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
602
1233
  send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
603
1234
  send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
604
1235
  /**
@@ -663,6 +1294,10 @@ declare class ActorConnRaw {
663
1294
  * @returns {boolean} - True if the connection is open, false otherwise.
664
1295
  */
665
1296
  get isConnected(): boolean;
1297
+ /**
1298
+ * Resolves when this connection first reaches the connected state.
1299
+ */
1300
+ get ready(): Promise<void>;
666
1301
  /**
667
1302
  * Subscribes to connection open events.
668
1303
  *
@@ -730,7 +1365,7 @@ declare class ActorHandleRaw {
730
1365
  *
731
1366
  * @protected
732
1367
  */
733
- constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState);
1368
+ constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
734
1369
  send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
735
1370
  send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
736
1371
  /**
@@ -743,24 +1378,23 @@ declare class ActorHandleRaw {
743
1378
  action<Args extends Array<unknown> = unknown[], Response = unknown>(opts: {
744
1379
  name: string;
745
1380
  args: Args;
746
- signal?: AbortSignal;
747
- }): Promise<Response>;
1381
+ } & ActorActionOptions): Promise<Response>;
748
1382
  /**
749
1383
  * Establishes a persistent connection to the actor.
750
1384
  *
751
1385
  * @template AD The actor class that this connection is for.
752
1386
  * @returns {ActorConn<AD>} A connection to the actor.
753
1387
  */
754
- connect(params?: unknown): ActorConn<AnyActorDefinition>;
1388
+ connect(params?: unknown, options?: ActorConnectOptions): ActorConn<AnyActorDefinition>;
755
1389
  /**
756
1390
  * Fetches a resource from this actor via the /request endpoint. This is a
757
1391
  * convenience wrapper around the raw HTTP API.
758
1392
  */
759
- fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
1393
+ fetch(input: string | URL | Request, init?: ActorFetchInit): Promise<Response>;
760
1394
  /**
761
1395
  * Opens a raw WebSocket connection to this actor.
762
1396
  */
763
- webSocket(path?: string, protocols?: string | string[]): Promise<any>;
1397
+ webSocket(path?: string, protocols?: string | string[], options?: ActorWebSocketOptions): Promise<any>;
764
1398
  /**
765
1399
  * Resolves the actor to get its unique actor ID.
766
1400
  */
@@ -788,7 +1422,7 @@ declare class ActorHandleRaw {
788
1422
  * @see {@link ActorHandleRaw}
789
1423
  */
790
1424
  type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect" | "send"> & {
791
- connect(params?: unknown): ActorConn<AD>;
1425
+ connect(params?: unknown, options?: ActorConnectOptions): ActorConn<AD>;
792
1426
  resolve(): Promise<string>;
793
1427
  } & ActorDefinitionQueueSend<AD> & ActorDefinitionActions<AD>;
794
1428
 
@@ -890,6 +1524,11 @@ interface GetOrCreateOptions extends QueryOptions {
890
1524
  createInRegion?: string;
891
1525
  /** Input data to pass to the actor. */
892
1526
  createWithInput?: unknown;
1527
+ /**
1528
+ * Name of the envoy pool to select for this actor if it is created.
1529
+ * Overrides the client's configured `poolName` for this call.
1530
+ */
1531
+ poolName?: string;
893
1532
  }
894
1533
  /**
895
1534
  * Options for creating a actor.
@@ -901,6 +1540,11 @@ interface CreateOptions extends QueryOptions {
901
1540
  region?: string;
902
1541
  /** Input data to pass to the actor. */
903
1542
  input?: unknown;
1543
+ /**
1544
+ * Name of the envoy pool to select for this actor.
1545
+ * Overrides the client's configured `poolName` for this call.
1546
+ */
1547
+ poolName?: string;
904
1548
  }
905
1549
  /**
906
1550
  * Represents a region to connect to.
@@ -934,7 +1578,7 @@ declare class ClientRaw {
934
1578
  /**
935
1579
  * Creates an instance of Client.
936
1580
  */
937
- constructor(driver: EngineControlClient, encoding: Encoding | undefined);
1581
+ constructor(driver: EngineControlClient, encoding: Encoding | undefined, gatewayOptions?: ActorGatewayOptions);
938
1582
  /**
939
1583
  * Gets a stateless handle to a actor by its ID.
940
1584
  *
@@ -996,10 +1640,12 @@ type Client<A extends Registry<any>> = ClientRaw & {
996
1640
  type AnyClient = Client<Registry<any>>;
997
1641
  declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient, config?: {
998
1642
  encoding?: Encoding;
1643
+ gateway?: ActorGatewayOptions;
999
1644
  }): Client<A>;
1000
1645
 
1001
1646
  declare const DEFAULT_SLEEP_GRACE_PERIOD = 15000;
1002
1647
  declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
1648
+ declare const RAW_STATE_SYMBOL: unique symbol;
1003
1649
  declare const CONN_DRIVER_SYMBOL: unique symbol;
1004
1650
  declare const CONN_STATE_MANAGER_SYMBOL: unique symbol;
1005
1651
  interface ActorLogger {
@@ -1034,6 +1680,10 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
1034
1680
  limit?: number;
1035
1681
  };
1036
1682
  type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
1683
+ /**
1684
+ * @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
1685
+ * or actor state instead.
1686
+ */
1037
1687
  interface ActorKv {
1038
1688
  get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
1039
1689
  put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
@@ -1048,10 +1698,83 @@ interface ActorKv {
1048
1698
  [key: string]: any;
1049
1699
  }
1050
1700
  interface ActorSchedule {
1051
- after(duration: number, action: string, ...args: unknown[]): Promise<void>;
1052
- at(timestamp: number, action: string, ...args: unknown[]): Promise<void>;
1701
+ after(duration: number, action: string, ...args: unknown[]): Promise<string>;
1702
+ at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
1703
+ cancel(id: string): Promise<boolean>;
1704
+ get(id: string): Promise<ScheduledEventInfo | undefined>;
1705
+ list(): Promise<ScheduledEventInfo[]>;
1706
+ [key: string]: any;
1707
+ }
1708
+ interface ActorCronSetOptions {
1709
+ name: string;
1710
+ expression: string;
1711
+ action: string;
1712
+ args?: unknown[];
1713
+ timezone?: string;
1714
+ /** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
1715
+ maxHistory?: number;
1716
+ }
1717
+ interface ActorCronEveryOptions {
1718
+ name: string;
1719
+ /** Fixed interval in milliseconds. Minimum 5,000. */
1720
+ interval: number;
1721
+ action: string;
1722
+ args?: unknown[];
1723
+ /** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
1724
+ maxHistory?: number;
1725
+ }
1726
+ interface ActorCron {
1727
+ set(options: ActorCronSetOptions): Promise<void>;
1728
+ every(options: ActorCronEveryOptions): Promise<void>;
1729
+ get(name: string): Promise<CronJobInfo | undefined>;
1730
+ list(): Promise<CronJobInfo[]>;
1731
+ delete(name: string): Promise<boolean>;
1732
+ history(name: string, options?: {
1733
+ limit?: number;
1734
+ }): Promise<CronFire[]>;
1053
1735
  [key: string]: any;
1054
1736
  }
1737
+ interface ScheduledEventInfo {
1738
+ id: string;
1739
+ action: string;
1740
+ args: unknown[];
1741
+ runAt: number;
1742
+ }
1743
+ type CronJobInfo = {
1744
+ name: string;
1745
+ action: string;
1746
+ args: unknown[];
1747
+ nextRunAt: number;
1748
+ lastRunAt?: number;
1749
+ maxHistory: number;
1750
+ } & ({
1751
+ kind: "cron";
1752
+ expression: string;
1753
+ timezone: string;
1754
+ } | {
1755
+ kind: "every";
1756
+ interval: number;
1757
+ });
1758
+ interface ScheduledFireInfo {
1759
+ kind: "at" | "cron" | "every";
1760
+ id: string;
1761
+ name?: string;
1762
+ scheduledAt: number;
1763
+ firedAt: number;
1764
+ }
1765
+ interface CronFire {
1766
+ action: string;
1767
+ scheduledAt: number;
1768
+ firedAt: number;
1769
+ finishedAt?: number;
1770
+ result: "running" | "ok" | "error" | "skipped";
1771
+ error?: {
1772
+ group: string;
1773
+ code: string;
1774
+ message: string;
1775
+ metadata?: unknown;
1776
+ };
1777
+ }
1055
1778
  type QueueMessageOf<Name extends string, Body> = {
1056
1779
  id: number | bigint;
1057
1780
  name: Name;
@@ -1110,13 +1833,20 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
1110
1833
  next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
1111
1834
  nextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextBatchOptions<TName, TCompletable>): Promise<any[]>;
1112
1835
  waitForNames<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(names: readonly TName[], opts?: QueueWaitOptions<TCompletable>): Promise<any>;
1836
+ /** @experimental */
1837
+ waitForAvailable<const TName extends QueueFilterName<TQueues>>(names?: readonly TName[], opts?: Omit<QueueWaitOptions<false>, "completable">): Promise<void>;
1838
+ /** @experimental */
1839
+ complete<const TName extends QueueFilterName<TQueues>>(message: {
1840
+ id: number | bigint;
1841
+ name: TName;
1842
+ }, ...args: QueueCompleteArgsForName<TQueues, TName>): Promise<void>;
1113
1843
  enqueueAndWait<const TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"], opts?: QueueEnqueueAndWaitOptions): Promise<QueueCompletionResultForName<TQueues, TName>>;
1114
1844
  tryNext<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextOptions<TName, TCompletable>): Promise<any>;
1115
1845
  tryNextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextBatchOptions<TName, TCompletable>): Promise<any[]>;
1116
1846
  iter<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueIterOptions<TName, TCompletable>): AsyncIterable<any>;
1117
1847
  [key: string]: any;
1118
1848
  }
1119
- interface Conn<TState = unknown, TConnParams = unknown, TConnState = unknown, TVars = unknown, TInput = unknown, TDatabase extends AnyDatabaseProvider = AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
1849
+ interface Conn<_TState = unknown, TConnParams = unknown, TConnState = unknown, _TVars = unknown, _TInput = unknown, _TDatabase extends AnyDatabaseProvider = AnyDatabaseProvider, _TEvents extends EventSchemaConfig = Record<never, never>, _TQueues extends QueueSchemaConfig = Record<never, never>> {
1120
1850
  id: string;
1121
1851
  params: TConnParams;
1122
1852
  state: TConnState;
@@ -1128,16 +1858,29 @@ interface Conn<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
1128
1858
  type AnyConn = Conn<any, any, any, any, any, any, any, any>;
1129
1859
  interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
1130
1860
  [ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
1861
+ /** Returns the raw unwrapped state without the write-through proxy. */
1862
+ [RAW_STATE_SYMBOL](): TState;
1131
1863
  state: TState;
1132
1864
  vars: TVars;
1865
+ /**
1866
+ * @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
1867
+ * or actor state instead.
1868
+ */
1133
1869
  readonly kv: ActorKv;
1134
1870
  readonly db: InferDatabaseClient<TDatabase>;
1135
1871
  readonly schedule: ActorSchedule;
1872
+ readonly cron: ActorCron;
1136
1873
  readonly queue: ActorQueue<TQueues>;
1874
+ /** @experimental */
1875
+ readonly run: ActorRun;
1137
1876
  readonly actorId: string;
1138
1877
  readonly name: string;
1139
1878
  readonly key: string[];
1140
1879
  readonly region: string;
1880
+ /** Provisions the experimental Actor Runtime Socket for this actor generation. */
1881
+ actorRuntimeSocket(): Promise<{
1882
+ path: string;
1883
+ }>;
1141
1884
  readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
1142
1885
  readonly log: ActorLogger;
1143
1886
  readonly abortSignal: AbortSignal;
@@ -1159,6 +1902,14 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
1159
1902
  client<T = any>(): ActorClientFor<T>;
1160
1903
  [key: string]: any;
1161
1904
  }
1905
+ /** @experimental */
1906
+ interface ActorRun {
1907
+ /**
1908
+ * @experimental Sets or clears the durable Unix-millisecond deadline that
1909
+ * ensures this actor's run handler is active, starting it if inactive.
1910
+ */
1911
+ setWakeAt(timestamp: number | null): Promise<void>;
1912
+ }
1162
1913
  type ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & {
1163
1914
  conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
1164
1915
  };
@@ -1187,14 +1938,90 @@ interface ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase e
1187
1938
  database?: TDatabase;
1188
1939
  }
1189
1940
  type InspectorUnsubscribe = () => void;
1941
+ /** @experimental */
1190
1942
  interface WorkflowInspectorConfig<THistory = unknown> {
1191
1943
  getHistory: () => THistory | null;
1944
+ getState?: () => Promise<WorkflowState | null>;
1192
1945
  onHistoryUpdated?: (listener: (history: THistory) => void) => InspectorUnsubscribe;
1193
1946
  replayFromStep?: (entryId?: string) => Promise<THistory | null>;
1194
1947
  }
1948
+ /** @experimental */
1195
1949
  interface RunInspectorConfig<THistory = unknown> {
1196
1950
  workflow?: WorkflowInspectorConfig<THistory>;
1197
1951
  }
1952
+ /**
1953
+ * Built-in inspector tabs the dashboard ships. Used to validate
1954
+ * `hidden: true` entries and reject custom-tab ids that collide with
1955
+ * a built-in.
1956
+ */
1957
+ declare const BUILTIN_INSPECTOR_TAB_IDS: readonly ["workflow", "database", "state", "queue", "schedules", "connections", "console"];
1958
+ declare const BuiltinInspectorTabIdSchema: z.ZodEnum<{
1959
+ workflow: "workflow";
1960
+ state: "state";
1961
+ database: "database";
1962
+ queue: "queue";
1963
+ schedules: "schedules";
1964
+ connections: "connections";
1965
+ console: "console";
1966
+ }>;
1967
+ declare const CustomInspectorTabEntrySchema: z.ZodObject<{
1968
+ id: z.ZodString;
1969
+ label: z.ZodString;
1970
+ source: z.ZodString;
1971
+ icon: z.ZodOptional<z.ZodString>;
1972
+ hidden: z.ZodOptional<z.ZodLiteral<false>>;
1973
+ }, z.core.$strict>;
1974
+ declare const HideInspectorTabEntrySchema: z.ZodObject<{
1975
+ id: z.ZodEnum<{
1976
+ workflow: "workflow";
1977
+ state: "state";
1978
+ database: "database";
1979
+ queue: "queue";
1980
+ schedules: "schedules";
1981
+ connections: "connections";
1982
+ console: "console";
1983
+ }>;
1984
+ hidden: z.ZodLiteral<true>;
1985
+ }, z.core.$strict>;
1986
+ declare const InspectorTabEntrySchema: z.ZodUnion<readonly [z.ZodObject<{
1987
+ id: z.ZodString;
1988
+ label: z.ZodString;
1989
+ source: z.ZodString;
1990
+ icon: z.ZodOptional<z.ZodString>;
1991
+ hidden: z.ZodOptional<z.ZodLiteral<false>>;
1992
+ }, z.core.$strict>, z.ZodObject<{
1993
+ id: z.ZodEnum<{
1994
+ workflow: "workflow";
1995
+ state: "state";
1996
+ database: "database";
1997
+ queue: "queue";
1998
+ schedules: "schedules";
1999
+ connections: "connections";
2000
+ console: "console";
2001
+ }>;
2002
+ hidden: z.ZodLiteral<true>;
2003
+ }, z.core.$strict>]>;
2004
+ declare const ActorInspectorConfigSchema: z.ZodObject<{
2005
+ tabs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2006
+ id: z.ZodString;
2007
+ label: z.ZodString;
2008
+ source: z.ZodString;
2009
+ icon: z.ZodOptional<z.ZodString>;
2010
+ hidden: z.ZodOptional<z.ZodLiteral<false>>;
2011
+ }, z.core.$strict>, z.ZodObject<{
2012
+ id: z.ZodEnum<{
2013
+ workflow: "workflow";
2014
+ state: "state";
2015
+ database: "database";
2016
+ queue: "queue";
2017
+ schedules: "schedules";
2018
+ connections: "connections";
2019
+ console: "console";
2020
+ }>;
2021
+ hidden: z.ZodLiteral<true>;
2022
+ }, z.core.$strict>]>>>;
2023
+ }, z.core.$strict>;
2024
+ type ActorInspectorConfig = z.input<typeof ActorInspectorConfigSchema>;
1198
2025
  declare const RunConfigSchema: z.ZodObject<{
1199
2026
  name: z.ZodOptional<z.ZodString>;
1200
2027
  icon: z.ZodOptional<z.ZodString>;
@@ -1202,6 +2029,7 @@ declare const RunConfigSchema: z.ZodObject<{
1202
2029
  inspector: z.ZodOptional<z.ZodOptional<z.ZodObject<{
1203
2030
  workflow: z.ZodOptional<z.ZodObject<{
1204
2031
  getHistory: z.ZodCustom<() => unknown, () => unknown>;
2032
+ getState: z.ZodOptional<z.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
1205
2033
  onHistoryUpdated: z.ZodOptional<z.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
1206
2034
  replayFromStep: z.ZodOptional<z.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
1207
2035
  }, z.core.$strip>>;
@@ -1212,7 +2040,59 @@ type RunConfig<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
1212
2040
  run: (c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>;
1213
2041
  };
1214
2042
  type AnyRunConfig = RunConfig<any, any, any, any, any, AnyDatabaseProvider, any, any>;
1215
- declare const RUN_FUNCTION_CONFIG_SYMBOL: unique symbol;
2043
+ /** @experimental */
2044
+ type RunInspectorKind = "workflow";
2045
+ /** @experimental */
2046
+ interface RunWithInactiveOptions {
2047
+ /** Restart the run handler before releasing the exclusive gate on success. */
2048
+ restartOnSuccess?: boolean;
2049
+ }
2050
+ /** @experimental */
2051
+ interface RunControl {
2052
+ run: {
2053
+ /**
2054
+ * Executes only while no run handler is active or waiting to start.
2055
+ *
2056
+ * This is a non-blocking acquisition: concurrent replay/control requests
2057
+ * fail instead of waiting behind an active run.
2058
+ */
2059
+ withInactive<T>(options: RunWithInactiveOptions, callback: () => T | Promise<T>): Promise<T>;
2060
+ };
2061
+ }
2062
+ /** @experimental */
2063
+ interface RunInspectorFactoryContext {
2064
+ actorId: string;
2065
+ control: RunControl;
2066
+ }
2067
+ /** @experimental */
2068
+ interface RunInspectorFactoryResult<THistory = unknown> {
2069
+ inspector: {
2070
+ workflow: Required<WorkflowInspectorConfig<THistory>> & {
2071
+ getState: () => Promise<WorkflowState | null>;
2072
+ };
2073
+ };
2074
+ /** Releases actor-specific listeners and encoded history. */
2075
+ dispose?: () => void;
2076
+ }
2077
+ interface RunHandlerDisplayOptions {
2078
+ name?: string;
2079
+ icon?: string;
2080
+ }
2081
+ /** @experimental */
2082
+ type DefineRunHandlerOptions<THistory = unknown> = RunHandlerDisplayOptions & ({
2083
+ inspectorKind?: never;
2084
+ createInspector?: never;
2085
+ } | {
2086
+ /** Static metadata used to install Inspector callbacks at registry build time. */
2087
+ inspectorKind: RunInspectorKind;
2088
+ /** Creates one Inspector adapter for each live actor. */
2089
+ createInspector: (context: RunInspectorFactoryContext) => RunInspectorFactoryResult<THistory>;
2090
+ });
2091
+ /**
2092
+ * @experimental Adds supported RivetKit run metadata while preserving the function's exact
2093
+ * callable type.
2094
+ */
2095
+ declare function defineRunHandler<TRun extends (...args: any[]) => any, THistory = unknown>(run: TRun, options: DefineRunHandlerOptions<THistory>): TRun;
1216
2096
  /** Extract the run function from either a function or RunConfig object. */
1217
2097
  declare function getRunFunction(run: ((...args: any[]) => any) | AnyRunConfig | undefined): ((...args: any[]) => any) | undefined;
1218
2098
  /** Extract run metadata (name/icon) from RunConfig if provided. */
@@ -1222,9 +2102,12 @@ declare function getRunMetadata(run: ((...args: any[]) => any) | AnyRunConfig |
1222
2102
  };
1223
2103
  /** Extract run inspector configuration if provided. */
1224
2104
  declare function getRunInspectorConfig(run: ((...args: any[]) => any) | AnyRunConfig | undefined, actor?: unknown): RunInspectorConfig | undefined;
2105
+ /** Release per-actor inspector state for a destroyed actor, if the run handler registered a disposer. */
2106
+ declare function disposeRunInspector(run: ((...args: any[]) => any) | AnyRunConfig | undefined, actorId: string): void;
1225
2107
  declare const GlobalActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
1226
2108
  name: z.ZodOptional<z.ZodString>;
1227
2109
  icon: z.ZodOptional<z.ZodString>;
2110
+ enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
1228
2111
  canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
1229
2112
  }, z.core.$strict>>;
1230
2113
  type GlobalActorOptions = z.infer<typeof GlobalActorOptionsSchema>;
@@ -1245,6 +2128,7 @@ declare const InstanceActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
1245
2128
  noSleep: z.ZodDefault<z.ZodBoolean>;
1246
2129
  sleepTimeout: z.ZodDefault<z.ZodNumber>;
1247
2130
  maxQueueSize: z.ZodDefault<z.ZodNumber>;
2131
+ maxSchedules: z.ZodDefault<z.ZodNumber>;
1248
2132
  maxQueueMessageSize: z.ZodDefault<z.ZodNumber>;
1249
2133
  preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
1250
2134
  preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
@@ -1254,6 +2138,7 @@ type InstanceActorOptionsInput = z.input<typeof InstanceActorOptionsSchema>;
1254
2138
  declare const ActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
1255
2139
  name: z.ZodOptional<z.ZodString>;
1256
2140
  icon: z.ZodOptional<z.ZodString>;
2141
+ enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
1257
2142
  canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
1258
2143
  createVarsTimeout: z.ZodDefault<z.ZodNumber>;
1259
2144
  createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
@@ -1270,6 +2155,7 @@ declare const ActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
1270
2155
  noSleep: z.ZodDefault<z.ZodBoolean>;
1271
2156
  sleepTimeout: z.ZodDefault<z.ZodNumber>;
1272
2157
  maxQueueSize: z.ZodDefault<z.ZodNumber>;
2158
+ maxSchedules: z.ZodDefault<z.ZodNumber>;
1273
2159
  maxQueueMessageSize: z.ZodDefault<z.ZodNumber>;
1274
2160
  preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
1275
2161
  preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
@@ -1289,6 +2175,7 @@ declare const ActorConfigSchema: z.ZodObject<{
1289
2175
  inspector: z.ZodOptional<z.ZodOptional<z.ZodObject<{
1290
2176
  workflow: z.ZodOptional<z.ZodObject<{
1291
2177
  getHistory: z.ZodCustom<() => unknown, () => unknown>;
2178
+ getState: z.ZodOptional<z.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
1292
2179
  onHistoryUpdated: z.ZodOptional<z.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
1293
2180
  replayFromStep: z.ZodOptional<z.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
1294
2181
  }, z.core.$strip>>;
@@ -1301,7 +2188,7 @@ declare const ActorConfigSchema: z.ZodObject<{
1301
2188
  onBeforeActionResponse: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
1302
2189
  onRequest: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
1303
2190
  onWebSocket: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
1304
- actions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>>;
2191
+ actions: z.ZodDefault<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
1305
2192
  actionInputSchemas: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1306
2193
  connParamsSchema: z.ZodOptional<z.ZodAny>;
1307
2194
  events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -1316,6 +2203,7 @@ declare const ActorConfigSchema: z.ZodObject<{
1316
2203
  options: z.ZodPrefault<z.ZodObject<{
1317
2204
  name: z.ZodOptional<z.ZodString>;
1318
2205
  icon: z.ZodOptional<z.ZodString>;
2206
+ enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
1319
2207
  canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
1320
2208
  createVarsTimeout: z.ZodDefault<z.ZodNumber>;
1321
2209
  createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
@@ -1332,12 +2220,33 @@ declare const ActorConfigSchema: z.ZodObject<{
1332
2220
  noSleep: z.ZodDefault<z.ZodBoolean>;
1333
2221
  sleepTimeout: z.ZodDefault<z.ZodNumber>;
1334
2222
  maxQueueSize: z.ZodDefault<z.ZodNumber>;
2223
+ maxSchedules: z.ZodDefault<z.ZodNumber>;
1335
2224
  maxQueueMessageSize: z.ZodDefault<z.ZodNumber>;
1336
2225
  preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
1337
2226
  preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
1338
2227
  }, z.core.$strict>>;
2228
+ inspector: z.ZodOptional<z.ZodObject<{
2229
+ tabs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2230
+ id: z.ZodString;
2231
+ label: z.ZodString;
2232
+ source: z.ZodString;
2233
+ icon: z.ZodOptional<z.ZodString>;
2234
+ hidden: z.ZodOptional<z.ZodLiteral<false>>;
2235
+ }, z.core.$strict>, z.ZodObject<{
2236
+ id: z.ZodEnum<{
2237
+ workflow: "workflow";
2238
+ state: "state";
2239
+ database: "database";
2240
+ queue: "queue";
2241
+ schedules: "schedules";
2242
+ connections: "connections";
2243
+ console: "console";
2244
+ }>;
2245
+ hidden: z.ZodLiteral<true>;
2246
+ }, z.core.$strict>]>>>;
2247
+ }, z.core.$strict>>;
1339
2248
  }, z.core.$strict>;
1340
- type CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
2249
+ type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
1341
2250
  state: TState;
1342
2251
  } | {
1343
2252
  createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
@@ -1350,7 +2259,7 @@ type CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase e
1350
2259
  /**
1351
2260
  * @experimental
1352
2261
  */
1353
- type CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
2262
+ type CreateVars<TState, _TConnParams, _TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
1354
2263
  /**
1355
2264
  * @experimental
1356
2265
  */
@@ -1362,7 +2271,10 @@ type CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase extend
1362
2271
  createVars: (c: CreateVarsContext<TState, TInput, TDatabase, TEvents, TQueues>, driverCtx: any) => TVars | Promise<TVars>;
1363
2272
  } | Record<never, never>;
1364
2273
  interface Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
1365
- [Action: string]: (c: ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, ...args: any[]) => any;
2274
+ [Action: string]: ((c: ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, ...args: any[]) => any) | Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2275
+ }
2276
+ interface ActionInputSchemas {
2277
+ [Action: string]: PrimitiveSchema | ActionInputSchemas;
1366
2278
  }
1367
2279
  /**
1368
2280
  * @experimental
@@ -1422,7 +2334,7 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
1422
2334
  * shutdown window (`sleepGracePeriod`) cover deferred work.
1423
2335
  *
1424
2336
  * The handler receives an abort signal via `c.abortSignal` and a
1425
- * `c.aborted` alias for loop checks. Use these to gracefully exit.
2337
+ * `c.aborted` alias. Use these to gracefully exit when shutdown starts.
1426
2338
  *
1427
2339
  * If this handler exits, the actor will follow the normal idle sleep timeout
1428
2340
  * once it becomes idle.
@@ -1451,10 +2363,11 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
1451
2363
  * Called before a client connects to the actor.
1452
2364
  *
1453
2365
  * Use this hook to determine if a connection should be accepted
1454
- * and to initialize connection-specific state.
2366
+ * and to validate client-provided parameters. The pending connection
2367
+ * is not visible in `c.conns` while this hook runs.
1455
2368
  *
1456
2369
  * @param opts Connection parameters including client-provided data
1457
- * @returns The initial connection state or a Promise that resolves to it
2370
+ * @returns Void or a Promise.
1458
2371
  * @throws Throw an error to reject the connection
1459
2372
  */
1460
2373
  onBeforeConnect?: (c: BeforeConnectContext<TState, TVars, TInput, TDatabase, TEvents, TQueues>, params: TConnParams) => void | Promise<void>;
@@ -1462,7 +2375,8 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
1462
2375
  * Called when a client successfully connects to the actor.
1463
2376
  *
1464
2377
  * Use this hook to perform actions when a connection is established,
1465
- * such as sending initial data or updating the actor's state.
2378
+ * such as sending initial data or updating the actor's state. The
2379
+ * connection is visible in `c.conns` before this hook runs.
1466
2380
  *
1467
2381
  * @param conn The connection object
1468
2382
  * @returns Void or a Promise that resolves when connection handling is complete
@@ -1516,9 +2430,10 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
1516
2430
  onWebSocket?: (c: WebSocketContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, websocket: UniversalWebSocket) => void | Promise<void>;
1517
2431
  actions?: TActions;
1518
2432
  /**
1519
- * Optional schema map for validating action argument tuples in native runtimes.
2433
+ * Optional schemas for validating action argument tuples in native runtimes.
2434
+ * May mirror nested action groups or use dot-separated low-level action names.
1520
2435
  */
1521
- actionInputSchemas?: Record<string, PrimitiveSchema>;
2436
+ actionInputSchemas?: ActionInputSchemas;
1522
2437
  /**
1523
2438
  * Optional schema for validating connection params in native runtimes.
1524
2439
  */
@@ -1538,7 +2453,7 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
1538
2453
  */
1539
2454
  db: TDatabase;
1540
2455
  } | Record<never, never>;
1541
- type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
2456
+ type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
1542
2457
  type ActorConfigInput<TState = undefined, TConnParams = undefined, TConnState = undefined, TVars = undefined, TInput = undefined, TDatabase extends AnyDatabaseProvider = undefined, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Record<never, never>> = {
1543
2458
  types?: ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase>;
1544
2459
  } & Omit<z.input<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
@@ -1546,6 +2461,7 @@ declare function test<TState, TConnParams, TConnState, TVars, TInput, TDatabase
1546
2461
  declare const DocActorOptionsSchema: z.ZodObject<{
1547
2462
  name: z.ZodOptional<z.ZodString>;
1548
2463
  icon: z.ZodOptional<z.ZodString>;
2464
+ enableActorRuntimeSocket: z.ZodOptional<z.ZodBoolean>;
1549
2465
  createVarsTimeout: z.ZodOptional<z.ZodNumber>;
1550
2466
  createConnStateTimeout: z.ZodOptional<z.ZodNumber>;
1551
2467
  onMigrateTimeout: z.ZodOptional<z.ZodNumber>;
@@ -1561,10 +2477,9 @@ declare const DocActorOptionsSchema: z.ZodObject<{
1561
2477
  noSleep: z.ZodOptional<z.ZodBoolean>;
1562
2478
  sleepTimeout: z.ZodOptional<z.ZodNumber>;
1563
2479
  maxQueueSize: z.ZodOptional<z.ZodNumber>;
2480
+ maxSchedules: z.ZodOptional<z.ZodNumber>;
1564
2481
  maxQueueMessageSize: z.ZodOptional<z.ZodNumber>;
1565
2482
  canHibernateWebSocket: z.ZodOptional<z.ZodBoolean>;
1566
- preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
1567
- preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
1568
2483
  }, z.core.$strip>;
1569
2484
  declare const DocActorConfigSchema: z.ZodObject<{
1570
2485
  state: z.ZodOptional<z.ZodUnknown>;
@@ -1595,6 +2510,7 @@ declare const DocActorConfigSchema: z.ZodObject<{
1595
2510
  options: z.ZodOptional<z.ZodObject<{
1596
2511
  name: z.ZodOptional<z.ZodString>;
1597
2512
  icon: z.ZodOptional<z.ZodString>;
2513
+ enableActorRuntimeSocket: z.ZodOptional<z.ZodBoolean>;
1598
2514
  createVarsTimeout: z.ZodOptional<z.ZodNumber>;
1599
2515
  createConnStateTimeout: z.ZodOptional<z.ZodNumber>;
1600
2516
  onMigrateTimeout: z.ZodOptional<z.ZodNumber>;
@@ -1610,11 +2526,10 @@ declare const DocActorConfigSchema: z.ZodObject<{
1610
2526
  noSleep: z.ZodOptional<z.ZodBoolean>;
1611
2527
  sleepTimeout: z.ZodOptional<z.ZodNumber>;
1612
2528
  maxQueueSize: z.ZodOptional<z.ZodNumber>;
2529
+ maxSchedules: z.ZodOptional<z.ZodNumber>;
1613
2530
  maxQueueMessageSize: z.ZodOptional<z.ZodNumber>;
1614
2531
  canHibernateWebSocket: z.ZodOptional<z.ZodBoolean>;
1615
- preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
1616
- preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
1617
2532
  }, z.core.$strip>>;
1618
2533
  }, z.core.$strip>;
1619
2534
 
1620
- export { DocConfigurePoolSchema as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorSchedule as F, type ActorTypes as G, ActorsSchema as H, type AnyActorInstance as I, type AnyClient as J, type AnyConn as K, type AnyStaticActorDefinition as L, type MigrateContext as M, type AnyStaticActorInstance as N, type AuthIntent as O, type BaseActorInstance as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, CONN_DRIVER_SYMBOL as T, CONN_STATE_MANAGER_SYMBOL as U, type Client as V, type WakeContext as W, type Conn as X, DEFAULT_SLEEP_GRACE_PERIOD as Y, DocActorConfigSchema as Z, DocActorOptionsSchema as _, type ActionContext as a, type ExtractRegistryFromClient as a$, DocEnvoyConfigSchema as a0, DocRegistryConfigSchema as a1, DocServerlessConfigSchema as a2, type Encoding as a3, type FetchHandler as a4, type GlobalActorOptions as a5, type GlobalActorOptionsInput as a6, GlobalActorOptionsSchema as a7, type InspectorUnsubscribe as a8, type InstanceActorOptions as a9, type WorkflowInspectorConfig as aA, actor as aB, buildActorNames as aC, createClientWithDriver as aD, event as aE, getRunFunction as aF, getRunInspectorConfig as aG, getRunMetadata as aH, isStaticActorDefinition as aI, isStaticActorInstance as aJ, lookupInRegistry as aK, queue as aL, setup as aM, test as aN, type ActorAccessor as aO, type ActorActionFunction as aP, type ActorConn as aQ, ActorConnRaw as aR, type ActorConnStatus as aS, type ActorHandle as aT, ActorHandleRaw as aU, ClientRaw as aV, type ConnectionStateCallback as aW, type CreateOptions as aX, type CreateRequest as aY, type EventUnsubscribe as aZ, type ExtractActorsFromRegistry as a_, type InstanceActorOptionsInput as aa, InstanceActorOptionsSchema as ab, type QueueEnqueueAndWaitOptions as ac, type QueueFilterName as ad, type QueueIterOptions as ae, type QueueMessageOf as af, type QueueName as ag, type QueueNextBatchOptions as ah, type QueueNextOptions as ai, type QueueResultMessageForName as aj, type QueueTryNextBatchOptions as ak, type QueueTryNextOptions as al, type QueueWaitOptions as am, RUN_FUNCTION_CONFIG_SYMBOL as an, Registry as ao, type RegistryActors as ap, type RegistryConfig as aq, type RegistryConfigInput as ar, RegistryConfigSchema as as, type RunConfig as at, RunConfigSchema as au, type RunInspectorConfig as av, type ServerlessHandler as aw, type TestConfig as ax, TestConfigSchema as ay, type Type as az, type BeforeActionResponseContext as b, type GetOptions as b0, type GetWithIdOptions as b1, type QueryOptions as b2, type Region as b3, type StatusChangeCallback as b4, type InferSchemaMap as b5, type InferEventArgs as b6, type BeforeConnectContext as c, type CreateConnStateContext as d, type CreateContext as e, type CreateVarsContext as f, type DisconnectContext as g, type RunContext as h, type StateChangeContext as i, type WebSocketContext as j, ACTOR_CONTEXT_INTERNAL_SYMBOL as k, type Actions as l, type ActorConfig as m, type ActorConfigInput as n, ActorConfigSchema as o, type ActorContext as p, type ActorContextOf as q, ActorDefinition as r, type ActorKey as s, type ActorKv as t, type ActorLogger as u, type ActorOptions as v, type ActorOptionsInput as w, ActorOptionsSchema as x, type ActorQuery as y, type ActorQueue as z };
2535
+ export { type BaseActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorLogger as F, type ActorOptions as G, type ActorOptionsInput as H, ActorOptionsSchema as I, type ActorQuery as J, type ActorQueue as K, type ActorRun as L, type MigrateContext as M, type ActorSchedule as N, type ActorTypes as O, ActorsSchema as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AnyActorInstance as T, type AnyClient as U, type AnyConn as V, type WakeContext as W, type AnyStaticActorDefinition as X, type AnyStaticActorInstance as Y, type AuthIntent as Z, BUILTIN_INSPECTOR_TAB_IDS as _, type ActionContext as a, type SqliteBackend as a$, BuiltinInspectorTabIdSchema as a0, CONN_DRIVER_SYMBOL as a1, CONN_STATE_MANAGER_SYMBOL as a2, type Client as a3, type Conn as a4, type CronFire as a5, type CronJobInfo as a6, CustomInspectorTabEntrySchema as a7, DEFAULT_SLEEP_GRACE_PERIOD as a8, type DefineRunHandlerOptions as a9, type QueueResultMessageForName as aA, type QueueTryNextBatchOptions as aB, type QueueTryNextOptions as aC, type QueueWaitOptions as aD, RAW_STATE_SYMBOL as aE, Registry as aF, type RegistryActors as aG, type RegistryApplication as aH, type RegistryConfig as aI, type RegistryConfigInput as aJ, RegistryConfigSchema as aK, type RegistryDeps as aL, type RegistryListenOptions as aM, type RegistryRoutes as aN, type RunConfig as aO, RunConfigSchema as aP, type RunControl as aQ, type RunInspectorConfig as aR, type RunInspectorFactoryContext as aS, type RunInspectorFactoryResult as aT, type RunInspectorKind as aU, type RunWithInactiveOptions as aV, type RuntimeKind as aW, RuntimeKindSchema as aX, type ScheduledEventInfo as aY, type ScheduledFireInfo as aZ, type ServerlessHandler as a_, DocActorConfigSchema as aa, DocActorOptionsSchema as ab, DocConfigurePoolSchema as ac, DocEnvoyConfigSchema as ad, DocRegistryConfigSchema as ae, DocServerlessConfigSchema as af, DocSqliteConfigSchema as ag, type FetchHandler as ah, type GlobalActorOptions as ai, type GlobalActorOptionsInput as aj, GlobalActorOptionsSchema as ak, HideInspectorTabEntrySchema as al, type InferEventArgs as am, type InferSchemaMap as an, InspectorTabEntrySchema as ao, type InspectorUnsubscribe as ap, type InstanceActorOptions as aq, type InstanceActorOptionsInput as ar, InstanceActorOptionsSchema as as, type QueueEnqueueAndWaitOptions as at, type QueueFilterName as au, type QueueIterOptions as av, type QueueMessageOf as aw, type QueueName as ax, type QueueNextBatchOptions as ay, type QueueNextOptions as az, type BeforeActionResponseContext as b, SqliteBackendSchema as b0, type SqliteConfig as b1, SqliteConfigSchema as b2, type TestConfig as b3, TestConfigSchema as b4, type Type as b5, type WasmRuntimeBindings as b6, type WasmRuntimeConfig as b7, WasmRuntimeConfigSchema as b8, type WasmRuntimeInitInput as b9, ClientRaw as bA, type ConnectionStateCallback as bB, type CreateOptions as bC, type CreateRequest as bD, type EventUnsubscribe as bE, type ExtractActorsFromRegistry as bF, type ExtractRegistryFromClient as bG, type GetOptions as bH, type GetWithIdOptions as bI, type QueryOptions as bJ, type Region as bK, type StatusChangeCallback as bL, type WorkflowInspectorConfig as ba, actor as bb, buildActorNames as bc, createClientWithDriver as bd, defineRunHandler as be, disposeRunInspector as bf, event as bg, getRunFunction as bh, getRunInspectorConfig as bi, getRunMetadata as bj, isStaticActorDefinition as bk, isStaticActorInstance as bl, lookupInRegistry as bm, queue as bn, setup as bo, test as bp, type ActorAccessor as bq, type ActorActionFunction as br, type ActorActionOptions as bs, type ActorConn as bt, ActorConnRaw as bu, type ActorConnStatus as bv, type ActorConnectOptions as bw, type ActorGatewayOptions as bx, type ActorHandle as by, ActorHandleRaw as bz, type BeforeConnectContext as c, type CreateConnStateContext as d, type CreateContext as e, type CreateVarsContext as f, type DisconnectContext as g, type RunContext as h, type StateChangeContext as i, type WebSocketContext as j, ACTOR_CONTEXT_INTERNAL_SYMBOL as k, type ActionInputSchemas as l, type Actions as m, type ActorConfig as n, type ActorConfigInput as o, ActorConfigSchema as p, type ActorContext as q, type ActorContextOf as r, type ActorCron as s, type ActorCronEveryOptions as t, type ActorCronSetOptions as u, ActorDefinition as v, type ActorInspectorConfig as w, ActorInspectorConfigSchema as x, type ActorKey as y, type ActorKv as z };