@bitfab/sdk 0.65.4 → 0.65.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.
Files changed (170) hide show
  1. package/dist/autoTrace-CZu0BXhG.js +270 -0
  2. package/dist/autoTrace-CZu0BXhG.js.map +1 -0
  3. package/dist/autoTrace-KM9pYqk9.cjs +395 -0
  4. package/dist/autoTrace-KM9pYqk9.cjs.map +1 -0
  5. package/dist/autoTrace.cjs +15 -353
  6. package/dist/autoTrace.d.cts +44 -44
  7. package/dist/autoTrace.d.ts +44 -44
  8. package/dist/autoTrace.js +1 -28
  9. package/dist/babelPlugin-C70OxrqA.js +209 -0
  10. package/dist/babelPlugin-C70OxrqA.js.map +1 -0
  11. package/dist/babelPlugin-Nta4-VcL.cjs +232 -0
  12. package/dist/babelPlugin-Nta4-VcL.cjs.map +1 -0
  13. package/dist/http-CG1Irqxx.js +2154 -0
  14. package/dist/http-CG1Irqxx.js.map +1 -0
  15. package/dist/index-BFkAwvuc.d.cts +4410 -0
  16. package/dist/index-BFkAwvuc.d.ts +4410 -0
  17. package/dist/index.cjs +48 -12504
  18. package/dist/index.d.cts +2 -4443
  19. package/dist/index.d.ts +2 -4443
  20. package/dist/index.js +3 -96
  21. package/dist/loaderRuntime-0huddOOP.d.ts +12 -0
  22. package/dist/loaderRuntime-CslfDFO7.d.cts +12 -0
  23. package/dist/node.cjs +56 -12520
  24. package/dist/node.cjs.map +1 -1
  25. package/dist/node.d.cts +2 -1
  26. package/dist/node.d.ts +2 -1
  27. package/dist/node.js +10 -105
  28. package/dist/node.js.map +1 -1
  29. package/dist/registryCommand-Di8x0YoJ.js +1111 -0
  30. package/dist/registryCommand-Di8x0YoJ.js.map +1 -0
  31. package/dist/replayCli.js +49 -87
  32. package/dist/replayCli.js.map +1 -1
  33. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  34. package/dist/seedCli.js +10 -24
  35. package/dist/seedCli.js.map +1 -1
  36. package/dist/src-BRKm0P_S.cjs +8434 -0
  37. package/dist/src-BRKm0P_S.cjs.map +1 -0
  38. package/dist/src-CfFkki5l.js +6011 -0
  39. package/dist/src-CfFkki5l.js.map +1 -0
  40. package/dist/transform/babel.cjs +5 -422
  41. package/dist/transform/babel.d.cts +16 -16
  42. package/dist/transform/babel.d.ts +16 -16
  43. package/dist/transform/babel.js +1 -7
  44. package/dist/transform/bun.cjs +9 -478
  45. package/dist/transform/bun.cjs.map +1 -1
  46. package/dist/transform/bun.d.cts +5 -7
  47. package/dist/transform/bun.d.ts +5 -7
  48. package/dist/transform/bun.js +6 -11
  49. package/dist/transform/bun.js.map +1 -1
  50. package/dist/transform/esbuild.cjs +9 -478
  51. package/dist/transform/esbuild.cjs.map +1 -1
  52. package/dist/transform/esbuild.d.cts +5 -7
  53. package/dist/transform/esbuild.d.ts +5 -7
  54. package/dist/transform/esbuild.js +6 -11
  55. package/dist/transform/esbuild.js.map +1 -1
  56. package/dist/transform/loaderRuntime.cjs +85 -532
  57. package/dist/transform/loaderRuntime.cjs.map +1 -1
  58. package/dist/transform/loaderRuntime.d.cts +2 -12
  59. package/dist/transform/loaderRuntime.d.ts +2 -12
  60. package/dist/transform/loaderRuntime.js +56 -98
  61. package/dist/transform/loaderRuntime.js.map +1 -1
  62. package/dist/transform/nest.cjs +12 -481
  63. package/dist/transform/nest.cjs.map +1 -1
  64. package/dist/transform/nest.d.cts +8 -9
  65. package/dist/transform/nest.d.ts +8 -9
  66. package/dist/transform/nest.js +9 -14
  67. package/dist/transform/nest.js.map +1 -1
  68. package/dist/transform/next.cjs +56 -528
  69. package/dist/transform/next.cjs.map +1 -1
  70. package/dist/transform/next.d.cts +25 -25
  71. package/dist/transform/next.d.ts +24 -24
  72. package/dist/transform/next.js +52 -60
  73. package/dist/transform/next.js.map +1 -1
  74. package/dist/transform/nodeLoader.js +260 -506
  75. package/dist/transform/nodeLoader.js.map +1 -1
  76. package/dist/transform/register.js +4 -1
  77. package/dist/transform/register.js.map +1 -1
  78. package/dist/transform/rolldown.cjs +9 -478
  79. package/dist/transform/rolldown.cjs.map +1 -1
  80. package/dist/transform/rolldown.d.cts +5 -7
  81. package/dist/transform/rolldown.d.ts +5 -7
  82. package/dist/transform/rolldown.js +6 -11
  83. package/dist/transform/rolldown.js.map +1 -1
  84. package/dist/transform/rollup.cjs +9 -478
  85. package/dist/transform/rollup.cjs.map +1 -1
  86. package/dist/transform/rollup.d.cts +5 -7
  87. package/dist/transform/rollup.d.ts +5 -7
  88. package/dist/transform/rollup.js +6 -11
  89. package/dist/transform/rollup.js.map +1 -1
  90. package/dist/transform/rsbuild.cjs +9 -478
  91. package/dist/transform/rsbuild.cjs.map +1 -1
  92. package/dist/transform/rsbuild.d.cts +5 -7
  93. package/dist/transform/rsbuild.d.ts +5 -7
  94. package/dist/transform/rsbuild.js +6 -11
  95. package/dist/transform/rsbuild.js.map +1 -1
  96. package/dist/transform/rspack.cjs +9 -478
  97. package/dist/transform/rspack.cjs.map +1 -1
  98. package/dist/transform/rspack.d.cts +5 -7
  99. package/dist/transform/rspack.d.ts +5 -7
  100. package/dist/transform/rspack.js +6 -11
  101. package/dist/transform/rspack.js.map +1 -1
  102. package/dist/transform/swc.cjs +18 -486
  103. package/dist/transform/swc.cjs.map +1 -1
  104. package/dist/transform/swc.d.cts +15 -14
  105. package/dist/transform/swc.d.ts +15 -14
  106. package/dist/transform/swc.js +14 -32
  107. package/dist/transform/swc.js.map +1 -1
  108. package/dist/transform/unplugin.cjs +20 -476
  109. package/dist/transform/unplugin.cjs.map +1 -1
  110. package/dist/transform/unplugin.d.cts +4 -6
  111. package/dist/transform/unplugin.d.ts +4 -6
  112. package/dist/transform/unplugin.js +19 -8
  113. package/dist/transform/unplugin.js.map +1 -1
  114. package/dist/transform/vite.cjs +9 -478
  115. package/dist/transform/vite.cjs.map +1 -1
  116. package/dist/transform/vite.d.cts +5 -7
  117. package/dist/transform/vite.d.ts +5 -7
  118. package/dist/transform/vite.js +6 -11
  119. package/dist/transform/vite.js.map +1 -1
  120. package/dist/transform/webpack.cjs +9 -478
  121. package/dist/transform/webpack.cjs.map +1 -1
  122. package/dist/transform/webpack.d.cts +5 -7
  123. package/dist/transform/webpack.d.ts +5 -7
  124. package/dist/transform/webpack.js +6 -11
  125. package/dist/transform/webpack.js.map +1 -1
  126. package/dist/transform-BcyUocwm.js +36 -0
  127. package/dist/transform-BcyUocwm.js.map +1 -0
  128. package/dist/transform-BjxHGGKc.cjs +47 -0
  129. package/dist/transform-BjxHGGKc.cjs.map +1 -0
  130. package/dist/transformOptions-BsjCELkh.d.cts +11 -0
  131. package/dist/transformOptions-BsjCELkh.d.ts +11 -0
  132. package/package.json +5 -5
  133. package/dist/autoTrace.cjs.map +0 -1
  134. package/dist/autoTrace.js.map +0 -1
  135. package/dist/chunk-27B3UBSS.js +0 -2547
  136. package/dist/chunk-27B3UBSS.js.map +0 -1
  137. package/dist/chunk-B2M4KELA.js +0 -1912
  138. package/dist/chunk-B2M4KELA.js.map +0 -1
  139. package/dist/chunk-I233ERUH.js +0 -2979
  140. package/dist/chunk-I233ERUH.js.map +0 -1
  141. package/dist/chunk-ISU6FQKY.js +0 -6877
  142. package/dist/chunk-ISU6FQKY.js.map +0 -1
  143. package/dist/chunk-MT36GJMW.js +0 -106
  144. package/dist/chunk-MT36GJMW.js.map +0 -1
  145. package/dist/chunk-PTCLRG4E.js +0 -28
  146. package/dist/chunk-PTCLRG4E.js.map +0 -1
  147. package/dist/chunk-QRNHRY7F.js +0 -270
  148. package/dist/chunk-QRNHRY7F.js.map +0 -1
  149. package/dist/chunk-R6M54SPO.js +0 -1176
  150. package/dist/chunk-R6M54SPO.js.map +0 -1
  151. package/dist/chunk-SOP5AFMH.js +0 -2060
  152. package/dist/chunk-SOP5AFMH.js.map +0 -1
  153. package/dist/chunk-YVJAOGHE.js +0 -45
  154. package/dist/chunk-YVJAOGHE.js.map +0 -1
  155. package/dist/chunk-ZG6SHKEF.js +0 -404
  156. package/dist/chunk-ZG6SHKEF.js.map +0 -1
  157. package/dist/http-LL3JD2JE.js +0 -24
  158. package/dist/http-LL3JD2JE.js.map +0 -1
  159. package/dist/http-QZDTQC3C.js +0 -23
  160. package/dist/http-QZDTQC3C.js.map +0 -1
  161. package/dist/index.cjs.map +0 -1
  162. package/dist/index.js.map +0 -1
  163. package/dist/replay-636XZIS2.js +0 -29
  164. package/dist/replay-636XZIS2.js.map +0 -1
  165. package/dist/replay-S4DNF4VR.js +0 -28
  166. package/dist/replay-S4DNF4VR.js.map +0 -1
  167. package/dist/transform/babel.cjs.map +0 -1
  168. package/dist/transform/babel.js.map +0 -1
  169. package/dist/transformOptions-Df2_Chtc.d.cts +0 -10
  170. package/dist/transformOptions-Df2_Chtc.d.ts +0 -10
@@ -1,354 +1,16 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/autoTrace.ts
21
- var autoTrace_exports = {};
22
- __export(autoTrace_exports, {
23
- __bitfabAutoSpan: () => __bitfabAutoSpan,
24
- __bitfabAutoTraceActive: () => __bitfabAutoTraceActive,
25
- __bitfabAutoWrap: () => __bitfabAutoWrap,
26
- _resetAutoTraceTransformDetection: () => _resetAutoTraceTransformDetection,
27
- clearAutoTraceNodeConfiguration: () => clearAutoTraceNodeConfiguration,
28
- currentAutoTraceEntries: () => currentAutoTraceEntries,
29
- invokeThroughAutoTraceEntries: () => invokeThroughAutoTraceEntries,
30
- runAsAutoTraceRootFunction: () => runAsAutoTraceRootFunction,
31
- runWithAutoTraceEntry: () => runWithAutoTraceEntry,
32
- runWithAutoTraceNodeConfiguration: () => runWithAutoTraceNodeConfiguration,
33
- runWithAutoTraceRootContext: () => runWithAutoTraceRootContext
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
35
- module.exports = __toCommonJS(autoTrace_exports);
36
-
37
- // src/asyncStorage.ts
38
- var AsyncLocalStorageClass = null;
39
- var initDone = false;
40
- function registerAsyncLocalStorageClass(cls) {
41
- if (!AsyncLocalStorageClass) {
42
- AsyncLocalStorageClass = cls;
43
- }
44
- initDone = true;
45
- }
46
- var asyncStorageReady = (typeof process !== "undefined" && process.versions?.node ? (
47
- // The join trick hides "node:async_hooks" from static analysis so
48
- // bundlers that ban Node.js built-ins don't fail at build time.
49
- // webpackIgnore tells webpack/turbopack to emit a native import()
50
- // so Node.js can resolve the module at runtime.
51
- import(
52
- /* webpackIgnore: true */
53
- ["node", "async_hooks"].join(":")
54
- ).then(
55
- (mod) => {
56
- registerAsyncLocalStorageClass(mod.AsyncLocalStorage);
57
- }
58
- ).catch(() => {
59
- })
60
- ) : Promise.resolve()).then(() => {
61
- initDone = true;
62
- });
63
- function createAsyncLocalStorage() {
64
- return AsyncLocalStorageClass ? new AsyncLocalStorageClass() : null;
65
- }
66
-
67
- // src/captureSuppression.ts
68
- var suppressionGlobal = globalThis;
69
- var suppressionState = suppressionGlobal.__bitfabCaptureSuppressionV1 ?? { depth: 0 };
70
- suppressionGlobal.__bitfabCaptureSuppressionV1 = suppressionState;
71
- function isCaptureSuppressed() {
72
- return suppressionState.depth > 0;
73
- }
74
-
75
- // src/warnOnce.ts
76
- var warned = /* @__PURE__ */ new Set();
77
- function warn(message) {
78
- try {
79
- console.warn(`[bitfab] ${message}`);
80
- } catch {
81
- }
82
- }
83
- function warnOnce(key, message) {
84
- if (warned.has(key)) {
85
- return;
86
- }
87
- warned.add(key);
88
- warn(message);
89
- }
90
-
91
- // src/autoTrace.ts
92
- var autoTraceGlobal = globalThis;
93
- var autoTraceState = autoTraceGlobal.__bitfabAutoTraceStateV4 ?? {
94
- storage: null,
95
- browserScope: void 0,
96
- capturePolicies: /* @__PURE__ */ new WeakMap(),
97
- activeRoots: 0
98
- };
99
- autoTraceGlobal.__bitfabAutoTraceStateV4 = autoTraceState;
100
- function initializeAutoTraceStorage() {
101
- autoTraceState.storage ?? (autoTraceState.storage = createAsyncLocalStorage());
102
- }
103
- function runWithAutoTraceScope(scope, fn) {
104
- initializeAutoTraceStorage();
105
- if (autoTraceState.storage) {
106
- return autoTraceState.storage.run(scope, fn);
107
- }
108
- const previous = autoTraceState.browserScope;
109
- autoTraceState.browserScope = scope;
110
- try {
111
- return fn();
112
- } finally {
113
- autoTraceState.browserScope = previous;
114
- }
115
- }
116
- function currentAutoTraceEntries() {
117
- return currentAutoTraceScope()?.entries ?? [];
118
- }
119
- function replaceEntry(entries, previous, updated) {
120
- return entries.map((entry) => entry === previous ? updated : entry);
121
- }
122
- function runWithAutoTraceEntry(previous, updated, fn) {
123
- const result = runWithAutoTraceScope(
124
- { entries: replaceEntry(currentAutoTraceEntries(), previous, updated) },
125
- fn
126
- );
127
- if (isAutoTraceAsyncGenerator(result)) {
128
- return wrapAutoTraceEntryAsyncGenerator(previous, updated, result);
129
- }
130
- return result;
131
- }
132
- function wrapAutoTraceEntryAsyncGenerator(previous, updated, source) {
133
- const step = (method, value) => runWithAutoTraceScope(
134
- { entries: replaceEntry(currentAutoTraceEntries(), previous, updated) },
135
- () => source[method](value)
136
- );
137
- const wrapped = {
138
- next: (value) => step("next", value),
139
- return: (value) => step("return", value),
140
- throw: (error) => step("throw", error),
141
- [Symbol.asyncIterator]: () => wrapped
142
- };
143
- return wrapped;
144
- }
145
- function clearAutoTraceNodeConfiguration(fn) {
146
- return runWithAutoTraceScope({ entries: currentAutoTraceEntries() }, fn);
147
- }
148
- function runWithAutoTraceNodeConfiguration(nodeConfiguration, fn) {
149
- const scope = currentAutoTraceScope();
150
- if (!scope || scope.entries.length === 0) {
151
- return fn();
152
- }
153
- const result = runWithAutoTraceScope({ ...scope, nodeConfiguration }, fn);
154
- if (isAutoTraceAsyncGenerator(result)) {
155
- return wrapAutoTraceNodeAsyncGenerator(nodeConfiguration, result);
156
- }
157
- return result;
158
- }
159
- function runAsAutoTraceRootFunction(functionName, fn) {
160
- const scope = currentAutoTraceScope();
161
- if (!scope || scope.entries.length === 0 || functionName === "") {
162
- return fn();
163
- }
164
- const rootFunction = {
165
- name: functionName,
166
- entering: true
167
- };
168
- try {
169
- return runWithAutoTraceScope({ ...scope, rootFunction }, fn);
170
- } finally {
171
- rootFunction.entering = false;
172
- }
173
- }
174
- function isRootFunctionEntry(scope, simpleName) {
175
- const rootFunction = scope.rootFunction;
176
- if (rootFunction === void 0 || !rootFunction.entering) {
177
- return false;
178
- }
179
- rootFunction.entering = false;
180
- return rootFunction.name === simpleName;
181
- }
182
- var SUBTREE_TRACING_DOCS_URL = "https://docs.bitfab.ai/typescript-sdk#experimental-subtree-tracing";
183
- function noteTransformedModule() {
184
- autoTraceGlobal.__bitfab_auto_trace_transformed_v1__ = true;
185
- }
186
- function transformInstalled() {
187
- return autoTraceGlobal.__bitfab_auto_trace_transformed_v1__ === true;
188
- }
189
- function runsOnNode() {
190
- return typeof process !== "undefined" && Boolean(process.versions?.node);
191
- }
192
- function closeAutoTraceRoot() {
193
- autoTraceState.activeRoots -= 1;
194
- }
195
- function settleAutoTraceRoot(context) {
196
- closeAutoTraceRoot();
197
- if (transformInstalled() || !runsOnNode()) {
198
- return;
199
- }
200
- warnOnce(
201
- "auto-trace-transform-missing",
202
- `trace root "${context.traceFunctionKey}" recorded only its own span. No module in this build was compiled by @bitfab/sdk/transform, so calls beneath the root were not discovered. Add the SDK's transform adapter to the server build: ${SUBTREE_TRACING_DOCS_URL}`
203
- );
204
- }
205
- function runWithAutoTraceRootContext(context, spanStack, fn) {
206
- autoTraceState.activeRoots += 1;
207
- const entries = [
208
- ...currentAutoTraceEntries(),
209
- { context, depth: 0, spanStack }
210
- ];
211
- let result;
212
- try {
213
- result = runWithAutoTraceScope({ entries }, fn);
214
- } catch (error) {
215
- settleAutoTraceRoot(context);
216
- throw error;
217
- }
218
- if (isAutoTraceAsyncGenerator(result)) {
219
- closeAutoTraceRoot();
220
- return wrapAutoTraceAsyncGenerator(context, spanStack, result);
221
- }
222
- if (result instanceof Promise) {
223
- return result.finally(() => {
224
- settleAutoTraceRoot(context);
225
- });
226
- }
227
- settleAutoTraceRoot(context);
228
- return result;
229
- }
230
- function invokeThroughAutoTraceEntries(entries, step, fn) {
231
- let run = fn;
232
- for (let index = entries.length - 1; index >= 0; index -= 1) {
233
- const entry = entries[index];
234
- const next = run;
235
- run = () => step(entry, next);
236
- }
237
- return run();
238
- }
239
- function isAutoTraceAsyncGenerator(value) {
240
- if (value === null || typeof value !== "object") {
241
- return false;
242
- }
243
- const candidate = value;
244
- return typeof candidate.next === "function" && typeof candidate.return === "function" && typeof candidate.throw === "function" && typeof candidate[Symbol.asyncIterator] === "function";
245
- }
246
- function wrapAutoTraceAsyncGenerator(context, spanStack, source) {
247
- const step = (method, value) => runWithAutoTraceRootContext(context, spanStack, () => source[method](value));
248
- const wrapped = {
249
- next: (value) => step("next", value),
250
- return: (value) => step("return", value),
251
- throw: (error) => step("throw", error),
252
- [Symbol.asyncIterator]: () => wrapped
253
- };
254
- return wrapped;
255
- }
256
- function wrapAutoTraceNodeAsyncGenerator(nodeConfiguration, source) {
257
- const step = (method, value) => runWithAutoTraceNodeConfiguration(
258
- nodeConfiguration,
259
- () => source[method](value)
260
- );
261
- const wrapped = {
262
- next: (value) => step("next", value),
263
- return: (value) => step("return", value),
264
- throw: (error) => step("throw", error),
265
- [Symbol.asyncIterator]: () => wrapped
266
- };
267
- return wrapped;
268
- }
269
- function shareFinalize(configuration) {
270
- const finalize = configuration.finalize;
271
- if (finalize === void 0) {
272
- return configuration;
273
- }
274
- let settled;
275
- return {
276
- ...configuration,
277
- finalize: (result) => {
278
- settled ?? (settled = Promise.resolve().then(() => finalize(result)));
279
- return settled;
280
- }
281
- };
282
- }
283
- function __bitfabAutoSpan(definition, inputs, fn) {
284
- noteTransformedModule();
285
- const scope = currentAutoTraceScope();
286
- if (!scope || scope.entries.length === 0 || isCaptureSuppressed()) {
287
- return fn();
288
- }
289
- const nameParts = definition.name.split(".");
290
- const simpleName = nameParts[nameParts.length - 1];
291
- if (isRootFunctionEntry(scope, simpleName)) {
292
- return fn();
293
- }
294
- const nodeConfiguration = simpleName === scope.nodeConfiguration?.functionName ? shareFinalize(scope.nodeConfiguration) : void 0;
295
- return invokeThroughAutoTraceEntries(
296
- scope.entries,
297
- (entry, next) => entry.context.invoke(definition, inputs, next, entry, nodeConfiguration),
298
- fn
299
- );
300
- }
301
- function __bitfabAutoWrap(definition, fn) {
302
- noteTransformedModule();
303
- if (fn.name === "") {
304
- const nameParts = definition.name.split(".");
305
- const inferredName = nameParts[nameParts.length - 1];
306
- if (inferredName !== void 0) {
307
- Object.defineProperty(fn, "name", {
308
- configurable: true,
309
- value: inferredName
310
- });
311
- }
312
- }
313
- const target = fn;
314
- return new Proxy(target, {
315
- apply(callTarget, thisArg, args) {
316
- if (!__bitfabAutoTraceActive()) {
317
- return Reflect.apply(callTarget, thisArg, args);
318
- }
319
- return __bitfabAutoSpan(
320
- definition,
321
- args,
322
- () => Reflect.apply(callTarget, thisArg, args)
323
- );
324
- }
325
- });
326
- }
327
- function __bitfabAutoTraceActive() {
328
- if (autoTraceState.activeRoots === 0 || isCaptureSuppressed()) {
329
- return false;
330
- }
331
- return currentAutoTraceEntries().length > 0;
332
- }
333
- function currentAutoTraceScope() {
334
- initializeAutoTraceStorage();
335
- return autoTraceState.storage?.getStore() ?? autoTraceState.browserScope;
336
- }
337
- function _resetAutoTraceTransformDetection() {
338
- autoTraceGlobal.__bitfab_auto_trace_transformed_v1__ = void 0;
339
- }
340
- // Annotate the CommonJS export names for ESM import in node:
341
- 0 && (module.exports = {
342
- __bitfabAutoSpan,
343
- __bitfabAutoTraceActive,
344
- __bitfabAutoWrap,
345
- _resetAutoTraceTransformDetection,
346
- clearAutoTraceNodeConfiguration,
347
- currentAutoTraceEntries,
348
- invokeThroughAutoTraceEntries,
349
- runAsAutoTraceRootFunction,
350
- runWithAutoTraceEntry,
351
- runWithAutoTraceNodeConfiguration,
352
- runWithAutoTraceRootContext
353
- });
354
- //# sourceMappingURL=autoTrace.cjs.map
5
+ const require_autoTrace = require("./autoTrace-KM9pYqk9.cjs");
6
+ exports.__bitfabAutoSpan = require_autoTrace.__bitfabAutoSpan;
7
+ exports.__bitfabAutoTraceActive = require_autoTrace.__bitfabAutoTraceActive;
8
+ exports.__bitfabAutoWrap = require_autoTrace.__bitfabAutoWrap;
9
+ exports._resetAutoTraceTransformDetection = require_autoTrace._resetAutoTraceTransformDetection;
10
+ exports.clearAutoTraceNodeConfiguration = require_autoTrace.clearAutoTraceNodeConfiguration;
11
+ exports.currentAutoTraceEntries = require_autoTrace.currentAutoTraceEntries;
12
+ exports.invokeThroughAutoTraceEntries = require_autoTrace.invokeThroughAutoTraceEntries;
13
+ exports.runAsAutoTraceRootFunction = require_autoTrace.runAsAutoTraceRootFunction;
14
+ exports.runWithAutoTraceEntry = require_autoTrace.runWithAutoTraceEntry;
15
+ exports.runWithAutoTraceNodeConfiguration = require_autoTrace.runWithAutoTraceNodeConfiguration;
16
+ exports.runWithAutoTraceRootContext = require_autoTrace.runWithAutoTraceRootContext;
@@ -1,47 +1,48 @@
1
- interface AutoTraceFunctionDefinition {
2
- id: string;
3
- name: string;
4
- file: string;
5
- line: number;
6
- column: number;
7
- async?: boolean;
8
- wrapper?: boolean;
1
+ //#region src/autoTrace.d.ts
2
+ export interface AutoTraceFunctionDefinition {
3
+ id: string;
4
+ name: string;
5
+ file: string;
6
+ line: number;
7
+ column: number;
8
+ async?: boolean;
9
+ wrapper?: boolean;
9
10
  }
10
- interface AutoTraceNodeConfiguration {
11
- functionName: string;
12
- name?: string;
13
- type?: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
14
- capture: boolean;
15
- experimentId?: string;
16
- /** @deprecated Use experimentId. */
17
- testRunId?: string;
18
- mockOnReplay?: boolean;
19
- replayReusable?: boolean;
20
- finalize?: (result: any) => unknown | Promise<unknown>;
11
+ export interface AutoTraceNodeConfiguration {
12
+ functionName: string;
13
+ name?: string;
14
+ type?: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
15
+ capture: boolean;
16
+ experimentId?: string;
17
+ /** @deprecated Use experimentId. */
18
+ testRunId?: string;
19
+ mockOnReplay?: boolean;
20
+ replayReusable?: boolean;
21
+ finalize?: (result: any) => unknown | Promise<unknown>;
21
22
  }
22
- interface NestedTraceLink {
23
- traceFunctionKey: string;
24
- traceId?: string;
25
- rootSpanId?: string;
23
+ export interface NestedTraceLink {
24
+ traceFunctionKey: string;
25
+ traceId?: string;
26
+ rootSpanId?: string;
26
27
  }
27
- interface AutoTraceEntry {
28
- context: AutoTraceContext;
29
- depth: number;
30
- spanStack: unknown;
28
+ export interface AutoTraceEntry {
29
+ context: AutoTraceContext;
30
+ depth: number;
31
+ spanStack: unknown;
31
32
  }
32
- interface AutoTraceContext {
33
- readonly traceFunctionKey: string;
34
- invoke<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, nodeConfiguration?: AutoTraceNodeConfiguration): T;
35
- invokeNestedRoot<T>(name: string, functionName: string, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, link: NestedTraceLink | undefined): T;
33
+ export interface AutoTraceContext {
34
+ readonly traceFunctionKey: string;
35
+ invoke<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, nodeConfiguration?: AutoTraceNodeConfiguration): T;
36
+ invokeNestedRoot<T>(name: string, functionName: string, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, link: NestedTraceLink | undefined): T;
36
37
  }
37
- declare function currentAutoTraceEntries(): readonly AutoTraceEntry[];
38
- declare function runWithAutoTraceEntry<T>(previous: AutoTraceEntry, updated: AutoTraceEntry, fn: () => T): T;
39
- declare function clearAutoTraceNodeConfiguration<T>(fn: () => T): T;
40
- declare function runWithAutoTraceNodeConfiguration<T>(nodeConfiguration: AutoTraceNodeConfiguration, fn: () => T): T;
41
- declare function runAsAutoTraceRootFunction<T>(functionName: string, fn: () => T): T;
42
- declare function runWithAutoTraceRootContext<T>(context: AutoTraceContext, spanStack: unknown, fn: () => T): T;
43
- declare function invokeThroughAutoTraceEntries<T>(entries: readonly AutoTraceEntry[], step: (entry: AutoTraceEntry, next: () => T) => T, fn: () => T): T;
44
- declare function __bitfabAutoSpan<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T): T;
38
+ export declare function currentAutoTraceEntries(): readonly AutoTraceEntry[];
39
+ export declare function runWithAutoTraceEntry<T>(previous: AutoTraceEntry, updated: AutoTraceEntry, fn: () => T): T;
40
+ export declare function clearAutoTraceNodeConfiguration<T>(fn: () => T): T;
41
+ export declare function runWithAutoTraceNodeConfiguration<T>(nodeConfiguration: AutoTraceNodeConfiguration, fn: () => T): T;
42
+ export declare function runAsAutoTraceRootFunction<T>(functionName: string, fn: () => T): T;
43
+ export declare function runWithAutoTraceRootContext<T>(context: AutoTraceContext, spanStack: unknown, fn: () => T): T;
44
+ export declare function invokeThroughAutoTraceEntries<T>(entries: readonly AutoTraceEntry[], step: (entry: AutoTraceEntry, next: () => T) => T, fn: () => T): T;
45
+ export declare function __bitfabAutoSpan<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T): T;
45
46
  /**
46
47
  * Preserve a function's original call arguments for transform cases where
47
48
  * parameter bindings discard them, such as destructured arrow parameters.
@@ -52,7 +53,7 @@ declare function __bitfabAutoSpan<T>(definition: AutoTraceFunctionDefinition, in
52
53
  *
53
54
  * @experimental The automatic tracing protocol may change.
54
55
  */
55
- declare function __bitfabAutoWrap<T extends (...args: never[]) => unknown>(definition: AutoTraceFunctionDefinition, fn: T): T;
56
+ export declare function __bitfabAutoWrap<T extends (...args: never[]) => unknown>(definition: AutoTraceFunctionDefinition, fn: T): T;
56
57
  /**
57
58
  * Return whether the current call is inside an automatic trace root.
58
59
  *
@@ -62,7 +63,6 @@ declare function __bitfabAutoWrap<T extends (...args: never[]) => unknown>(defin
62
63
  *
63
64
  * @experimental The automatic tracing protocol may change.
64
65
  */
65
- declare function __bitfabAutoTraceActive(): boolean;
66
- declare function _resetAutoTraceTransformDetection(): void;
67
-
68
- export { type AutoTraceContext, type AutoTraceEntry, type AutoTraceFunctionDefinition, type AutoTraceNodeConfiguration, type NestedTraceLink, __bitfabAutoSpan, __bitfabAutoTraceActive, __bitfabAutoWrap, _resetAutoTraceTransformDetection, clearAutoTraceNodeConfiguration, currentAutoTraceEntries, invokeThroughAutoTraceEntries, runAsAutoTraceRootFunction, runWithAutoTraceEntry, runWithAutoTraceNodeConfiguration, runWithAutoTraceRootContext };
66
+ export declare function __bitfabAutoTraceActive(): boolean;
67
+ export declare function _resetAutoTraceTransformDetection(): void;
68
+ //#endregion
@@ -1,47 +1,48 @@
1
- interface AutoTraceFunctionDefinition {
2
- id: string;
3
- name: string;
4
- file: string;
5
- line: number;
6
- column: number;
7
- async?: boolean;
8
- wrapper?: boolean;
1
+ //#region src/autoTrace.d.ts
2
+ export interface AutoTraceFunctionDefinition {
3
+ id: string;
4
+ name: string;
5
+ file: string;
6
+ line: number;
7
+ column: number;
8
+ async?: boolean;
9
+ wrapper?: boolean;
9
10
  }
10
- interface AutoTraceNodeConfiguration {
11
- functionName: string;
12
- name?: string;
13
- type?: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
14
- capture: boolean;
15
- experimentId?: string;
16
- /** @deprecated Use experimentId. */
17
- testRunId?: string;
18
- mockOnReplay?: boolean;
19
- replayReusable?: boolean;
20
- finalize?: (result: any) => unknown | Promise<unknown>;
11
+ export interface AutoTraceNodeConfiguration {
12
+ functionName: string;
13
+ name?: string;
14
+ type?: "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
15
+ capture: boolean;
16
+ experimentId?: string;
17
+ /** @deprecated Use experimentId. */
18
+ testRunId?: string;
19
+ mockOnReplay?: boolean;
20
+ replayReusable?: boolean;
21
+ finalize?: (result: any) => unknown | Promise<unknown>;
21
22
  }
22
- interface NestedTraceLink {
23
- traceFunctionKey: string;
24
- traceId?: string;
25
- rootSpanId?: string;
23
+ export interface NestedTraceLink {
24
+ traceFunctionKey: string;
25
+ traceId?: string;
26
+ rootSpanId?: string;
26
27
  }
27
- interface AutoTraceEntry {
28
- context: AutoTraceContext;
29
- depth: number;
30
- spanStack: unknown;
28
+ export interface AutoTraceEntry {
29
+ context: AutoTraceContext;
30
+ depth: number;
31
+ spanStack: unknown;
31
32
  }
32
- interface AutoTraceContext {
33
- readonly traceFunctionKey: string;
34
- invoke<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, nodeConfiguration?: AutoTraceNodeConfiguration): T;
35
- invokeNestedRoot<T>(name: string, functionName: string, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, link: NestedTraceLink | undefined): T;
33
+ export interface AutoTraceContext {
34
+ readonly traceFunctionKey: string;
35
+ invoke<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, nodeConfiguration?: AutoTraceNodeConfiguration): T;
36
+ invokeNestedRoot<T>(name: string, functionName: string, inputs: unknown[], fn: () => T, entry: AutoTraceEntry, link: NestedTraceLink | undefined): T;
36
37
  }
37
- declare function currentAutoTraceEntries(): readonly AutoTraceEntry[];
38
- declare function runWithAutoTraceEntry<T>(previous: AutoTraceEntry, updated: AutoTraceEntry, fn: () => T): T;
39
- declare function clearAutoTraceNodeConfiguration<T>(fn: () => T): T;
40
- declare function runWithAutoTraceNodeConfiguration<T>(nodeConfiguration: AutoTraceNodeConfiguration, fn: () => T): T;
41
- declare function runAsAutoTraceRootFunction<T>(functionName: string, fn: () => T): T;
42
- declare function runWithAutoTraceRootContext<T>(context: AutoTraceContext, spanStack: unknown, fn: () => T): T;
43
- declare function invokeThroughAutoTraceEntries<T>(entries: readonly AutoTraceEntry[], step: (entry: AutoTraceEntry, next: () => T) => T, fn: () => T): T;
44
- declare function __bitfabAutoSpan<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T): T;
38
+ export declare function currentAutoTraceEntries(): readonly AutoTraceEntry[];
39
+ export declare function runWithAutoTraceEntry<T>(previous: AutoTraceEntry, updated: AutoTraceEntry, fn: () => T): T;
40
+ export declare function clearAutoTraceNodeConfiguration<T>(fn: () => T): T;
41
+ export declare function runWithAutoTraceNodeConfiguration<T>(nodeConfiguration: AutoTraceNodeConfiguration, fn: () => T): T;
42
+ export declare function runAsAutoTraceRootFunction<T>(functionName: string, fn: () => T): T;
43
+ export declare function runWithAutoTraceRootContext<T>(context: AutoTraceContext, spanStack: unknown, fn: () => T): T;
44
+ export declare function invokeThroughAutoTraceEntries<T>(entries: readonly AutoTraceEntry[], step: (entry: AutoTraceEntry, next: () => T) => T, fn: () => T): T;
45
+ export declare function __bitfabAutoSpan<T>(definition: AutoTraceFunctionDefinition, inputs: unknown[], fn: () => T): T;
45
46
  /**
46
47
  * Preserve a function's original call arguments for transform cases where
47
48
  * parameter bindings discard them, such as destructured arrow parameters.
@@ -52,7 +53,7 @@ declare function __bitfabAutoSpan<T>(definition: AutoTraceFunctionDefinition, in
52
53
  *
53
54
  * @experimental The automatic tracing protocol may change.
54
55
  */
55
- declare function __bitfabAutoWrap<T extends (...args: never[]) => unknown>(definition: AutoTraceFunctionDefinition, fn: T): T;
56
+ export declare function __bitfabAutoWrap<T extends (...args: never[]) => unknown>(definition: AutoTraceFunctionDefinition, fn: T): T;
56
57
  /**
57
58
  * Return whether the current call is inside an automatic trace root.
58
59
  *
@@ -62,7 +63,6 @@ declare function __bitfabAutoWrap<T extends (...args: never[]) => unknown>(defin
62
63
  *
63
64
  * @experimental The automatic tracing protocol may change.
64
65
  */
65
- declare function __bitfabAutoTraceActive(): boolean;
66
- declare function _resetAutoTraceTransformDetection(): void;
67
-
68
- export { type AutoTraceContext, type AutoTraceEntry, type AutoTraceFunctionDefinition, type AutoTraceNodeConfiguration, type NestedTraceLink, __bitfabAutoSpan, __bitfabAutoTraceActive, __bitfabAutoWrap, _resetAutoTraceTransformDetection, clearAutoTraceNodeConfiguration, currentAutoTraceEntries, invokeThroughAutoTraceEntries, runAsAutoTraceRootFunction, runWithAutoTraceEntry, runWithAutoTraceNodeConfiguration, runWithAutoTraceRootContext };
66
+ export declare function __bitfabAutoTraceActive(): boolean;
67
+ export declare function _resetAutoTraceTransformDetection(): void;
68
+ //#endregion
package/dist/autoTrace.js CHANGED
@@ -1,28 +1 @@
1
- import {
2
- __bitfabAutoSpan,
3
- __bitfabAutoTraceActive,
4
- __bitfabAutoWrap,
5
- _resetAutoTraceTransformDetection,
6
- clearAutoTraceNodeConfiguration,
7
- currentAutoTraceEntries,
8
- invokeThroughAutoTraceEntries,
9
- runAsAutoTraceRootFunction,
10
- runWithAutoTraceEntry,
11
- runWithAutoTraceNodeConfiguration,
12
- runWithAutoTraceRootContext
13
- } from "./chunk-QRNHRY7F.js";
14
- import "./chunk-MT36GJMW.js";
15
- export {
16
- __bitfabAutoSpan,
17
- __bitfabAutoTraceActive,
18
- __bitfabAutoWrap,
19
- _resetAutoTraceTransformDetection,
20
- clearAutoTraceNodeConfiguration,
21
- currentAutoTraceEntries,
22
- invokeThroughAutoTraceEntries,
23
- runAsAutoTraceRootFunction,
24
- runWithAutoTraceEntry,
25
- runWithAutoTraceNodeConfiguration,
26
- runWithAutoTraceRootContext
27
- };
28
- //# sourceMappingURL=autoTrace.js.map
1
+ export { t as __bitfabAutoSpan, n as __bitfabAutoTraceActive, r as __bitfabAutoWrap, i as _resetAutoTraceTransformDetection, a as clearAutoTraceNodeConfiguration, o as currentAutoTraceEntries, s as invokeThroughAutoTraceEntries, c as runAsAutoTraceRootFunction, l as runWithAutoTraceEntry, u as runWithAutoTraceNodeConfiguration, d as runWithAutoTraceRootContext } from "./autoTrace-CZu0BXhG.js";