rivetkit 3.0.7 → 3.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/browser/client.d.ts +112 -2
  2. package/dist/browser/client.js +145 -7
  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-AY25XAXA.js → chunk-5NNDJCH7.js} +3 -3
  7. package/dist/tsup/{chunk-AY25XAXA.js.map → chunk-5NNDJCH7.js.map} +1 -1
  8. package/dist/tsup/{chunk-U3CMQVMS.cjs → chunk-6LQ23TJA.cjs} +3 -3
  9. package/dist/tsup/{chunk-U3CMQVMS.cjs.map → chunk-6LQ23TJA.cjs.map} +1 -1
  10. package/dist/tsup/{chunk-YMCG4FCB.js → chunk-76FFOINJ.js} +149 -12
  11. package/dist/tsup/chunk-76FFOINJ.js.map +1 -0
  12. package/dist/tsup/{chunk-YO4TJ56P.js → chunk-CRC7NMU3.js} +2 -2
  13. package/dist/tsup/{chunk-NMLZDHH2.js → chunk-ECLJJGV6.js} +2 -2
  14. package/dist/tsup/{chunk-YTELGNB3.cjs → chunk-I3YW5B3I.cjs} +7 -7
  15. package/dist/tsup/{chunk-YTELGNB3.cjs.map → chunk-I3YW5B3I.cjs.map} +1 -1
  16. package/dist/tsup/{chunk-OEOODXVI.cjs → chunk-K6O7IE7P.cjs} +4 -4
  17. package/dist/tsup/{chunk-OEOODXVI.cjs.map → chunk-K6O7IE7P.cjs.map} +1 -1
  18. package/dist/tsup/{chunk-WBUHPDDM.cjs → chunk-MT3ZLU7U.cjs} +2 -2
  19. package/dist/tsup/chunk-MT3ZLU7U.cjs.map +1 -0
  20. package/dist/tsup/{chunk-HKD7AH4Z.cjs → chunk-MUCEIMJW.cjs} +287 -150
  21. package/dist/tsup/chunk-MUCEIMJW.cjs.map +1 -0
  22. package/dist/tsup/{chunk-YWWDUC6D.cjs → chunk-OKLZYDQB.cjs} +5 -1
  23. package/dist/tsup/chunk-OKLZYDQB.cjs.map +1 -0
  24. package/dist/tsup/{chunk-RFJ4NNO3.js → chunk-R4VUGJNR.js} +4 -4
  25. package/dist/tsup/{chunk-QTCX5KN3.js → chunk-SVWVXVV7.js} +2 -2
  26. package/dist/tsup/{chunk-K6WETGBW.cjs → chunk-SXEIT5DF.cjs} +3 -3
  27. package/dist/tsup/{chunk-K6WETGBW.cjs.map → chunk-SXEIT5DF.cjs.map} +1 -1
  28. package/dist/tsup/{chunk-S6ZMUE7Q.js → chunk-TDHEMJHH.js} +2 -2
  29. package/dist/tsup/{chunk-PBIQPYE5.js → chunk-UFHGMXXV.js} +5 -1
  30. package/dist/tsup/chunk-UFHGMXXV.js.map +1 -0
  31. package/dist/tsup/{chunk-7OXC5BQF.js → chunk-UYCRHJY2.js} +2 -2
  32. package/dist/tsup/chunk-UYCRHJY2.js.map +1 -0
  33. package/dist/tsup/{chunk-5A2KUC5L.cjs → chunk-VOGVBK5O.cjs} +10 -10
  34. package/dist/tsup/{chunk-5A2KUC5L.cjs.map → chunk-VOGVBK5O.cjs.map} +1 -1
  35. package/dist/tsup/{chunk-VM4SXQOC.cjs → chunk-YTSSP6NX.cjs} +3 -3
  36. package/dist/tsup/{chunk-VM4SXQOC.cjs.map → chunk-YTSSP6NX.cjs.map} +1 -1
  37. package/dist/tsup/client/mod.cjs +5 -5
  38. package/dist/tsup/client/mod.d.cts +2 -2
  39. package/dist/tsup/client/mod.d.ts +2 -2
  40. package/dist/tsup/client/mod.js +4 -4
  41. package/dist/tsup/common/log.cjs +2 -2
  42. package/dist/tsup/common/log.js +1 -1
  43. package/dist/tsup/common/websocket.cjs +3 -3
  44. package/dist/tsup/common/websocket.js +2 -2
  45. package/dist/tsup/{config-BDJltifk.d.cts → config-DFAysGOK.d.cts} +114 -3
  46. package/dist/tsup/{config-DXC7qzme.d.ts → config-Dn8SZJF8.d.ts} +114 -3
  47. package/dist/tsup/{context-DgPsVbw6.d.ts → context-D_c2ERjO.d.ts} +5 -1
  48. package/dist/tsup/{context-osC4Q1ax.d.cts → context-fSkMTO5w.d.cts} +5 -1
  49. package/dist/tsup/db/drizzle.cjs +2 -2
  50. package/dist/tsup/db/drizzle.js +1 -1
  51. package/dist/tsup/db/mod.cjs +3 -3
  52. package/dist/tsup/db/mod.js +2 -2
  53. package/dist/tsup/dynamic/mod.cjs +2 -2
  54. package/dist/tsup/dynamic/mod.d.cts +1 -1
  55. package/dist/tsup/dynamic/mod.d.ts +1 -1
  56. package/dist/tsup/dynamic/mod.js +1 -1
  57. package/dist/tsup/inspector/mod.cjs +5 -5
  58. package/dist/tsup/inspector/mod.js +4 -4
  59. package/dist/tsup/inspector/workflow.cjs +4 -4
  60. package/dist/tsup/inspector/workflow.js +3 -3
  61. package/dist/tsup/inspector-tab/mod.cjs +2 -2
  62. package/dist/tsup/inspector-tab/mod.d.cts +2 -2
  63. package/dist/tsup/inspector-tab/mod.d.ts +2 -2
  64. package/dist/tsup/inspector-tab/mod.js +1 -1
  65. package/dist/tsup/mod.cjs +153 -110
  66. package/dist/tsup/mod.cjs.map +1 -1
  67. package/dist/tsup/mod.d.cts +3 -3
  68. package/dist/tsup/mod.d.ts +3 -3
  69. package/dist/tsup/mod.js +49 -6
  70. package/dist/tsup/mod.js.map +1 -1
  71. package/dist/tsup/test/mod.cjs +6 -6
  72. package/dist/tsup/test/mod.d.cts +1 -1
  73. package/dist/tsup/test/mod.d.ts +1 -1
  74. package/dist/tsup/test/mod.js +4 -4
  75. package/dist/tsup/utils.cjs +2 -2
  76. package/dist/tsup/utils.js +1 -1
  77. package/dist/tsup/workflow/mod.cjs +22 -10
  78. package/dist/tsup/workflow/mod.cjs.map +1 -1
  79. package/dist/tsup/workflow/mod.d.cts +3 -3
  80. package/dist/tsup/workflow/mod.d.ts +3 -3
  81. package/dist/tsup/workflow/mod.js +17 -5
  82. package/dist/tsup/workflow/mod.js.map +1 -1
  83. package/package.json +9 -9
  84. package/src/actor/config.ts +79 -0
  85. package/src/client/actor-conn.ts +43 -7
  86. package/src/client/client.ts +93 -0
  87. package/src/client/errors.ts +12 -0
  88. package/src/client/lifecycle-errors.ts +28 -1
  89. package/src/client/mod.ts +1 -0
  90. package/src/client/retry-budget.ts +4 -1
  91. package/src/common/actor-router-consts.ts +1 -0
  92. package/src/engine-api/actors.ts +12 -0
  93. package/src/engine-client/actor-http-client.ts +6 -0
  94. package/src/engine-client/actor-websocket-client.ts +25 -1
  95. package/src/engine-client/api-endpoints.ts +16 -0
  96. package/src/engine-client/driver.ts +12 -0
  97. package/src/engine-client/mod.ts +30 -0
  98. package/src/registry/napi-runtime.ts +8 -0
  99. package/src/registry/native.ts +49 -0
  100. package/src/registry/runtime.ts +11 -0
  101. package/src/registry/wasm-runtime.ts +9 -0
  102. package/src/workflow/context.ts +17 -0
  103. package/dist/tsup/chunk-7OXC5BQF.js.map +0 -1
  104. package/dist/tsup/chunk-HKD7AH4Z.cjs.map +0 -1
  105. package/dist/tsup/chunk-PBIQPYE5.js.map +0 -1
  106. package/dist/tsup/chunk-WBUHPDDM.cjs.map +0 -1
  107. package/dist/tsup/chunk-YMCG4FCB.js.map +0 -1
  108. package/dist/tsup/chunk-YWWDUC6D.cjs.map +0 -1
  109. /package/dist/tsup/{chunk-YO4TJ56P.js.map → chunk-CRC7NMU3.js.map} +0 -0
  110. /package/dist/tsup/{chunk-NMLZDHH2.js.map → chunk-ECLJJGV6.js.map} +0 -0
  111. /package/dist/tsup/{chunk-RFJ4NNO3.js.map → chunk-R4VUGJNR.js.map} +0 -0
  112. /package/dist/tsup/{chunk-QTCX5KN3.js.map → chunk-SVWVXVV7.js.map} +0 -0
  113. /package/dist/tsup/{chunk-S6ZMUE7Q.js.map → chunk-TDHEMJHH.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkK6WETGBWcjs = require('../chunk-K6WETGBW.cjs');
4
- require('../chunk-WBUHPDDM.cjs');
3
+ var _chunkSXEIT5DFcjs = require('../chunk-SXEIT5DF.cjs');
4
+ require('../chunk-MT3ZLU7U.cjs');
5
5
  require('../chunk-MGI2VVF6.cjs');
6
6
 
7
7
 
8
- exports.importWebSocket = _chunkK6WETGBWcjs.importWebSocket;
8
+ exports.importWebSocket = _chunkSXEIT5DFcjs.importWebSocket;
9
9
  //# sourceMappingURL=websocket.cjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  importWebSocket
3
- } from "../chunk-NMLZDHH2.js";
4
- import "../chunk-7OXC5BQF.js";
3
+ } from "../chunk-ECLJJGV6.js";
4
+ import "../chunk-UYCRHJY2.js";
5
5
  import "../chunk-ZOVJDAOW.js";
6
6
  export {
7
7
  importWebSocket
@@ -522,6 +522,8 @@ interface EngineControlClient {
522
522
  getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
523
523
  getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
524
524
  createActor(input: CreateInput): Promise<ActorOutput>;
525
+ /** Forks the actor `actorId` into a new actor of the same name, started on a copy of its database. */
526
+ forkActor(input: ForkInput): Promise<ActorOutput>;
525
527
  listActors(input: ListActorsInput): Promise<ActorOutput[]>;
526
528
  sendRequest(target: GatewayTarget, actorRequest: Request, options?: GatewayRequestOptions): Promise<Response>;
527
529
  openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown, options?: GatewayRequestOptions): Promise<UniversalWebSocket>;
@@ -573,6 +575,15 @@ interface CreateInput {
573
575
  /** Overrides the client's configured pool name for this actor. */
574
576
  poolName?: string;
575
577
  }
578
+ interface ForkInput {
579
+ c?: Context | undefined;
580
+ /** The source actor. */
581
+ actorId: string;
582
+ /** The new actor's key; omitted for a keyless actor. */
583
+ key?: ActorKey;
584
+ /** The fork input, given to the new actor's `onFork` hook. */
585
+ input?: unknown;
586
+ }
576
587
  interface ListActorsInput {
577
588
  c?: Context | undefined;
578
589
  name: string;
@@ -628,6 +639,12 @@ interface RuntimeActorKeySegment {
628
639
  stringValue?: string;
629
640
  numberValue?: number;
630
641
  }
642
+ /** One individual actor fork behind an actor, as the runtime reports it. */
643
+ interface RuntimeForkLink {
644
+ actorId: string;
645
+ key: RuntimeActorKeySegment[];
646
+ forkedAt: number;
647
+ }
631
648
  /** Resolves correlation at operation time so retained clients cannot freeze stale context. */
632
649
  type CurrentActorInvocation = () => ActorInvocationTraceContext | undefined;
633
650
  /** One open call from an actor out to another actor. */
@@ -1015,7 +1032,11 @@ interface CoreRuntime {
1015
1032
  currentInvocationScope(): object | undefined;
1016
1033
  actorName(ctx: ActorContextHandle): string;
1017
1034
  actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
1035
+ /** The individual actor forks behind the actor, oldest first. */
1036
+ actorForkChain(ctx: ActorContextHandle): RuntimeForkLink[];
1018
1037
  actorRegion(ctx: ActorContextHandle): string;
1038
+ /** The name of the namespace the actor runs in. */
1039
+ actorNamespace(ctx: ActorContextHandle): string;
1019
1040
  actorSleep(ctx: ActorContextHandle): void;
1020
1041
  actorDestroy(ctx: ActorContextHandle): void;
1021
1042
  actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
@@ -1656,6 +1677,20 @@ interface ActorAccessor<AD extends AnyActorDefinition> {
1656
1677
  * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the actor.
1657
1678
  */
1658
1679
  create(key?: string | string[], opts?: CreateOptions): Promise<ActorHandle<AD>>;
1680
+ /**
1681
+ * Forks the actor `actorId` into a new actor of this name, and returns a
1682
+ * stateless handle to the new actor with its ID resolved.
1683
+ *
1684
+ * The new actor starts at once on a copy of the source's database as of
1685
+ * its last committed write, runs `onFork` once with `opts.input`, and
1686
+ * keeps running independently of the source. A fork is not idempotent:
1687
+ * a `key` already held answers `actor.duplicate_key`.
1688
+ *
1689
+ * @param {string} actorId - The ID of the source actor.
1690
+ * @param {ForkOptions} [opts] - The new actor's key and the fork input.
1691
+ * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the new actor.
1692
+ */
1693
+ fork(actorId: string, opts?: ForkOptions): Promise<ActorHandle<AD>>;
1659
1694
  }
1660
1695
  /**
1661
1696
  * Options for querying actors.
@@ -1717,6 +1752,15 @@ interface CreateOptions extends QueryOptions {
1717
1752
  */
1718
1753
  poolName?: string;
1719
1754
  }
1755
+ /**
1756
+ * Options for forking an actor.
1757
+ */
1758
+ interface ForkOptions extends QueryOptions {
1759
+ /** The new actor's key. Omit for a keyless actor. */
1760
+ key?: string | string[];
1761
+ /** The fork input, passed to the new actor's `onFork` hook. */
1762
+ input?: unknown;
1763
+ }
1720
1764
  /**
1721
1765
  * Represents a region to connect to.
1722
1766
  * @typedef {Object} Region
@@ -1809,6 +1853,16 @@ declare class ClientRaw {
1809
1853
  * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the actor.
1810
1854
  */
1811
1855
  create<AD extends AnyActorDefinition>(name: string, key?: string | string[], opts?: CreateOptions): Promise<ActorHandle<AD>>;
1856
+ /**
1857
+ * Forks the actor `actorId` into a new actor and returns a handle to it.
1858
+ *
1859
+ * @template AD The actor class that this handle is for.
1860
+ * @param {string} name - The name of the actor; the source has the same name.
1861
+ * @param {string} actorId - The ID of the source actor.
1862
+ * @param {ForkOptions} [opts] - The new actor's key and the fork input.
1863
+ * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the new actor.
1864
+ */
1865
+ fork<AD extends AnyActorDefinition>(name: string, actorId: string, opts?: ForkOptions): Promise<ActorHandle<AD>>;
1812
1866
  [CREATE_ACTOR_CONN_PROXY]<AD extends AnyActorDefinition>(conn: ActorConnRaw): ActorConn<AD>;
1813
1867
  /**
1814
1868
  * Disconnects from all actors.
@@ -1903,6 +1957,20 @@ interface ActorKv {
1903
1957
  list<T extends ActorKvValueType = "text", K extends ActorKvKeyType = "text">(prefix: Uint8Array | string, options?: ActorKvListOptions<T, K>): Promise<Array<[ActorKvKeyTypeMap[K], ActorKvValueTypeMap[T]]>>;
1904
1958
  [key: string]: any;
1905
1959
  }
1960
+ /** One individual actor fork behind an actor, as `c.forkChain` lists it. */
1961
+ interface ActorForkLink {
1962
+ /** The source actor's ID. */
1963
+ actorId: string;
1964
+ /** The source actor's key. */
1965
+ key: string[];
1966
+ /** When the fork was made, in milliseconds since the epoch. */
1967
+ forkedAt: number;
1968
+ }
1969
+ /** The fork an `onFork` hook runs for: the newest entry of `c.forkChain` and the fork input. */
1970
+ interface ActorFork extends ActorForkLink {
1971
+ /** The `input` passed to `client.<actor>.fork`, or `undefined`. */
1972
+ input: unknown;
1973
+ }
1906
1974
  interface ActorSchedule {
1907
1975
  after(duration: number, action: string, ...args: unknown[]): Promise<string>;
1908
1976
  at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
@@ -2083,7 +2151,18 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
2083
2151
  readonly actorId: string;
2084
2152
  readonly name: string;
2085
2153
  readonly key: string[];
2154
+ /**
2155
+ * The individual actor forks behind this actor, oldest first; empty when it was never
2156
+ * forked. Namespace forks are not listed.
2157
+ */
2158
+ readonly forkChain: ActorForkLink[];
2086
2159
  readonly region: string;
2160
+ /**
2161
+ * The name of the namespace the actor runs in. After a namespace fork it differs from the
2162
+ * source actor's namespace while the actor id stays the same, so an actor that owns an
2163
+ * external resource can store this to detect that it was copied.
2164
+ */
2165
+ readonly namespace: string;
2087
2166
  readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
2088
2167
  readonly log: ActorLogger;
2089
2168
  readonly abortSignal: AbortSignal;
@@ -2402,6 +2481,7 @@ declare const ActorConfigSchema: z.ZodObject<{
2402
2481
  onDestroy: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2403
2482
  onMigrate: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2404
2483
  onWake: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2484
+ onFork: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2405
2485
  onSleep: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2406
2486
  run: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>, z.ZodObject<{
2407
2487
  name: z.ZodOptional<z.ZodString>;
@@ -2541,6 +2621,36 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
2541
2621
  * must run on both first boot and wake.
2542
2622
  */
2543
2623
  onMigrate?: (c: MigrateContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, isNew: boolean) => void | Promise<void>;
2624
+ /**
2625
+ * Called once at the first start of an actor made by forking another actor
2626
+ * (`client.<actor>.fork`), after its state loads and before `onWake` and any
2627
+ * overdue schedule events run. `createState` and `onCreate` do not run for a fork.
2628
+ *
2629
+ * Use this hook to cancel schedules the fork inherited, drop resources copied
2630
+ * from the source, or record the fork input. `c.forkChain` already ends with
2631
+ * this fork. A throw fails the start, and the hook runs again on the next start.
2632
+ * Forks of a whole namespace do not call it.
2633
+ *
2634
+ * State edits made in this hook are saved in one commit with the record that the
2635
+ * fork ran, so a start that finds the fork recorded also finds the hook's final
2636
+ * state. On native SQLite the hook's `c.db` writes and any save it starts itself
2637
+ * join that commit too, and a failed start drops them. Two limits apply:
2638
+ *
2639
+ * - On remote SQLite (wasm runtimes), `c.db` writes, and state the hook writes
2640
+ * itself in a transaction (for example `c.db.transaction` with
2641
+ * `experimental.includeState`), are committed at once, without the fork record.
2642
+ * A `c.saveState` call is not such a write: the startup save carries its
2643
+ * state. Only state the hook leaves to the startup save is atomic with it. A
2644
+ * crash or a failed start before the record lands runs the hook again on top
2645
+ * of those writes, so the hook must be idempotent there.
2646
+ * - On native SQLite the hook's writes must fit one commit (32,768 pages, 128 MiB
2647
+ * at the default page size). A transaction that would take them past it fails as
2648
+ * too large instead of committing part of them early; a hook that lets the error
2649
+ * throw fails the start, and nothing it wrote lands. Move a backfill that large
2650
+ * into later actions.
2651
+ * `onCreate` differs: its writes held so far are committed early instead.
2652
+ */
2653
+ onFork?: (c: WakeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, fork: ActorFork) => void | Promise<void>;
2544
2654
  /**
2545
2655
  * Called when the actor is started and ready to receive connections and action.
2546
2656
  *
@@ -2709,10 +2819,10 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
2709
2819
  */
2710
2820
  db: TDatabase;
2711
2821
  } | Record<never, never>;
2712
- 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>;
2822
+ 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" | "onFork" | "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>;
2713
2823
  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>> = {
2714
2824
  types?: ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase>;
2715
- } & Omit<z.input<typeof ActorConfigSchema>, "actions" | "tracing" | "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>;
2825
+ } & Omit<z.input<typeof ActorConfigSchema>, "actions" | "tracing" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onFork" | "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>;
2716
2826
  declare function test<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>(input: ActorConfigInput<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions>): ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2717
2827
  declare const DocActorOptionsSchema: z.ZodObject<{
2718
2828
  name: z.ZodOptional<z.ZodString>;
@@ -2748,6 +2858,7 @@ declare const DocActorConfigSchema: z.ZodObject<{
2748
2858
  onDestroy: z.ZodOptional<z.ZodUnknown>;
2749
2859
  onMigrate: z.ZodOptional<z.ZodUnknown>;
2750
2860
  onWake: z.ZodOptional<z.ZodUnknown>;
2861
+ onFork: z.ZodOptional<z.ZodUnknown>;
2751
2862
  onSleep: z.ZodOptional<z.ZodUnknown>;
2752
2863
  run: z.ZodOptional<z.ZodUnknown>;
2753
2864
  onStateChange: z.ZodOptional<z.ZodUnknown>;
@@ -2787,4 +2898,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
2787
2898
  }, z.core.$strip>>;
2788
2899
  }, z.core.$strip>;
2789
2900
 
2790
- export { type AnyStaticActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorKey as F, type ActorKv as G, type ActorLogger as H, type ActorOptions as I, type ActorOptionsInput as J, ActorOptionsSchema as K, type ActorQuery as L, type MigrateContext as M, type ActorQueue as N, type ActorRun as O, type ActorSchedule as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type ActorTracingOptions as T, type ActorTypes as U, ActorsSchema as V, type WakeContext as W, type AnyActorInstance as X, type AnyClient as Y, type AnyConn as Z, type AnyStaticActorDefinition as _, type ActionContext as a, type ScheduledEventInfo as a$, type AuthIntent as a0, BUILTIN_INSPECTOR_TAB_IDS as a1, type BaseActorInstance as a2, BuiltinInspectorTabIdSchema as a3, CONN_DRIVER_SYMBOL as a4, CONN_STATE_MANAGER_SYMBOL as a5, type Client as a6, type Conn as a7, type CronFire as a8, type CronJobInfo as a9, type QueueName as aA, type QueueNextBatchOptions as aB, type QueueNextOptions as aC, type QueueResultMessageForName as aD, type QueueTryNextBatchOptions as aE, type QueueTryNextOptions as aF, type QueueWaitOptions as aG, RAW_STATE_SYMBOL as aH, Registry as aI, type RegistryActors as aJ, type RegistryApplication as aK, type RegistryConfig as aL, type RegistryConfigInput as aM, RegistryConfigSchema as aN, type RegistryDeps as aO, type RegistryListenOptions as aP, type RegistryRoutes as aQ, type RunConfig as aR, RunConfigSchema as aS, type RunControl as aT, type RunInspectorConfig as aU, type RunInspectorFactoryContext as aV, type RunInspectorFactoryResult as aW, type RunInspectorKind as aX, type RunWithInactiveOptions as aY, type RuntimeKind as aZ, RuntimeKindSchema as a_, CustomInspectorTabEntrySchema as aa, DEFAULT_SLEEP_GRACE_PERIOD as ab, type DefineRunHandlerOptions as ac, DocActorConfigSchema as ad, DocActorOptionsSchema as ae, DocConfigurePoolSchema as af, DocEnvoyConfigSchema as ag, DocRegistryConfigSchema as ah, DocServerlessConfigSchema as ai, DocSqliteConfigSchema as aj, type FetchHandler as ak, type GlobalActorOptions as al, type GlobalActorOptionsInput as am, GlobalActorOptionsSchema as an, HideInspectorTabEntrySchema as ao, type InferEventArgs as ap, type InferSchemaMap as aq, InspectorTabEntrySchema as ar, type InspectorUnsubscribe as as, type InstanceActorOptions as at, type InstanceActorOptionsInput as au, InstanceActorOptionsSchema as av, type QueueEnqueueAndWaitOptions as aw, type QueueFilterName as ax, type QueueIterOptions as ay, type QueueMessageOf as az, type BeforeActionResponseContext as b, type ScheduledFireInfo as b0, type ServerlessHandler as b1, type SqliteBackend as b2, SqliteBackendSchema as b3, type SqliteConfig as b4, SqliteConfigSchema as b5, type TestConfig as b6, TestConfigSchema as b7, type Type as b8, type WasmRuntimeBindings as b9, type ActorConn as bA, ActorConnRaw as bB, type ActorConnStatus as bC, type ActorConnectOptions as bD, type ActorGatewayOptions as bE, type ActorHandle as bF, ActorHandleRaw as bG, type ActorIssueTokenOptions as bH, type ActorTokenPermissions as bI, type ActorTokenResource as bJ, ClientRaw as bK, type ConnectionStateCallback as bL, type CreateOptions as bM, type CreateRequest as bN, type EventUnsubscribe as bO, type ExtractActorsFromRegistry as bP, type ExtractRegistryFromClient as bQ, type GetOptions as bR, type GetWithIdOptions as bS, type IssueTokenOptions as bT, type IssuedToken as bU, type QueryOptions as bV, type Region as bW, type StatusChangeCallback as bX, type TokenGrant as bY, type WasmRuntimeConfig as ba, WasmRuntimeConfigSchema as bb, type WasmRuntimeInitInput as bc, type WorkflowInspectorConfig as bd, type WorkflowOutcome as be, type WorkflowSpan as bf, type WorkflowStepOutcome as bg, type WorkflowStepSpan as bh, actor as bi, buildActorNames as bj, createClientWithDriver as bk, defineRunHandler as bl, disposeRunInspector as bm, event as bn, getRunFunction as bo, getRunInspectorConfig as bp, getRunMetadata as bq, isStaticActorDefinition as br, isStaticActorInstance as bs, lookupInRegistry as bt, queue as bu, setup as bv, test as bw, type ActorAccessor as bx, type ActorActionFunction as by, type ActorActionOptions 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 ActionSampleRates as m, type ActionTraceSamplers as n, type Actions as o, type ActorConfig as p, type ActorConfigInput as q, ActorConfigSchema as r, type ActorContext as s, type ActorContextOf as t, type ActorCron as u, type ActorCronEveryOptions as v, type ActorCronSetOptions as w, ActorDefinition as x, type ActorInspectorConfig as y, ActorInspectorConfigSchema as z };
2901
+ export { type AnyConn as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorInspectorConfig as F, ActorInspectorConfigSchema as G, type ActorKey as H, type ActorKv as I, type ActorLogger as J, type ActorOptions as K, type ActorOptionsInput as L, type MigrateContext as M, ActorOptionsSchema as N, type ActorQuery as O, type ActorQueue as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type ActorRun as T, type ActorSchedule as U, type ActorTracingOptions as V, type WakeContext as W, type ActorTypes as X, ActorsSchema as Y, type AnyActorInstance as Z, type AnyClient as _, type ActionContext as a, type RuntimeKind as a$, type AnyStaticActorDefinition as a0, type AnyStaticActorInstance as a1, type AuthIntent as a2, BUILTIN_INSPECTOR_TAB_IDS as a3, type BaseActorInstance as a4, BuiltinInspectorTabIdSchema as a5, CONN_DRIVER_SYMBOL as a6, CONN_STATE_MANAGER_SYMBOL as a7, type Client as a8, type Conn as a9, type QueueIterOptions as aA, type QueueMessageOf as aB, type QueueName as aC, type QueueNextBatchOptions as aD, type QueueNextOptions as aE, type QueueResultMessageForName as aF, type QueueTryNextBatchOptions as aG, type QueueTryNextOptions as aH, type QueueWaitOptions as aI, RAW_STATE_SYMBOL as aJ, Registry as aK, type RegistryActors as aL, type RegistryApplication as aM, type RegistryConfig as aN, type RegistryConfigInput as aO, RegistryConfigSchema as aP, type RegistryDeps as aQ, type RegistryListenOptions as aR, type RegistryRoutes as aS, type RunConfig as aT, RunConfigSchema as aU, type RunControl as aV, type RunInspectorConfig as aW, type RunInspectorFactoryContext as aX, type RunInspectorFactoryResult as aY, type RunInspectorKind as aZ, type RunWithInactiveOptions as a_, type CronFire as aa, type CronJobInfo as ab, CustomInspectorTabEntrySchema as ac, DEFAULT_SLEEP_GRACE_PERIOD as ad, type DefineRunHandlerOptions as ae, DocActorConfigSchema as af, DocActorOptionsSchema as ag, DocConfigurePoolSchema as ah, DocEnvoyConfigSchema as ai, DocRegistryConfigSchema as aj, DocServerlessConfigSchema as ak, DocSqliteConfigSchema as al, type FetchHandler as am, type GlobalActorOptions as an, type GlobalActorOptionsInput as ao, GlobalActorOptionsSchema as ap, HideInspectorTabEntrySchema as aq, type InferEventArgs as ar, type InferSchemaMap as as, InspectorTabEntrySchema as at, type InspectorUnsubscribe as au, type InstanceActorOptions as av, type InstanceActorOptionsInput as aw, InstanceActorOptionsSchema as ax, type QueueEnqueueAndWaitOptions as ay, type QueueFilterName as az, type BeforeActionResponseContext as b, type TokenGrant as b$, RuntimeKindSchema as b0, type ScheduledEventInfo as b1, type ScheduledFireInfo as b2, type ServerlessHandler as b3, type SqliteBackend as b4, SqliteBackendSchema as b5, type SqliteConfig as b6, SqliteConfigSchema as b7, type TestConfig as b8, TestConfigSchema as b9, type ActorActionFunction as bA, type ActorActionOptions as bB, type ActorConn as bC, ActorConnRaw as bD, type ActorConnStatus as bE, type ActorConnectOptions as bF, type ActorGatewayOptions as bG, type ActorHandle as bH, ActorHandleRaw as bI, type ActorIssueTokenOptions as bJ, type ActorTokenPermissions as bK, type ActorTokenResource as bL, ClientRaw as bM, type ConnectionStateCallback as bN, type CreateOptions as bO, type CreateRequest as bP, type EventUnsubscribe as bQ, type ExtractActorsFromRegistry as bR, type ExtractRegistryFromClient as bS, type ForkOptions as bT, type GetOptions as bU, type GetWithIdOptions as bV, type IssueTokenOptions as bW, type IssuedToken as bX, type QueryOptions as bY, type Region as bZ, type StatusChangeCallback as b_, type Type as ba, type WasmRuntimeBindings as bb, type WasmRuntimeConfig as bc, WasmRuntimeConfigSchema as bd, type WasmRuntimeInitInput as be, type WorkflowInspectorConfig as bf, type WorkflowOutcome as bg, type WorkflowSpan as bh, type WorkflowStepOutcome as bi, type WorkflowStepSpan as bj, actor as bk, buildActorNames as bl, createClientWithDriver as bm, defineRunHandler as bn, disposeRunInspector as bo, event as bp, getRunFunction as bq, getRunInspectorConfig as br, getRunMetadata as bs, isStaticActorDefinition as bt, isStaticActorInstance as bu, lookupInRegistry as bv, queue as bw, setup as bx, test as by, type ActorAccessor 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 ActionSampleRates as m, type ActionTraceSamplers as n, type Actions as o, type ActorConfig as p, type ActorConfigInput as q, ActorConfigSchema as r, type ActorContext as s, type ActorContextOf as t, type ActorCron as u, type ActorCronEveryOptions as v, type ActorCronSetOptions as w, ActorDefinition as x, type ActorFork as y, type ActorForkLink as z };
@@ -522,6 +522,8 @@ interface EngineControlClient {
522
522
  getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
523
523
  getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
524
524
  createActor(input: CreateInput): Promise<ActorOutput>;
525
+ /** Forks the actor `actorId` into a new actor of the same name, started on a copy of its database. */
526
+ forkActor(input: ForkInput): Promise<ActorOutput>;
525
527
  listActors(input: ListActorsInput): Promise<ActorOutput[]>;
526
528
  sendRequest(target: GatewayTarget, actorRequest: Request, options?: GatewayRequestOptions): Promise<Response>;
527
529
  openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown, options?: GatewayRequestOptions): Promise<UniversalWebSocket>;
@@ -573,6 +575,15 @@ interface CreateInput {
573
575
  /** Overrides the client's configured pool name for this actor. */
574
576
  poolName?: string;
575
577
  }
578
+ interface ForkInput {
579
+ c?: Context | undefined;
580
+ /** The source actor. */
581
+ actorId: string;
582
+ /** The new actor's key; omitted for a keyless actor. */
583
+ key?: ActorKey;
584
+ /** The fork input, given to the new actor's `onFork` hook. */
585
+ input?: unknown;
586
+ }
576
587
  interface ListActorsInput {
577
588
  c?: Context | undefined;
578
589
  name: string;
@@ -628,6 +639,12 @@ interface RuntimeActorKeySegment {
628
639
  stringValue?: string;
629
640
  numberValue?: number;
630
641
  }
642
+ /** One individual actor fork behind an actor, as the runtime reports it. */
643
+ interface RuntimeForkLink {
644
+ actorId: string;
645
+ key: RuntimeActorKeySegment[];
646
+ forkedAt: number;
647
+ }
631
648
  /** Resolves correlation at operation time so retained clients cannot freeze stale context. */
632
649
  type CurrentActorInvocation = () => ActorInvocationTraceContext | undefined;
633
650
  /** One open call from an actor out to another actor. */
@@ -1015,7 +1032,11 @@ interface CoreRuntime {
1015
1032
  currentInvocationScope(): object | undefined;
1016
1033
  actorName(ctx: ActorContextHandle): string;
1017
1034
  actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
1035
+ /** The individual actor forks behind the actor, oldest first. */
1036
+ actorForkChain(ctx: ActorContextHandle): RuntimeForkLink[];
1018
1037
  actorRegion(ctx: ActorContextHandle): string;
1038
+ /** The name of the namespace the actor runs in. */
1039
+ actorNamespace(ctx: ActorContextHandle): string;
1019
1040
  actorSleep(ctx: ActorContextHandle): void;
1020
1041
  actorDestroy(ctx: ActorContextHandle): void;
1021
1042
  actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
@@ -1656,6 +1677,20 @@ interface ActorAccessor<AD extends AnyActorDefinition> {
1656
1677
  * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the actor.
1657
1678
  */
1658
1679
  create(key?: string | string[], opts?: CreateOptions): Promise<ActorHandle<AD>>;
1680
+ /**
1681
+ * Forks the actor `actorId` into a new actor of this name, and returns a
1682
+ * stateless handle to the new actor with its ID resolved.
1683
+ *
1684
+ * The new actor starts at once on a copy of the source's database as of
1685
+ * its last committed write, runs `onFork` once with `opts.input`, and
1686
+ * keeps running independently of the source. A fork is not idempotent:
1687
+ * a `key` already held answers `actor.duplicate_key`.
1688
+ *
1689
+ * @param {string} actorId - The ID of the source actor.
1690
+ * @param {ForkOptions} [opts] - The new actor's key and the fork input.
1691
+ * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the new actor.
1692
+ */
1693
+ fork(actorId: string, opts?: ForkOptions): Promise<ActorHandle<AD>>;
1659
1694
  }
1660
1695
  /**
1661
1696
  * Options for querying actors.
@@ -1717,6 +1752,15 @@ interface CreateOptions extends QueryOptions {
1717
1752
  */
1718
1753
  poolName?: string;
1719
1754
  }
1755
+ /**
1756
+ * Options for forking an actor.
1757
+ */
1758
+ interface ForkOptions extends QueryOptions {
1759
+ /** The new actor's key. Omit for a keyless actor. */
1760
+ key?: string | string[];
1761
+ /** The fork input, passed to the new actor's `onFork` hook. */
1762
+ input?: unknown;
1763
+ }
1720
1764
  /**
1721
1765
  * Represents a region to connect to.
1722
1766
  * @typedef {Object} Region
@@ -1809,6 +1853,16 @@ declare class ClientRaw {
1809
1853
  * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the actor.
1810
1854
  */
1811
1855
  create<AD extends AnyActorDefinition>(name: string, key?: string | string[], opts?: CreateOptions): Promise<ActorHandle<AD>>;
1856
+ /**
1857
+ * Forks the actor `actorId` into a new actor and returns a handle to it.
1858
+ *
1859
+ * @template AD The actor class that this handle is for.
1860
+ * @param {string} name - The name of the actor; the source has the same name.
1861
+ * @param {string} actorId - The ID of the source actor.
1862
+ * @param {ForkOptions} [opts] - The new actor's key and the fork input.
1863
+ * @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the new actor.
1864
+ */
1865
+ fork<AD extends AnyActorDefinition>(name: string, actorId: string, opts?: ForkOptions): Promise<ActorHandle<AD>>;
1812
1866
  [CREATE_ACTOR_CONN_PROXY]<AD extends AnyActorDefinition>(conn: ActorConnRaw): ActorConn<AD>;
1813
1867
  /**
1814
1868
  * Disconnects from all actors.
@@ -1903,6 +1957,20 @@ interface ActorKv {
1903
1957
  list<T extends ActorKvValueType = "text", K extends ActorKvKeyType = "text">(prefix: Uint8Array | string, options?: ActorKvListOptions<T, K>): Promise<Array<[ActorKvKeyTypeMap[K], ActorKvValueTypeMap[T]]>>;
1904
1958
  [key: string]: any;
1905
1959
  }
1960
+ /** One individual actor fork behind an actor, as `c.forkChain` lists it. */
1961
+ interface ActorForkLink {
1962
+ /** The source actor's ID. */
1963
+ actorId: string;
1964
+ /** The source actor's key. */
1965
+ key: string[];
1966
+ /** When the fork was made, in milliseconds since the epoch. */
1967
+ forkedAt: number;
1968
+ }
1969
+ /** The fork an `onFork` hook runs for: the newest entry of `c.forkChain` and the fork input. */
1970
+ interface ActorFork extends ActorForkLink {
1971
+ /** The `input` passed to `client.<actor>.fork`, or `undefined`. */
1972
+ input: unknown;
1973
+ }
1906
1974
  interface ActorSchedule {
1907
1975
  after(duration: number, action: string, ...args: unknown[]): Promise<string>;
1908
1976
  at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
@@ -2083,7 +2151,18 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
2083
2151
  readonly actorId: string;
2084
2152
  readonly name: string;
2085
2153
  readonly key: string[];
2154
+ /**
2155
+ * The individual actor forks behind this actor, oldest first; empty when it was never
2156
+ * forked. Namespace forks are not listed.
2157
+ */
2158
+ readonly forkChain: ActorForkLink[];
2086
2159
  readonly region: string;
2160
+ /**
2161
+ * The name of the namespace the actor runs in. After a namespace fork it differs from the
2162
+ * source actor's namespace while the actor id stays the same, so an actor that owns an
2163
+ * external resource can store this to detect that it was copied.
2164
+ */
2165
+ readonly namespace: string;
2087
2166
  readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
2088
2167
  readonly log: ActorLogger;
2089
2168
  readonly abortSignal: AbortSignal;
@@ -2402,6 +2481,7 @@ declare const ActorConfigSchema: z.ZodObject<{
2402
2481
  onDestroy: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2403
2482
  onMigrate: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2404
2483
  onWake: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2484
+ onFork: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2405
2485
  onSleep: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
2406
2486
  run: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>, z.ZodObject<{
2407
2487
  name: z.ZodOptional<z.ZodString>;
@@ -2541,6 +2621,36 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
2541
2621
  * must run on both first boot and wake.
2542
2622
  */
2543
2623
  onMigrate?: (c: MigrateContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, isNew: boolean) => void | Promise<void>;
2624
+ /**
2625
+ * Called once at the first start of an actor made by forking another actor
2626
+ * (`client.<actor>.fork`), after its state loads and before `onWake` and any
2627
+ * overdue schedule events run. `createState` and `onCreate` do not run for a fork.
2628
+ *
2629
+ * Use this hook to cancel schedules the fork inherited, drop resources copied
2630
+ * from the source, or record the fork input. `c.forkChain` already ends with
2631
+ * this fork. A throw fails the start, and the hook runs again on the next start.
2632
+ * Forks of a whole namespace do not call it.
2633
+ *
2634
+ * State edits made in this hook are saved in one commit with the record that the
2635
+ * fork ran, so a start that finds the fork recorded also finds the hook's final
2636
+ * state. On native SQLite the hook's `c.db` writes and any save it starts itself
2637
+ * join that commit too, and a failed start drops them. Two limits apply:
2638
+ *
2639
+ * - On remote SQLite (wasm runtimes), `c.db` writes, and state the hook writes
2640
+ * itself in a transaction (for example `c.db.transaction` with
2641
+ * `experimental.includeState`), are committed at once, without the fork record.
2642
+ * A `c.saveState` call is not such a write: the startup save carries its
2643
+ * state. Only state the hook leaves to the startup save is atomic with it. A
2644
+ * crash or a failed start before the record lands runs the hook again on top
2645
+ * of those writes, so the hook must be idempotent there.
2646
+ * - On native SQLite the hook's writes must fit one commit (32,768 pages, 128 MiB
2647
+ * at the default page size). A transaction that would take them past it fails as
2648
+ * too large instead of committing part of them early; a hook that lets the error
2649
+ * throw fails the start, and nothing it wrote lands. Move a backfill that large
2650
+ * into later actions.
2651
+ * `onCreate` differs: its writes held so far are committed early instead.
2652
+ */
2653
+ onFork?: (c: WakeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, fork: ActorFork) => void | Promise<void>;
2544
2654
  /**
2545
2655
  * Called when the actor is started and ready to receive connections and action.
2546
2656
  *
@@ -2709,10 +2819,10 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
2709
2819
  */
2710
2820
  db: TDatabase;
2711
2821
  } | Record<never, never>;
2712
- 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>;
2822
+ 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" | "onFork" | "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>;
2713
2823
  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>> = {
2714
2824
  types?: ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase>;
2715
- } & Omit<z.input<typeof ActorConfigSchema>, "actions" | "tracing" | "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>;
2825
+ } & Omit<z.input<typeof ActorConfigSchema>, "actions" | "tracing" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onFork" | "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>;
2716
2826
  declare function test<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>(input: ActorConfigInput<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions>): ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2717
2827
  declare const DocActorOptionsSchema: z.ZodObject<{
2718
2828
  name: z.ZodOptional<z.ZodString>;
@@ -2748,6 +2858,7 @@ declare const DocActorConfigSchema: z.ZodObject<{
2748
2858
  onDestroy: z.ZodOptional<z.ZodUnknown>;
2749
2859
  onMigrate: z.ZodOptional<z.ZodUnknown>;
2750
2860
  onWake: z.ZodOptional<z.ZodUnknown>;
2861
+ onFork: z.ZodOptional<z.ZodUnknown>;
2751
2862
  onSleep: z.ZodOptional<z.ZodUnknown>;
2752
2863
  run: z.ZodOptional<z.ZodUnknown>;
2753
2864
  onStateChange: z.ZodOptional<z.ZodUnknown>;
@@ -2787,4 +2898,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
2787
2898
  }, z.core.$strip>>;
2788
2899
  }, z.core.$strip>;
2789
2900
 
2790
- export { type AnyStaticActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorKey as F, type ActorKv as G, type ActorLogger as H, type ActorOptions as I, type ActorOptionsInput as J, ActorOptionsSchema as K, type ActorQuery as L, type MigrateContext as M, type ActorQueue as N, type ActorRun as O, type ActorSchedule as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type ActorTracingOptions as T, type ActorTypes as U, ActorsSchema as V, type WakeContext as W, type AnyActorInstance as X, type AnyClient as Y, type AnyConn as Z, type AnyStaticActorDefinition as _, type ActionContext as a, type ScheduledEventInfo as a$, type AuthIntent as a0, BUILTIN_INSPECTOR_TAB_IDS as a1, type BaseActorInstance as a2, BuiltinInspectorTabIdSchema as a3, CONN_DRIVER_SYMBOL as a4, CONN_STATE_MANAGER_SYMBOL as a5, type Client as a6, type Conn as a7, type CronFire as a8, type CronJobInfo as a9, type QueueName as aA, type QueueNextBatchOptions as aB, type QueueNextOptions as aC, type QueueResultMessageForName as aD, type QueueTryNextBatchOptions as aE, type QueueTryNextOptions as aF, type QueueWaitOptions as aG, RAW_STATE_SYMBOL as aH, Registry as aI, type RegistryActors as aJ, type RegistryApplication as aK, type RegistryConfig as aL, type RegistryConfigInput as aM, RegistryConfigSchema as aN, type RegistryDeps as aO, type RegistryListenOptions as aP, type RegistryRoutes as aQ, type RunConfig as aR, RunConfigSchema as aS, type RunControl as aT, type RunInspectorConfig as aU, type RunInspectorFactoryContext as aV, type RunInspectorFactoryResult as aW, type RunInspectorKind as aX, type RunWithInactiveOptions as aY, type RuntimeKind as aZ, RuntimeKindSchema as a_, CustomInspectorTabEntrySchema as aa, DEFAULT_SLEEP_GRACE_PERIOD as ab, type DefineRunHandlerOptions as ac, DocActorConfigSchema as ad, DocActorOptionsSchema as ae, DocConfigurePoolSchema as af, DocEnvoyConfigSchema as ag, DocRegistryConfigSchema as ah, DocServerlessConfigSchema as ai, DocSqliteConfigSchema as aj, type FetchHandler as ak, type GlobalActorOptions as al, type GlobalActorOptionsInput as am, GlobalActorOptionsSchema as an, HideInspectorTabEntrySchema as ao, type InferEventArgs as ap, type InferSchemaMap as aq, InspectorTabEntrySchema as ar, type InspectorUnsubscribe as as, type InstanceActorOptions as at, type InstanceActorOptionsInput as au, InstanceActorOptionsSchema as av, type QueueEnqueueAndWaitOptions as aw, type QueueFilterName as ax, type QueueIterOptions as ay, type QueueMessageOf as az, type BeforeActionResponseContext as b, type ScheduledFireInfo as b0, type ServerlessHandler as b1, type SqliteBackend as b2, SqliteBackendSchema as b3, type SqliteConfig as b4, SqliteConfigSchema as b5, type TestConfig as b6, TestConfigSchema as b7, type Type as b8, type WasmRuntimeBindings as b9, type ActorConn as bA, ActorConnRaw as bB, type ActorConnStatus as bC, type ActorConnectOptions as bD, type ActorGatewayOptions as bE, type ActorHandle as bF, ActorHandleRaw as bG, type ActorIssueTokenOptions as bH, type ActorTokenPermissions as bI, type ActorTokenResource as bJ, ClientRaw as bK, type ConnectionStateCallback as bL, type CreateOptions as bM, type CreateRequest as bN, type EventUnsubscribe as bO, type ExtractActorsFromRegistry as bP, type ExtractRegistryFromClient as bQ, type GetOptions as bR, type GetWithIdOptions as bS, type IssueTokenOptions as bT, type IssuedToken as bU, type QueryOptions as bV, type Region as bW, type StatusChangeCallback as bX, type TokenGrant as bY, type WasmRuntimeConfig as ba, WasmRuntimeConfigSchema as bb, type WasmRuntimeInitInput as bc, type WorkflowInspectorConfig as bd, type WorkflowOutcome as be, type WorkflowSpan as bf, type WorkflowStepOutcome as bg, type WorkflowStepSpan as bh, actor as bi, buildActorNames as bj, createClientWithDriver as bk, defineRunHandler as bl, disposeRunInspector as bm, event as bn, getRunFunction as bo, getRunInspectorConfig as bp, getRunMetadata as bq, isStaticActorDefinition as br, isStaticActorInstance as bs, lookupInRegistry as bt, queue as bu, setup as bv, test as bw, type ActorAccessor as bx, type ActorActionFunction as by, type ActorActionOptions 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 ActionSampleRates as m, type ActionTraceSamplers as n, type Actions as o, type ActorConfig as p, type ActorConfigInput as q, ActorConfigSchema as r, type ActorContext as s, type ActorContextOf as t, type ActorCron as u, type ActorCronEveryOptions as v, type ActorCronSetOptions as w, ActorDefinition as x, type ActorInspectorConfig as y, ActorInspectorConfigSchema as z };
2901
+ export { type AnyConn as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorInspectorConfig as F, ActorInspectorConfigSchema as G, type ActorKey as H, type ActorKv as I, type ActorLogger as J, type ActorOptions as K, type ActorOptionsInput as L, type MigrateContext as M, ActorOptionsSchema as N, type ActorQuery as O, type ActorQueue as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type ActorRun as T, type ActorSchedule as U, type ActorTracingOptions as V, type WakeContext as W, type ActorTypes as X, ActorsSchema as Y, type AnyActorInstance as Z, type AnyClient as _, type ActionContext as a, type RuntimeKind as a$, type AnyStaticActorDefinition as a0, type AnyStaticActorInstance as a1, type AuthIntent as a2, BUILTIN_INSPECTOR_TAB_IDS as a3, type BaseActorInstance as a4, BuiltinInspectorTabIdSchema as a5, CONN_DRIVER_SYMBOL as a6, CONN_STATE_MANAGER_SYMBOL as a7, type Client as a8, type Conn as a9, type QueueIterOptions as aA, type QueueMessageOf as aB, type QueueName as aC, type QueueNextBatchOptions as aD, type QueueNextOptions as aE, type QueueResultMessageForName as aF, type QueueTryNextBatchOptions as aG, type QueueTryNextOptions as aH, type QueueWaitOptions as aI, RAW_STATE_SYMBOL as aJ, Registry as aK, type RegistryActors as aL, type RegistryApplication as aM, type RegistryConfig as aN, type RegistryConfigInput as aO, RegistryConfigSchema as aP, type RegistryDeps as aQ, type RegistryListenOptions as aR, type RegistryRoutes as aS, type RunConfig as aT, RunConfigSchema as aU, type RunControl as aV, type RunInspectorConfig as aW, type RunInspectorFactoryContext as aX, type RunInspectorFactoryResult as aY, type RunInspectorKind as aZ, type RunWithInactiveOptions as a_, type CronFire as aa, type CronJobInfo as ab, CustomInspectorTabEntrySchema as ac, DEFAULT_SLEEP_GRACE_PERIOD as ad, type DefineRunHandlerOptions as ae, DocActorConfigSchema as af, DocActorOptionsSchema as ag, DocConfigurePoolSchema as ah, DocEnvoyConfigSchema as ai, DocRegistryConfigSchema as aj, DocServerlessConfigSchema as ak, DocSqliteConfigSchema as al, type FetchHandler as am, type GlobalActorOptions as an, type GlobalActorOptionsInput as ao, GlobalActorOptionsSchema as ap, HideInspectorTabEntrySchema as aq, type InferEventArgs as ar, type InferSchemaMap as as, InspectorTabEntrySchema as at, type InspectorUnsubscribe as au, type InstanceActorOptions as av, type InstanceActorOptionsInput as aw, InstanceActorOptionsSchema as ax, type QueueEnqueueAndWaitOptions as ay, type QueueFilterName as az, type BeforeActionResponseContext as b, type TokenGrant as b$, RuntimeKindSchema as b0, type ScheduledEventInfo as b1, type ScheduledFireInfo as b2, type ServerlessHandler as b3, type SqliteBackend as b4, SqliteBackendSchema as b5, type SqliteConfig as b6, SqliteConfigSchema as b7, type TestConfig as b8, TestConfigSchema as b9, type ActorActionFunction as bA, type ActorActionOptions as bB, type ActorConn as bC, ActorConnRaw as bD, type ActorConnStatus as bE, type ActorConnectOptions as bF, type ActorGatewayOptions as bG, type ActorHandle as bH, ActorHandleRaw as bI, type ActorIssueTokenOptions as bJ, type ActorTokenPermissions as bK, type ActorTokenResource as bL, ClientRaw as bM, type ConnectionStateCallback as bN, type CreateOptions as bO, type CreateRequest as bP, type EventUnsubscribe as bQ, type ExtractActorsFromRegistry as bR, type ExtractRegistryFromClient as bS, type ForkOptions as bT, type GetOptions as bU, type GetWithIdOptions as bV, type IssueTokenOptions as bW, type IssuedToken as bX, type QueryOptions as bY, type Region as bZ, type StatusChangeCallback as b_, type Type as ba, type WasmRuntimeBindings as bb, type WasmRuntimeConfig as bc, WasmRuntimeConfigSchema as bd, type WasmRuntimeInitInput as be, type WorkflowInspectorConfig as bf, type WorkflowOutcome as bg, type WorkflowSpan as bh, type WorkflowStepOutcome as bi, type WorkflowStepSpan as bj, actor as bk, buildActorNames as bl, createClientWithDriver as bm, defineRunHandler as bn, disposeRunInspector as bo, event as bp, getRunFunction as bq, getRunInspectorConfig as br, getRunMetadata as bs, isStaticActorDefinition as bt, isStaticActorInstance as bu, lookupInRegistry as bv, queue as bw, setup as bx, test as by, type ActorAccessor 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 ActionSampleRates as m, type ActionTraceSamplers as n, type Actions as o, type ActorConfig as p, type ActorConfigInput as q, ActorConfigSchema as r, type ActorContext as s, type ActorContextOf as t, type ActorCron as u, type ActorCronEveryOptions as v, type ActorCronSetOptions as w, ActorDefinition as x, type ActorFork as y, type ActorForkLink as z };
@@ -1,4 +1,4 @@
1
- import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, H as ActorLogger, ax as QueueFilterName, aC as QueueNextOptions, aD as QueueResultMessageForName, aB as QueueNextBatchOptions, aI as Registry, a6 as Client, ap as InferEventArgs, aq as InferSchemaMap } from './config-DXC7qzme.js';
1
+ import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, z as ActorForkLink, J as ActorLogger, az as QueueFilterName, aE as QueueNextOptions, aF as QueueResultMessageForName, aD as QueueNextBatchOptions, aK as Registry, a8 as Client, ar as InferEventArgs, as as InferSchemaMap } from './config-Dn8SZJF8.js';
2
2
  import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine';
3
3
  import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-CBTr4IhE.js';
4
4
 
@@ -40,6 +40,8 @@ declare class WorkflowStepContext<TState, TConnParams, TConnState, TVars, TInput
40
40
  get actorId(): string;
41
41
  get name(): string;
42
42
  get key(): string[];
43
+ get forkChain(): ActorForkLink[];
44
+ get namespace(): string;
43
45
  get log(): ActorLogger;
44
46
  get abortSignal(): AbortSignal;
45
47
  /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
@@ -84,6 +86,8 @@ declare class WorkflowContext<TState, TConnParams, TConnState, TVars, TInput, TD
84
86
  get actorId(): string;
85
87
  get name(): string;
86
88
  get key(): string[];
89
+ get forkChain(): ActorForkLink[];
90
+ get namespace(): string;
87
91
  get log(): ActorLogger;
88
92
  /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
89
93
  get queue(): {
@@ -1,4 +1,4 @@
1
- import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, H as ActorLogger, ax as QueueFilterName, aC as QueueNextOptions, aD as QueueResultMessageForName, aB as QueueNextBatchOptions, aI as Registry, a6 as Client, ap as InferEventArgs, aq as InferSchemaMap } from './config-BDJltifk.cjs';
1
+ import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, z as ActorForkLink, J as ActorLogger, az as QueueFilterName, aE as QueueNextOptions, aF as QueueResultMessageForName, aD as QueueNextBatchOptions, aK as Registry, a8 as Client, ar as InferEventArgs, as as InferSchemaMap } from './config-DFAysGOK.cjs';
2
2
  import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine';
3
3
  import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-CBTr4IhE.cjs';
4
4
 
@@ -40,6 +40,8 @@ declare class WorkflowStepContext<TState, TConnParams, TConnState, TVars, TInput
40
40
  get actorId(): string;
41
41
  get name(): string;
42
42
  get key(): string[];
43
+ get forkChain(): ActorForkLink[];
44
+ get namespace(): string;
43
45
  get log(): ActorLogger;
44
46
  get abortSignal(): AbortSignal;
45
47
  /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
@@ -84,6 +86,8 @@ declare class WorkflowContext<TState, TConnParams, TConnState, TVars, TInput, TD
84
86
  get actorId(): string;
85
87
  get name(): string;
86
88
  get key(): string[];
89
+ get forkChain(): ActorForkLink[];
90
+ get namespace(): string;
87
91
  get log(): ActorLogger;
88
92
  /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
89
93
  get queue(): {
@@ -7,7 +7,7 @@
7
7
  var _chunkKVFIONKQcjs = require('../chunk-KVFIONKQ.cjs');
8
8
 
9
9
 
10
- var _chunkWBUHPDDMcjs = require('../chunk-WBUHPDDM.cjs');
10
+ var _chunkMT3ZLU7Ucjs = require('../chunk-MT3ZLU7U.cjs');
11
11
  require('../chunk-MGI2VVF6.cjs');
12
12
 
13
13
  // src/db/drizzle.ts
@@ -164,7 +164,7 @@ function db({
164
164
  return;
165
165
  }
166
166
  manualTransactionWarned = true;
167
- _chunkWBUHPDDMcjs.getLogger.call(void 0, "database").warn(
167
+ _chunkMT3ZLU7Ucjs.getLogger.call(void 0, "database").warn(
168
168
  { actorId: ctx.actorId },
169
169
  "Manual cross-call SQLite transactions can interleave with other actor work. Use db.transaction() for coordinated transactions. Set warnOnManualTransactions: false in your db(...) configuration to disable this warning."
170
170
  );
@@ -7,7 +7,7 @@ import {
7
7
  } from "../chunk-JTHHCZCZ.js";
8
8
  import {
9
9
  getLogger
10
- } from "../chunk-7OXC5BQF.js";
10
+ } from "../chunk-UYCRHJY2.js";
11
11
  import "../chunk-ZOVJDAOW.js";
12
12
 
13
13
  // src/db/drizzle.ts
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkVM4SXQOCcjs = require('../chunk-VM4SXQOC.cjs');
3
+ var _chunkYTSSP6NXcjs = require('../chunk-YTSSP6NX.cjs');
4
4
  require('../chunk-KVFIONKQ.cjs');
5
- require('../chunk-WBUHPDDM.cjs');
5
+ require('../chunk-MT3ZLU7U.cjs');
6
6
  require('../chunk-MGI2VVF6.cjs');
7
7
 
8
8
 
9
- exports.db = _chunkVM4SXQOCcjs.db;
9
+ exports.db = _chunkYTSSP6NXcjs.db;
10
10
  //# sourceMappingURL=mod.cjs.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  db
3
- } from "../chunk-YO4TJ56P.js";
3
+ } from "../chunk-CRC7NMU3.js";
4
4
  import "../chunk-JTHHCZCZ.js";
5
- import "../chunk-7OXC5BQF.js";
5
+ import "../chunk-UYCRHJY2.js";
6
6
  import "../chunk-ZOVJDAOW.js";
7
7
  export {
8
8
  db