bitfab 0.44.0 → 0.45.0

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
@@ -1,35 +1,3 @@
1
- /**
2
- * BAML execution utilities for the Bitfab TypeScript SDK.
3
- * This module provides functions to execute BAML prompts dynamically on the client side.
4
- */
5
- /**
6
- * Provider definition from the server.
7
- */
8
- interface ProviderDefinition {
9
- provider: string;
10
- apiKeyEnv: string;
11
- models: Array<{
12
- model: string;
13
- description: string;
14
- }>;
15
- }
16
- /**
17
- * Result of a BAML function execution with raw collector data.
18
- */
19
- interface BamlExecutionResult {
20
- /** The parsed result of the function */
21
- result: unknown;
22
- /** Raw collector data for the server to parse */
23
- rawCollector: Record<string, unknown> | null;
24
- }
25
- /**
26
- * Type for allowed environment variables.
27
- * Only OPENAI_API_KEY is currently supported.
28
- */
29
- type AllowedEnvVars = {
30
- OPENAI_API_KEY?: string;
31
- };
32
-
33
1
  /**
34
2
  * Per-trace database snapshot ref capture.
35
3
  *
@@ -647,6 +615,32 @@ interface TokenUsage {
647
615
  cached: number | null;
648
616
  total: number | null;
649
617
  }
618
+ interface TraceOutlineSpanError {
619
+ source: string;
620
+ error: string;
621
+ step?: string;
622
+ }
623
+ interface TraceOutlineSpan {
624
+ spanId: string;
625
+ name: string | null;
626
+ type: string;
627
+ traceFunctionKey: string | null;
628
+ durationMs: number | null;
629
+ tokens: TokenUsage | null;
630
+ model: string | null;
631
+ errors: TraceOutlineSpanError[] | null;
632
+ mocked: boolean;
633
+ children: TraceOutlineSpan[];
634
+ }
635
+ interface TraceOutline {
636
+ traceId: string;
637
+ name: string | null;
638
+ status: string;
639
+ traceFunctionKey: string | null;
640
+ durationMs: number | null;
641
+ spanCount: number;
642
+ spans: TraceOutlineSpan[];
643
+ }
650
644
  /**
651
645
  * Describes a single file edited as part of a code change.
652
646
  *
@@ -746,6 +740,8 @@ interface CompleteReplayResponse {
746
740
  * `ReplayItem.tokens`. Absent on servers that predate this field.
747
741
  */
748
742
  tokens?: Record<string, TokenUsage | null>;
743
+ traceOutlines?: Record<string, TraceOutline>;
744
+ originalTraceOutlines?: Record<string, TraceOutline>;
749
745
  /**
750
746
  * Number of traces the server has persisted for this test run at
751
747
  * completion time. Lets the SDK distinguish "uploads failed" from
@@ -775,6 +771,86 @@ interface SpanTreeResponse {
775
771
  root: SpanTreeNode;
776
772
  }
777
773
 
774
+ type TraceTargetOccurrence = "first" | "last" | number;
775
+ type TraceTarget = {
776
+ kind: "output";
777
+ } | {
778
+ kind: "span";
779
+ name: string;
780
+ occurrence?: TraceTargetOccurrence;
781
+ };
782
+ type TraceAssertionSource = "human" | "agent";
783
+ type TraceAssertion = {
784
+ id: string;
785
+ traceId: string;
786
+ assertion: string;
787
+ passCriteria: string | null;
788
+ failCriteria: string | null;
789
+ targetOnEvaluatedTrace: TraceTarget | null;
790
+ source: TraceAssertionSource;
791
+ createdAt: string;
792
+ updatedAt: string;
793
+ };
794
+ type SaveAssertion = {
795
+ id?: string;
796
+ assertion: string;
797
+ passCriteria?: string | null;
798
+ failCriteria?: string | null;
799
+ targetOnEvaluatedTrace?: TraceTarget | null;
800
+ };
801
+ type TraceAssertionsResult = {
802
+ assertions: TraceAssertion[];
803
+ inheritedFrom: string | null;
804
+ };
805
+ type SaveAssertionsParams = {
806
+ traceId: string;
807
+ assertions: SaveAssertion[];
808
+ source?: TraceAssertionSource;
809
+ };
810
+ type ArchiveAssertionsParams = {
811
+ traceId: string;
812
+ assertionIds: string[];
813
+ };
814
+ declare class TracesClient {
815
+ private readonly httpClient;
816
+ constructor(httpClient: HttpClient);
817
+ getAssertions(traceId: string): Promise<TraceAssertionsResult>;
818
+ saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
819
+ archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
820
+ }
821
+
822
+ /**
823
+ * BAML execution utilities for the Bitfab TypeScript SDK.
824
+ * This module provides functions to execute BAML prompts dynamically on the client side.
825
+ */
826
+ /**
827
+ * Provider definition from the server.
828
+ */
829
+ interface ProviderDefinition {
830
+ provider: string;
831
+ apiKeyEnv: string;
832
+ models: Array<{
833
+ model: string;
834
+ description: string;
835
+ }>;
836
+ }
837
+ /**
838
+ * Result of a BAML function execution with raw collector data.
839
+ */
840
+ interface BamlExecutionResult {
841
+ /** The parsed result of the function */
842
+ result: unknown;
843
+ /** Raw collector data for the server to parse */
844
+ rawCollector: Record<string, unknown> | null;
845
+ }
846
+ /**
847
+ * Type for allowed environment variables.
848
+ * Only OPENAI_API_KEY is currently supported.
849
+ */
850
+ type AllowedEnvVars = {
851
+ OPENAI_API_KEY?: string;
852
+ };
853
+
778
854
  /**
779
855
  * Claude Agent SDK handler for Bitfab tracing.
780
856
  *
@@ -1181,6 +1257,43 @@ declare class DatasetsClient {
1181
1257
  getGraderRerun(datasetId: string, runId?: string): Promise<GraderRerun | null>;
1182
1258
  }
1183
1259
 
1260
+ type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
1261
+ type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
1262
+ type LabelTarget = {
1263
+ traceId: string;
1264
+ originalTraceId?: never;
1265
+ attempt?: never;
1266
+ } | {
1267
+ originalTraceId: string;
1268
+ attempt?: number;
1269
+ traceId?: never;
1270
+ };
1271
+ type LabelVerdict = {
1272
+ label: boolean;
1273
+ annotation: string;
1274
+ confidence?: LabelConfidence;
1275
+ } | {
1276
+ skip: true;
1277
+ } | {
1278
+ archive: true;
1279
+ };
1280
+ type LabelUpdate = LabelTarget & LabelVerdict;
1281
+ type LabelOutcome = {
1282
+ key: string;
1283
+ traceId: string;
1284
+ action: LabelAction;
1285
+ };
1286
+ type SaveLabelsParams = {
1287
+ labels: LabelUpdate[];
1288
+ testRunId?: string;
1289
+ };
1290
+ declare class LabelsClient {
1291
+ private readonly httpClient;
1292
+ constructor(httpClient: HttpClient);
1293
+ save(params: SaveLabelsParams): Promise<LabelOutcome[]>;
1294
+ saveOne(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
1295
+ }
1296
+
1184
1297
  /**
1185
1298
  * LangGraph/LangChain callback handler for Bitfab tracing.
1186
1299
  *
@@ -1693,6 +1806,8 @@ interface ReplayProgressItem {
1693
1806
  model?: string | null;
1694
1807
  dbSnapshotRef?: DbSnapshotRef | null;
1695
1808
  dbBranchTimings?: DbBranchTimings | null;
1809
+ traceOutline?: TraceOutline | null;
1810
+ originalTraceOutline?: TraceOutline | null;
1696
1811
  }
1697
1812
  /**
1698
1813
  * @deprecated Use {@link ReplayItemFinishProgress}. This legacy shape also
@@ -1844,6 +1959,8 @@ interface ReplayItem<T> {
1844
1959
  * no snapshot ref, or against a server that predates timings.
1845
1960
  */
1846
1961
  dbBranchTimings: DbBranchTimings | null;
1962
+ traceOutline: TraceOutline | null;
1963
+ originalTraceOutline: TraceOutline | null;
1847
1964
  }
1848
1965
 
1849
1966
  interface ReplayResult<T> {
@@ -2437,6 +2554,8 @@ declare class Bitfab {
2437
2554
  private readonly httpClient;
2438
2555
  /** Dataset operations for the authenticated organization. */
2439
2556
  readonly datasets: DatasetsClient;
2557
+ readonly traces: TracesClient;
2558
+ readonly labels: LabelsClient;
2440
2559
  private readonly bamlClient;
2441
2560
  private readonly dbSnapshot;
2442
2561
  private readonly autoTracePolicyRefreshes;
@@ -3082,7 +3201,7 @@ declare class BitfabFunction {
3082
3201
  /**
3083
3202
  * SDK version from package.json (injected at build time)
3084
3203
  */
3085
- declare const __version__ = "0.44.0";
3204
+ declare const __version__ = "0.45.0";
3086
3205
 
3087
3206
  /**
3088
3207
  * Constants for the Bitfab SDK.
@@ -3212,4 +3331,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3212
3331
  run?: boolean;
3213
3332
  }): Promise<SeedResult>;
3214
3333
 
3215
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, 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, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceIngestionType, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
3334
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, 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, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SaveLabelsParams, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
package/dist/index.d.ts CHANGED
@@ -1,35 +1,3 @@
1
- /**
2
- * BAML execution utilities for the Bitfab TypeScript SDK.
3
- * This module provides functions to execute BAML prompts dynamically on the client side.
4
- */
5
- /**
6
- * Provider definition from the server.
7
- */
8
- interface ProviderDefinition {
9
- provider: string;
10
- apiKeyEnv: string;
11
- models: Array<{
12
- model: string;
13
- description: string;
14
- }>;
15
- }
16
- /**
17
- * Result of a BAML function execution with raw collector data.
18
- */
19
- interface BamlExecutionResult {
20
- /** The parsed result of the function */
21
- result: unknown;
22
- /** Raw collector data for the server to parse */
23
- rawCollector: Record<string, unknown> | null;
24
- }
25
- /**
26
- * Type for allowed environment variables.
27
- * Only OPENAI_API_KEY is currently supported.
28
- */
29
- type AllowedEnvVars = {
30
- OPENAI_API_KEY?: string;
31
- };
32
-
33
1
  /**
34
2
  * Per-trace database snapshot ref capture.
35
3
  *
@@ -647,6 +615,32 @@ interface TokenUsage {
647
615
  cached: number | null;
648
616
  total: number | null;
649
617
  }
618
+ interface TraceOutlineSpanError {
619
+ source: string;
620
+ error: string;
621
+ step?: string;
622
+ }
623
+ interface TraceOutlineSpan {
624
+ spanId: string;
625
+ name: string | null;
626
+ type: string;
627
+ traceFunctionKey: string | null;
628
+ durationMs: number | null;
629
+ tokens: TokenUsage | null;
630
+ model: string | null;
631
+ errors: TraceOutlineSpanError[] | null;
632
+ mocked: boolean;
633
+ children: TraceOutlineSpan[];
634
+ }
635
+ interface TraceOutline {
636
+ traceId: string;
637
+ name: string | null;
638
+ status: string;
639
+ traceFunctionKey: string | null;
640
+ durationMs: number | null;
641
+ spanCount: number;
642
+ spans: TraceOutlineSpan[];
643
+ }
650
644
  /**
651
645
  * Describes a single file edited as part of a code change.
652
646
  *
@@ -746,6 +740,8 @@ interface CompleteReplayResponse {
746
740
  * `ReplayItem.tokens`. Absent on servers that predate this field.
747
741
  */
748
742
  tokens?: Record<string, TokenUsage | null>;
743
+ traceOutlines?: Record<string, TraceOutline>;
744
+ originalTraceOutlines?: Record<string, TraceOutline>;
749
745
  /**
750
746
  * Number of traces the server has persisted for this test run at
751
747
  * completion time. Lets the SDK distinguish "uploads failed" from
@@ -775,6 +771,86 @@ interface SpanTreeResponse {
775
771
  root: SpanTreeNode;
776
772
  }
777
773
 
774
+ type TraceTargetOccurrence = "first" | "last" | number;
775
+ type TraceTarget = {
776
+ kind: "output";
777
+ } | {
778
+ kind: "span";
779
+ name: string;
780
+ occurrence?: TraceTargetOccurrence;
781
+ };
782
+ type TraceAssertionSource = "human" | "agent";
783
+ type TraceAssertion = {
784
+ id: string;
785
+ traceId: string;
786
+ assertion: string;
787
+ passCriteria: string | null;
788
+ failCriteria: string | null;
789
+ targetOnEvaluatedTrace: TraceTarget | null;
790
+ source: TraceAssertionSource;
791
+ createdAt: string;
792
+ updatedAt: string;
793
+ };
794
+ type SaveAssertion = {
795
+ id?: string;
796
+ assertion: string;
797
+ passCriteria?: string | null;
798
+ failCriteria?: string | null;
799
+ targetOnEvaluatedTrace?: TraceTarget | null;
800
+ };
801
+ type TraceAssertionsResult = {
802
+ assertions: TraceAssertion[];
803
+ inheritedFrom: string | null;
804
+ };
805
+ type SaveAssertionsParams = {
806
+ traceId: string;
807
+ assertions: SaveAssertion[];
808
+ source?: TraceAssertionSource;
809
+ };
810
+ type ArchiveAssertionsParams = {
811
+ traceId: string;
812
+ assertionIds: string[];
813
+ };
814
+ declare class TracesClient {
815
+ private readonly httpClient;
816
+ constructor(httpClient: HttpClient);
817
+ getAssertions(traceId: string): Promise<TraceAssertionsResult>;
818
+ saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
819
+ archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
820
+ }
821
+
822
+ /**
823
+ * BAML execution utilities for the Bitfab TypeScript SDK.
824
+ * This module provides functions to execute BAML prompts dynamically on the client side.
825
+ */
826
+ /**
827
+ * Provider definition from the server.
828
+ */
829
+ interface ProviderDefinition {
830
+ provider: string;
831
+ apiKeyEnv: string;
832
+ models: Array<{
833
+ model: string;
834
+ description: string;
835
+ }>;
836
+ }
837
+ /**
838
+ * Result of a BAML function execution with raw collector data.
839
+ */
840
+ interface BamlExecutionResult {
841
+ /** The parsed result of the function */
842
+ result: unknown;
843
+ /** Raw collector data for the server to parse */
844
+ rawCollector: Record<string, unknown> | null;
845
+ }
846
+ /**
847
+ * Type for allowed environment variables.
848
+ * Only OPENAI_API_KEY is currently supported.
849
+ */
850
+ type AllowedEnvVars = {
851
+ OPENAI_API_KEY?: string;
852
+ };
853
+
778
854
  /**
779
855
  * Claude Agent SDK handler for Bitfab tracing.
780
856
  *
@@ -1181,6 +1257,43 @@ declare class DatasetsClient {
1181
1257
  getGraderRerun(datasetId: string, runId?: string): Promise<GraderRerun | null>;
1182
1258
  }
1183
1259
 
1260
+ type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
1261
+ type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
1262
+ type LabelTarget = {
1263
+ traceId: string;
1264
+ originalTraceId?: never;
1265
+ attempt?: never;
1266
+ } | {
1267
+ originalTraceId: string;
1268
+ attempt?: number;
1269
+ traceId?: never;
1270
+ };
1271
+ type LabelVerdict = {
1272
+ label: boolean;
1273
+ annotation: string;
1274
+ confidence?: LabelConfidence;
1275
+ } | {
1276
+ skip: true;
1277
+ } | {
1278
+ archive: true;
1279
+ };
1280
+ type LabelUpdate = LabelTarget & LabelVerdict;
1281
+ type LabelOutcome = {
1282
+ key: string;
1283
+ traceId: string;
1284
+ action: LabelAction;
1285
+ };
1286
+ type SaveLabelsParams = {
1287
+ labels: LabelUpdate[];
1288
+ testRunId?: string;
1289
+ };
1290
+ declare class LabelsClient {
1291
+ private readonly httpClient;
1292
+ constructor(httpClient: HttpClient);
1293
+ save(params: SaveLabelsParams): Promise<LabelOutcome[]>;
1294
+ saveOne(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
1295
+ }
1296
+
1184
1297
  /**
1185
1298
  * LangGraph/LangChain callback handler for Bitfab tracing.
1186
1299
  *
@@ -1693,6 +1806,8 @@ interface ReplayProgressItem {
1693
1806
  model?: string | null;
1694
1807
  dbSnapshotRef?: DbSnapshotRef | null;
1695
1808
  dbBranchTimings?: DbBranchTimings | null;
1809
+ traceOutline?: TraceOutline | null;
1810
+ originalTraceOutline?: TraceOutline | null;
1696
1811
  }
1697
1812
  /**
1698
1813
  * @deprecated Use {@link ReplayItemFinishProgress}. This legacy shape also
@@ -1844,6 +1959,8 @@ interface ReplayItem<T> {
1844
1959
  * no snapshot ref, or against a server that predates timings.
1845
1960
  */
1846
1961
  dbBranchTimings: DbBranchTimings | null;
1962
+ traceOutline: TraceOutline | null;
1963
+ originalTraceOutline: TraceOutline | null;
1847
1964
  }
1848
1965
 
1849
1966
  interface ReplayResult<T> {
@@ -2437,6 +2554,8 @@ declare class Bitfab {
2437
2554
  private readonly httpClient;
2438
2555
  /** Dataset operations for the authenticated organization. */
2439
2556
  readonly datasets: DatasetsClient;
2557
+ readonly traces: TracesClient;
2558
+ readonly labels: LabelsClient;
2440
2559
  private readonly bamlClient;
2441
2560
  private readonly dbSnapshot;
2442
2561
  private readonly autoTracePolicyRefreshes;
@@ -3082,7 +3201,7 @@ declare class BitfabFunction {
3082
3201
  /**
3083
3202
  * SDK version from package.json (injected at build time)
3084
3203
  */
3085
- declare const __version__ = "0.44.0";
3204
+ declare const __version__ = "0.45.0";
3086
3205
 
3087
3206
  /**
3088
3207
  * Constants for the Bitfab SDK.
@@ -3212,4 +3331,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3212
3331
  run?: boolean;
3213
3332
  }): Promise<SeedResult>;
3214
3333
 
3215
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, 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, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceIngestionType, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
3334
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, 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, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SaveLabelsParams, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
package/dist/index.js CHANGED
@@ -17,14 +17,16 @@ import {
17
17
  BitfabOpenAITracingProcessor,
18
18
  BitfabVercelAiHandler,
19
19
  DatasetsClient,
20
+ LabelsClient,
20
21
  SUPPORTED_PROVIDERS,
22
+ TracesClient,
21
23
  defineReplayRegistry,
22
24
  finalizers,
23
25
  getCurrentReplayBranch,
24
26
  getCurrentSpan,
25
27
  getCurrentTrace,
26
28
  seedFromRegistry
27
- } from "./chunk-WKGQM7HI.js";
29
+ } from "./chunk-GYDK6ZDN.js";
28
30
  import "./chunk-ZUD7OFYB.js";
29
31
  import {
30
32
  BITFAB_PROGRESS_PREFIX,
@@ -33,7 +35,7 @@ import {
33
35
  ReplayError,
34
36
  reportReplayProgress,
35
37
  serializeReplayResult
36
- } from "./chunk-J25AP452.js";
38
+ } from "./chunk-W77NNSNX.js";
37
39
  import {
38
40
  BitfabError,
39
41
  DEFAULT_SERVICE_URL,
@@ -41,7 +43,7 @@ import {
41
43
  MixedTracingError,
42
44
  __version__,
43
45
  flushTraces
44
- } from "./chunk-DCF7NJK7.js";
46
+ } from "./chunk-YDPSSWNF.js";
45
47
  import "./chunk-H6LZRFMN.js";
46
48
  export {
47
49
  BITFAB_PROGRESS_PREFIX,
@@ -59,10 +61,12 @@ export {
59
61
  DatasetsClient,
60
62
  DbBranchReplayError,
61
63
  HttpClient,
64
+ LabelsClient,
62
65
  MixedTracingError,
63
66
  NO_MOCK_OVERRIDE,
64
67
  ReplayError,
65
68
  SUPPORTED_PROVIDERS,
69
+ TracesClient,
66
70
  __version__,
67
71
  defineReplayRegistry,
68
72
  finalizers,
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.44.0";
100
+ __version__ = "0.45.0";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -2735,7 +2735,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2735
2735
  tokens: null,
2736
2736
  model: serverItem.originalModel ?? serverItem.model ?? null,
2737
2737
  dbSnapshotRef: dbSnapshotRef ?? null,
2738
- dbBranchTimings: dbBranchTimings ?? null
2738
+ dbBranchTimings: dbBranchTimings ?? null,
2739
+ traceOutline: null,
2740
+ originalTraceOutline: null
2739
2741
  };
2740
2742
  }
2741
2743
  try {
@@ -2819,7 +2821,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2819
2821
  tokens: null,
2820
2822
  model: originalModel,
2821
2823
  dbSnapshotRef: dbSnapshotRef ?? null,
2822
- dbBranchTimings: dbBranchTimings ?? null
2824
+ dbBranchTimings: dbBranchTimings ?? null,
2825
+ traceOutline: null,
2826
+ originalTraceOutline: null
2823
2827
  };
2824
2828
  }
2825
2829
  async function waitForReplayPersistence(httpClient, testRunId, replayedTraceIds) {
@@ -3074,7 +3078,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
3074
3078
  tokens: item.tokens,
3075
3079
  model: item.model,
3076
3080
  dbSnapshotRef: item.dbSnapshotRef,
3077
- dbBranchTimings: item.dbBranchTimings
3081
+ dbBranchTimings: item.dbBranchTimings,
3082
+ traceOutline: item.traceOutline,
3083
+ originalTraceOutline: item.originalTraceOutline
3078
3084
  }
3079
3085
  });
3080
3086
  } catch {
@@ -3154,7 +3160,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
3154
3160
  }
3155
3161
  if (mapped !== void 0) {
3156
3162
  item.tokens = replayTokens?.[mapped] ?? null;
3163
+ item.traceOutline = completeResult.traceOutlines?.[mapped] ?? null;
3157
3164
  }
3165
+ item.originalTraceOutline = completeResult.originalTraceOutlines?.[item.originalTraceId] ?? null;
3158
3166
  }
3159
3167
  if (completedCount > 0 && missing.length === completedCount) {
3160
3168
  const serverCount = completeResult.traceCount !== void 0 ? ` The server persisted ${completeResult.traceCount} trace(s) for this run.` : "";
@@ -3277,10 +3285,12 @@ __export(node_exports, {
3277
3285
  DatasetsClient: () => DatasetsClient,
3278
3286
  DbBranchReplayError: () => DbBranchReplayError,
3279
3287
  HttpClient: () => HttpClient,
3288
+ LabelsClient: () => LabelsClient,
3280
3289
  MixedTracingError: () => MixedTracingError,
3281
3290
  NO_MOCK_OVERRIDE: () => NO_MOCK_OVERRIDE,
3282
3291
  ReplayError: () => ReplayError,
3283
3292
  SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
3293
+ TracesClient: () => TracesClient,
3284
3294
  __version__: () => __version__,
3285
3295
  defineReplayRegistry: () => defineReplayRegistry,
3286
3296
  finalizers: () => finalizers,
@@ -3301,6 +3311,33 @@ registerAsyncLocalStorageClass(
3301
3311
  import_node_async_hooks.AsyncLocalStorage
3302
3312
  );
3303
3313
 
3314
+ // src/assertions.ts
3315
+ function expectationsPath(traceId, suffix = "") {
3316
+ return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
3317
+ }
3318
+ var TracesClient = class {
3319
+ constructor(httpClient) {
3320
+ this.httpClient = httpClient;
3321
+ }
3322
+ async getAssertions(traceId) {
3323
+ return this.httpClient.get(expectationsPath(traceId));
3324
+ }
3325
+ async saveAssertions(params) {
3326
+ const response = await this.httpClient.request(expectationsPath(params.traceId), {
3327
+ assertions: params.assertions,
3328
+ source: params.source ?? "agent"
3329
+ });
3330
+ return response.assertions;
3331
+ }
3332
+ async archiveAssertions(params) {
3333
+ const response = await this.httpClient.request(
3334
+ expectationsPath(params.traceId, "/archive"),
3335
+ { assertionIds: params.assertionIds }
3336
+ );
3337
+ return response.archived;
3338
+ }
3339
+ };
3340
+
3304
3341
  // src/claudeAgentSdk.ts
3305
3342
  init_constants();
3306
3343
  init_http();
@@ -4551,6 +4588,28 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4551
4588
  init_errors();
4552
4589
  init_http();
4553
4590
 
4591
+ // src/labels.ts
4592
+ var LABELS_PATH = "/api/sdk/traces/labels";
4593
+ var LabelsClient = class {
4594
+ constructor(httpClient) {
4595
+ this.httpClient = httpClient;
4596
+ }
4597
+ async save(params) {
4598
+ const response = await this.httpClient.request(
4599
+ LABELS_PATH,
4600
+ {
4601
+ labels: params.labels,
4602
+ ...params.testRunId === void 0 ? {} : { testRunId: params.testRunId }
4603
+ }
4604
+ );
4605
+ return response.labels;
4606
+ }
4607
+ async saveOne(update, testRunId) {
4608
+ const [outcome] = await this.save({ labels: [update], testRunId });
4609
+ return outcome;
4610
+ }
4611
+ };
4612
+
4554
4613
  // src/langgraph.ts
4555
4614
  init_constants();
4556
4615
  init_http();
@@ -6324,6 +6383,8 @@ var Bitfab = class {
6324
6383
  timeout: this.timeout
6325
6384
  });
6326
6385
  this.datasets = new DatasetsClient(this.httpClient);
6386
+ this.traces = new TracesClient(this.httpClient);
6387
+ this.labels = new LabelsClient(this.httpClient);
6327
6388
  }
6328
6389
  /**
6329
6390
  * Decorate a class method as an automatically expanded trace root.
@@ -8229,10 +8290,12 @@ assertAsyncStorageRegistered();
8229
8290
  DatasetsClient,
8230
8291
  DbBranchReplayError,
8231
8292
  HttpClient,
8293
+ LabelsClient,
8232
8294
  MixedTracingError,
8233
8295
  NO_MOCK_OVERRIDE,
8234
8296
  ReplayError,
8235
8297
  SUPPORTED_PROVIDERS,
8298
+ TracesClient,
8236
8299
  __version__,
8237
8300
  defineReplayRegistry,
8238
8301
  finalizers,