@bitfab/sdk 0.43.1 → 0.44.0
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-TNGKCPBP.js → chunk-3WIN3VU3.js} +2 -2
- package/dist/{chunk-5LY4XOUY.js → chunk-6JTVCM2L.js} +9 -2
- package/dist/chunk-6JTVCM2L.js.map +1 -0
- package/dist/{chunk-RBKGO5ZC.js → chunk-AX6EZPGH.js} +2 -2
- package/dist/chunk-AX6EZPGH.js.map +1 -0
- package/dist/{chunk-V4MRFSWK.js → chunk-XYMG2FH7.js} +81 -34
- package/dist/chunk-XYMG2FH7.js.map +1 -0
- package/dist/{http-FKD4GT55.js → http-Q4TSO32V.js} +2 -2
- package/dist/{http-TPVUGXYJ.js → http-QWUWDTFN.js} +2 -2
- package/dist/index.cjs +86 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -3
- package/dist/node.cjs +86 -30
- 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-RPB6CT6M.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-5LY4XOUY.js.map +0 -1
- package/dist/chunk-RBKGO5ZC.js.map +0 -1
- package/dist/chunk-V4MRFSWK.js.map +0 -1
- /package/dist/{chunk-TNGKCPBP.js.map → chunk-3WIN3VU3.js.map} +0 -0
- /package/dist/{http-FKD4GT55.js.map → http-Q4TSO32V.js.map} +0 -0
- /package/dist/{http-TPVUGXYJ.js.map → http-QWUWDTFN.js.map} +0 -0
- /package/dist/{replay-PICGOZVG.js.map → replay-RPB6CT6M.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.
|
|
@@ -2096,6 +2099,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2096
2099
|
}
|
|
2097
2100
|
|
|
2098
2101
|
type CaptureSurface = "opt-in" | "opt-out";
|
|
2102
|
+
|
|
2099
2103
|
/**
|
|
2100
2104
|
* Options for wrapBAML.
|
|
2101
2105
|
*/
|
|
@@ -3078,7 +3082,7 @@ declare class BitfabFunction {
|
|
|
3078
3082
|
/**
|
|
3079
3083
|
* SDK version from package.json (injected at build time)
|
|
3080
3084
|
*/
|
|
3081
|
-
declare const __version__ = "0.
|
|
3085
|
+
declare const __version__ = "0.44.0";
|
|
3082
3086
|
|
|
3083
3087
|
/**
|
|
3084
3088
|
* Constants for the Bitfab SDK.
|
|
@@ -3208,4 +3212,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3208
3212
|
run?: boolean;
|
|
3209
3213
|
}): Promise<SeedResult>;
|
|
3210
3214
|
|
|
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 };
|
|
3215
|
+
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 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.
|
|
@@ -2096,6 +2099,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2096
2099
|
}
|
|
2097
2100
|
|
|
2098
2101
|
type CaptureSurface = "opt-in" | "opt-out";
|
|
2102
|
+
|
|
2099
2103
|
/**
|
|
2100
2104
|
* Options for wrapBAML.
|
|
2101
2105
|
*/
|
|
@@ -3078,7 +3082,7 @@ declare class BitfabFunction {
|
|
|
3078
3082
|
/**
|
|
3079
3083
|
* SDK version from package.json (injected at build time)
|
|
3080
3084
|
*/
|
|
3081
|
-
declare const __version__ = "0.
|
|
3085
|
+
declare const __version__ = "0.44.0";
|
|
3082
3086
|
|
|
3083
3087
|
/**
|
|
3084
3088
|
* Constants for the Bitfab SDK.
|
|
@@ -3208,4 +3212,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3208
3212
|
run?: boolean;
|
|
3209
3213
|
}): Promise<SeedResult>;
|
|
3210
3214
|
|
|
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 };
|
|
3215
|
+
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 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-XYMG2FH7.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-3WIN3VU3.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-6JTVCM2L.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.0";
|
|
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
|
|
|
@@ -3262,6 +3268,7 @@ __export(node_exports, {
|
|
|
3262
3268
|
DatasetsClient: () => DatasetsClient,
|
|
3263
3269
|
DbBranchReplayError: () => DbBranchReplayError,
|
|
3264
3270
|
HttpClient: () => HttpClient,
|
|
3271
|
+
MixedTracingError: () => MixedTracingError,
|
|
3265
3272
|
NO_MOCK_OVERRIDE: () => NO_MOCK_OVERRIDE,
|
|
3266
3273
|
ReplayError: () => ReplayError,
|
|
3267
3274
|
SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
|
|
@@ -4342,6 +4349,50 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
|
|
|
4342
4349
|
};
|
|
4343
4350
|
}
|
|
4344
4351
|
|
|
4352
|
+
// src/captureSurface.ts
|
|
4353
|
+
init_errors();
|
|
4354
|
+
var DEFAULT_SURFACE = "opt-in";
|
|
4355
|
+
var SURFACE_API = {
|
|
4356
|
+
"opt-in": "withSpan()",
|
|
4357
|
+
"opt-out": "withTrace()"
|
|
4358
|
+
};
|
|
4359
|
+
var MIXED_SURFACE_REMEDY = {
|
|
4360
|
+
"opt-in": "Inside a withTrace/trace subtree, configure a discovered call with node()/withNode() instead, or trace this workflow with withSpan() only.",
|
|
4361
|
+
"opt-out": "Wrap the caller with withTrace()/trace() as well, or wrap this function with withSpan()."
|
|
4362
|
+
};
|
|
4363
|
+
function resolveSurface(requested, parentSurface) {
|
|
4364
|
+
if (requested === "neutral") {
|
|
4365
|
+
return void 0;
|
|
4366
|
+
}
|
|
4367
|
+
if (requested === "inherit") {
|
|
4368
|
+
return parentSurface ?? DEFAULT_SURFACE;
|
|
4369
|
+
}
|
|
4370
|
+
return requested;
|
|
4371
|
+
}
|
|
4372
|
+
function mixedTracingError(enteredApi, entered, enclosing, traceFunctionKey) {
|
|
4373
|
+
const subject = traceFunctionKey === void 0 ? "" : ` for "${traceFunctionKey}"`;
|
|
4374
|
+
return new MixedTracingError(
|
|
4375
|
+
`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]}`
|
|
4376
|
+
);
|
|
4377
|
+
}
|
|
4378
|
+
function assertSurfacesCompatible(requested, resolved, parentSurface, traceFunctionKey) {
|
|
4379
|
+
if (requested === "inherit" || requested === "neutral") {
|
|
4380
|
+
return;
|
|
4381
|
+
}
|
|
4382
|
+
if (resolved === void 0 || parentSurface === void 0) {
|
|
4383
|
+
return;
|
|
4384
|
+
}
|
|
4385
|
+
if (parentSurface === resolved) {
|
|
4386
|
+
return;
|
|
4387
|
+
}
|
|
4388
|
+
throw mixedTracingError(
|
|
4389
|
+
SURFACE_API[resolved],
|
|
4390
|
+
resolved,
|
|
4391
|
+
parentSurface,
|
|
4392
|
+
traceFunctionKey
|
|
4393
|
+
);
|
|
4394
|
+
}
|
|
4395
|
+
|
|
4345
4396
|
// src/client.ts
|
|
4346
4397
|
init_constants();
|
|
4347
4398
|
|
|
@@ -4488,6 +4539,7 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
|
|
|
4488
4539
|
}
|
|
4489
4540
|
|
|
4490
4541
|
// src/client.ts
|
|
4542
|
+
init_errors();
|
|
4491
4543
|
init_http();
|
|
4492
4544
|
|
|
4493
4545
|
// src/langgraph.ts
|
|
@@ -5877,18 +5929,6 @@ var BitfabVercelAiHandler = class {
|
|
|
5877
5929
|
|
|
5878
5930
|
// src/client.ts
|
|
5879
5931
|
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
5932
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
5893
5933
|
var asyncLocalStorage = null;
|
|
5894
5934
|
var SPAN_CONTEXT_STORAGE_SYMBOL = /* @__PURE__ */ Symbol.for("bitfab.spanContextStorage");
|
|
@@ -5918,6 +5958,10 @@ function getSpanStack() {
|
|
|
5918
5958
|
}
|
|
5919
5959
|
return browserSpanStack;
|
|
5920
5960
|
}
|
|
5961
|
+
function enclosingSurface() {
|
|
5962
|
+
const stack = getSpanStack();
|
|
5963
|
+
return stack[stack.length - 1]?.surface;
|
|
5964
|
+
}
|
|
5921
5965
|
function runWithSpanStack(stack, fn) {
|
|
5922
5966
|
if (asyncLocalStorage) {
|
|
5923
5967
|
return asyncLocalStorage.run(stack, fn);
|
|
@@ -6404,6 +6448,9 @@ var Bitfab = class {
|
|
|
6404
6448
|
const nodeConfiguration = { ...configuration, functionName };
|
|
6405
6449
|
return function(...args) {
|
|
6406
6450
|
if (!__bitfabAutoTraceActive()) {
|
|
6451
|
+
if (enclosingSurface() === "opt-in") {
|
|
6452
|
+
throw mixedTracingError("node()", "opt-out", "opt-in");
|
|
6453
|
+
}
|
|
6407
6454
|
return fn.apply(this, args);
|
|
6408
6455
|
}
|
|
6409
6456
|
return runWithAutoTraceNodeConfiguration(
|
|
@@ -7105,20 +7152,19 @@ var Bitfab = class {
|
|
|
7105
7152
|
const spanId = randomUuid();
|
|
7106
7153
|
const parentSpanId = parentContext?.spanId ?? null;
|
|
7107
7154
|
const isRootSpan = parentSpanId === null;
|
|
7108
|
-
const requestedSurface = options.surface ??
|
|
7109
|
-
const surface = requestedSurface
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
}
|
|
7155
|
+
const requestedSurface = options.surface ?? DEFAULT_SURFACE;
|
|
7156
|
+
const surface = resolveSurface(requestedSurface, parentContext?.surface);
|
|
7157
|
+
assertSurfacesCompatible(
|
|
7158
|
+
requestedSurface,
|
|
7159
|
+
surface,
|
|
7160
|
+
parentContext?.surface,
|
|
7161
|
+
traceFunctionKey
|
|
7162
|
+
);
|
|
7117
7163
|
const newContext = {
|
|
7118
7164
|
traceId,
|
|
7119
7165
|
spanId,
|
|
7120
7166
|
contexts: [],
|
|
7121
|
-
surface
|
|
7167
|
+
...surface !== void 0 && { surface }
|
|
7122
7168
|
};
|
|
7123
7169
|
newStack = [...currentStack, newContext];
|
|
7124
7170
|
const inputs = args;
|
|
@@ -7401,6 +7447,9 @@ var Bitfab = class {
|
|
|
7401
7447
|
if (registeredTraceId) {
|
|
7402
7448
|
activeTraceStates.delete(registeredTraceId);
|
|
7403
7449
|
}
|
|
7450
|
+
if (setupError instanceof MixedTracingError) {
|
|
7451
|
+
throw setupError;
|
|
7452
|
+
}
|
|
7404
7453
|
if (getReplayContext() || inSeedScope()) {
|
|
7405
7454
|
throw setupError;
|
|
7406
7455
|
}
|
|
@@ -7800,9 +7849,14 @@ var Bitfab = class {
|
|
|
7800
7849
|
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
7801
7850
|
let target = fn;
|
|
7802
7851
|
if (wrappedKey === void 0) {
|
|
7852
|
+
const seedRootOptions = {
|
|
7853
|
+
name: traceFunctionKey,
|
|
7854
|
+
type: "agent",
|
|
7855
|
+
surface: "neutral"
|
|
7856
|
+
};
|
|
7803
7857
|
target = this.withSpan(
|
|
7804
7858
|
traceFunctionKey,
|
|
7805
|
-
|
|
7859
|
+
seedRootOptions,
|
|
7806
7860
|
fn
|
|
7807
7861
|
);
|
|
7808
7862
|
} else if (wrappedKey !== traceFunctionKey) {
|
|
@@ -7844,11 +7898,12 @@ var Bitfab = class {
|
|
|
7844
7898
|
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
7845
7899
|
let replayFn = fn;
|
|
7846
7900
|
if (wrappedKey === void 0) {
|
|
7847
|
-
|
|
7848
|
-
traceFunctionKey,
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7901
|
+
const replayRootOptions = {
|
|
7902
|
+
name: traceFunctionKey,
|
|
7903
|
+
type: "agent",
|
|
7904
|
+
surface: "neutral"
|
|
7905
|
+
};
|
|
7906
|
+
replayFn = this.withSpan(traceFunctionKey, replayRootOptions, fn);
|
|
7852
7907
|
} else if (wrappedKey !== traceFunctionKey) {
|
|
7853
7908
|
throw new BitfabError(
|
|
7854
7909
|
`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 +8220,7 @@ assertAsyncStorageRegistered();
|
|
|
8165
8220
|
DatasetsClient,
|
|
8166
8221
|
DbBranchReplayError,
|
|
8167
8222
|
HttpClient,
|
|
8223
|
+
MixedTracingError,
|
|
8168
8224
|
NO_MOCK_OVERRIDE,
|
|
8169
8225
|
ReplayError,
|
|
8170
8226
|
SUPPORTED_PROVIDERS,
|