bitfab 0.54.11 → 0.54.13

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 (36) hide show
  1. package/dist/autoTrace.cjs +0 -19
  2. package/dist/autoTrace.cjs.map +1 -1
  3. package/dist/autoTrace.d.cts +1 -3
  4. package/dist/autoTrace.d.ts +1 -3
  5. package/dist/autoTrace.js +1 -5
  6. package/dist/{chunk-G4LWALQ7.js → chunk-FZNRSEMN.js} +2 -2
  7. package/dist/{chunk-2C7M3Y3H.js → chunk-KPALXSAF.js} +3 -3
  8. package/dist/{chunk-MEJOPEKV.js → chunk-Q7HDNYYY.js} +65 -60
  9. package/dist/chunk-Q7HDNYYY.js.map +1 -0
  10. package/dist/{chunk-EGWJYCNT.js → chunk-RCHSYWKI.js} +2 -19
  11. package/dist/chunk-RCHSYWKI.js.map +1 -0
  12. package/dist/{chunk-RUBVHBIK.js → chunk-VW7MA7DS.js} +2 -8
  13. package/dist/{chunk-RUBVHBIK.js.map → chunk-VW7MA7DS.js.map} +1 -1
  14. package/dist/{chunk-FMUJONTQ.js → chunk-YKOD4GWI.js} +2 -9
  15. package/dist/{chunk-FMUJONTQ.js.map → chunk-YKOD4GWI.js.map} +1 -1
  16. package/dist/{http-AXPT27DO.js → http-42KAFBUN.js} +2 -2
  17. package/dist/{http-JQN2LHHF.js → http-7PF6XCJR.js} +2 -2
  18. package/dist/index.cjs +59 -73
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +20 -21
  21. package/dist/index.d.ts +20 -21
  22. package/dist/index.js +4 -4
  23. package/dist/node.cjs +59 -73
  24. package/dist/node.cjs.map +1 -1
  25. package/dist/node.js +4 -4
  26. package/dist/{replay-DOG4KV7I.js → replay-5RHBDIEK.js} +3 -3
  27. package/dist/replayCli.js +2 -2
  28. package/dist/seedCli.js +2 -2
  29. package/package.json +1 -1
  30. package/dist/chunk-EGWJYCNT.js.map +0 -1
  31. package/dist/chunk-MEJOPEKV.js.map +0 -1
  32. /package/dist/{chunk-G4LWALQ7.js.map → chunk-FZNRSEMN.js.map} +0 -0
  33. /package/dist/{chunk-2C7M3Y3H.js.map → chunk-KPALXSAF.js.map} +0 -0
  34. /package/dist/{http-AXPT27DO.js.map → http-42KAFBUN.js.map} +0 -0
  35. /package/dist/{http-JQN2LHHF.js.map → http-7PF6XCJR.js.map} +0 -0
  36. /package/dist/{replay-DOG4KV7I.js.map → replay-5RHBDIEK.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-FMUJONTQ.js";
9
+ } from "./chunk-YKOD4GWI.js";
10
10
  import "./chunk-VCRFFCLY.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-AXPT27DO.js.map
20
+ //# sourceMappingURL=http-42KAFBUN.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-RUBVHBIK.js";
9
+ } from "./chunk-VW7MA7DS.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-JQN2LHHF.js.map
19
+ //# sourceMappingURL=http-7PF6XCJR.js.map
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ var __version__, __packageName__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.54.11";
54
+ __version__ = "0.54.13";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -2666,12 +2666,6 @@ var init_http = __esm({
2666
2666
  async lookupFunction(name) {
2667
2667
  return this.request("/api/sdk/functions/lookup", { name });
2668
2668
  }
2669
- async getAutoTracePolicy(traceFunctionKey, protocol) {
2670
- return this.request("/api/sdk/auto-trace/policy", {
2671
- traceFunctionKey,
2672
- protocol
2673
- });
2674
- }
2675
2669
  async getSimulationPlan() {
2676
2670
  return this.get(
2677
2671
  "/api/sdk/sim-plan",
@@ -5195,21 +5189,6 @@ function currentAutoTraceScope() {
5195
5189
  initializeAutoTraceStorage();
5196
5190
  return autoTraceState.storage?.getStore() ?? autoTraceState.browserScope;
5197
5191
  }
5198
- function __setBitfabAutoTraceCapturePolicy(client, traceFunctionKey, functionIds) {
5199
- const policies = autoTraceState.capturePolicies.get(client) ?? /* @__PURE__ */ new Map();
5200
- if (functionIds === void 0) {
5201
- policies.delete(traceFunctionKey);
5202
- if (policies.size === 0) {
5203
- autoTraceState.capturePolicies.delete(client);
5204
- }
5205
- return;
5206
- }
5207
- policies.set(traceFunctionKey, new Set(functionIds));
5208
- autoTraceState.capturePolicies.set(client, policies);
5209
- }
5210
- function getAutoTraceCapturePolicy(client, traceFunctionKey) {
5211
- return autoTraceState.capturePolicies.get(client)?.get(traceFunctionKey);
5212
- }
5213
5192
 
5214
5193
  // src/optionalPeer.ts
5215
5194
  function importOptionalPeer(specifierParts) {
@@ -7058,7 +7037,6 @@ function openAiAgentsParentSpanId(bitfabTraceId, enclosingSpanIds) {
7058
7037
  }
7059
7038
 
7060
7039
  // src/client.ts
7061
- init_policyRefresh();
7062
7040
  init_randomUuid();
7063
7041
  init_replay();
7064
7042
 
@@ -7206,18 +7184,42 @@ var RIVET_TOP_LEVEL_EFFECTS = [
7206
7184
  "broadcast",
7207
7185
  "saveState",
7208
7186
  "sleep",
7209
- "destroy"
7187
+ "destroy",
7188
+ "step",
7189
+ "tryStep",
7190
+ "try",
7191
+ "loop",
7192
+ "sleepUntil",
7193
+ "rollbackCheckpoint",
7194
+ "join",
7195
+ "race",
7196
+ "removed",
7197
+ "getVersion"
7210
7198
  ];
7211
7199
  var TOP_LEVEL_UNAVAILABLE_CAPABILITIES = /* @__PURE__ */ new Set([
7212
7200
  "conn",
7213
7201
  "conns",
7214
- "log",
7215
7202
  "request",
7216
7203
  "actorRuntimeSocket",
7217
7204
  "keepAwake",
7218
7205
  "waitUntil",
7219
7206
  "client"
7220
7207
  ]);
7208
+ var replayLog = () => void 0;
7209
+ var replayLogger = {
7210
+ level: "silent",
7211
+ msgPrefix: void 0,
7212
+ fatal: replayLog,
7213
+ trace: replayLog,
7214
+ silent: replayLog,
7215
+ debug: replayLog,
7216
+ info: replayLog,
7217
+ warn: replayLog,
7218
+ error: replayLog,
7219
+ child: () => replayLogger,
7220
+ bindings: () => ({}),
7221
+ isLevelEnabled: () => false
7222
+ };
7221
7223
  var SYNC_VOID_EFFECTS = /* @__PURE__ */ new Set([
7222
7224
  "broadcast",
7223
7225
  "sleep",
@@ -7247,16 +7249,28 @@ function snapshotContext(context) {
7247
7249
  "state",
7248
7250
  "vars",
7249
7251
  "actorId",
7252
+ "workflowId",
7250
7253
  "name",
7251
7254
  "key",
7252
- "region",
7253
- "aborted"
7255
+ "region"
7254
7256
  ]) {
7255
7257
  const value = readProperty(source, property);
7256
7258
  if (value !== void 0) {
7257
7259
  snapshot[property] = value;
7258
7260
  }
7259
7261
  }
7262
+ const aborted = readProperty(source, "aborted");
7263
+ if (typeof aborted === "boolean") {
7264
+ snapshot.aborted = aborted;
7265
+ } else {
7266
+ const abortSignal = readProperty(source, "abortSignal");
7267
+ if (isRecord5(abortSignal)) {
7268
+ const signalAborted = readProperty(abortSignal, "aborted");
7269
+ if (typeof signalAborted === "boolean") {
7270
+ snapshot.aborted = signalAborted;
7271
+ }
7272
+ }
7273
+ }
7260
7274
  return snapshot;
7261
7275
  }
7262
7276
  function unavailableCapability(path) {
@@ -7348,7 +7362,8 @@ var BitfabRivetIntegration = class {
7348
7362
  }
7349
7363
  /**
7350
7364
  * Adapt a traced function into a Rivet handler whose first argument is the
7351
- * live actor context. The context is not added to the traced root's inputs.
7365
+ * live actor or workflow context. The context is not added to the traced
7366
+ * root's inputs.
7352
7367
  */
7353
7368
  bind(fn) {
7354
7369
  const integration = this;
@@ -7359,7 +7374,8 @@ var BitfabRivetIntegration = class {
7359
7374
  /**
7360
7375
  * Return the current Rivet context proxy. In production it delegates to the
7361
7376
  * bound live context. During replay it hydrates recorded actor state and
7362
- * intercepts supported effects without requiring a live Rivet actor.
7377
+ * intercepts supported effects without requiring a live Rivet actor or
7378
+ * workflow.
7363
7379
  */
7364
7380
  getContext() {
7365
7381
  const replay2 = getReplayContext();
@@ -7443,6 +7459,12 @@ var BitfabRivetIntegration = class {
7443
7459
  if (property === "setPreventSleep" && replay2) {
7444
7460
  return (_preventSleep) => void 0;
7445
7461
  }
7462
+ if (property === "isEvicted" && replay2) {
7463
+ return () => replayTarget.abortSignal?.aborted === true;
7464
+ }
7465
+ if (property === "log" && replay2) {
7466
+ return replayLogger;
7467
+ }
7446
7468
  if (replay2 && typeof property === "string" && TOP_LEVEL_UNAVAILABLE_CAPABILITIES.has(property)) {
7447
7469
  throw unavailableCapability(property);
7448
7470
  }
@@ -7616,7 +7638,7 @@ var BitfabRivetIntegration = class {
7616
7638
  return { ...value, complete };
7617
7639
  }
7618
7640
  queueCallIsCompletable(effect, args) {
7619
- const options = effect === "queue.waitForNames" ? args[1] : args[0];
7641
+ const options = effect === "queue.waitForNames" || (effect === "queue.next" || effect === "queue.nextBatch") && typeof args[0] === "string" ? args[1] : args[0];
7620
7642
  return isRecord5(options) && options.completable === true;
7621
7643
  }
7622
7644
  createQueueIterator(queue, options) {
@@ -8598,8 +8620,6 @@ function readBooleanEnv(name) {
8598
8620
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
8599
8621
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
8600
8622
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
8601
- var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
8602
- var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
8603
8623
  function spanOwnerName(receiver) {
8604
8624
  if (typeof receiver === "function") {
8605
8625
  return receiver.name !== "" ? receiver.name : void 0;
@@ -8632,7 +8652,6 @@ var Bitfab = class {
8632
8652
  constructor(config) {
8633
8653
  /** Gate the empty-key warning to fire at most once. */
8634
8654
  this.apiKeyWarned = false;
8635
- this.autoTracePolicyRefreshes = /* @__PURE__ */ new Map();
8636
8655
  /**
8637
8656
  * Mock overrides registered via {@link Bitfab.registerMockOverride}, applied
8638
8657
  * to every `replay` on this client (after any per-call `mockOverride`). In
@@ -8681,12 +8700,12 @@ var Bitfab = class {
8681
8700
  *
8682
8701
  * Build instrumentation turns repository functions called beneath this
8683
8702
  * method into nested spans that capture inputs, outputs, and errors by
8684
- * default. A confirmed capture policy can narrow rich capture to selected
8685
- * function IDs.
8703
+ * default. Source exclusions and sim-plan capture-off decisions are explicit
8704
+ * opt-outs from that default.
8686
8705
  * Without a compatible build transform, this still records the decorated
8687
8706
  * method as a normal rich root span but cannot discover child calls.
8688
8707
  *
8689
- * @param traceFunctionKey - Groups traces and their capture policy.
8708
+ * @param traceFunctionKey - Groups traces and their capture controls.
8690
8709
  * @param options - Root presentation, subtree bounds, and exclusions.
8691
8710
  * @experimental Automatic child-call instrumentation is experimental.
8692
8711
  */
@@ -8844,11 +8863,6 @@ var Bitfab = class {
8844
8863
  traceFunctionKey,
8845
8864
  spanOptions,
8846
8865
  function(...args) {
8847
- const capturePolicy = getAutoTraceCapturePolicy(
8848
- self,
8849
- traceFunctionKey
8850
- );
8851
- self.refreshAutoTraceCapturePolicy(traceFunctionKey);
8852
8866
  self.simulationPlan.refresh();
8853
8867
  let spansUsed = 0;
8854
8868
  let truncated = false;
@@ -8928,7 +8942,7 @@ var Bitfab = class {
8928
8942
  surface: "opt-out",
8929
8943
  instrumentation: "trace",
8930
8944
  functionId: definition.id,
8931
- captureContent: nodeConfiguration !== void 0 || capturePolicy === void 0 || capturePolicy.has(definition.id),
8945
+ captureContent: true,
8932
8946
  autoTraceDefinition: definition,
8933
8947
  ...nodeConfiguration?.testRunId !== void 0 && {
8934
8948
  testRunId: nodeConfiguration.testRunId
@@ -9027,34 +9041,6 @@ var Bitfab = class {
9027
9041
  applySimulationPlan(payload, submit) {
9028
9042
  this.simulationPlan.send(payload, rootTraceFunctionKeyOf(payload), submit);
9029
9043
  }
9030
- refreshAutoTraceCapturePolicy(traceFunctionKey) {
9031
- const state2 = this.autoTracePolicyRefreshes.get(traceFunctionKey) ?? new PolicyRefresh();
9032
- this.autoTracePolicyRefreshes.set(traceFunctionKey, state2);
9033
- state2.run(
9034
- () => this.httpClient.getAutoTracePolicy(
9035
- traceFunctionKey,
9036
- AUTO_TRACE_PROTOCOL
9037
- ),
9038
- (policy) => {
9039
- if (policy.protocol !== AUTO_TRACE_PROTOCOL) {
9040
- state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
9041
- return;
9042
- }
9043
- const functionIds = Array.isArray(policy.functionIds) ? policy.functionIds.filter(
9044
- (id) => typeof id === "string" && id.startsWith(`${AUTO_TRACE_PROTOCOL}:`)
9045
- ).slice(0, DEFAULT_AUTO_TRACE_MAX_SPANS) : [];
9046
- __setBitfabAutoTraceCapturePolicy(
9047
- this,
9048
- traceFunctionKey,
9049
- policy.revision === null ? void 0 : functionIds
9050
- );
9051
- state2.hold(AUTO_TRACE_POLICY_REFRESH_MS);
9052
- },
9053
- () => {
9054
- state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
9055
- }
9056
- );
9057
- }
9058
9044
  /**
9059
9045
  * Flush and permanently close this client's tracing resources: its pending
9060
9046
  * requests and the single span-transport worker shared by its decorators and
@@ -9357,9 +9343,9 @@ var Bitfab = class {
9357
9343
  });
9358
9344
  }
9359
9345
  /**
9360
- * Get the first-class Rivet actor-context integration for an existing trace
9361
- * root. The integration binds context and records effect spans; it never
9362
- * creates another root.
9346
+ * Get the first-class Rivet actor/workflow-context integration for an
9347
+ * existing trace root. The integration binds context and records effect
9348
+ * spans; it never creates another root.
9363
9349
  *
9364
9350
  * @param traceFunctionKey - Key used by the enclosing `withTrace()` root
9365
9351
  * @param options - Explicit per-context-path replay mocking policy