bitfab 0.28.1 → 0.28.3

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.
package/dist/index.cjs CHANGED
@@ -360,7 +360,7 @@ function buildMockTree(rootNode) {
360
360
  function walk(node) {
361
361
  const key = node.traceFunctionKey;
362
362
  if (key) {
363
- const name = node.spanName;
363
+ const name = node.spanName || key;
364
364
  const counterKey = `${key}:${name}`;
365
365
  const index = counters.get(counterKey) ?? 0;
366
366
  counters.set(counterKey, index + 1);
@@ -653,7 +653,7 @@ __export(index_exports, {
653
653
  module.exports = __toCommonJS(index_exports);
654
654
 
655
655
  // src/version.generated.ts
656
- var __version__ = "0.28.1";
656
+ var __version__ = "0.28.3";
657
657
 
658
658
  // src/constants.ts
659
659
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -966,7 +966,7 @@ var HttpClient = class {
966
966
  }
967
967
  /**
968
968
  * Start a replay session by fetching historical traces.
969
- * Blocking call creates a test run and returns lightweight item references.
969
+ * Blocking call - creates a test run and returns lightweight item references.
970
970
  */
971
971
  async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId) {
972
972
  const payload = { traceFunctionKey };
@@ -1084,7 +1084,7 @@ var HttpClient = class {
1084
1084
  }
1085
1085
  /**
1086
1086
  * Ask the server to materialize a per-trace DB branch lease from a
1087
- * captured `dbSnapshotRef`. Blocking the resolver creates a Neon
1087
+ * captured `dbSnapshotRef`. Blocking - the resolver creates a Neon
1088
1088
  * snapshot + preview branch and polls operations to readiness, which
1089
1089
  * can take seconds.
1090
1090
  */
@@ -1224,7 +1224,7 @@ var BitfabClaudeAgentHandler = class {
1224
1224
  // Synthetic root span (handler-only replay). When an `input` is supplied to
1225
1225
  // wrapQuery/wrapResponse, the handler emits a root `agent` span carrying that
1226
1226
  // input, so a handler-instrumented run is replayable WITHOUT an enclosing
1227
- // withSpan matching the LangGraph handler, which records the graph input as
1227
+ // withSpan - matching the LangGraph handler, which records the graph input as
1228
1228
  // its root. The prompt is not present anywhere in the message stream, so it
1229
1229
  // must be handed in explicitly.
1230
1230
  this.hasRootInput = false;
@@ -1498,7 +1498,7 @@ var BitfabClaudeAgentHandler = class {
1498
1498
  * SDK's `wrapResponse` (which wraps `ClaudeSDKClient.receiveResponse()`);
1499
1499
  * in TypeScript, prefer `wrapQuery` around `query()`.
1500
1500
  *
1501
- * Pass `{ input }` (the prompt) to record a replayable root span see
1501
+ * Pass `{ input }` (the prompt) to record a replayable root span - see
1502
1502
  * `wrapQuery`.
1503
1503
  */
1504
1504
  async *wrapResponse(stream, opts) {
@@ -1511,8 +1511,8 @@ var BitfabClaudeAgentHandler = class {
1511
1511
  * Tool and subagent spans are captured separately via the hooks injected
1512
1512
  * by `instrumentOptions` into the `options` passed to `query()`.
1513
1513
  *
1514
- * Pass `{ input }` the prompt (or the serializable args that produced it)
1515
- * to make a handler-only run replayable: the handler records a root `agent`
1514
+ * Pass `{ input }` - the prompt (or the serializable args that produced it)
1515
+ * - to make a handler-only run replayable: the handler records a root `agent`
1516
1516
  * span with that input, so `replay(key, fn)` can re-feed it. Omit it only
1517
1517
  * when an enclosing `withSpan` already supplies the replayable root.
1518
1518
  *
@@ -2624,7 +2624,7 @@ var BitfabOpenAIAgentHandler = class {
2624
2624
  * argument, so `replay(key, fn)` re-feeds it), and the run's `finalOutput`
2625
2625
  * is recorded as the root output. For streaming runs (`{ stream: true }`),
2626
2626
  * the result is handed back immediately and the final output is recorded
2627
- * once the stream completes first-byte latency is untouched.
2627
+ * once the stream completes - first-byte latency is untouched.
2628
2628
  *
2629
2629
  * The process-wide tracing processor (`getOpenAiTracingProcessor`) must still
2630
2630
  * be registered: it captures the LLM/tool/handoff spans that nest beneath
@@ -2717,7 +2717,7 @@ var ReplayEnvironment = class {
2717
2717
  }
2718
2718
  /**
2719
2719
  * Record on the replay context that customer code obtained the branch
2720
- * URL. Only `databaseUrl` and `snapshot()` count `active`, `readOnly`
2720
+ * URL. Only `databaseUrl` and `snapshot()` count - `active`, `readOnly`
2721
2721
  * and friends inspect the lease without exposing the connection string,
2722
2722
  * so they don't prove the replayed code could have connected to the
2723
2723
  * branch.
@@ -3442,7 +3442,7 @@ var Bitfab = class {
3442
3442
  if (this.explicitlyEnabled && !this.apiKeyWarned) {
3443
3443
  this.apiKeyWarned = true;
3444
3444
  console.warn(
3445
- "Bitfab: apiKey is empty \u2014 tracing is disabled. Provide a valid API key to enable tracing."
3445
+ "Bitfab: apiKey is empty - tracing is disabled. Provide a valid API key to enable tracing."
3446
3446
  );
3447
3447
  }
3448
3448
  return void 0;
@@ -3706,7 +3706,7 @@ var Bitfab = class {
3706
3706
  * Wrap a BAML client method to automatically capture prompt and LLM metadata.
3707
3707
  *
3708
3708
  * Creates a BAML Collector, calls the method through a tracked client,
3709
- * then extracts rendered messages and token usage calling setPrompt()
3709
+ * then extracts rendered messages and token usage - calling setPrompt()
3710
3710
  * and addContext() on the current span automatically.
3711
3711
  *
3712
3712
  * The BAML client can be provided in the constructor or passed explicitly:
@@ -4093,7 +4093,7 @@ var Bitfab = class {
4093
4093
  * Get a detached handle to a previously-created trace, looked up by the
4094
4094
  * caller-supplied id (the same id passed at trace creation).
4095
4095
  *
4096
- * The returned handle is not tied to AsyncLocalStorage each method sends
4096
+ * The returned handle is not tied to AsyncLocalStorage - each method sends
4097
4097
  * to the server immediately. Useful for adding context to a trace from a
4098
4098
  * different process or thread than the one that created it.
4099
4099
  *
@@ -4274,7 +4274,7 @@ var Bitfab = class {
4274
4274
  * plain callable: plain callables are wrapped internally so each replayed
4275
4275
  * invocation records a trace tied to the test run. The plain-callable form
4276
4276
  * is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
4277
- * SDK) replay those record traces under a key with no `withSpan`-wrapped
4277
+ * SDK) replay - those record traces under a key with no `withSpan`-wrapped
4278
4278
  * root in the app.
4279
4279
  *
4280
4280
  * @param traceFunctionKey - The trace function key to replay
@@ -4426,7 +4426,7 @@ var BitfabFunction = class {
4426
4426
  return this.client.getLangGraphCallbackHandler(this.traceFunctionKey);
4427
4427
  }
4428
4428
  /**
4429
- * Alias of {@link getLangGraphCallbackHandler} LangChain and LangGraph
4429
+ * Alias of {@link getLangGraphCallbackHandler} - LangChain and LangGraph
4430
4430
  * share one callback system, so the same bound handler serves both.
4431
4431
  *
4432
4432
  * @returns A LangChain callback handler for this client and key
@@ -4441,7 +4441,7 @@ var BitfabFunction = class {
4441
4441
  * Unlike the other methods on this handle, `wrapBAML` does NOT use the bound
4442
4442
  * key: it opens no span of its own. It enriches the *current* span (via
4443
4443
  * `getCurrentSpan().setPrompt()` / `addContext()`), so call it inside a
4444
- * function wrapped by this handle's `withSpan` the bound key keys that
4444
+ * function wrapped by this handle's `withSpan` - the bound key keys that
4445
4445
  * wrapper, and the BAML prompt/metadata attach to it.
4446
4446
  *
4447
4447
  * @param methodOrClient - Either a BAML method (uses constructor bamlClient) or the BAML client instance