rivetkit 2.3.11-rc.4 → 2.3.11-rc.6

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 (85) hide show
  1. package/dist/browser/client.js +1 -1
  2. package/dist/browser/client.js.map +1 -1
  3. package/dist/browser/inspector/client.d.ts +5 -1
  4. package/dist/browser/inspector/client.js +4 -2
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/actor/errors.cjs.map +1 -1
  7. package/dist/tsup/agent-os/index.cjs +1 -1
  8. package/dist/tsup/agent-os/index.cjs.map +1 -1
  9. package/dist/tsup/agent-os/index.js +1 -1
  10. package/dist/tsup/agent-os/index.js.map +1 -1
  11. package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -1
  12. package/dist/tsup/{chunk-5KLTIO35.js → chunk-6IZF6OM2.js} +6 -6
  13. package/dist/tsup/{chunk-3WCNDXDU.cjs → chunk-AKUYP7I4.cjs} +6 -4
  14. package/dist/tsup/chunk-AKUYP7I4.cjs.map +1 -0
  15. package/dist/tsup/{chunk-RRVTP46R.cjs → chunk-CUQ73NBJ.cjs} +9 -9
  16. package/dist/tsup/chunk-CUQ73NBJ.cjs.map +1 -0
  17. package/dist/tsup/{chunk-3BQTLF6T.cjs → chunk-DXYOITKV.cjs} +139 -139
  18. package/dist/tsup/chunk-DXYOITKV.cjs.map +1 -0
  19. package/dist/tsup/{chunk-TP5MGPLS.js → chunk-F34M5L2C.js} +3 -3
  20. package/dist/tsup/chunk-F34M5L2C.js.map +1 -0
  21. package/dist/tsup/chunk-HNHLBM3Y.cjs.map +1 -1
  22. package/dist/tsup/{chunk-S26YGW4T.js → chunk-J6E7BTKN.js} +2 -2
  23. package/dist/tsup/{chunk-DD4HSOMO.cjs → chunk-MCN5VBXX.cjs} +2 -2
  24. package/dist/tsup/chunk-MCN5VBXX.cjs.map +1 -0
  25. package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -1
  26. package/dist/tsup/{chunk-G66RAENX.cjs → chunk-OASP62X2.cjs} +3 -3
  27. package/dist/tsup/chunk-OASP62X2.cjs.map +1 -0
  28. package/dist/tsup/{chunk-I3OXZILZ.js → chunk-PTBC6LFA.js} +5 -3
  29. package/dist/tsup/{chunk-I3OXZILZ.js.map → chunk-PTBC6LFA.js.map} +1 -1
  30. package/dist/tsup/chunk-UEULFXUI.cjs.map +1 -1
  31. package/dist/tsup/{chunk-7N4PSYCJ.js → chunk-Y7JRYLOM.js} +2 -2
  32. package/dist/tsup/{chunk-7N4PSYCJ.js.map → chunk-Y7JRYLOM.js.map} +1 -1
  33. package/dist/tsup/{chunk-VAG7L6N3.cjs → chunk-YNK7OLSV.cjs} +7 -7
  34. package/dist/tsup/chunk-YNK7OLSV.cjs.map +1 -0
  35. package/dist/tsup/{chunk-ZI6TSSI4.js → chunk-YTOYKXNW.js} +3 -3
  36. package/dist/tsup/client/mod.cjs +5 -5
  37. package/dist/tsup/client/mod.cjs.map +1 -1
  38. package/dist/tsup/client/mod.js +4 -4
  39. package/dist/tsup/common/log.cjs +2 -2
  40. package/dist/tsup/common/log.cjs.map +1 -1
  41. package/dist/tsup/common/log.js +1 -1
  42. package/dist/tsup/common/websocket.cjs +3 -3
  43. package/dist/tsup/common/websocket.cjs.map +1 -1
  44. package/dist/tsup/common/websocket.js +2 -2
  45. package/dist/tsup/db/drizzle.cjs +2 -2
  46. package/dist/tsup/db/drizzle.cjs.map +1 -1
  47. package/dist/tsup/db/drizzle.js +1 -1
  48. package/dist/tsup/db/mod.cjs +2 -2
  49. package/dist/tsup/db/mod.cjs.map +1 -1
  50. package/dist/tsup/db/mod.js +1 -1
  51. package/dist/tsup/dynamic/mod.cjs.map +1 -1
  52. package/dist/tsup/inspector/mod.cjs +4 -4
  53. package/dist/tsup/inspector/mod.cjs.map +1 -1
  54. package/dist/tsup/inspector/mod.d.cts +19 -17
  55. package/dist/tsup/inspector/mod.d.ts +19 -17
  56. package/dist/tsup/inspector/mod.js +3 -3
  57. package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
  58. package/dist/tsup/mod.cjs +67 -67
  59. package/dist/tsup/mod.cjs.map +1 -1
  60. package/dist/tsup/mod.js +6 -6
  61. package/dist/tsup/mod.js.map +1 -1
  62. package/dist/tsup/test/mod.cjs +6 -6
  63. package/dist/tsup/test/mod.cjs.map +1 -1
  64. package/dist/tsup/test/mod.js +4 -4
  65. package/dist/tsup/unstable/migrations.cjs.map +1 -1
  66. package/dist/tsup/utils.cjs +2 -2
  67. package/dist/tsup/utils.cjs.map +1 -1
  68. package/dist/tsup/utils.js +1 -1
  69. package/dist/tsup/workflow/mod.cjs +6 -6
  70. package/dist/tsup/workflow/mod.cjs.map +1 -1
  71. package/dist/tsup/workflow/mod.js +3 -3
  72. package/package.json +14 -9
  73. package/src/common/inspector-transport.ts +12 -2
  74. package/src/registry/native.ts +20 -8
  75. package/src/workflow/inspector.ts +9 -13
  76. package/dist/tsup/chunk-3BQTLF6T.cjs.map +0 -1
  77. package/dist/tsup/chunk-3WCNDXDU.cjs.map +0 -1
  78. package/dist/tsup/chunk-DD4HSOMO.cjs.map +0 -1
  79. package/dist/tsup/chunk-G66RAENX.cjs.map +0 -1
  80. package/dist/tsup/chunk-RRVTP46R.cjs.map +0 -1
  81. package/dist/tsup/chunk-TP5MGPLS.js.map +0 -1
  82. package/dist/tsup/chunk-VAG7L6N3.cjs.map +0 -1
  83. /package/dist/tsup/{chunk-5KLTIO35.js.map → chunk-6IZF6OM2.js.map} +0 -0
  84. /package/dist/tsup/{chunk-S26YGW4T.js.map → chunk-J6E7BTKN.js.map} +0 -0
  85. /package/dist/tsup/{chunk-ZI6TSSI4.js.map → chunk-YTOYKXNW.js.map} +0 -0
@@ -48,7 +48,10 @@ import type { AnyDatabaseProvider } from "@/common/database/config";
48
48
  import { wrapJsNativeDatabase } from "@/common/database/native-database";
49
49
  import { assertJsonCompatValue, type JsonCompatValue } from "@/common/encoding";
50
50
  import { isResponseLike, type ResponseLike } from "@/common/fetch-like";
51
- import { decodeWorkflowHistoryTransport } from "@/common/inspector-transport";
51
+ import {
52
+ decodeWorkflowHistoryTransport,
53
+ type WorkflowHistoryBytes,
54
+ } from "@/common/inspector-transport";
52
55
  import { deconstructError, stringifyError } from "@/common/utils";
53
56
  import type {
54
57
  RivetCloseEvent,
@@ -64,7 +67,7 @@ import type {
64
67
  SqliteBackend,
65
68
  } from "@/registry/config";
66
69
  import { decodeCborCompat, encodeCborCompat } from "@/serde";
67
- import { getEnvUniversal, VERSION } from "@/utils";
70
+ import { getEnvUniversal, toUint8Array, VERSION } from "@/utils";
68
71
  import {
69
72
  getNodeFsSync,
70
73
  getNodePath,
@@ -677,7 +680,15 @@ function decodeValue<T>(value?: RuntimeBytes | null): T {
677
680
  return decodeCborCompat(value);
678
681
  }
679
682
 
680
- function encodeValue(value: unknown): RuntimeBytes {
683
+ // Rejects `WorkflowHistoryBytes`: the compat layer rewrites an ArrayBuffer as
684
+ // `["$ArrayBuffer", "<base64>"]`, and the inspector wire field carries raw BARE.
685
+ // The conditional distributes, so it catches the branded type on its own but
686
+ // only strips it from a union that also has other members. A non-distributive
687
+ // `[T] extends [...]` resolves to `never` for the `any` arguments this takes
688
+ // elsewhere, so the union case stays uncovered.
689
+ function encodeValue<T>(
690
+ value: T extends WorkflowHistoryBytes ? never : T,
691
+ ): RuntimeBytes {
681
692
  return encodeCborCompat(value as JsonCompatValue);
682
693
  }
683
694
 
@@ -769,9 +780,10 @@ function callNativeSync<T>(invoke: () => T): T {
769
780
  }
770
781
  }
771
782
 
772
- type NativeWorkflowInspectorConfig = WorkflowInspectorConfig<ArrayBuffer> & {
773
- getState?: () => Promise<unknown> | unknown;
774
- };
783
+ type NativeWorkflowInspectorConfig =
784
+ WorkflowInspectorConfig<WorkflowHistoryBytes> & {
785
+ getState?: () => Promise<unknown> | unknown;
786
+ };
775
787
 
776
788
  function isClosedTaskRegistrationError(error: unknown): boolean {
777
789
  const metadata = error instanceof RivetError ? error.metadata : undefined;
@@ -4816,7 +4828,7 @@ export function buildNativeFactory(
4816
4828
  getNativeWorkflowInspector(ctx)?.getHistory();
4817
4829
  return history == null
4818
4830
  ? undefined
4819
- : encodeValue(history);
4831
+ : toUint8Array(history);
4820
4832
  },
4821
4833
  )
4822
4834
  : undefined,
@@ -4846,7 +4858,7 @@ export function buildNativeFactory(
4846
4858
  )) ?? null;
4847
4859
  return history == null
4848
4860
  ? undefined
4849
- : encodeValue(history);
4861
+ : toUint8Array(history);
4850
4862
  },
4851
4863
  )
4852
4864
  : undefined,
@@ -10,14 +10,14 @@ import type {
10
10
  WorkflowHistorySnapshot,
11
11
  WorkflowState,
12
12
  } from "@rivetkit/workflow-engine";
13
- import type * as inspectorSchema from "@/common/bare/generated/inspector/v4";
14
13
  import * as transport from "@/common/bare/transport/v1";
15
14
  import type { JsonCompatValue } from "@/common/encoding";
15
+ import type { WorkflowHistoryBytes } from "@/common/inspector-transport";
16
16
  import { encodeWorkflowHistoryTransport } from "@/common/inspector-transport";
17
17
  import { encodeCborCompat } from "@/serde";
18
18
  import { assertUnreachable, bufferToArrayBuffer } from "@/utils";
19
19
 
20
- type HistoryListener = (history: inspectorSchema.WorkflowHistory) => void;
20
+ type HistoryListener = (history: WorkflowHistoryBytes) => void;
21
21
 
22
22
  function createHistoryEmitter() {
23
23
  const listeners = new Set<HistoryListener>();
@@ -27,7 +27,7 @@ function createHistoryEmitter() {
27
27
  listeners.add(listener);
28
28
  return () => listeners.delete(listener);
29
29
  },
30
- emit: (history: inspectorSchema.WorkflowHistory) => {
30
+ emit: (history: WorkflowHistoryBytes) => {
31
31
  for (const listener of listeners) {
32
32
  listener(history);
33
33
  }
@@ -36,14 +36,12 @@ function createHistoryEmitter() {
36
36
  }
37
37
 
38
38
  export interface WorkflowInspectorAdapter {
39
- getHistory: () => inspectorSchema.WorkflowHistory | null;
39
+ getHistory: () => WorkflowHistoryBytes | null;
40
40
  getState: () => Promise<WorkflowState | null>;
41
41
  onHistoryUpdated: (
42
- listener: (history: inspectorSchema.WorkflowHistory) => void,
42
+ listener: (history: WorkflowHistoryBytes) => void,
43
43
  ) => () => void;
44
- replayFromStep: (
45
- entryId?: string,
46
- ) => Promise<inspectorSchema.WorkflowHistory | null>;
44
+ replayFromStep: (entryId?: string) => Promise<WorkflowHistoryBytes | null>;
47
45
  }
48
46
 
49
47
  export function createWorkflowInspectorAdapter(): {
@@ -51,17 +49,15 @@ export function createWorkflowInspectorAdapter(): {
51
49
  update: (snapshot: WorkflowHistorySnapshot) => void;
52
50
  setGetState: (fn: () => Promise<WorkflowState | null>) => void;
53
51
  setReplayFromStep: (
54
- fn: (
55
- entryId?: string,
56
- ) => Promise<inspectorSchema.WorkflowHistory | null>,
52
+ fn: (entryId?: string) => Promise<WorkflowHistoryBytes | null>,
57
53
  ) => void;
58
54
  } {
59
55
  const emitter = createHistoryEmitter();
60
- let history: inspectorSchema.WorkflowHistory | null = null;
56
+ let history: WorkflowHistoryBytes | null = null;
61
57
  let getState: () => Promise<WorkflowState | null> = async () => null;
62
58
  let replayFromStep: (
63
59
  entryId?: string,
64
- ) => Promise<inspectorSchema.WorkflowHistory | null> = async () => {
60
+ ) => Promise<WorkflowHistoryBytes | null> = async () => {
65
61
  throw new Error("Workflow replay controls are not initialized");
66
62
  };
67
63