@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
|
@@ -693,9 +693,12 @@ ${content.trim()}\`\`\``);
|
|
|
693
693
|
const history = await this.memory.getHistory();
|
|
694
694
|
const stream = this.api.createMessage(sysPrompt, history);
|
|
695
695
|
let fullResponseText = "";
|
|
696
|
+
let fullReasoningText = "";
|
|
696
697
|
for await (const chunk of stream) {
|
|
697
698
|
if (chunk.type === "text" && chunk.text) {
|
|
698
699
|
fullResponseText += chunk.text;
|
|
700
|
+
} else if (chunk.type === "reasoning" && chunk.reasoning) {
|
|
701
|
+
fullReasoningText += chunk.reasoning;
|
|
699
702
|
}
|
|
700
703
|
if (this.onStreamChunk) {
|
|
701
704
|
this.onStreamChunk(chunk);
|
|
@@ -703,7 +706,8 @@ ${content.trim()}\`\`\``);
|
|
|
703
706
|
}
|
|
704
707
|
await this.memory.appendMessage({
|
|
705
708
|
role: "assistant",
|
|
706
|
-
content: fullResponseText
|
|
709
|
+
content: fullResponseText,
|
|
710
|
+
...fullReasoningText ? { reasoning: fullReasoningText } : {}
|
|
707
711
|
});
|
|
708
712
|
const parsedBlocks = parseAssistantMessageV2(fullResponseText, this.allToolParamNames);
|
|
709
713
|
const toolUses = parsedBlocks.filter((b) => b.type === "tool_use");
|
|
@@ -1061,6 +1065,11 @@ var NodeApiHandler = class {
|
|
|
1061
1065
|
type: "text",
|
|
1062
1066
|
text: part.textDelta || part.text || ""
|
|
1063
1067
|
};
|
|
1068
|
+
} else if (part.type === "reasoning-delta") {
|
|
1069
|
+
yield {
|
|
1070
|
+
type: "reasoning",
|
|
1071
|
+
reasoning: part.delta || part.text || ""
|
|
1072
|
+
};
|
|
1064
1073
|
} else if (part.type === "finish") {
|
|
1065
1074
|
yield {
|
|
1066
1075
|
type: "usage",
|