@bitfab/sdk 0.43.1 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RBKGO5ZC.js → chunk-AYEJRU7Z.js} +2 -2
- package/dist/chunk-AYEJRU7Z.js.map +1 -0
- package/dist/{chunk-V4MRFSWK.js → chunk-RZF5XSM6.js} +81 -34
- package/dist/chunk-RZF5XSM6.js.map +1 -0
- package/dist/{chunk-TNGKCPBP.js → chunk-SMWYCJH6.js} +13 -5
- package/dist/chunk-SMWYCJH6.js.map +1 -0
- package/dist/{chunk-5LY4XOUY.js → chunk-XTX66R4I.js} +9 -2
- package/dist/chunk-XTX66R4I.js.map +1 -0
- package/dist/{http-FKD4GT55.js → http-CL4DNNRP.js} +2 -2
- package/dist/{http-TPVUGXYJ.js → http-GHKRM3L7.js} +2 -2
- package/dist/index.cjs +97 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +5 -3
- package/dist/node.cjs +97 -33
- 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-PICGOZVG.js → replay-IPATGCIY.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/replayCli.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5LY4XOUY.js.map +0 -1
- package/dist/chunk-RBKGO5ZC.js.map +0 -1
- package/dist/chunk-TNGKCPBP.js.map +0 -1
- package/dist/chunk-V4MRFSWK.js.map +0 -1
- /package/dist/{http-FKD4GT55.js.map → http-CL4DNNRP.js.map} +0 -0
- /package/dist/{http-TPVUGXYJ.js.map → http-GHKRM3L7.js.map} +0 -0
- /package/dist/{replay-PICGOZVG.js.map → replay-IPATGCIY.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -98,6 +98,9 @@ declare class BitfabError extends Error {
|
|
|
98
98
|
*/
|
|
99
99
|
retryAfterMs?: number | undefined);
|
|
100
100
|
}
|
|
101
|
+
declare class MixedTracingError extends Error {
|
|
102
|
+
constructor(message: string);
|
|
103
|
+
}
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
106
|
* Selective mock overrides for replay.
|
|
@@ -644,6 +647,32 @@ interface TokenUsage {
|
|
|
644
647
|
cached: number | null;
|
|
645
648
|
total: number | null;
|
|
646
649
|
}
|
|
650
|
+
interface TraceOutlineSpanError {
|
|
651
|
+
source: string;
|
|
652
|
+
error: string;
|
|
653
|
+
step?: string;
|
|
654
|
+
}
|
|
655
|
+
interface TraceOutlineSpan {
|
|
656
|
+
spanId: string;
|
|
657
|
+
name: string | null;
|
|
658
|
+
type: string;
|
|
659
|
+
traceFunctionKey: string | null;
|
|
660
|
+
durationMs: number | null;
|
|
661
|
+
tokens: TokenUsage | null;
|
|
662
|
+
model: string | null;
|
|
663
|
+
errors: TraceOutlineSpanError[] | null;
|
|
664
|
+
mocked: boolean;
|
|
665
|
+
children: TraceOutlineSpan[];
|
|
666
|
+
}
|
|
667
|
+
interface TraceOutline {
|
|
668
|
+
traceId: string;
|
|
669
|
+
name: string | null;
|
|
670
|
+
status: string;
|
|
671
|
+
traceFunctionKey: string | null;
|
|
672
|
+
durationMs: number | null;
|
|
673
|
+
spanCount: number;
|
|
674
|
+
spans: TraceOutlineSpan[];
|
|
675
|
+
}
|
|
647
676
|
/**
|
|
648
677
|
* Describes a single file edited as part of a code change.
|
|
649
678
|
*
|
|
@@ -743,6 +772,8 @@ interface CompleteReplayResponse {
|
|
|
743
772
|
* `ReplayItem.tokens`. Absent on servers that predate this field.
|
|
744
773
|
*/
|
|
745
774
|
tokens?: Record<string, TokenUsage | null>;
|
|
775
|
+
traceOutlines?: Record<string, TraceOutline>;
|
|
776
|
+
originalTraceOutlines?: Record<string, TraceOutline>;
|
|
746
777
|
/**
|
|
747
778
|
* Number of traces the server has persisted for this test run at
|
|
748
779
|
* completion time. Lets the SDK distinguish "uploads failed" from
|
|
@@ -1690,6 +1721,8 @@ interface ReplayProgressItem {
|
|
|
1690
1721
|
model?: string | null;
|
|
1691
1722
|
dbSnapshotRef?: DbSnapshotRef | null;
|
|
1692
1723
|
dbBranchTimings?: DbBranchTimings | null;
|
|
1724
|
+
traceOutline?: TraceOutline | null;
|
|
1725
|
+
originalTraceOutline?: TraceOutline | null;
|
|
1693
1726
|
}
|
|
1694
1727
|
/**
|
|
1695
1728
|
* @deprecated Use {@link ReplayItemFinishProgress}. This legacy shape also
|
|
@@ -1841,6 +1874,8 @@ interface ReplayItem<T> {
|
|
|
1841
1874
|
* no snapshot ref, or against a server that predates timings.
|
|
1842
1875
|
*/
|
|
1843
1876
|
dbBranchTimings: DbBranchTimings | null;
|
|
1877
|
+
traceOutline: TraceOutline | null;
|
|
1878
|
+
originalTraceOutline: TraceOutline | null;
|
|
1844
1879
|
}
|
|
1845
1880
|
|
|
1846
1881
|
interface ReplayResult<T> {
|
|
@@ -2096,6 +2131,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2096
2131
|
}
|
|
2097
2132
|
|
|
2098
2133
|
type CaptureSurface = "opt-in" | "opt-out";
|
|
2134
|
+
|
|
2099
2135
|
/**
|
|
2100
2136
|
* Options for wrapBAML.
|
|
2101
2137
|
*/
|
|
@@ -3078,7 +3114,7 @@ declare class BitfabFunction {
|
|
|
3078
3114
|
/**
|
|
3079
3115
|
* SDK version from package.json (injected at build time)
|
|
3080
3116
|
*/
|
|
3081
|
-
declare const __version__ = "0.
|
|
3117
|
+
declare const __version__ = "0.44.1";
|
|
3082
3118
|
|
|
3083
3119
|
/**
|
|
3084
3120
|
* Constants for the Bitfab SDK.
|
|
@@ -3208,4 +3244,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3208
3244
|
run?: boolean;
|
|
3209
3245
|
}): Promise<SeedResult>;
|
|
3210
3246
|
|
|
3211
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type 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 TraceIngestionType, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3247
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type 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 TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -98,6 +98,9 @@ declare class BitfabError extends Error {
|
|
|
98
98
|
*/
|
|
99
99
|
retryAfterMs?: number | undefined);
|
|
100
100
|
}
|
|
101
|
+
declare class MixedTracingError extends Error {
|
|
102
|
+
constructor(message: string);
|
|
103
|
+
}
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
106
|
* Selective mock overrides for replay.
|
|
@@ -644,6 +647,32 @@ interface TokenUsage {
|
|
|
644
647
|
cached: number | null;
|
|
645
648
|
total: number | null;
|
|
646
649
|
}
|
|
650
|
+
interface TraceOutlineSpanError {
|
|
651
|
+
source: string;
|
|
652
|
+
error: string;
|
|
653
|
+
step?: string;
|
|
654
|
+
}
|
|
655
|
+
interface TraceOutlineSpan {
|
|
656
|
+
spanId: string;
|
|
657
|
+
name: string | null;
|
|
658
|
+
type: string;
|
|
659
|
+
traceFunctionKey: string | null;
|
|
660
|
+
durationMs: number | null;
|
|
661
|
+
tokens: TokenUsage | null;
|
|
662
|
+
model: string | null;
|
|
663
|
+
errors: TraceOutlineSpanError[] | null;
|
|
664
|
+
mocked: boolean;
|
|
665
|
+
children: TraceOutlineSpan[];
|
|
666
|
+
}
|
|
667
|
+
interface TraceOutline {
|
|
668
|
+
traceId: string;
|
|
669
|
+
name: string | null;
|
|
670
|
+
status: string;
|
|
671
|
+
traceFunctionKey: string | null;
|
|
672
|
+
durationMs: number | null;
|
|
673
|
+
spanCount: number;
|
|
674
|
+
spans: TraceOutlineSpan[];
|
|
675
|
+
}
|
|
647
676
|
/**
|
|
648
677
|
* Describes a single file edited as part of a code change.
|
|
649
678
|
*
|
|
@@ -743,6 +772,8 @@ interface CompleteReplayResponse {
|
|
|
743
772
|
* `ReplayItem.tokens`. Absent on servers that predate this field.
|
|
744
773
|
*/
|
|
745
774
|
tokens?: Record<string, TokenUsage | null>;
|
|
775
|
+
traceOutlines?: Record<string, TraceOutline>;
|
|
776
|
+
originalTraceOutlines?: Record<string, TraceOutline>;
|
|
746
777
|
/**
|
|
747
778
|
* Number of traces the server has persisted for this test run at
|
|
748
779
|
* completion time. Lets the SDK distinguish "uploads failed" from
|
|
@@ -1690,6 +1721,8 @@ interface ReplayProgressItem {
|
|
|
1690
1721
|
model?: string | null;
|
|
1691
1722
|
dbSnapshotRef?: DbSnapshotRef | null;
|
|
1692
1723
|
dbBranchTimings?: DbBranchTimings | null;
|
|
1724
|
+
traceOutline?: TraceOutline | null;
|
|
1725
|
+
originalTraceOutline?: TraceOutline | null;
|
|
1693
1726
|
}
|
|
1694
1727
|
/**
|
|
1695
1728
|
* @deprecated Use {@link ReplayItemFinishProgress}. This legacy shape also
|
|
@@ -1841,6 +1874,8 @@ interface ReplayItem<T> {
|
|
|
1841
1874
|
* no snapshot ref, or against a server that predates timings.
|
|
1842
1875
|
*/
|
|
1843
1876
|
dbBranchTimings: DbBranchTimings | null;
|
|
1877
|
+
traceOutline: TraceOutline | null;
|
|
1878
|
+
originalTraceOutline: TraceOutline | null;
|
|
1844
1879
|
}
|
|
1845
1880
|
|
|
1846
1881
|
interface ReplayResult<T> {
|
|
@@ -2096,6 +2131,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2096
2131
|
}
|
|
2097
2132
|
|
|
2098
2133
|
type CaptureSurface = "opt-in" | "opt-out";
|
|
2134
|
+
|
|
2099
2135
|
/**
|
|
2100
2136
|
* Options for wrapBAML.
|
|
2101
2137
|
*/
|
|
@@ -3078,7 +3114,7 @@ declare class BitfabFunction {
|
|
|
3078
3114
|
/**
|
|
3079
3115
|
* SDK version from package.json (injected at build time)
|
|
3080
3116
|
*/
|
|
3081
|
-
declare const __version__ = "0.
|
|
3117
|
+
declare const __version__ = "0.44.1";
|
|
3082
3118
|
|
|
3083
3119
|
/**
|
|
3084
3120
|
* Constants for the Bitfab SDK.
|
|
@@ -3208,4 +3244,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3208
3244
|
run?: boolean;
|
|
3209
3245
|
}): Promise<SeedResult>;
|
|
3210
3246
|
|
|
3211
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type 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 TraceIngestionType, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3247
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type 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 TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace,
|
|
17
17
|
seedFromRegistry
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RZF5XSM6.js";
|
|
19
19
|
import "./chunk-ZUD7OFYB.js";
|
|
20
20
|
import {
|
|
21
21
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -24,14 +24,15 @@ import {
|
|
|
24
24
|
ReplayError,
|
|
25
25
|
reportReplayProgress,
|
|
26
26
|
serializeReplayResult
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SMWYCJH6.js";
|
|
28
28
|
import {
|
|
29
29
|
BitfabError,
|
|
30
30
|
DEFAULT_SERVICE_URL,
|
|
31
31
|
HttpClient,
|
|
32
|
+
MixedTracingError,
|
|
32
33
|
__version__,
|
|
33
34
|
flushTraces
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-XTX66R4I.js";
|
|
35
36
|
import "./chunk-H6LZRFMN.js";
|
|
36
37
|
export {
|
|
37
38
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -49,6 +50,7 @@ export {
|
|
|
49
50
|
DatasetsClient,
|
|
50
51
|
DbBranchReplayError,
|
|
51
52
|
HttpClient,
|
|
53
|
+
MixedTracingError,
|
|
52
54
|
NO_MOCK_OVERRIDE,
|
|
53
55
|
ReplayError,
|
|
54
56
|
SUPPORTED_PROVIDERS,
|
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.
|
|
91
|
+
__version__ = "0.44.1";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -210,7 +210,7 @@ var init_compress = __esm({
|
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
// src/errors.ts
|
|
213
|
-
var BitfabError;
|
|
213
|
+
var BitfabError, MixedTracingError;
|
|
214
214
|
var init_errors = __esm({
|
|
215
215
|
"src/errors.ts"() {
|
|
216
216
|
"use strict";
|
|
@@ -223,6 +223,12 @@ var init_errors = __esm({
|
|
|
223
223
|
this.name = "BitfabError";
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
+
MixedTracingError = class extends Error {
|
|
227
|
+
constructor(message) {
|
|
228
|
+
super(message);
|
|
229
|
+
this.name = "MixedTracingError";
|
|
230
|
+
}
|
|
231
|
+
};
|
|
226
232
|
}
|
|
227
233
|
});
|
|
228
234
|
|
|
@@ -2720,7 +2726,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
2720
2726
|
tokens: null,
|
|
2721
2727
|
model: serverItem.originalModel ?? serverItem.model ?? null,
|
|
2722
2728
|
dbSnapshotRef: dbSnapshotRef ?? null,
|
|
2723
|
-
dbBranchTimings: dbBranchTimings ?? null
|
|
2729
|
+
dbBranchTimings: dbBranchTimings ?? null,
|
|
2730
|
+
traceOutline: null,
|
|
2731
|
+
originalTraceOutline: null
|
|
2724
2732
|
};
|
|
2725
2733
|
}
|
|
2726
2734
|
try {
|
|
@@ -2804,7 +2812,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
2804
2812
|
tokens: null,
|
|
2805
2813
|
model: originalModel,
|
|
2806
2814
|
dbSnapshotRef: dbSnapshotRef ?? null,
|
|
2807
|
-
dbBranchTimings: dbBranchTimings ?? null
|
|
2815
|
+
dbBranchTimings: dbBranchTimings ?? null,
|
|
2816
|
+
traceOutline: null,
|
|
2817
|
+
originalTraceOutline: null
|
|
2808
2818
|
};
|
|
2809
2819
|
}
|
|
2810
2820
|
async function waitForReplayPersistence(httpClient, testRunId, replayedTraceIds) {
|
|
@@ -3059,7 +3069,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
3059
3069
|
tokens: item.tokens,
|
|
3060
3070
|
model: item.model,
|
|
3061
3071
|
dbSnapshotRef: item.dbSnapshotRef,
|
|
3062
|
-
dbBranchTimings: item.dbBranchTimings
|
|
3072
|
+
dbBranchTimings: item.dbBranchTimings,
|
|
3073
|
+
traceOutline: item.traceOutline,
|
|
3074
|
+
originalTraceOutline: item.originalTraceOutline
|
|
3063
3075
|
}
|
|
3064
3076
|
});
|
|
3065
3077
|
} catch {
|
|
@@ -3139,7 +3151,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
3139
3151
|
}
|
|
3140
3152
|
if (mapped !== void 0) {
|
|
3141
3153
|
item.tokens = replayTokens?.[mapped] ?? null;
|
|
3154
|
+
item.traceOutline = completeResult.traceOutlines?.[mapped] ?? null;
|
|
3142
3155
|
}
|
|
3156
|
+
item.originalTraceOutline = completeResult.originalTraceOutlines?.[item.originalTraceId] ?? null;
|
|
3143
3157
|
}
|
|
3144
3158
|
if (completedCount > 0 && missing.length === completedCount) {
|
|
3145
3159
|
const serverCount = completeResult.traceCount !== void 0 ? ` The server persisted ${completeResult.traceCount} trace(s) for this run.` : "";
|
|
@@ -3262,6 +3276,7 @@ __export(node_exports, {
|
|
|
3262
3276
|
DatasetsClient: () => DatasetsClient,
|
|
3263
3277
|
DbBranchReplayError: () => DbBranchReplayError,
|
|
3264
3278
|
HttpClient: () => HttpClient,
|
|
3279
|
+
MixedTracingError: () => MixedTracingError,
|
|
3265
3280
|
NO_MOCK_OVERRIDE: () => NO_MOCK_OVERRIDE,
|
|
3266
3281
|
ReplayError: () => ReplayError,
|
|
3267
3282
|
SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
|
|
@@ -4342,6 +4357,50 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
|
|
|
4342
4357
|
};
|
|
4343
4358
|
}
|
|
4344
4359
|
|
|
4360
|
+
// src/captureSurface.ts
|
|
4361
|
+
init_errors();
|
|
4362
|
+
var DEFAULT_SURFACE = "opt-in";
|
|
4363
|
+
var SURFACE_API = {
|
|
4364
|
+
"opt-in": "withSpan()",
|
|
4365
|
+
"opt-out": "withTrace()"
|
|
4366
|
+
};
|
|
4367
|
+
var MIXED_SURFACE_REMEDY = {
|
|
4368
|
+
"opt-in": "Inside a withTrace/trace subtree, configure a discovered call with node()/withNode() instead, or trace this workflow with withSpan() only.",
|
|
4369
|
+
"opt-out": "Wrap the caller with withTrace()/trace() as well, or wrap this function with withSpan()."
|
|
4370
|
+
};
|
|
4371
|
+
function resolveSurface(requested, parentSurface) {
|
|
4372
|
+
if (requested === "neutral") {
|
|
4373
|
+
return void 0;
|
|
4374
|
+
}
|
|
4375
|
+
if (requested === "inherit") {
|
|
4376
|
+
return parentSurface ?? DEFAULT_SURFACE;
|
|
4377
|
+
}
|
|
4378
|
+
return requested;
|
|
4379
|
+
}
|
|
4380
|
+
function mixedTracingError(enteredApi, entered, enclosing, traceFunctionKey) {
|
|
4381
|
+
const subject = traceFunctionKey === void 0 ? "" : ` for "${traceFunctionKey}"`;
|
|
4382
|
+
return new MixedTracingError(
|
|
4383
|
+
`opt-in and opt-out tracing can't be mixed in one call stack: ${enteredApi} (${entered})${subject} was entered inside a ${SURFACE_API[enclosing]} call (${enclosing}). ${MIXED_SURFACE_REMEDY[entered]}`
|
|
4384
|
+
);
|
|
4385
|
+
}
|
|
4386
|
+
function assertSurfacesCompatible(requested, resolved, parentSurface, traceFunctionKey) {
|
|
4387
|
+
if (requested === "inherit" || requested === "neutral") {
|
|
4388
|
+
return;
|
|
4389
|
+
}
|
|
4390
|
+
if (resolved === void 0 || parentSurface === void 0) {
|
|
4391
|
+
return;
|
|
4392
|
+
}
|
|
4393
|
+
if (parentSurface === resolved) {
|
|
4394
|
+
return;
|
|
4395
|
+
}
|
|
4396
|
+
throw mixedTracingError(
|
|
4397
|
+
SURFACE_API[resolved],
|
|
4398
|
+
resolved,
|
|
4399
|
+
parentSurface,
|
|
4400
|
+
traceFunctionKey
|
|
4401
|
+
);
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4345
4404
|
// src/client.ts
|
|
4346
4405
|
init_constants();
|
|
4347
4406
|
|
|
@@ -4488,6 +4547,7 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
|
|
|
4488
4547
|
}
|
|
4489
4548
|
|
|
4490
4549
|
// src/client.ts
|
|
4550
|
+
init_errors();
|
|
4491
4551
|
init_http();
|
|
4492
4552
|
|
|
4493
4553
|
// src/langgraph.ts
|
|
@@ -5877,18 +5937,6 @@ var BitfabVercelAiHandler = class {
|
|
|
5877
5937
|
|
|
5878
5938
|
// src/client.ts
|
|
5879
5939
|
init_warnOnce();
|
|
5880
|
-
var MIXED_SURFACE_REMEDY = {
|
|
5881
|
-
"opt-in": "Inside a withTrace/trace subtree, configure a discovered call with node()/withNode() instead, or trace this workflow with withSpan() only.",
|
|
5882
|
-
"opt-out": "Wrap the caller with withTrace()/trace() as well, or wrap this function with withSpan()."
|
|
5883
|
-
};
|
|
5884
|
-
function warnMixedTracingSurfaces(traceFunctionKey, entered, enclosing) {
|
|
5885
|
-
const enteredApi = entered === "opt-in" ? "withSpan()" : "withTrace()";
|
|
5886
|
-
const enclosingApi = enclosing === "opt-in" ? "withSpan()" : "withTrace()";
|
|
5887
|
-
warnOnce(
|
|
5888
|
-
`mixed-tracing-surface:${traceFunctionKey}:${entered}`,
|
|
5889
|
-
`opt-in and opt-out tracing are mixed in one call stack: ${enteredApi} (${entered}) for "${traceFunctionKey}" was entered inside a ${enclosingApi} call (${enclosing}). Both are recorded, and the spans nest as written. ${MIXED_SURFACE_REMEDY[entered]}`
|
|
5890
|
-
);
|
|
5891
|
-
}
|
|
5892
5940
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
5893
5941
|
var asyncLocalStorage = null;
|
|
5894
5942
|
var SPAN_CONTEXT_STORAGE_SYMBOL = /* @__PURE__ */ Symbol.for("bitfab.spanContextStorage");
|
|
@@ -5918,6 +5966,10 @@ function getSpanStack() {
|
|
|
5918
5966
|
}
|
|
5919
5967
|
return browserSpanStack;
|
|
5920
5968
|
}
|
|
5969
|
+
function enclosingSurface() {
|
|
5970
|
+
const stack = getSpanStack();
|
|
5971
|
+
return stack[stack.length - 1]?.surface;
|
|
5972
|
+
}
|
|
5921
5973
|
function runWithSpanStack(stack, fn) {
|
|
5922
5974
|
if (asyncLocalStorage) {
|
|
5923
5975
|
return asyncLocalStorage.run(stack, fn);
|
|
@@ -6404,6 +6456,9 @@ var Bitfab = class {
|
|
|
6404
6456
|
const nodeConfiguration = { ...configuration, functionName };
|
|
6405
6457
|
return function(...args) {
|
|
6406
6458
|
if (!__bitfabAutoTraceActive()) {
|
|
6459
|
+
if (enclosingSurface() === "opt-in") {
|
|
6460
|
+
throw mixedTracingError("node()", "opt-out", "opt-in");
|
|
6461
|
+
}
|
|
6407
6462
|
return fn.apply(this, args);
|
|
6408
6463
|
}
|
|
6409
6464
|
return runWithAutoTraceNodeConfiguration(
|
|
@@ -7105,20 +7160,19 @@ var Bitfab = class {
|
|
|
7105
7160
|
const spanId = randomUuid();
|
|
7106
7161
|
const parentSpanId = parentContext?.spanId ?? null;
|
|
7107
7162
|
const isRootSpan = parentSpanId === null;
|
|
7108
|
-
const requestedSurface = options.surface ??
|
|
7109
|
-
const surface = requestedSurface
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
}
|
|
7163
|
+
const requestedSurface = options.surface ?? DEFAULT_SURFACE;
|
|
7164
|
+
const surface = resolveSurface(requestedSurface, parentContext?.surface);
|
|
7165
|
+
assertSurfacesCompatible(
|
|
7166
|
+
requestedSurface,
|
|
7167
|
+
surface,
|
|
7168
|
+
parentContext?.surface,
|
|
7169
|
+
traceFunctionKey
|
|
7170
|
+
);
|
|
7117
7171
|
const newContext = {
|
|
7118
7172
|
traceId,
|
|
7119
7173
|
spanId,
|
|
7120
7174
|
contexts: [],
|
|
7121
|
-
surface
|
|
7175
|
+
...surface !== void 0 && { surface }
|
|
7122
7176
|
};
|
|
7123
7177
|
newStack = [...currentStack, newContext];
|
|
7124
7178
|
const inputs = args;
|
|
@@ -7401,6 +7455,9 @@ var Bitfab = class {
|
|
|
7401
7455
|
if (registeredTraceId) {
|
|
7402
7456
|
activeTraceStates.delete(registeredTraceId);
|
|
7403
7457
|
}
|
|
7458
|
+
if (setupError instanceof MixedTracingError) {
|
|
7459
|
+
throw setupError;
|
|
7460
|
+
}
|
|
7404
7461
|
if (getReplayContext() || inSeedScope()) {
|
|
7405
7462
|
throw setupError;
|
|
7406
7463
|
}
|
|
@@ -7800,9 +7857,14 @@ var Bitfab = class {
|
|
|
7800
7857
|
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
7801
7858
|
let target = fn;
|
|
7802
7859
|
if (wrappedKey === void 0) {
|
|
7860
|
+
const seedRootOptions = {
|
|
7861
|
+
name: traceFunctionKey,
|
|
7862
|
+
type: "agent",
|
|
7863
|
+
surface: "neutral"
|
|
7864
|
+
};
|
|
7803
7865
|
target = this.withSpan(
|
|
7804
7866
|
traceFunctionKey,
|
|
7805
|
-
|
|
7867
|
+
seedRootOptions,
|
|
7806
7868
|
fn
|
|
7807
7869
|
);
|
|
7808
7870
|
} else if (wrappedKey !== traceFunctionKey) {
|
|
@@ -7844,11 +7906,12 @@ var Bitfab = class {
|
|
|
7844
7906
|
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
7845
7907
|
let replayFn = fn;
|
|
7846
7908
|
if (wrappedKey === void 0) {
|
|
7847
|
-
|
|
7848
|
-
traceFunctionKey,
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7909
|
+
const replayRootOptions = {
|
|
7910
|
+
name: traceFunctionKey,
|
|
7911
|
+
type: "agent",
|
|
7912
|
+
surface: "neutral"
|
|
7913
|
+
};
|
|
7914
|
+
replayFn = this.withSpan(traceFunctionKey, replayRootOptions, fn);
|
|
7852
7915
|
} else if (wrappedKey !== traceFunctionKey) {
|
|
7853
7916
|
throw new BitfabError(
|
|
7854
7917
|
`Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
|
|
@@ -8165,6 +8228,7 @@ assertAsyncStorageRegistered();
|
|
|
8165
8228
|
DatasetsClient,
|
|
8166
8229
|
DbBranchReplayError,
|
|
8167
8230
|
HttpClient,
|
|
8231
|
+
MixedTracingError,
|
|
8168
8232
|
NO_MOCK_OVERRIDE,
|
|
8169
8233
|
ReplayError,
|
|
8170
8234
|
SUPPORTED_PROVIDERS,
|