@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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-EQI6ZJC3.js";
|
|
11
11
|
|
|
12
12
|
// src/version.generated.ts
|
|
13
|
-
var __version__ = "0.23.
|
|
13
|
+
var __version__ = "0.23.1";
|
|
14
14
|
|
|
15
15
|
// src/constants.ts
|
|
16
16
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -1791,9 +1791,17 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
1791
1791
|
constructor(config) {
|
|
1792
1792
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
1793
1793
|
this.withSpanFn = config.withSpan;
|
|
1794
|
+
this.getActiveSpanContext = config.getActiveSpanContext;
|
|
1794
1795
|
}
|
|
1795
1796
|
async wrapRun(agent, input, options) {
|
|
1796
1797
|
const { run } = await import("@openai/agents");
|
|
1798
|
+
if (this.getActiveSpanContext?.() != null) {
|
|
1799
|
+
return run(
|
|
1800
|
+
agent,
|
|
1801
|
+
input,
|
|
1802
|
+
options
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
1797
1805
|
const isStreaming = options?.stream === true;
|
|
1798
1806
|
const finalize = async (result) => {
|
|
1799
1807
|
const res = result;
|
|
@@ -2530,7 +2538,11 @@ var Bitfab = class {
|
|
|
2530
2538
|
getOpenAiAgentHandler(traceFunctionKey) {
|
|
2531
2539
|
return new BitfabOpenAIAgentHandler({
|
|
2532
2540
|
traceFunctionKey,
|
|
2533
|
-
withSpan: this.withSpan.bind(this)
|
|
2541
|
+
withSpan: this.withSpan.bind(this),
|
|
2542
|
+
getActiveSpanContext: () => {
|
|
2543
|
+
const stack = getSpanStack();
|
|
2544
|
+
return stack[stack.length - 1] ?? null;
|
|
2545
|
+
}
|
|
2534
2546
|
});
|
|
2535
2547
|
}
|
|
2536
2548
|
/**
|
|
@@ -3155,7 +3167,7 @@ var Bitfab = class {
|
|
|
3155
3167
|
if (wrappedKey === void 0) {
|
|
3156
3168
|
replayFn = this.withSpan(
|
|
3157
3169
|
traceFunctionKey,
|
|
3158
|
-
{ name:
|
|
3170
|
+
{ name: traceFunctionKey, type: "agent" },
|
|
3159
3171
|
fn
|
|
3160
3172
|
);
|
|
3161
3173
|
} else if (wrappedKey !== traceFunctionKey) {
|
|
@@ -3292,4 +3304,4 @@ export {
|
|
|
3292
3304
|
BitfabFunction,
|
|
3293
3305
|
finalizers
|
|
3294
3306
|
};
|
|
3295
|
-
//# sourceMappingURL=chunk-
|
|
3307
|
+
//# sourceMappingURL=chunk-2EDITKO2.js.map
|