@bitfab/sdk 0.54.13 → 0.54.14
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-WDSOB57F.js → chunk-DXBYY5RS.js} +22 -9
- package/dist/chunk-DXBYY5RS.js.map +1 -0
- package/dist/{chunk-N5T6NDR3.js → chunk-KMSJJOT6.js} +21 -9
- package/dist/chunk-KMSJJOT6.js.map +1 -0
- package/dist/{chunk-BUGCOUK6.js → chunk-RMJAAI6S.js} +37 -7
- package/dist/chunk-RMJAAI6S.js.map +1 -0
- package/dist/{chunk-M7HWCJVO.js → chunk-ROQKK6YZ.js} +9 -3
- package/dist/chunk-ROQKK6YZ.js.map +1 -0
- package/dist/{chunk-IOLVW3PT.js → chunk-V2TWHXTK.js} +28 -16
- package/dist/chunk-V2TWHXTK.js.map +1 -0
- package/dist/{http-4W2BM7GE.js → http-PNENM32G.js} +2 -2
- package/dist/{http-Y6UGNXSO.js → http-X5LJ4GM6.js} +2 -2
- package/dist/index.cjs +50 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +3 -3
- package/dist/node.cjs +50 -21
- 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 +3 -3
- package/dist/{replay-YJBLRMQD.js → replay-BRLNXOAL.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-BUGCOUK6.js.map +0 -1
- package/dist/chunk-IOLVW3PT.js.map +0 -1
- package/dist/chunk-M7HWCJVO.js.map +0 -1
- package/dist/chunk-N5T6NDR3.js.map +0 -1
- package/dist/chunk-WDSOB57F.js.map +0 -1
- /package/dist/{http-4W2BM7GE.js.map → http-PNENM32G.js.map} +0 -0
- /package/dist/{http-Y6UGNXSO.js.map → http-X5LJ4GM6.js.map} +0 -0
- /package/dist/{replay-YJBLRMQD.js.map → replay-BRLNXOAL.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DXBYY5RS.js";
|
|
10
10
|
import "./chunk-VCRFFCLY.js";
|
|
11
11
|
export {
|
|
12
12
|
BitfabError,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
parseRetryAfterMs,
|
|
18
18
|
serializePayloadBody
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=http-
|
|
20
|
+
//# sourceMappingURL=http-PNENM32G.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KMSJJOT6.js";
|
|
10
10
|
export {
|
|
11
11
|
BitfabError,
|
|
12
12
|
HttpClient,
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
parseRetryAfterMs,
|
|
17
17
|
serializePayloadBody
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=http-
|
|
19
|
+
//# sourceMappingURL=http-X5LJ4GM6.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var __version__, __packageName__;
|
|
|
42
42
|
var init_version_generated = __esm({
|
|
43
43
|
"src/version.generated.ts"() {
|
|
44
44
|
"use strict";
|
|
45
|
-
__version__ = "0.54.
|
|
45
|
+
__version__ = "0.54.14";
|
|
46
46
|
__packageName__ = "@bitfab/sdk";
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -1256,6 +1256,7 @@ var init_simulationPlan = __esm({
|
|
|
1256
1256
|
}
|
|
1257
1257
|
this.warnNeverLoaded();
|
|
1258
1258
|
this.warnDropped();
|
|
1259
|
+
return this.held.length === 0;
|
|
1259
1260
|
}
|
|
1260
1261
|
waitForFirstLoad(timeoutMs) {
|
|
1261
1262
|
const firstLoad = this.firstLoad();
|
|
@@ -2078,9 +2079,14 @@ __export(http_exports, {
|
|
|
2078
2079
|
});
|
|
2079
2080
|
async function releaseHeldExternalSpans(timeoutMs) {
|
|
2080
2081
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2082
|
+
let released = true;
|
|
2081
2083
|
for (const client of [...liveHttpClients]) {
|
|
2082
|
-
await client.releaseHeldExternalSpans?.(
|
|
2084
|
+
const result = await client.releaseHeldExternalSpans?.(
|
|
2085
|
+
Math.max(0, deadline - Date.now())
|
|
2086
|
+
);
|
|
2087
|
+
released = result !== false && released;
|
|
2083
2088
|
}
|
|
2089
|
+
return released;
|
|
2084
2090
|
}
|
|
2085
2091
|
function stopSimulationPlans() {
|
|
2086
2092
|
for (const client of [...liveHttpClients]) {
|
|
@@ -2097,14 +2103,15 @@ function awaitOnExit(promise) {
|
|
|
2097
2103
|
}
|
|
2098
2104
|
async function flushTraces(timeoutMs = 5e3) {
|
|
2099
2105
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2100
|
-
await releaseHeldExternalSpans(planWaitSliceMs(timeoutMs));
|
|
2106
|
+
const released = await releaseHeldExternalSpans(planWaitSliceMs(timeoutMs));
|
|
2101
2107
|
const requestsFlushed = await awaitPendingRequests(
|
|
2102
2108
|
Math.max(0, deadline - Date.now())
|
|
2103
2109
|
);
|
|
2110
|
+
const releasedAfterDeferred = await releaseHeldExternalSpans(0);
|
|
2104
2111
|
const transportsFlushed = await flushTraceTransports(
|
|
2105
2112
|
Math.max(0, deadline - Date.now())
|
|
2106
2113
|
);
|
|
2107
|
-
return requestsFlushed && transportsFlushed;
|
|
2114
|
+
return released && releasedAfterDeferred && requestsFlushed && transportsFlushed;
|
|
2108
2115
|
}
|
|
2109
2116
|
async function awaitPendingRequests(timeoutMs = DEFAULT_LIFECYCLE_TIMEOUT_MS2) {
|
|
2110
2117
|
await replayContextReady.catch(() => {
|
|
@@ -2514,13 +2521,17 @@ var init_http = __esm({
|
|
|
2514
2521
|
*/
|
|
2515
2522
|
async settleDeferredWork(timeoutMs = DEFAULT_LIFECYCLE_TIMEOUT_MS2) {
|
|
2516
2523
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2517
|
-
await this.releaseHeldExternalSpans?.(
|
|
2524
|
+
const released = await this.releaseHeldExternalSpans?.(
|
|
2525
|
+
planWaitSliceMs(timeoutMs)
|
|
2526
|
+
);
|
|
2518
2527
|
await replayContextReady.catch(() => {
|
|
2519
2528
|
});
|
|
2520
|
-
|
|
2529
|
+
const settled2 = await waitForPromises(
|
|
2521
2530
|
Array.from(this.deferredWork),
|
|
2522
2531
|
Math.max(0, deadline - Date.now())
|
|
2523
2532
|
);
|
|
2533
|
+
const releasedAfterDeferred = await this.releaseHeldExternalSpans?.(0);
|
|
2534
|
+
return released !== false && releasedAfterDeferred !== false && settled2;
|
|
2524
2535
|
}
|
|
2525
2536
|
/**
|
|
2526
2537
|
* Wait for spans queued by this client to be delivered, within one deadline.
|
|
@@ -2545,7 +2556,9 @@ var init_http = __esm({
|
|
|
2545
2556
|
}
|
|
2546
2557
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2547
2558
|
this.closing = (async () => {
|
|
2548
|
-
await this.releaseHeldExternalSpans?.(
|
|
2559
|
+
const released = await this.releaseHeldExternalSpans?.(
|
|
2560
|
+
planWaitSliceMs(timeoutMs)
|
|
2561
|
+
);
|
|
2549
2562
|
this.stopSimulationPlan?.();
|
|
2550
2563
|
this.externalSpanTransform = void 0;
|
|
2551
2564
|
this.externalTraceTransform = void 0;
|
|
@@ -2559,7 +2572,7 @@ var init_http = __esm({
|
|
|
2559
2572
|
const transport = this.traceTransport;
|
|
2560
2573
|
this.traceTransport = void 0;
|
|
2561
2574
|
const shutdownOk = await transport?.shutdown(Math.max(0, deadline - Date.now())) ?? true;
|
|
2562
|
-
return settled2 && shutdownOk;
|
|
2575
|
+
return released !== false && settled2 && shutdownOk;
|
|
2563
2576
|
})();
|
|
2564
2577
|
return this.closing;
|
|
2565
2578
|
}
|
|
@@ -3993,6 +4006,12 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
3993
4006
|
}
|
|
3994
4007
|
}
|
|
3995
4008
|
const attempts = resolveAttempts(options?.attempts);
|
|
4009
|
+
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
4010
|
+
if (!Number.isInteger(maxConcurrency) || maxConcurrency < 1) {
|
|
4011
|
+
throw new BitfabError(
|
|
4012
|
+
`maxConcurrency must be a positive integer (got ${maxConcurrency}).`
|
|
4013
|
+
);
|
|
4014
|
+
}
|
|
3996
4015
|
await replayContextReady;
|
|
3997
4016
|
let codeChangeDescription = options?.codeChangeDescription;
|
|
3998
4017
|
let codeChangeFiles = options?.codeChangeFiles;
|
|
@@ -4039,7 +4058,6 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
4039
4058
|
}
|
|
4040
4059
|
}
|
|
4041
4060
|
const mockStrategy = options?.mock ?? "marked";
|
|
4042
|
-
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
4043
4061
|
const fullTestRunUrl = `${serviceUrl}${testRunUrl}`;
|
|
4044
4062
|
const resolvedOverrides = [
|
|
4045
4063
|
...normalizeMockOverrides(options?.mockOverride),
|
|
@@ -4136,6 +4154,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
4136
4154
|
originalDurationMs: item.originalDurationMs,
|
|
4137
4155
|
originalTokens: item.originalTokens,
|
|
4138
4156
|
originalModel: item.originalModel,
|
|
4157
|
+
ingestionType: item.ingestionType,
|
|
4139
4158
|
tokens: item.tokens,
|
|
4140
4159
|
model: item.model,
|
|
4141
4160
|
dbSnapshotRef: item.dbSnapshotRef,
|
|
@@ -5969,6 +5988,14 @@ var LabelsClient = class {
|
|
|
5969
5988
|
);
|
|
5970
5989
|
return response.labels;
|
|
5971
5990
|
}
|
|
5991
|
+
/** Withhold a verdict for a trace or replay attempt whose check did not run. */
|
|
5992
|
+
async skip(target, testRunId) {
|
|
5993
|
+
return this.save({ ...target, skip: true }, testRunId);
|
|
5994
|
+
}
|
|
5995
|
+
/** Clear a previous verdict for a trace, replay attempt, or assertion. */
|
|
5996
|
+
async archive(target, testRunId) {
|
|
5997
|
+
return this.save({ ...target, archive: true }, testRunId);
|
|
5998
|
+
}
|
|
5972
5999
|
async saveHuman(update) {
|
|
5973
6000
|
const [outcome] = await this.saveHumanAll([update]);
|
|
5974
6001
|
return outcome;
|
|
@@ -6887,6 +6914,15 @@ var BitfabLangGraphIntegration = class {
|
|
|
6887
6914
|
// src/client.ts
|
|
6888
6915
|
init_mockOverride();
|
|
6889
6916
|
|
|
6917
|
+
// src/streamFinalizationError.ts
|
|
6918
|
+
var StreamFinalizationError = class extends Error {
|
|
6919
|
+
constructor(message, output) {
|
|
6920
|
+
super(message);
|
|
6921
|
+
this.output = output;
|
|
6922
|
+
this.name = "StreamFinalizationError";
|
|
6923
|
+
}
|
|
6924
|
+
};
|
|
6925
|
+
|
|
6890
6926
|
// src/openaiAgentSdk.ts
|
|
6891
6927
|
var BitfabOpenAIAgentHandler = class {
|
|
6892
6928
|
constructor(config) {
|
|
@@ -6926,7 +6962,11 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
6926
6962
|
if (isStreaming && res?.completed) {
|
|
6927
6963
|
try {
|
|
6928
6964
|
await res.completed;
|
|
6929
|
-
} catch {
|
|
6965
|
+
} catch (error) {
|
|
6966
|
+
throw new StreamFinalizationError(
|
|
6967
|
+
error instanceof Error ? error.message : String(error),
|
|
6968
|
+
res.finalOutput
|
|
6969
|
+
);
|
|
6930
6970
|
}
|
|
6931
6971
|
}
|
|
6932
6972
|
return res?.finalOutput;
|
|
@@ -7684,17 +7724,6 @@ function runWithSeedContext(ctx, fn) {
|
|
|
7684
7724
|
init_serialize();
|
|
7685
7725
|
init_simulationPlan();
|
|
7686
7726
|
init_spanOrigin();
|
|
7687
|
-
|
|
7688
|
-
// src/streamFinalizationError.ts
|
|
7689
|
-
var StreamFinalizationError = class extends Error {
|
|
7690
|
-
constructor(message, output) {
|
|
7691
|
-
super(message);
|
|
7692
|
-
this.output = output;
|
|
7693
|
-
this.name = "StreamFinalizationError";
|
|
7694
|
-
}
|
|
7695
|
-
};
|
|
7696
|
-
|
|
7697
|
-
// src/client.ts
|
|
7698
7727
|
init_traceMetadata();
|
|
7699
7728
|
|
|
7700
7729
|
// src/traces.ts
|