@bitfab/sdk 0.48.0 → 0.51.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
@@ -556,7 +556,7 @@ declare class HttpClient {
556
556
  * Start a replay session by fetching historical traces.
557
557
  * Blocking call - creates a test run and returns lightweight item references.
558
558
  */
559
- startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetId?: string, graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean): Promise<StartReplayResponse>;
559
+ startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean): Promise<StartReplayResponse>;
560
560
  /**
561
561
  * Fetch an external span by ID.
562
562
  * Blocking GET request.
@@ -1259,6 +1259,8 @@ declare class DatasetsClient {
1259
1259
 
1260
1260
  type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
1261
1261
  type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
1262
+ type LabelStatus = "labeled" | "skipped" | "unlabeled";
1263
+ type LabelSource = "human" | "agent";
1262
1264
  type LabelTarget = ({
1263
1265
  traceId: string;
1264
1266
  originalTraceId?: never;
@@ -1285,11 +1287,72 @@ type LabelOutcome = {
1285
1287
  traceId: string;
1286
1288
  action: LabelAction;
1287
1289
  };
1290
+ type HumanLabelUpdate = {
1291
+ traceId: string;
1292
+ assertionId?: string;
1293
+ label: boolean;
1294
+ annotation: string;
1295
+ confidence?: LabelConfidence;
1296
+ };
1297
+ type HumanLabelOutcome = {
1298
+ traceId: string;
1299
+ assertionId: string | null;
1300
+ label: boolean;
1301
+ action: "set";
1302
+ };
1303
+ type AssertionVerdict = {
1304
+ assertionId: string;
1305
+ assertion: string | null;
1306
+ labelStatus: LabelStatus;
1307
+ label: boolean | null;
1308
+ annotation: string | null;
1309
+ confidence: LabelConfidence | null;
1310
+ labelSource: LabelSource;
1311
+ approved: boolean;
1312
+ };
1313
+ type TraceLabels = {
1314
+ traceId: string;
1315
+ labelStatus: LabelStatus;
1316
+ label: boolean | null;
1317
+ annotation: string | null;
1318
+ approved: boolean;
1319
+ passed: number;
1320
+ failed: number;
1321
+ assertions: AssertionVerdict[];
1322
+ };
1288
1323
  declare class LabelsClient {
1289
1324
  private readonly httpClient;
1290
1325
  constructor(httpClient: HttpClient);
1291
1326
  save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
1292
1327
  saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
1328
+ saveHuman(update: HumanLabelUpdate): Promise<HumanLabelOutcome>;
1329
+ saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
1330
+ get(traceId: string): Promise<TraceLabels | null>;
1331
+ getAll(traceIds: string[]): Promise<TraceLabels[]>;
1332
+ }
1333
+
1334
+ type GraderLabelSource = "human" | "live_grader";
1335
+ type GraderLabel = {
1336
+ traceId: string;
1337
+ graderId: string;
1338
+ graderName: string | null;
1339
+ graderStatus: string;
1340
+ label: boolean | null;
1341
+ labelReason: string | null;
1342
+ failureDiagnostic: string | null;
1343
+ labelConfidence: LabelConfidence | null;
1344
+ source: GraderLabelSource;
1345
+ evaluatedAt: string | null;
1346
+ };
1347
+ type GetGraderLabelsParams = {
1348
+ traceIds?: string[];
1349
+ graderId?: string;
1350
+ limit?: number;
1351
+ };
1352
+ declare class GradersClient {
1353
+ private readonly httpClient;
1354
+ constructor(httpClient: HttpClient);
1355
+ getLabels(params: GetGraderLabelsParams): Promise<GraderLabel[]>;
1293
1356
  }
1294
1357
 
1295
1358
  /**
@@ -1582,12 +1645,15 @@ interface DbBranchOptions {
1582
1645
  interface ReplayOptions {
1583
1646
  /**
1584
1647
  * Maximum number of traces to replay (1-5,000, default 5). Ignored when
1585
- * `traceIds` is passed (with a warning), or when `datasetId` is passed,
1586
- * because either source already determines how many traces replay.
1648
+ * `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
1649
+ * is passed, because either source already determines how many traces replay.
1587
1650
  */
1588
1651
  limit?: number;
1589
1652
  attempts?: number;
1590
- /** Optional list of specific trace IDs to replay (max 100). Mutually exclusive with `datasetId`. */
1653
+ /**
1654
+ * Optional list of specific trace IDs to replay (max 100). Mutually exclusive
1655
+ * with `datasetId` and `datasetIds`.
1656
+ */
1591
1657
  traceIds?: string[];
1592
1658
  /** Optional display name for the resulting experiment/test run. */
1593
1659
  name?: string;
@@ -1644,13 +1710,14 @@ interface ReplayOptions {
1644
1710
  /** Group ID to associate this replay with an experiment group for live streaming in Studio. */
1645
1711
  experimentGroupId?: string;
1646
1712
  /**
1647
- * Dataset this replay runs against. Mutually exclusive with `traceIds`. When
1648
- * set, the resulting experiment is
1713
+ * Dataset this replay runs against. Mutually exclusive with `traceIds` and
1714
+ * with `datasetIds`. When set, the resulting experiment is
1649
1715
  * durably attributed to the dataset (stored on the test run), so it appears
1650
1716
  * under the dataset's experiments even if the trace lineage can't be
1651
1717
  * reconstructed. Validated server-side against the org.
1652
1718
  */
1653
1719
  datasetId?: string;
1720
+ datasetIds?: string[];
1654
1721
  /**
1655
1722
  * Graders to attach directly to this experiment (test run), independent of any
1656
1723
  * graders already on the dataset. The resulting experiment is graded by the
@@ -1663,7 +1730,7 @@ interface ReplayOptions {
1663
1730
  /**
1664
1731
  * Replay only the selected traces that carry at least one assertion.
1665
1732
  *
1666
- * Narrows whatever `limit`, `traceIds` or `datasetId` selected, so a run that
1733
+ * Narrows whatever `limit`, `traceIds` or `datasetIds` selected, so a run that
1667
1734
  * measures assertion outcomes does not pay to re-execute traces nothing can
1668
1735
  * grade. The server applies it as part of selection, which is what makes it
1669
1736
  * compose with `limit`: `{ limit: 10, onlyWithAssertions: true }` is the ten
@@ -2566,6 +2633,7 @@ declare class Bitfab {
2566
2633
  readonly datasets: DatasetsClient;
2567
2634
  readonly traces: TracesClient;
2568
2635
  readonly labels: LabelsClient;
2636
+ readonly graders: GradersClient;
2569
2637
  private readonly bamlClient;
2570
2638
  private readonly dbSnapshot;
2571
2639
  private readonly autoTracePolicyRefreshes;
@@ -3211,7 +3279,7 @@ declare class BitfabFunction {
3211
3279
  /**
3212
3280
  * SDK version from package.json (injected at build time)
3213
3281
  */
3214
- declare const __version__ = "0.48.0";
3282
+ declare const __version__ = "0.51.0";
3215
3283
 
3216
3284
  /**
3217
3285
  * Constants for the Bitfab SDK.
@@ -3341,4 +3409,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3341
3409
  run?: boolean;
3342
3410
  }): Promise<SeedResult>;
3343
3411
 
3344
- 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 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 };
3412
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, type AssertionVerdict, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, 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 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 TraceLabels, 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
@@ -556,7 +556,7 @@ declare class HttpClient {
556
556
  * Start a replay session by fetching historical traces.
557
557
  * Blocking call - creates a test run and returns lightweight item references.
558
558
  */
559
- startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetId?: string, graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean): Promise<StartReplayResponse>;
559
+ startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean): Promise<StartReplayResponse>;
560
560
  /**
561
561
  * Fetch an external span by ID.
562
562
  * Blocking GET request.
@@ -1259,6 +1259,8 @@ declare class DatasetsClient {
1259
1259
 
1260
1260
  type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
1261
1261
  type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
1262
+ type LabelStatus = "labeled" | "skipped" | "unlabeled";
1263
+ type LabelSource = "human" | "agent";
1262
1264
  type LabelTarget = ({
1263
1265
  traceId: string;
1264
1266
  originalTraceId?: never;
@@ -1285,11 +1287,72 @@ type LabelOutcome = {
1285
1287
  traceId: string;
1286
1288
  action: LabelAction;
1287
1289
  };
1290
+ type HumanLabelUpdate = {
1291
+ traceId: string;
1292
+ assertionId?: string;
1293
+ label: boolean;
1294
+ annotation: string;
1295
+ confidence?: LabelConfidence;
1296
+ };
1297
+ type HumanLabelOutcome = {
1298
+ traceId: string;
1299
+ assertionId: string | null;
1300
+ label: boolean;
1301
+ action: "set";
1302
+ };
1303
+ type AssertionVerdict = {
1304
+ assertionId: string;
1305
+ assertion: string | null;
1306
+ labelStatus: LabelStatus;
1307
+ label: boolean | null;
1308
+ annotation: string | null;
1309
+ confidence: LabelConfidence | null;
1310
+ labelSource: LabelSource;
1311
+ approved: boolean;
1312
+ };
1313
+ type TraceLabels = {
1314
+ traceId: string;
1315
+ labelStatus: LabelStatus;
1316
+ label: boolean | null;
1317
+ annotation: string | null;
1318
+ approved: boolean;
1319
+ passed: number;
1320
+ failed: number;
1321
+ assertions: AssertionVerdict[];
1322
+ };
1288
1323
  declare class LabelsClient {
1289
1324
  private readonly httpClient;
1290
1325
  constructor(httpClient: HttpClient);
1291
1326
  save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
1292
1327
  saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
1328
+ saveHuman(update: HumanLabelUpdate): Promise<HumanLabelOutcome>;
1329
+ saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
1330
+ get(traceId: string): Promise<TraceLabels | null>;
1331
+ getAll(traceIds: string[]): Promise<TraceLabels[]>;
1332
+ }
1333
+
1334
+ type GraderLabelSource = "human" | "live_grader";
1335
+ type GraderLabel = {
1336
+ traceId: string;
1337
+ graderId: string;
1338
+ graderName: string | null;
1339
+ graderStatus: string;
1340
+ label: boolean | null;
1341
+ labelReason: string | null;
1342
+ failureDiagnostic: string | null;
1343
+ labelConfidence: LabelConfidence | null;
1344
+ source: GraderLabelSource;
1345
+ evaluatedAt: string | null;
1346
+ };
1347
+ type GetGraderLabelsParams = {
1348
+ traceIds?: string[];
1349
+ graderId?: string;
1350
+ limit?: number;
1351
+ };
1352
+ declare class GradersClient {
1353
+ private readonly httpClient;
1354
+ constructor(httpClient: HttpClient);
1355
+ getLabels(params: GetGraderLabelsParams): Promise<GraderLabel[]>;
1293
1356
  }
1294
1357
 
1295
1358
  /**
@@ -1582,12 +1645,15 @@ interface DbBranchOptions {
1582
1645
  interface ReplayOptions {
1583
1646
  /**
1584
1647
  * Maximum number of traces to replay (1-5,000, default 5). Ignored when
1585
- * `traceIds` is passed (with a warning), or when `datasetId` is passed,
1586
- * because either source already determines how many traces replay.
1648
+ * `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
1649
+ * is passed, because either source already determines how many traces replay.
1587
1650
  */
1588
1651
  limit?: number;
1589
1652
  attempts?: number;
1590
- /** Optional list of specific trace IDs to replay (max 100). Mutually exclusive with `datasetId`. */
1653
+ /**
1654
+ * Optional list of specific trace IDs to replay (max 100). Mutually exclusive
1655
+ * with `datasetId` and `datasetIds`.
1656
+ */
1591
1657
  traceIds?: string[];
1592
1658
  /** Optional display name for the resulting experiment/test run. */
1593
1659
  name?: string;
@@ -1644,13 +1710,14 @@ interface ReplayOptions {
1644
1710
  /** Group ID to associate this replay with an experiment group for live streaming in Studio. */
1645
1711
  experimentGroupId?: string;
1646
1712
  /**
1647
- * Dataset this replay runs against. Mutually exclusive with `traceIds`. When
1648
- * set, the resulting experiment is
1713
+ * Dataset this replay runs against. Mutually exclusive with `traceIds` and
1714
+ * with `datasetIds`. When set, the resulting experiment is
1649
1715
  * durably attributed to the dataset (stored on the test run), so it appears
1650
1716
  * under the dataset's experiments even if the trace lineage can't be
1651
1717
  * reconstructed. Validated server-side against the org.
1652
1718
  */
1653
1719
  datasetId?: string;
1720
+ datasetIds?: string[];
1654
1721
  /**
1655
1722
  * Graders to attach directly to this experiment (test run), independent of any
1656
1723
  * graders already on the dataset. The resulting experiment is graded by the
@@ -1663,7 +1730,7 @@ interface ReplayOptions {
1663
1730
  /**
1664
1731
  * Replay only the selected traces that carry at least one assertion.
1665
1732
  *
1666
- * Narrows whatever `limit`, `traceIds` or `datasetId` selected, so a run that
1733
+ * Narrows whatever `limit`, `traceIds` or `datasetIds` selected, so a run that
1667
1734
  * measures assertion outcomes does not pay to re-execute traces nothing can
1668
1735
  * grade. The server applies it as part of selection, which is what makes it
1669
1736
  * compose with `limit`: `{ limit: 10, onlyWithAssertions: true }` is the ten
@@ -2566,6 +2633,7 @@ declare class Bitfab {
2566
2633
  readonly datasets: DatasetsClient;
2567
2634
  readonly traces: TracesClient;
2568
2635
  readonly labels: LabelsClient;
2636
+ readonly graders: GradersClient;
2569
2637
  private readonly bamlClient;
2570
2638
  private readonly dbSnapshot;
2571
2639
  private readonly autoTracePolicyRefreshes;
@@ -3211,7 +3279,7 @@ declare class BitfabFunction {
3211
3279
  /**
3212
3280
  * SDK version from package.json (injected at build time)
3213
3281
  */
3214
- declare const __version__ = "0.48.0";
3282
+ declare const __version__ = "0.51.0";
3215
3283
 
3216
3284
  /**
3217
3285
  * Constants for the Bitfab SDK.
@@ -3341,4 +3409,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3341
3409
  run?: boolean;
3342
3410
  }): Promise<SeedResult>;
3343
3411
 
3344
- 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 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 };
3412
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, type AssertionVerdict, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, 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 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 TraceLabels, 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,6 +8,7 @@ import {
8
8
  BitfabOpenAITracingProcessor,
9
9
  BitfabVercelAiHandler,
10
10
  DatasetsClient,
11
+ GradersClient,
11
12
  LabelsClient,
12
13
  SUPPORTED_PROVIDERS,
13
14
  TracesClient,
@@ -17,7 +18,7 @@ import {
17
18
  getCurrentSpan,
18
19
  getCurrentTrace,
19
20
  seedFromRegistry
20
- } from "./chunk-ZIPITG22.js";
21
+ } from "./chunk-VXD27AJ3.js";
21
22
  import "./chunk-ZUD7OFYB.js";
22
23
  import {
23
24
  BITFAB_PROGRESS_PREFIX,
@@ -26,7 +27,7 @@ import {
26
27
  ReplayError,
27
28
  reportReplayProgress,
28
29
  serializeReplayResult
29
- } from "./chunk-LUDC6WMA.js";
30
+ } from "./chunk-DNYZJLNY.js";
30
31
  import {
31
32
  BitfabError,
32
33
  DEFAULT_SERVICE_URL,
@@ -34,7 +35,7 @@ import {
34
35
  MixedTracingError,
35
36
  __version__,
36
37
  flushTraces
37
- } from "./chunk-OKSCUFJ6.js";
38
+ } from "./chunk-RGC7IEOI.js";
38
39
  import "./chunk-H6LZRFMN.js";
39
40
  export {
40
41
  BITFAB_PROGRESS_PREFIX,
@@ -51,6 +52,7 @@ export {
51
52
  DEFAULT_SERVICE_URL,
52
53
  DatasetsClient,
53
54
  DbBranchReplayError,
55
+ GradersClient,
54
56
  HttpClient,
55
57
  LabelsClient,
56
58
  MixedTracingError,
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.48.0";
91
+ __version__ = "0.51.0";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -1854,7 +1854,7 @@ var init_http = __esm({
1854
1854
  * Start a replay session by fetching historical traces.
1855
1855
  * Blocking call - creates a test run and returns lightweight item references.
1856
1856
  */
1857
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
1857
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
1858
1858
  const payload = { traceFunctionKey };
1859
1859
  if (limit !== void 0) {
1860
1860
  payload.limit = limit;
@@ -1878,8 +1878,12 @@ var init_http = __esm({
1878
1878
  if (experimentGroupId !== void 0) {
1879
1879
  payload.experimentGroupId = experimentGroupId;
1880
1880
  }
1881
- if (datasetId !== void 0) {
1882
- payload.datasetId = datasetId;
1881
+ if (datasetIds !== void 0) {
1882
+ if (datasetIds.length === 1) {
1883
+ payload.datasetId = datasetIds[0];
1884
+ } else {
1885
+ payload.datasetIds = datasetIds;
1886
+ }
1883
1887
  }
1884
1888
  if (graderIds !== void 0) {
1885
1889
  payload.graderIds = graderIds;
@@ -2481,6 +2485,23 @@ function resolveAttempts(attempts) {
2481
2485
  }
2482
2486
  return attempts;
2483
2487
  }
2488
+ function resolveDatasetIds(options) {
2489
+ if (options?.datasetId !== void 0 && options?.datasetIds !== void 0) {
2490
+ throw new BitfabError(
2491
+ "datasetId and datasetIds are the same selector: pass one dataset through datasetId, or several through datasetIds."
2492
+ );
2493
+ }
2494
+ if (options?.datasetId !== void 0) {
2495
+ return [options.datasetId];
2496
+ }
2497
+ if (options?.datasetIds === void 0) {
2498
+ return void 0;
2499
+ }
2500
+ if (options.datasetIds.length === 0) {
2501
+ throw new BitfabError("datasetIds must contain at least one dataset ID.");
2502
+ }
2503
+ return [...new Set(options.datasetIds)];
2504
+ }
2484
2505
  function dbBranchEnabled(dbBranch) {
2485
2506
  return dbBranch !== void 0 && dbBranch !== false;
2486
2507
  }
@@ -2913,9 +2934,10 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
2913
2934
  );
2914
2935
  }
2915
2936
  }
2916
- if (options?.traceIds !== void 0 && options?.datasetId !== void 0) {
2937
+ const datasetIds = resolveDatasetIds(options);
2938
+ if (options?.traceIds !== void 0 && datasetIds !== void 0) {
2917
2939
  throw new BitfabError(
2918
- "traceIds and datasetId select different replay sources and cannot be used together."
2940
+ "traceIds and datasetIds select different replay sources and cannot be used together."
2919
2941
  );
2920
2942
  }
2921
2943
  if (options?.limit !== void 0 && options?.traceIds !== void 0) {
@@ -2957,7 +2979,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
2957
2979
  // before it could report its resolved inputs.
2958
2980
  dbBranchEnabled(options?.dbBranch) && options?.dryRun !== true,
2959
2981
  options?.experimentGroupId,
2960
- options?.datasetId,
2982
+ datasetIds,
2961
2983
  options?.graderIds,
2962
2984
  resolveDbBranchSettings(options?.dbBranch),
2963
2985
  attempts,
@@ -3279,6 +3301,7 @@ __export(node_exports, {
3279
3301
  DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
3280
3302
  DatasetsClient: () => DatasetsClient,
3281
3303
  DbBranchReplayError: () => DbBranchReplayError,
3304
+ GradersClient: () => GradersClient,
3282
3305
  HttpClient: () => HttpClient,
3283
3306
  LabelsClient: () => LabelsClient,
3284
3307
  MixedTracingError: () => MixedTracingError,
@@ -4581,10 +4604,45 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4581
4604
 
4582
4605
  // src/client.ts
4583
4606
  init_errors();
4607
+
4608
+ // src/graders.ts
4609
+ init_errors();
4610
+ var GRADER_LABELS_PATH = "/api/sdk/graderLabels";
4611
+ var GradersClient = class {
4612
+ constructor(httpClient) {
4613
+ this.httpClient = httpClient;
4614
+ }
4615
+ async getLabels(params) {
4616
+ const hasTraceIds = params.traceIds !== void 0 && params.traceIds.length > 0;
4617
+ const hasGraderId = params.graderId !== void 0;
4618
+ if (!hasTraceIds && !hasGraderId) {
4619
+ throw new BitfabError(
4620
+ "Pass traceIds, graderId, or both: there is nothing to read otherwise."
4621
+ );
4622
+ }
4623
+ const query = new URLSearchParams();
4624
+ if (params.traceIds !== void 0 && params.traceIds.length > 0) {
4625
+ query.set("traceIds", params.traceIds.join(","));
4626
+ }
4627
+ if (params.graderId !== void 0) {
4628
+ query.set("graderId", params.graderId);
4629
+ }
4630
+ if (params.limit !== void 0) {
4631
+ query.set("limit", String(params.limit));
4632
+ }
4633
+ const response = await this.httpClient.get(
4634
+ `${GRADER_LABELS_PATH}?${query.toString()}`
4635
+ );
4636
+ return response.labels;
4637
+ }
4638
+ };
4639
+
4640
+ // src/client.ts
4584
4641
  init_http();
4585
4642
 
4586
4643
  // src/labels.ts
4587
4644
  var LABELS_PATH = "/api/sdk/traces/labels";
4645
+ var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
4588
4646
  var LabelsClient = class {
4589
4647
  constructor(httpClient) {
4590
4648
  this.httpClient = httpClient;
@@ -4603,6 +4661,28 @@ var LabelsClient = class {
4603
4661
  );
4604
4662
  return response.labels;
4605
4663
  }
4664
+ async saveHuman(update) {
4665
+ const [outcome] = await this.saveHumanAll([update]);
4666
+ return outcome;
4667
+ }
4668
+ async saveHumanAll(updates) {
4669
+ const response = await this.httpClient.request(HUMAN_LABELS_PATH, { labels: updates });
4670
+ return response.labels;
4671
+ }
4672
+ async get(traceId) {
4673
+ const [labels] = await this.getAll([traceId]);
4674
+ return labels ?? null;
4675
+ }
4676
+ async getAll(traceIds) {
4677
+ if (traceIds.length === 0) {
4678
+ return [];
4679
+ }
4680
+ const query = new URLSearchParams({ traceIds: traceIds.join(",") });
4681
+ const response = await this.httpClient.get(
4682
+ `${LABELS_PATH}?${query.toString()}`
4683
+ );
4684
+ return response.labels;
4685
+ }
4606
4686
  };
4607
4687
 
4608
4688
  // src/langgraph.ts
@@ -6380,6 +6460,7 @@ var Bitfab = class {
6380
6460
  this.datasets = new DatasetsClient(this.httpClient);
6381
6461
  this.traces = new TracesClient(this.httpClient);
6382
6462
  this.labels = new LabelsClient(this.httpClient);
6463
+ this.graders = new GradersClient(this.httpClient);
6383
6464
  }
6384
6465
  /**
6385
6466
  * Decorate a class method as an automatically expanded trace root.
@@ -8284,6 +8365,7 @@ assertAsyncStorageRegistered();
8284
8365
  DEFAULT_SERVICE_URL,
8285
8366
  DatasetsClient,
8286
8367
  DbBranchReplayError,
8368
+ GradersClient,
8287
8369
  HttpClient,
8288
8370
  LabelsClient,
8289
8371
  MixedTracingError,