rivetkit 3.1.2-rc.8 → 3.1.2-rc.9

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 (82) hide show
  1. package/dist/browser/client.d.ts +4 -0
  2. package/dist/browser/client.js +63 -25
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +2 -2
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/{chunk-T2RO34S7.js → chunk-24OLPBXH.js} +31 -11
  7. package/dist/tsup/chunk-24OLPBXH.js.map +1 -0
  8. package/dist/tsup/{chunk-SOIAEURF.cjs → chunk-6BCM5FXB.cjs} +10 -10
  9. package/dist/tsup/{chunk-SOIAEURF.cjs.map → chunk-6BCM5FXB.cjs.map} +1 -1
  10. package/dist/tsup/{chunk-YDRBLWMD.js → chunk-7TW4LSJN.js} +2 -2
  11. package/dist/tsup/{chunk-KYDMRRA4.cjs → chunk-7YVW2AZO.cjs} +3 -3
  12. package/dist/tsup/{chunk-KYDMRRA4.cjs.map → chunk-7YVW2AZO.cjs.map} +1 -1
  13. package/dist/tsup/{chunk-M2FXWR5I.js → chunk-BAPWFPDP.js} +2 -2
  14. package/dist/tsup/{chunk-JSP6RLEU.js → chunk-C4QGTZEW.js} +3 -3
  15. package/dist/tsup/{chunk-DM2JKQKQ.cjs → chunk-DO4K3PV4.cjs} +7 -7
  16. package/dist/tsup/{chunk-DM2JKQKQ.cjs.map → chunk-DO4K3PV4.cjs.map} +1 -1
  17. package/dist/tsup/{chunk-RS5KRWTM.cjs → chunk-DWQV2G7C.cjs} +3 -3
  18. package/dist/tsup/{chunk-RS5KRWTM.cjs.map → chunk-DWQV2G7C.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-ADVIQW7J.js → chunk-F4IRT46P.js} +2 -2
  20. package/dist/tsup/{chunk-O64KQZAU.cjs → chunk-HM7C4VY6.cjs} +173 -153
  21. package/dist/tsup/chunk-HM7C4VY6.cjs.map +1 -0
  22. package/dist/tsup/{chunk-ZL5APMH7.js → chunk-KQLEFYNT.js} +36 -18
  23. package/dist/tsup/chunk-KQLEFYNT.js.map +1 -0
  24. package/dist/tsup/{chunk-6SLO54JF.cjs → chunk-NBYWKPR6.cjs} +4 -4
  25. package/dist/tsup/{chunk-6SLO54JF.cjs.map → chunk-NBYWKPR6.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-J2X7GXHN.cjs → chunk-SYTAFLV7.cjs} +3 -3
  27. package/dist/tsup/{chunk-J2X7GXHN.cjs.map → chunk-SYTAFLV7.cjs.map} +1 -1
  28. package/dist/tsup/{chunk-YJIZRXZO.js → chunk-U7RFRYY2.js} +2 -2
  29. package/dist/tsup/{chunk-XIXHH2FF.cjs → chunk-V7ISUWSD.cjs} +36 -18
  30. package/dist/tsup/chunk-V7ISUWSD.cjs.map +1 -0
  31. package/dist/tsup/{chunk-7LLORXOJ.js → chunk-VYXFJR7Y.js} +4 -4
  32. package/dist/tsup/client/mod.cjs +5 -5
  33. package/dist/tsup/client/mod.d.cts +2 -2
  34. package/dist/tsup/client/mod.d.ts +2 -2
  35. package/dist/tsup/client/mod.js +4 -4
  36. package/dist/tsup/common/log.cjs +2 -2
  37. package/dist/tsup/common/log.js +1 -1
  38. package/dist/tsup/common/websocket.cjs +3 -3
  39. package/dist/tsup/common/websocket.js +2 -2
  40. package/dist/tsup/{config-CyOAiV6S.d.cts → config-B1L9Ytm_.d.cts} +4 -0
  41. package/dist/tsup/{config-TS1eu7w9.d.ts → config-DhGSJx-3.d.ts} +4 -0
  42. package/dist/tsup/{context-CxYw0sLz.d.ts → context-B6HOPYyk.d.ts} +1 -1
  43. package/dist/tsup/{context-Cq5UEIVG.d.cts → context-BuQ4FncM.d.cts} +1 -1
  44. package/dist/tsup/db/drizzle.cjs +2 -2
  45. package/dist/tsup/db/drizzle.js +1 -1
  46. package/dist/tsup/db/mod.cjs +3 -3
  47. package/dist/tsup/db/mod.js +2 -2
  48. package/dist/tsup/dynamic/mod.d.cts +1 -1
  49. package/dist/tsup/dynamic/mod.d.ts +1 -1
  50. package/dist/tsup/inspector/mod.cjs +5 -5
  51. package/dist/tsup/inspector/mod.js +4 -4
  52. package/dist/tsup/inspector/workflow.cjs +4 -4
  53. package/dist/tsup/inspector/workflow.js +3 -3
  54. package/dist/tsup/inspector-tab/mod.d.cts +2 -2
  55. package/dist/tsup/inspector-tab/mod.d.ts +2 -2
  56. package/dist/tsup/mod.cjs +86 -86
  57. package/dist/tsup/mod.d.cts +3 -3
  58. package/dist/tsup/mod.d.ts +3 -3
  59. package/dist/tsup/mod.js +5 -5
  60. package/dist/tsup/test/mod.cjs +6 -6
  61. package/dist/tsup/test/mod.d.cts +1 -1
  62. package/dist/tsup/test/mod.d.ts +1 -1
  63. package/dist/tsup/test/mod.js +4 -4
  64. package/dist/tsup/utils.cjs +2 -2
  65. package/dist/tsup/utils.js +1 -1
  66. package/dist/tsup/workflow/mod.cjs +7 -7
  67. package/dist/tsup/workflow/mod.d.cts +3 -3
  68. package/dist/tsup/workflow/mod.d.ts +3 -3
  69. package/dist/tsup/workflow/mod.js +4 -4
  70. package/package.json +10 -10
  71. package/src/client/actor-conn.ts +33 -9
  72. package/src/common/encoding.ts +45 -15
  73. package/dist/tsup/chunk-O64KQZAU.cjs.map +0 -1
  74. package/dist/tsup/chunk-T2RO34S7.js.map +0 -1
  75. package/dist/tsup/chunk-XIXHH2FF.cjs.map +0 -1
  76. package/dist/tsup/chunk-ZL5APMH7.js.map +0 -1
  77. /package/dist/tsup/{chunk-YDRBLWMD.js.map → chunk-7TW4LSJN.js.map} +0 -0
  78. /package/dist/tsup/{chunk-M2FXWR5I.js.map → chunk-BAPWFPDP.js.map} +0 -0
  79. /package/dist/tsup/{chunk-JSP6RLEU.js.map → chunk-C4QGTZEW.js.map} +0 -0
  80. /package/dist/tsup/{chunk-ADVIQW7J.js.map → chunk-F4IRT46P.js.map} +0 -0
  81. /package/dist/tsup/{chunk-YJIZRXZO.js.map → chunk-U7RFRYY2.js.map} +0 -0
  82. /package/dist/tsup/{chunk-7LLORXOJ.js.map → chunk-VYXFJR7Y.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-CyOAiV6S.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 ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-CyOAiV6S.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-B1L9Ytm_.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 ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-B1L9Ytm_.cjs';
3
3
  export { E as Encoding, t as toUint8Array } from './utils-BctYATXG.cjs';
4
4
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
5
5
  export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
6
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-Cq5UEIVG.cjs';
9
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-BuQ4FncM.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-TS1eu7w9.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 ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-TS1eu7w9.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-DhGSJx-3.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 ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-DhGSJx-3.js';
3
3
  export { E as Encoding, t as toUint8Array } from './utils-CR1Y49t6.js';
4
4
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
5
5
  export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
6
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-CxYw0sLz.js';
9
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-B6HOPYyk.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-YDRBLWMD.js";
3
+ } from "./chunk-7TW4LSJN.js";
4
4
  import {
5
5
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
6
6
  ActorConfigSchema,
@@ -35,17 +35,17 @@ import {
35
35
  runWithActorInvocationSpan,
36
36
  tryParseEndpoint,
37
37
  updateRunnerConfig
38
- } from "./chunk-T2RO34S7.js";
38
+ } from "./chunk-24OLPBXH.js";
39
39
  import {
40
40
  makePrefixedKey,
41
41
  removePrefixFromKey
42
42
  } from "./chunk-A2CF6PFH.js";
43
- import "./chunk-M2FXWR5I.js";
43
+ import "./chunk-BAPWFPDP.js";
44
44
  import {
45
45
  bindNativeStateTransactionContext,
46
46
  db,
47
47
  registerNativeStateTransactionOpener
48
- } from "./chunk-YJIZRXZO.js";
48
+ } from "./chunk-U7RFRYY2.js";
49
49
  import "./chunk-JTHHCZCZ.js";
50
50
  import {
51
51
  LogLevelSchema,
@@ -80,7 +80,7 @@ import {
80
80
  parsePortEnv,
81
81
  stringifyError,
82
82
  toUint8Array
83
- } from "./chunk-ZL5APMH7.js";
83
+ } from "./chunk-KQLEFYNT.js";
84
84
  import {
85
85
  INTERNAL_ERROR_CODE,
86
86
  RivetError,
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkDM2JKQKQcjs = require('../chunk-DM2JKQKQ.cjs');
3
+ var _chunkDO4K3PV4cjs = require('../chunk-DO4K3PV4.cjs');
4
4
 
5
5
 
6
- var _chunkO64KQZAUcjs = require('../chunk-O64KQZAU.cjs');
6
+ var _chunkHM7C4VY6cjs = require('../chunk-HM7C4VY6.cjs');
7
7
  require('../chunk-RTWH3AX3.cjs');
8
- require('../chunk-RS5KRWTM.cjs');
8
+ require('../chunk-DWQV2G7C.cjs');
9
9
  require('../chunk-KVFIONKQ.cjs');
10
- require('../chunk-XIXHH2FF.cjs');
10
+ require('../chunk-V7ISUWSD.cjs');
11
11
  require('../chunk-MGI2VVF6.cjs');
12
12
 
13
13
  // src/test/ready.ts
@@ -36,8 +36,8 @@ async function setupTest(c, registry) {
36
36
  registry.config.noWelcome = true;
37
37
  registry.start();
38
38
  await waitForRegistryReady(registry);
39
- const client = _chunkDM2JKQKQcjs.createClient.call(void 0, {
40
- ..._chunkO64KQZAUcjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
39
+ const client = _chunkDO4K3PV4cjs.createClient.call(void 0, {
40
+ ..._chunkHM7C4VY6cjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
41
41
  disableMetadataLookup: false
42
42
  });
43
43
  c.onTestFinished(async () => {
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { aK as Registry, a8 as Client } from '../config-CyOAiV6S.cjs';
2
+ import { aK as Registry, a8 as Client } from '../config-B1L9Ytm_.cjs';
3
3
  import 'zod/v4';
4
4
  import '../config-CBTr4IhE.cjs';
5
5
  import '@rivetkit/rivetkit-wasm';
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { aK as Registry, a8 as Client } from '../config-TS1eu7w9.js';
2
+ import { aK as Registry, a8 as Client } from '../config-DhGSJx-3.js';
3
3
  import 'zod/v4';
4
4
  import '../config-CBTr4IhE.js';
5
5
  import '@rivetkit/rivetkit-wasm';
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createClient
3
- } from "../chunk-JSP6RLEU.js";
3
+ } from "../chunk-C4QGTZEW.js";
4
4
  import {
5
5
  convertRegistryConfigToClientConfig
6
- } from "../chunk-T2RO34S7.js";
6
+ } from "../chunk-24OLPBXH.js";
7
7
  import "../chunk-A2CF6PFH.js";
8
- import "../chunk-M2FXWR5I.js";
8
+ import "../chunk-BAPWFPDP.js";
9
9
  import "../chunk-JTHHCZCZ.js";
10
- import "../chunk-ZL5APMH7.js";
10
+ import "../chunk-KQLEFYNT.js";
11
11
  import "../chunk-ZOVJDAOW.js";
12
12
 
13
13
  // src/test/ready.ts
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkXIXHH2FFcjs = require('./chunk-XIXHH2FF.cjs');
22
+ var _chunkV7ISUWSDcjs = require('./chunk-V7ISUWSD.cjs');
23
23
  require('./chunk-MGI2VVF6.cjs');
24
24
 
25
25
 
@@ -42,5 +42,5 @@ require('./chunk-MGI2VVF6.cjs');
42
42
 
43
43
 
44
44
 
45
- exports.EXTRA_ERROR_LOG = _chunkXIXHH2FFcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkXIXHH2FFcjs.SinglePromiseQueue; exports.VERSION = _chunkXIXHH2FFcjs.VERSION; exports.arrayBuffersEqual = _chunkXIXHH2FFcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkXIXHH2FFcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkXIXHH2FFcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkXIXHH2FFcjs.combineUrlPath; exports.dbg = _chunkXIXHH2FFcjs.dbg; exports.detectRuntime = _chunkXIXHH2FFcjs.detectRuntime; exports.getEnvUniversal = _chunkXIXHH2FFcjs.getEnvUniversal; exports.httpUserAgent = _chunkXIXHH2FFcjs.httpUserAgent; exports.interval = _chunkXIXHH2FFcjs.interval; exports.joinSignals = _chunkXIXHH2FFcjs.joinSignals; exports.jsonParseCompat = _chunkXIXHH2FFcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkXIXHH2FFcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkXIXHH2FFcjs.promiseWithResolvers; exports.setLongTimeout = _chunkXIXHH2FFcjs.setLongTimeout; exports.sleep = _chunkXIXHH2FFcjs.sleep; exports.stringifyError = _chunkXIXHH2FFcjs.stringifyError; exports.toUint8Array = _chunkXIXHH2FFcjs.toUint8Array;
45
+ exports.EXTRA_ERROR_LOG = _chunkV7ISUWSDcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkV7ISUWSDcjs.SinglePromiseQueue; exports.VERSION = _chunkV7ISUWSDcjs.VERSION; exports.arrayBuffersEqual = _chunkV7ISUWSDcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkV7ISUWSDcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkV7ISUWSDcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkV7ISUWSDcjs.combineUrlPath; exports.dbg = _chunkV7ISUWSDcjs.dbg; exports.detectRuntime = _chunkV7ISUWSDcjs.detectRuntime; exports.getEnvUniversal = _chunkV7ISUWSDcjs.getEnvUniversal; exports.httpUserAgent = _chunkV7ISUWSDcjs.httpUserAgent; exports.interval = _chunkV7ISUWSDcjs.interval; exports.joinSignals = _chunkV7ISUWSDcjs.joinSignals; exports.jsonParseCompat = _chunkV7ISUWSDcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkV7ISUWSDcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkV7ISUWSDcjs.promiseWithResolvers; exports.setLongTimeout = _chunkV7ISUWSDcjs.setLongTimeout; exports.sleep = _chunkV7ISUWSDcjs.sleep; exports.stringifyError = _chunkV7ISUWSDcjs.stringifyError; exports.toUint8Array = _chunkV7ISUWSDcjs.toUint8Array;
46
46
  //# sourceMappingURL=utils.cjs.map
@@ -19,7 +19,7 @@ import {
19
19
  sleep,
20
20
  stringifyError,
21
21
  toUint8Array
22
- } from "./chunk-ZL5APMH7.js";
22
+ } from "./chunk-KQLEFYNT.js";
23
23
  import "./chunk-ZOVJDAOW.js";
24
24
  export {
25
25
  EXTRA_ERROR_LOG,
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2;
2
2
 
3
- var _chunkSOIAEURFcjs = require('../chunk-SOIAEURF.cjs');
4
- require('../chunk-KYDMRRA4.cjs');
5
- require('../chunk-6SLO54JF.cjs');
3
+ var _chunk6BCM5FXBcjs = require('../chunk-6BCM5FXB.cjs');
4
+ require('../chunk-7YVW2AZO.cjs');
5
+ require('../chunk-NBYWKPR6.cjs');
6
6
 
7
7
 
8
8
 
@@ -13,7 +13,7 @@ var _chunkAQJFKHBKcjs = require('../chunk-AQJFKHBK.cjs');
13
13
  var _chunkRTWH3AX3cjs = require('../chunk-RTWH3AX3.cjs');
14
14
 
15
15
 
16
- var _chunkXIXHH2FFcjs = require('../chunk-XIXHH2FF.cjs');
16
+ var _chunkV7ISUWSDcjs = require('../chunk-V7ISUWSD.cjs');
17
17
 
18
18
 
19
19
 
@@ -769,7 +769,7 @@ function workflow(fn, options = {}) {
769
769
  function getWorkflowInspector(actorId) {
770
770
  let workflowInspector = workflowInspectors.get(actorId);
771
771
  if (!workflowInspector) {
772
- workflowInspector = _chunkSOIAEURFcjs.createWorkflowInspectorAdapter.call(void 0, );
772
+ workflowInspector = _chunk6BCM5FXBcjs.createWorkflowInspectorAdapter.call(void 0, );
773
773
  workflowInspectors.set(actorId, workflowInspector);
774
774
  }
775
775
  return workflowInspector;
@@ -842,13 +842,13 @@ function workflow(fn, options = {}) {
842
842
  if (shouldRethrowWorkflowError(error)) {
843
843
  runCtx.log.error({
844
844
  msg: "workflow run failed",
845
- error: _chunkXIXHH2FFcjs.stringifyError.call(void 0, error)
845
+ error: _chunkV7ISUWSDcjs.stringifyError.call(void 0, error)
846
846
  });
847
847
  throw error;
848
848
  }
849
849
  runCtx.log.warn({
850
850
  msg: "workflow failed and will sleep until woken",
851
- error: _chunkXIXHH2FFcjs.stringifyError.call(void 0, error)
851
+ error: _chunkV7ISUWSDcjs.stringifyError.call(void 0, error)
852
852
  });
853
853
  } finally {
854
854
  runCtx.abortSignal.removeEventListener("abort", onAbort);
@@ -1,9 +1,9 @@
1
1
  import { WorkflowErrorEvent } from '@rivetkit/workflow-engine';
2
2
  export { Loop, TryBlockCatchKind, TryBlockConfig, TryBlockFailure, TryBlockResult, TryStepCatchKind, TryStepConfig, TryStepFailure, TryStepResult, WorkflowError, WorkflowErrorEvent } from '@rivetkit/workflow-engine';
3
- import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-CyOAiV6S.cjs';
3
+ import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-B1L9Ytm_.cjs';
4
4
  import { A as AnyDatabaseProvider } from '../config-CBTr4IhE.cjs';
5
- import { d as WorkflowContext } from '../context-Cq5UEIVG.cjs';
6
- export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-Cq5UEIVG.cjs';
5
+ import { d as WorkflowContext } from '../context-BuQ4FncM.cjs';
6
+ export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-BuQ4FncM.cjs';
7
7
  import 'zod/v4';
8
8
  import '@rivetkit/rivetkit-wasm';
9
9
  import 'zod';
@@ -1,9 +1,9 @@
1
1
  import { WorkflowErrorEvent } from '@rivetkit/workflow-engine';
2
2
  export { Loop, TryBlockCatchKind, TryBlockConfig, TryBlockFailure, TryBlockResult, TryStepCatchKind, TryStepConfig, TryStepFailure, TryStepResult, WorkflowError, WorkflowErrorEvent } from '@rivetkit/workflow-engine';
3
- import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-TS1eu7w9.js';
3
+ import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-DhGSJx-3.js';
4
4
  import { A as AnyDatabaseProvider } from '../config-CBTr4IhE.js';
5
- import { d as WorkflowContext } from '../context-CxYw0sLz.js';
6
- export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-CxYw0sLz.js';
5
+ import { d as WorkflowContext } from '../context-B6HOPYyk.js';
6
+ export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-B6HOPYyk.js';
7
7
  import 'zod/v4';
8
8
  import '@rivetkit/rivetkit-wasm';
9
9
  import 'zod';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createWorkflowInspectorAdapter
3
- } from "../chunk-7LLORXOJ.js";
4
- import "../chunk-ADVIQW7J.js";
5
- import "../chunk-YDRBLWMD.js";
3
+ } from "../chunk-VYXFJR7Y.js";
4
+ import "../chunk-F4IRT46P.js";
5
+ import "../chunk-7TW4LSJN.js";
6
6
  import {
7
7
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
8
8
  defineRunHandler
@@ -13,7 +13,7 @@ import {
13
13
  } from "../chunk-A2CF6PFH.js";
14
14
  import {
15
15
  stringifyError
16
- } from "../chunk-ZL5APMH7.js";
16
+ } from "../chunk-KQLEFYNT.js";
17
17
  import {
18
18
  RivetError,
19
19
  isActorAbortedError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivetkit",
3
- "version": "3.1.2-rc.8",
3
+ "version": "3.1.2-rc.9",
4
4
  "description": "Lightweight libraries for building stateful actors on edge platforms",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -211,16 +211,16 @@
211
211
  "@hono/zod-openapi": "^1.1.5",
212
212
  "@opentelemetry/api": "^1.1.0",
213
213
  "@rivetkit/bare-ts": "^0.6.2",
214
- "@rivetkit/engine-api-full": "3.1.2-rc.8",
215
- "@rivetkit/engine-cli": "3.1.2-rc.8",
216
- "@rivetkit/engine-envoy-protocol": "3.1.2-rc.8",
214
+ "@rivetkit/engine-api-full": "3.1.2-rc.9",
215
+ "@rivetkit/engine-cli": "3.1.2-rc.9",
216
+ "@rivetkit/engine-envoy-protocol": "3.1.2-rc.9",
217
217
  "@rivetkit/on-change": "6.0.1",
218
- "@rivetkit/rivetkit-napi": "3.1.2-rc.8",
219
- "@rivetkit/rivetkit-wasm": "3.1.2-rc.8",
220
- "@rivetkit/traces": "3.1.2-rc.8",
221
- "@rivetkit/virtual-websocket": "3.1.2-rc.8",
222
- "@rivetkit/workflow-engine": "3.1.2-rc.8",
223
- "cbor-x": "^1.6.0",
218
+ "@rivetkit/rivetkit-napi": "3.1.2-rc.9",
219
+ "@rivetkit/rivetkit-wasm": "3.1.2-rc.9",
220
+ "@rivetkit/traces": "3.1.2-rc.9",
221
+ "@rivetkit/virtual-websocket": "3.1.2-rc.9",
222
+ "@rivetkit/workflow-engine": "3.1.2-rc.9",
223
+ "cbor-x": "^1.6.6",
224
224
  "drizzle-orm": "0.45.2",
225
225
  "hono": "^4.7.0",
226
226
  "invariant": "^2.2.4",
@@ -345,6 +345,10 @@ export class ActorConnRaw {
345
345
  /**
346
346
  * Call a raw action connection. See {@link ActorConn} for type-safe action calls.
347
347
  *
348
+ * Aborting `signal` rejects the call with `signal.reason`. An action still queued while the
349
+ * connection opens or reconnects is dropped and never sent. An action already sent may
350
+ * still run on the actor.
351
+ *
348
352
  * @see {@link ActorConn}
349
353
  * @template Args - The type of arguments to pass to the action function.
350
354
  * @template Response - The type of the response returned by the action function.
@@ -370,6 +374,8 @@ export class ActorConnRaw {
370
374
  `Invalid action call: expected an options object { name, args }, got ${typeof opts}. Use conn.actionName(...args) for the shorthand API.`,
371
375
  );
372
376
  }
377
+ const signal = opts.signal;
378
+ if (signal?.aborted) throw signal.reason;
373
379
  if (this.#disposed) throw new errors.ActorConnDisposed();
374
380
  if (this.#connectionOpenError) throw this.#connectionOpenError;
375
381
  logger().debug({ msg: "action", name: opts.name, args: opts.args });
@@ -394,26 +400,44 @@ export class ActorConnRaw {
394
400
  inFlightCount: this.#actionsInFlight.size,
395
401
  });
396
402
 
397
- this.#sendMessage({
403
+ const message = {
398
404
  body: {
399
- tag: "ActionRequest",
405
+ tag: "ActionRequest" as const,
400
406
  val: {
401
407
  id: BigInt(actionId),
402
408
  name: opts.name,
403
409
  args: opts.args,
404
410
  },
405
411
  },
406
- });
412
+ };
413
+ this.#sendMessage(message);
414
+
415
+ // The actor never sees a queued action, so an abort drops it from the queue. Once the
416
+ // action is sent, an abort only rejects the caller. The actor may still run it, and its
417
+ // late reply settles nothing.
418
+ const onAbort = () => {
419
+ const queuedIndex = this.#messageQueue.indexOf(message);
420
+ if (queuedIndex !== -1) {
421
+ this.#messageQueue.splice(queuedIndex, 1);
422
+ this.#actionsInFlight.delete(actionId);
423
+ }
424
+ reject(signal?.reason);
425
+ };
426
+ signal?.addEventListener("abort", onAbort, { once: true });
407
427
 
408
428
  // TODO: Throw error if disconnect is called
409
429
 
410
- const { id: responseId, output } = await promise;
411
- if (responseId !== BigInt(actionId))
412
- throw new Error(
413
- `Request ID ${actionId} does not match response ID ${responseId}`,
414
- );
430
+ try {
431
+ const { id: responseId, output } = await promise;
432
+ if (responseId !== BigInt(actionId))
433
+ throw new Error(
434
+ `Request ID ${actionId} does not match response ID ${responseId}`,
435
+ );
415
436
 
416
- return output as Response;
437
+ return output as Response;
438
+ } finally {
439
+ signal?.removeEventListener("abort", onAbort);
440
+ }
417
441
  }
418
442
 
419
443
  /**
@@ -377,6 +377,21 @@ export interface JsonCompatReviveOptions {
377
377
  export function reviveJsonCompatValue(
378
378
  input: any,
379
379
  options: JsonCompatReviveOptions = {},
380
+ ): any {
381
+ return reviveValue(input, options, new WeakMap());
382
+ }
383
+
384
+ /**
385
+ * `revived` maps each object already walked to its revived value. Decoded CBOR
386
+ * can use one object in many places through cbor-x shared references, and
387
+ * walking it once per place grows exponentially with nesting. Containers are
388
+ * recorded before their children are walked, so cyclic input revives to a
389
+ * cyclic value instead of recursing forever.
390
+ */
391
+ function reviveValue(
392
+ input: any,
393
+ options: JsonCompatReviveOptions,
394
+ revived: WeakMap<object, unknown>,
380
395
  ): any {
381
396
  if (typeof input === "bigint") {
382
397
  if (
@@ -388,15 +403,22 @@ export function reviveJsonCompatValue(
388
403
  }
389
404
  return input;
390
405
  }
406
+ if (typeof input !== "object" || input === null) {
407
+ return input;
408
+ }
409
+ if (revived.has(input)) {
410
+ return revived.get(input);
411
+ }
391
412
  if (input instanceof Map) {
392
- const revived = new Map();
413
+ const map = new Map();
414
+ revived.set(input, map);
393
415
  for (const [k, v] of input.entries()) {
394
- revived.set(
395
- reviveJsonCompatValue(k, options),
396
- reviveJsonCompatValue(v, options),
416
+ map.set(
417
+ reviveValue(k, options, revived),
418
+ reviveValue(v, options, revived),
397
419
  );
398
420
  }
399
- return revived;
421
+ return map;
400
422
  }
401
423
  if (Array.isArray(input)) {
402
424
  if (
@@ -417,27 +439,35 @@ export function reviveJsonCompatValue(
417
439
  return undefined;
418
440
  }
419
441
  if (input[0] === JSON_COMPAT_SET) {
420
- const items = (input[1] as unknown[]).map((v) =>
421
- reviveJsonCompatValue(v, options),
422
- );
423
- return new Set(items);
442
+ const set = new Set();
443
+ revived.set(input, set);
444
+ for (const value of input[1] as unknown[]) {
445
+ set.add(reviveValue(value, options, revived));
446
+ }
447
+ return set;
424
448
  }
425
449
  if (input[0].startsWith("$$")) {
426
- return [
427
- input[0].substring(1),
428
- reviveJsonCompatValue(input[1], options),
429
- ];
450
+ const escaped: unknown[] = [input[0].substring(1)];
451
+ revived.set(input, escaped);
452
+ escaped.push(reviveValue(input[1], options, revived));
453
+ return escaped;
430
454
  }
431
455
  throw new Error(
432
456
  `Unknown JSON encoding type: ${input[0]}. This may indicate corrupted data or a version mismatch.`,
433
457
  );
434
458
  }
435
- return input.map((value) => reviveJsonCompatValue(value, options));
459
+ const array: unknown[] = [];
460
+ revived.set(input, array);
461
+ for (const value of input) {
462
+ array.push(reviveValue(value, options, revived));
463
+ }
464
+ return array;
436
465
  }
437
466
  if (isPlainObject(input)) {
438
467
  const decoded: Record<string, unknown> = {};
468
+ revived.set(input, decoded);
439
469
  for (const [key, value] of Object.entries(input)) {
440
- decoded[key] = reviveJsonCompatValue(value, options);
470
+ decoded[key] = reviveValue(value, options, revived);
441
471
  }
442
472
  return decoded;
443
473
  }