@yourgpt/copilot-sdk 1.4.2 → 1.4.31
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-CGBPUUOT.js} +20 -4
- package/dist/chunk-CGBPUUOT.js.map +1 -0
- package/dist/{chunk-ZR4YXLCM.cjs → chunk-FCWLHNLI.cjs} +20 -4
- package/dist/chunk-FCWLHNLI.cjs.map +1 -0
- package/dist/react/index.cjs +37 -37
- package/dist/react/index.d.cts +3 -2
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +1 -1
- package/dist/ui/index.cjs +4 -4
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-B3FE7HDI.js.map +0 -1
- package/dist/chunk-ZR4YXLCM.cjs.map +0 -1
|
@@ -438,6 +438,7 @@ var AbstractChat = class {
|
|
|
438
438
|
* Dynamic context from useAIContext hook
|
|
439
439
|
*/
|
|
440
440
|
this.dynamicContext = "";
|
|
441
|
+
this.isDisposed = false;
|
|
441
442
|
this.config = {
|
|
442
443
|
runtimeUrl: init.runtimeUrl,
|
|
443
444
|
llm: init.llm,
|
|
@@ -674,6 +675,10 @@ var AbstractChat = class {
|
|
|
674
675
|
*/
|
|
675
676
|
emit(type, data) {
|
|
676
677
|
const event = { type, ...data };
|
|
678
|
+
const handlers = this.eventHandlers.get(type);
|
|
679
|
+
if (type === "toolCalls") {
|
|
680
|
+
this.debug(`emit(toolCalls): ${handlers?.size || 0} handlers registered`);
|
|
681
|
+
}
|
|
677
682
|
this.eventHandlers.get(type)?.forEach((handler) => handler(event));
|
|
678
683
|
}
|
|
679
684
|
// ============================================
|
|
@@ -716,7 +721,7 @@ var AbstractChat = class {
|
|
|
716
721
|
* Build the request payload
|
|
717
722
|
*/
|
|
718
723
|
buildRequest() {
|
|
719
|
-
const tools = this.config.tools?.map((tool) => ({
|
|
724
|
+
const tools = this.config.tools?.filter((tool) => tool.available !== false).map((tool) => ({
|
|
720
725
|
name: tool.name,
|
|
721
726
|
description: tool.description,
|
|
722
727
|
inputSchema: tool.inputSchema
|
|
@@ -905,6 +910,12 @@ ${this.dynamicContext}`.trim() : this.config.systemPrompt,
|
|
|
905
910
|
* Dispose and cleanup
|
|
906
911
|
*/
|
|
907
912
|
dispose() {
|
|
913
|
+
if (this.isDisposed) {
|
|
914
|
+
this.debug("dispose() called but already disposed - ignoring");
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
this.debug("dispose() - clearing event handlers");
|
|
918
|
+
this.isDisposed = true;
|
|
908
919
|
this.stop();
|
|
909
920
|
this.eventHandlers.clear();
|
|
910
921
|
}
|
|
@@ -1339,9 +1350,14 @@ var ChatWithTools = class {
|
|
|
1339
1350
|
* Wire up internal events between chat and agent loop
|
|
1340
1351
|
*/
|
|
1341
1352
|
wireEvents() {
|
|
1353
|
+
this.debug("Wiring up toolCalls event handler");
|
|
1342
1354
|
this.chat.on("toolCalls", async (event) => {
|
|
1355
|
+
this.debug("\u{1F3AF} toolCalls event handler FIRED", event);
|
|
1343
1356
|
const toolCalls = event.toolCalls;
|
|
1344
|
-
if (!toolCalls?.length)
|
|
1357
|
+
if (!toolCalls?.length) {
|
|
1358
|
+
this.debug("No tool calls in event");
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1345
1361
|
this.debug("Tool calls received:", toolCalls);
|
|
1346
1362
|
const toolCallInfos = toolCalls.map((tc) => {
|
|
1347
1363
|
const tcAny = tc;
|
|
@@ -3800,5 +3816,5 @@ exports.useToolExecutor = useToolExecutor;
|
|
|
3800
3816
|
exports.useToolWithSchema = useToolWithSchema;
|
|
3801
3817
|
exports.useTools = useTools;
|
|
3802
3818
|
exports.useToolsWithSchema = useToolsWithSchema;
|
|
3803
|
-
//# sourceMappingURL=chunk-
|
|
3804
|
-
//# sourceMappingURL=chunk-
|
|
3819
|
+
//# sourceMappingURL=chunk-FCWLHNLI.cjs.map
|
|
3820
|
+
//# sourceMappingURL=chunk-FCWLHNLI.cjs.map
|