@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
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
flushTraces,
|
|
5
5
|
gitRunner,
|
|
6
6
|
replayContextReady,
|
|
7
|
-
runWithReplayContext
|
|
8
|
-
|
|
9
|
-
} from "./chunk-WVFMRMV4.js";
|
|
7
|
+
runWithReplayContext
|
|
8
|
+
} from "./chunk-IP2AYKT7.js";
|
|
10
9
|
import {
|
|
11
|
-
runWithCaptureSuppressed
|
|
12
|
-
|
|
10
|
+
runWithCaptureSuppressed,
|
|
11
|
+
warnOnce
|
|
12
|
+
} from "./chunk-BAOIRE5T.js";
|
|
13
13
|
|
|
14
14
|
// src/codeChange.ts
|
|
15
15
|
var MAX_FILES = 60;
|
|
@@ -1264,4 +1264,4 @@ export {
|
|
|
1264
1264
|
sleepForReplayPersistence,
|
|
1265
1265
|
replay
|
|
1266
1266
|
};
|
|
1267
|
-
//# sourceMappingURL=chunk-
|
|
1267
|
+
//# sourceMappingURL=chunk-YGZA3H67.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-E25HU4YZ.js";
|
|
10
10
|
export {
|
|
11
11
|
BitfabError,
|
|
12
12
|
HttpClient,
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
parseRetryAfterMs,
|
|
17
17
|
serializePayloadBody
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=http-
|
|
19
|
+
//# sourceMappingURL=http-6K4GQC4S.js.map
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-IP2AYKT7.js";
|
|
10
|
+
import "./chunk-BAOIRE5T.js";
|
|
11
11
|
export {
|
|
12
12
|
BitfabError,
|
|
13
13
|
HttpClient,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
parseRetryAfterMs,
|
|
18
18
|
serializePayloadBody
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=http-
|
|
20
|
+
//# sourceMappingURL=http-PVE62D6W.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var __version__, __packageName__;
|
|
|
42
42
|
var init_version_generated = __esm({
|
|
43
43
|
"src/version.generated.ts"() {
|
|
44
44
|
"use strict";
|
|
45
|
-
__version__ = "0.58.
|
|
45
|
+
__version__ = "0.58.5";
|
|
46
46
|
__packageName__ = "@bitfab/sdk";
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -5097,6 +5097,7 @@ init_asyncStorage();
|
|
|
5097
5097
|
// src/autoTrace.ts
|
|
5098
5098
|
init_asyncStorage();
|
|
5099
5099
|
init_captureSuppression();
|
|
5100
|
+
init_warnOnce();
|
|
5100
5101
|
var autoTraceGlobal = globalThis;
|
|
5101
5102
|
var autoTraceState = autoTraceGlobal.__bitfabAutoTraceStateV4 ?? {
|
|
5102
5103
|
storage: null,
|
|
@@ -5164,6 +5165,26 @@ function runWithAutoTraceNodeConfiguration(nodeConfiguration, fn) {
|
|
|
5164
5165
|
}
|
|
5165
5166
|
return result;
|
|
5166
5167
|
}
|
|
5168
|
+
var SUBTREE_TRACING_DOCS_URL = "https://docs.bitfab.ai/typescript-sdk#experimental-subtree-tracing";
|
|
5169
|
+
function transformInstalled() {
|
|
5170
|
+
return autoTraceGlobal.__bitfab_auto_trace_transformed_v1__ === true;
|
|
5171
|
+
}
|
|
5172
|
+
function runsOnNode() {
|
|
5173
|
+
return typeof process !== "undefined" && Boolean(process.versions?.node);
|
|
5174
|
+
}
|
|
5175
|
+
function closeAutoTraceRoot() {
|
|
5176
|
+
autoTraceState.activeRoots -= 1;
|
|
5177
|
+
}
|
|
5178
|
+
function settleAutoTraceRoot(context) {
|
|
5179
|
+
closeAutoTraceRoot();
|
|
5180
|
+
if (transformInstalled() || !runsOnNode()) {
|
|
5181
|
+
return;
|
|
5182
|
+
}
|
|
5183
|
+
warnOnce(
|
|
5184
|
+
"auto-trace-transform-missing",
|
|
5185
|
+
`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}`
|
|
5186
|
+
);
|
|
5187
|
+
}
|
|
5167
5188
|
function runWithAutoTraceRootContext(context, spanStack, fn) {
|
|
5168
5189
|
autoTraceState.activeRoots += 1;
|
|
5169
5190
|
const entries = [
|
|
@@ -5174,19 +5195,19 @@ function runWithAutoTraceRootContext(context, spanStack, fn) {
|
|
|
5174
5195
|
try {
|
|
5175
5196
|
result = runWithAutoTraceScope({ entries }, fn);
|
|
5176
5197
|
} catch (error) {
|
|
5177
|
-
|
|
5198
|
+
settleAutoTraceRoot(context);
|
|
5178
5199
|
throw error;
|
|
5179
5200
|
}
|
|
5180
5201
|
if (isAutoTraceAsyncGenerator(result)) {
|
|
5181
|
-
|
|
5202
|
+
closeAutoTraceRoot();
|
|
5182
5203
|
return wrapAutoTraceAsyncGenerator(context, spanStack, result);
|
|
5183
5204
|
}
|
|
5184
5205
|
if (result instanceof Promise) {
|
|
5185
5206
|
return result.finally(() => {
|
|
5186
|
-
|
|
5207
|
+
settleAutoTraceRoot(context);
|
|
5187
5208
|
});
|
|
5188
5209
|
}
|
|
5189
|
-
|
|
5210
|
+
settleAutoTraceRoot(context);
|
|
5190
5211
|
return result;
|
|
5191
5212
|
}
|
|
5192
5213
|
function invokeThroughAutoTraceEntries(entries, step, fn) {
|
|
@@ -9809,13 +9830,23 @@ var Bitfab = class {
|
|
|
9809
9830
|
traceFunctionKey
|
|
9810
9831
|
);
|
|
9811
9832
|
const openAiAgentsSpanIds = openAiAgentsSpanChain();
|
|
9833
|
+
const functionNameAtOpen = fn.name !== "" ? fn.name : void 0;
|
|
9812
9834
|
const newContext = {
|
|
9813
9835
|
traceId,
|
|
9814
9836
|
spanId,
|
|
9815
9837
|
contexts: [],
|
|
9838
|
+
spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
|
|
9839
|
+
rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(
|
|
9840
|
+
traceId,
|
|
9841
|
+
traceFunctionKey
|
|
9842
|
+
),
|
|
9843
|
+
instrumentation: options.instrumentation ?? "span",
|
|
9844
|
+
declaredNode: options.declaredNode === true,
|
|
9845
|
+
isRoot: isRootSpan,
|
|
9816
9846
|
...surface !== void 0 && { surface },
|
|
9817
9847
|
...openAiAgentsSpanIds.length > 0 && { openAiAgentsSpanIds }
|
|
9818
9848
|
};
|
|
9849
|
+
const nearestCapturedAncestorSpanId = self.nearestCapturedAncestorSpanIdOf(currentStack);
|
|
9819
9850
|
newStack = [...currentStack, newContext];
|
|
9820
9851
|
const inputs = args;
|
|
9821
9852
|
const startedAt = nowIsoTimestamp();
|
|
@@ -9842,19 +9873,16 @@ var Bitfab = class {
|
|
|
9842
9873
|
}
|
|
9843
9874
|
self.httpClient.traceCompletion.start(traceId, spanId);
|
|
9844
9875
|
startedSpan = { traceId, spanId };
|
|
9845
|
-
const functionName =
|
|
9846
|
-
const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
|
|
9847
|
-
traceId,
|
|
9848
|
-
traceFunctionKey
|
|
9849
|
-
);
|
|
9876
|
+
const functionName = functionNameAtOpen;
|
|
9850
9877
|
const baseSpanParams = {
|
|
9851
9878
|
traceFunctionKey,
|
|
9852
|
-
rootTraceFunctionKey,
|
|
9879
|
+
rootTraceFunctionKey: newContext.rootTraceFunctionKey,
|
|
9853
9880
|
functionName,
|
|
9854
|
-
spanName:
|
|
9881
|
+
spanName: newContext.spanName,
|
|
9855
9882
|
traceId,
|
|
9856
9883
|
spanId,
|
|
9857
9884
|
parentSpanId,
|
|
9885
|
+
nearestCapturedAncestorSpanId,
|
|
9858
9886
|
inputs,
|
|
9859
9887
|
startedAt,
|
|
9860
9888
|
spanType: options.type ?? "custom",
|
|
@@ -10373,6 +10401,21 @@ var Bitfab = class {
|
|
|
10373
10401
|
...params.testRunId && { testRunId: params.testRunId }
|
|
10374
10402
|
});
|
|
10375
10403
|
}
|
|
10404
|
+
sendsSpanOnCompletion(context) {
|
|
10405
|
+
return context.isRoot || context.declaredNode || isFrameworkInstrumentation(context.instrumentation) || !this.simulationPlan.contentOffNow(
|
|
10406
|
+
context.rootTraceFunctionKey,
|
|
10407
|
+
context.spanName
|
|
10408
|
+
);
|
|
10409
|
+
}
|
|
10410
|
+
nearestCapturedAncestorSpanIdOf(stack) {
|
|
10411
|
+
for (let index = stack.length - 1; index >= 0; index -= 1) {
|
|
10412
|
+
const candidate = stack[index];
|
|
10413
|
+
if (candidate !== void 0 && this.sendsSpanOnCompletion(candidate)) {
|
|
10414
|
+
return candidate.spanId;
|
|
10415
|
+
}
|
|
10416
|
+
}
|
|
10417
|
+
return null;
|
|
10418
|
+
}
|
|
10376
10419
|
contentOffBySimulationPlan(params) {
|
|
10377
10420
|
if (params.rootTraceFunctionKey === void 0 || isFrameworkInstrumentation(params.instrumentation)) {
|
|
10378
10421
|
return false;
|
|
@@ -10449,6 +10492,9 @@ var Bitfab = class {
|
|
|
10449
10492
|
if (params.parentSpanId) {
|
|
10450
10493
|
externalSpan.parent_id = params.parentSpanId;
|
|
10451
10494
|
}
|
|
10495
|
+
if (params.nearestCapturedAncestorSpanId !== void 0 && params.nearestCapturedAncestorSpanId !== null && params.nearestCapturedAncestorSpanId !== params.parentSpanId) {
|
|
10496
|
+
externalSpan.nearest_captured_ancestor_id = params.nearestCapturedAncestorSpanId;
|
|
10497
|
+
}
|
|
10452
10498
|
if (params.inputSourceSpanId) {
|
|
10453
10499
|
externalSpan.input_source_span_id = params.inputSourceSpanId;
|
|
10454
10500
|
}
|