@athenaintel/react 0.9.15 → 0.9.17
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/index.cjs +41 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19867,14 +19867,20 @@ const joinExternalMessages = (messages) => {
|
|
|
19867
19867
|
)
|
|
19868
19868
|
);
|
|
19869
19869
|
}
|
|
19870
|
+
const { messages: existingMessages, ...toolCallRest } = toolCall;
|
|
19870
19871
|
const updatedToolCall = {
|
|
19871
|
-
...
|
|
19872
|
+
...toolCallRest,
|
|
19872
19873
|
result: output.result,
|
|
19873
19874
|
artifact: output.artifact,
|
|
19874
19875
|
isError: output.isError,
|
|
19875
|
-
|
|
19876
|
+
...(output.messages ?? existingMessages) !== void 0 && {
|
|
19877
|
+
messages: output.messages ?? existingMessages
|
|
19878
|
+
}
|
|
19876
19879
|
};
|
|
19877
|
-
bindExternalStoreMessage(updatedToolCall, [
|
|
19880
|
+
bindExternalStoreMessage(updatedToolCall, [
|
|
19881
|
+
...getExternalStoreMessages(toolCallRest),
|
|
19882
|
+
output
|
|
19883
|
+
]);
|
|
19878
19884
|
assistantMessage.content[toolCallIdx] = updatedToolCall;
|
|
19879
19885
|
} else {
|
|
19880
19886
|
console.warn(
|
|
@@ -19883,10 +19889,14 @@ const joinExternalMessages = (messages) => {
|
|
|
19883
19889
|
}
|
|
19884
19890
|
} else {
|
|
19885
19891
|
const role = output.role;
|
|
19886
|
-
const
|
|
19892
|
+
const rawContent = typeof output.content === "string" ? [{ type: "text", text: output.content }] : Array.isArray(output.content) ? output.content : [];
|
|
19893
|
+
const content = rawContent.flatMap((c) => {
|
|
19894
|
+
if (!c || typeof c !== "object") {
|
|
19895
|
+
return [];
|
|
19896
|
+
}
|
|
19887
19897
|
const mapped = { ...c };
|
|
19888
19898
|
bindExternalStoreMessage(mapped, output);
|
|
19889
|
-
return mapped;
|
|
19899
|
+
return [mapped];
|
|
19890
19900
|
});
|
|
19891
19901
|
switch (role) {
|
|
19892
19902
|
case "system":
|
|
@@ -20017,7 +20027,13 @@ const convertExternalMessages = (messages, callback, isRunning, metadata) => {
|
|
|
20017
20027
|
const callbackResults = [];
|
|
20018
20028
|
for (const message of messages) {
|
|
20019
20029
|
const output = callback(message, metadata);
|
|
20020
|
-
const
|
|
20030
|
+
const rawOutputs = Array.isArray(output) ? output : [output];
|
|
20031
|
+
const outputs = rawOutputs.filter(
|
|
20032
|
+
(candidate) => candidate != null
|
|
20033
|
+
);
|
|
20034
|
+
if (outputs.length === 0) {
|
|
20035
|
+
continue;
|
|
20036
|
+
}
|
|
20021
20037
|
const result = { input: message, outputs };
|
|
20022
20038
|
callbackResults.push(result);
|
|
20023
20039
|
}
|
|
@@ -20040,37 +20056,40 @@ const warnForUnknownMessagePartType = (type) => {
|
|
|
20040
20056
|
};
|
|
20041
20057
|
const contentToParts = (content) => {
|
|
20042
20058
|
if (typeof content === "string") return [{ type: "text", text: content }];
|
|
20043
|
-
return content.
|
|
20059
|
+
return content.flatMap((part) => {
|
|
20060
|
+
if (!part || typeof part !== "object" || !("type" in part)) {
|
|
20061
|
+
return [];
|
|
20062
|
+
}
|
|
20044
20063
|
const type = part.type;
|
|
20045
20064
|
switch (type) {
|
|
20046
20065
|
case "text":
|
|
20047
|
-
return { type: "text", text: part.text };
|
|
20066
|
+
return [{ type: "text", text: part.text }];
|
|
20048
20067
|
case "text_delta":
|
|
20049
|
-
return { type: "text", text: part.text };
|
|
20068
|
+
return [{ type: "text", text: part.text }];
|
|
20050
20069
|
case "image_url":
|
|
20051
20070
|
if (typeof part.image_url === "string") {
|
|
20052
|
-
return { type: "image", image: part.image_url };
|
|
20071
|
+
return [{ type: "image", image: part.image_url }];
|
|
20053
20072
|
}
|
|
20054
|
-
return {
|
|
20073
|
+
return [{
|
|
20055
20074
|
type: "image",
|
|
20056
20075
|
image: part.image_url.url
|
|
20057
|
-
};
|
|
20076
|
+
}];
|
|
20058
20077
|
case "thinking":
|
|
20059
|
-
return { type: "reasoning", text: part.thinking };
|
|
20078
|
+
return [{ type: "reasoning", text: part.thinking }];
|
|
20060
20079
|
case "reasoning":
|
|
20061
|
-
return {
|
|
20080
|
+
return [{
|
|
20062
20081
|
type: "reasoning",
|
|
20063
20082
|
text: part.summary.map((s) => s.text).join("\n\n\n")
|
|
20064
|
-
};
|
|
20083
|
+
}];
|
|
20065
20084
|
case "tool_use":
|
|
20066
|
-
return
|
|
20085
|
+
return [];
|
|
20067
20086
|
case "input_json_delta":
|
|
20068
|
-
return
|
|
20087
|
+
return [];
|
|
20069
20088
|
default:
|
|
20070
20089
|
warnForUnknownMessagePartType(type);
|
|
20071
|
-
return
|
|
20090
|
+
return [];
|
|
20072
20091
|
}
|
|
20073
|
-
})
|
|
20092
|
+
});
|
|
20074
20093
|
};
|
|
20075
20094
|
const getNumberAtPath = (value, path) => {
|
|
20076
20095
|
let current = value;
|
|
@@ -20175,7 +20194,7 @@ const convertLangChainMessage = (message) => {
|
|
|
20175
20194
|
(_b = message.additional_kwargs) == null ? void 0 : _b.reasoning,
|
|
20176
20195
|
...normalizedContent,
|
|
20177
20196
|
...((_c = message.additional_kwargs) == null ? void 0 : _c.tool_outputs) ?? []
|
|
20178
|
-
].filter((c) => c
|
|
20197
|
+
].filter((c) => c != null);
|
|
20179
20198
|
return {
|
|
20180
20199
|
role: "assistant",
|
|
20181
20200
|
id: message.id,
|
|
@@ -20198,6 +20217,8 @@ const convertLangChainMessage = (message) => {
|
|
|
20198
20217
|
isError: message.status === "error"
|
|
20199
20218
|
};
|
|
20200
20219
|
}
|
|
20220
|
+
default:
|
|
20221
|
+
return null;
|
|
20201
20222
|
}
|
|
20202
20223
|
};
|
|
20203
20224
|
const convertLangChainToThreadMessages = (messages, isRunning = false, metadata = {}) => {
|