@bitfab/sdk 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
@@ -8,14 +8,16 @@ import {
8
8
  BitfabOpenAITracingProcessor,
9
9
  BitfabVercelAiHandler,
10
10
  DatasetsClient,
11
+ LabelsClient,
11
12
  SUPPORTED_PROVIDERS,
13
+ TracesClient,
12
14
  defineReplayRegistry,
13
15
  finalizers,
14
16
  getCurrentReplayBranch,
15
17
  getCurrentSpan,
16
18
  getCurrentTrace,
17
19
  seedFromRegistry
18
- } from "./chunk-XYMG2FH7.js";
20
+ } from "./chunk-GN6E2IBU.js";
19
21
  import "./chunk-ZUD7OFYB.js";
20
22
  import {
21
23
  BITFAB_PROGRESS_PREFIX,
@@ -24,7 +26,7 @@ import {
24
26
  ReplayError,
25
27
  reportReplayProgress,
26
28
  serializeReplayResult
27
- } from "./chunk-3WIN3VU3.js";
29
+ } from "./chunk-H4WJUUZH.js";
28
30
  import {
29
31
  BitfabError,
30
32
  DEFAULT_SERVICE_URL,
@@ -32,7 +34,7 @@ import {
32
34
  MixedTracingError,
33
35
  __version__,
34
36
  flushTraces
35
- } from "./chunk-6JTVCM2L.js";
37
+ } from "./chunk-TCOD5O2B.js";
36
38
  import "./chunk-H6LZRFMN.js";
37
39
  export {
38
40
  BITFAB_PROGRESS_PREFIX,
@@ -50,10 +52,12 @@ export {
50
52
  DatasetsClient,
51
53
  DbBranchReplayError,
52
54
  HttpClient,
55
+ LabelsClient,
53
56
  MixedTracingError,
54
57
  NO_MOCK_OVERRIDE,
55
58
  ReplayError,
56
59
  SUPPORTED_PROVIDERS,
60
+ TracesClient,
57
61
  __version__,
58
62
  defineReplayRegistry,
59
63
  finalizers,
package/dist/node.cjs CHANGED
@@ -88,7 +88,7 @@ var __version__, __packageName__;
88
88
  var init_version_generated = __esm({
89
89
  "src/version.generated.ts"() {
90
90
  "use strict";
91
- __version__ = "0.44.0";
91
+ __version__ = "0.45.0";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -2726,7 +2726,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2726
2726
  tokens: null,
2727
2727
  model: serverItem.originalModel ?? serverItem.model ?? null,
2728
2728
  dbSnapshotRef: dbSnapshotRef ?? null,
2729
- dbBranchTimings: dbBranchTimings ?? null
2729
+ dbBranchTimings: dbBranchTimings ?? null,
2730
+ traceOutline: null,
2731
+ originalTraceOutline: null
2730
2732
  };
2731
2733
  }
2732
2734
  try {
@@ -2810,7 +2812,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2810
2812
  tokens: null,
2811
2813
  model: originalModel,
2812
2814
  dbSnapshotRef: dbSnapshotRef ?? null,
2813
- dbBranchTimings: dbBranchTimings ?? null
2815
+ dbBranchTimings: dbBranchTimings ?? null,
2816
+ traceOutline: null,
2817
+ originalTraceOutline: null
2814
2818
  };
2815
2819
  }
2816
2820
  async function waitForReplayPersistence(httpClient, testRunId, replayedTraceIds) {
@@ -3065,7 +3069,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
3065
3069
  tokens: item.tokens,
3066
3070
  model: item.model,
3067
3071
  dbSnapshotRef: item.dbSnapshotRef,
3068
- dbBranchTimings: item.dbBranchTimings
3072
+ dbBranchTimings: item.dbBranchTimings,
3073
+ traceOutline: item.traceOutline,
3074
+ originalTraceOutline: item.originalTraceOutline
3069
3075
  }
3070
3076
  });
3071
3077
  } catch {
@@ -3145,7 +3151,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
3145
3151
  }
3146
3152
  if (mapped !== void 0) {
3147
3153
  item.tokens = replayTokens?.[mapped] ?? null;
3154
+ item.traceOutline = completeResult.traceOutlines?.[mapped] ?? null;
3148
3155
  }
3156
+ item.originalTraceOutline = completeResult.originalTraceOutlines?.[item.originalTraceId] ?? null;
3149
3157
  }
3150
3158
  if (completedCount > 0 && missing.length === completedCount) {
3151
3159
  const serverCount = completeResult.traceCount !== void 0 ? ` The server persisted ${completeResult.traceCount} trace(s) for this run.` : "";
@@ -3268,10 +3276,12 @@ __export(node_exports, {
3268
3276
  DatasetsClient: () => DatasetsClient,
3269
3277
  DbBranchReplayError: () => DbBranchReplayError,
3270
3278
  HttpClient: () => HttpClient,
3279
+ LabelsClient: () => LabelsClient,
3271
3280
  MixedTracingError: () => MixedTracingError,
3272
3281
  NO_MOCK_OVERRIDE: () => NO_MOCK_OVERRIDE,
3273
3282
  ReplayError: () => ReplayError,
3274
3283
  SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
3284
+ TracesClient: () => TracesClient,
3275
3285
  __version__: () => __version__,
3276
3286
  defineReplayRegistry: () => defineReplayRegistry,
3277
3287
  finalizers: () => finalizers,
@@ -3292,6 +3302,33 @@ registerAsyncLocalStorageClass(
3292
3302
  import_node_async_hooks.AsyncLocalStorage
3293
3303
  );
3294
3304
 
3305
+ // src/assertions.ts
3306
+ function expectationsPath(traceId, suffix = "") {
3307
+ return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
3308
+ }
3309
+ var TracesClient = class {
3310
+ constructor(httpClient) {
3311
+ this.httpClient = httpClient;
3312
+ }
3313
+ async getAssertions(traceId) {
3314
+ return this.httpClient.get(expectationsPath(traceId));
3315
+ }
3316
+ async saveAssertions(params) {
3317
+ const response = await this.httpClient.request(expectationsPath(params.traceId), {
3318
+ assertions: params.assertions,
3319
+ source: params.source ?? "agent"
3320
+ });
3321
+ return response.assertions;
3322
+ }
3323
+ async archiveAssertions(params) {
3324
+ const response = await this.httpClient.request(
3325
+ expectationsPath(params.traceId, "/archive"),
3326
+ { assertionIds: params.assertionIds }
3327
+ );
3328
+ return response.archived;
3329
+ }
3330
+ };
3331
+
3295
3332
  // src/claudeAgentSdk.ts
3296
3333
  init_constants();
3297
3334
  init_http();
@@ -4542,6 +4579,28 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4542
4579
  init_errors();
4543
4580
  init_http();
4544
4581
 
4582
+ // src/labels.ts
4583
+ var LABELS_PATH = "/api/sdk/traces/labels";
4584
+ var LabelsClient = class {
4585
+ constructor(httpClient) {
4586
+ this.httpClient = httpClient;
4587
+ }
4588
+ async save(params) {
4589
+ const response = await this.httpClient.request(
4590
+ LABELS_PATH,
4591
+ {
4592
+ labels: params.labels,
4593
+ ...params.testRunId === void 0 ? {} : { testRunId: params.testRunId }
4594
+ }
4595
+ );
4596
+ return response.labels;
4597
+ }
4598
+ async saveOne(update, testRunId) {
4599
+ const [outcome] = await this.save({ labels: [update], testRunId });
4600
+ return outcome;
4601
+ }
4602
+ };
4603
+
4545
4604
  // src/langgraph.ts
4546
4605
  init_constants();
4547
4606
  init_http();
@@ -6315,6 +6374,8 @@ var Bitfab = class {
6315
6374
  timeout: this.timeout
6316
6375
  });
6317
6376
  this.datasets = new DatasetsClient(this.httpClient);
6377
+ this.traces = new TracesClient(this.httpClient);
6378
+ this.labels = new LabelsClient(this.httpClient);
6318
6379
  }
6319
6380
  /**
6320
6381
  * Decorate a class method as an automatically expanded trace root.
@@ -8220,10 +8281,12 @@ assertAsyncStorageRegistered();
8220
8281
  DatasetsClient,
8221
8282
  DbBranchReplayError,
8222
8283
  HttpClient,
8284
+ LabelsClient,
8223
8285
  MixedTracingError,
8224
8286
  NO_MOCK_OVERRIDE,
8225
8287
  ReplayError,
8226
8288
  SUPPORTED_PROVIDERS,
8289
+ TracesClient,
8227
8290
  __version__,
8228
8291
  defineReplayRegistry,
8229
8292
  finalizers,