bitfab 0.57.5 → 0.57.7

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.
Files changed (33) hide show
  1. package/dist/{chunk-I5EG523G.js → chunk-IYGYSMSD.js} +3 -3
  2. package/dist/{chunk-WYNN6NY2.js → chunk-NRUFN7RZ.js} +26 -13
  3. package/dist/chunk-NRUFN7RZ.js.map +1 -0
  4. package/dist/{chunk-255I4PN4.js → chunk-P4R3NY2U.js} +36 -16
  5. package/dist/chunk-P4R3NY2U.js.map +1 -0
  6. package/dist/{chunk-VPZ2LTU6.js → chunk-VPU6U4WM.js} +2 -2
  7. package/dist/{chunk-YO3HKQX6.js → chunk-W3HLGZBO.js} +137 -67
  8. package/dist/chunk-W3HLGZBO.js.map +1 -0
  9. package/dist/{http-FQ76VRFF.js → http-AFLRC33F.js} +2 -2
  10. package/dist/{http-CHXMOVLK.js → http-ODKUB6M4.js} +2 -2
  11. package/dist/index.cjs +166 -77
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +125 -127
  14. package/dist/index.d.ts +125 -127
  15. package/dist/index.js +3 -5
  16. package/dist/node.cjs +166 -77
  17. package/dist/node.cjs.map +1 -1
  18. package/dist/node.d.cts +1 -1
  19. package/dist/node.d.ts +1 -1
  20. package/dist/node.js +3 -5
  21. package/dist/node.js.map +1 -1
  22. package/dist/{replay-CHM7OQ25.js → replay-2VGODDLA.js} +3 -3
  23. package/dist/replayCli.js +2 -2
  24. package/dist/seedCli.js +2 -2
  25. package/package.json +1 -1
  26. package/dist/chunk-255I4PN4.js.map +0 -1
  27. package/dist/chunk-WYNN6NY2.js.map +0 -1
  28. package/dist/chunk-YO3HKQX6.js.map +0 -1
  29. /package/dist/{chunk-I5EG523G.js.map → chunk-IYGYSMSD.js.map} +0 -0
  30. /package/dist/{chunk-VPZ2LTU6.js.map → chunk-VPU6U4WM.js.map} +0 -0
  31. /package/dist/{http-CHXMOVLK.js.map → http-AFLRC33F.js.map} +0 -0
  32. /package/dist/{http-FQ76VRFF.js.map → http-ODKUB6M4.js.map} +0 -0
  33. /package/dist/{replay-CHM7OQ25.js.map → replay-2VGODDLA.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -440,7 +440,8 @@ declare class HttpClient {
440
440
  readonly traceCompletion: TraceCompletion;
441
441
  private closed;
442
442
  private closing;
443
- externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
443
+ externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit, drop: () => void) => void) | undefined;
444
+ frameworkSpanStart: ((traceId: string, spanId: string, parentSpanId: string | null) => void) | undefined;
444
445
  externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
445
446
  releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
446
447
  stopSimulationPlan: (() => void) | undefined;
@@ -570,6 +571,7 @@ declare class HttpClient {
570
571
  * the OTLP carrier has no path to carry it.
571
572
  */
572
573
  sendInternalTrace(functionId: string, payload: Record<string, unknown>): void;
574
+ reserveFrameworkSpan(traceId: string, spanId: string, parentSpanId: string | null | undefined): void;
573
575
  sendExternalSpan(payload: Record<string, unknown>): void;
574
576
  submitExternalSpan(payload: Record<string, unknown>): void;
575
577
  /**
@@ -1303,6 +1305,123 @@ declare class DatasetsClient {
1303
1305
  getGraderRerun(datasetId: string, runId?: string): Promise<GraderRerun | null>;
1304
1306
  }
1305
1307
 
1308
+ type TraceTargetOccurrence = "first" | "last" | number;
1309
+ type TraceTarget = {
1310
+ kind: "output";
1311
+ } | {
1312
+ kind: "span";
1313
+ name: string;
1314
+ occurrence?: TraceTargetOccurrence;
1315
+ };
1316
+ type TraceAssertionSource = "human" | "agent";
1317
+ type TraceSearchFilters = {
1318
+ callerMetadata?: Record<string, string>;
1319
+ name?: string;
1320
+ nameContains?: string;
1321
+ };
1322
+ type TraceSearchParams = TraceSearchFilters & ({
1323
+ callerMetadata: Record<string, string>;
1324
+ } | {
1325
+ name: string;
1326
+ } | {
1327
+ nameContains: string;
1328
+ }) & {
1329
+ traceFunctionKey?: string;
1330
+ cursor?: string | null;
1331
+ limit?: number;
1332
+ };
1333
+ type TraceSearchResult = {
1334
+ traces: Array<{
1335
+ id: string;
1336
+ traceFunctionKey: string | null;
1337
+ name: string | null;
1338
+ status: "pending" | "completed" | "failed" | "dropped";
1339
+ createdAt: string;
1340
+ callerMetadata: Record<string, string>;
1341
+ }>;
1342
+ nextCursor: string | null;
1343
+ hasMore: boolean;
1344
+ };
1345
+ type TraceAssertion = {
1346
+ id: string;
1347
+ traceId: string;
1348
+ assertion: string;
1349
+ humanNote: string | null;
1350
+ category_assertion_id: string | null;
1351
+ category: AssertionCategorySummary | null;
1352
+ passCriteria: string | null;
1353
+ failCriteria: string | null;
1354
+ targetOnEvaluatedTrace: TraceTarget | null;
1355
+ source: TraceAssertionSource;
1356
+ /** Why this assertion is right for its trace, span by span. */
1357
+ justification: Justification | null;
1358
+ /** Why its assigned category is the right one, span by span. */
1359
+ categoryJustification: Justification | null;
1360
+ createdAt: string;
1361
+ updatedAt: string;
1362
+ } & ApprovalFields;
1363
+ type AssertionEvidenceParameter = {
1364
+ name: string;
1365
+ type: "string" | "number" | "boolean" | "object" | "array" | "null" | "unknown";
1366
+ };
1367
+ type PotentialAssertionEvidence = {
1368
+ spanId: string;
1369
+ text: string;
1370
+ spanName: string | null;
1371
+ parameters: AssertionEvidenceParameter[];
1372
+ spanType: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
1373
+ isMocked: boolean;
1374
+ };
1375
+ type SaveAssertion = {
1376
+ /** Omit to preserve the category, or pass null to clear it. */
1377
+ category_assertion_id?: string | null;
1378
+ id?: string;
1379
+ assertion: string;
1380
+ passCriteria?: string | null;
1381
+ failCriteria?: string | null;
1382
+ targetOnEvaluatedTrace?: TraceTarget | null;
1383
+ /**
1384
+ * Why this assertion is right for this trace, one entry per span it rests on.
1385
+ * Cite spans on this trace only. Omit on an edit to preserve it.
1386
+ */
1387
+ justification?: Justification | null;
1388
+ /**
1389
+ * Why `category_assertion_id` is the right category. Changing the category
1390
+ * clears it. Omit on an edit to preserve it.
1391
+ */
1392
+ categoryJustification?: Justification | null;
1393
+ };
1394
+ type TraceAssertionsResult = {
1395
+ assertions: TraceAssertion[];
1396
+ inheritedFrom: string | null;
1397
+ };
1398
+ type TraceAssertionsUpdate = {
1399
+ traceId: string;
1400
+ assertions: SaveAssertion[];
1401
+ };
1402
+ type SaveAssertionsParams = {
1403
+ traceId: string;
1404
+ assertions: SaveAssertion[];
1405
+ source?: TraceAssertionSource;
1406
+ };
1407
+ type SaveAssertionsAllParams = {
1408
+ updates: TraceAssertionsUpdate[];
1409
+ source?: TraceAssertionSource;
1410
+ };
1411
+ type ArchiveAssertionsParams = {
1412
+ traceId: string;
1413
+ assertionIds: string[];
1414
+ };
1415
+ declare class TracesClient {
1416
+ private readonly httpClient;
1417
+ constructor(httpClient: HttpClient);
1418
+ search(params: TraceSearchParams): Promise<TraceSearchResult>;
1419
+ getAssertions(traceId: string): Promise<TraceAssertionsResult>;
1420
+ saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
1421
+ saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
1422
+ archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
1423
+ }
1424
+
1306
1425
  type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
1307
1426
  type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
1308
1427
  type LabelStatus = "labeled" | "skipped" | "unlabeled";
@@ -1383,6 +1502,8 @@ declare class LabelsClient {
1383
1502
  saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
1384
1503
  get(traceId: string): Promise<TraceLabels | null>;
1385
1504
  getAll(traceIds: string[]): Promise<TraceLabels[]>;
1505
+ /** Generate suggested evidence for an assertion on an original or replay trace. */
1506
+ generateLabelEvidence(traceId: string, assertionId: string): Promise<PotentialAssertionEvidence[]>;
1386
1507
  }
1387
1508
 
1388
1509
  type GraderLabelSource = "human" | "live_grader";
@@ -2294,130 +2415,6 @@ declare class BitfabRivetIntegration<TContext extends object = RivetContextLike>
2294
2415
  private createQueueIterator;
2295
2416
  }
2296
2417
 
2297
- type TraceTargetOccurrence = "first" | "last" | number;
2298
- type TraceTarget = {
2299
- kind: "output";
2300
- } | {
2301
- kind: "span";
2302
- name: string;
2303
- occurrence?: TraceTargetOccurrence;
2304
- };
2305
- type TraceAssertionSource = "human" | "agent";
2306
- type TraceSearchFilters = {
2307
- callerMetadata?: Record<string, string>;
2308
- name?: string;
2309
- nameContains?: string;
2310
- };
2311
- type TraceSearchParams = TraceSearchFilters & ({
2312
- callerMetadata: Record<string, string>;
2313
- } | {
2314
- name: string;
2315
- } | {
2316
- nameContains: string;
2317
- }) & {
2318
- traceFunctionKey?: string;
2319
- cursor?: string | null;
2320
- limit?: number;
2321
- };
2322
- type TraceSearchResult = {
2323
- traces: Array<{
2324
- id: string;
2325
- traceFunctionKey: string | null;
2326
- name: string | null;
2327
- status: "pending" | "completed" | "failed" | "dropped";
2328
- createdAt: string;
2329
- callerMetadata: Record<string, string>;
2330
- }>;
2331
- nextCursor: string | null;
2332
- hasMore: boolean;
2333
- };
2334
- type TraceAssertion = {
2335
- id: string;
2336
- traceId: string;
2337
- assertion: string;
2338
- humanNote: string | null;
2339
- category_assertion_id: string | null;
2340
- category: AssertionCategorySummary | null;
2341
- passCriteria: string | null;
2342
- failCriteria: string | null;
2343
- targetOnEvaluatedTrace: TraceTarget | null;
2344
- source: TraceAssertionSource;
2345
- /** Why this assertion is right for its trace, span by span. */
2346
- justification: Justification | null;
2347
- /** Why its assigned category is the right one, span by span. */
2348
- categoryJustification: Justification | null;
2349
- createdAt: string;
2350
- updatedAt: string;
2351
- } & ApprovalFields;
2352
- type AssertionEvidenceParameter = {
2353
- name: string;
2354
- type: "string" | "number" | "boolean" | "object" | "array" | "null" | "unknown";
2355
- };
2356
- type PotentialAssertionEvidence = {
2357
- spanId: string;
2358
- text: string;
2359
- spanName: string | null;
2360
- parameters: AssertionEvidenceParameter[];
2361
- spanType: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
2362
- isMocked: boolean;
2363
- };
2364
- type SaveAssertion = {
2365
- /** Omit to preserve the category, or pass null to clear it. */
2366
- category_assertion_id?: string | null;
2367
- id?: string;
2368
- assertion: string;
2369
- passCriteria?: string | null;
2370
- failCriteria?: string | null;
2371
- targetOnEvaluatedTrace?: TraceTarget | null;
2372
- /**
2373
- * Why this assertion is right for this trace, one entry per span it rests on.
2374
- * Cite spans on this trace only. Omit on an edit to preserve it.
2375
- */
2376
- justification?: Justification | null;
2377
- /**
2378
- * Why `category_assertion_id` is the right category. Changing the category
2379
- * clears it. Omit on an edit to preserve it.
2380
- */
2381
- categoryJustification?: Justification | null;
2382
- };
2383
- type TraceAssertionsResult = {
2384
- assertions: TraceAssertion[];
2385
- inheritedFrom: string | null;
2386
- };
2387
- type TraceAssertionsUpdate = {
2388
- traceId: string;
2389
- assertions: SaveAssertion[];
2390
- };
2391
- type SaveAssertionsParams = {
2392
- traceId: string;
2393
- assertions: SaveAssertion[];
2394
- source?: TraceAssertionSource;
2395
- };
2396
- type SaveAssertionsAllParams = {
2397
- updates: TraceAssertionsUpdate[];
2398
- source?: TraceAssertionSource;
2399
- };
2400
- type ArchiveAssertionsParams = {
2401
- traceId: string;
2402
- assertionIds: string[];
2403
- };
2404
- declare class TraceAssertionsClient {
2405
- private readonly httpClient;
2406
- constructor(httpClient: HttpClient);
2407
- /** Suggest evidence for an assertion, enriched with its span context. */
2408
- getAssertionEvidence(assertionId: string): Promise<PotentialAssertionEvidence[]>;
2409
- }
2410
- declare class TracesClient {
2411
- private readonly httpClient;
2412
- readonly assertions: TraceAssertionsClient;
2413
- constructor(httpClient: HttpClient);
2414
- search(params: TraceSearchParams): Promise<TraceSearchResult>;
2415
- getAssertions(traceId: string): Promise<TraceAssertionsResult>;
2416
- saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
2417
- saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
2418
- archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
2419
- }
2420
-
2421
2418
  /**
2422
2419
  * Tracing utilities for external trace submission to Bitfab.
2423
2420
  *
@@ -2432,6 +2429,7 @@ interface Trace {
2432
2429
  interface Span<_T = any> {
2433
2430
  spanId?: string;
2434
2431
  traceId?: string;
2432
+ parentId?: string | null;
2435
2433
  toJSON(): unknown;
2436
2434
  spanData?: {
2437
2435
  type?: string;
@@ -3627,7 +3625,7 @@ interface CommitRef {
3627
3625
  /**
3628
3626
  * SDK version from package.json (injected at build time)
3629
3627
  */
3630
- declare const __version__ = "0.57.5";
3628
+ declare const __version__ = "0.57.7";
3631
3629
 
3632
3630
  /**
3633
3631
  * Constants for the Bitfab SDK.
@@ -3766,4 +3764,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3766
3764
  run?: boolean;
3767
3765
  }): Promise<SeedResult>;
3768
3766
 
3769
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 PotentialAssertionEvidence, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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, TraceAssertionsClient, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
3767
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 PotentialAssertionEvidence, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
package/dist/index.d.ts CHANGED
@@ -440,7 +440,8 @@ declare class HttpClient {
440
440
  readonly traceCompletion: TraceCompletion;
441
441
  private closed;
442
442
  private closing;
443
- externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
443
+ externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit, drop: () => void) => void) | undefined;
444
+ frameworkSpanStart: ((traceId: string, spanId: string, parentSpanId: string | null) => void) | undefined;
444
445
  externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
445
446
  releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
446
447
  stopSimulationPlan: (() => void) | undefined;
@@ -570,6 +571,7 @@ declare class HttpClient {
570
571
  * the OTLP carrier has no path to carry it.
571
572
  */
572
573
  sendInternalTrace(functionId: string, payload: Record<string, unknown>): void;
574
+ reserveFrameworkSpan(traceId: string, spanId: string, parentSpanId: string | null | undefined): void;
573
575
  sendExternalSpan(payload: Record<string, unknown>): void;
574
576
  submitExternalSpan(payload: Record<string, unknown>): void;
575
577
  /**
@@ -1303,6 +1305,123 @@ declare class DatasetsClient {
1303
1305
  getGraderRerun(datasetId: string, runId?: string): Promise<GraderRerun | null>;
1304
1306
  }
1305
1307
 
1308
+ type TraceTargetOccurrence = "first" | "last" | number;
1309
+ type TraceTarget = {
1310
+ kind: "output";
1311
+ } | {
1312
+ kind: "span";
1313
+ name: string;
1314
+ occurrence?: TraceTargetOccurrence;
1315
+ };
1316
+ type TraceAssertionSource = "human" | "agent";
1317
+ type TraceSearchFilters = {
1318
+ callerMetadata?: Record<string, string>;
1319
+ name?: string;
1320
+ nameContains?: string;
1321
+ };
1322
+ type TraceSearchParams = TraceSearchFilters & ({
1323
+ callerMetadata: Record<string, string>;
1324
+ } | {
1325
+ name: string;
1326
+ } | {
1327
+ nameContains: string;
1328
+ }) & {
1329
+ traceFunctionKey?: string;
1330
+ cursor?: string | null;
1331
+ limit?: number;
1332
+ };
1333
+ type TraceSearchResult = {
1334
+ traces: Array<{
1335
+ id: string;
1336
+ traceFunctionKey: string | null;
1337
+ name: string | null;
1338
+ status: "pending" | "completed" | "failed" | "dropped";
1339
+ createdAt: string;
1340
+ callerMetadata: Record<string, string>;
1341
+ }>;
1342
+ nextCursor: string | null;
1343
+ hasMore: boolean;
1344
+ };
1345
+ type TraceAssertion = {
1346
+ id: string;
1347
+ traceId: string;
1348
+ assertion: string;
1349
+ humanNote: string | null;
1350
+ category_assertion_id: string | null;
1351
+ category: AssertionCategorySummary | null;
1352
+ passCriteria: string | null;
1353
+ failCriteria: string | null;
1354
+ targetOnEvaluatedTrace: TraceTarget | null;
1355
+ source: TraceAssertionSource;
1356
+ /** Why this assertion is right for its trace, span by span. */
1357
+ justification: Justification | null;
1358
+ /** Why its assigned category is the right one, span by span. */
1359
+ categoryJustification: Justification | null;
1360
+ createdAt: string;
1361
+ updatedAt: string;
1362
+ } & ApprovalFields;
1363
+ type AssertionEvidenceParameter = {
1364
+ name: string;
1365
+ type: "string" | "number" | "boolean" | "object" | "array" | "null" | "unknown";
1366
+ };
1367
+ type PotentialAssertionEvidence = {
1368
+ spanId: string;
1369
+ text: string;
1370
+ spanName: string | null;
1371
+ parameters: AssertionEvidenceParameter[];
1372
+ spanType: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
1373
+ isMocked: boolean;
1374
+ };
1375
+ type SaveAssertion = {
1376
+ /** Omit to preserve the category, or pass null to clear it. */
1377
+ category_assertion_id?: string | null;
1378
+ id?: string;
1379
+ assertion: string;
1380
+ passCriteria?: string | null;
1381
+ failCriteria?: string | null;
1382
+ targetOnEvaluatedTrace?: TraceTarget | null;
1383
+ /**
1384
+ * Why this assertion is right for this trace, one entry per span it rests on.
1385
+ * Cite spans on this trace only. Omit on an edit to preserve it.
1386
+ */
1387
+ justification?: Justification | null;
1388
+ /**
1389
+ * Why `category_assertion_id` is the right category. Changing the category
1390
+ * clears it. Omit on an edit to preserve it.
1391
+ */
1392
+ categoryJustification?: Justification | null;
1393
+ };
1394
+ type TraceAssertionsResult = {
1395
+ assertions: TraceAssertion[];
1396
+ inheritedFrom: string | null;
1397
+ };
1398
+ type TraceAssertionsUpdate = {
1399
+ traceId: string;
1400
+ assertions: SaveAssertion[];
1401
+ };
1402
+ type SaveAssertionsParams = {
1403
+ traceId: string;
1404
+ assertions: SaveAssertion[];
1405
+ source?: TraceAssertionSource;
1406
+ };
1407
+ type SaveAssertionsAllParams = {
1408
+ updates: TraceAssertionsUpdate[];
1409
+ source?: TraceAssertionSource;
1410
+ };
1411
+ type ArchiveAssertionsParams = {
1412
+ traceId: string;
1413
+ assertionIds: string[];
1414
+ };
1415
+ declare class TracesClient {
1416
+ private readonly httpClient;
1417
+ constructor(httpClient: HttpClient);
1418
+ search(params: TraceSearchParams): Promise<TraceSearchResult>;
1419
+ getAssertions(traceId: string): Promise<TraceAssertionsResult>;
1420
+ saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
1421
+ saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
1422
+ archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
1423
+ }
1424
+
1306
1425
  type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
1307
1426
  type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
1308
1427
  type LabelStatus = "labeled" | "skipped" | "unlabeled";
@@ -1383,6 +1502,8 @@ declare class LabelsClient {
1383
1502
  saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
1384
1503
  get(traceId: string): Promise<TraceLabels | null>;
1385
1504
  getAll(traceIds: string[]): Promise<TraceLabels[]>;
1505
+ /** Generate suggested evidence for an assertion on an original or replay trace. */
1506
+ generateLabelEvidence(traceId: string, assertionId: string): Promise<PotentialAssertionEvidence[]>;
1386
1507
  }
1387
1508
 
1388
1509
  type GraderLabelSource = "human" | "live_grader";
@@ -2294,130 +2415,6 @@ declare class BitfabRivetIntegration<TContext extends object = RivetContextLike>
2294
2415
  private createQueueIterator;
2295
2416
  }
2296
2417
 
2297
- type TraceTargetOccurrence = "first" | "last" | number;
2298
- type TraceTarget = {
2299
- kind: "output";
2300
- } | {
2301
- kind: "span";
2302
- name: string;
2303
- occurrence?: TraceTargetOccurrence;
2304
- };
2305
- type TraceAssertionSource = "human" | "agent";
2306
- type TraceSearchFilters = {
2307
- callerMetadata?: Record<string, string>;
2308
- name?: string;
2309
- nameContains?: string;
2310
- };
2311
- type TraceSearchParams = TraceSearchFilters & ({
2312
- callerMetadata: Record<string, string>;
2313
- } | {
2314
- name: string;
2315
- } | {
2316
- nameContains: string;
2317
- }) & {
2318
- traceFunctionKey?: string;
2319
- cursor?: string | null;
2320
- limit?: number;
2321
- };
2322
- type TraceSearchResult = {
2323
- traces: Array<{
2324
- id: string;
2325
- traceFunctionKey: string | null;
2326
- name: string | null;
2327
- status: "pending" | "completed" | "failed" | "dropped";
2328
- createdAt: string;
2329
- callerMetadata: Record<string, string>;
2330
- }>;
2331
- nextCursor: string | null;
2332
- hasMore: boolean;
2333
- };
2334
- type TraceAssertion = {
2335
- id: string;
2336
- traceId: string;
2337
- assertion: string;
2338
- humanNote: string | null;
2339
- category_assertion_id: string | null;
2340
- category: AssertionCategorySummary | null;
2341
- passCriteria: string | null;
2342
- failCriteria: string | null;
2343
- targetOnEvaluatedTrace: TraceTarget | null;
2344
- source: TraceAssertionSource;
2345
- /** Why this assertion is right for its trace, span by span. */
2346
- justification: Justification | null;
2347
- /** Why its assigned category is the right one, span by span. */
2348
- categoryJustification: Justification | null;
2349
- createdAt: string;
2350
- updatedAt: string;
2351
- } & ApprovalFields;
2352
- type AssertionEvidenceParameter = {
2353
- name: string;
2354
- type: "string" | "number" | "boolean" | "object" | "array" | "null" | "unknown";
2355
- };
2356
- type PotentialAssertionEvidence = {
2357
- spanId: string;
2358
- text: string;
2359
- spanName: string | null;
2360
- parameters: AssertionEvidenceParameter[];
2361
- spanType: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
2362
- isMocked: boolean;
2363
- };
2364
- type SaveAssertion = {
2365
- /** Omit to preserve the category, or pass null to clear it. */
2366
- category_assertion_id?: string | null;
2367
- id?: string;
2368
- assertion: string;
2369
- passCriteria?: string | null;
2370
- failCriteria?: string | null;
2371
- targetOnEvaluatedTrace?: TraceTarget | null;
2372
- /**
2373
- * Why this assertion is right for this trace, one entry per span it rests on.
2374
- * Cite spans on this trace only. Omit on an edit to preserve it.
2375
- */
2376
- justification?: Justification | null;
2377
- /**
2378
- * Why `category_assertion_id` is the right category. Changing the category
2379
- * clears it. Omit on an edit to preserve it.
2380
- */
2381
- categoryJustification?: Justification | null;
2382
- };
2383
- type TraceAssertionsResult = {
2384
- assertions: TraceAssertion[];
2385
- inheritedFrom: string | null;
2386
- };
2387
- type TraceAssertionsUpdate = {
2388
- traceId: string;
2389
- assertions: SaveAssertion[];
2390
- };
2391
- type SaveAssertionsParams = {
2392
- traceId: string;
2393
- assertions: SaveAssertion[];
2394
- source?: TraceAssertionSource;
2395
- };
2396
- type SaveAssertionsAllParams = {
2397
- updates: TraceAssertionsUpdate[];
2398
- source?: TraceAssertionSource;
2399
- };
2400
- type ArchiveAssertionsParams = {
2401
- traceId: string;
2402
- assertionIds: string[];
2403
- };
2404
- declare class TraceAssertionsClient {
2405
- private readonly httpClient;
2406
- constructor(httpClient: HttpClient);
2407
- /** Suggest evidence for an assertion, enriched with its span context. */
2408
- getAssertionEvidence(assertionId: string): Promise<PotentialAssertionEvidence[]>;
2409
- }
2410
- declare class TracesClient {
2411
- private readonly httpClient;
2412
- readonly assertions: TraceAssertionsClient;
2413
- constructor(httpClient: HttpClient);
2414
- search(params: TraceSearchParams): Promise<TraceSearchResult>;
2415
- getAssertions(traceId: string): Promise<TraceAssertionsResult>;
2416
- saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
2417
- saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
2418
- archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
2419
- }
2420
-
2421
2418
  /**
2422
2419
  * Tracing utilities for external trace submission to Bitfab.
2423
2420
  *
@@ -2432,6 +2429,7 @@ interface Trace {
2432
2429
  interface Span<_T = any> {
2433
2430
  spanId?: string;
2434
2431
  traceId?: string;
2432
+ parentId?: string | null;
2435
2433
  toJSON(): unknown;
2436
2434
  spanData?: {
2437
2435
  type?: string;
@@ -3627,7 +3625,7 @@ interface CommitRef {
3627
3625
  /**
3628
3626
  * SDK version from package.json (injected at build time)
3629
3627
  */
3630
- declare const __version__ = "0.57.5";
3628
+ declare const __version__ = "0.57.7";
3631
3629
 
3632
3630
  /**
3633
3631
  * Constants for the Bitfab SDK.
@@ -3766,4 +3764,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3766
3764
  run?: boolean;
3767
3765
  }): Promise<SeedResult>;
3768
3766
 
3769
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 PotentialAssertionEvidence, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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, TraceAssertionsClient, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
3767
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 PotentialAssertionEvidence, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
package/dist/index.js CHANGED
@@ -22,7 +22,6 @@ import {
22
22
  GradersClient,
23
23
  LabelsClient,
24
24
  SUPPORTED_PROVIDERS,
25
- TraceAssertionsClient,
26
25
  TracesClient,
27
26
  defineReplayRegistry,
28
27
  finalizers,
@@ -31,7 +30,7 @@ import {
31
30
  getCurrentTrace,
32
31
  reseedFromRegistry,
33
32
  seedFromRegistry
34
- } from "./chunk-YO3HKQX6.js";
33
+ } from "./chunk-W3HLGZBO.js";
35
34
  import "./chunk-RCHSYWKI.js";
36
35
  import {
37
36
  BITFAB_PROGRESS_PREFIX,
@@ -40,7 +39,7 @@ import {
40
39
  ReplayError,
41
40
  reportReplayProgress,
42
41
  serializeReplayResult
43
- } from "./chunk-VPZ2LTU6.js";
42
+ } from "./chunk-VPU6U4WM.js";
44
43
  import {
45
44
  BitfabError,
46
45
  DEFAULT_SERVICE_URL,
@@ -48,7 +47,7 @@ import {
48
47
  MixedTracingError,
49
48
  __version__,
50
49
  flushTraces
51
- } from "./chunk-255I4PN4.js";
50
+ } from "./chunk-P4R3NY2U.js";
52
51
  import "./chunk-VCRFFCLY.js";
53
52
  export {
54
53
  AssertionCategoriesClient,
@@ -74,7 +73,6 @@ export {
74
73
  NO_MOCK_OVERRIDE,
75
74
  ReplayError,
76
75
  SUPPORTED_PROVIDERS,
77
- TraceAssertionsClient,
78
76
  TracesClient,
79
77
  __version__,
80
78
  defineReplayRegistry,