bitfab 0.68.4 → 0.68.6
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-D3-OZcmR.cjs → autoTrace-DUmR1KJ8.cjs} +417 -62
- package/dist/autoTrace-DUmR1KJ8.cjs.map +1 -0
- package/dist/{autoTrace-ghnojSj9.js → autoTrace-DVnpnuMb.js} +322 -57
- package/dist/autoTrace-DVnpnuMb.js.map +1 -0
- package/dist/autoTrace.cjs +3 -1
- package/dist/autoTrace.d.cts +29 -1
- package/dist/autoTrace.d.ts +29 -1
- package/dist/autoTrace.js +1 -1
- package/dist/{babelPlugin-0uOq-j1Q.cjs → babelPlugin-C0Im6AZ2.cjs} +37 -14
- package/dist/babelPlugin-C0Im6AZ2.cjs.map +1 -0
- package/dist/{babelPlugin-Muq0uuuu.js → babelPlugin-hS2Hb2vt.js} +37 -14
- package/dist/babelPlugin-hS2Hb2vt.js.map +1 -0
- package/dist/baml.cjs +1 -1
- package/dist/baml.js +1 -1
- package/dist/{bamlPeer-BUoZgNxZ.cjs → bamlPeer-5Ohpq8q9.cjs} +3 -17
- package/dist/bamlPeer-5Ohpq8q9.cjs.map +1 -0
- package/dist/{bamlPeer-CIVwS68E.js → bamlPeer-Dyeb3e5o.js} +3 -11
- package/dist/bamlPeer-Dyeb3e5o.js.map +1 -0
- package/dist/{http-C-HrwUb8.cjs → http-CARmid5D.cjs} +4 -4
- package/dist/{http-C-HrwUb8.cjs.map → http-CARmid5D.cjs.map} +1 -1
- package/dist/{http-BGY4ULH5.js → http-CYIjoMdj.js} +3 -3
- package/dist/{http-BGY4ULH5.js.map → http-CYIjoMdj.js.map} +1 -1
- package/dist/{index-BcGxu85i.d.cts → index-BuP59-AI.d.cts} +189 -4
- package/dist/{index-BcGxu85i.d.ts → index-BuP59-AI.d.ts} +189 -4
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/node.cjs +3 -3
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +3 -3
- package/dist/optionalPeer-CUH756lt.cjs +17 -0
- package/dist/optionalPeer-CUH756lt.cjs.map +1 -0
- package/dist/optionalPeer-CczrzrXx.js +12 -0
- package/dist/optionalPeer-CczrzrXx.js.map +1 -0
- package/dist/{registryCommand-Dk4Y1ZgW.js → registryCommand-D7bfo0Au.js} +179 -8
- package/dist/registryCommand-D7bfo0Au.js.map +1 -0
- package/dist/replayCli.js +1 -1
- package/dist/seedCli.js +1 -1
- package/dist/{src-BG2_8Fpf.cjs → src-C3H1v_hp.cjs} +62 -81
- package/dist/src-C3H1v_hp.cjs.map +1 -0
- package/dist/{src-Cmfs_7Ib.js → src-DgeGOhjN.js} +51 -70
- package/dist/src-DgeGOhjN.js.map +1 -0
- package/dist/transform/babel.cjs +1 -1
- package/dist/transform/babel.js +1 -1
- package/dist/transform/loaderRuntime.cjs +2 -2
- package/dist/transform/loaderRuntime.js +2 -2
- package/dist/transform/nodeLoader.js +36 -13
- package/dist/transform/nodeLoader.js.map +1 -1
- package/dist/transform/swc.cjs +1 -1
- package/dist/transform/swc.js +1 -1
- package/dist/transform/unplugin.cjs +2 -2
- package/dist/transform/unplugin.js +2 -2
- package/dist/{transform-CAJyLLe2.js → transform-BL1fJW-C.js} +2 -2
- package/dist/{transform-CAJyLLe2.js.map → transform-BL1fJW-C.js.map} +1 -1
- package/dist/{transform-ClCOpCZ2.cjs → transform-C4H7TKW-.cjs} +2 -2
- package/dist/{transform-ClCOpCZ2.cjs.map → transform-C4H7TKW-.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/autoTrace-D3-OZcmR.cjs.map +0 -1
- package/dist/autoTrace-ghnojSj9.js.map +0 -1
- package/dist/babelPlugin-0uOq-j1Q.cjs.map +0 -1
- package/dist/babelPlugin-Muq0uuuu.js.map +0 -1
- package/dist/bamlPeer-BUoZgNxZ.cjs.map +0 -1
- package/dist/bamlPeer-CIVwS68E.js.map +0 -1
- package/dist/registryCommand-Dk4Y1ZgW.js.map +0 -1
- package/dist/src-BG2_8Fpf.cjs.map +0 -1
- package/dist/src-Cmfs_7Ib.js.map +0 -1
package/dist/replayCli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, o as checkReplayCliArgs, r as resolveRegistry, s as runReplayCli, t as importRegistry } from "./registryCommand-
|
|
2
|
+
import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, o as checkReplayCliArgs, r as resolveRegistry, s as runReplayCli, t as importRegistry } from "./registryCommand-D7bfo0Au.js";
|
|
3
3
|
//#region src/cloudReplayCli.ts
|
|
4
4
|
const CLOUD_REPLAY_HINT = "Add --cloud to run the same replay on GitHub Actions; bitfab-replay --cloud --help explains it.";
|
|
5
5
|
function isCloudReplayCommand(argv) {
|
package/dist/seedCli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, r as resolveRegistry, t as importRegistry } from "./registryCommand-
|
|
2
|
+
import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, r as resolveRegistry, t as importRegistry } from "./registryCommand-D7bfo0Au.js";
|
|
3
3
|
//#region src/seedCli.ts
|
|
4
4
|
const USAGE = "Usage: bitfab-seed --registry <path> <pipeline> --from-trace <id>[,<id>...]\n bitfab-seed --registry <path> <pipeline> --cases <cases.jsonl> [--run]\nRun bitfab-seed --registry <path> <pipeline> --help for details.";
|
|
5
5
|
async function runSeedCommand(argv, io = {}, importer = importRegistry) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const require_bamlPeer = require("./bamlPeer-
|
|
2
|
-
const require_http = require("./http-
|
|
3
|
-
const require_autoTrace = require("./autoTrace-
|
|
1
|
+
const require_bamlPeer = require("./bamlPeer-5Ohpq8q9.cjs");
|
|
2
|
+
const require_http = require("./http-CARmid5D.cjs");
|
|
3
|
+
const require_autoTrace = require("./autoTrace-DUmR1KJ8.cjs");
|
|
4
|
+
const require_optionalPeer = require("./optionalPeer-CUH756lt.cjs");
|
|
4
5
|
let superjson = require("superjson");
|
|
5
6
|
superjson = require_bamlPeer.__toESM(superjson, 1);
|
|
6
7
|
//#region src/categories.ts
|
|
@@ -1696,6 +1697,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1696
1697
|
this.getActiveSpanContext = config.getActiveSpanContext ?? null;
|
|
1697
1698
|
this.shouldRecord = config.shouldRecord ?? (() => this.httpClient.hasApiKey());
|
|
1698
1699
|
this.captureTools = config.captureTools ?? true;
|
|
1700
|
+
require_autoTrace.installLangChainRunScopes();
|
|
1699
1701
|
}
|
|
1700
1702
|
async close(timeoutMs) {
|
|
1701
1703
|
return this.ownsHttpClient ? this.httpClient.close(timeoutMs) : true;
|
|
@@ -1907,6 +1909,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1907
1909
|
const converted = messages.map((batch) => batch.map(convertMessage));
|
|
1908
1910
|
const spanInfo = this.startSpan(runId, parentRunId, String(name), "llm", converted, metadata, tags);
|
|
1909
1911
|
spanInfo.model = model;
|
|
1912
|
+
if (this.shouldRecord()) require_autoTrace.markLangChainRunRecorded(runId);
|
|
1910
1913
|
} catch {}
|
|
1911
1914
|
}
|
|
1912
1915
|
async handleLLMStart(llm, prompts, runId, parentRunId, _extraParams, tags, metadata, runName) {
|
|
@@ -1917,10 +1920,12 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1917
1920
|
const name = runName ?? model ?? idArr?.[idArr.length - 1] ?? "llm";
|
|
1918
1921
|
const spanInfo = this.startSpan(runId, parentRunId, String(name), "llm", prompts, metadata, tags);
|
|
1919
1922
|
spanInfo.model = model;
|
|
1923
|
+
if (this.shouldRecord()) require_autoTrace.markLangChainRunRecorded(runId);
|
|
1920
1924
|
} catch {}
|
|
1921
1925
|
}
|
|
1922
1926
|
async handleLLMEnd(output, runId) {
|
|
1923
1927
|
try {
|
|
1928
|
+
require_autoTrace.forgetLangChainRun(runId);
|
|
1924
1929
|
let llmOutput;
|
|
1925
1930
|
const generations = output.generations;
|
|
1926
1931
|
if (generations?.length && generations[generations.length - 1]?.length) {
|
|
@@ -1938,6 +1943,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
1938
1943
|
}
|
|
1939
1944
|
async handleLLMError(error, runId) {
|
|
1940
1945
|
try {
|
|
1946
|
+
require_autoTrace.forgetLangChainRun(runId);
|
|
1941
1947
|
this.completeSpan(runId, void 0, error instanceof Error ? error.message : String(error));
|
|
1942
1948
|
} catch {}
|
|
1943
1949
|
}
|
|
@@ -2043,7 +2049,7 @@ function fromBase64(text) {
|
|
|
2043
2049
|
}
|
|
2044
2050
|
async function loadLangGraphPeer() {
|
|
2045
2051
|
try {
|
|
2046
|
-
return await
|
|
2052
|
+
return await require_optionalPeer.importOptionalPeer(["@langchain", "langgraph"]);
|
|
2047
2053
|
} catch {
|
|
2048
2054
|
throw new require_http.BitfabError("Restoring a LangGraph thread during replay requires @langchain/langgraph.", "https://docs.bitfab.ai/frameworks/langgraph");
|
|
2049
2055
|
}
|
|
@@ -2285,14 +2291,14 @@ function isEncodedToolResult(value) {
|
|
|
2285
2291
|
}
|
|
2286
2292
|
async function loadPeer(specifierParts, packageName, docsPath) {
|
|
2287
2293
|
try {
|
|
2288
|
-
return await
|
|
2294
|
+
return await require_optionalPeer.importOptionalPeer(specifierParts);
|
|
2289
2295
|
} catch {
|
|
2290
2296
|
throw new require_http.BitfabError(`This LangGraph integration method requires ${packageName}. Install it to use it.`, `https://docs.bitfab.ai${docsPath}`);
|
|
2291
2297
|
}
|
|
2292
2298
|
}
|
|
2293
2299
|
async function loadLangChainCore() {
|
|
2294
2300
|
try {
|
|
2295
|
-
return await
|
|
2301
|
+
return await require_optionalPeer.importOptionalPeer([
|
|
2296
2302
|
"@langchain",
|
|
2297
2303
|
"core",
|
|
2298
2304
|
"messages"
|
|
@@ -2303,7 +2309,7 @@ async function loadLangChainCore() {
|
|
|
2303
2309
|
}
|
|
2304
2310
|
async function loadLangGraph() {
|
|
2305
2311
|
try {
|
|
2306
|
-
return await
|
|
2312
|
+
return await require_optionalPeer.importOptionalPeer(["@langchain", "langgraph"]);
|
|
2307
2313
|
} catch {
|
|
2308
2314
|
throw new require_http.BitfabError("Replaying a LangGraph Command requires @langchain/langgraph.", "https://docs.bitfab.ai/frameworks/langgraph");
|
|
2309
2315
|
}
|
|
@@ -2548,7 +2554,7 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2548
2554
|
this.getActiveSpanContext = config.getActiveSpanContext;
|
|
2549
2555
|
}
|
|
2550
2556
|
async wrapRun(agent, input, options) {
|
|
2551
|
-
const { run } = await
|
|
2557
|
+
const { run } = await require_optionalPeer.importOptionalPeer(["@openai", "agents"]);
|
|
2552
2558
|
if (this.getActiveSpanContext?.() != null) return run(agent, input, options);
|
|
2553
2559
|
const isStreaming = options?.stream === true;
|
|
2554
2560
|
const finalize = async (result) => {
|
|
@@ -2570,64 +2576,6 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2570
2576
|
}
|
|
2571
2577
|
};
|
|
2572
2578
|
//#endregion
|
|
2573
|
-
//#region src/openaiAgentsSpanContext.ts
|
|
2574
|
-
const OPENAI_AGENTS_CONTEXT_STORAGE = Symbol.for("openai.agents.core.asyncLocalStorage");
|
|
2575
|
-
const MAX_OPENAI_AGENTS_SPAN_CHAIN = 64;
|
|
2576
|
-
const spanGlobal = globalThis;
|
|
2577
|
-
const state = spanGlobal.__bitfabOpenAiAgentsSpansV1 ?? {
|
|
2578
|
-
bitfabTraceIds: /* @__PURE__ */ new Map(),
|
|
2579
|
-
endedSpanIds: /* @__PURE__ */ new Map()
|
|
2580
|
-
};
|
|
2581
|
-
spanGlobal.__bitfabOpenAiAgentsSpansV1 = state;
|
|
2582
|
-
function mapOpenAiAgentsTrace(agentsTraceId, bitfabTraceId) {
|
|
2583
|
-
state.bitfabTraceIds.set(agentsTraceId, bitfabTraceId);
|
|
2584
|
-
}
|
|
2585
|
-
function unmapOpenAiAgentsTrace(agentsTraceId) {
|
|
2586
|
-
state.bitfabTraceIds.delete(agentsTraceId);
|
|
2587
|
-
state.endedSpanIds.delete(agentsTraceId);
|
|
2588
|
-
}
|
|
2589
|
-
function endOpenAiAgentsSpan(agentsTraceId, spanId) {
|
|
2590
|
-
if (!state.bitfabTraceIds.has(agentsTraceId)) return;
|
|
2591
|
-
const ended = state.endedSpanIds.get(agentsTraceId) ?? /* @__PURE__ */ new Set();
|
|
2592
|
-
ended.add(spanId);
|
|
2593
|
-
state.endedSpanIds.set(agentsTraceId, ended);
|
|
2594
|
-
}
|
|
2595
|
-
function isOpenAiAgentsContextStorage(value) {
|
|
2596
|
-
return value !== null && typeof value === "object" && typeof value.getStore === "function";
|
|
2597
|
-
}
|
|
2598
|
-
function currentOpenAiAgentsSpan() {
|
|
2599
|
-
const storage = spanGlobal[OPENAI_AGENTS_CONTEXT_STORAGE];
|
|
2600
|
-
if (!isOpenAiAgentsContextStorage(storage)) return;
|
|
2601
|
-
try {
|
|
2602
|
-
const store = storage.getStore();
|
|
2603
|
-
return store?.active === true ? store.span ?? void 0 : void 0;
|
|
2604
|
-
} catch {
|
|
2605
|
-
return;
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
function currentOpenAiAgentsSpans() {
|
|
2609
|
-
const spans = [];
|
|
2610
|
-
let span = currentOpenAiAgentsSpan();
|
|
2611
|
-
while (span !== void 0 && spans.length < MAX_OPENAI_AGENTS_SPAN_CHAIN) {
|
|
2612
|
-
spans.push(span);
|
|
2613
|
-
span = span.previousSpan ?? void 0;
|
|
2614
|
-
}
|
|
2615
|
-
return spans;
|
|
2616
|
-
}
|
|
2617
|
-
function openAiAgentsSpanChain() {
|
|
2618
|
-
if (state.bitfabTraceIds.size === 0) return [];
|
|
2619
|
-
return currentOpenAiAgentsSpans().map((span) => span.spanId).filter((spanId) => typeof spanId === "string");
|
|
2620
|
-
}
|
|
2621
|
-
function openAiAgentsParentSpanId(bitfabTraceId, enclosingSpanIds) {
|
|
2622
|
-
if (state.bitfabTraceIds.size === 0) return;
|
|
2623
|
-
for (const span of currentOpenAiAgentsSpans()) {
|
|
2624
|
-
if (typeof span.spanId !== "string" || typeof span.traceId !== "string") return;
|
|
2625
|
-
if (state.bitfabTraceIds.get(span.traceId) !== bitfabTraceId) return;
|
|
2626
|
-
if (enclosingSpanIds?.includes(span.spanId)) return;
|
|
2627
|
-
if (!state.endedSpanIds.get(span.traceId)?.has(span.spanId)) return span.spanId;
|
|
2628
|
-
}
|
|
2629
|
-
}
|
|
2630
|
-
//#endregion
|
|
2631
2579
|
//#region src/organizationMembers.ts
|
|
2632
2580
|
const MEMBERS_PATH = "/api/sdk/organizationMembers";
|
|
2633
2581
|
var OrganizationMembersClient = class {
|
|
@@ -4652,9 +4600,18 @@ var TracesClient = class {
|
|
|
4652
4600
|
return (await this.httpClient.get(traceScenarioPath(traceId))).scenario;
|
|
4653
4601
|
}
|
|
4654
4602
|
async saveScenario({ traceId, ...edit }) {
|
|
4655
|
-
return (await this.httpClient.request(traceScenarioPath(traceId), edit)).scenario;
|
|
4603
|
+
return (await this.httpClient.request(traceScenarioPath(traceId), withoutDataRecords(edit))).scenario;
|
|
4656
4604
|
}
|
|
4657
4605
|
};
|
|
4606
|
+
const RECORDS_KEYS_IN_DATA = ["records", "sources"];
|
|
4607
|
+
function withoutDataRecords(edit) {
|
|
4608
|
+
if (edit.data === void 0) return edit;
|
|
4609
|
+
const data = Object.fromEntries(Object.entries(edit.data).filter(([key]) => !RECORDS_KEYS_IN_DATA.includes(key)));
|
|
4610
|
+
return {
|
|
4611
|
+
...edit,
|
|
4612
|
+
data
|
|
4613
|
+
};
|
|
4614
|
+
}
|
|
4658
4615
|
//#endregion
|
|
4659
4616
|
//#region src/tracing.ts
|
|
4660
4617
|
var BitfabOpenAITracingProcessor = class {
|
|
@@ -4688,7 +4645,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
4688
4645
|
const activeContext = this.getActiveSpanContext?.();
|
|
4689
4646
|
if (activeContext) {
|
|
4690
4647
|
this.activeSpanMappings[trace.traceId] = activeContext;
|
|
4691
|
-
if (this.shouldRecord()) mapOpenAiAgentsTrace(trace.traceId, activeContext.traceId);
|
|
4648
|
+
if (this.shouldRecord()) require_autoTrace.mapOpenAiAgentsTrace(trace.traceId, activeContext.traceId);
|
|
4692
4649
|
}
|
|
4693
4650
|
const canonicalTraceId = activeContext?.traceId ?? this.getCanonicalTraceId(trace.traceId);
|
|
4694
4651
|
this.canonicalTraceIds[trace.traceId] = canonicalTraceId;
|
|
@@ -4713,7 +4670,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
4713
4670
|
if (!this.endedTraces.has(traceId) || [...this.startedSpans.values()].includes(traceId)) return;
|
|
4714
4671
|
this.endedTraces.delete(traceId);
|
|
4715
4672
|
delete this.activeSpanMappings[traceId];
|
|
4716
|
-
unmapOpenAiAgentsTrace(traceId);
|
|
4673
|
+
require_autoTrace.unmapOpenAiAgentsTrace(traceId);
|
|
4717
4674
|
delete this.canonicalTraceIds[traceId];
|
|
4718
4675
|
delete this.activeTraces[traceId];
|
|
4719
4676
|
}
|
|
@@ -4727,7 +4684,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
4727
4684
|
async onSpanEnd(span) {
|
|
4728
4685
|
const originalTraceId = span.traceId ?? "";
|
|
4729
4686
|
const traceId = this.activeSpanMappings[originalTraceId]?.traceId ?? originalTraceId;
|
|
4730
|
-
if (span.spanId !== void 0) endOpenAiAgentsSpan(originalTraceId, span.spanId);
|
|
4687
|
+
if (span.spanId !== void 0) require_autoTrace.endOpenAiAgentsSpan(originalTraceId, span.spanId);
|
|
4731
4688
|
try {
|
|
4732
4689
|
this.sendSpan(span);
|
|
4733
4690
|
} finally {
|
|
@@ -4742,7 +4699,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
4742
4699
|
await this.httpClient.waitForPendingRequests();
|
|
4743
4700
|
}
|
|
4744
4701
|
async shutdown(timeout) {
|
|
4745
|
-
for (const traceId of Object.keys(this.activeSpanMappings)) unmapOpenAiAgentsTrace(traceId);
|
|
4702
|
+
for (const traceId of Object.keys(this.activeSpanMappings)) require_autoTrace.unmapOpenAiAgentsTrace(traceId);
|
|
4746
4703
|
this.activeTraces = {};
|
|
4747
4704
|
this.activeSpanMappings = {};
|
|
4748
4705
|
this.canonicalTraceIds = {};
|
|
@@ -5220,7 +5177,7 @@ function extractContextFromCollector(collector) {
|
|
|
5220
5177
|
}
|
|
5221
5178
|
const BOUND_FUNCTION_NAME_PREFIX = /^bound /;
|
|
5222
5179
|
function discoveredSpanType(definition, nodeConfiguration) {
|
|
5223
|
-
const recordsModelCall = definition.baml === true || definition.jev === true || definition.
|
|
5180
|
+
const recordsModelCall = definition.baml === true || definition.jev === true || definition.clientCall !== void 0;
|
|
5224
5181
|
const ownType = recordsModelCall ? "llm" : "function";
|
|
5225
5182
|
if (nodeConfiguration === void 0) return ownType;
|
|
5226
5183
|
if (recordsModelCall && nodeConfiguration.defaultType === true) return ownType;
|
|
@@ -5541,6 +5498,7 @@ var Bitfab = class {
|
|
|
5541
5498
|
const self = this;
|
|
5542
5499
|
self.simulationPlan.refresh();
|
|
5543
5500
|
loadCollectorClass();
|
|
5501
|
+
require_autoTrace.installLangChainRunScopes();
|
|
5544
5502
|
const runRootFunction = (receiver, args) => require_autoTrace.runAsAutoTraceRootFunction(rootFunctionName, () => fn.apply(receiver, args));
|
|
5545
5503
|
const maxDepth = autoTraceLimit(options.maxDepth, DEFAULT_AUTO_TRACE_MAX_DEPTH);
|
|
5546
5504
|
const maxCapturedSubtreeSpans = autoTraceLimit(options.maxCapturedSubtreeSpans, DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS);
|
|
@@ -5629,7 +5587,8 @@ var Bitfab = class {
|
|
|
5629
5587
|
...nodeConfiguration?.finalize !== void 0 && { finalize: nodeConfiguration.finalize }
|
|
5630
5588
|
};
|
|
5631
5589
|
const isAsync = definition.async === true;
|
|
5632
|
-
|
|
5590
|
+
const clientCall = require_autoTrace.clientCallProvider(definition.clientCall);
|
|
5591
|
+
return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : definition.jev === true ? () => recordAutoTracedJev(invokeFn, getCurrentSpan()) : clientCall !== void 0 ? () => require_autoTrace.recordAutoTracedClientCall(clientCall, invokeFn, inputs[0], getCurrentSpan()) : invokeFn);
|
|
5633
5592
|
},
|
|
5634
5593
|
invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link, spanDetails) {
|
|
5635
5594
|
if (excluded.has(nestedName) || excluded.has(nestedFunctionName) || !recordsSpan(entry, nestedName, true)) return invokeFn();
|
|
@@ -5941,14 +5900,30 @@ var Bitfab = class {
|
|
|
5941
5900
|
return wrappedFn;
|
|
5942
5901
|
}
|
|
5943
5902
|
wrapOpenRouter(method, options) {
|
|
5903
|
+
return this.wrapClientCall(require_autoTrace.OPENROUTER, "wrapOpenRouter requires a named function (e.g., openai.chat.completions.create.bind(openai.chat.completions)).", method, options);
|
|
5904
|
+
}
|
|
5905
|
+
wrapAnthropic(method, options) {
|
|
5906
|
+
return this.wrapClientCall(require_autoTrace.ANTHROPIC, "wrapAnthropic requires a named function (e.g., anthropic.messages.create.bind(anthropic.messages)).", method, options);
|
|
5907
|
+
}
|
|
5908
|
+
wrapOpenAIResponses(method, options) {
|
|
5909
|
+
return this.wrapClientCall(require_autoTrace.OPENAI_RESPONSES, "wrapOpenAIResponses requires a named function (e.g., openai.responses.create.bind(openai.responses)).", method, options);
|
|
5910
|
+
}
|
|
5911
|
+
wrapClientCall(provider, anonymousError, method, options) {
|
|
5944
5912
|
const methodName = method.name.replace(BOUND_FUNCTION_NAME_PREFIX, "");
|
|
5945
|
-
if (!methodName) throw new require_http.BitfabError(
|
|
5913
|
+
if (!methodName) throw new require_http.BitfabError(anonymousError);
|
|
5946
5914
|
const wrappedFn = async (...args) => {
|
|
5947
5915
|
const span = getCurrentSpan();
|
|
5948
5916
|
const startedAt = Date.now();
|
|
5949
|
-
|
|
5917
|
+
if (require_autoTrace.frameworkRecordsClientCall()) {
|
|
5918
|
+
const response = await method(...args);
|
|
5919
|
+
try {
|
|
5920
|
+
options?.onResponse?.(response);
|
|
5921
|
+
} catch {}
|
|
5922
|
+
return response;
|
|
5923
|
+
}
|
|
5924
|
+
const { watch, result } = require_autoTrace.watchClientCall(() => method(...args));
|
|
5950
5925
|
const response = await result;
|
|
5951
|
-
require_autoTrace.
|
|
5926
|
+
require_autoTrace.recordWatchedClientCall(provider, span, watch, args[0], response, Date.now() - startedAt);
|
|
5952
5927
|
try {
|
|
5953
5928
|
options?.onResponse?.(response);
|
|
5954
5929
|
} catch {}
|
|
@@ -6011,7 +5986,7 @@ var Bitfab = class {
|
|
|
6011
5986
|
const seedCtxForTraceId = parentContext ? null : getSeedContext();
|
|
6012
5987
|
const traceId = parentContext?.traceId ?? replayCtxForTraceId?.traceId ?? seedCtxForTraceId?.traceId ?? randomUuid();
|
|
6013
5988
|
const spanId = randomUuid();
|
|
6014
|
-
const openAiAgentsParent = parentContext !== void 0 && options.instrumentation === "trace" ? openAiAgentsParentSpanId(parentContext.traceId, parentContext.openAiAgentsSpanIds) : void 0;
|
|
5989
|
+
const openAiAgentsParent = parentContext !== void 0 && options.instrumentation === "trace" ? require_autoTrace.openAiAgentsParentSpanId(parentContext.traceId, parentContext.openAiAgentsSpanIds) : void 0;
|
|
6015
5990
|
const frameworkParent = parentContext !== void 0 ? options.frameworkParentSpanId : void 0;
|
|
6016
5991
|
const parentSpanId = openAiAgentsParent ?? frameworkParent ?? parentContext?.spanId ?? null;
|
|
6017
5992
|
const isRootSpan = parentSpanId === null;
|
|
@@ -6022,7 +5997,7 @@ var Bitfab = class {
|
|
|
6022
5997
|
const requestedSurface = options.surface ?? "opt-in";
|
|
6023
5998
|
const surface = resolveSurface(requestedSurface, parentContext?.surface);
|
|
6024
5999
|
assertSurfacesCompatible(requestedSurface, surface, parentContext?.surface, traceFunctionKey);
|
|
6025
|
-
const openAiAgentsSpanIds = openAiAgentsSpanChain();
|
|
6000
|
+
const openAiAgentsSpanIds = require_autoTrace.openAiAgentsSpanChain();
|
|
6026
6001
|
const functionNameAtOpen = fn.name !== "" ? fn.name : void 0;
|
|
6027
6002
|
const newContext = {
|
|
6028
6003
|
traceId,
|
|
@@ -6598,7 +6573,7 @@ var Bitfab = class {
|
|
|
6598
6573
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
6599
6574
|
} finally {
|
|
6600
6575
|
try {
|
|
6601
|
-
const { flushTraces } = await Promise.resolve().then(() => require("./http-
|
|
6576
|
+
const { flushTraces } = await Promise.resolve().then(() => require("./http-CARmid5D.cjs")).then((n) => n.http_exports);
|
|
6602
6577
|
await flushTraces(3e4);
|
|
6603
6578
|
} finally {
|
|
6604
6579
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -6693,6 +6668,12 @@ var BitfabFunction = class {
|
|
|
6693
6668
|
wrapOpenRouter(method, options) {
|
|
6694
6669
|
return this.client.wrapOpenRouter(method, options);
|
|
6695
6670
|
}
|
|
6671
|
+
wrapAnthropic(method, options) {
|
|
6672
|
+
return this.client.wrapAnthropic(method, options);
|
|
6673
|
+
}
|
|
6674
|
+
wrapOpenAIResponses(method, options) {
|
|
6675
|
+
return this.client.wrapOpenAIResponses(method, options);
|
|
6676
|
+
}
|
|
6696
6677
|
};
|
|
6697
6678
|
//#endregion
|
|
6698
6679
|
//#region src/finalizers.ts
|
|
@@ -6795,7 +6776,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
6795
6776
|
metadata: seedCase.metadata,
|
|
6796
6777
|
sessionId: seedCase.sessionId
|
|
6797
6778
|
}));
|
|
6798
|
-
const { flushTraces } = await Promise.resolve().then(() => require("./http-
|
|
6779
|
+
const { flushTraces } = await Promise.resolve().then(() => require("./http-CARmid5D.cjs")).then((n) => n.http_exports);
|
|
6799
6780
|
await flushTraces(3e4);
|
|
6800
6781
|
return {
|
|
6801
6782
|
pipeline,
|
|
@@ -7039,4 +7020,4 @@ Object.defineProperty(exports, "serializeReplayResult", {
|
|
|
7039
7020
|
}
|
|
7040
7021
|
});
|
|
7041
7022
|
|
|
7042
|
-
//# sourceMappingURL=src-
|
|
7023
|
+
//# sourceMappingURL=src-C3H1v_hp.cjs.map
|