@bitfab/sdk 0.58.2 → 0.58.4

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 (32) hide show
  1. package/dist/{chunk-JMMFN4RO.js → chunk-3LJVTDD5.js} +6 -3
  2. package/dist/{chunk-JMMFN4RO.js.map → chunk-3LJVTDD5.js.map} +1 -1
  3. package/dist/{chunk-FRAFDYLK.js → chunk-74ECLOFY.js} +3 -3
  4. package/dist/chunk-74ECLOFY.js.map +1 -0
  5. package/dist/{chunk-QK6CVPVR.js → chunk-BVUGW7BJ.js} +4 -3
  6. package/dist/chunk-BVUGW7BJ.js.map +1 -0
  7. package/dist/{chunk-LS4AHYFJ.js → chunk-UKJ3RWVS.js} +38 -13
  8. package/dist/chunk-UKJ3RWVS.js.map +1 -0
  9. package/dist/{chunk-PR3I5UTO.js → chunk-ZLAFCSCP.js} +6 -3
  10. package/dist/{chunk-PR3I5UTO.js.map → chunk-ZLAFCSCP.js.map} +1 -1
  11. package/dist/{http-W3ZKRIWW.js → http-NG5NP6PH.js} +2 -2
  12. package/dist/{http-IEFEMFSD.js → http-XTSUPZEC.js} +2 -2
  13. package/dist/index.cjs +39 -10
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +14 -5
  16. package/dist/index.d.ts +14 -5
  17. package/dist/index.js +3 -3
  18. package/dist/node.cjs +39 -10
  19. package/dist/node.cjs.map +1 -1
  20. package/dist/node.d.cts +1 -1
  21. package/dist/node.d.ts +1 -1
  22. package/dist/node.js +3 -3
  23. package/dist/{replay-NFSPHMXY.js → replay-JHFO457Z.js} +3 -3
  24. package/dist/replayCli.js +2 -2
  25. package/dist/seedCli.js +2 -2
  26. package/package.json +1 -1
  27. package/dist/chunk-FRAFDYLK.js.map +0 -1
  28. package/dist/chunk-LS4AHYFJ.js.map +0 -1
  29. package/dist/chunk-QK6CVPVR.js.map +0 -1
  30. /package/dist/{http-IEFEMFSD.js.map → http-NG5NP6PH.js.map} +0 -0
  31. /package/dist/{http-W3ZKRIWW.js.map → http-XTSUPZEC.js.map} +0 -0
  32. /package/dist/{replay-NFSPHMXY.js.map → replay-JHFO457Z.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -602,7 +602,7 @@ declare class HttpClient {
602
602
  * Start a replay session by fetching historical traces.
603
603
  * Blocking call - creates a test run and returns lightweight item references.
604
604
  */
605
- 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>;
605
+ 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, judgeAssertions?: boolean): Promise<StartReplayResponse>;
606
606
  /**
607
607
  * Fetch an external span by ID.
608
608
  * Blocking GET request.
@@ -1366,9 +1366,10 @@ type AssertionEvidenceParameter = {
1366
1366
  name: string;
1367
1367
  type: "string" | "number" | "boolean" | "object" | "array" | "null" | "unknown";
1368
1368
  };
1369
- type PotentialAssertionEvidence = {
1369
+ type AssertionLabelEvidence = {
1370
1370
  spanId: string;
1371
1371
  text: string;
1372
+ sourceField: string;
1372
1373
  spanName: string | null;
1373
1374
  parameters: AssertionEvidenceParameter[];
1374
1375
  spanType: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
@@ -1511,7 +1512,7 @@ declare class LabelsClient {
1511
1512
  get(traceId: string): Promise<TraceLabels | null>;
1512
1513
  getAll(traceIds: string[]): Promise<TraceLabels[]>;
1513
1514
  /** Generate suggested evidence for an assertion on an original or replay trace. */
1514
- generateLabelEvidence(traceId: string, assertionId: string): Promise<PotentialAssertionEvidence[]>;
1515
+ generateLabelEvidence(traceId: string, assertionId: string): Promise<AssertionLabelEvidence[]>;
1515
1516
  }
1516
1517
 
1517
1518
  type GraderLabelSource = "human" | "live_grader";
@@ -1951,6 +1952,12 @@ interface ReplayOptions {
1951
1952
  * replays nothing.
1952
1953
  */
1953
1954
  onlyWithAssertions?: boolean;
1955
+ /**
1956
+ * Judge every approved assertion on each replay as it finishes and save the
1957
+ * verdict as that assertion's agent label. Off unless asked: each judgement
1958
+ * costs model calls.
1959
+ */
1960
+ judgeAssertions?: boolean;
1954
1961
  /**
1955
1962
  * Reshape recorded inputs before they are spread into `fn`.
1956
1963
  *
@@ -3365,6 +3372,8 @@ declare class Bitfab {
3365
3372
  * Queued on the client's span transport; delivery is the transport's job.
3366
3373
  */
3367
3374
  private sendTraceCompletion;
3375
+ private sendsSpanOnCompletion;
3376
+ private nearestCapturedAncestorSpanIdOf;
3368
3377
  private contentOffBySimulationPlan;
3369
3378
  /**
3370
3379
  * Send a wrapper span from function execution.
@@ -3650,7 +3659,7 @@ interface CommitRef {
3650
3659
  /**
3651
3660
  * SDK version from package.json (injected at build time)
3652
3661
  */
3653
- declare const __version__ = "0.58.2";
3662
+ declare const __version__ = "0.58.4";
3654
3663
 
3655
3664
  /**
3656
3665
  * Constants for the Bitfab SDK.
@@ -3789,4 +3798,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3789
3798
  run?: boolean;
3790
3799
  }): Promise<SeedResult>;
3791
3800
 
3792
- 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, type Assignee, 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 OrganizationMember, OrganizationMembersClient, 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 };
3801
+ 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 AssertionLabelEvidence, type AssertionVerdict, type Assignee, 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 OrganizationMember, OrganizationMembersClient, 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
@@ -602,7 +602,7 @@ declare class HttpClient {
602
602
  * Start a replay session by fetching historical traces.
603
603
  * Blocking call - creates a test run and returns lightweight item references.
604
604
  */
605
- 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>;
605
+ 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, judgeAssertions?: boolean): Promise<StartReplayResponse>;
606
606
  /**
607
607
  * Fetch an external span by ID.
608
608
  * Blocking GET request.
@@ -1366,9 +1366,10 @@ type AssertionEvidenceParameter = {
1366
1366
  name: string;
1367
1367
  type: "string" | "number" | "boolean" | "object" | "array" | "null" | "unknown";
1368
1368
  };
1369
- type PotentialAssertionEvidence = {
1369
+ type AssertionLabelEvidence = {
1370
1370
  spanId: string;
1371
1371
  text: string;
1372
+ sourceField: string;
1372
1373
  spanName: string | null;
1373
1374
  parameters: AssertionEvidenceParameter[];
1374
1375
  spanType: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
@@ -1511,7 +1512,7 @@ declare class LabelsClient {
1511
1512
  get(traceId: string): Promise<TraceLabels | null>;
1512
1513
  getAll(traceIds: string[]): Promise<TraceLabels[]>;
1513
1514
  /** Generate suggested evidence for an assertion on an original or replay trace. */
1514
- generateLabelEvidence(traceId: string, assertionId: string): Promise<PotentialAssertionEvidence[]>;
1515
+ generateLabelEvidence(traceId: string, assertionId: string): Promise<AssertionLabelEvidence[]>;
1515
1516
  }
1516
1517
 
1517
1518
  type GraderLabelSource = "human" | "live_grader";
@@ -1951,6 +1952,12 @@ interface ReplayOptions {
1951
1952
  * replays nothing.
1952
1953
  */
1953
1954
  onlyWithAssertions?: boolean;
1955
+ /**
1956
+ * Judge every approved assertion on each replay as it finishes and save the
1957
+ * verdict as that assertion's agent label. Off unless asked: each judgement
1958
+ * costs model calls.
1959
+ */
1960
+ judgeAssertions?: boolean;
1954
1961
  /**
1955
1962
  * Reshape recorded inputs before they are spread into `fn`.
1956
1963
  *
@@ -3365,6 +3372,8 @@ declare class Bitfab {
3365
3372
  * Queued on the client's span transport; delivery is the transport's job.
3366
3373
  */
3367
3374
  private sendTraceCompletion;
3375
+ private sendsSpanOnCompletion;
3376
+ private nearestCapturedAncestorSpanIdOf;
3368
3377
  private contentOffBySimulationPlan;
3369
3378
  /**
3370
3379
  * Send a wrapper span from function execution.
@@ -3650,7 +3659,7 @@ interface CommitRef {
3650
3659
  /**
3651
3660
  * SDK version from package.json (injected at build time)
3652
3661
  */
3653
- declare const __version__ = "0.58.2";
3662
+ declare const __version__ = "0.58.4";
3654
3663
 
3655
3664
  /**
3656
3665
  * Constants for the Bitfab SDK.
@@ -3789,4 +3798,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3789
3798
  run?: boolean;
3790
3799
  }): Promise<SeedResult>;
3791
3800
 
3792
- 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, type Assignee, 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 OrganizationMember, OrganizationMembersClient, 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 };
3801
+ 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 AssertionLabelEvidence, type AssertionVerdict, type Assignee, 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 OrganizationMember, OrganizationMembersClient, 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,7 @@ import {
22
22
  getCurrentTrace,
23
23
  reseedFromRegistry,
24
24
  seedFromRegistry
25
- } from "./chunk-LS4AHYFJ.js";
25
+ } from "./chunk-UKJ3RWVS.js";
26
26
  import "./chunk-RCHSYWKI.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
@@ -31,7 +31,7 @@ import {
31
31
  ReplayError,
32
32
  reportReplayProgress,
33
33
  serializeReplayResult
34
- } from "./chunk-QK6CVPVR.js";
34
+ } from "./chunk-BVUGW7BJ.js";
35
35
  import {
36
36
  BitfabError,
37
37
  DEFAULT_SERVICE_URL,
@@ -39,7 +39,7 @@ import {
39
39
  MixedTracingError,
40
40
  __version__,
41
41
  flushTraces
42
- } from "./chunk-PR3I5UTO.js";
42
+ } from "./chunk-ZLAFCSCP.js";
43
43
  import "./chunk-VCRFFCLY.js";
44
44
  export {
45
45
  AssertionCategoriesClient,
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.58.2";
91
+ __version__ = "0.58.4";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -2885,7 +2885,7 @@ var init_http = __esm({
2885
2885
  * Start a replay session by fetching historical traces.
2886
2886
  * Blocking call - creates a test run and returns lightweight item references.
2887
2887
  */
2888
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
2888
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, judgeAssertions) {
2889
2889
  const payload = { traceFunctionKey };
2890
2890
  if (limit !== void 0) {
2891
2891
  payload.limit = limit;
@@ -2931,6 +2931,9 @@ var init_http = __esm({
2931
2931
  if (onlyWithAssertions) {
2932
2932
  payload.onlyWithAssertions = true;
2933
2933
  }
2934
+ if (judgeAssertions) {
2935
+ payload.judgeAssertions = true;
2936
+ }
2934
2937
  const git = await resolvedGitState();
2935
2938
  if (git && !isEmptyGitState(git)) {
2936
2939
  payload.git = git;
@@ -4088,7 +4091,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4088
4091
  resolveDbBranchSettings(options?.dbBranch),
4089
4092
  attempts,
4090
4093
  options?.adaptInputs !== void 0,
4091
- options?.onlyWithAssertions
4094
+ options?.onlyWithAssertions,
4095
+ options?.judgeAssertions
4092
4096
  );
4093
4097
  if (serverItems.length === 0) {
4094
4098
  try {
@@ -9819,13 +9823,23 @@ var Bitfab = class {
9819
9823
  traceFunctionKey
9820
9824
  );
9821
9825
  const openAiAgentsSpanIds = openAiAgentsSpanChain();
9826
+ const functionNameAtOpen = fn.name !== "" ? fn.name : void 0;
9822
9827
  const newContext = {
9823
9828
  traceId,
9824
9829
  spanId,
9825
9830
  contexts: [],
9831
+ spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
9832
+ rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(
9833
+ traceId,
9834
+ traceFunctionKey
9835
+ ),
9836
+ instrumentation: options.instrumentation ?? "span",
9837
+ declaredNode: options.declaredNode === true,
9838
+ isRoot: isRootSpan,
9826
9839
  ...surface !== void 0 && { surface },
9827
9840
  ...openAiAgentsSpanIds.length > 0 && { openAiAgentsSpanIds }
9828
9841
  };
9842
+ const nearestCapturedAncestorSpanId = self.nearestCapturedAncestorSpanIdOf(currentStack);
9829
9843
  newStack = [...currentStack, newContext];
9830
9844
  const inputs = args;
9831
9845
  const startedAt = nowIsoTimestamp();
@@ -9852,19 +9866,16 @@ var Bitfab = class {
9852
9866
  }
9853
9867
  self.httpClient.traceCompletion.start(traceId, spanId);
9854
9868
  startedSpan = { traceId, spanId };
9855
- const functionName = fn.name !== "" ? fn.name : void 0;
9856
- const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
9857
- traceId,
9858
- traceFunctionKey
9859
- );
9869
+ const functionName = functionNameAtOpen;
9860
9870
  const baseSpanParams = {
9861
9871
  traceFunctionKey,
9862
- rootTraceFunctionKey,
9872
+ rootTraceFunctionKey: newContext.rootTraceFunctionKey,
9863
9873
  functionName,
9864
- spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionName) ?? traceFunctionKey,
9874
+ spanName: newContext.spanName,
9865
9875
  traceId,
9866
9876
  spanId,
9867
9877
  parentSpanId,
9878
+ nearestCapturedAncestorSpanId,
9868
9879
  inputs,
9869
9880
  startedAt,
9870
9881
  spanType: options.type ?? "custom",
@@ -10383,6 +10394,21 @@ var Bitfab = class {
10383
10394
  ...params.testRunId && { testRunId: params.testRunId }
10384
10395
  });
10385
10396
  }
10397
+ sendsSpanOnCompletion(context) {
10398
+ return context.isRoot || context.declaredNode || isFrameworkInstrumentation(context.instrumentation) || !this.simulationPlan.contentOffNow(
10399
+ context.rootTraceFunctionKey,
10400
+ context.spanName
10401
+ );
10402
+ }
10403
+ nearestCapturedAncestorSpanIdOf(stack) {
10404
+ for (let index = stack.length - 1; index >= 0; index -= 1) {
10405
+ const candidate = stack[index];
10406
+ if (candidate !== void 0 && this.sendsSpanOnCompletion(candidate)) {
10407
+ return candidate.spanId;
10408
+ }
10409
+ }
10410
+ return null;
10411
+ }
10386
10412
  contentOffBySimulationPlan(params) {
10387
10413
  if (params.rootTraceFunctionKey === void 0 || isFrameworkInstrumentation(params.instrumentation)) {
10388
10414
  return false;
@@ -10459,6 +10485,9 @@ var Bitfab = class {
10459
10485
  if (params.parentSpanId) {
10460
10486
  externalSpan.parent_id = params.parentSpanId;
10461
10487
  }
10488
+ if (params.nearestCapturedAncestorSpanId !== void 0 && params.nearestCapturedAncestorSpanId !== null && params.nearestCapturedAncestorSpanId !== params.parentSpanId) {
10489
+ externalSpan.nearest_captured_ancestor_id = params.nearestCapturedAncestorSpanId;
10490
+ }
10462
10491
  if (params.inputSourceSpanId) {
10463
10492
  externalSpan.input_source_span_id = params.inputSourceSpanId;
10464
10493
  }