bitfab 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.
- package/README.md +1 -5
- package/dist/{chunk-MFYWZFV6.js → chunk-G2SZ2Q4B.js} +17 -3
- package/dist/{chunk-MFYWZFV6.js.map → chunk-G2SZ2Q4B.js.map} +1 -1
- package/dist/{chunk-4AZHPORE.js → chunk-NEZUD2GD.js} +62 -22
- package/dist/chunk-NEZUD2GD.js.map +1 -0
- package/dist/{chunk-HYIDCLES.js → chunk-RZ3GXYXE.js} +2 -2
- package/dist/{chunk-N23USNUX.js → chunk-XA5E27HS.js} +4 -4
- package/dist/chunk-XA5E27HS.js.map +1 -0
- package/dist/{chunk-J76P75JP.js → chunk-YZKNF5CY.js} +17 -3
- package/dist/chunk-YZKNF5CY.js.map +1 -0
- package/dist/{chunk-FYRM6KRA.js → chunk-ZQHUYPMY.js} +2 -2
- package/dist/{http-J7BSIXZV.js → http-C4QTUACG.js} +4 -2
- package/dist/{http-V3DB4PXL.js → http-MZHDPA7V.js} +4 -2
- package/dist/index.cjs +76 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -14
- package/dist/index.d.ts +73 -14
- package/dist/index.js +5 -3
- package/dist/node.cjs +76 -19
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +5 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-TF4ATVXC.js → replay-DDS5DRTW.js} +3 -3
- package/dist/{replay-W6AODQF3.js → replay-G2ZJDPUZ.js} +3 -3
- package/dist/replayCli.js +3 -3
- package/dist/seedCli.js +3 -3
- package/package.json +2 -3
- package/dist/chunk-4AZHPORE.js.map +0 -1
- package/dist/chunk-J76P75JP.js.map +0 -1
- package/dist/chunk-N23USNUX.js.map +0 -1
- /package/dist/{chunk-HYIDCLES.js.map → chunk-RZ3GXYXE.js.map} +0 -0
- /package/dist/{chunk-FYRM6KRA.js.map → chunk-ZQHUYPMY.js.map} +0 -0
- /package/dist/{http-J7BSIXZV.js.map → http-C4QTUACG.js.map} +0 -0
- /package/dist/{http-V3DB4PXL.js.map → http-MZHDPA7V.js.map} +0 -0
- /package/dist/{replay-TF4ATVXC.js.map → replay-DDS5DRTW.js.map} +0 -0
- /package/dist/{replay-W6AODQF3.js.map → replay-G2ZJDPUZ.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
|
-
*
|
|
3782
|
-
*
|
|
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.
|
|
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
|
-
*
|
|
3782
|
-
*
|
|
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.
|
|
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
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
LabelsClient,
|
|
29
29
|
OrganizationMembersClient,
|
|
30
30
|
SUPPORTED_PROVIDERS,
|
|
31
|
+
SpansClient,
|
|
31
32
|
TracesClient,
|
|
32
33
|
defineReplayRegistry,
|
|
33
34
|
finalizers,
|
|
@@ -36,7 +37,7 @@ import {
|
|
|
36
37
|
getCurrentTrace,
|
|
37
38
|
reseedFromRegistry,
|
|
38
39
|
seedFromRegistry
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-NEZUD2GD.js";
|
|
40
41
|
import "./chunk-YWXQM6J3.js";
|
|
41
42
|
import {
|
|
42
43
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -45,7 +46,7 @@ import {
|
|
|
45
46
|
ReplayError,
|
|
46
47
|
reportReplayProgress,
|
|
47
48
|
serializeReplayResult
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-RZ3GXYXE.js";
|
|
49
50
|
import {
|
|
50
51
|
BitfabError,
|
|
51
52
|
DEFAULT_SERVICE_URL,
|
|
@@ -53,7 +54,7 @@ import {
|
|
|
53
54
|
MixedTracingError,
|
|
54
55
|
__version__,
|
|
55
56
|
flushTraces
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-YZKNF5CY.js";
|
|
57
58
|
import "./chunk-MT36GJMW.js";
|
|
58
59
|
export {
|
|
59
60
|
AssertionCategoriesClient,
|
|
@@ -85,6 +86,7 @@ export {
|
|
|
85
86
|
OrganizationMembersClient,
|
|
86
87
|
ReplayError,
|
|
87
88
|
SUPPORTED_PROVIDERS,
|
|
89
|
+
SpansClient,
|
|
88
90
|
TracesClient,
|
|
89
91
|
__version__,
|
|
90
92
|
defineReplayRegistry,
|
package/dist/node.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var __version__, __packageName__;
|
|
|
97
97
|
var init_version_generated = __esm({
|
|
98
98
|
"src/version.generated.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
__version__ = "0.64.
|
|
100
|
+
__version__ = "0.64.20";
|
|
101
101
|
__packageName__ = "bitfab";
|
|
102
102
|
}
|
|
103
103
|
});
|
|
@@ -2130,6 +2130,7 @@ var http_exports = {};
|
|
|
2130
2130
|
__export(http_exports, {
|
|
2131
2131
|
BitfabError: () => BitfabError,
|
|
2132
2132
|
HttpClient: () => HttpClient,
|
|
2133
|
+
SPAN_TYPES: () => SPAN_TYPES,
|
|
2133
2134
|
awaitOnExit: () => awaitOnExit,
|
|
2134
2135
|
awaitPendingRequests: () => awaitPendingRequests,
|
|
2135
2136
|
experimentIdWireFields: () => experimentIdWireFields,
|
|
@@ -2304,7 +2305,7 @@ function warnDroppedExternalTrace(error) {
|
|
|
2304
2305
|
function experimentIdWireFields(experimentId) {
|
|
2305
2306
|
return { experimentId, testRunId: experimentId };
|
|
2306
2307
|
}
|
|
2307
|
-
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;
|
|
2308
|
+
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;
|
|
2308
2309
|
var init_http = __esm({
|
|
2309
2310
|
"src/http.ts"() {
|
|
2310
2311
|
"use strict";
|
|
@@ -2362,6 +2363,14 @@ var init_http = __esm({
|
|
|
2362
2363
|
});
|
|
2363
2364
|
});
|
|
2364
2365
|
}
|
|
2366
|
+
SPAN_TYPES = [
|
|
2367
|
+
"llm",
|
|
2368
|
+
"agent",
|
|
2369
|
+
"function",
|
|
2370
|
+
"guardrail",
|
|
2371
|
+
"handoff",
|
|
2372
|
+
"custom"
|
|
2373
|
+
];
|
|
2365
2374
|
carrierSeq = 0;
|
|
2366
2375
|
HttpClient = class {
|
|
2367
2376
|
constructor(config) {
|
|
@@ -2746,7 +2755,12 @@ var init_http = __esm({
|
|
|
2746
2755
|
if (lookup.id !== void 0) {
|
|
2747
2756
|
searchParams.set("id", lookup.id);
|
|
2748
2757
|
} else {
|
|
2749
|
-
|
|
2758
|
+
if (lookup.name !== void 0) {
|
|
2759
|
+
searchParams.set("name", lookup.name);
|
|
2760
|
+
}
|
|
2761
|
+
if (lookup.type !== void 0) {
|
|
2762
|
+
searchParams.set("type", lookup.type);
|
|
2763
|
+
}
|
|
2750
2764
|
searchParams.set("occurrence", String(lookup.occurrence ?? "last"));
|
|
2751
2765
|
}
|
|
2752
2766
|
const endpoint = `/api/sdk/traces/${encodeURIComponent(traceId)}/span?${searchParams.toString()}`;
|
|
@@ -5373,6 +5387,7 @@ __export(node_exports, {
|
|
|
5373
5387
|
OrganizationMembersClient: () => OrganizationMembersClient,
|
|
5374
5388
|
ReplayError: () => ReplayError,
|
|
5375
5389
|
SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
|
|
5390
|
+
SpansClient: () => SpansClient,
|
|
5376
5391
|
TracesClient: () => TracesClient,
|
|
5377
5392
|
__version__: () => __version__,
|
|
5378
5393
|
defineReplayRegistry: () => defineReplayRegistry,
|
|
@@ -6532,6 +6547,20 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
|
|
|
6532
6547
|
};
|
|
6533
6548
|
}
|
|
6534
6549
|
|
|
6550
|
+
// src/bitfabIds.ts
|
|
6551
|
+
init_errors();
|
|
6552
|
+
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;
|
|
6553
|
+
function validateTraceId(traceId) {
|
|
6554
|
+
if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
|
|
6555
|
+
throw new BitfabError("traceId must be a valid Bitfab trace ID");
|
|
6556
|
+
}
|
|
6557
|
+
}
|
|
6558
|
+
function validateSpanId(id) {
|
|
6559
|
+
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
6560
|
+
throw new BitfabError("id must be a valid Bitfab span ID");
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6535
6564
|
// src/client.ts
|
|
6536
6565
|
init_captureSuppression();
|
|
6537
6566
|
|
|
@@ -8904,6 +8933,35 @@ function runWithSeedContext(ctx, fn) {
|
|
|
8904
8933
|
init_serialize();
|
|
8905
8934
|
init_simulationPlan();
|
|
8906
8935
|
init_spanOrigin();
|
|
8936
|
+
|
|
8937
|
+
// src/spans.ts
|
|
8938
|
+
var LIST_PATH = "/api/sdk/spans/list";
|
|
8939
|
+
function withoutUndefined(params) {
|
|
8940
|
+
return Object.fromEntries(
|
|
8941
|
+
Object.entries(params).filter(([, value]) => value !== void 0)
|
|
8942
|
+
);
|
|
8943
|
+
}
|
|
8944
|
+
var SpansClient = class {
|
|
8945
|
+
constructor(httpClient) {
|
|
8946
|
+
this.httpClient = httpClient;
|
|
8947
|
+
}
|
|
8948
|
+
/**
|
|
8949
|
+
* List one trace's spans in the order they ran, one page at a time. No
|
|
8950
|
+
* filter is required: omit `spanType` and `spanName` to page through every
|
|
8951
|
+
* span. Each span carries one extra key per requested `fields` entry. Pass
|
|
8952
|
+
* the returned `nextCursor` back as `cursor` for the next page. Throws a
|
|
8953
|
+
* `BitfabError` with status 404 when the trace is not in your organization.
|
|
8954
|
+
*/
|
|
8955
|
+
async list(traceId, params = {}) {
|
|
8956
|
+
validateTraceId(traceId);
|
|
8957
|
+
return this.httpClient.request(
|
|
8958
|
+
LIST_PATH,
|
|
8959
|
+
withoutUndefined({ traceId, ...params })
|
|
8960
|
+
);
|
|
8961
|
+
}
|
|
8962
|
+
};
|
|
8963
|
+
|
|
8964
|
+
// src/client.ts
|
|
8907
8965
|
init_traceMetadata();
|
|
8908
8966
|
|
|
8909
8967
|
// src/traces.ts
|
|
@@ -9784,16 +9842,8 @@ function extractContextFromCollector(collector) {
|
|
|
9784
9842
|
return null;
|
|
9785
9843
|
}
|
|
9786
9844
|
}
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
|
|
9790
|
-
throw new BitfabError("traceId must be a valid Bitfab trace ID");
|
|
9791
|
-
}
|
|
9792
|
-
}
|
|
9793
|
-
function validateSpanId(id) {
|
|
9794
|
-
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
9795
|
-
throw new BitfabError("id must be a valid Bitfab span ID");
|
|
9796
|
-
}
|
|
9845
|
+
function isSpanType(value) {
|
|
9846
|
+
return SPAN_TYPES.some((spanType) => spanType === value);
|
|
9797
9847
|
}
|
|
9798
9848
|
var noOpSpan = {
|
|
9799
9849
|
id: "",
|
|
@@ -10027,6 +10077,7 @@ var Bitfab = class {
|
|
|
10027
10077
|
this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
|
|
10028
10078
|
this.organizationMembers = new OrganizationMembersClient(this.httpClient);
|
|
10029
10079
|
this.traces = new TracesClient(this.httpClient);
|
|
10080
|
+
this.spans = new SpansClient(this.httpClient);
|
|
10030
10081
|
this.labels = new LabelsClient(this.httpClient);
|
|
10031
10082
|
this.graders = new GradersClient(this.httpClient);
|
|
10032
10083
|
this.experiments = new ExperimentsClient(this.httpClient);
|
|
@@ -11505,22 +11556,27 @@ var Bitfab = class {
|
|
|
11505
11556
|
}
|
|
11506
11557
|
/**
|
|
11507
11558
|
* Fetch one persisted span from a trace without loading the full trace.
|
|
11508
|
-
*
|
|
11509
|
-
*
|
|
11559
|
+
* Look up by `id` alone, or by `name` and/or `type` (both must match when
|
|
11560
|
+
* both are given). Name and type lookups return the last matching span by
|
|
11561
|
+
* default. Pass `occurrence` as `"first"` or a zero-based index to select a
|
|
11562
|
+
* different match. Returns `null` when no span matches.
|
|
11510
11563
|
*/
|
|
11511
11564
|
async getTraceSpan(traceId, lookup) {
|
|
11512
11565
|
validateTraceId(traceId);
|
|
11513
11566
|
const hasId = lookup.id !== void 0;
|
|
11514
|
-
const
|
|
11515
|
-
if (hasId ===
|
|
11516
|
-
throw new BitfabError("Provide
|
|
11567
|
+
const hasNameOrType = lookup.name !== void 0 || lookup.type !== void 0;
|
|
11568
|
+
if (hasId === hasNameOrType) {
|
|
11569
|
+
throw new BitfabError("Provide id, or name and/or type");
|
|
11517
11570
|
}
|
|
11518
11571
|
if (hasId) {
|
|
11519
11572
|
validateSpanId(lookup.id);
|
|
11520
11573
|
} else {
|
|
11521
|
-
if (lookup.name.length === 0) {
|
|
11574
|
+
if (lookup.name !== void 0 && lookup.name.length === 0) {
|
|
11522
11575
|
throw new BitfabError("name must be a non-empty string");
|
|
11523
11576
|
}
|
|
11577
|
+
if (lookup.type !== void 0 && !isSpanType(lookup.type)) {
|
|
11578
|
+
throw new BitfabError(`type must be one of ${SPAN_TYPES.join(", ")}`);
|
|
11579
|
+
}
|
|
11524
11580
|
const occurrence = lookup.occurrence ?? "last";
|
|
11525
11581
|
if (occurrence !== "first" && occurrence !== "last" && (!Number.isInteger(occurrence) || occurrence < 0)) {
|
|
11526
11582
|
throw new BitfabError(
|
|
@@ -12355,6 +12411,7 @@ assertAsyncStorageRegistered();
|
|
|
12355
12411
|
OrganizationMembersClient,
|
|
12356
12412
|
ReplayError,
|
|
12357
12413
|
SUPPORTED_PROVIDERS,
|
|
12414
|
+
SpansClient,
|
|
12358
12415
|
TracesClient,
|
|
12359
12416
|
__version__,
|
|
12360
12417
|
defineReplayRegistry,
|