@yourgpt/copilot-sdk 1.4.2 → 1.4.3
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-B3FE7HDI.js → chunk-ILVX5S3Y.js} +20 -4
- package/dist/chunk-ILVX5S3Y.js.map +1 -0
- package/dist/{chunk-ZR4YXLCM.cjs → chunk-N24PPVNQ.cjs} +20 -4
- package/dist/chunk-N24PPVNQ.cjs.map +1 -0
- package/dist/react/index.cjs +37 -37
- package/dist/react/index.d.cts +1 -0
- package/dist/react/index.d.ts +1 -0
- 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-B3FE7HDI.js.map +0 -1
- package/dist/chunk-ZR4YXLCM.cjs.map +0 -1
|
@@ -416,6 +416,7 @@ var AbstractChat = class {
|
|
|
416
416
|
* Dynamic context from useAIContext hook
|
|
417
417
|
*/
|
|
418
418
|
this.dynamicContext = "";
|
|
419
|
+
this.isDisposed = false;
|
|
419
420
|
this.config = {
|
|
420
421
|
runtimeUrl: init.runtimeUrl,
|
|
421
422
|
llm: init.llm,
|
|
@@ -652,6 +653,10 @@ var AbstractChat = class {
|
|
|
652
653
|
*/
|
|
653
654
|
emit(type, data) {
|
|
654
655
|
const event = { type, ...data };
|
|
656
|
+
const handlers = this.eventHandlers.get(type);
|
|
657
|
+
if (type === "toolCalls") {
|
|
658
|
+
this.debug(`emit(toolCalls): ${handlers?.size || 0} handlers registered`);
|
|
659
|
+
}
|
|
655
660
|
this.eventHandlers.get(type)?.forEach((handler) => handler(event));
|
|
656
661
|
}
|
|
657
662
|
// ============================================
|
|
@@ -694,7 +699,7 @@ var AbstractChat = class {
|
|
|
694
699
|
* Build the request payload
|
|
695
700
|
*/
|
|
696
701
|
buildRequest() {
|
|
697
|
-
const tools = this.config.tools?.map((tool) => ({
|
|
702
|
+
const tools = this.config.tools?.filter((tool) => tool.available !== false).map((tool) => ({
|
|
698
703
|
name: tool.name,
|
|
699
704
|
description: tool.description,
|
|
700
705
|
inputSchema: tool.inputSchema
|
|
@@ -883,6 +888,12 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt,
|
|
|
883
888
|
* Dispose and cleanup
|
|
884
889
|
*/
|
|
885
890
|
dispose() {
|
|
891
|
+
if (this.isDisposed) {
|
|
892
|
+
this.debug("dispose() called but already disposed - ignoring");
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
this.debug("dispose() - clearing event handlers");
|
|
896
|
+
this.isDisposed = true;
|
|
886
897
|
this.stop();
|
|
887
898
|
this.eventHandlers.clear();
|
|
888
899
|
}
|
|
@@ -1317,9 +1328,14 @@ var ChatWithTools = class {
|
|
|
1317
1328
|
* Wire up internal events between chat and agent loop
|
|
1318
1329
|
*/
|
|
1319
1330
|
wireEvents() {
|
|
1331
|
+
this.debug("Wiring up toolCalls event handler");
|
|
1320
1332
|
this.chat.on("toolCalls", async (event) => {
|
|
1333
|
+
this.debug("\u{1F3AF} toolCalls event handler FIRED", event);
|
|
1321
1334
|
const toolCalls = event.toolCalls;
|
|
1322
|
-
if (!toolCalls?.length)
|
|
1335
|
+
if (!toolCalls?.length) {
|
|
1336
|
+
this.debug("No tool calls in event");
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1323
1339
|
this.debug("Tool calls received:", toolCalls);
|
|
1324
1340
|
const toolCallInfos = toolCalls.map((tc) => {
|
|
1325
1341
|
const tcAny = tc;
|
|
@@ -3743,5 +3759,5 @@ function useChat(config) {
|
|
|
3743
3759
|
}
|
|
3744
3760
|
|
|
3745
3761
|
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 };
|
|
3746
|
-
//# sourceMappingURL=chunk-
|
|
3747
|
-
//# sourceMappingURL=chunk-
|
|
3762
|
+
//# sourceMappingURL=chunk-ILVX5S3Y.js.map
|
|
3763
|
+
//# sourceMappingURL=chunk-ILVX5S3Y.js.map
|