@bitfab/sdk 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-EG2BK73V.js → chunk-BUGCOUK6.js} +3 -3
  7. package/dist/{chunk-NLJLEF7Q.js → chunk-IOLVW3PT.js} +65 -60
  8. package/dist/chunk-IOLVW3PT.js.map +1 -0
  9. package/dist/{chunk-WEUG3N7A.js → chunk-M7HWCJVO.js} +2 -2
  10. package/dist/{chunk-GQNLAY72.js → chunk-N5T6NDR3.js} +2 -8
  11. package/dist/{chunk-GQNLAY72.js.map → chunk-N5T6NDR3.js.map} +1 -1
  12. package/dist/{chunk-EGWJYCNT.js → chunk-RCHSYWKI.js} +2 -19
  13. package/dist/chunk-RCHSYWKI.js.map +1 -0
  14. package/dist/{chunk-MC2NKYDY.js → chunk-WDSOB57F.js} +2 -9
  15. package/dist/{chunk-MC2NKYDY.js.map → chunk-WDSOB57F.js.map} +1 -1
  16. package/dist/{http-L357FQLN.js → http-4W2BM7GE.js} +2 -2
  17. package/dist/{http-3NVEDIBT.js → http-Y6UGNXSO.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-ZXA5AA2M.js → replay-YJBLRMQD.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-NLJLEF7Q.js.map +0 -1
  32. /package/dist/{chunk-EG2BK73V.js.map → chunk-BUGCOUK6.js.map} +0 -0
  33. /package/dist/{chunk-WEUG3N7A.js.map → chunk-M7HWCJVO.js.map} +0 -0
  34. /package/dist/{http-3NVEDIBT.js.map → http-4W2BM7GE.js.map} +0 -0
  35. /package/dist/{http-L357FQLN.js.map → http-Y6UGNXSO.js.map} +0 -0
  36. /package/dist/{replay-ZXA5AA2M.js.map → replay-YJBLRMQD.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-MC2NKYDY.js";
9
+ } from "./chunk-WDSOB57F.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-L357FQLN.js.map
20
+ //# sourceMappingURL=http-4W2BM7GE.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-GQNLAY72.js";
9
+ } from "./chunk-N5T6NDR3.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-3NVEDIBT.js.map
19
+ //# sourceMappingURL=http-Y6UGNXSO.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.54.11";
45
+ __version__ = "0.54.13";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -2657,12 +2657,6 @@ var init_http = __esm({
2657
2657
  async lookupFunction(name) {
2658
2658
  return this.request("/api/sdk/functions/lookup", { name });
2659
2659
  }
2660
- async getAutoTracePolicy(traceFunctionKey, protocol) {
2661
- return this.request("/api/sdk/auto-trace/policy", {
2662
- traceFunctionKey,
2663
- protocol
2664
- });
2665
- }
2666
2660
  async getSimulationPlan() {
2667
2661
  return this.get(
2668
2662
  "/api/sdk/sim-plan",
@@ -5186,21 +5180,6 @@ function currentAutoTraceScope() {
5186
5180
  initializeAutoTraceStorage();
5187
5181
  return autoTraceState.storage?.getStore() ?? autoTraceState.browserScope;
5188
5182
  }
5189
- function __setBitfabAutoTraceCapturePolicy(client, traceFunctionKey, functionIds) {
5190
- const policies = autoTraceState.capturePolicies.get(client) ?? /* @__PURE__ */ new Map();
5191
- if (functionIds === void 0) {
5192
- policies.delete(traceFunctionKey);
5193
- if (policies.size === 0) {
5194
- autoTraceState.capturePolicies.delete(client);
5195
- }
5196
- return;
5197
- }
5198
- policies.set(traceFunctionKey, new Set(functionIds));
5199
- autoTraceState.capturePolicies.set(client, policies);
5200
- }
5201
- function getAutoTraceCapturePolicy(client, traceFunctionKey) {
5202
- return autoTraceState.capturePolicies.get(client)?.get(traceFunctionKey);
5203
- }
5204
5183
 
5205
5184
  // src/optionalPeer.ts
5206
5185
  function importOptionalPeer(specifierParts) {
@@ -7049,7 +7028,6 @@ function openAiAgentsParentSpanId(bitfabTraceId, enclosingSpanIds) {
7049
7028
  }
7050
7029
 
7051
7030
  // src/client.ts
7052
- init_policyRefresh();
7053
7031
  init_randomUuid();
7054
7032
  init_replay();
7055
7033
 
@@ -7197,18 +7175,42 @@ var RIVET_TOP_LEVEL_EFFECTS = [
7197
7175
  "broadcast",
7198
7176
  "saveState",
7199
7177
  "sleep",
7200
- "destroy"
7178
+ "destroy",
7179
+ "step",
7180
+ "tryStep",
7181
+ "try",
7182
+ "loop",
7183
+ "sleepUntil",
7184
+ "rollbackCheckpoint",
7185
+ "join",
7186
+ "race",
7187
+ "removed",
7188
+ "getVersion"
7201
7189
  ];
7202
7190
  var TOP_LEVEL_UNAVAILABLE_CAPABILITIES = /* @__PURE__ */ new Set([
7203
7191
  "conn",
7204
7192
  "conns",
7205
- "log",
7206
7193
  "request",
7207
7194
  "actorRuntimeSocket",
7208
7195
  "keepAwake",
7209
7196
  "waitUntil",
7210
7197
  "client"
7211
7198
  ]);
7199
+ var replayLog = () => void 0;
7200
+ var replayLogger = {
7201
+ level: "silent",
7202
+ msgPrefix: void 0,
7203
+ fatal: replayLog,
7204
+ trace: replayLog,
7205
+ silent: replayLog,
7206
+ debug: replayLog,
7207
+ info: replayLog,
7208
+ warn: replayLog,
7209
+ error: replayLog,
7210
+ child: () => replayLogger,
7211
+ bindings: () => ({}),
7212
+ isLevelEnabled: () => false
7213
+ };
7212
7214
  var SYNC_VOID_EFFECTS = /* @__PURE__ */ new Set([
7213
7215
  "broadcast",
7214
7216
  "sleep",
@@ -7238,16 +7240,28 @@ function snapshotContext(context) {
7238
7240
  "state",
7239
7241
  "vars",
7240
7242
  "actorId",
7243
+ "workflowId",
7241
7244
  "name",
7242
7245
  "key",
7243
- "region",
7244
- "aborted"
7246
+ "region"
7245
7247
  ]) {
7246
7248
  const value = readProperty(source, property);
7247
7249
  if (value !== void 0) {
7248
7250
  snapshot[property] = value;
7249
7251
  }
7250
7252
  }
7253
+ const aborted = readProperty(source, "aborted");
7254
+ if (typeof aborted === "boolean") {
7255
+ snapshot.aborted = aborted;
7256
+ } else {
7257
+ const abortSignal = readProperty(source, "abortSignal");
7258
+ if (isRecord5(abortSignal)) {
7259
+ const signalAborted = readProperty(abortSignal, "aborted");
7260
+ if (typeof signalAborted === "boolean") {
7261
+ snapshot.aborted = signalAborted;
7262
+ }
7263
+ }
7264
+ }
7251
7265
  return snapshot;
7252
7266
  }
7253
7267
  function unavailableCapability(path) {
@@ -7339,7 +7353,8 @@ var BitfabRivetIntegration = class {
7339
7353
  }
7340
7354
  /**
7341
7355
  * Adapt a traced function into a Rivet handler whose first argument is the
7342
- * live actor context. The context is not added to the traced root's inputs.
7356
+ * live actor or workflow context. The context is not added to the traced
7357
+ * root's inputs.
7343
7358
  */
7344
7359
  bind(fn) {
7345
7360
  const integration = this;
@@ -7350,7 +7365,8 @@ var BitfabRivetIntegration = class {
7350
7365
  /**
7351
7366
  * Return the current Rivet context proxy. In production it delegates to the
7352
7367
  * bound live context. During replay it hydrates recorded actor state and
7353
- * intercepts supported effects without requiring a live Rivet actor.
7368
+ * intercepts supported effects without requiring a live Rivet actor or
7369
+ * workflow.
7354
7370
  */
7355
7371
  getContext() {
7356
7372
  const replay2 = getReplayContext();
@@ -7434,6 +7450,12 @@ var BitfabRivetIntegration = class {
7434
7450
  if (property === "setPreventSleep" && replay2) {
7435
7451
  return (_preventSleep) => void 0;
7436
7452
  }
7453
+ if (property === "isEvicted" && replay2) {
7454
+ return () => replayTarget.abortSignal?.aborted === true;
7455
+ }
7456
+ if (property === "log" && replay2) {
7457
+ return replayLogger;
7458
+ }
7437
7459
  if (replay2 && typeof property === "string" && TOP_LEVEL_UNAVAILABLE_CAPABILITIES.has(property)) {
7438
7460
  throw unavailableCapability(property);
7439
7461
  }
@@ -7607,7 +7629,7 @@ var BitfabRivetIntegration = class {
7607
7629
  return { ...value, complete };
7608
7630
  }
7609
7631
  queueCallIsCompletable(effect, args) {
7610
- const options = effect === "queue.waitForNames" ? args[1] : args[0];
7632
+ const options = effect === "queue.waitForNames" || (effect === "queue.next" || effect === "queue.nextBatch") && typeof args[0] === "string" ? args[1] : args[0];
7611
7633
  return isRecord5(options) && options.completable === true;
7612
7634
  }
7613
7635
  createQueueIterator(queue, options) {
@@ -8589,8 +8611,6 @@ function readBooleanEnv(name) {
8589
8611
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
8590
8612
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
8591
8613
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
8592
- var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
8593
- var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
8594
8614
  function spanOwnerName(receiver) {
8595
8615
  if (typeof receiver === "function") {
8596
8616
  return receiver.name !== "" ? receiver.name : void 0;
@@ -8623,7 +8643,6 @@ var Bitfab = class {
8623
8643
  constructor(config) {
8624
8644
  /** Gate the empty-key warning to fire at most once. */
8625
8645
  this.apiKeyWarned = false;
8626
- this.autoTracePolicyRefreshes = /* @__PURE__ */ new Map();
8627
8646
  /**
8628
8647
  * Mock overrides registered via {@link Bitfab.registerMockOverride}, applied
8629
8648
  * to every `replay` on this client (after any per-call `mockOverride`). In
@@ -8672,12 +8691,12 @@ var Bitfab = class {
8672
8691
  *
8673
8692
  * Build instrumentation turns repository functions called beneath this
8674
8693
  * method into nested spans that capture inputs, outputs, and errors by
8675
- * default. A confirmed capture policy can narrow rich capture to selected
8676
- * function IDs.
8694
+ * default. Source exclusions and sim-plan capture-off decisions are explicit
8695
+ * opt-outs from that default.
8677
8696
  * Without a compatible build transform, this still records the decorated
8678
8697
  * method as a normal rich root span but cannot discover child calls.
8679
8698
  *
8680
- * @param traceFunctionKey - Groups traces and their capture policy.
8699
+ * @param traceFunctionKey - Groups traces and their capture controls.
8681
8700
  * @param options - Root presentation, subtree bounds, and exclusions.
8682
8701
  * @experimental Automatic child-call instrumentation is experimental.
8683
8702
  */
@@ -8835,11 +8854,6 @@ var Bitfab = class {
8835
8854
  traceFunctionKey,
8836
8855
  spanOptions,
8837
8856
  function(...args) {
8838
- const capturePolicy = getAutoTraceCapturePolicy(
8839
- self,
8840
- traceFunctionKey
8841
- );
8842
- self.refreshAutoTraceCapturePolicy(traceFunctionKey);
8843
8857
  self.simulationPlan.refresh();
8844
8858
  let spansUsed = 0;
8845
8859
  let truncated = false;
@@ -8919,7 +8933,7 @@ var Bitfab = class {
8919
8933
  surface: "opt-out",
8920
8934
  instrumentation: "trace",
8921
8935
  functionId: definition.id,
8922
- captureContent: nodeConfiguration !== void 0 || capturePolicy === void 0 || capturePolicy.has(definition.id),
8936
+ captureContent: true,
8923
8937
  autoTraceDefinition: definition,
8924
8938
  ...nodeConfiguration?.testRunId !== void 0 && {
8925
8939
  testRunId: nodeConfiguration.testRunId
@@ -9018,34 +9032,6 @@ var Bitfab = class {
9018
9032
  applySimulationPlan(payload, submit) {
9019
9033
  this.simulationPlan.send(payload, rootTraceFunctionKeyOf(payload), submit);
9020
9034
  }
9021
- refreshAutoTraceCapturePolicy(traceFunctionKey) {
9022
- const state2 = this.autoTracePolicyRefreshes.get(traceFunctionKey) ?? new PolicyRefresh();
9023
- this.autoTracePolicyRefreshes.set(traceFunctionKey, state2);
9024
- state2.run(
9025
- () => this.httpClient.getAutoTracePolicy(
9026
- traceFunctionKey,
9027
- AUTO_TRACE_PROTOCOL
9028
- ),
9029
- (policy) => {
9030
- if (policy.protocol !== AUTO_TRACE_PROTOCOL) {
9031
- state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
9032
- return;
9033
- }
9034
- const functionIds = Array.isArray(policy.functionIds) ? policy.functionIds.filter(
9035
- (id) => typeof id === "string" && id.startsWith(`${AUTO_TRACE_PROTOCOL}:`)
9036
- ).slice(0, DEFAULT_AUTO_TRACE_MAX_SPANS) : [];
9037
- __setBitfabAutoTraceCapturePolicy(
9038
- this,
9039
- traceFunctionKey,
9040
- policy.revision === null ? void 0 : functionIds
9041
- );
9042
- state2.hold(AUTO_TRACE_POLICY_REFRESH_MS);
9043
- },
9044
- () => {
9045
- state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
9046
- }
9047
- );
9048
- }
9049
9035
  /**
9050
9036
  * Flush and permanently close this client's tracing resources: its pending
9051
9037
  * requests and the single span-transport worker shared by its decorators and
@@ -9348,9 +9334,9 @@ var Bitfab = class {
9348
9334
  });
9349
9335
  }
9350
9336
  /**
9351
- * Get the first-class Rivet actor-context integration for an existing trace
9352
- * root. The integration binds context and records effect spans; it never
9353
- * creates another root.
9337
+ * Get the first-class Rivet actor/workflow-context integration for an
9338
+ * existing trace root. The integration binds context and records effect
9339
+ * spans; it never creates another root.
9354
9340
  *
9355
9341
  * @param traceFunctionKey - Key used by the enclosing `withTrace()` root
9356
9342
  * @param options - Explicit per-context-path replay mocking policy