@bitfab/sdk 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
package/dist/index.d.cts
CHANGED
|
@@ -978,11 +978,15 @@ declare class Bitfab {
|
|
|
978
978
|
* Fetches the last N traces for the given trace function key, re-runs each
|
|
979
979
|
* through the provided function, and returns comparison data.
|
|
980
980
|
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
981
|
+
* Accepts either a `withSpan`-wrapped function (under the same key) or any
|
|
982
|
+
* plain callable: plain callables are wrapped internally so each replayed
|
|
983
|
+
* invocation records a trace tied to the test run. The plain-callable form
|
|
984
|
+
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
985
|
+
* SDK) replay — those record traces under a key with no `withSpan`-wrapped
|
|
986
|
+
* root in the app.
|
|
983
987
|
*
|
|
984
988
|
* @param traceFunctionKey - The trace function key to replay
|
|
985
|
-
* @param fn - The function to
|
|
989
|
+
* @param fn - The function to run recorded inputs through
|
|
986
990
|
* @param options - Optional replay options. When `traceIds` is passed,
|
|
987
991
|
* `limit` is ignored (with a warning): an explicit ID list already
|
|
988
992
|
* determines how many traces replay.
|
|
@@ -1051,7 +1055,7 @@ declare class BitfabFunction {
|
|
|
1051
1055
|
/**
|
|
1052
1056
|
* SDK version from package.json (injected at build time)
|
|
1053
1057
|
*/
|
|
1054
|
-
declare const __version__ = "0.
|
|
1058
|
+
declare const __version__ = "0.18.0";
|
|
1055
1059
|
|
|
1056
1060
|
/**
|
|
1057
1061
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -978,11 +978,15 @@ declare class Bitfab {
|
|
|
978
978
|
* Fetches the last N traces for the given trace function key, re-runs each
|
|
979
979
|
* through the provided function, and returns comparison data.
|
|
980
980
|
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
981
|
+
* Accepts either a `withSpan`-wrapped function (under the same key) or any
|
|
982
|
+
* plain callable: plain callables are wrapped internally so each replayed
|
|
983
|
+
* invocation records a trace tied to the test run. The plain-callable form
|
|
984
|
+
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
985
|
+
* SDK) replay — those record traces under a key with no `withSpan`-wrapped
|
|
986
|
+
* root in the app.
|
|
983
987
|
*
|
|
984
988
|
* @param traceFunctionKey - The trace function key to replay
|
|
985
|
-
* @param fn - The function to
|
|
989
|
+
* @param fn - The function to run recorded inputs through
|
|
986
990
|
* @param options - Optional replay options. When `traceIds` is passed,
|
|
987
991
|
* `limit` is ignored (with a warning): an explicit ID list already
|
|
988
992
|
* determines how many traces replay.
|
|
@@ -1051,7 +1055,7 @@ declare class BitfabFunction {
|
|
|
1051
1055
|
/**
|
|
1052
1056
|
* SDK version from package.json (injected at build time)
|
|
1053
1057
|
*/
|
|
1054
|
-
declare const __version__ = "0.
|
|
1058
|
+
declare const __version__ = "0.18.0";
|
|
1055
1059
|
|
|
1056
1060
|
/**
|
|
1057
1061
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
package/dist/node.cjs
CHANGED
|
@@ -447,7 +447,7 @@ registerAsyncLocalStorageClass(
|
|
|
447
447
|
);
|
|
448
448
|
|
|
449
449
|
// src/version.generated.ts
|
|
450
|
-
var __version__ = "0.
|
|
450
|
+
var __version__ = "0.18.0";
|
|
451
451
|
|
|
452
452
|
// src/constants.ts
|
|
453
453
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -3079,6 +3079,9 @@ var Bitfab = class {
|
|
|
3079
3079
|
};
|
|
3080
3080
|
return runWithSpanStack(newStack, executeWithContext);
|
|
3081
3081
|
};
|
|
3082
|
+
Object.defineProperty(wrappedFn, "_bitfabTraceFunctionKey", {
|
|
3083
|
+
value: traceFunctionKey
|
|
3084
|
+
});
|
|
3082
3085
|
return wrappedFn;
|
|
3083
3086
|
}
|
|
3084
3087
|
/**
|
|
@@ -3250,23 +3253,40 @@ var Bitfab = class {
|
|
|
3250
3253
|
* Fetches the last N traces for the given trace function key, re-runs each
|
|
3251
3254
|
* through the provided function, and returns comparison data.
|
|
3252
3255
|
*
|
|
3253
|
-
*
|
|
3254
|
-
*
|
|
3256
|
+
* Accepts either a `withSpan`-wrapped function (under the same key) or any
|
|
3257
|
+
* plain callable: plain callables are wrapped internally so each replayed
|
|
3258
|
+
* invocation records a trace tied to the test run. The plain-callable form
|
|
3259
|
+
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
3260
|
+
* SDK) replay — those record traces under a key with no `withSpan`-wrapped
|
|
3261
|
+
* root in the app.
|
|
3255
3262
|
*
|
|
3256
3263
|
* @param traceFunctionKey - The trace function key to replay
|
|
3257
|
-
* @param fn - The function to
|
|
3264
|
+
* @param fn - The function to run recorded inputs through
|
|
3258
3265
|
* @param options - Optional replay options. When `traceIds` is passed,
|
|
3259
3266
|
* `limit` is ignored (with a warning): an explicit ID list already
|
|
3260
3267
|
* determines how many traces replay.
|
|
3261
3268
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
3262
3269
|
*/
|
|
3263
3270
|
async replay(traceFunctionKey, fn, options) {
|
|
3271
|
+
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
3272
|
+
let replayFn = fn;
|
|
3273
|
+
if (wrappedKey === void 0) {
|
|
3274
|
+
replayFn = this.withSpan(
|
|
3275
|
+
traceFunctionKey,
|
|
3276
|
+
{ name: fn.name || "Replay", type: "agent" },
|
|
3277
|
+
fn
|
|
3278
|
+
);
|
|
3279
|
+
} else if (wrappedKey !== traceFunctionKey) {
|
|
3280
|
+
throw new BitfabError(
|
|
3281
|
+
`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.`
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3264
3284
|
const { replay: doReplay } = await Promise.resolve().then(() => (init_replay(), replay_exports));
|
|
3265
3285
|
return doReplay(
|
|
3266
3286
|
this.httpClient,
|
|
3267
3287
|
this.serviceUrl,
|
|
3268
3288
|
traceFunctionKey,
|
|
3269
|
-
|
|
3289
|
+
replayFn,
|
|
3270
3290
|
options
|
|
3271
3291
|
);
|
|
3272
3292
|
}
|