bitfab 0.13.4 → 0.13.6
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-XUW46356.js → chunk-6757PVPS.js} +5 -4
- package/dist/{chunk-XUW46356.js.map → chunk-6757PVPS.js.map} +1 -1
- package/dist/{chunk-SKJWF5VX.js → chunk-TMSVIA5J.js} +6 -3
- package/dist/chunk-TMSVIA5J.js.map +1 -0
- package/dist/index.cjs +20 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +20 -5
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-HGU5YAOK.js → replay-UBXCO6QU.js} +15 -4
- package/dist/replay-UBXCO6QU.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-SKJWF5VX.js.map +0 -1
- package/dist/replay-HGU5YAOK.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -394,8 +394,12 @@ interface ReplayOptions {
|
|
|
394
394
|
* environment to pick up the per-trace branch URL.
|
|
395
395
|
*/
|
|
396
396
|
environment?: ReplayEnvironment;
|
|
397
|
+
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
398
|
+
experimentGroupId?: string;
|
|
397
399
|
}
|
|
398
400
|
interface ReplayItem<T> {
|
|
401
|
+
/** Trace ID of the new trace created during replay. */
|
|
402
|
+
traceId: string | null;
|
|
399
403
|
/** Deserialized inputs from the original trace. */
|
|
400
404
|
input: unknown[];
|
|
401
405
|
/** The result returned by the function during replay, or undefined on error. */
|
|
@@ -1006,7 +1010,7 @@ declare class BitfabFunction {
|
|
|
1006
1010
|
/**
|
|
1007
1011
|
* SDK version from package.json (injected at build time)
|
|
1008
1012
|
*/
|
|
1009
|
-
declare const __version__ = "0.13.
|
|
1013
|
+
declare const __version__ = "0.13.6";
|
|
1010
1014
|
|
|
1011
1015
|
/**
|
|
1012
1016
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -394,8 +394,12 @@ interface ReplayOptions {
|
|
|
394
394
|
* environment to pick up the per-trace branch URL.
|
|
395
395
|
*/
|
|
396
396
|
environment?: ReplayEnvironment;
|
|
397
|
+
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
398
|
+
experimentGroupId?: string;
|
|
397
399
|
}
|
|
398
400
|
interface ReplayItem<T> {
|
|
401
|
+
/** Trace ID of the new trace created during replay. */
|
|
402
|
+
traceId: string | null;
|
|
399
403
|
/** Deserialized inputs from the original trace. */
|
|
400
404
|
input: unknown[];
|
|
401
405
|
/** The result returned by the function during replay, or undefined on error. */
|
|
@@ -1006,7 +1010,7 @@ declare class BitfabFunction {
|
|
|
1006
1010
|
/**
|
|
1007
1011
|
* SDK version from package.json (injected at build time)
|
|
1008
1012
|
*/
|
|
1009
|
-
declare const __version__ = "0.13.
|
|
1013
|
+
declare const __version__ = "0.13.6";
|
|
1010
1014
|
|
|
1011
1015
|
/**
|
|
1012
1016
|
* 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-6757PVPS.js";
|
|
21
21
|
import {
|
|
22
22
|
BitfabError,
|
|
23
23
|
DEFAULT_SERVICE_URL,
|
|
24
24
|
__version__,
|
|
25
25
|
flushTraces
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TMSVIA5J.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.13.
|
|
93
|
+
__version__ = "0.13.6";
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
|
|
@@ -321,7 +321,7 @@ var init_http = __esm({
|
|
|
321
321
|
* Start a replay session by fetching historical traces.
|
|
322
322
|
* Blocking call — creates a test run and returns lightweight item references.
|
|
323
323
|
*/
|
|
324
|
-
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease) {
|
|
324
|
+
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
|
|
325
325
|
const payload = { traceFunctionKey, limit };
|
|
326
326
|
if (traceIds) {
|
|
327
327
|
payload.traceIds = traceIds;
|
|
@@ -335,6 +335,9 @@ var init_http = __esm({
|
|
|
335
335
|
if (includeDbBranchLease) {
|
|
336
336
|
payload.includeDbBranchLease = true;
|
|
337
337
|
}
|
|
338
|
+
if (experimentGroupId !== void 0) {
|
|
339
|
+
payload.experimentGroupId = experimentGroupId;
|
|
340
|
+
}
|
|
338
341
|
const timeout = includeDbBranchLease ? 18e4 : 3e4;
|
|
339
342
|
return this.request("/api/sdk/replay/start", payload, {
|
|
340
343
|
timeout
|
|
@@ -588,6 +591,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
588
591
|
let originalOutput;
|
|
589
592
|
let result;
|
|
590
593
|
let error = null;
|
|
594
|
+
const replayedTraceId = crypto.randomUUID();
|
|
591
595
|
try {
|
|
592
596
|
const span = await httpClient.getExternalSpan(serverItem.externalSpanId);
|
|
593
597
|
const spanData = span.rawData?.span_data ?? {};
|
|
@@ -603,6 +607,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
603
607
|
const maybePromise = runWithReplayContext(
|
|
604
608
|
{
|
|
605
609
|
testRunId,
|
|
610
|
+
traceId: replayedTraceId,
|
|
606
611
|
inputSourceSpanId: span.id,
|
|
607
612
|
inputSourceTraceId: span.externalTraceId,
|
|
608
613
|
sourceBitfabTraceId: serverItem.traceId,
|
|
@@ -631,6 +636,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
631
636
|
}
|
|
632
637
|
}
|
|
633
638
|
return {
|
|
639
|
+
traceId: replayedTraceId,
|
|
634
640
|
input: inputs,
|
|
635
641
|
result,
|
|
636
642
|
originalOutput,
|
|
@@ -669,8 +675,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
669
675
|
options?.traceIds,
|
|
670
676
|
options?.codeChangeDescription,
|
|
671
677
|
options?.codeChangeFiles,
|
|
672
|
-
options?.environment !== void 0
|
|
678
|
+
options?.environment !== void 0,
|
|
673
679
|
// includeDbBranchLease
|
|
680
|
+
options?.experimentGroupId
|
|
674
681
|
);
|
|
675
682
|
const mockStrategy = options?.mock ?? "none";
|
|
676
683
|
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
@@ -686,14 +693,21 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
686
693
|
);
|
|
687
694
|
const resultItems = await mapWithConcurrency(tasks, maxConcurrency);
|
|
688
695
|
await flushTraces();
|
|
696
|
+
let serverTraceIds = {};
|
|
689
697
|
try {
|
|
690
|
-
await httpClient.completeReplay(testRunId);
|
|
698
|
+
const completeResult = await httpClient.completeReplay(testRunId);
|
|
699
|
+
serverTraceIds = completeResult.traceIds ?? {};
|
|
691
700
|
} catch (e) {
|
|
692
701
|
try {
|
|
693
702
|
console.error("Bitfab: Failed to complete replay:", e);
|
|
694
703
|
} catch {
|
|
695
704
|
}
|
|
696
705
|
}
|
|
706
|
+
for (const item of resultItems) {
|
|
707
|
+
if (item.traceId) {
|
|
708
|
+
item.traceId = serverTraceIds[item.traceId] ?? null;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
697
711
|
return {
|
|
698
712
|
items: resultItems,
|
|
699
713
|
testRunId,
|
|
@@ -2885,7 +2899,8 @@ var Bitfab = class {
|
|
|
2885
2899
|
}
|
|
2886
2900
|
const currentStack = getSpanStack();
|
|
2887
2901
|
const parentContext = currentStack[currentStack.length - 1];
|
|
2888
|
-
const
|
|
2902
|
+
const replayCtxForTraceId = parentContext ? null : getReplayContext();
|
|
2903
|
+
const traceId = parentContext?.traceId ?? replayCtxForTraceId?.traceId ?? crypto.randomUUID();
|
|
2889
2904
|
const spanId = crypto.randomUUID();
|
|
2890
2905
|
const parentSpanId = parentContext?.spanId ?? null;
|
|
2891
2906
|
const isRootSpan = parentSpanId === null;
|