@bitfab/sdk 0.64.18 → 0.64.20

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 (38) hide show
  1. package/README.md +1 -5
  2. package/dist/{chunk-6AUI3X66.js → chunk-6235TDLD.js} +4 -4
  3. package/dist/chunk-6235TDLD.js.map +1 -0
  4. package/dist/{chunk-NGKTKRCV.js → chunk-7R5DLRXP.js} +2 -2
  5. package/dist/{chunk-4JZ6UMDW.js → chunk-JXZHAIXA.js} +17 -3
  6. package/dist/chunk-JXZHAIXA.js.map +1 -0
  7. package/dist/{chunk-ZBA4QJWF.js → chunk-KC6CJUMD.js} +62 -22
  8. package/dist/chunk-KC6CJUMD.js.map +1 -0
  9. package/dist/{chunk-ACKEEC7I.js → chunk-SR2WNZCW.js} +2 -2
  10. package/dist/{chunk-7NPHFRQD.js → chunk-U2NAI4RU.js} +17 -3
  11. package/dist/{chunk-7NPHFRQD.js.map → chunk-U2NAI4RU.js.map} +1 -1
  12. package/dist/{http-6VZBSALH.js → http-GX4NROD3.js} +4 -2
  13. package/dist/{http-2BXJLZ5N.js → http-OEYRIJZM.js} +4 -2
  14. package/dist/index.cjs +76 -19
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +73 -14
  17. package/dist/index.d.ts +73 -14
  18. package/dist/index.js +5 -3
  19. package/dist/node.cjs +76 -19
  20. package/dist/node.cjs.map +1 -1
  21. package/dist/node.d.cts +1 -1
  22. package/dist/node.d.ts +1 -1
  23. package/dist/node.js +5 -3
  24. package/dist/node.js.map +1 -1
  25. package/dist/{replay-OO2DFUAQ.js → replay-SZTY5TYU.js} +3 -3
  26. package/dist/{replay-Z46UJQVQ.js → replay-UKR5WFON.js} +3 -3
  27. package/dist/replayCli.js +3 -3
  28. package/dist/seedCli.js +3 -3
  29. package/package.json +2 -3
  30. package/dist/chunk-4JZ6UMDW.js.map +0 -1
  31. package/dist/chunk-6AUI3X66.js.map +0 -1
  32. package/dist/chunk-ZBA4QJWF.js.map +0 -1
  33. /package/dist/{chunk-NGKTKRCV.js.map → chunk-7R5DLRXP.js.map} +0 -0
  34. /package/dist/{chunk-ACKEEC7I.js.map → chunk-SR2WNZCW.js.map} +0 -0
  35. /package/dist/{http-2BXJLZ5N.js.map → http-GX4NROD3.js.map} +0 -0
  36. /package/dist/{http-6VZBSALH.js.map → http-OEYRIJZM.js.map} +0 -0
  37. /package/dist/{replay-OO2DFUAQ.js.map → replay-SZTY5TYU.js.map} +0 -0
  38. /package/dist/{replay-Z46UJQVQ.js.map → replay-UKR5WFON.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -500,12 +500,35 @@ interface HttpClientConfig {
500
500
  timeout?: number;
501
501
  }
502
502
  type SpanOccurrence = "first" | "last" | number;
503
+ declare const SPAN_TYPES: readonly ["llm", "agent", "function", "guardrail", "handoff", "custom"];
504
+ /**
505
+ * Span types matching the backend enum.
506
+ * - llm: LLM API calls
507
+ * - agent: Autonomous orchestrators
508
+ * - function: Tool implementations
509
+ * - guardrail: Safety/validation checks
510
+ * - handoff: Agent-to-agent transfers
511
+ * - custom: Application-specific tracing (default)
512
+ */
513
+ type SpanType = (typeof SPAN_TYPES)[number];
514
+ /**
515
+ * Which span `getTraceSpan` returns: `id` alone, or `name` and/or `type`
516
+ * with an optional `occurrence` (`"first"`, `"last"` by default, or a
517
+ * zero-based index into the matches in the order they ran).
518
+ */
503
519
  type SpanLookup = {
504
520
  id: string;
505
521
  name?: never;
522
+ type?: never;
506
523
  occurrence?: never;
507
524
  } | {
508
525
  name: string;
526
+ type?: SpanType;
527
+ id?: never;
528
+ occurrence?: SpanOccurrence;
529
+ } | {
530
+ type: SpanType;
531
+ name?: string;
509
532
  id?: never;
510
533
  occurrence?: SpanOccurrence;
511
534
  };
@@ -2866,6 +2889,48 @@ declare class BitfabRivetIntegration<TContext extends object = RivetContextLike>
2866
2889
  private createQueueIterator;
2867
2890
  }
2868
2891
 
2892
+ type SpanListField = "input" | "output" | "reasoning" | "content" | "errors" | "contexts";
2893
+ type SpanListParams = {
2894
+ spanType?: SpanType;
2895
+ spanName?: string;
2896
+ fields?: SpanListField[];
2897
+ cursor?: string | null;
2898
+ /** Spans per page, 1 to 200, or at most 50 when `fields` is set. The server defaults to 50. */
2899
+ limit?: number;
2900
+ };
2901
+ type ListedSpan = {
2902
+ id: string;
2903
+ traceId: string;
2904
+ parentSpanId: string | null;
2905
+ name: string | null;
2906
+ type: string | null;
2907
+ startedAt: string | null;
2908
+ endedAt: string | null;
2909
+ input?: unknown;
2910
+ output?: unknown;
2911
+ reasoning?: unknown;
2912
+ content?: unknown;
2913
+ errors?: unknown;
2914
+ contexts?: unknown;
2915
+ };
2916
+ type SpanListResult = {
2917
+ spans: ListedSpan[];
2918
+ nextCursor: string | null;
2919
+ hasMore: boolean;
2920
+ };
2921
+ declare class SpansClient {
2922
+ private readonly httpClient;
2923
+ constructor(httpClient: HttpClient);
2924
+ /**
2925
+ * List one trace's spans in the order they ran, one page at a time. No
2926
+ * filter is required: omit `spanType` and `spanName` to page through every
2927
+ * span. Each span carries one extra key per requested `fields` entry. Pass
2928
+ * the returned `nextCursor` back as `cursor` for the next page. Throws a
2929
+ * `BitfabError` with status 404 when the trace is not in your organization.
2930
+ */
2931
+ list(traceId: string, params?: SpanListParams): Promise<SpanListResult>;
2932
+ }
2933
+
2869
2934
  /**
2870
2935
  * Tracing utilities for external trace submission to Bitfab.
2871
2936
  *
@@ -3224,16 +3289,7 @@ interface BitfabConfig {
3224
3289
  dbSnapshot?: DbSnapshotConfig;
3225
3290
  simulationPlan?: boolean;
3226
3291
  }
3227
- /**
3228
- * Span types matching the backend enum.
3229
- * - llm: LLM API calls
3230
- * - agent: Autonomous orchestrators
3231
- * - function: Tool implementations
3232
- * - guardrail: Safety/validation checks
3233
- * - handoff: Agent-to-agent transfers
3234
- * - custom: Application-specific tracing (default)
3235
- */
3236
- type SpanType = "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
3292
+
3237
3293
  /**
3238
3294
  * Controls when a span is captured.
3239
3295
  * - always: Capture the span even when it becomes the root of a new trace.
@@ -3387,6 +3443,7 @@ declare class Bitfab {
3387
3443
  readonly assertionCategories: AssertionCategoriesClient;
3388
3444
  readonly organizationMembers: OrganizationMembersClient;
3389
3445
  readonly traces: TracesClient;
3446
+ readonly spans: SpansClient;
3390
3447
  readonly labels: LabelsClient;
3391
3448
  readonly graders: GradersClient;
3392
3449
  readonly experiments: ExperimentsClient;
@@ -3778,8 +3835,10 @@ declare class Bitfab {
3778
3835
  getTrace(traceId: string): DetachedTrace;
3779
3836
  /**
3780
3837
  * Fetch one persisted span from a trace without loading the full trace.
3781
- * Name lookups return the last matching span by default. Pass `occurrence`
3782
- * as `"first"` or a zero-based index to select a different match.
3838
+ * Look up by `id` alone, or by `name` and/or `type` (both must match when
3839
+ * both are given). Name and type lookups return the last matching span by
3840
+ * default. Pass `occurrence` as `"first"` or a zero-based index to select a
3841
+ * different match. Returns `null` when no span matches.
3783
3842
  */
3784
3843
  getTraceSpan(traceId: string, lookup: SpanLookup): Promise<CapturedSpan | null>;
3785
3844
  getSpan(spanId: string): Promise<CapturedSpan | null>;
@@ -4095,7 +4154,7 @@ interface CommitRef {
4095
4154
  /**
4096
4155
  * SDK version from package.json (injected at build time)
4097
4156
  */
4098
- declare const __version__ = "0.64.18";
4157
+ declare const __version__ = "0.64.20";
4099
4158
 
4100
4159
  /**
4101
4160
  * Constants for the Bitfab SDK.
@@ -4234,4 +4293,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
4234
4293
  run?: boolean;
4235
4294
  }): Promise<SeedResult>;
4236
4295
 
4237
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, type ArchiveLabelTarget, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, 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 Experiment, type ExperimentCategoryTally, type ExperimentCodeChangeTotals, type ExperimentJitter, type ExperimentPage, type ExperimentRollup, type ExperimentRollupResult, type ExperimentRunBy, type ExperimentStatus, type ExperimentTally, type ExperimentTotals, ExperimentsClient, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelOutcome, type GraderLabelSource, type GraderLabelUpdate, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, 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, type ListExperimentsParams, 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 ReplayExperiment, type ReplayInterrupt, type ReplayInterruptSignal, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayNodeIdentity, 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 SaveScenarioData, type SaveScenarioHistoryEntry, type SaveScenarioParams, type Scenario, type ScenarioData, type ScenarioDataAppend, type ScenarioDataOrigin, type ScenarioHistoryEntry, type ScenarioSource, type ScenarioTrigger, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SelectiveReplayDecision, type SelectiveReplayOptions, type SelectiveReplayReport, 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 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 };
4296
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, type ArchiveLabelTarget, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, 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 Experiment, type ExperimentCategoryTally, type ExperimentCodeChangeTotals, type ExperimentJitter, type ExperimentPage, type ExperimentRollup, type ExperimentRollupResult, type ExperimentRunBy, type ExperimentStatus, type ExperimentTally, type ExperimentTotals, ExperimentsClient, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelOutcome, type GraderLabelSource, type GraderLabelUpdate, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, 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, type ListExperimentsParams, type ListedSpan, 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 ReplayExperiment, type ReplayInterrupt, type ReplayInterruptSignal, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayNodeIdentity, 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 SaveScenarioData, type SaveScenarioHistoryEntry, type SaveScenarioParams, type Scenario, type ScenarioData, type ScenarioDataAppend, type ScenarioDataOrigin, type ScenarioHistoryEntry, type ScenarioSource, type ScenarioTrigger, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SelectiveReplayDecision, type SelectiveReplayOptions, type SelectiveReplayReport, type SpanListField, type SpanListParams, type SpanListResult, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, SpansClient, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, 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
@@ -500,12 +500,35 @@ interface HttpClientConfig {
500
500
  timeout?: number;
501
501
  }
502
502
  type SpanOccurrence = "first" | "last" | number;
503
+ declare const SPAN_TYPES: readonly ["llm", "agent", "function", "guardrail", "handoff", "custom"];
504
+ /**
505
+ * Span types matching the backend enum.
506
+ * - llm: LLM API calls
507
+ * - agent: Autonomous orchestrators
508
+ * - function: Tool implementations
509
+ * - guardrail: Safety/validation checks
510
+ * - handoff: Agent-to-agent transfers
511
+ * - custom: Application-specific tracing (default)
512
+ */
513
+ type SpanType = (typeof SPAN_TYPES)[number];
514
+ /**
515
+ * Which span `getTraceSpan` returns: `id` alone, or `name` and/or `type`
516
+ * with an optional `occurrence` (`"first"`, `"last"` by default, or a
517
+ * zero-based index into the matches in the order they ran).
518
+ */
503
519
  type SpanLookup = {
504
520
  id: string;
505
521
  name?: never;
522
+ type?: never;
506
523
  occurrence?: never;
507
524
  } | {
508
525
  name: string;
526
+ type?: SpanType;
527
+ id?: never;
528
+ occurrence?: SpanOccurrence;
529
+ } | {
530
+ type: SpanType;
531
+ name?: string;
509
532
  id?: never;
510
533
  occurrence?: SpanOccurrence;
511
534
  };
@@ -2866,6 +2889,48 @@ declare class BitfabRivetIntegration<TContext extends object = RivetContextLike>
2866
2889
  private createQueueIterator;
2867
2890
  }
2868
2891
 
2892
+ type SpanListField = "input" | "output" | "reasoning" | "content" | "errors" | "contexts";
2893
+ type SpanListParams = {
2894
+ spanType?: SpanType;
2895
+ spanName?: string;
2896
+ fields?: SpanListField[];
2897
+ cursor?: string | null;
2898
+ /** Spans per page, 1 to 200, or at most 50 when `fields` is set. The server defaults to 50. */
2899
+ limit?: number;
2900
+ };
2901
+ type ListedSpan = {
2902
+ id: string;
2903
+ traceId: string;
2904
+ parentSpanId: string | null;
2905
+ name: string | null;
2906
+ type: string | null;
2907
+ startedAt: string | null;
2908
+ endedAt: string | null;
2909
+ input?: unknown;
2910
+ output?: unknown;
2911
+ reasoning?: unknown;
2912
+ content?: unknown;
2913
+ errors?: unknown;
2914
+ contexts?: unknown;
2915
+ };
2916
+ type SpanListResult = {
2917
+ spans: ListedSpan[];
2918
+ nextCursor: string | null;
2919
+ hasMore: boolean;
2920
+ };
2921
+ declare class SpansClient {
2922
+ private readonly httpClient;
2923
+ constructor(httpClient: HttpClient);
2924
+ /**
2925
+ * List one trace's spans in the order they ran, one page at a time. No
2926
+ * filter is required: omit `spanType` and `spanName` to page through every
2927
+ * span. Each span carries one extra key per requested `fields` entry. Pass
2928
+ * the returned `nextCursor` back as `cursor` for the next page. Throws a
2929
+ * `BitfabError` with status 404 when the trace is not in your organization.
2930
+ */
2931
+ list(traceId: string, params?: SpanListParams): Promise<SpanListResult>;
2932
+ }
2933
+
2869
2934
  /**
2870
2935
  * Tracing utilities for external trace submission to Bitfab.
2871
2936
  *
@@ -3224,16 +3289,7 @@ interface BitfabConfig {
3224
3289
  dbSnapshot?: DbSnapshotConfig;
3225
3290
  simulationPlan?: boolean;
3226
3291
  }
3227
- /**
3228
- * Span types matching the backend enum.
3229
- * - llm: LLM API calls
3230
- * - agent: Autonomous orchestrators
3231
- * - function: Tool implementations
3232
- * - guardrail: Safety/validation checks
3233
- * - handoff: Agent-to-agent transfers
3234
- * - custom: Application-specific tracing (default)
3235
- */
3236
- type SpanType = "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
3292
+
3237
3293
  /**
3238
3294
  * Controls when a span is captured.
3239
3295
  * - always: Capture the span even when it becomes the root of a new trace.
@@ -3387,6 +3443,7 @@ declare class Bitfab {
3387
3443
  readonly assertionCategories: AssertionCategoriesClient;
3388
3444
  readonly organizationMembers: OrganizationMembersClient;
3389
3445
  readonly traces: TracesClient;
3446
+ readonly spans: SpansClient;
3390
3447
  readonly labels: LabelsClient;
3391
3448
  readonly graders: GradersClient;
3392
3449
  readonly experiments: ExperimentsClient;
@@ -3778,8 +3835,10 @@ declare class Bitfab {
3778
3835
  getTrace(traceId: string): DetachedTrace;
3779
3836
  /**
3780
3837
  * Fetch one persisted span from a trace without loading the full trace.
3781
- * Name lookups return the last matching span by default. Pass `occurrence`
3782
- * as `"first"` or a zero-based index to select a different match.
3838
+ * Look up by `id` alone, or by `name` and/or `type` (both must match when
3839
+ * both are given). Name and type lookups return the last matching span by
3840
+ * default. Pass `occurrence` as `"first"` or a zero-based index to select a
3841
+ * different match. Returns `null` when no span matches.
3783
3842
  */
3784
3843
  getTraceSpan(traceId: string, lookup: SpanLookup): Promise<CapturedSpan | null>;
3785
3844
  getSpan(spanId: string): Promise<CapturedSpan | null>;
@@ -4095,7 +4154,7 @@ interface CommitRef {
4095
4154
  /**
4096
4155
  * SDK version from package.json (injected at build time)
4097
4156
  */
4098
- declare const __version__ = "0.64.18";
4157
+ declare const __version__ = "0.64.20";
4099
4158
 
4100
4159
  /**
4101
4160
  * Constants for the Bitfab SDK.
@@ -4234,4 +4293,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
4234
4293
  run?: boolean;
4235
4294
  }): Promise<SeedResult>;
4236
4295
 
4237
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, type ArchiveLabelTarget, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, 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 Experiment, type ExperimentCategoryTally, type ExperimentCodeChangeTotals, type ExperimentJitter, type ExperimentPage, type ExperimentRollup, type ExperimentRollupResult, type ExperimentRunBy, type ExperimentStatus, type ExperimentTally, type ExperimentTotals, ExperimentsClient, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelOutcome, type GraderLabelSource, type GraderLabelUpdate, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, 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, type ListExperimentsParams, 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 ReplayExperiment, type ReplayInterrupt, type ReplayInterruptSignal, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayNodeIdentity, 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 SaveScenarioData, type SaveScenarioHistoryEntry, type SaveScenarioParams, type Scenario, type ScenarioData, type ScenarioDataAppend, type ScenarioDataOrigin, type ScenarioHistoryEntry, type ScenarioSource, type ScenarioTrigger, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SelectiveReplayDecision, type SelectiveReplayOptions, type SelectiveReplayReport, 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 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 };
4296
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, type ArchiveLabelTarget, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, 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 Experiment, type ExperimentCategoryTally, type ExperimentCodeChangeTotals, type ExperimentJitter, type ExperimentPage, type ExperimentRollup, type ExperimentRollupResult, type ExperimentRunBy, type ExperimentStatus, type ExperimentTally, type ExperimentTotals, ExperimentsClient, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelOutcome, type GraderLabelSource, type GraderLabelUpdate, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, 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, type ListExperimentsParams, type ListedSpan, 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 ReplayExperiment, type ReplayInterrupt, type ReplayInterruptSignal, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayNodeIdentity, 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 SaveScenarioData, type SaveScenarioHistoryEntry, type SaveScenarioParams, type Scenario, type ScenarioData, type ScenarioDataAppend, type ScenarioDataOrigin, type ScenarioHistoryEntry, type ScenarioSource, type ScenarioTrigger, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SelectiveReplayDecision, type SelectiveReplayOptions, type SelectiveReplayReport, type SpanListField, type SpanListParams, type SpanListResult, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, SpansClient, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, 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
@@ -19,6 +19,7 @@ import {
19
19
  LabelsClient,
20
20
  OrganizationMembersClient,
21
21
  SUPPORTED_PROVIDERS,
22
+ SpansClient,
22
23
  TracesClient,
23
24
  defineReplayRegistry,
24
25
  finalizers,
@@ -27,7 +28,7 @@ import {
27
28
  getCurrentTrace,
28
29
  reseedFromRegistry,
29
30
  seedFromRegistry
30
- } from "./chunk-ZBA4QJWF.js";
31
+ } from "./chunk-KC6CJUMD.js";
31
32
  import "./chunk-YWXQM6J3.js";
32
33
  import {
33
34
  BITFAB_PROGRESS_PREFIX,
@@ -36,7 +37,7 @@ import {
36
37
  ReplayError,
37
38
  reportReplayProgress,
38
39
  serializeReplayResult
39
- } from "./chunk-ACKEEC7I.js";
40
+ } from "./chunk-SR2WNZCW.js";
40
41
  import {
41
42
  BitfabError,
42
43
  DEFAULT_SERVICE_URL,
@@ -44,7 +45,7 @@ import {
44
45
  MixedTracingError,
45
46
  __version__,
46
47
  flushTraces
47
- } from "./chunk-4JZ6UMDW.js";
48
+ } from "./chunk-JXZHAIXA.js";
48
49
  import "./chunk-MT36GJMW.js";
49
50
  export {
50
51
  AssertionCategoriesClient,
@@ -76,6 +77,7 @@ export {
76
77
  OrganizationMembersClient,
77
78
  ReplayError,
78
79
  SUPPORTED_PROVIDERS,
80
+ SpansClient,
79
81
  TracesClient,
80
82
  __version__,
81
83
  defineReplayRegistry,
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.64.18";
91
+ __version__ = "0.64.20";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -2121,6 +2121,7 @@ var http_exports = {};
2121
2121
  __export(http_exports, {
2122
2122
  BitfabError: () => BitfabError,
2123
2123
  HttpClient: () => HttpClient,
2124
+ SPAN_TYPES: () => SPAN_TYPES,
2124
2125
  awaitOnExit: () => awaitOnExit,
2125
2126
  awaitPendingRequests: () => awaitPendingRequests,
2126
2127
  experimentIdWireFields: () => experimentIdWireFields,
@@ -2295,7 +2296,7 @@ function warnDroppedExternalTrace(error) {
2295
2296
  function experimentIdWireFields(experimentId) {
2296
2297
  return { experimentId, testRunId: experimentId };
2297
2298
  }
2298
- var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS, REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS, OTLP_TRACES_ENDPOINT, RETRYABLE_STATUSES, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCLE_TIMEOUT_MS2, pendingTracePromises, liveHttpClients, carrierSeq, HttpClient;
2299
+ var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS, REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS, OTLP_TRACES_ENDPOINT, RETRYABLE_STATUSES, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCLE_TIMEOUT_MS2, pendingTracePromises, liveHttpClients, SPAN_TYPES, carrierSeq, HttpClient;
2299
2300
  var init_http = __esm({
2300
2301
  "src/http.ts"() {
2301
2302
  "use strict";
@@ -2353,6 +2354,14 @@ var init_http = __esm({
2353
2354
  });
2354
2355
  });
2355
2356
  }
2357
+ SPAN_TYPES = [
2358
+ "llm",
2359
+ "agent",
2360
+ "function",
2361
+ "guardrail",
2362
+ "handoff",
2363
+ "custom"
2364
+ ];
2356
2365
  carrierSeq = 0;
2357
2366
  HttpClient = class {
2358
2367
  constructor(config) {
@@ -2737,7 +2746,12 @@ var init_http = __esm({
2737
2746
  if (lookup.id !== void 0) {
2738
2747
  searchParams.set("id", lookup.id);
2739
2748
  } else {
2740
- searchParams.set("name", lookup.name);
2749
+ if (lookup.name !== void 0) {
2750
+ searchParams.set("name", lookup.name);
2751
+ }
2752
+ if (lookup.type !== void 0) {
2753
+ searchParams.set("type", lookup.type);
2754
+ }
2741
2755
  searchParams.set("occurrence", String(lookup.occurrence ?? "last"));
2742
2756
  }
2743
2757
  const endpoint = `/api/sdk/traces/${encodeURIComponent(traceId)}/span?${searchParams.toString()}`;
@@ -5364,6 +5378,7 @@ __export(node_exports, {
5364
5378
  OrganizationMembersClient: () => OrganizationMembersClient,
5365
5379
  ReplayError: () => ReplayError,
5366
5380
  SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
5381
+ SpansClient: () => SpansClient,
5367
5382
  TracesClient: () => TracesClient,
5368
5383
  __version__: () => __version__,
5369
5384
  defineReplayRegistry: () => defineReplayRegistry,
@@ -6523,6 +6538,20 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
6523
6538
  };
6524
6539
  }
6525
6540
 
6541
+ // src/bitfabIds.ts
6542
+ init_errors();
6543
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6544
+ function validateTraceId(traceId) {
6545
+ if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
6546
+ throw new BitfabError("traceId must be a valid Bitfab trace ID");
6547
+ }
6548
+ }
6549
+ function validateSpanId(id) {
6550
+ if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
6551
+ throw new BitfabError("id must be a valid Bitfab span ID");
6552
+ }
6553
+ }
6554
+
6526
6555
  // src/client.ts
6527
6556
  init_captureSuppression();
6528
6557
 
@@ -8895,6 +8924,35 @@ function runWithSeedContext(ctx, fn) {
8895
8924
  init_serialize();
8896
8925
  init_simulationPlan();
8897
8926
  init_spanOrigin();
8927
+
8928
+ // src/spans.ts
8929
+ var LIST_PATH = "/api/sdk/spans/list";
8930
+ function withoutUndefined(params) {
8931
+ return Object.fromEntries(
8932
+ Object.entries(params).filter(([, value]) => value !== void 0)
8933
+ );
8934
+ }
8935
+ var SpansClient = class {
8936
+ constructor(httpClient) {
8937
+ this.httpClient = httpClient;
8938
+ }
8939
+ /**
8940
+ * List one trace's spans in the order they ran, one page at a time. No
8941
+ * filter is required: omit `spanType` and `spanName` to page through every
8942
+ * span. Each span carries one extra key per requested `fields` entry. Pass
8943
+ * the returned `nextCursor` back as `cursor` for the next page. Throws a
8944
+ * `BitfabError` with status 404 when the trace is not in your organization.
8945
+ */
8946
+ async list(traceId, params = {}) {
8947
+ validateTraceId(traceId);
8948
+ return this.httpClient.request(
8949
+ LIST_PATH,
8950
+ withoutUndefined({ traceId, ...params })
8951
+ );
8952
+ }
8953
+ };
8954
+
8955
+ // src/client.ts
8898
8956
  init_traceMetadata();
8899
8957
 
8900
8958
  // src/traces.ts
@@ -9775,16 +9833,8 @@ function extractContextFromCollector(collector) {
9775
9833
  return null;
9776
9834
  }
9777
9835
  }
9778
- var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
9779
- function validateTraceId(traceId) {
9780
- if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
9781
- throw new BitfabError("traceId must be a valid Bitfab trace ID");
9782
- }
9783
- }
9784
- function validateSpanId(id) {
9785
- if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
9786
- throw new BitfabError("id must be a valid Bitfab span ID");
9787
- }
9836
+ function isSpanType(value) {
9837
+ return SPAN_TYPES.some((spanType) => spanType === value);
9788
9838
  }
9789
9839
  var noOpSpan = {
9790
9840
  id: "",
@@ -10018,6 +10068,7 @@ var Bitfab = class {
10018
10068
  this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
10019
10069
  this.organizationMembers = new OrganizationMembersClient(this.httpClient);
10020
10070
  this.traces = new TracesClient(this.httpClient);
10071
+ this.spans = new SpansClient(this.httpClient);
10021
10072
  this.labels = new LabelsClient(this.httpClient);
10022
10073
  this.graders = new GradersClient(this.httpClient);
10023
10074
  this.experiments = new ExperimentsClient(this.httpClient);
@@ -11496,22 +11547,27 @@ var Bitfab = class {
11496
11547
  }
11497
11548
  /**
11498
11549
  * Fetch one persisted span from a trace without loading the full trace.
11499
- * Name lookups return the last matching span by default. Pass `occurrence`
11500
- * as `"first"` or a zero-based index to select a different match.
11550
+ * Look up by `id` alone, or by `name` and/or `type` (both must match when
11551
+ * both are given). Name and type lookups return the last matching span by
11552
+ * default. Pass `occurrence` as `"first"` or a zero-based index to select a
11553
+ * different match. Returns `null` when no span matches.
11501
11554
  */
11502
11555
  async getTraceSpan(traceId, lookup) {
11503
11556
  validateTraceId(traceId);
11504
11557
  const hasId = lookup.id !== void 0;
11505
- const hasName = lookup.name !== void 0;
11506
- if (hasId === hasName) {
11507
- throw new BitfabError("Provide exactly one of id or name");
11558
+ const hasNameOrType = lookup.name !== void 0 || lookup.type !== void 0;
11559
+ if (hasId === hasNameOrType) {
11560
+ throw new BitfabError("Provide id, or name and/or type");
11508
11561
  }
11509
11562
  if (hasId) {
11510
11563
  validateSpanId(lookup.id);
11511
11564
  } else {
11512
- if (lookup.name.length === 0) {
11565
+ if (lookup.name !== void 0 && lookup.name.length === 0) {
11513
11566
  throw new BitfabError("name must be a non-empty string");
11514
11567
  }
11568
+ if (lookup.type !== void 0 && !isSpanType(lookup.type)) {
11569
+ throw new BitfabError(`type must be one of ${SPAN_TYPES.join(", ")}`);
11570
+ }
11515
11571
  const occurrence = lookup.occurrence ?? "last";
11516
11572
  if (occurrence !== "first" && occurrence !== "last" && (!Number.isInteger(occurrence) || occurrence < 0)) {
11517
11573
  throw new BitfabError(
@@ -12346,6 +12402,7 @@ assertAsyncStorageRegistered();
12346
12402
  OrganizationMembersClient,
12347
12403
  ReplayError,
12348
12404
  SUPPORTED_PROVIDERS,
12405
+ SpansClient,
12349
12406
  TracesClient,
12350
12407
  __version__,
12351
12408
  defineReplayRegistry,