bitfab 0.38.2 → 0.38.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.d.cts CHANGED
@@ -1234,7 +1234,7 @@ interface ReplayOptions {
1234
1234
  * because either source already determines how many traces replay.
1235
1235
  */
1236
1236
  limit?: number;
1237
- /** Optional list of specific trace IDs to replay (max 100). */
1237
+ /** Optional list of specific trace IDs to replay (max 100). Mutually exclusive with `datasetId`. */
1238
1238
  traceIds?: string[];
1239
1239
  /** Optional display name for the resulting experiment/test run. */
1240
1240
  name?: string;
@@ -1291,7 +1291,8 @@ interface ReplayOptions {
1291
1291
  /** Group ID to associate this replay with an experiment group for live streaming in Studio. */
1292
1292
  experimentGroupId?: string;
1293
1293
  /**
1294
- * Dataset this replay runs against. When set, the resulting experiment is
1294
+ * Dataset this replay runs against. Mutually exclusive with `traceIds`. When
1295
+ * set, the resulting experiment is
1295
1296
  * durably attributed to the dataset (stored on the test run), so it appears
1296
1297
  * under the dataset's experiments even if the trace lineage can't be
1297
1298
  * reconstructed. Validated server-side against the org.
@@ -2717,7 +2718,7 @@ declare class BitfabFunction {
2717
2718
  /**
2718
2719
  * SDK version from package.json (injected at build time)
2719
2720
  */
2720
- declare const __version__ = "0.38.2";
2721
+ declare const __version__ = "0.38.3";
2721
2722
 
2722
2723
  /**
2723
2724
  * Constants for the Bitfab SDK.
@@ -2785,4 +2786,39 @@ declare const finalizers: {
2785
2786
  readableStream: typeof readableStream;
2786
2787
  };
2787
2788
 
2788
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayProgress, type ReplayProgressItem, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
2789
+ type ReplayFunction = (...args: any[]) => unknown | Promise<unknown>;
2790
+ type ReplayRegistryOptions = Omit<ReplayOptions, "onItemStart" | "onItemFinish" | "onProgress">;
2791
+ interface ReplayRegistryContext {
2792
+ /** Values supplied through `--params` and repeated `--param name=value`. */
2793
+ params: Readonly<Record<string, unknown>>;
2794
+ }
2795
+ type ReplayOptionsFactory = (context: ReplayRegistryContext) => ReplayRegistryOptions | Promise<ReplayRegistryOptions>;
2796
+ interface ReplayRegistration {
2797
+ /** Client instance used by the production traced function. */
2798
+ client: Bitfab;
2799
+ /** The exact traced function production calls. */
2800
+ fn: ReplayFunction;
2801
+ /**
2802
+ * Required for handler-instrumented or otherwise plain callables. Omit for a
2803
+ * `withSpan`-wrapped function and the registry reads the wrapper's key.
2804
+ */
2805
+ traceFunctionKey?: string;
2806
+ /**
2807
+ * Per-function replay behavior and defaults. Put executable configuration
2808
+ * such as `mockOverride` and `adaptInputs` here; command-line values override
2809
+ * overlapping scalar defaults such as `mock` and `maxConcurrency`.
2810
+ */
2811
+ options?: ReplayRegistryOptions;
2812
+ /** Build executable replay behavior from caller-supplied CLI parameters. */
2813
+ optionsFactory?: ReplayOptionsFactory;
2814
+ }
2815
+ type ReplayRegistry = Record<string, ReplayRegistration>;
2816
+ /**
2817
+ * Define the project-owned list of replayable functions.
2818
+ *
2819
+ * The registry is deliberately data-only: the SDK owns the replay CLI, so an
2820
+ * SDK upgrade can add replay features without regenerating the project file.
2821
+ */
2822
+ declare function defineReplayRegistry<TRegistry extends ReplayRegistry>(registry: TRegistry): TRegistry;
2823
+
2824
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
package/dist/index.d.ts CHANGED
@@ -1234,7 +1234,7 @@ interface ReplayOptions {
1234
1234
  * because either source already determines how many traces replay.
1235
1235
  */
1236
1236
  limit?: number;
1237
- /** Optional list of specific trace IDs to replay (max 100). */
1237
+ /** Optional list of specific trace IDs to replay (max 100). Mutually exclusive with `datasetId`. */
1238
1238
  traceIds?: string[];
1239
1239
  /** Optional display name for the resulting experiment/test run. */
1240
1240
  name?: string;
@@ -1291,7 +1291,8 @@ interface ReplayOptions {
1291
1291
  /** Group ID to associate this replay with an experiment group for live streaming in Studio. */
1292
1292
  experimentGroupId?: string;
1293
1293
  /**
1294
- * Dataset this replay runs against. When set, the resulting experiment is
1294
+ * Dataset this replay runs against. Mutually exclusive with `traceIds`. When
1295
+ * set, the resulting experiment is
1295
1296
  * durably attributed to the dataset (stored on the test run), so it appears
1296
1297
  * under the dataset's experiments even if the trace lineage can't be
1297
1298
  * reconstructed. Validated server-side against the org.
@@ -2717,7 +2718,7 @@ declare class BitfabFunction {
2717
2718
  /**
2718
2719
  * SDK version from package.json (injected at build time)
2719
2720
  */
2720
- declare const __version__ = "0.38.2";
2721
+ declare const __version__ = "0.38.3";
2721
2722
 
2722
2723
  /**
2723
2724
  * Constants for the Bitfab SDK.
@@ -2785,4 +2786,39 @@ declare const finalizers: {
2785
2786
  readableStream: typeof readableStream;
2786
2787
  };
2787
2788
 
2788
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayProgress, type ReplayProgressItem, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
2789
+ type ReplayFunction = (...args: any[]) => unknown | Promise<unknown>;
2790
+ type ReplayRegistryOptions = Omit<ReplayOptions, "onItemStart" | "onItemFinish" | "onProgress">;
2791
+ interface ReplayRegistryContext {
2792
+ /** Values supplied through `--params` and repeated `--param name=value`. */
2793
+ params: Readonly<Record<string, unknown>>;
2794
+ }
2795
+ type ReplayOptionsFactory = (context: ReplayRegistryContext) => ReplayRegistryOptions | Promise<ReplayRegistryOptions>;
2796
+ interface ReplayRegistration {
2797
+ /** Client instance used by the production traced function. */
2798
+ client: Bitfab;
2799
+ /** The exact traced function production calls. */
2800
+ fn: ReplayFunction;
2801
+ /**
2802
+ * Required for handler-instrumented or otherwise plain callables. Omit for a
2803
+ * `withSpan`-wrapped function and the registry reads the wrapper's key.
2804
+ */
2805
+ traceFunctionKey?: string;
2806
+ /**
2807
+ * Per-function replay behavior and defaults. Put executable configuration
2808
+ * such as `mockOverride` and `adaptInputs` here; command-line values override
2809
+ * overlapping scalar defaults such as `mock` and `maxConcurrency`.
2810
+ */
2811
+ options?: ReplayRegistryOptions;
2812
+ /** Build executable replay behavior from caller-supplied CLI parameters. */
2813
+ optionsFactory?: ReplayOptionsFactory;
2814
+ }
2815
+ type ReplayRegistry = Record<string, ReplayRegistration>;
2816
+ /**
2817
+ * Define the project-owned list of replayable functions.
2818
+ *
2819
+ * The registry is deliberately data-only: the SDK owns the replay CLI, so an
2820
+ * SDK upgrade can add replay features without regenerating the project file.
2821
+ */
2822
+ declare function defineReplayRegistry<TRegistry extends ReplayRegistry>(registry: TRegistry): TRegistry;
2823
+
2824
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
package/dist/index.js CHANGED
@@ -16,11 +16,12 @@ import {
16
16
  BitfabOpenAITracingProcessor,
17
17
  BitfabVercelAiHandler,
18
18
  SUPPORTED_PROVIDERS,
19
+ defineReplayRegistry,
19
20
  finalizers,
20
21
  getCurrentReplayBranch,
21
22
  getCurrentSpan,
22
23
  getCurrentTrace
23
- } from "./chunk-JSU2Z2Z7.js";
24
+ } from "./chunk-GSTRSZRO.js";
24
25
  import "./chunk-GFBQ2AMO.js";
25
26
  import {
26
27
  BITFAB_PROGRESS_PREFIX,
@@ -33,7 +34,7 @@ import {
33
34
  flushTraces,
34
35
  reportReplayProgress,
35
36
  serializeReplayResult
36
- } from "./chunk-QWV7JDLQ.js";
37
+ } from "./chunk-QNPM27RY.js";
37
38
  import "./chunk-H6LZRFMN.js";
38
39
  export {
39
40
  BITFAB_PROGRESS_PREFIX,
@@ -52,6 +53,7 @@ export {
52
53
  ReplayError,
53
54
  SUPPORTED_PROVIDERS,
54
55
  __version__,
56
+ defineReplayRegistry,
55
57
  finalizers,
56
58
  flushTraces,
57
59
  getCurrentReplayBranch,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.38.2";
100
+ __version__ = "0.38.3";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -2820,6 +2820,11 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
2820
2820
  );
2821
2821
  }
2822
2822
  }
2823
+ if (options?.traceIds !== void 0 && options?.datasetId !== void 0) {
2824
+ throw new BitfabError(
2825
+ "traceIds and datasetId select different replay sources and cannot be used together."
2826
+ );
2827
+ }
2823
2828
  if (options?.limit !== void 0 && options?.traceIds !== void 0) {
2824
2829
  try {
2825
2830
  console.warn(
@@ -3147,6 +3152,7 @@ __export(node_exports, {
3147
3152
  ReplayError: () => ReplayError,
3148
3153
  SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
3149
3154
  __version__: () => __version__,
3155
+ defineReplayRegistry: () => defineReplayRegistry,
3150
3156
  finalizers: () => finalizers,
3151
3157
  flushTraces: () => flushTraces,
3152
3158
  getCurrentReplayBranch: () => getCurrentReplayBranch,
@@ -7087,6 +7093,13 @@ var finalizers = {
7087
7093
  init_http();
7088
7094
  init_replay();
7089
7095
 
7096
+ // src/replayRegistry.ts
7097
+ init_errors();
7098
+ init_replay();
7099
+ function defineReplayRegistry(registry) {
7100
+ return registry;
7101
+ }
7102
+
7090
7103
  // src/node.ts
7091
7104
  init_asyncStorage();
7092
7105
  assertAsyncStorageRegistered();
@@ -7108,6 +7121,7 @@ assertAsyncStorageRegistered();
7108
7121
  ReplayError,
7109
7122
  SUPPORTED_PROVIDERS,
7110
7123
  __version__,
7124
+ defineReplayRegistry,
7111
7125
  finalizers,
7112
7126
  flushTraces,
7113
7127
  getCurrentReplayBranch,