bitfab 0.23.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-QOPP5TSO.js → chunk-2EDITKO2.js} +16 -4
- package/dist/{chunk-QOPP5TSO.js.map → chunk-2EDITKO2.js.map} +1 -1
- package/dist/index.cjs +15 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +1 -1
- package/dist/node.cjs +15 -3
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -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.23.
|
|
503
|
+
var __version__ = "0.23.1";
|
|
504
504
|
|
|
505
505
|
// src/constants.ts
|
|
506
506
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -2288,9 +2288,17 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2288
2288
|
constructor(config) {
|
|
2289
2289
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
2290
2290
|
this.withSpanFn = config.withSpan;
|
|
2291
|
+
this.getActiveSpanContext = config.getActiveSpanContext;
|
|
2291
2292
|
}
|
|
2292
2293
|
async wrapRun(agent, input, options) {
|
|
2293
2294
|
const { run } = await import("@openai/agents");
|
|
2295
|
+
if (this.getActiveSpanContext?.() != null) {
|
|
2296
|
+
return run(
|
|
2297
|
+
agent,
|
|
2298
|
+
input,
|
|
2299
|
+
options
|
|
2300
|
+
);
|
|
2301
|
+
}
|
|
2294
2302
|
const isStreaming = options?.stream === true;
|
|
2295
2303
|
const finalize = async (result) => {
|
|
2296
2304
|
const res = result;
|
|
@@ -3034,7 +3042,11 @@ var Bitfab = class {
|
|
|
3034
3042
|
getOpenAiAgentHandler(traceFunctionKey) {
|
|
3035
3043
|
return new BitfabOpenAIAgentHandler({
|
|
3036
3044
|
traceFunctionKey,
|
|
3037
|
-
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
|
+
}
|
|
3038
3050
|
});
|
|
3039
3051
|
}
|
|
3040
3052
|
/**
|
|
@@ -3659,7 +3671,7 @@ var Bitfab = class {
|
|
|
3659
3671
|
if (wrappedKey === void 0) {
|
|
3660
3672
|
replayFn = this.withSpan(
|
|
3661
3673
|
traceFunctionKey,
|
|
3662
|
-
{ name:
|
|
3674
|
+
{ name: traceFunctionKey, type: "agent" },
|
|
3663
3675
|
fn
|
|
3664
3676
|
);
|
|
3665
3677
|
} else if (wrappedKey !== traceFunctionKey) {
|