@elizaos/core 1.5.9 → 1.5.10-alpha.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/node/index.node.js
CHANGED
|
@@ -32021,7 +32021,7 @@ function _mergeDicts(left, right) {
|
|
|
32021
32021
|
} else if (typeof merged[key] === "string") {
|
|
32022
32022
|
if (key === "type") {
|
|
32023
32023
|
continue;
|
|
32024
|
-
} else if (["id", "output_version", "model_provider"].includes(key)) {
|
|
32024
|
+
} else if (["id", "name", "output_version", "model_provider"].includes(key)) {
|
|
32025
32025
|
merged[key] = value;
|
|
32026
32026
|
} else {
|
|
32027
32027
|
merged[key] += value;
|
|
@@ -32047,7 +32047,13 @@ function _mergeLists(left, right) {
|
|
|
32047
32047
|
const merged = [...left];
|
|
32048
32048
|
for (const item of right) {
|
|
32049
32049
|
if (typeof item === "object" && item !== null && "index" in item && typeof item.index === "number") {
|
|
32050
|
-
const toMerge = merged.findIndex((leftItem) =>
|
|
32050
|
+
const toMerge = merged.findIndex((leftItem) => {
|
|
32051
|
+
const isObject = typeof leftItem === "object";
|
|
32052
|
+
const indiciesMatch = "index" in leftItem && leftItem.index === item.index;
|
|
32053
|
+
const idsMatch = "id" in leftItem && "id" in item && leftItem?.id === item?.id;
|
|
32054
|
+
const eitherItemMissingID = !("id" in leftItem) || !leftItem?.id || !("id" in item) || !item?.id;
|
|
32055
|
+
return isObject && indiciesMatch && (idsMatch || eitherItemMissingID);
|
|
32056
|
+
});
|
|
32051
32057
|
if (toMerge !== -1 && typeof merged[toMerge] === "object" && merged[toMerge] !== null) {
|
|
32052
32058
|
merged[toMerge] = _mergeDicts(merged[toMerge], item);
|
|
32053
32059
|
} else {
|
|
@@ -32085,36 +32091,50 @@ class AIMessageChunk extends BaseMessageChunk {
|
|
|
32085
32091
|
usage_metadata: fields.usage_metadata !== undefined ? fields.usage_metadata : undefined
|
|
32086
32092
|
};
|
|
32087
32093
|
} else {
|
|
32088
|
-
const
|
|
32089
|
-
const
|
|
32090
|
-
|
|
32091
|
-
|
|
32094
|
+
const groupedToolCallChunks = fields.tool_call_chunks.reduce((acc, chunk) => {
|
|
32095
|
+
const matchedChunkIndex = acc.findIndex(([match]) => {
|
|
32096
|
+
if ("id" in chunk && chunk.id && "index" in chunk && chunk.index !== undefined) {
|
|
32097
|
+
return chunk.id === match.id && chunk.index === match.index;
|
|
32098
|
+
}
|
|
32099
|
+
if ("id" in chunk && chunk.id) {
|
|
32100
|
+
return chunk.id === match.id;
|
|
32101
|
+
}
|
|
32102
|
+
if ("index" in chunk && chunk.index !== undefined) {
|
|
32103
|
+
return chunk.index === match.index;
|
|
32104
|
+
}
|
|
32105
|
+
return false;
|
|
32106
|
+
});
|
|
32107
|
+
if (matchedChunkIndex !== -1) {
|
|
32108
|
+
acc[matchedChunkIndex].push(chunk);
|
|
32109
|
+
} else {
|
|
32110
|
+
acc.push([chunk]);
|
|
32111
|
+
}
|
|
32092
32112
|
return acc;
|
|
32093
|
-
},
|
|
32113
|
+
}, []);
|
|
32094
32114
|
const toolCalls = [];
|
|
32095
32115
|
const invalidToolCalls = [];
|
|
32096
|
-
for (const
|
|
32116
|
+
for (const chunks of groupedToolCallChunks) {
|
|
32097
32117
|
let parsedArgs = {};
|
|
32098
32118
|
const name = chunks[0]?.name ?? "";
|
|
32099
32119
|
const joinedArgs = chunks.map((c) => c.args || "").join("");
|
|
32100
32120
|
const argsStr = joinedArgs.length ? joinedArgs : "{}";
|
|
32101
|
-
const
|
|
32121
|
+
const id = chunks[0]?.id;
|
|
32102
32122
|
try {
|
|
32103
32123
|
parsedArgs = parsePartialJson(argsStr);
|
|
32104
|
-
if (parsedArgs === null || typeof parsedArgs !== "object" || Array.isArray(parsedArgs)) {
|
|
32124
|
+
if (!id || parsedArgs === null || typeof parsedArgs !== "object" || Array.isArray(parsedArgs)) {
|
|
32105
32125
|
throw new Error("Malformed tool call chunk args.");
|
|
32106
32126
|
}
|
|
32107
32127
|
toolCalls.push({
|
|
32108
32128
|
name,
|
|
32109
32129
|
args: parsedArgs,
|
|
32110
|
-
id
|
|
32130
|
+
id,
|
|
32111
32131
|
type: "tool_call"
|
|
32112
32132
|
});
|
|
32113
32133
|
} catch (e) {
|
|
32114
32134
|
invalidToolCalls.push({
|
|
32115
32135
|
name,
|
|
32116
32136
|
args: argsStr,
|
|
32117
|
-
id
|
|
32137
|
+
id,
|
|
32118
32138
|
error: "Malformed args.",
|
|
32119
32139
|
type: "invalid_tool_call"
|
|
32120
32140
|
});
|
|
@@ -46152,5 +46172,5 @@ export {
|
|
|
46152
46172
|
AgentRuntime
|
|
46153
46173
|
};
|
|
46154
46174
|
|
|
46155
|
-
//# debugId=
|
|
46175
|
+
//# debugId=919E5D09308269D664756E2164756E21
|
|
46156
46176
|
//# sourceMappingURL=index.node.js.map
|