rivetkit 3.0.1 → 3.0.2

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 (91) hide show
  1. package/dist/browser/client.d.ts +69 -7
  2. package/dist/browser/client.js +1 -1
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +1 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/{chunk-LXSYHJ7E.cjs → chunk-3C5KLO4V.cjs} +4 -4
  7. package/dist/tsup/{chunk-LXSYHJ7E.cjs.map → chunk-3C5KLO4V.cjs.map} +1 -1
  8. package/dist/tsup/{chunk-B3MXZSPO.cjs → chunk-3KVVYC5I.cjs} +144 -144
  9. package/dist/tsup/{chunk-B3MXZSPO.cjs.map → chunk-3KVVYC5I.cjs.map} +1 -1
  10. package/dist/tsup/{chunk-B5WDVY32.js → chunk-3RE23GTB.js} +2 -2
  11. package/dist/tsup/{chunk-B5WDVY32.js.map → chunk-3RE23GTB.js.map} +1 -1
  12. package/dist/tsup/{chunk-2JSFY7XD.js → chunk-47W6FHPJ.js} +2 -2
  13. package/dist/tsup/{chunk-57I7SSSV.js → chunk-4ASLJWUQ.js} +4 -4
  14. package/dist/tsup/{chunk-JOCSSMLU.js → chunk-ANP7UCAM.js} +6 -6
  15. package/dist/tsup/{chunk-NSQWB4QD.cjs → chunk-BBEH6RML.cjs} +3 -3
  16. package/dist/tsup/{chunk-NSQWB4QD.cjs.map → chunk-BBEH6RML.cjs.map} +1 -1
  17. package/dist/tsup/{chunk-HQ5JCCK6.cjs → chunk-DVXMOEFT.cjs} +7 -7
  18. package/dist/tsup/{chunk-HQ5JCCK6.cjs.map → chunk-DVXMOEFT.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-N7V3BQUB.cjs → chunk-FR5QOAYE.cjs} +10 -10
  20. package/dist/tsup/{chunk-N7V3BQUB.cjs.map → chunk-FR5QOAYE.cjs.map} +1 -1
  21. package/dist/tsup/{chunk-BOVQ3JQK.js → chunk-HJWK46Z5.js} +3 -3
  22. package/dist/tsup/{chunk-QX7DWU46.js → chunk-J7T52LN6.js} +2 -2
  23. package/dist/tsup/{chunk-3PFAODLE.cjs → chunk-KF7ETIFK.cjs} +3 -3
  24. package/dist/tsup/{chunk-3PFAODLE.cjs.map → chunk-KF7ETIFK.cjs.map} +1 -1
  25. package/dist/tsup/{chunk-QI7E2UH5.cjs → chunk-M3H37DUQ.cjs} +2 -2
  26. package/dist/tsup/{chunk-QI7E2UH5.cjs.map → chunk-M3H37DUQ.cjs.map} +1 -1
  27. package/dist/tsup/{chunk-4VEJIK7O.cjs → chunk-M7KPJSGO.cjs} +3 -3
  28. package/dist/tsup/{chunk-4VEJIK7O.cjs.map → chunk-M7KPJSGO.cjs.map} +1 -1
  29. package/dist/tsup/{chunk-7K6MC544.js → chunk-OF63EVJQ.js} +2 -2
  30. package/dist/tsup/{chunk-PLZVADML.js → chunk-ZAZAKYNQ.js} +2 -2
  31. package/dist/tsup/client/mod.cjs +5 -5
  32. package/dist/tsup/client/mod.d.cts +3 -3
  33. package/dist/tsup/client/mod.d.ts +3 -3
  34. package/dist/tsup/client/mod.js +4 -4
  35. package/dist/tsup/common/log.cjs +2 -2
  36. package/dist/tsup/common/log.js +1 -1
  37. package/dist/tsup/common/websocket.cjs +3 -3
  38. package/dist/tsup/common/websocket.js +2 -2
  39. package/dist/tsup/{config-XfKwGYxx.d.ts → config-BtUHYdoj.d.ts} +21 -1
  40. package/dist/tsup/{config-B2wlj9wx.d.ts → config-CBTr4IhE.d.cts} +50 -8
  41. package/dist/tsup/{config-B2wlj9wx.d.cts → config-CBTr4IhE.d.ts} +50 -8
  42. package/dist/tsup/{config-K9uOKlok.d.cts → config-H6pJy_J1.d.cts} +21 -1
  43. package/dist/tsup/{context-Bm7mA4E3.d.ts → context-DrDoMXSD.d.ts} +2 -2
  44. package/dist/tsup/{context-CPCM-xn6.d.cts → context-TWrKZjqf.d.cts} +2 -2
  45. package/dist/tsup/db/drizzle.cjs +2 -2
  46. package/dist/tsup/db/drizzle.d.cts +1 -1
  47. package/dist/tsup/db/drizzle.d.ts +1 -1
  48. package/dist/tsup/db/drizzle.js +1 -1
  49. package/dist/tsup/db/mod.cjs +3 -3
  50. package/dist/tsup/db/mod.d.cts +2 -2
  51. package/dist/tsup/db/mod.d.ts +2 -2
  52. package/dist/tsup/db/mod.js +2 -2
  53. package/dist/tsup/dynamic/mod.d.cts +2 -2
  54. package/dist/tsup/dynamic/mod.d.ts +2 -2
  55. package/dist/tsup/inspector/mod.cjs +5 -5
  56. package/dist/tsup/inspector/mod.js +4 -4
  57. package/dist/tsup/inspector/workflow.cjs +4 -4
  58. package/dist/tsup/inspector/workflow.js +3 -3
  59. package/dist/tsup/inspector-tab/mod.d.cts +3 -3
  60. package/dist/tsup/inspector-tab/mod.d.ts +3 -3
  61. package/dist/tsup/mod.cjs +212 -87
  62. package/dist/tsup/mod.cjs.map +1 -1
  63. package/dist/tsup/mod.d.cts +4 -4
  64. package/dist/tsup/mod.d.ts +4 -4
  65. package/dist/tsup/mod.js +131 -6
  66. package/dist/tsup/mod.js.map +1 -1
  67. package/dist/tsup/test/mod.cjs +6 -6
  68. package/dist/tsup/test/mod.d.cts +2 -2
  69. package/dist/tsup/test/mod.d.ts +2 -2
  70. package/dist/tsup/test/mod.js +4 -4
  71. package/dist/tsup/unstable/migrations.d.cts +1 -1
  72. package/dist/tsup/unstable/migrations.d.ts +1 -1
  73. package/dist/tsup/utils.cjs +2 -2
  74. package/dist/tsup/utils.js +1 -1
  75. package/dist/tsup/workflow/mod.cjs +7 -7
  76. package/dist/tsup/workflow/mod.d.cts +4 -4
  77. package/dist/tsup/workflow/mod.d.ts +4 -4
  78. package/dist/tsup/workflow/mod.js +4 -4
  79. package/package.json +9 -9
  80. package/src/common/database/config.ts +50 -7
  81. package/src/db/mod.ts +1 -0
  82. package/src/registry/index.ts +142 -1
  83. package/src/registry/napi-runtime.ts +15 -0
  84. package/src/registry/runtime.ts +6 -0
  85. /package/dist/tsup/{chunk-2JSFY7XD.js.map → chunk-47W6FHPJ.js.map} +0 -0
  86. /package/dist/tsup/{chunk-57I7SSSV.js.map → chunk-4ASLJWUQ.js.map} +0 -0
  87. /package/dist/tsup/{chunk-JOCSSMLU.js.map → chunk-ANP7UCAM.js.map} +0 -0
  88. /package/dist/tsup/{chunk-BOVQ3JQK.js.map → chunk-HJWK46Z5.js.map} +0 -0
  89. /package/dist/tsup/{chunk-QX7DWU46.js.map → chunk-J7T52LN6.js.map} +0 -0
  90. /package/dist/tsup/{chunk-7K6MC544.js.map → chunk-OF63EVJQ.js.map} +0 -0
  91. /package/dist/tsup/{chunk-PLZVADML.js.map → chunk-ZAZAKYNQ.js.map} +0 -0
@@ -1,12 +1,12 @@
1
- import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-K9uOKlok.cjs';
2
- export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw as test } from './config-K9uOKlok.cjs';
1
+ import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-H6pJy_J1.cjs';
2
+ export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw as test } from './config-H6pJy_J1.cjs';
3
3
  export { E as Encoding, t as toUint8Array } from './utils-C6b0aYUM.cjs';
4
4
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
5
5
  export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
6
- import { A as AnyDatabaseProvider } from './config-B2wlj9wx.cjs';
6
+ import { A as AnyDatabaseProvider } from './config-CBTr4IhE.cjs';
7
7
  export { R as ActorError, R as RivetError, a as RivetErrorLike, b as RivetErrorOptions, U as UserError, c as UserErrorOptions, n as noopNext } from './utils-3rsE0JvI.cjs';
8
8
  import { WSContext } from 'hono/ws';
9
- export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-CPCM-xn6.cjs';
9
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-TWrKZjqf.cjs';
10
10
  import 'zod/v4';
11
11
  import '@rivetkit/rivetkit-wasm';
12
12
  import 'zod';
@@ -1,12 +1,12 @@
1
- import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-XfKwGYxx.js';
2
- export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw as test } from './config-XfKwGYxx.js';
1
+ import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-BtUHYdoj.js';
2
+ export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorInspectorConfig, z as ActorInspectorConfigSchema, F as ActorKey, G as ActorKv, H as ActorLogger, I as ActorOptions, J as ActorOptionsInput, K as ActorOptionsSchema, L as ActorQuery, N as ActorQueue, O as ActorRun, P as ActorSchedule, T as ActorTracingOptions, U as ActorTypes, V as ActorsSchema, X as AnyActorInstance, Y as AnyClient, Z as AnyConn, _ as AnyStaticActorDefinition, $ as AnyStaticActorInstance, a0 as AuthIntent, a1 as BUILTIN_INSPECTOR_TAB_IDS, a2 as BaseActorInstance, a3 as BuiltinInspectorTabIdSchema, a4 as CONN_DRIVER_SYMBOL, a5 as CONN_STATE_MANAGER_SYMBOL, a6 as Client, a7 as Conn, a8 as CronFire, a9 as CronJobInfo, aa as CustomInspectorTabEntrySchema, ab as DEFAULT_SLEEP_GRACE_PERIOD, ac as DefineRunHandlerOptions, ad as DocActorConfigSchema, ae as DocActorOptionsSchema, af as DocConfigurePoolSchema, ag as DocEnvoyConfigSchema, ah as DocRegistryConfigSchema, ai as DocServerlessConfigSchema, aj as DocSqliteConfigSchema, ak as FetchHandler, al as GlobalActorOptions, am as GlobalActorOptionsInput, an as GlobalActorOptionsSchema, ao as HideInspectorTabEntrySchema, ap as InferEventArgs, aq as InferSchemaMap, ar as InspectorTabEntrySchema, as as InspectorUnsubscribe, at as InstanceActorOptions, au as InstanceActorOptionsInput, av as InstanceActorOptionsSchema, aw as QueueEnqueueAndWaitOptions, ax as QueueFilterName, ay as QueueIterOptions, az as QueueMessageOf, aA as QueueName, aB as QueueNextBatchOptions, aC as QueueNextOptions, aD as QueueResultMessageForName, aE as QueueTryNextBatchOptions, aF as QueueTryNextOptions, aG as QueueWaitOptions, aH as RAW_STATE_SYMBOL, aI as Registry, aJ as RegistryActors, aK as RegistryApplication, aL as RegistryConfig, aM as RegistryConfigInput, aN as RegistryConfigSchema, aO as RegistryDeps, aP as RegistryListenOptions, aQ as RegistryRoutes, aR as RunConfig, aS as RunConfigSchema, aT as RunControl, aU as RunInspectorConfig, aV as RunInspectorFactoryContext, aW as RunInspectorFactoryResult, aX as RunInspectorKind, aY as RunWithInactiveOptions, aZ as RuntimeKind, a_ as RuntimeKindSchema, a$ as ScheduledEventInfo, b0 as ScheduledFireInfo, b1 as ServerlessHandler, b2 as SqliteBackend, b3 as SqliteBackendSchema, b4 as SqliteConfig, b5 as SqliteConfigSchema, b6 as TestConfig, b7 as TestConfigSchema, b8 as Type, b9 as WasmRuntimeBindings, ba as WasmRuntimeConfig, bb as WasmRuntimeConfigSchema, bc as WasmRuntimeInitInput, bd as WorkflowInspectorConfig, be as WorkflowOutcome, bf as WorkflowSpan, bg as WorkflowStepOutcome, bh as WorkflowStepSpan, bi as actor, bj as buildActorNames, bk as createClientWithDriver, bl as defineRunHandler, bm as disposeRunInspector, bn as event, bo as getRunFunction, bp as getRunInspectorConfig, bq as getRunMetadata, br as isStaticActorDefinition, bs as isStaticActorInstance, bt as lookupInRegistry, bu as queue, bv as setup, bw as test } from './config-BtUHYdoj.js';
3
3
  export { E as Encoding, t as toUint8Array } from './utils-C1O-SklO.js';
4
4
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
5
5
  export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
6
- import { A as AnyDatabaseProvider } from './config-B2wlj9wx.js';
6
+ import { A as AnyDatabaseProvider } from './config-CBTr4IhE.js';
7
7
  export { R as ActorError, R as RivetError, a as RivetErrorLike, b as RivetErrorOptions, U as UserError, c as UserErrorOptions, n as noopNext } from './utils-3rsE0JvI.js';
8
8
  import { WSContext } from 'hono/ws';
9
- export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-Bm7mA4E3.js';
9
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-DrDoMXSD.js';
10
10
  import 'zod/v4';
11
11
  import '@rivetkit/rivetkit-wasm';
12
12
  import 'zod';
package/dist/tsup/mod.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  decodeWorkflowHistoryTransport
3
- } from "./chunk-QX7DWU46.js";
3
+ } from "./chunk-J7T52LN6.js";
4
4
  import {
5
5
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
6
6
  ActorConfigSchema,
@@ -35,18 +35,18 @@ import {
35
35
  runWithActorInvocationSpan,
36
36
  tryParseEndpoint,
37
37
  updateRunnerConfig
38
- } from "./chunk-JOCSSMLU.js";
38
+ } from "./chunk-ANP7UCAM.js";
39
39
  import {
40
40
  makePrefixedKey,
41
41
  removePrefixFromKey
42
42
  } from "./chunk-A2CF6PFH.js";
43
+ import "./chunk-ZAZAKYNQ.js";
43
44
  import {
44
45
  bindNativeStateTransactionContext,
45
46
  db,
46
47
  registerNativeStateTransactionOpener
47
- } from "./chunk-7K6MC544.js";
48
+ } from "./chunk-OF63EVJQ.js";
48
49
  import "./chunk-JTHHCZCZ.js";
49
- import "./chunk-PLZVADML.js";
50
50
  import {
51
51
  LogLevelSchema,
52
52
  VERSION,
@@ -80,7 +80,7 @@ import {
80
80
  parsePortEnv,
81
81
  stringifyError,
82
82
  toUint8Array
83
- } from "./chunk-B5WDVY32.js";
83
+ } from "./chunk-3RE23GTB.js";
84
84
  import {
85
85
  INTERNAL_ERROR_CODE,
86
86
  RivetError,
@@ -1599,6 +1599,15 @@ var NapiCoreRuntime = class {
1599
1599
  async registryActorStopThresholdMs(registry) {
1600
1600
  return await asNativeRegistry(registry).actorStopThresholdMs() ?? void 0;
1601
1601
  }
1602
+ registryActiveActorCount(registry) {
1603
+ return asNativeRegistry(registry).activeActorCount();
1604
+ }
1605
+ onRegistryActiveActorCountChange(registry, callback, cancelToken) {
1606
+ asNativeRegistry(registry).onActiveActorCountChange(
1607
+ callback,
1608
+ asNativeCancellationToken(cancelToken)
1609
+ );
1610
+ }
1602
1611
  async registryHealth(registry) {
1603
1612
  const response = await asNativeRegistry(registry).health();
1604
1613
  return {
@@ -7421,6 +7430,7 @@ async function buildConfiguredRegistry(config) {
7421
7430
  var REGISTRY_READY_TIMEOUT_MS = 3e4;
7422
7431
  var LOCAL_ENGINE_READY_TIMEOUT_MS = 6e4;
7423
7432
  var LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS = 4e3;
7433
+ var DEFAULT_ACTOR_STOP_THRESHOLD_MS = 3e4;
7424
7434
  function rejectServerless() {
7425
7435
  throw new Error("serverless is disabled in this version");
7426
7436
  }
@@ -7507,6 +7517,11 @@ var Registry = class {
7507
7517
  #shutdownInstalled = false;
7508
7518
  #shutdownInFlight = null;
7509
7519
  #signalHandlers = {};
7520
+ #envoyConfiguredRegistry;
7521
+ #activeActorCountListeners = /* @__PURE__ */ new Set();
7522
+ #activeActorCountToken;
7523
+ #lastActiveActorCount;
7524
+ #activeActorCountSupported;
7510
7525
  constructor(config, deps) {
7511
7526
  var _a;
7512
7527
  this.#config = config;
@@ -7921,6 +7936,21 @@ var Registry = class {
7921
7936
  }
7922
7937
  const configuredRegistryPromise = this.#buildConfiguredRegistry(config);
7923
7938
  this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
7939
+ configuredRegistryPromise.then(
7940
+ (configured) => {
7941
+ this.#envoyConfiguredRegistry = configured;
7942
+ try {
7943
+ this.#syncActiveActorCountSubscription();
7944
+ } catch (error) {
7945
+ logger2().error(
7946
+ { error },
7947
+ "failed to subscribe to the active actor count"
7948
+ );
7949
+ }
7950
+ },
7951
+ // The serve lifecycle below reports build failures.
7952
+ () => void 0
7953
+ );
7924
7954
  this.#runtimeServeLifecyclePromise = configuredRegistryPromise.then(
7925
7955
  async ({ runtime, registry, serveConfig }) => {
7926
7956
  await runtime.serveRegistry(registry, serveConfig);
@@ -8006,7 +8036,7 @@ var Registry = class {
8006
8036
  if (gracePeriodMs === void 0) {
8007
8037
  gracePeriodMs = localDevSignal ? LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS : await this.#actorStopThresholdMs(
8008
8038
  modeAPromise ?? modeBPromise
8009
- ) ?? 30 * 60 * 1e3;
8039
+ ) ?? DEFAULT_ACTOR_STOP_THRESHOLD_MS;
8010
8040
  }
8011
8041
  const drain = async () => {
8012
8042
  const registries = [];
@@ -8200,6 +8230,101 @@ var Registry = class {
8200
8230
  const config = this.parseConfig();
8201
8231
  this.#startEnvoy(config, true);
8202
8232
  }
8233
+ /**
8234
+ * Returns the number of actors hosted by this process's envoy, which is zero
8235
+ * while it is not serving. Requires the native runtime.
8236
+ */
8237
+ activeActorCount() {
8238
+ this.#assertActiveActorCountSupported("activeActorCount");
8239
+ const configured = this.#envoyConfiguredRegistry;
8240
+ if (!configured) return 0;
8241
+ const { runtime, registry } = configured;
8242
+ if (!runtime.registryActiveActorCount) {
8243
+ throw new Error(
8244
+ "registry.activeActorCount() is not supported by this runtime"
8245
+ );
8246
+ }
8247
+ return runtime.registryActiveActorCount(registry);
8248
+ }
8249
+ /**
8250
+ * Calls `callback` with the number of actors hosted by this process's envoy
8251
+ * and again whenever it changes. Rapid changes may coalesce.
8252
+ * Returns a function that unsubscribes. Requires the native runtime.
8253
+ *
8254
+ * @example
8255
+ * ```ts
8256
+ * const unsubscribe = registry.onActiveActorCountChange((count) => {
8257
+ * setTaskProtection(count > 0);
8258
+ * });
8259
+ * ```
8260
+ */
8261
+ onActiveActorCountChange(callback) {
8262
+ this.#assertActiveActorCountSupported("onActiveActorCountChange");
8263
+ const listener = (count) => callback(count);
8264
+ this.#activeActorCountListeners.add(listener);
8265
+ this.#syncActiveActorCountSubscription();
8266
+ const lastCount = this.#lastActiveActorCount;
8267
+ if (lastCount !== void 0) {
8268
+ queueMicrotask(() => {
8269
+ if (this.#activeActorCountListeners.has(listener)) {
8270
+ this.#deliverActiveActorCount(listener, lastCount);
8271
+ }
8272
+ });
8273
+ }
8274
+ return () => {
8275
+ this.#activeActorCountListeners.delete(listener);
8276
+ this.#syncActiveActorCountSubscription();
8277
+ };
8278
+ }
8279
+ #assertActiveActorCountSupported(method2) {
8280
+ this.#activeActorCountSupported ??= this.parseConfig().runtime !== "wasm";
8281
+ if (!this.#activeActorCountSupported) {
8282
+ throw new Error(
8283
+ `registry.${method2}() requires the native runtime; WebAssembly registries do not host an envoy`
8284
+ );
8285
+ }
8286
+ }
8287
+ /** Holds one native subscription while any listener is registered. */
8288
+ #syncActiveActorCountSubscription() {
8289
+ const configured = this.#envoyConfiguredRegistry;
8290
+ if (!configured) return;
8291
+ const { runtime, registry } = configured;
8292
+ const token = this.#activeActorCountToken;
8293
+ if (this.#activeActorCountListeners.size === 0) {
8294
+ if (token !== void 0) {
8295
+ this.#activeActorCountToken = void 0;
8296
+ this.#lastActiveActorCount = void 0;
8297
+ runtime.cancelCancellationToken(token);
8298
+ }
8299
+ return;
8300
+ }
8301
+ if (token !== void 0) return;
8302
+ if (!runtime.onRegistryActiveActorCountChange) {
8303
+ throw new Error(
8304
+ "active actor count subscriptions are not supported by this runtime"
8305
+ );
8306
+ }
8307
+ const nextToken = runtime.createCancellationToken();
8308
+ this.#activeActorCountToken = nextToken;
8309
+ runtime.onRegistryActiveActorCountChange(
8310
+ registry,
8311
+ (count) => {
8312
+ if (this.#activeActorCountToken !== nextToken) return;
8313
+ this.#lastActiveActorCount = count;
8314
+ for (const listener of [...this.#activeActorCountListeners]) {
8315
+ this.#deliverActiveActorCount(listener, count);
8316
+ }
8317
+ },
8318
+ nextToken
8319
+ );
8320
+ }
8321
+ #deliverActiveActorCount(listener, count) {
8322
+ try {
8323
+ listener(count);
8324
+ } catch (error) {
8325
+ logger2().error({ error }, "active actor count listener threw");
8326
+ }
8327
+ }
8203
8328
  #printWelcome(config, kind, listener) {
8204
8329
  if (config.noWelcome || this.#welcomePrinted) return;
8205
8330
  this.#welcomePrinted = true;