bitfab 0.53.1 → 0.53.2
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-ZEGNMZU7.js → chunk-3LSPOHL7.js} +3 -3
- package/dist/{chunk-ZCOZHNAA.js → chunk-6SPWEVFD.js} +116 -41
- package/dist/chunk-6SPWEVFD.js.map +1 -0
- package/dist/{chunk-ASMHSKFS.js → chunk-JZAKQDGR.js} +2 -2
- package/dist/{chunk-ASMHSKFS.js.map → chunk-JZAKQDGR.js.map} +1 -1
- package/dist/{chunk-ZNY2HZT3.js → chunk-S4UK5HNW.js} +2 -2
- package/dist/{chunk-ZNY2HZT3.js.map → chunk-S4UK5HNW.js.map} +1 -1
- package/dist/{chunk-MMT5MWG5.js → chunk-V3KD7B3B.js} +2 -2
- package/dist/{http-7QLUPC6F.js → http-LOZSAC23.js} +2 -2
- package/dist/{http-2OOKOZQ3.js → http-PUEEHMKU.js} +2 -2
- package/dist/index.cjs +113 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -3
- package/dist/node.cjs +113 -36
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-KJKIGXRH.js → replay-SSJ72WEI.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +2 -1
- package/dist/chunk-ZCOZHNAA.js.map +0 -1
- /package/dist/{chunk-ZEGNMZU7.js.map → chunk-3LSPOHL7.js.map} +0 -0
- /package/dist/{chunk-MMT5MWG5.js.map → chunk-V3KD7B3B.js.map} +0 -0
- /package/dist/{http-2OOKOZQ3.js.map → http-LOZSAC23.js.map} +0 -0
- /package/dist/{http-7QLUPC6F.js.map → http-PUEEHMKU.js.map} +0 -0
- /package/dist/{replay-KJKIGXRH.js.map → replay-SSJ72WEI.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
replayContextReady,
|
|
6
6
|
runWithReplayContext,
|
|
7
7
|
warnOnce
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JZAKQDGR.js";
|
|
9
9
|
|
|
10
10
|
// src/gitCommand.ts
|
|
11
11
|
var EXIT_GRACE_MS = 500;
|
|
@@ -1303,4 +1303,4 @@ export {
|
|
|
1303
1303
|
sleepForReplayPersistence,
|
|
1304
1304
|
replay
|
|
1305
1305
|
};
|
|
1306
|
-
//# sourceMappingURL=chunk-
|
|
1306
|
+
//# sourceMappingURL=chunk-V3KD7B3B.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S4UK5HNW.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-LOZSAC23.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JZAKQDGR.js";
|
|
10
10
|
import "./chunk-H6LZRFMN.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-PUEEHMKU.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,7 @@ var __version__, __packageName__;
|
|
|
51
51
|
var init_version_generated = __esm({
|
|
52
52
|
"src/version.generated.ts"() {
|
|
53
53
|
"use strict";
|
|
54
|
-
__version__ = "0.53.
|
|
54
|
+
__version__ = "0.53.2";
|
|
55
55
|
__packageName__ = "bitfab";
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -6719,6 +6719,17 @@ function runWithSeedContext(ctx, fn) {
|
|
|
6719
6719
|
init_serialize();
|
|
6720
6720
|
init_simulationPlan();
|
|
6721
6721
|
init_spanOrigin();
|
|
6722
|
+
|
|
6723
|
+
// src/streamFinalizationError.ts
|
|
6724
|
+
var StreamFinalizationError = class extends Error {
|
|
6725
|
+
constructor(message, output) {
|
|
6726
|
+
super(message);
|
|
6727
|
+
this.output = output;
|
|
6728
|
+
this.name = "StreamFinalizationError";
|
|
6729
|
+
}
|
|
6730
|
+
};
|
|
6731
|
+
|
|
6732
|
+
// src/client.ts
|
|
6722
6733
|
init_traceMetadata();
|
|
6723
6734
|
|
|
6724
6735
|
// src/tracing.ts
|
|
@@ -6992,52 +7003,110 @@ function summarizeGenerate(result, model) {
|
|
|
6992
7003
|
}
|
|
6993
7004
|
return summary;
|
|
6994
7005
|
}
|
|
6995
|
-
function accumulateStream(onComplete, model) {
|
|
7006
|
+
function accumulateStream(source, onComplete, model) {
|
|
7007
|
+
const reader = source.getReader();
|
|
6996
7008
|
let text = "";
|
|
6997
7009
|
const toolCalls = [];
|
|
6998
7010
|
let usage;
|
|
6999
7011
|
let finishReason;
|
|
7000
7012
|
let completed = false;
|
|
7001
|
-
|
|
7013
|
+
let streamFailure;
|
|
7014
|
+
const complete = (failure = streamFailure) => {
|
|
7002
7015
|
if (completed) {
|
|
7003
7016
|
return;
|
|
7004
7017
|
}
|
|
7005
7018
|
completed = true;
|
|
7006
|
-
|
|
7019
|
+
let error;
|
|
7020
|
+
if (failure !== void 0) {
|
|
7021
|
+
try {
|
|
7022
|
+
error = failure.error instanceof Error ? failure.error.message : String(
|
|
7023
|
+
failure.error ?? (failure.cancelled === true ? "Stream cancelled" : "Stream failed")
|
|
7024
|
+
);
|
|
7025
|
+
} catch {
|
|
7026
|
+
error = "Stream failed";
|
|
7027
|
+
}
|
|
7028
|
+
}
|
|
7029
|
+
onComplete({
|
|
7007
7030
|
text,
|
|
7008
7031
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
7009
7032
|
usage,
|
|
7010
|
-
finishReason
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
}
|
|
7015
|
-
onComplete(summary);
|
|
7033
|
+
finishReason,
|
|
7034
|
+
...model !== void 0 && { model },
|
|
7035
|
+
...failure !== void 0 && { error },
|
|
7036
|
+
...failure?.cancelled === true && { cancelled: true }
|
|
7037
|
+
});
|
|
7016
7038
|
};
|
|
7017
|
-
return new
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7039
|
+
return new ReadableStream(
|
|
7040
|
+
{
|
|
7041
|
+
start(controller) {
|
|
7042
|
+
void reader.closed.then(
|
|
7043
|
+
() => {
|
|
7044
|
+
queueMicrotask(() => {
|
|
7045
|
+
if (!completed) {
|
|
7046
|
+
complete();
|
|
7047
|
+
reader.releaseLock();
|
|
7048
|
+
controller.close();
|
|
7049
|
+
}
|
|
7050
|
+
});
|
|
7051
|
+
},
|
|
7052
|
+
(error) => {
|
|
7053
|
+
if (!completed) {
|
|
7054
|
+
complete({ error });
|
|
7055
|
+
controller.error(error);
|
|
7056
|
+
reader.releaseLock();
|
|
7057
|
+
}
|
|
7058
|
+
}
|
|
7059
|
+
);
|
|
7060
|
+
},
|
|
7061
|
+
async pull(controller) {
|
|
7062
|
+
try {
|
|
7063
|
+
const { done, value: part } = await reader.read();
|
|
7064
|
+
if (completed) {
|
|
7065
|
+
return;
|
|
7066
|
+
}
|
|
7067
|
+
if (done) {
|
|
7068
|
+
complete();
|
|
7069
|
+
reader.releaseLock();
|
|
7070
|
+
controller.close();
|
|
7071
|
+
return;
|
|
7072
|
+
}
|
|
7073
|
+
try {
|
|
7074
|
+
if (part?.type === "text-delta") {
|
|
7075
|
+
text += part.delta ?? part.textDelta ?? "";
|
|
7076
|
+
} else if (part?.type === "tool-call") {
|
|
7077
|
+
toolCalls.push({
|
|
7078
|
+
toolCallId: part.toolCallId,
|
|
7079
|
+
toolName: part.toolName,
|
|
7080
|
+
input: part.input ?? part.args
|
|
7081
|
+
});
|
|
7082
|
+
} else if (part?.type === "error") {
|
|
7083
|
+
streamFailure = { error: part.error };
|
|
7084
|
+
} else if (part?.type === "finish") {
|
|
7085
|
+
usage = part.usage;
|
|
7086
|
+
finishReason = part.finishReason;
|
|
7087
|
+
}
|
|
7088
|
+
} catch {
|
|
7089
|
+
}
|
|
7090
|
+
controller.enqueue(part);
|
|
7091
|
+
} catch (error) {
|
|
7092
|
+
if (!completed) {
|
|
7093
|
+
complete({ error });
|
|
7094
|
+
reader.releaseLock();
|
|
7095
|
+
controller.error(error);
|
|
7096
|
+
}
|
|
7097
|
+
}
|
|
7098
|
+
},
|
|
7099
|
+
async cancel(reason) {
|
|
7100
|
+
complete({ error: reason, cancelled: true });
|
|
7101
|
+
try {
|
|
7102
|
+
await reader.cancel(reason);
|
|
7103
|
+
} finally {
|
|
7104
|
+
reader.releaseLock();
|
|
7032
7105
|
}
|
|
7033
|
-
} catch {
|
|
7034
7106
|
}
|
|
7035
|
-
controller.enqueue(part);
|
|
7036
7107
|
},
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
}
|
|
7040
|
-
});
|
|
7108
|
+
{ highWaterMark: 0 }
|
|
7109
|
+
);
|
|
7041
7110
|
}
|
|
7042
7111
|
var BitfabVercelAiHandler = class {
|
|
7043
7112
|
constructor(config) {
|
|
@@ -7078,14 +7147,22 @@ var BitfabVercelAiHandler = class {
|
|
|
7078
7147
|
// awaits the summary the accumulator resolves once the stream drains.
|
|
7079
7148
|
{
|
|
7080
7149
|
type: "llm",
|
|
7081
|
-
finalize: () =>
|
|
7150
|
+
finalize: async () => {
|
|
7151
|
+
const output = await summary;
|
|
7152
|
+
if (output.error !== void 0) {
|
|
7153
|
+
throw new StreamFinalizationError(output.error, output);
|
|
7154
|
+
}
|
|
7155
|
+
return output;
|
|
7156
|
+
},
|
|
7082
7157
|
surface: "inherit",
|
|
7083
7158
|
instrumentation: "vercel-ai"
|
|
7084
7159
|
},
|
|
7085
7160
|
async () => {
|
|
7086
7161
|
const result = await doStream();
|
|
7087
|
-
const stream =
|
|
7088
|
-
|
|
7162
|
+
const stream = accumulateStream(
|
|
7163
|
+
result.stream,
|
|
7164
|
+
resolveSummary,
|
|
7165
|
+
label
|
|
7089
7166
|
);
|
|
7090
7167
|
return { ...result, stream };
|
|
7091
7168
|
}
|
|
@@ -8580,8 +8657,8 @@ var Bitfab = class {
|
|
|
8580
8657
|
void self.httpClient.trackDeferred(
|
|
8581
8658
|
Promise.resolve().then(() => options.finalize(result)).then((output) => sendSpan({ result: output })).catch(
|
|
8582
8659
|
(error) => sendSpan({
|
|
8583
|
-
result: void 0,
|
|
8584
|
-
error: error instanceof Error ? `finalize failed: ${error.message}` : `finalize failed: ${String(error)}`
|
|
8660
|
+
result: error instanceof StreamFinalizationError ? error.output : void 0,
|
|
8661
|
+
error: error instanceof StreamFinalizationError ? error.message : error instanceof Error ? `finalize failed: ${error.message}` : `finalize failed: ${String(error)}`
|
|
8585
8662
|
})
|
|
8586
8663
|
)
|
|
8587
8664
|
);
|