@amical/aiagent-sdk 0.1.7 → 0.1.8
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.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/dist/runtime/nodeRuntime.js +10 -1
- package/dist/runtime/nodeRuntime.js.map +1 -1
- package/dist/runtime/nodeRuntime.mjs +10 -1
- package/dist/runtime/nodeRuntime.mjs.map +1 -1
- package/dist/runtime/webRuntime.js +10 -1
- package/dist/runtime/webRuntime.js.map +1 -1
- package/dist/runtime/webRuntime.mjs +10 -1
- package/dist/runtime/webRuntime.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -688,9 +688,12 @@ ${content.trim()}\`\`\``);
|
|
|
688
688
|
const history = await this.memory.getHistory();
|
|
689
689
|
const stream = this.api.createMessage(sysPrompt, history);
|
|
690
690
|
let fullResponseText = "";
|
|
691
|
+
let fullReasoningText = "";
|
|
691
692
|
for await (const chunk of stream) {
|
|
692
693
|
if (chunk.type === "text" && chunk.text) {
|
|
693
694
|
fullResponseText += chunk.text;
|
|
695
|
+
} else if (chunk.type === "reasoning" && chunk.reasoning) {
|
|
696
|
+
fullReasoningText += chunk.reasoning;
|
|
694
697
|
}
|
|
695
698
|
if (this.onStreamChunk) {
|
|
696
699
|
this.onStreamChunk(chunk);
|
|
@@ -698,7 +701,8 @@ ${content.trim()}\`\`\``);
|
|
|
698
701
|
}
|
|
699
702
|
await this.memory.appendMessage({
|
|
700
703
|
role: "assistant",
|
|
701
|
-
content: fullResponseText
|
|
704
|
+
content: fullResponseText,
|
|
705
|
+
...fullReasoningText ? { reasoning: fullReasoningText } : {}
|
|
702
706
|
});
|
|
703
707
|
const parsedBlocks = parseAssistantMessageV2(fullResponseText, this.allToolParamNames);
|
|
704
708
|
const toolUses = parsedBlocks.filter((b) => b.type === "tool_use");
|
|
@@ -1056,6 +1060,11 @@ var WebApiHandler = class {
|
|
|
1056
1060
|
type: "text",
|
|
1057
1061
|
text: part.textDelta || part.text || ""
|
|
1058
1062
|
};
|
|
1063
|
+
} else if (part.type === "reasoning-delta") {
|
|
1064
|
+
yield {
|
|
1065
|
+
type: "reasoning",
|
|
1066
|
+
reasoning: part.delta || part.text || ""
|
|
1067
|
+
};
|
|
1059
1068
|
} else if (part.type === "finish") {
|
|
1060
1069
|
yield {
|
|
1061
1070
|
type: "usage",
|