@yourgpt/copilot-sdk 2.1.6 → 2.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.
@@ -2286,7 +2286,11 @@ ${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)
2289
+ if (msg.role === "assistant" && msg.tool_calls?.length && msg.tool_calls.every(
2290
+ (tc) => !pendingIds.has(tc?.id ?? "")
2291
+ ))
2292
+ continue;
2293
+ if (msg.role === "tool" && msg.tool_call_id && pendingIds.has(msg.tool_call_id))
2290
2294
  continue;
2291
2295
  messagesToInsert.push({
2292
2296
  id: generateMessageId(),
@@ -2405,6 +2409,15 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt;
2405
2409
  if (chunk.type === "message:delta") {
2406
2410
  this.callbacks.onMessageDelta?.(assistantMessage.id, chunk.content);
2407
2411
  }
2412
+ if (chunk.type === "thread:created") {
2413
+ const serverThreadId = chunk.threadId;
2414
+ if (!this.config.threadId || this.config.threadId !== serverThreadId) {
2415
+ this.config.threadId = serverThreadId;
2416
+ this.sessionInitPromise = null;
2417
+ this.setSessionStatus("ready");
2418
+ this.callbacks.onThreadChange?.(serverThreadId);
2419
+ }
2420
+ }
2408
2421
  if (isStreamDone(chunk)) {
2409
2422
  this.debug("streamDone", {
2410
2423
  chunkType: chunk.type,
@@ -5941,5 +5954,5 @@ function useMCPTools(config) {
5941
5954
  }
5942
5955
 
5943
5956
  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 };
5944
- //# sourceMappingURL=chunk-2JNH3T6H.js.map
5945
- //# sourceMappingURL=chunk-2JNH3T6H.js.map
5957
+ //# sourceMappingURL=chunk-ISOMZAYN.js.map
5958
+ //# sourceMappingURL=chunk-ISOMZAYN.js.map