@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.
@@ -2292,7 +2292,11 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt;
2292
2292
  continue;
2293
2293
  }
2294
2294
  if (msg.role === "assistant" && !msg.tool_calls?.length) continue;
2295
- if (msg.role === "assistant" && msg.tool_calls?.length && pendingIds.size === 0)
2295
+ if (msg.role === "assistant" && msg.tool_calls?.length && msg.tool_calls.every(
2296
+ (tc) => !pendingIds.has(tc?.id ?? "")
2297
+ ))
2298
+ continue;
2299
+ if (msg.role === "tool" && msg.tool_call_id && pendingIds.has(msg.tool_call_id))
2296
2300
  continue;
2297
2301
  messagesToInsert.push({
2298
2302
  id: generateMessageId(),
@@ -2411,6 +2415,15 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt;
2411
2415
  if (chunk.type === "message:delta") {
2412
2416
  this.callbacks.onMessageDelta?.(assistantMessage.id, chunk.content);
2413
2417
  }
2418
+ if (chunk.type === "thread:created") {
2419
+ const serverThreadId = chunk.threadId;
2420
+ if (!this.config.threadId || this.config.threadId !== serverThreadId) {
2421
+ this.config.threadId = serverThreadId;
2422
+ this.sessionInitPromise = null;
2423
+ this.setSessionStatus("ready");
2424
+ this.callbacks.onThreadChange?.(serverThreadId);
2425
+ }
2426
+ }
2414
2427
  if (isStreamDone(chunk)) {
2415
2428
  this.debug("streamDone", {
2416
2429
  chunkType: chunk.type,
@@ -5971,5 +5984,5 @@ exports.useMessageHistoryContext = useMessageHistoryContext;
5971
5984
  exports.useSkillContext = useSkillContext;
5972
5985
  exports.useTool = useTool;
5973
5986
  exports.useTools = useTools;
5974
- //# sourceMappingURL=chunk-6ZTITCKU.cjs.map
5975
- //# sourceMappingURL=chunk-6ZTITCKU.cjs.map
5987
+ //# sourceMappingURL=chunk-IDAQU3FP.cjs.map
5988
+ //# sourceMappingURL=chunk-IDAQU3FP.cjs.map