@bitfab/sdk 0.16.0 → 0.16.2

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.d.cts CHANGED
@@ -343,9 +343,9 @@ declare class ReplayEnvironment {
343
343
  type MockStrategy = "none" | "all" | "marked";
344
344
  interface ReplayOptions {
345
345
  /**
346
- * Maximum number of traces to replay (1100, default 5). Mutually
347
- * exclusive with `traceIds` an explicit ID list already determines how
348
- * many traces replay, so passing both throws.
346
+ * Maximum number of traces to replay (1-100, default 5). Ignored when
347
+ * `traceIds` is passed (with a warning): an explicit ID list already
348
+ * determines how many traces replay.
349
349
  */
350
350
  limit?: number;
351
351
  /** Optional list of specific trace IDs to replay (max 100). */
@@ -812,6 +812,22 @@ declare class Bitfab {
812
812
  * @returns A BitfabLangGraphCallbackHandler configured for this client
813
813
  */
814
814
  getLangGraphCallbackHandler(traceFunctionKey: string): BitfabLangGraphCallbackHandler;
815
+ /**
816
+ * Get a LangChain callback handler for tracing.
817
+ *
818
+ * Alias of {@link getLangGraphCallbackHandler}: LangChain chains and
819
+ * LangGraph graphs share the same callback system, so one handler serves
820
+ * both.
821
+ *
822
+ * ```typescript
823
+ * const handler = client.getLangChainCallbackHandler("my-chain");
824
+ * const result = await chain.invoke(input, { callbacks: [handler] });
825
+ * ```
826
+ *
827
+ * @param traceFunctionKey - Groups traces under this key in Bitfab
828
+ * @returns A BitfabLangGraphCallbackHandler configured for this client
829
+ */
830
+ getLangChainCallbackHandler(traceFunctionKey: string): BitfabLangGraphCallbackHandler;
815
831
  /**
816
832
  * Get a Claude Agent SDK handler for tracing.
817
833
  *
@@ -959,9 +975,9 @@ declare class Bitfab {
959
975
  *
960
976
  * @param traceFunctionKey - The trace function key to replay
961
977
  * @param fn - The function to replay (must be the return value of `withSpan`)
962
- * @param options - Optional replay options. `limit` and `traceIds` are
963
- * mutually exclusive an explicit ID list already determines how many
964
- * traces replay, so passing both throws a BitfabError.
978
+ * @param options - Optional replay options. When `traceIds` is passed,
979
+ * `limit` is ignored (with a warning): an explicit ID list already
980
+ * determines how many traces replay.
965
981
  * @returns ReplayResult with items, testRunId, and testRunUrl
966
982
  */
967
983
  replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
@@ -1027,7 +1043,7 @@ declare class BitfabFunction {
1027
1043
  /**
1028
1044
  * SDK version from package.json (injected at build time)
1029
1045
  */
1030
- declare const __version__ = "0.16.0";
1046
+ declare const __version__ = "0.16.2";
1031
1047
 
1032
1048
  /**
1033
1049
  * Constants for the Bitfab SDK.
@@ -1037,4 +1053,4 @@ declare const __version__ = "0.16.0";
1037
1053
  */
1038
1054
  declare const DEFAULT_SERVICE_URL = "https://bitfab.ai";
1039
1055
 
1040
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler, BitfabOpenAITracingProcessor, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockStrategy, type ProviderDefinition, ReplayEnvironment, type ReplayEnvironmentSnapshot, type ReplayItem, type ReplayOptions, type ReplayResult, SUPPORTED_PROVIDERS, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type WrapBAMLOptions, type WrappedBamlFn, __version__, flushTraces, getCurrentSpan, getCurrentTrace };
1056
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabOpenAITracingProcessor, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockStrategy, type ProviderDefinition, ReplayEnvironment, type ReplayEnvironmentSnapshot, type ReplayItem, type ReplayOptions, type ReplayResult, SUPPORTED_PROVIDERS, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type WrapBAMLOptions, type WrappedBamlFn, __version__, flushTraces, getCurrentSpan, getCurrentTrace };
package/dist/index.d.ts CHANGED
@@ -343,9 +343,9 @@ declare class ReplayEnvironment {
343
343
  type MockStrategy = "none" | "all" | "marked";
344
344
  interface ReplayOptions {
345
345
  /**
346
- * Maximum number of traces to replay (1100, default 5). Mutually
347
- * exclusive with `traceIds` an explicit ID list already determines how
348
- * many traces replay, so passing both throws.
346
+ * Maximum number of traces to replay (1-100, default 5). Ignored when
347
+ * `traceIds` is passed (with a warning): an explicit ID list already
348
+ * determines how many traces replay.
349
349
  */
350
350
  limit?: number;
351
351
  /** Optional list of specific trace IDs to replay (max 100). */
@@ -812,6 +812,22 @@ declare class Bitfab {
812
812
  * @returns A BitfabLangGraphCallbackHandler configured for this client
813
813
  */
814
814
  getLangGraphCallbackHandler(traceFunctionKey: string): BitfabLangGraphCallbackHandler;
815
+ /**
816
+ * Get a LangChain callback handler for tracing.
817
+ *
818
+ * Alias of {@link getLangGraphCallbackHandler}: LangChain chains and
819
+ * LangGraph graphs share the same callback system, so one handler serves
820
+ * both.
821
+ *
822
+ * ```typescript
823
+ * const handler = client.getLangChainCallbackHandler("my-chain");
824
+ * const result = await chain.invoke(input, { callbacks: [handler] });
825
+ * ```
826
+ *
827
+ * @param traceFunctionKey - Groups traces under this key in Bitfab
828
+ * @returns A BitfabLangGraphCallbackHandler configured for this client
829
+ */
830
+ getLangChainCallbackHandler(traceFunctionKey: string): BitfabLangGraphCallbackHandler;
815
831
  /**
816
832
  * Get a Claude Agent SDK handler for tracing.
817
833
  *
@@ -959,9 +975,9 @@ declare class Bitfab {
959
975
  *
960
976
  * @param traceFunctionKey - The trace function key to replay
961
977
  * @param fn - The function to replay (must be the return value of `withSpan`)
962
- * @param options - Optional replay options. `limit` and `traceIds` are
963
- * mutually exclusive an explicit ID list already determines how many
964
- * traces replay, so passing both throws a BitfabError.
978
+ * @param options - Optional replay options. When `traceIds` is passed,
979
+ * `limit` is ignored (with a warning): an explicit ID list already
980
+ * determines how many traces replay.
965
981
  * @returns ReplayResult with items, testRunId, and testRunUrl
966
982
  */
967
983
  replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
@@ -1027,7 +1043,7 @@ declare class BitfabFunction {
1027
1043
  /**
1028
1044
  * SDK version from package.json (injected at build time)
1029
1045
  */
1030
- declare const __version__ = "0.16.0";
1046
+ declare const __version__ = "0.16.2";
1031
1047
 
1032
1048
  /**
1033
1049
  * Constants for the Bitfab SDK.
@@ -1037,4 +1053,4 @@ declare const __version__ = "0.16.0";
1037
1053
  */
1038
1054
  declare const DEFAULT_SERVICE_URL = "https://bitfab.ai";
1039
1055
 
1040
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler, BitfabOpenAITracingProcessor, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockStrategy, type ProviderDefinition, ReplayEnvironment, type ReplayEnvironmentSnapshot, type ReplayItem, type ReplayOptions, type ReplayResult, SUPPORTED_PROVIDERS, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type WrapBAMLOptions, type WrappedBamlFn, __version__, flushTraces, getCurrentSpan, getCurrentTrace };
1056
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabOpenAITracingProcessor, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockStrategy, type ProviderDefinition, ReplayEnvironment, type ReplayEnvironmentSnapshot, type ReplayItem, type ReplayOptions, type ReplayResult, SUPPORTED_PROVIDERS, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type WrapBAMLOptions, type WrappedBamlFn, __version__, flushTraces, getCurrentSpan, getCurrentTrace };
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  flushTraces,
12
12
  getCurrentSpan,
13
13
  getCurrentTrace
14
- } from "./chunk-53G5GR7B.js";
14
+ } from "./chunk-4WJPQT2X.js";
15
15
  import {
16
16
  BitfabError
17
17
  } from "./chunk-QT7HWOKU.js";
@@ -20,6 +20,7 @@ export {
20
20
  BitfabClaudeAgentHandler,
21
21
  BitfabError,
22
22
  BitfabFunction,
23
+ BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler,
23
24
  BitfabLangGraphCallbackHandler,
24
25
  BitfabOpenAITracingProcessor,
25
26
  DEFAULT_SERVICE_URL,
package/dist/node.cjs CHANGED
@@ -324,9 +324,12 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
324
324
  }
325
325
  }
326
326
  if (options?.limit !== void 0 && options?.traceIds !== void 0) {
327
- throw new BitfabError(
328
- "Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
329
- );
327
+ try {
328
+ console.warn(
329
+ "Bitfab: limit is ignored when traceIds is passed: the explicit trace ID list already determines how many traces replay."
330
+ );
331
+ } catch {
332
+ }
330
333
  }
331
334
  await replayContextReady;
332
335
  const {
@@ -423,6 +426,7 @@ __export(node_exports, {
423
426
  BitfabClaudeAgentHandler: () => BitfabClaudeAgentHandler,
424
427
  BitfabError: () => BitfabError,
425
428
  BitfabFunction: () => BitfabFunction,
429
+ BitfabLangChainCallbackHandler: () => BitfabLangGraphCallbackHandler,
426
430
  BitfabLangGraphCallbackHandler: () => BitfabLangGraphCallbackHandler,
427
431
  BitfabOpenAITracingProcessor: () => BitfabOpenAITracingProcessor,
428
432
  DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
@@ -443,7 +447,7 @@ registerAsyncLocalStorageClass(
443
447
  );
444
448
 
445
449
  // src/version.generated.ts
446
- var __version__ = "0.16.0";
450
+ var __version__ = "0.16.2";
447
451
 
448
452
  // src/constants.ts
449
453
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -2730,6 +2734,24 @@ var Bitfab = class {
2730
2734
  }
2731
2735
  });
2732
2736
  }
2737
+ /**
2738
+ * Get a LangChain callback handler for tracing.
2739
+ *
2740
+ * Alias of {@link getLangGraphCallbackHandler}: LangChain chains and
2741
+ * LangGraph graphs share the same callback system, so one handler serves
2742
+ * both.
2743
+ *
2744
+ * ```typescript
2745
+ * const handler = client.getLangChainCallbackHandler("my-chain");
2746
+ * const result = await chain.invoke(input, { callbacks: [handler] });
2747
+ * ```
2748
+ *
2749
+ * @param traceFunctionKey - Groups traces under this key in Bitfab
2750
+ * @returns A BitfabLangGraphCallbackHandler configured for this client
2751
+ */
2752
+ getLangChainCallbackHandler(traceFunctionKey) {
2753
+ return this.getLangGraphCallbackHandler(traceFunctionKey);
2754
+ }
2733
2755
  /**
2734
2756
  * Get a Claude Agent SDK handler for tracing.
2735
2757
  *
@@ -3233,9 +3255,9 @@ var Bitfab = class {
3233
3255
  *
3234
3256
  * @param traceFunctionKey - The trace function key to replay
3235
3257
  * @param fn - The function to replay (must be the return value of `withSpan`)
3236
- * @param options - Optional replay options. `limit` and `traceIds` are
3237
- * mutually exclusive an explicit ID list already determines how many
3238
- * traces replay, so passing both throws a BitfabError.
3258
+ * @param options - Optional replay options. When `traceIds` is passed,
3259
+ * `limit` is ignored (with a warning): an explicit ID list already
3260
+ * determines how many traces replay.
3239
3261
  * @returns ReplayResult with items, testRunId, and testRunUrl
3240
3262
  */
3241
3263
  async replay(traceFunctionKey, fn, options) {
@@ -3313,6 +3335,7 @@ assertAsyncStorageRegistered();
3313
3335
  BitfabClaudeAgentHandler,
3314
3336
  BitfabError,
3315
3337
  BitfabFunction,
3338
+ BitfabLangChainCallbackHandler,
3316
3339
  BitfabLangGraphCallbackHandler,
3317
3340
  BitfabOpenAITracingProcessor,
3318
3341
  DEFAULT_SERVICE_URL,