@yourgpt/copilot-sdk 1.2.3 → 1.2.5
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/{chunk-XPV4Y2CT.js → chunk-6NJKNYYW.js} +15 -16
- package/dist/chunk-6NJKNYYW.js.map +1 -0
- package/dist/{chunk-2IPWAEIC.cjs → chunk-OD6O6TQI.cjs} +15 -16
- package/dist/chunk-OD6O6TQI.cjs.map +1 -0
- package/dist/react/index.cjs +37 -37
- package/dist/react/index.js +1 -1
- package/dist/ui/index.cjs +4 -4
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2IPWAEIC.cjs.map +0 -1
- package/dist/chunk-XPV4Y2CT.js.map +0 -1
|
@@ -132,10 +132,7 @@ function requiresToolExecution(chunk) {
|
|
|
132
132
|
function processStreamChunk(chunk, state) {
|
|
133
133
|
switch (chunk.type) {
|
|
134
134
|
case "message:start":
|
|
135
|
-
return
|
|
136
|
-
...state,
|
|
137
|
-
messageId: chunk.id
|
|
138
|
-
};
|
|
135
|
+
return state;
|
|
139
136
|
case "message:delta":
|
|
140
137
|
return {
|
|
141
138
|
...state,
|
|
@@ -791,14 +788,16 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt,
|
|
|
791
788
|
this.debug("handleStreamResponse", `Processed ${chunkCount} chunks`);
|
|
792
789
|
const finalMessage = streamStateToMessage(this.streamState);
|
|
793
790
|
this.state.updateMessageById(this.streamState.messageId, () => finalMessage);
|
|
794
|
-
this.state.status = "ready";
|
|
795
791
|
if (!finalMessage.content && (!finalMessage.toolCalls || finalMessage.toolCalls.length === 0)) {
|
|
796
792
|
this.debug("warning", "Empty response - no content and no tool calls");
|
|
797
793
|
}
|
|
798
794
|
this.callbacks.onMessageFinish?.(finalMessage);
|
|
799
|
-
this.callbacks.onStatusChange?.("ready");
|
|
800
795
|
this.callbacks.onMessagesChange?.(this.state.messages);
|
|
801
|
-
|
|
796
|
+
if (!toolCallsEmitted) {
|
|
797
|
+
this.state.status = "ready";
|
|
798
|
+
this.callbacks.onStatusChange?.("ready");
|
|
799
|
+
this.callbacks.onFinish?.(this.state.messages);
|
|
800
|
+
}
|
|
802
801
|
this.emit("done", {});
|
|
803
802
|
this.streamState = null;
|
|
804
803
|
}
|
|
@@ -816,15 +815,15 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt,
|
|
|
816
815
|
};
|
|
817
816
|
this.state.pushMessage(message);
|
|
818
817
|
}
|
|
819
|
-
this.state.status = "ready";
|
|
820
|
-
this.callbacks.onStatusChange?.("ready");
|
|
821
818
|
this.callbacks.onMessagesChange?.(this.state.messages);
|
|
822
|
-
this.
|
|
823
|
-
if (
|
|
819
|
+
const hasToolCalls = response.requiresAction && this.state.messages.length > 0 && this.state.messages[this.state.messages.length - 1]?.toolCalls?.length;
|
|
820
|
+
if (hasToolCalls) {
|
|
824
821
|
const lastMessage = this.state.messages[this.state.messages.length - 1];
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
822
|
+
this.emit("toolCalls", { toolCalls: lastMessage.toolCalls });
|
|
823
|
+
} else {
|
|
824
|
+
this.state.status = "ready";
|
|
825
|
+
this.callbacks.onStatusChange?.("ready");
|
|
826
|
+
this.callbacks.onFinish?.(this.state.messages);
|
|
828
827
|
}
|
|
829
828
|
this.emit("done", {});
|
|
830
829
|
}
|
|
@@ -3605,5 +3604,5 @@ function useChat(config) {
|
|
|
3605
3604
|
}
|
|
3606
3605
|
|
|
3607
3606
|
export { AbstractAgentLoop, AbstractChat, CopilotProvider, ReactChat, ReactChatState, ReactThreadManager, ReactThreadManagerState, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createSessionPermissionCache, formatKnowledgeResultsForAI, initialAgentLoopState, searchKnowledgeBase, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useCopilot, useDevLogger, useFeatureSupport, useKnowledgeBase, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
|
|
3608
|
-
//# sourceMappingURL=chunk-
|
|
3609
|
-
//# sourceMappingURL=chunk-
|
|
3607
|
+
//# sourceMappingURL=chunk-6NJKNYYW.js.map
|
|
3608
|
+
//# sourceMappingURL=chunk-6NJKNYYW.js.map
|