@yourgpt/copilot-sdk 2.1.5-alpha.8 → 2.1.6

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.
@@ -2211,7 +2211,7 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt;
2211
2211
  this.handleError(error);
2212
2212
  return;
2213
2213
  }
2214
- if (chunk.type === "message:end" && this.streamState?.content) {
2214
+ if (chunk.type === "message:end" && this.streamState !== null && (this.streamState.content || (this.streamState.toolResults?.size ?? 0) > 0)) {
2215
2215
  this.debug("message:end mid-stream", {
2216
2216
  messageId: this.streamState.messageId,
2217
2217
  contentLength: this.streamState.content.length,
@@ -2286,6 +2286,8 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt;
2286
2286
  continue;
2287
2287
  }
2288
2288
  if (msg.role === "assistant" && !msg.tool_calls?.length) continue;
2289
+ if (msg.role === "assistant" && msg.tool_calls?.length && pendingIds.size === 0)
2290
+ continue;
2289
2291
  messagesToInsert.push({
2290
2292
  id: generateMessageId(),
2291
2293
  role: msg.role,
@@ -5939,5 +5941,5 @@ function useMCPTools(config) {
5939
5941
  }
5940
5942
 
5941
5943
  export { AbstractAgentLoop, AbstractChat, CopilotProvider, MessageHistoryContext, MessageTree, ReactChatState, SkillProvider, createReactChatState, defaultMessageHistoryConfig, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, toDisplayMessage, toLLMMessage, toLLMMessages, useAIContext, useAIContexts, useCopilot, useMCPClient, useMCPTools, useMessageHistory, useMessageHistoryContext, useSkillContext, useTool, useTools };
5942
- //# sourceMappingURL=chunk-FDZVDGNR.js.map
5943
- //# sourceMappingURL=chunk-FDZVDGNR.js.map
5944
+ //# sourceMappingURL=chunk-2JNH3T6H.js.map
5945
+ //# sourceMappingURL=chunk-2JNH3T6H.js.map