ai 6.0.202 → 6.0.203
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/CHANGELOG.md +27 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -23
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +10 -12
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +11 -13
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/generate-text/stream-text.ts +6 -5
- package/src/middleware/extract-json-middleware.ts +2 -1
- package/src/middleware/extract-reasoning-middleware.ts +2 -1
- package/src/ui-message-stream/create-ui-message-stream.ts +2 -3
- package/src/util/download/download.ts +11 -14
package/dist/index.mjs
CHANGED
|
@@ -1164,13 +1164,13 @@ import {
|
|
|
1164
1164
|
DownloadError as DownloadError2,
|
|
1165
1165
|
readResponseWithSizeLimit,
|
|
1166
1166
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
1167
|
-
|
|
1167
|
+
fetchWithValidatedRedirects,
|
|
1168
1168
|
withUserAgentSuffix,
|
|
1169
1169
|
getRuntimeEnvironmentUserAgent
|
|
1170
1170
|
} from "@ai-sdk/provider-utils";
|
|
1171
1171
|
|
|
1172
1172
|
// src/version.ts
|
|
1173
|
-
var VERSION = true ? "6.0.
|
|
1173
|
+
var VERSION = true ? "6.0.203" : "0.0.0-test";
|
|
1174
1174
|
|
|
1175
1175
|
// src/util/download/download.ts
|
|
1176
1176
|
var download = async ({
|
|
@@ -1180,19 +1180,17 @@ var download = async ({
|
|
|
1180
1180
|
}) => {
|
|
1181
1181
|
var _a22;
|
|
1182
1182
|
const urlText = url.toString();
|
|
1183
|
-
validateDownloadUrl(urlText);
|
|
1184
1183
|
try {
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1184
|
+
const headers = withUserAgentSuffix(
|
|
1185
|
+
{},
|
|
1186
|
+
`ai-sdk/${VERSION}`,
|
|
1187
|
+
getRuntimeEnvironmentUserAgent()
|
|
1188
|
+
);
|
|
1189
|
+
const response = await fetchWithValidatedRedirects({
|
|
1190
|
+
url: urlText,
|
|
1191
|
+
headers,
|
|
1192
|
+
abortSignal
|
|
1192
1193
|
});
|
|
1193
|
-
if (response.redirected) {
|
|
1194
|
-
validateDownloadUrl(response.url);
|
|
1195
|
-
}
|
|
1196
1194
|
if (!response.ok) {
|
|
1197
1195
|
throw new DownloadError2({
|
|
1198
1196
|
url: urlText,
|
|
@@ -6973,8 +6971,8 @@ var DefaultStreamTextResult = class {
|
|
|
6973
6971
|
let recordedNoOutputError;
|
|
6974
6972
|
const pendingDeferredToolCalls = /* @__PURE__ */ new Map();
|
|
6975
6973
|
let rootSpan;
|
|
6976
|
-
let activeTextContent =
|
|
6977
|
-
let activeReasoningContent =
|
|
6974
|
+
let activeTextContent = createIdMap();
|
|
6975
|
+
let activeReasoningContent = createIdMap();
|
|
6978
6976
|
const eventProcessor = new TransformStream({
|
|
6979
6977
|
async transform(chunk, controller) {
|
|
6980
6978
|
var _a22, _b, _c, _d;
|
|
@@ -7090,8 +7088,8 @@ var DefaultStreamTextResult = class {
|
|
|
7090
7088
|
}
|
|
7091
7089
|
if (part.type === "start-step") {
|
|
7092
7090
|
recordedContent = [];
|
|
7093
|
-
activeReasoningContent =
|
|
7094
|
-
activeTextContent =
|
|
7091
|
+
activeReasoningContent = createIdMap();
|
|
7092
|
+
activeTextContent = createIdMap();
|
|
7095
7093
|
recordedRequest = part.request;
|
|
7096
7094
|
recordedWarnings = part.warnings;
|
|
7097
7095
|
}
|
|
@@ -8198,7 +8196,8 @@ var DefaultStreamTextResult = class {
|
|
|
8198
8196
|
sendSources = false,
|
|
8199
8197
|
sendStart = true,
|
|
8200
8198
|
sendFinish = true,
|
|
8201
|
-
onError =
|
|
8199
|
+
onError = () => "An error occurred."
|
|
8200
|
+
// prevent leaking server error details to the client by default
|
|
8202
8201
|
} = {}) {
|
|
8203
8202
|
const responseMessageId = generateMessageId != null ? getResponseUIMessageId({
|
|
8204
8203
|
originalMessages,
|
|
@@ -8634,12 +8633,12 @@ var ToolLoopAgent = class {
|
|
|
8634
8633
|
|
|
8635
8634
|
// src/ui-message-stream/create-ui-message-stream.ts
|
|
8636
8635
|
import {
|
|
8637
|
-
generateId as generateIdFunc
|
|
8638
|
-
getErrorMessage as getErrorMessage8
|
|
8636
|
+
generateId as generateIdFunc
|
|
8639
8637
|
} from "@ai-sdk/provider-utils";
|
|
8640
8638
|
function createUIMessageStream({
|
|
8641
8639
|
execute,
|
|
8642
|
-
onError =
|
|
8640
|
+
onError = () => "An error occurred.",
|
|
8641
|
+
// prevent leaking server error details to the client by default
|
|
8643
8642
|
originalMessages,
|
|
8644
8643
|
onStepFinish,
|
|
8645
8644
|
onFinish,
|
|
@@ -12039,7 +12038,7 @@ function extractJsonMiddleware(options) {
|
|
|
12039
12038
|
},
|
|
12040
12039
|
wrapStream: async ({ doStream }) => {
|
|
12041
12040
|
const { stream, ...rest } = await doStream();
|
|
12042
|
-
const textBlocks =
|
|
12041
|
+
const textBlocks = createIdMap();
|
|
12043
12042
|
const SUFFIX_BUFFER_SIZE = 12;
|
|
12044
12043
|
return {
|
|
12045
12044
|
stream: stream.pipeThrough(
|
|
@@ -12202,7 +12201,7 @@ function extractReasoningMiddleware({
|
|
|
12202
12201
|
},
|
|
12203
12202
|
wrapStream: async ({ doStream }) => {
|
|
12204
12203
|
const { stream, ...rest } = await doStream();
|
|
12205
|
-
const reasoningExtractions =
|
|
12204
|
+
const reasoningExtractions = createIdMap();
|
|
12206
12205
|
let delayedTextStart;
|
|
12207
12206
|
return {
|
|
12208
12207
|
stream: stream.pipeThrough(
|