@jarvis-agent/core 0.2.2 → 0.2.3
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/agent/agent-llm.d.ts +2 -2
- package/dist/agent/agent-llm.d.ts.map +1 -1
- package/dist/agent/base.d.ts +2 -2
- package/dist/agent/base.d.ts.map +1 -1
- package/dist/chat/chat-agent.d.ts +2 -2
- package/dist/chat/chat-agent.d.ts.map +1 -1
- package/dist/chat/chat-llm.d.ts +3 -3
- package/dist/chat/chat-llm.d.ts.map +1 -1
- package/dist/index.cjs +32 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +32 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/llm/react.d.ts +6 -6
- package/dist/llm/react.d.ts.map +1 -1
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm.types.d.ts +2 -2
- package/dist/types/llm.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -39433,12 +39433,13 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
|
|
|
39433
39433
|
await errorHandler(request, e, retryNum);
|
|
39434
39434
|
}
|
|
39435
39435
|
Log.warn("callLLM abort error: ", e);
|
|
39436
|
-
|
|
39437
|
-
|
|
39438
|
-
|
|
39439
|
-
|
|
39440
|
-
|
|
39441
|
-
|
|
39436
|
+
const parts = [];
|
|
39437
|
+
if (thinkText)
|
|
39438
|
+
parts.push({ type: "reasoning", text: thinkText });
|
|
39439
|
+
if (streamText)
|
|
39440
|
+
parts.push({ type: "text", text: streamText });
|
|
39441
|
+
parts.push(...toolParts);
|
|
39442
|
+
return parts;
|
|
39442
39443
|
}
|
|
39443
39444
|
else {
|
|
39444
39445
|
if (retryNum < config$1.maxRetryNum) {
|
|
@@ -39454,30 +39455,34 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
|
|
|
39454
39455
|
finally {
|
|
39455
39456
|
reader && reader.releaseLock();
|
|
39456
39457
|
}
|
|
39457
|
-
|
|
39458
|
-
|
|
39459
|
-
|
|
39460
|
-
|
|
39461
|
-
|
|
39462
|
-
|
|
39458
|
+
const resultParts = [];
|
|
39459
|
+
if (thinkText)
|
|
39460
|
+
resultParts.push({ type: "reasoning", text: thinkText });
|
|
39461
|
+
if (streamText)
|
|
39462
|
+
resultParts.push({ type: "text", text: streamText });
|
|
39463
|
+
resultParts.push(...toolParts);
|
|
39464
|
+
return resultParts;
|
|
39463
39465
|
}
|
|
39464
39466
|
function convertAssistantContent(assistantParts) {
|
|
39465
39467
|
return assistantParts
|
|
39466
|
-
.filter((part) => part.type
|
|
39467
|
-
.map((part) =>
|
|
39468
|
-
|
|
39469
|
-
type: "text",
|
|
39470
|
-
|
|
39468
|
+
.filter((part) => part.type === "text" || part.type === "reasoning" || part.type === "tool-call")
|
|
39469
|
+
.map((part) => {
|
|
39470
|
+
if (part.type === "text") {
|
|
39471
|
+
return { type: "text", text: part.text };
|
|
39472
|
+
}
|
|
39473
|
+
if (part.type === "reasoning") {
|
|
39474
|
+
return { type: "reasoning", text: part.text };
|
|
39471
39475
|
}
|
|
39472
|
-
|
|
39476
|
+
return {
|
|
39473
39477
|
type: "tool-call",
|
|
39474
39478
|
toolCallId: part.toolCallId,
|
|
39475
39479
|
toolName: part.toolName,
|
|
39476
|
-
input: typeof part.input
|
|
39480
|
+
input: typeof part.input === "string"
|
|
39477
39481
|
? JSON.parse(part.input || "{}")
|
|
39478
39482
|
: part.input || {},
|
|
39479
39483
|
providerOptions: part.providerOptions,
|
|
39480
|
-
}
|
|
39484
|
+
};
|
|
39485
|
+
});
|
|
39481
39486
|
}
|
|
39482
39487
|
|
|
39483
39488
|
const global = {
|
|
@@ -41599,8 +41604,8 @@ class Agent {
|
|
|
41599
41604
|
if (results.length == 0) {
|
|
41600
41605
|
return null;
|
|
41601
41606
|
}
|
|
41602
|
-
if (results.every((s) => s.type
|
|
41603
|
-
return results.map((s) => s.text).join("\n\n");
|
|
41607
|
+
if (results.every((s) => s.type === "text" || s.type === "reasoning")) {
|
|
41608
|
+
return results.filter((s) => s.type === "text").map((s) => s.text).join("\n\n");
|
|
41604
41609
|
}
|
|
41605
41610
|
const toolCalls = results.filter((s) => s.type == "tool-call");
|
|
41606
41611
|
if (toolCalls.length > 1 &&
|
|
@@ -45156,7 +45161,7 @@ async function callChatLLM(chatId, messageId, rlm, messages, tools, toolChoice,
|
|
|
45156
45161
|
});
|
|
45157
45162
|
}
|
|
45158
45163
|
function convertAssistantToolResults(results) {
|
|
45159
|
-
return results.map((part) => {
|
|
45164
|
+
return results.filter((part) => part.type !== "reasoning").map((part) => {
|
|
45160
45165
|
if (part.type == "text") {
|
|
45161
45166
|
return {
|
|
45162
45167
|
type: "text",
|
|
@@ -45906,10 +45911,13 @@ class ChatAgent {
|
|
|
45906
45911
|
}
|
|
45907
45912
|
for (let i = 0; i < results.length; i++) {
|
|
45908
45913
|
const result = results[i];
|
|
45909
|
-
if (result.type
|
|
45914
|
+
if (result.type === "text") {
|
|
45910
45915
|
text = result.text;
|
|
45911
45916
|
continue;
|
|
45912
45917
|
}
|
|
45918
|
+
if (result.type === "reasoning") {
|
|
45919
|
+
continue;
|
|
45920
|
+
}
|
|
45913
45921
|
let toolResult;
|
|
45914
45922
|
try {
|
|
45915
45923
|
const args = typeof result.input == "string"
|