@bitfab/sdk 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
|
@@ -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.23.
|
|
494
|
+
var __version__ = "0.23.1";
|
|
495
495
|
|
|
496
496
|
// src/constants.ts
|
|
497
497
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -2279,9 +2279,17 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2279
2279
|
constructor(config) {
|
|
2280
2280
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
2281
2281
|
this.withSpanFn = config.withSpan;
|
|
2282
|
+
this.getActiveSpanContext = config.getActiveSpanContext;
|
|
2282
2283
|
}
|
|
2283
2284
|
async wrapRun(agent, input, options) {
|
|
2284
2285
|
const { run } = await import("@openai/agents");
|
|
2286
|
+
if (this.getActiveSpanContext?.() != null) {
|
|
2287
|
+
return run(
|
|
2288
|
+
agent,
|
|
2289
|
+
input,
|
|
2290
|
+
options
|
|
2291
|
+
);
|
|
2292
|
+
}
|
|
2285
2293
|
const isStreaming = options?.stream === true;
|
|
2286
2294
|
const finalize = async (result) => {
|
|
2287
2295
|
const res = result;
|
|
@@ -3025,7 +3033,11 @@ var Bitfab = class {
|
|
|
3025
3033
|
getOpenAiAgentHandler(traceFunctionKey) {
|
|
3026
3034
|
return new BitfabOpenAIAgentHandler({
|
|
3027
3035
|
traceFunctionKey,
|
|
3028
|
-
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
|
+
}
|
|
3029
3041
|
});
|
|
3030
3042
|
}
|
|
3031
3043
|
/**
|
|
@@ -3650,7 +3662,7 @@ var Bitfab = class {
|
|
|
3650
3662
|
if (wrappedKey === void 0) {
|
|
3651
3663
|
replayFn = this.withSpan(
|
|
3652
3664
|
traceFunctionKey,
|
|
3653
|
-
{ name:
|
|
3665
|
+
{ name: traceFunctionKey, type: "agent" },
|
|
3654
3666
|
fn
|
|
3655
3667
|
);
|
|
3656
3668
|
} else if (wrappedKey !== traceFunctionKey) {
|