@bitfab/sdk 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
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
SUPPORTED_PROVIDERS,
|
|
9
9
|
getCurrentSpan,
|
|
10
10
|
getCurrentTrace
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RMQX546G.js";
|
|
12
12
|
import {
|
|
13
13
|
BitfabError,
|
|
14
14
|
DEFAULT_SERVICE_URL,
|
|
15
15
|
__version__,
|
|
16
16
|
flushTraces
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OW2EJK7T.js";
|
|
18
18
|
export {
|
|
19
19
|
Bitfab,
|
|
20
20
|
BitfabClaudeAgentHandler,
|
package/dist/node.cjs
CHANGED
|
@@ -81,7 +81,7 @@ var __version__;
|
|
|
81
81
|
var init_version_generated = __esm({
|
|
82
82
|
"src/version.generated.ts"() {
|
|
83
83
|
"use strict";
|
|
84
|
-
__version__ = "0.
|
|
84
|
+
__version__ = "0.14.0";
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
|
|
@@ -188,7 +188,9 @@ var init_http = __esm({
|
|
|
188
188
|
)
|
|
189
189
|
),
|
|
190
190
|
rawSpan: {},
|
|
191
|
-
errors: [
|
|
191
|
+
errors: [
|
|
192
|
+
{ source: "sdk", step: "json_serialize", error: serializationError }
|
|
193
|
+
]
|
|
192
194
|
});
|
|
193
195
|
}
|
|
194
196
|
try {
|
|
@@ -313,7 +315,10 @@ var init_http = __esm({
|
|
|
313
315
|
* Blocking call — creates a test run and returns lightweight item references.
|
|
314
316
|
*/
|
|
315
317
|
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
|
|
316
|
-
const payload = { traceFunctionKey
|
|
318
|
+
const payload = { traceFunctionKey };
|
|
319
|
+
if (limit !== void 0) {
|
|
320
|
+
payload.limit = limit;
|
|
321
|
+
}
|
|
317
322
|
if (traceIds) {
|
|
318
323
|
payload.traceIds = traceIds;
|
|
319
324
|
}
|
|
@@ -655,6 +660,21 @@ async function mapWithConcurrency(tasks, maxConcurrency) {
|
|
|
655
660
|
return results;
|
|
656
661
|
}
|
|
657
662
|
async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
663
|
+
if (options?.traceIds !== void 0) {
|
|
664
|
+
if (options.traceIds.length === 0) {
|
|
665
|
+
throw new BitfabError("traceIds must contain at least one trace ID.");
|
|
666
|
+
}
|
|
667
|
+
if (options.traceIds.length > 100) {
|
|
668
|
+
throw new BitfabError(
|
|
669
|
+
`traceIds supports at most 100 trace IDs per replay (got ${options.traceIds.length}).`
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if (options?.limit !== void 0 && options?.traceIds !== void 0) {
|
|
674
|
+
throw new BitfabError(
|
|
675
|
+
"Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
|
|
676
|
+
);
|
|
677
|
+
}
|
|
658
678
|
await replayContextReady;
|
|
659
679
|
const {
|
|
660
680
|
testRunId,
|
|
@@ -662,7 +682,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
662
682
|
items: serverItems
|
|
663
683
|
} = await httpClient.startReplay(
|
|
664
684
|
traceFunctionKey,
|
|
665
|
-
|
|
685
|
+
// limit is meaningless with explicit traceIds (the ID list determines
|
|
686
|
+
// the count), so it's omitted from the request entirely.
|
|
687
|
+
options?.traceIds ? void 0 : options?.limit ?? 5,
|
|
666
688
|
options?.traceIds,
|
|
667
689
|
options?.codeChangeDescription,
|
|
668
690
|
options?.codeChangeFiles,
|
|
@@ -708,6 +730,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
708
730
|
var init_replay = __esm({
|
|
709
731
|
"src/replay.ts"() {
|
|
710
732
|
"use strict";
|
|
733
|
+
init_errors();
|
|
711
734
|
init_http();
|
|
712
735
|
init_replayContext();
|
|
713
736
|
init_serialize();
|
|
@@ -2182,6 +2205,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2182
2205
|
const jsonResult = span.toJSON();
|
|
2183
2206
|
if (typeof jsonResult !== "object" || jsonResult === null) {
|
|
2184
2207
|
errors.push({
|
|
2208
|
+
source: "sdk",
|
|
2185
2209
|
step: "span.toJSON()",
|
|
2186
2210
|
error: `Returned unexpected type: ${typeof jsonResult}`
|
|
2187
2211
|
});
|
|
@@ -2191,6 +2215,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2191
2215
|
}
|
|
2192
2216
|
} catch (error) {
|
|
2193
2217
|
errors.push({
|
|
2218
|
+
source: "sdk",
|
|
2194
2219
|
step: "span.toJSON()",
|
|
2195
2220
|
error: error instanceof Error ? error.message : String(error)
|
|
2196
2221
|
});
|
|
@@ -2210,6 +2235,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2210
2235
|
spanData.input = span.spanData?._input || [];
|
|
2211
2236
|
} catch (error) {
|
|
2212
2237
|
errors.push({
|
|
2238
|
+
source: "sdk",
|
|
2213
2239
|
step: "access_input",
|
|
2214
2240
|
error: error instanceof Error ? error.message : String(error)
|
|
2215
2241
|
});
|
|
@@ -2218,6 +2244,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2218
2244
|
spanData.response = span.spanData?._response || null;
|
|
2219
2245
|
} catch (error) {
|
|
2220
2246
|
errors.push({
|
|
2247
|
+
source: "sdk",
|
|
2221
2248
|
step: "access_response",
|
|
2222
2249
|
error: error instanceof Error ? error.message : String(error)
|
|
2223
2250
|
});
|
|
@@ -3146,7 +3173,10 @@ var Bitfab = class {
|
|
|
3146
3173
|
...params.functionName !== void 0 && {
|
|
3147
3174
|
function_name: params.functionName
|
|
3148
3175
|
},
|
|
3149
|
-
...params.error !== void 0 && {
|
|
3176
|
+
...params.error !== void 0 && {
|
|
3177
|
+
error: params.error,
|
|
3178
|
+
error_source: "code"
|
|
3179
|
+
},
|
|
3150
3180
|
...params.contexts && params.contexts.length > 0 && {
|
|
3151
3181
|
contexts: params.contexts
|
|
3152
3182
|
},
|
|
@@ -3179,7 +3209,9 @@ var Bitfab = class {
|
|
|
3179
3209
|
*
|
|
3180
3210
|
* @param traceFunctionKey - The trace function key to replay
|
|
3181
3211
|
* @param fn - The function to replay (must be the return value of `withSpan`)
|
|
3182
|
-
* @param options - Optional replay options
|
|
3212
|
+
* @param options - Optional replay options. `limit` and `traceIds` are
|
|
3213
|
+
* mutually exclusive — an explicit ID list already determines how many
|
|
3214
|
+
* traces replay, so passing both throws a BitfabError.
|
|
3183
3215
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
3184
3216
|
*/
|
|
3185
3217
|
async replay(traceFunctionKey, fn, options) {
|