bitfab 0.17.0 → 0.18.0
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-M6N633CX.js → chunk-S3YLZ47O.js} +26 -6
- package/dist/{chunk-M6N633CX.js.map → chunk-S3YLZ47O.js.map} +1 -1
- package/dist/index.cjs +25 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +1 -1
- package/dist/node.cjs +25 -5
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-QT7HWOKU.js";
|
|
10
10
|
|
|
11
11
|
// src/version.generated.ts
|
|
12
|
-
var __version__ = "0.
|
|
12
|
+
var __version__ = "0.18.0";
|
|
13
13
|
|
|
14
14
|
// src/constants.ts
|
|
15
15
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -2629,6 +2629,9 @@ var Bitfab = class {
|
|
|
2629
2629
|
};
|
|
2630
2630
|
return runWithSpanStack(newStack, executeWithContext);
|
|
2631
2631
|
};
|
|
2632
|
+
Object.defineProperty(wrappedFn, "_bitfabTraceFunctionKey", {
|
|
2633
|
+
value: traceFunctionKey
|
|
2634
|
+
});
|
|
2632
2635
|
return wrappedFn;
|
|
2633
2636
|
}
|
|
2634
2637
|
/**
|
|
@@ -2800,23 +2803,40 @@ var Bitfab = class {
|
|
|
2800
2803
|
* Fetches the last N traces for the given trace function key, re-runs each
|
|
2801
2804
|
* through the provided function, and returns comparison data.
|
|
2802
2805
|
*
|
|
2803
|
-
*
|
|
2804
|
-
*
|
|
2806
|
+
* Accepts either a `withSpan`-wrapped function (under the same key) or any
|
|
2807
|
+
* plain callable: plain callables are wrapped internally so each replayed
|
|
2808
|
+
* invocation records a trace tied to the test run. The plain-callable form
|
|
2809
|
+
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
2810
|
+
* SDK) replay — those record traces under a key with no `withSpan`-wrapped
|
|
2811
|
+
* root in the app.
|
|
2805
2812
|
*
|
|
2806
2813
|
* @param traceFunctionKey - The trace function key to replay
|
|
2807
|
-
* @param fn - The function to
|
|
2814
|
+
* @param fn - The function to run recorded inputs through
|
|
2808
2815
|
* @param options - Optional replay options. When `traceIds` is passed,
|
|
2809
2816
|
* `limit` is ignored (with a warning): an explicit ID list already
|
|
2810
2817
|
* determines how many traces replay.
|
|
2811
2818
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
2812
2819
|
*/
|
|
2813
2820
|
async replay(traceFunctionKey, fn, options) {
|
|
2821
|
+
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
2822
|
+
let replayFn = fn;
|
|
2823
|
+
if (wrappedKey === void 0) {
|
|
2824
|
+
replayFn = this.withSpan(
|
|
2825
|
+
traceFunctionKey,
|
|
2826
|
+
{ name: fn.name || "Replay", type: "agent" },
|
|
2827
|
+
fn
|
|
2828
|
+
);
|
|
2829
|
+
} else if (wrappedKey !== traceFunctionKey) {
|
|
2830
|
+
throw new BitfabError(
|
|
2831
|
+
`Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
|
|
2832
|
+
);
|
|
2833
|
+
}
|
|
2814
2834
|
const { replay: doReplay } = await import("./replay-BIPIDXX6.js");
|
|
2815
2835
|
return doReplay(
|
|
2816
2836
|
this.httpClient,
|
|
2817
2837
|
this.serviceUrl,
|
|
2818
2838
|
traceFunctionKey,
|
|
2819
|
-
|
|
2839
|
+
replayFn,
|
|
2820
2840
|
options
|
|
2821
2841
|
);
|
|
2822
2842
|
}
|
|
@@ -2890,4 +2910,4 @@ export {
|
|
|
2890
2910
|
Bitfab,
|
|
2891
2911
|
BitfabFunction
|
|
2892
2912
|
};
|
|
2893
|
-
//# sourceMappingURL=chunk-
|
|
2913
|
+
//# sourceMappingURL=chunk-S3YLZ47O.js.map
|