bitfab 0.13.7 → 0.14.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-EGRWBJYR.js → chunk-OW2EJK7T.js} +9 -4
- package/dist/chunk-OW2EJK7T.js.map +1 -0
- package/dist/{chunk-LUZVIGER.js → chunk-RMQX546G.js} +14 -5
- package/dist/chunk-RMQX546G.js.map +1 -0
- package/dist/index.cjs +38 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +2 -2
- package/dist/node.cjs +38 -6
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-VXZJBR34.js → replay-LNP2K3DN.js} +21 -3
- package/dist/replay-LNP2K3DN.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-EGRWBJYR.js.map +0 -1
- package/dist/chunk-LUZVIGER.js.map +0 -1
- package/dist/replay-VXZJBR34.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -342,9 +342,13 @@ declare class ReplayEnvironment {
|
|
|
342
342
|
|
|
343
343
|
type MockStrategy = "none" | "all" | "marked";
|
|
344
344
|
interface ReplayOptions {
|
|
345
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* Maximum number of traces to replay (1–100, default 5). Mutually
|
|
347
|
+
* exclusive with `traceIds` — an explicit ID list already determines how
|
|
348
|
+
* many traces replay, so passing both throws.
|
|
349
|
+
*/
|
|
346
350
|
limit?: number;
|
|
347
|
-
/** Optional list of specific trace IDs to replay. */
|
|
351
|
+
/** Optional list of specific trace IDs to replay (max 100). */
|
|
348
352
|
traceIds?: string[];
|
|
349
353
|
/** Maximum number of items to process in parallel. Set to 1 for sequential. Default 10. */
|
|
350
354
|
maxConcurrency?: number;
|
|
@@ -916,18 +920,12 @@ declare class Bitfab {
|
|
|
916
920
|
*
|
|
917
921
|
* @param traceFunctionKey - The trace function key to replay
|
|
918
922
|
* @param fn - The function to replay (must be the return value of `withSpan`)
|
|
919
|
-
* @param options - Optional replay options
|
|
923
|
+
* @param options - Optional replay options. `limit` and `traceIds` are
|
|
924
|
+
* mutually exclusive — an explicit ID list already determines how many
|
|
925
|
+
* traces replay, so passing both throws a BitfabError.
|
|
920
926
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
921
927
|
*/
|
|
922
|
-
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?:
|
|
923
|
-
limit?: number;
|
|
924
|
-
traceIds?: string[];
|
|
925
|
-
maxConcurrency?: number;
|
|
926
|
-
codeChangeDescription?: string;
|
|
927
|
-
codeChangeFiles?: CodeChangeFile[];
|
|
928
|
-
mock?: "none" | "all" | "marked";
|
|
929
|
-
environment?: ReplayEnvironment;
|
|
930
|
-
}): Promise<ReplayResult<TReturn>>;
|
|
928
|
+
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
931
929
|
}
|
|
932
930
|
/**
|
|
933
931
|
* Represents a Bitfab function that can wrap user functions for tracing.
|
|
@@ -990,7 +988,7 @@ declare class BitfabFunction {
|
|
|
990
988
|
/**
|
|
991
989
|
* SDK version from package.json (injected at build time)
|
|
992
990
|
*/
|
|
993
|
-
declare const __version__ = "0.
|
|
991
|
+
declare const __version__ = "0.14.0";
|
|
994
992
|
|
|
995
993
|
/**
|
|
996
994
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -342,9 +342,13 @@ declare class ReplayEnvironment {
|
|
|
342
342
|
|
|
343
343
|
type MockStrategy = "none" | "all" | "marked";
|
|
344
344
|
interface ReplayOptions {
|
|
345
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* Maximum number of traces to replay (1–100, default 5). Mutually
|
|
347
|
+
* exclusive with `traceIds` — an explicit ID list already determines how
|
|
348
|
+
* many traces replay, so passing both throws.
|
|
349
|
+
*/
|
|
346
350
|
limit?: number;
|
|
347
|
-
/** Optional list of specific trace IDs to replay. */
|
|
351
|
+
/** Optional list of specific trace IDs to replay (max 100). */
|
|
348
352
|
traceIds?: string[];
|
|
349
353
|
/** Maximum number of items to process in parallel. Set to 1 for sequential. Default 10. */
|
|
350
354
|
maxConcurrency?: number;
|
|
@@ -916,18 +920,12 @@ declare class Bitfab {
|
|
|
916
920
|
*
|
|
917
921
|
* @param traceFunctionKey - The trace function key to replay
|
|
918
922
|
* @param fn - The function to replay (must be the return value of `withSpan`)
|
|
919
|
-
* @param options - Optional replay options
|
|
923
|
+
* @param options - Optional replay options. `limit` and `traceIds` are
|
|
924
|
+
* mutually exclusive — an explicit ID list already determines how many
|
|
925
|
+
* traces replay, so passing both throws a BitfabError.
|
|
920
926
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
921
927
|
*/
|
|
922
|
-
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?:
|
|
923
|
-
limit?: number;
|
|
924
|
-
traceIds?: string[];
|
|
925
|
-
maxConcurrency?: number;
|
|
926
|
-
codeChangeDescription?: string;
|
|
927
|
-
codeChangeFiles?: CodeChangeFile[];
|
|
928
|
-
mock?: "none" | "all" | "marked";
|
|
929
|
-
environment?: ReplayEnvironment;
|
|
930
|
-
}): Promise<ReplayResult<TReturn>>;
|
|
928
|
+
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
931
929
|
}
|
|
932
930
|
/**
|
|
933
931
|
* Represents a Bitfab function that can wrap user functions for tracing.
|
|
@@ -990,7 +988,7 @@ declare class BitfabFunction {
|
|
|
990
988
|
/**
|
|
991
989
|
* SDK version from package.json (injected at build time)
|
|
992
990
|
*/
|
|
993
|
-
declare const __version__ = "0.
|
|
991
|
+
declare const __version__ = "0.14.0";
|
|
994
992
|
|
|
995
993
|
/**
|
|
996
994
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
SUPPORTED_PROVIDERS,
|
|
18
18
|
getCurrentSpan,
|
|
19
19
|
getCurrentTrace
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RMQX546G.js";
|
|
21
21
|
import {
|
|
22
22
|
BitfabError,
|
|
23
23
|
DEFAULT_SERVICE_URL,
|
|
24
24
|
__version__,
|
|
25
25
|
flushTraces
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OW2EJK7T.js";
|
|
27
27
|
export {
|
|
28
28
|
Bitfab,
|
|
29
29
|
BitfabClaudeAgentHandler,
|
package/dist/node.cjs
CHANGED
|
@@ -90,7 +90,7 @@ var __version__;
|
|
|
90
90
|
var init_version_generated = __esm({
|
|
91
91
|
"src/version.generated.ts"() {
|
|
92
92
|
"use strict";
|
|
93
|
-
__version__ = "0.
|
|
93
|
+
__version__ = "0.14.0";
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
|
|
@@ -197,7 +197,9 @@ var init_http = __esm({
|
|
|
197
197
|
)
|
|
198
198
|
),
|
|
199
199
|
rawSpan: {},
|
|
200
|
-
errors: [
|
|
200
|
+
errors: [
|
|
201
|
+
{ source: "sdk", step: "json_serialize", error: serializationError }
|
|
202
|
+
]
|
|
201
203
|
});
|
|
202
204
|
}
|
|
203
205
|
try {
|
|
@@ -322,7 +324,10 @@ var init_http = __esm({
|
|
|
322
324
|
* Blocking call — creates a test run and returns lightweight item references.
|
|
323
325
|
*/
|
|
324
326
|
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
|
|
325
|
-
const payload = { traceFunctionKey
|
|
327
|
+
const payload = { traceFunctionKey };
|
|
328
|
+
if (limit !== void 0) {
|
|
329
|
+
payload.limit = limit;
|
|
330
|
+
}
|
|
326
331
|
if (traceIds) {
|
|
327
332
|
payload.traceIds = traceIds;
|
|
328
333
|
}
|
|
@@ -664,6 +669,21 @@ async function mapWithConcurrency(tasks, maxConcurrency) {
|
|
|
664
669
|
return results;
|
|
665
670
|
}
|
|
666
671
|
async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
672
|
+
if (options?.traceIds !== void 0) {
|
|
673
|
+
if (options.traceIds.length === 0) {
|
|
674
|
+
throw new BitfabError("traceIds must contain at least one trace ID.");
|
|
675
|
+
}
|
|
676
|
+
if (options.traceIds.length > 100) {
|
|
677
|
+
throw new BitfabError(
|
|
678
|
+
`traceIds supports at most 100 trace IDs per replay (got ${options.traceIds.length}).`
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
if (options?.limit !== void 0 && options?.traceIds !== void 0) {
|
|
683
|
+
throw new BitfabError(
|
|
684
|
+
"Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
|
|
685
|
+
);
|
|
686
|
+
}
|
|
667
687
|
await replayContextReady;
|
|
668
688
|
const {
|
|
669
689
|
testRunId,
|
|
@@ -671,7 +691,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
671
691
|
items: serverItems
|
|
672
692
|
} = await httpClient.startReplay(
|
|
673
693
|
traceFunctionKey,
|
|
674
|
-
|
|
694
|
+
// limit is meaningless with explicit traceIds (the ID list determines
|
|
695
|
+
// the count), so it's omitted from the request entirely.
|
|
696
|
+
options?.traceIds ? void 0 : options?.limit ?? 5,
|
|
675
697
|
options?.traceIds,
|
|
676
698
|
options?.codeChangeDescription,
|
|
677
699
|
options?.codeChangeFiles,
|
|
@@ -717,6 +739,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
717
739
|
var init_replay = __esm({
|
|
718
740
|
"src/replay.ts"() {
|
|
719
741
|
"use strict";
|
|
742
|
+
init_errors();
|
|
720
743
|
init_http();
|
|
721
744
|
init_replayContext();
|
|
722
745
|
init_serialize();
|
|
@@ -2191,6 +2214,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2191
2214
|
const jsonResult = span.toJSON();
|
|
2192
2215
|
if (typeof jsonResult !== "object" || jsonResult === null) {
|
|
2193
2216
|
errors.push({
|
|
2217
|
+
source: "sdk",
|
|
2194
2218
|
step: "span.toJSON()",
|
|
2195
2219
|
error: `Returned unexpected type: ${typeof jsonResult}`
|
|
2196
2220
|
});
|
|
@@ -2200,6 +2224,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2200
2224
|
}
|
|
2201
2225
|
} catch (error) {
|
|
2202
2226
|
errors.push({
|
|
2227
|
+
source: "sdk",
|
|
2203
2228
|
step: "span.toJSON()",
|
|
2204
2229
|
error: error instanceof Error ? error.message : String(error)
|
|
2205
2230
|
});
|
|
@@ -2219,6 +2244,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2219
2244
|
spanData.input = span.spanData?._input || [];
|
|
2220
2245
|
} catch (error) {
|
|
2221
2246
|
errors.push({
|
|
2247
|
+
source: "sdk",
|
|
2222
2248
|
step: "access_input",
|
|
2223
2249
|
error: error instanceof Error ? error.message : String(error)
|
|
2224
2250
|
});
|
|
@@ -2227,6 +2253,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2227
2253
|
spanData.response = span.spanData?._response || null;
|
|
2228
2254
|
} catch (error) {
|
|
2229
2255
|
errors.push({
|
|
2256
|
+
source: "sdk",
|
|
2230
2257
|
step: "access_response",
|
|
2231
2258
|
error: error instanceof Error ? error.message : String(error)
|
|
2232
2259
|
});
|
|
@@ -3155,7 +3182,10 @@ var Bitfab = class {
|
|
|
3155
3182
|
...params.functionName !== void 0 && {
|
|
3156
3183
|
function_name: params.functionName
|
|
3157
3184
|
},
|
|
3158
|
-
...params.error !== void 0 && {
|
|
3185
|
+
...params.error !== void 0 && {
|
|
3186
|
+
error: params.error,
|
|
3187
|
+
error_source: "code"
|
|
3188
|
+
},
|
|
3159
3189
|
...params.contexts && params.contexts.length > 0 && {
|
|
3160
3190
|
contexts: params.contexts
|
|
3161
3191
|
},
|
|
@@ -3188,7 +3218,9 @@ var Bitfab = class {
|
|
|
3188
3218
|
*
|
|
3189
3219
|
* @param traceFunctionKey - The trace function key to replay
|
|
3190
3220
|
* @param fn - The function to replay (must be the return value of `withSpan`)
|
|
3191
|
-
* @param options - Optional replay options
|
|
3221
|
+
* @param options - Optional replay options. `limit` and `traceIds` are
|
|
3222
|
+
* mutually exclusive — an explicit ID list already determines how many
|
|
3223
|
+
* traces replay, so passing both throws a BitfabError.
|
|
3192
3224
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
3193
3225
|
*/
|
|
3194
3226
|
async replay(traceFunctionKey, fn, options) {
|