@bitfab/sdk 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
|
@@ -491,7 +491,7 @@ __export(index_exports, {
|
|
|
491
491
|
module.exports = __toCommonJS(index_exports);
|
|
492
492
|
|
|
493
493
|
// src/version.generated.ts
|
|
494
|
-
var __version__ = "0.
|
|
494
|
+
var __version__ = "0.23.1";
|
|
495
495
|
|
|
496
496
|
// src/constants.ts
|
|
497
497
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -1942,8 +1942,9 @@ function extractLangGraphMetadata(metadata) {
|
|
|
1942
1942
|
var BitfabLangGraphCallbackHandler = class {
|
|
1943
1943
|
constructor(config) {
|
|
1944
1944
|
this.name = "BitfabLangGraphCallbackHandler";
|
|
1945
|
-
this.ignoreRetriever = true;
|
|
1946
1945
|
this.ignoreRetry = true;
|
|
1946
|
+
// Retriever callbacks ARE captured (retriever queries -> function spans).
|
|
1947
|
+
this.ignoreRetriever = false;
|
|
1947
1948
|
this.ignoreCustomEvent = true;
|
|
1948
1949
|
this.runToSpan = /* @__PURE__ */ new Map();
|
|
1949
1950
|
this.invocations = /* @__PURE__ */ new Map();
|
|
@@ -2278,9 +2279,17 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2278
2279
|
constructor(config) {
|
|
2279
2280
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
2280
2281
|
this.withSpanFn = config.withSpan;
|
|
2282
|
+
this.getActiveSpanContext = config.getActiveSpanContext;
|
|
2281
2283
|
}
|
|
2282
2284
|
async wrapRun(agent, input, options) {
|
|
2283
2285
|
const { run } = await import("@openai/agents");
|
|
2286
|
+
if (this.getActiveSpanContext?.() != null) {
|
|
2287
|
+
return run(
|
|
2288
|
+
agent,
|
|
2289
|
+
input,
|
|
2290
|
+
options
|
|
2291
|
+
);
|
|
2292
|
+
}
|
|
2284
2293
|
const isStreaming = options?.stream === true;
|
|
2285
2294
|
const finalize = async (result) => {
|
|
2286
2295
|
const res = result;
|
|
@@ -3024,7 +3033,11 @@ var Bitfab = class {
|
|
|
3024
3033
|
getOpenAiAgentHandler(traceFunctionKey) {
|
|
3025
3034
|
return new BitfabOpenAIAgentHandler({
|
|
3026
3035
|
traceFunctionKey,
|
|
3027
|
-
withSpan: this.withSpan.bind(this)
|
|
3036
|
+
withSpan: this.withSpan.bind(this),
|
|
3037
|
+
getActiveSpanContext: () => {
|
|
3038
|
+
const stack = getSpanStack();
|
|
3039
|
+
return stack[stack.length - 1] ?? null;
|
|
3040
|
+
}
|
|
3028
3041
|
});
|
|
3029
3042
|
}
|
|
3030
3043
|
/**
|
|
@@ -3649,7 +3662,7 @@ var Bitfab = class {
|
|
|
3649
3662
|
if (wrappedKey === void 0) {
|
|
3650
3663
|
replayFn = this.withSpan(
|
|
3651
3664
|
traceFunctionKey,
|
|
3652
|
-
{ name:
|
|
3665
|
+
{ name: traceFunctionKey, type: "agent" },
|
|
3653
3666
|
fn
|
|
3654
3667
|
);
|
|
3655
3668
|
} else if (wrappedKey !== traceFunctionKey) {
|