@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.
@@ -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",