ai 6.0.0-beta.164 → 6.0.0-beta.165
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 +10 -0
- package/dist/index.js +70 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -59
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -852,7 +852,7 @@ import {
|
|
|
852
852
|
} from "@ai-sdk/provider-utils";
|
|
853
853
|
|
|
854
854
|
// src/version.ts
|
|
855
|
-
var VERSION = true ? "6.0.0-beta.
|
|
855
|
+
var VERSION = true ? "6.0.0-beta.165" : "0.0.0-test";
|
|
856
856
|
|
|
857
857
|
// src/util/download/download.ts
|
|
858
858
|
var download = async ({ url }) => {
|
|
@@ -4021,68 +4021,73 @@ function asContent({
|
|
|
4021
4021
|
toolApprovalRequests,
|
|
4022
4022
|
tools
|
|
4023
4023
|
}) {
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
}
|
|
4037
|
-
}
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
error: part.result,
|
|
4060
|
-
providerExecuted: true,
|
|
4061
|
-
dynamic: part.dynamic
|
|
4062
|
-
};
|
|
4063
|
-
}
|
|
4064
|
-
return {
|
|
4065
|
-
type: "tool-result",
|
|
4024
|
+
const contentParts = [];
|
|
4025
|
+
for (const part of content) {
|
|
4026
|
+
switch (part.type) {
|
|
4027
|
+
case "text":
|
|
4028
|
+
case "reasoning":
|
|
4029
|
+
case "source":
|
|
4030
|
+
contentParts.push(part);
|
|
4031
|
+
break;
|
|
4032
|
+
case "file": {
|
|
4033
|
+
contentParts.push({
|
|
4034
|
+
type: "file",
|
|
4035
|
+
file: new DefaultGeneratedFile(part),
|
|
4036
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
4037
|
+
});
|
|
4038
|
+
break;
|
|
4039
|
+
}
|
|
4040
|
+
case "tool-call": {
|
|
4041
|
+
contentParts.push(
|
|
4042
|
+
toolCalls.find((toolCall) => toolCall.toolCallId === part.toolCallId)
|
|
4043
|
+
);
|
|
4044
|
+
break;
|
|
4045
|
+
}
|
|
4046
|
+
case "tool-result": {
|
|
4047
|
+
const toolCall = toolCalls.find(
|
|
4048
|
+
(toolCall2) => toolCall2.toolCallId === part.toolCallId
|
|
4049
|
+
);
|
|
4050
|
+
if (toolCall == null) {
|
|
4051
|
+
const tool2 = tools == null ? void 0 : tools[part.toolName];
|
|
4052
|
+
const supportsDeferredResults = (tool2 == null ? void 0 : tool2.type) === "provider" && tool2.supportsDeferredResults;
|
|
4053
|
+
if (!supportsDeferredResults) {
|
|
4054
|
+
throw new Error(`Tool call ${part.toolCallId} not found.`);
|
|
4055
|
+
}
|
|
4056
|
+
if (part.isError) {
|
|
4057
|
+
contentParts.push({
|
|
4058
|
+
type: "tool-error",
|
|
4066
4059
|
toolCallId: part.toolCallId,
|
|
4067
4060
|
toolName: part.toolName,
|
|
4068
4061
|
input: void 0,
|
|
4069
|
-
|
|
4062
|
+
error: part.result,
|
|
4070
4063
|
providerExecuted: true,
|
|
4071
4064
|
dynamic: part.dynamic
|
|
4072
|
-
};
|
|
4073
|
-
}
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
type: "tool-error",
|
|
4065
|
+
});
|
|
4066
|
+
} else {
|
|
4067
|
+
contentParts.push({
|
|
4068
|
+
type: "tool-result",
|
|
4077
4069
|
toolCallId: part.toolCallId,
|
|
4078
4070
|
toolName: part.toolName,
|
|
4079
|
-
input:
|
|
4080
|
-
|
|
4071
|
+
input: void 0,
|
|
4072
|
+
output: part.result,
|
|
4081
4073
|
providerExecuted: true,
|
|
4082
|
-
dynamic:
|
|
4083
|
-
};
|
|
4074
|
+
dynamic: part.dynamic
|
|
4075
|
+
});
|
|
4084
4076
|
}
|
|
4085
|
-
|
|
4077
|
+
break;
|
|
4078
|
+
}
|
|
4079
|
+
if (part.isError) {
|
|
4080
|
+
contentParts.push({
|
|
4081
|
+
type: "tool-error",
|
|
4082
|
+
toolCallId: part.toolCallId,
|
|
4083
|
+
toolName: part.toolName,
|
|
4084
|
+
input: toolCall.input,
|
|
4085
|
+
error: part.result,
|
|
4086
|
+
providerExecuted: true,
|
|
4087
|
+
dynamic: toolCall.dynamic
|
|
4088
|
+
});
|
|
4089
|
+
} else {
|
|
4090
|
+
contentParts.push({
|
|
4086
4091
|
type: "tool-result",
|
|
4087
4092
|
toolCallId: part.toolCallId,
|
|
4088
4093
|
toolName: part.toolName,
|
|
@@ -4090,13 +4095,16 @@ function asContent({
|
|
|
4090
4095
|
output: part.result,
|
|
4091
4096
|
providerExecuted: true,
|
|
4092
4097
|
dynamic: toolCall.dynamic
|
|
4093
|
-
};
|
|
4098
|
+
});
|
|
4094
4099
|
}
|
|
4100
|
+
break;
|
|
4095
4101
|
}
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4102
|
+
case "tool-approval-request": {
|
|
4103
|
+
break;
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4107
|
+
return [...contentParts, ...toolOutputs, ...toolApprovalRequests];
|
|
4100
4108
|
}
|
|
4101
4109
|
|
|
4102
4110
|
// src/generate-text/stream-text.ts
|
|
@@ -5387,6 +5395,9 @@ function runToolsTransformation({
|
|
|
5387
5395
|
}
|
|
5388
5396
|
break;
|
|
5389
5397
|
}
|
|
5398
|
+
case "tool-approval-request": {
|
|
5399
|
+
break;
|
|
5400
|
+
}
|
|
5390
5401
|
default: {
|
|
5391
5402
|
const _exhaustiveCheck = chunkType;
|
|
5392
5403
|
throw new Error(`Unhandled chunk type: ${_exhaustiveCheck}`);
|