bitfab 0.54.11 → 0.54.12

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.
@@ -19,7 +19,7 @@ import {
19
19
  serializeValue,
20
20
  toJsonSafe,
21
21
  toJsonSafeReport
22
- } from "./chunk-G4LWALQ7.js";
22
+ } from "./chunk-ZR4HGK6G.js";
23
23
  import {
24
24
  BitfabError,
25
25
  DEFAULT_SERVICE_URL,
@@ -36,7 +36,7 @@ import {
36
36
  recordCallerTraceMetadata,
37
37
  retireTraceMetadata,
38
38
  warnOnce
39
- } from "./chunk-FMUJONTQ.js";
39
+ } from "./chunk-WKXLCFLT.js";
40
40
  import {
41
41
  __privateAdd,
42
42
  __privateGet,
@@ -2653,18 +2653,42 @@ var RIVET_TOP_LEVEL_EFFECTS = [
2653
2653
  "broadcast",
2654
2654
  "saveState",
2655
2655
  "sleep",
2656
- "destroy"
2656
+ "destroy",
2657
+ "step",
2658
+ "tryStep",
2659
+ "try",
2660
+ "loop",
2661
+ "sleepUntil",
2662
+ "rollbackCheckpoint",
2663
+ "join",
2664
+ "race",
2665
+ "removed",
2666
+ "getVersion"
2657
2667
  ];
2658
2668
  var TOP_LEVEL_UNAVAILABLE_CAPABILITIES = /* @__PURE__ */ new Set([
2659
2669
  "conn",
2660
2670
  "conns",
2661
- "log",
2662
2671
  "request",
2663
2672
  "actorRuntimeSocket",
2664
2673
  "keepAwake",
2665
2674
  "waitUntil",
2666
2675
  "client"
2667
2676
  ]);
2677
+ var replayLog = () => void 0;
2678
+ var replayLogger = {
2679
+ level: "silent",
2680
+ msgPrefix: void 0,
2681
+ fatal: replayLog,
2682
+ trace: replayLog,
2683
+ silent: replayLog,
2684
+ debug: replayLog,
2685
+ info: replayLog,
2686
+ warn: replayLog,
2687
+ error: replayLog,
2688
+ child: () => replayLogger,
2689
+ bindings: () => ({}),
2690
+ isLevelEnabled: () => false
2691
+ };
2668
2692
  var SYNC_VOID_EFFECTS = /* @__PURE__ */ new Set([
2669
2693
  "broadcast",
2670
2694
  "sleep",
@@ -2694,16 +2718,28 @@ function snapshotContext(context) {
2694
2718
  "state",
2695
2719
  "vars",
2696
2720
  "actorId",
2721
+ "workflowId",
2697
2722
  "name",
2698
2723
  "key",
2699
- "region",
2700
- "aborted"
2724
+ "region"
2701
2725
  ]) {
2702
2726
  const value = readProperty(source, property);
2703
2727
  if (value !== void 0) {
2704
2728
  snapshot[property] = value;
2705
2729
  }
2706
2730
  }
2731
+ const aborted = readProperty(source, "aborted");
2732
+ if (typeof aborted === "boolean") {
2733
+ snapshot.aborted = aborted;
2734
+ } else {
2735
+ const abortSignal = readProperty(source, "abortSignal");
2736
+ if (isRecord2(abortSignal)) {
2737
+ const signalAborted = readProperty(abortSignal, "aborted");
2738
+ if (typeof signalAborted === "boolean") {
2739
+ snapshot.aborted = signalAborted;
2740
+ }
2741
+ }
2742
+ }
2707
2743
  return snapshot;
2708
2744
  }
2709
2745
  function unavailableCapability(path) {
@@ -2795,7 +2831,8 @@ var BitfabRivetIntegration = class {
2795
2831
  }
2796
2832
  /**
2797
2833
  * Adapt a traced function into a Rivet handler whose first argument is the
2798
- * live actor context. The context is not added to the traced root's inputs.
2834
+ * live actor or workflow context. The context is not added to the traced
2835
+ * root's inputs.
2799
2836
  */
2800
2837
  bind(fn) {
2801
2838
  const integration = this;
@@ -2806,7 +2843,8 @@ var BitfabRivetIntegration = class {
2806
2843
  /**
2807
2844
  * Return the current Rivet context proxy. In production it delegates to the
2808
2845
  * bound live context. During replay it hydrates recorded actor state and
2809
- * intercepts supported effects without requiring a live Rivet actor.
2846
+ * intercepts supported effects without requiring a live Rivet actor or
2847
+ * workflow.
2810
2848
  */
2811
2849
  getContext() {
2812
2850
  const replay = getReplayContext();
@@ -2890,6 +2928,12 @@ var BitfabRivetIntegration = class {
2890
2928
  if (property === "setPreventSleep" && replay) {
2891
2929
  return (_preventSleep) => void 0;
2892
2930
  }
2931
+ if (property === "isEvicted" && replay) {
2932
+ return () => replayTarget.abortSignal?.aborted === true;
2933
+ }
2934
+ if (property === "log" && replay) {
2935
+ return replayLogger;
2936
+ }
2893
2937
  if (replay && typeof property === "string" && TOP_LEVEL_UNAVAILABLE_CAPABILITIES.has(property)) {
2894
2938
  throw unavailableCapability(property);
2895
2939
  }
@@ -3063,7 +3107,7 @@ var BitfabRivetIntegration = class {
3063
3107
  return { ...value, complete };
3064
3108
  }
3065
3109
  queueCallIsCompletable(effect, args) {
3066
- const options = effect === "queue.waitForNames" ? args[1] : args[0];
3110
+ const options = effect === "queue.waitForNames" || (effect === "queue.next" || effect === "queue.nextBatch") && typeof args[0] === "string" ? args[1] : args[0];
3067
3111
  return isRecord2(options) && options.completable === true;
3068
3112
  }
3069
3113
  createQueueIterator(queue, options) {
@@ -4790,9 +4834,9 @@ var Bitfab = class {
4790
4834
  });
4791
4835
  }
4792
4836
  /**
4793
- * Get the first-class Rivet actor-context integration for an existing trace
4794
- * root. The integration binds context and records effect spans; it never
4795
- * creates another root.
4837
+ * Get the first-class Rivet actor/workflow-context integration for an
4838
+ * existing trace root. The integration binds context and records effect
4839
+ * spans; it never creates another root.
4796
4840
  *
4797
4841
  * @param traceFunctionKey - Key used by the enclosing `withTrace()` root
4798
4842
  * @param options - Explicit per-context-path replay mocking policy
@@ -5894,7 +5938,7 @@ var Bitfab = class {
5894
5938
  await runWithSeedContext({ traceId }, async () => target(...args));
5895
5939
  } finally {
5896
5940
  try {
5897
- const { flushTraces: flushTraces2 } = await import("./http-AXPT27DO.js");
5941
+ const { flushTraces: flushTraces2 } = await import("./http-NWSSB5FA.js");
5898
5942
  await flushTraces2(3e4);
5899
5943
  } finally {
5900
5944
  unrecorded = activeTraceStates.delete(traceId);
@@ -5953,7 +5997,7 @@ var Bitfab = class {
5953
5997
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
5954
5998
  );
5955
5999
  }
5956
- const { replay: doReplay } = await import("./replay-DOG4KV7I.js");
6000
+ const { replay: doReplay } = await import("./replay-WB5NQNQS.js");
5957
6001
  return doReplay(
5958
6002
  this.httpClient,
5959
6003
  this.serviceUrl,
@@ -6273,7 +6317,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
6273
6317
  sessionId: seedCase.sessionId
6274
6318
  })
6275
6319
  );
6276
- const { flushTraces: flushTraces2 } = await import("./http-AXPT27DO.js");
6320
+ const { flushTraces: flushTraces2 } = await import("./http-NWSSB5FA.js");
6277
6321
  await flushTraces2(3e4);
6278
6322
  return { pipeline, traceFunctionKey, traceIds };
6279
6323
  }
@@ -6312,4 +6356,4 @@ export {
6312
6356
  reseedFromRegistry,
6313
6357
  seedFromRegistry
6314
6358
  };
6315
- //# sourceMappingURL=chunk-MEJOPEKV.js.map
6359
+ //# sourceMappingURL=chunk-YY5BB2YS.js.map