bitfab 0.59.0 → 0.59.1
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/autoTrace.cjs.map +1 -1
- package/dist/autoTrace.d.cts +2 -0
- package/dist/autoTrace.d.ts +2 -0
- package/dist/autoTrace.js +1 -1
- package/dist/{chunk-FHEEAPG2.js → chunk-3D5EEY47.js} +54 -38
- package/dist/chunk-3D5EEY47.js.map +1 -0
- package/dist/{chunk-Y6FVWJKU.js → chunk-4F46OBRG.js} +18 -10
- package/dist/chunk-4F46OBRG.js.map +1 -0
- package/dist/{chunk-ETZUSSF6.js → chunk-5DNB7EN7.js} +1 -1
- package/dist/chunk-5DNB7EN7.js.map +1 -0
- package/dist/{chunk-R5MUOBRK.js → chunk-5MN6WIMW.js} +29 -14
- package/dist/chunk-5MN6WIMW.js.map +1 -0
- package/dist/{chunk-KFZ5OIN5.js → chunk-GJCZABUC.js} +29 -14
- package/dist/chunk-GJCZABUC.js.map +1 -0
- package/dist/{chunk-RYSCYPHQ.js → chunk-NVOQ7YMI.js} +37 -26
- package/dist/chunk-NVOQ7YMI.js.map +1 -0
- package/dist/{http-D7P4JL6C.js → http-2QEMP27E.js} +4 -2
- package/dist/{http-7WLON2BH.js → http-OXKVRA3E.js} +4 -2
- package/dist/index.cjs +109 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -35
- package/dist/index.d.ts +68 -35
- package/dist/index.js +4 -4
- package/dist/node.cjs +109 -67
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +4 -4
- package/dist/{replay-5TZNJ2DL.js → replay-WYPFFXSU.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-ETZUSSF6.js.map +0 -1
- package/dist/chunk-FHEEAPG2.js.map +0 -1
- package/dist/chunk-KFZ5OIN5.js.map +0 -1
- package/dist/chunk-R5MUOBRK.js.map +0 -1
- package/dist/chunk-RYSCYPHQ.js.map +0 -1
- package/dist/chunk-Y6FVWJKU.js.map +0 -1
- /package/dist/{http-7WLON2BH.js.map → http-2QEMP27E.js.map} +0 -0
- /package/dist/{http-D7P4JL6C.js.map → http-OXKVRA3E.js.map} +0 -0
- /package/dist/{replay-5TZNJ2DL.js.map → replay-WYPFFXSU.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
runWithAutoTraceEntry,
|
|
7
7
|
runWithAutoTraceNodeConfiguration,
|
|
8
8
|
runWithAutoTraceRootContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5DNB7EN7.js";
|
|
10
10
|
import {
|
|
11
11
|
NO_MOCK_OVERRIDE,
|
|
12
12
|
createIntegrationFixtureContext,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
serializeValue,
|
|
18
18
|
toJsonSafe,
|
|
19
19
|
toJsonSafeReport
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3D5EEY47.js";
|
|
21
21
|
import {
|
|
22
22
|
BitfabError,
|
|
23
23
|
CONTENT_OFF_KEY,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
ROOT_TRACE_FUNCTION_KEY_FIELD,
|
|
29
29
|
SimulationPlan,
|
|
30
30
|
callerTraceMetadata,
|
|
31
|
+
experimentIdWireFields,
|
|
31
32
|
getReplayContext,
|
|
32
33
|
gitRunner,
|
|
33
34
|
isFrameworkInstrumentation,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
readEnv,
|
|
36
37
|
recordCallerTraceMetadata,
|
|
37
38
|
retireTraceMetadata
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-GJCZABUC.js";
|
|
39
40
|
import {
|
|
40
41
|
__privateAdd,
|
|
41
42
|
__privateGet,
|
|
@@ -1484,27 +1485,27 @@ var LabelsClient = class {
|
|
|
1484
1485
|
constructor(httpClient) {
|
|
1485
1486
|
this.httpClient = httpClient;
|
|
1486
1487
|
}
|
|
1487
|
-
async save(update,
|
|
1488
|
-
const [outcome] = await this.saveAll([update],
|
|
1488
|
+
async save(update, experimentId) {
|
|
1489
|
+
const [outcome] = await this.saveAll([update], experimentId);
|
|
1489
1490
|
return outcome;
|
|
1490
1491
|
}
|
|
1491
|
-
async saveAll(updates,
|
|
1492
|
+
async saveAll(updates, experimentId) {
|
|
1492
1493
|
const response = await this.httpClient.request(
|
|
1493
1494
|
LABELS_PATH,
|
|
1494
1495
|
{
|
|
1495
1496
|
labels: updates,
|
|
1496
|
-
...
|
|
1497
|
+
...experimentId === void 0 ? {} : experimentIdWireFields(experimentId)
|
|
1497
1498
|
}
|
|
1498
1499
|
);
|
|
1499
1500
|
return response.labels;
|
|
1500
1501
|
}
|
|
1501
1502
|
/** Withhold a verdict for a trace or replay attempt whose check did not run. */
|
|
1502
|
-
async skip(target,
|
|
1503
|
-
return this.save({ ...target, skip: true },
|
|
1503
|
+
async skip(target, experimentId) {
|
|
1504
|
+
return this.save({ ...target, skip: true }, experimentId);
|
|
1504
1505
|
}
|
|
1505
1506
|
/** Clear a previous verdict for a trace, replay attempt, or assertion. */
|
|
1506
|
-
async archive(target,
|
|
1507
|
-
return this.save({ ...target, archive: true },
|
|
1507
|
+
async archive(target, experimentId) {
|
|
1508
|
+
return this.save({ ...target, archive: true }, experimentId);
|
|
1508
1509
|
}
|
|
1509
1510
|
async saveHuman(update) {
|
|
1510
1511
|
const [outcome] = await this.saveHumanAll([update]);
|
|
@@ -3827,6 +3828,15 @@ var BitfabVercelAiHandler = class {
|
|
|
3827
3828
|
};
|
|
3828
3829
|
|
|
3829
3830
|
// src/client.ts
|
|
3831
|
+
function resolveSpanExperimentId(options) {
|
|
3832
|
+
const { experimentId, testRunId } = options;
|
|
3833
|
+
if (experimentId !== void 0 && testRunId !== void 0 && experimentId !== testRunId) {
|
|
3834
|
+
throw new BitfabError(
|
|
3835
|
+
`experimentId ("${experimentId}") and its deprecated alias testRunId ("${testRunId}") were both passed with different values. Pass only experimentId.`
|
|
3836
|
+
);
|
|
3837
|
+
}
|
|
3838
|
+
return experimentId ?? testRunId;
|
|
3839
|
+
}
|
|
3830
3840
|
var TRUNCATION_LIMIT_ORDER = [
|
|
3831
3841
|
"max_depth",
|
|
3832
3842
|
"max_captured_subtree_spans"
|
|
@@ -4416,13 +4426,12 @@ var Bitfab = class {
|
|
|
4416
4426
|
"bitfab.node({ capture: false }) cannot use mockOnReplay: true because an uncaptured node has no recorded output."
|
|
4417
4427
|
);
|
|
4418
4428
|
}
|
|
4429
|
+
const experimentId = resolveSpanExperimentId(options);
|
|
4419
4430
|
return {
|
|
4420
4431
|
capture,
|
|
4421
4432
|
type: options.type ?? "custom",
|
|
4422
4433
|
...options.name !== void 0 && { name: options.name },
|
|
4423
|
-
...
|
|
4424
|
-
testRunId: options.testRunId
|
|
4425
|
-
},
|
|
4434
|
+
...experimentId !== void 0 && { experimentId },
|
|
4426
4435
|
...options.mockOnReplay !== void 0 && {
|
|
4427
4436
|
mockOnReplay: options.mockOnReplay
|
|
4428
4437
|
},
|
|
@@ -4557,6 +4566,7 @@ var Bitfab = class {
|
|
|
4557
4566
|
return invokeWithoutNode();
|
|
4558
4567
|
}
|
|
4559
4568
|
const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
|
|
4569
|
+
const nodeExperimentId = nodeConfiguration === void 0 ? void 0 : resolveSpanExperimentId(nodeConfiguration);
|
|
4560
4570
|
const childOptions = {
|
|
4561
4571
|
name: spanName,
|
|
4562
4572
|
type: nodeConfiguration?.type ?? "function",
|
|
@@ -4567,8 +4577,8 @@ var Bitfab = class {
|
|
|
4567
4577
|
captureContent: true,
|
|
4568
4578
|
autoTraceDefinition: definition,
|
|
4569
4579
|
...declaredNode && { declaredNode },
|
|
4570
|
-
...
|
|
4571
|
-
|
|
4580
|
+
...nodeExperimentId !== void 0 && {
|
|
4581
|
+
experimentId: nodeExperimentId
|
|
4572
4582
|
},
|
|
4573
4583
|
...mockOnReplay !== void 0 && {
|
|
4574
4584
|
mockOnReplay
|
|
@@ -5229,6 +5239,7 @@ var Bitfab = class {
|
|
|
5229
5239
|
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
|
|
5230
5240
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
5231
5241
|
const self = this;
|
|
5242
|
+
const optionExperimentId = resolveSpanExperimentId(options);
|
|
5232
5243
|
const fnIsAsyncFunction = fn.constructor.name === "AsyncFunction";
|
|
5233
5244
|
const fnReturnsPromise = fnIsAsyncFunction || (() => {
|
|
5234
5245
|
try {
|
|
@@ -5331,7 +5342,7 @@ var Bitfab = class {
|
|
|
5331
5342
|
const inputs = args;
|
|
5332
5343
|
const startedAt = nowIsoTimestamp();
|
|
5333
5344
|
const replayCtxAtStart = getReplayContext();
|
|
5334
|
-
const
|
|
5345
|
+
const experimentId = replayCtxAtStart?.experimentId ?? optionExperimentId;
|
|
5335
5346
|
if (isRootSpan && !activeTraceStates.has(traceId)) {
|
|
5336
5347
|
const dbSnapshotRef = buildSnapshotRef(self.dbSnapshot, startedAt);
|
|
5337
5348
|
self.simulationPlan.refresh();
|
|
@@ -5340,7 +5351,7 @@ var Bitfab = class {
|
|
|
5340
5351
|
traceFunctionKey,
|
|
5341
5352
|
startedAt,
|
|
5342
5353
|
contexts: [],
|
|
5343
|
-
...
|
|
5354
|
+
...experimentId !== void 0 && { experimentId },
|
|
5344
5355
|
...replayCtxAtStart?.inputSourceTraceId && {
|
|
5345
5356
|
inputSourceTraceId: replayCtxAtStart.inputSourceTraceId
|
|
5346
5357
|
},
|
|
@@ -5386,7 +5397,7 @@ var Bitfab = class {
|
|
|
5386
5397
|
contexts: newContext.contexts,
|
|
5387
5398
|
prompt: newContext.prompt,
|
|
5388
5399
|
endedAt,
|
|
5389
|
-
...
|
|
5400
|
+
...experimentId !== void 0 && { experimentId },
|
|
5390
5401
|
...replayCtx?.inputSourceSpanId && {
|
|
5391
5402
|
inputSourceSpanId: replayCtx.inputSourceSpanId
|
|
5392
5403
|
}
|
|
@@ -5407,7 +5418,7 @@ var Bitfab = class {
|
|
|
5407
5418
|
name: traceState?.name,
|
|
5408
5419
|
metadata: callerTraceMetadata(traceId),
|
|
5409
5420
|
contexts: traceState?.contexts ?? [],
|
|
5410
|
-
|
|
5421
|
+
experimentId: traceState?.experimentId,
|
|
5411
5422
|
inputSourceTraceId: traceState?.inputSourceTraceId,
|
|
5412
5423
|
replayAttempt: traceState?.replayAttempt,
|
|
5413
5424
|
dbSnapshotRef: traceState?.dbSnapshotRef,
|
|
@@ -5878,7 +5889,7 @@ var Bitfab = class {
|
|
|
5878
5889
|
completed: true,
|
|
5879
5890
|
...params.dropped && { dropped: true },
|
|
5880
5891
|
...params.sessionId && { sessionId: params.sessionId },
|
|
5881
|
-
...params.
|
|
5892
|
+
...params.experimentId !== void 0 && experimentIdWireFields(params.experimentId)
|
|
5882
5893
|
});
|
|
5883
5894
|
}
|
|
5884
5895
|
sendsSpanOnCompletion(context) {
|
|
@@ -5990,7 +6001,7 @@ var Bitfab = class {
|
|
|
5990
6001
|
},
|
|
5991
6002
|
...params.declaredNode === true && { [DECLARED_NODE_FIELD]: true },
|
|
5992
6003
|
rawSpan: externalSpan,
|
|
5993
|
-
...params.
|
|
6004
|
+
...params.experimentId !== void 0 && experimentIdWireFields(params.experimentId),
|
|
5994
6005
|
...params.mocked && { mocked: true },
|
|
5995
6006
|
...params.mockTarget && { mockTarget: params.mockTarget },
|
|
5996
6007
|
...params.mockSource && { mockSource: params.mockSource }
|
|
@@ -6136,7 +6147,7 @@ var Bitfab = class {
|
|
|
6136
6147
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
6137
6148
|
} finally {
|
|
6138
6149
|
try {
|
|
6139
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
6150
|
+
const { flushTraces: flushTraces2 } = await import("./http-2QEMP27E.js");
|
|
6140
6151
|
await flushTraces2(3e4);
|
|
6141
6152
|
} finally {
|
|
6142
6153
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -6195,7 +6206,7 @@ var Bitfab = class {
|
|
|
6195
6206
|
`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.`
|
|
6196
6207
|
);
|
|
6197
6208
|
}
|
|
6198
|
-
const { replay: doReplay } = await import("./replay-
|
|
6209
|
+
const { replay: doReplay } = await import("./replay-WYPFFXSU.js");
|
|
6199
6210
|
return doReplay(
|
|
6200
6211
|
this.httpClient,
|
|
6201
6212
|
this.serviceUrl,
|
|
@@ -6515,7 +6526,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
6515
6526
|
sessionId: seedCase.sessionId
|
|
6516
6527
|
})
|
|
6517
6528
|
);
|
|
6518
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
6529
|
+
const { flushTraces: flushTraces2 } = await import("./http-2QEMP27E.js");
|
|
6519
6530
|
await flushTraces2(3e4);
|
|
6520
6531
|
return { pipeline, traceFunctionKey, traceIds };
|
|
6521
6532
|
}
|
|
@@ -6559,4 +6570,4 @@ export {
|
|
|
6559
6570
|
reseedFromRegistry,
|
|
6560
6571
|
seedFromRegistry
|
|
6561
6572
|
};
|
|
6562
|
-
//# sourceMappingURL=chunk-
|
|
6573
|
+
//# sourceMappingURL=chunk-NVOQ7YMI.js.map
|