@bitfab/sdk 0.58.3 → 0.58.5
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/autoTrace.cjs +50 -4
- package/dist/autoTrace.cjs.map +1 -1
- package/dist/autoTrace.d.cts +2 -1
- package/dist/autoTrace.d.ts +2 -1
- package/dist/autoTrace.js +4 -2
- package/dist/{chunk-VCRFFCLY.js → chunk-BAOIRE5T.js} +20 -2
- package/dist/chunk-BAOIRE5T.js.map +1 -0
- package/dist/{chunk-E4W3LSVL.js → chunk-E25HU4YZ.js} +2 -2
- package/dist/{chunk-E4W3LSVL.js.map → chunk-E25HU4YZ.js.map} +1 -1
- package/dist/{chunk-RCHSYWKI.js → chunk-ETZUSSF6.js} +38 -8
- package/dist/chunk-ETZUSSF6.js.map +1 -0
- package/dist/{chunk-WVFMRMV4.js → chunk-IP2AYKT7.js} +6 -21
- package/dist/chunk-IP2AYKT7.js.map +1 -0
- package/dist/{chunk-PHJMV6OL.js → chunk-NNSJVCR3.js} +3 -3
- package/dist/{chunk-XBZO7PFX.js → chunk-Y47DQCCK.js} +43 -18
- package/dist/chunk-Y47DQCCK.js.map +1 -0
- package/dist/{chunk-KOWM65AV.js → chunk-YGZA3H67.js} +6 -6
- package/dist/{http-ZI4BQTKT.js → http-6K4GQC4S.js} +2 -2
- package/dist/{http-ARGY6JF2.js → http-PVE62D6W.js} +3 -3
- package/dist/index.cjs +58 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -5
- package/dist/node.cjs +58 -12
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +5 -5
- package/dist/{replay-OOW54JKA.js → replay-6WA5GD4R.js} +4 -4
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-RCHSYWKI.js.map +0 -1
- package/dist/chunk-VCRFFCLY.js.map +0 -1
- package/dist/chunk-WVFMRMV4.js.map +0 -1
- package/dist/chunk-XBZO7PFX.js.map +0 -1
- /package/dist/{chunk-PHJMV6OL.js.map → chunk-NNSJVCR3.js.map} +0 -0
- /package/dist/{chunk-KOWM65AV.js.map → chunk-YGZA3H67.js.map} +0 -0
- /package/dist/{http-ARGY6JF2.js.map → http-6K4GQC4S.js.map} +0 -0
- /package/dist/{http-ZI4BQTKT.js.map → http-PVE62D6W.js.map} +0 -0
- /package/dist/{replay-OOW54JKA.js.map → replay-6WA5GD4R.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -3372,6 +3372,8 @@ declare class Bitfab {
|
|
|
3372
3372
|
* Queued on the client's span transport; delivery is the transport's job.
|
|
3373
3373
|
*/
|
|
3374
3374
|
private sendTraceCompletion;
|
|
3375
|
+
private sendsSpanOnCompletion;
|
|
3376
|
+
private nearestCapturedAncestorSpanIdOf;
|
|
3375
3377
|
private contentOffBySimulationPlan;
|
|
3376
3378
|
/**
|
|
3377
3379
|
* Send a wrapper span from function execution.
|
|
@@ -3657,7 +3659,7 @@ interface CommitRef {
|
|
|
3657
3659
|
/**
|
|
3658
3660
|
* SDK version from package.json (injected at build time)
|
|
3659
3661
|
*/
|
|
3660
|
-
declare const __version__ = "0.58.
|
|
3662
|
+
declare const __version__ = "0.58.5";
|
|
3661
3663
|
|
|
3662
3664
|
/**
|
|
3663
3665
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -3372,6 +3372,8 @@ declare class Bitfab {
|
|
|
3372
3372
|
* Queued on the client's span transport; delivery is the transport's job.
|
|
3373
3373
|
*/
|
|
3374
3374
|
private sendTraceCompletion;
|
|
3375
|
+
private sendsSpanOnCompletion;
|
|
3376
|
+
private nearestCapturedAncestorSpanIdOf;
|
|
3375
3377
|
private contentOffBySimulationPlan;
|
|
3376
3378
|
/**
|
|
3377
3379
|
* Send a wrapper span from function execution.
|
|
@@ -3657,7 +3659,7 @@ interface CommitRef {
|
|
|
3657
3659
|
/**
|
|
3658
3660
|
* SDK version from package.json (injected at build time)
|
|
3659
3661
|
*/
|
|
3660
|
-
declare const __version__ = "0.58.
|
|
3662
|
+
declare const __version__ = "0.58.5";
|
|
3661
3663
|
|
|
3662
3664
|
/**
|
|
3663
3665
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
getCurrentTrace,
|
|
23
23
|
reseedFromRegistry,
|
|
24
24
|
seedFromRegistry
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-Y47DQCCK.js";
|
|
26
|
+
import "./chunk-ETZUSSF6.js";
|
|
27
27
|
import {
|
|
28
28
|
BITFAB_PROGRESS_PREFIX,
|
|
29
29
|
DbBranchReplayError,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
ReplayError,
|
|
32
32
|
reportReplayProgress,
|
|
33
33
|
serializeReplayResult
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-YGZA3H67.js";
|
|
35
35
|
import {
|
|
36
36
|
BitfabError,
|
|
37
37
|
DEFAULT_SERVICE_URL,
|
|
@@ -39,8 +39,8 @@ import {
|
|
|
39
39
|
MixedTracingError,
|
|
40
40
|
__version__,
|
|
41
41
|
flushTraces
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-IP2AYKT7.js";
|
|
43
|
+
import "./chunk-BAOIRE5T.js";
|
|
44
44
|
export {
|
|
45
45
|
AssertionCategoriesClient,
|
|
46
46
|
BITFAB_PROGRESS_PREFIX,
|
package/dist/node.cjs
CHANGED
|
@@ -88,7 +88,7 @@ var __version__, __packageName__;
|
|
|
88
88
|
var init_version_generated = __esm({
|
|
89
89
|
"src/version.generated.ts"() {
|
|
90
90
|
"use strict";
|
|
91
|
-
__version__ = "0.58.
|
|
91
|
+
__version__ = "0.58.5";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -5111,6 +5111,7 @@ init_asyncStorage();
|
|
|
5111
5111
|
// src/autoTrace.ts
|
|
5112
5112
|
init_asyncStorage();
|
|
5113
5113
|
init_captureSuppression();
|
|
5114
|
+
init_warnOnce();
|
|
5114
5115
|
var autoTraceGlobal = globalThis;
|
|
5115
5116
|
var autoTraceState = autoTraceGlobal.__bitfabAutoTraceStateV4 ?? {
|
|
5116
5117
|
storage: null,
|
|
@@ -5178,6 +5179,26 @@ function runWithAutoTraceNodeConfiguration(nodeConfiguration, fn) {
|
|
|
5178
5179
|
}
|
|
5179
5180
|
return result;
|
|
5180
5181
|
}
|
|
5182
|
+
var SUBTREE_TRACING_DOCS_URL = "https://docs.bitfab.ai/typescript-sdk#experimental-subtree-tracing";
|
|
5183
|
+
function transformInstalled() {
|
|
5184
|
+
return autoTraceGlobal.__bitfab_auto_trace_transformed_v1__ === true;
|
|
5185
|
+
}
|
|
5186
|
+
function runsOnNode() {
|
|
5187
|
+
return typeof process !== "undefined" && Boolean(process.versions?.node);
|
|
5188
|
+
}
|
|
5189
|
+
function closeAutoTraceRoot() {
|
|
5190
|
+
autoTraceState.activeRoots -= 1;
|
|
5191
|
+
}
|
|
5192
|
+
function settleAutoTraceRoot(context) {
|
|
5193
|
+
closeAutoTraceRoot();
|
|
5194
|
+
if (transformInstalled() || !runsOnNode()) {
|
|
5195
|
+
return;
|
|
5196
|
+
}
|
|
5197
|
+
warnOnce(
|
|
5198
|
+
"auto-trace-transform-missing",
|
|
5199
|
+
`trace root "${context.traceFunctionKey}" recorded only its own span. No module in this build was compiled by @bitfab/transform, so calls beneath the root were not discovered. Install @bitfab/transform and add its adapter to the server build: ${SUBTREE_TRACING_DOCS_URL}`
|
|
5200
|
+
);
|
|
5201
|
+
}
|
|
5181
5202
|
function runWithAutoTraceRootContext(context, spanStack, fn) {
|
|
5182
5203
|
autoTraceState.activeRoots += 1;
|
|
5183
5204
|
const entries = [
|
|
@@ -5188,19 +5209,19 @@ function runWithAutoTraceRootContext(context, spanStack, fn) {
|
|
|
5188
5209
|
try {
|
|
5189
5210
|
result = runWithAutoTraceScope({ entries }, fn);
|
|
5190
5211
|
} catch (error) {
|
|
5191
|
-
|
|
5212
|
+
settleAutoTraceRoot(context);
|
|
5192
5213
|
throw error;
|
|
5193
5214
|
}
|
|
5194
5215
|
if (isAutoTraceAsyncGenerator(result)) {
|
|
5195
|
-
|
|
5216
|
+
closeAutoTraceRoot();
|
|
5196
5217
|
return wrapAutoTraceAsyncGenerator(context, spanStack, result);
|
|
5197
5218
|
}
|
|
5198
5219
|
if (result instanceof Promise) {
|
|
5199
5220
|
return result.finally(() => {
|
|
5200
|
-
|
|
5221
|
+
settleAutoTraceRoot(context);
|
|
5201
5222
|
});
|
|
5202
5223
|
}
|
|
5203
|
-
|
|
5224
|
+
settleAutoTraceRoot(context);
|
|
5204
5225
|
return result;
|
|
5205
5226
|
}
|
|
5206
5227
|
function invokeThroughAutoTraceEntries(entries, step, fn) {
|
|
@@ -9823,13 +9844,23 @@ var Bitfab = class {
|
|
|
9823
9844
|
traceFunctionKey
|
|
9824
9845
|
);
|
|
9825
9846
|
const openAiAgentsSpanIds = openAiAgentsSpanChain();
|
|
9847
|
+
const functionNameAtOpen = fn.name !== "" ? fn.name : void 0;
|
|
9826
9848
|
const newContext = {
|
|
9827
9849
|
traceId,
|
|
9828
9850
|
spanId,
|
|
9829
9851
|
contexts: [],
|
|
9852
|
+
spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
|
|
9853
|
+
rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(
|
|
9854
|
+
traceId,
|
|
9855
|
+
traceFunctionKey
|
|
9856
|
+
),
|
|
9857
|
+
instrumentation: options.instrumentation ?? "span",
|
|
9858
|
+
declaredNode: options.declaredNode === true,
|
|
9859
|
+
isRoot: isRootSpan,
|
|
9830
9860
|
...surface !== void 0 && { surface },
|
|
9831
9861
|
...openAiAgentsSpanIds.length > 0 && { openAiAgentsSpanIds }
|
|
9832
9862
|
};
|
|
9863
|
+
const nearestCapturedAncestorSpanId = self.nearestCapturedAncestorSpanIdOf(currentStack);
|
|
9833
9864
|
newStack = [...currentStack, newContext];
|
|
9834
9865
|
const inputs = args;
|
|
9835
9866
|
const startedAt = nowIsoTimestamp();
|
|
@@ -9856,19 +9887,16 @@ var Bitfab = class {
|
|
|
9856
9887
|
}
|
|
9857
9888
|
self.httpClient.traceCompletion.start(traceId, spanId);
|
|
9858
9889
|
startedSpan = { traceId, spanId };
|
|
9859
|
-
const functionName =
|
|
9860
|
-
const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
|
|
9861
|
-
traceId,
|
|
9862
|
-
traceFunctionKey
|
|
9863
|
-
);
|
|
9890
|
+
const functionName = functionNameAtOpen;
|
|
9864
9891
|
const baseSpanParams = {
|
|
9865
9892
|
traceFunctionKey,
|
|
9866
|
-
rootTraceFunctionKey,
|
|
9893
|
+
rootTraceFunctionKey: newContext.rootTraceFunctionKey,
|
|
9867
9894
|
functionName,
|
|
9868
|
-
spanName:
|
|
9895
|
+
spanName: newContext.spanName,
|
|
9869
9896
|
traceId,
|
|
9870
9897
|
spanId,
|
|
9871
9898
|
parentSpanId,
|
|
9899
|
+
nearestCapturedAncestorSpanId,
|
|
9872
9900
|
inputs,
|
|
9873
9901
|
startedAt,
|
|
9874
9902
|
spanType: options.type ?? "custom",
|
|
@@ -10387,6 +10415,21 @@ var Bitfab = class {
|
|
|
10387
10415
|
...params.testRunId && { testRunId: params.testRunId }
|
|
10388
10416
|
});
|
|
10389
10417
|
}
|
|
10418
|
+
sendsSpanOnCompletion(context) {
|
|
10419
|
+
return context.isRoot || context.declaredNode || isFrameworkInstrumentation(context.instrumentation) || !this.simulationPlan.contentOffNow(
|
|
10420
|
+
context.rootTraceFunctionKey,
|
|
10421
|
+
context.spanName
|
|
10422
|
+
);
|
|
10423
|
+
}
|
|
10424
|
+
nearestCapturedAncestorSpanIdOf(stack) {
|
|
10425
|
+
for (let index = stack.length - 1; index >= 0; index -= 1) {
|
|
10426
|
+
const candidate = stack[index];
|
|
10427
|
+
if (candidate !== void 0 && this.sendsSpanOnCompletion(candidate)) {
|
|
10428
|
+
return candidate.spanId;
|
|
10429
|
+
}
|
|
10430
|
+
}
|
|
10431
|
+
return null;
|
|
10432
|
+
}
|
|
10390
10433
|
contentOffBySimulationPlan(params) {
|
|
10391
10434
|
if (params.rootTraceFunctionKey === void 0 || isFrameworkInstrumentation(params.instrumentation)) {
|
|
10392
10435
|
return false;
|
|
@@ -10463,6 +10506,9 @@ var Bitfab = class {
|
|
|
10463
10506
|
if (params.parentSpanId) {
|
|
10464
10507
|
externalSpan.parent_id = params.parentSpanId;
|
|
10465
10508
|
}
|
|
10509
|
+
if (params.nearestCapturedAncestorSpanId !== void 0 && params.nearestCapturedAncestorSpanId !== null && params.nearestCapturedAncestorSpanId !== params.parentSpanId) {
|
|
10510
|
+
externalSpan.nearest_captured_ancestor_id = params.nearestCapturedAncestorSpanId;
|
|
10511
|
+
}
|
|
10466
10512
|
if (params.inputSourceSpanId) {
|
|
10467
10513
|
externalSpan.input_source_span_id = params.inputSourceSpanId;
|
|
10468
10514
|
}
|