bitfab 0.22.0 → 0.23.1
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-4SLFC266.js → chunk-2EDITKO2.js} +18 -5
- package/dist/chunk-2EDITKO2.js.map +1 -0
- package/dist/index.cjs +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/dist/node.cjs +17 -4
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4SLFC266.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -500,7 +500,7 @@ __export(index_exports, {
|
|
|
500
500
|
module.exports = __toCommonJS(index_exports);
|
|
501
501
|
|
|
502
502
|
// src/version.generated.ts
|
|
503
|
-
var __version__ = "0.
|
|
503
|
+
var __version__ = "0.23.1";
|
|
504
504
|
|
|
505
505
|
// src/constants.ts
|
|
506
506
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -1951,8 +1951,9 @@ function extractLangGraphMetadata(metadata) {
|
|
|
1951
1951
|
var BitfabLangGraphCallbackHandler = class {
|
|
1952
1952
|
constructor(config) {
|
|
1953
1953
|
this.name = "BitfabLangGraphCallbackHandler";
|
|
1954
|
-
this.ignoreRetriever = true;
|
|
1955
1954
|
this.ignoreRetry = true;
|
|
1955
|
+
// Retriever callbacks ARE captured (retriever queries -> function spans).
|
|
1956
|
+
this.ignoreRetriever = false;
|
|
1956
1957
|
this.ignoreCustomEvent = true;
|
|
1957
1958
|
this.runToSpan = /* @__PURE__ */ new Map();
|
|
1958
1959
|
this.invocations = /* @__PURE__ */ new Map();
|
|
@@ -2287,9 +2288,17 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2287
2288
|
constructor(config) {
|
|
2288
2289
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
2289
2290
|
this.withSpanFn = config.withSpan;
|
|
2291
|
+
this.getActiveSpanContext = config.getActiveSpanContext;
|
|
2290
2292
|
}
|
|
2291
2293
|
async wrapRun(agent, input, options) {
|
|
2292
2294
|
const { run } = await import("@openai/agents");
|
|
2295
|
+
if (this.getActiveSpanContext?.() != null) {
|
|
2296
|
+
return run(
|
|
2297
|
+
agent,
|
|
2298
|
+
input,
|
|
2299
|
+
options
|
|
2300
|
+
);
|
|
2301
|
+
}
|
|
2293
2302
|
const isStreaming = options?.stream === true;
|
|
2294
2303
|
const finalize = async (result) => {
|
|
2295
2304
|
const res = result;
|
|
@@ -3033,7 +3042,11 @@ var Bitfab = class {
|
|
|
3033
3042
|
getOpenAiAgentHandler(traceFunctionKey) {
|
|
3034
3043
|
return new BitfabOpenAIAgentHandler({
|
|
3035
3044
|
traceFunctionKey,
|
|
3036
|
-
withSpan: this.withSpan.bind(this)
|
|
3045
|
+
withSpan: this.withSpan.bind(this),
|
|
3046
|
+
getActiveSpanContext: () => {
|
|
3047
|
+
const stack = getSpanStack();
|
|
3048
|
+
return stack[stack.length - 1] ?? null;
|
|
3049
|
+
}
|
|
3037
3050
|
});
|
|
3038
3051
|
}
|
|
3039
3052
|
/**
|
|
@@ -3658,7 +3671,7 @@ var Bitfab = class {
|
|
|
3658
3671
|
if (wrappedKey === void 0) {
|
|
3659
3672
|
replayFn = this.withSpan(
|
|
3660
3673
|
traceFunctionKey,
|
|
3661
|
-
{ name:
|
|
3674
|
+
{ name: traceFunctionKey, type: "agent" },
|
|
3662
3675
|
fn
|
|
3663
3676
|
);
|
|
3664
3677
|
} else if (wrappedKey !== traceFunctionKey) {
|