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