@copilotkitnext/core 1.51.4-next.7 → 1.51.4

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/index.mjs CHANGED
@@ -33,7 +33,9 @@ var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
33
33
  const transport = config.transport ?? "rest";
34
34
  const runUrl = transport === "single" ? normalizedRuntimeUrl ?? config.runtimeUrl ?? "" : `${normalizedRuntimeUrl ?? config.runtimeUrl}/agent/${encodeURIComponent(config.agentId ?? "")}/run`;
35
35
  if (!runUrl) {
36
- throw new Error("ProxiedCopilotRuntimeAgent requires a runtimeUrl when transport is set to 'single'.");
36
+ throw new Error(
37
+ "ProxiedCopilotRuntimeAgent requires a runtimeUrl when transport is set to 'single'."
38
+ );
37
39
  }
38
40
  super({
39
41
  ...config,
@@ -57,7 +59,10 @@ var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
57
59
  if (!this.singleEndpointUrl) {
58
60
  return;
59
61
  }
60
- const headers = new Headers({ ...this.headers, "Content-Type": "application/json" });
62
+ const headers = new Headers({
63
+ ...this.headers,
64
+ "Content-Type": "application/json"
65
+ });
61
66
  void fetch(this.singleEndpointUrl, {
62
67
  method: "POST",
63
68
  headers,
@@ -97,13 +102,20 @@ var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
97
102
  if (!this.singleEndpointUrl) {
98
103
  throw new Error("Single endpoint transport requires a runtimeUrl");
99
104
  }
100
- const requestInit = this.createSingleRouteRequestInit(input, "agent/connect", {
101
- agentId: this.agentId
102
- });
105
+ const requestInit = this.createSingleRouteRequestInit(
106
+ input,
107
+ "agent/connect",
108
+ {
109
+ agentId: this.agentId
110
+ }
111
+ );
103
112
  const httpEvents2 = runHttpRequest(this.singleEndpointUrl, requestInit);
104
113
  return withAbortErrorHandling(transformHttpEventStream(httpEvents2));
105
114
  }
106
- const httpEvents = runHttpRequest(`${this.runtimeUrl}/agent/${this.agentId}/connect`, this.requestInit(input));
115
+ const httpEvents = runHttpRequest(
116
+ `${this.runtimeUrl}/agent/${this.agentId}/connect`,
117
+ this.requestInit(input)
118
+ );
107
119
  return withAbortErrorHandling(transformHttpEventStream(httpEvents));
108
120
  }
109
121
  run(input) {
@@ -111,9 +123,13 @@ var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
111
123
  if (!this.singleEndpointUrl) {
112
124
  throw new Error("Single endpoint transport requires a runtimeUrl");
113
125
  }
114
- const requestInit = this.createSingleRouteRequestInit(input, "agent/run", {
115
- agentId: this.agentId
116
- });
126
+ const requestInit = this.createSingleRouteRequestInit(
127
+ input,
128
+ "agent/run",
129
+ {
130
+ agentId: this.agentId
131
+ }
132
+ );
117
133
  const httpEvents = runHttpRequest(this.singleEndpointUrl, requestInit);
118
134
  return withAbortErrorHandling(transformHttpEventStream(httpEvents));
119
135
  }
@@ -129,7 +145,9 @@ var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
129
145
  }
130
146
  createSingleRouteRequestInit(input, method, params) {
131
147
  if (!this.agentId) {
132
- throw new Error("ProxiedCopilotRuntimeAgent requires agentId to make runtime requests");
148
+ throw new Error(
149
+ "ProxiedCopilotRuntimeAgent requires agentId to make runtime requests"
150
+ );
133
151
  }
134
152
  const baseInit = super.requestInit(input);
135
153
  const headers = new Headers(baseInit.headers ?? {});
@@ -140,7 +158,10 @@ var ProxiedCopilotRuntimeAgent = class extends HttpAgent {
140
158
  try {
141
159
  originalBody = JSON.parse(baseInit.body);
142
160
  } catch (error) {
143
- console.warn("ProxiedCopilotRuntimeAgent: failed to parse request body for single route transport", error);
161
+ console.warn(
162
+ "ProxiedCopilotRuntimeAgent: failed to parse request body for single route transport",
163
+ error
164
+ );
144
165
  originalBody = void 0;
145
166
  }
146
167
  }
@@ -272,7 +293,9 @@ var AgentRegistry = class {
272
293
  */
273
294
  applyHeadersToAgent(agent) {
274
295
  if (agent instanceof HttpAgent2) {
275
- agent.headers = { ...this.core.headers };
296
+ agent.headers = {
297
+ ...this.core.headers
298
+ };
276
299
  }
277
300
  }
278
301
  /**
@@ -312,12 +335,16 @@ var AgentRegistry = class {
312
335
  this._audioFileTranscriptionEnabled = false;
313
336
  this.remoteAgents = {};
314
337
  this._agents = this.localAgents;
315
- await this.notifyRuntimeStatusChanged("disconnected" /* Disconnected */);
338
+ await this.notifyRuntimeStatusChanged(
339
+ "disconnected" /* Disconnected */
340
+ );
316
341
  await this.notifyAgentsChanged();
317
342
  return;
318
343
  }
319
344
  this._runtimeConnectionStatus = "connecting" /* Connecting */;
320
- await this.notifyRuntimeStatusChanged("connecting" /* Connecting */);
345
+ await this.notifyRuntimeStatusChanged(
346
+ "connecting" /* Connecting */
347
+ );
321
348
  try {
322
349
  const runtimeInfoResponse = await this.fetchRuntimeInfo();
323
350
  const {
@@ -344,7 +371,9 @@ var AgentRegistry = class {
344
371
  this._runtimeConnectionStatus = "connected" /* Connected */;
345
372
  this._runtimeVersion = version;
346
373
  this._audioFileTranscriptionEnabled = runtimeInfoResponse.audioFileTranscriptionEnabled ?? false;
347
- await this.notifyRuntimeStatusChanged("connected" /* Connected */);
374
+ await this.notifyRuntimeStatusChanged(
375
+ "connected" /* Connected */
376
+ );
348
377
  await this.notifyAgentsChanged();
349
378
  } catch (error) {
350
379
  this._runtimeConnectionStatus = "error" /* Error */;
@@ -352,10 +381,14 @@ var AgentRegistry = class {
352
381
  this._audioFileTranscriptionEnabled = false;
353
382
  this.remoteAgents = {};
354
383
  this._agents = this.localAgents;
355
- await this.notifyRuntimeStatusChanged("error" /* Error */);
384
+ await this.notifyRuntimeStatusChanged(
385
+ "error" /* Error */
386
+ );
356
387
  await this.notifyAgentsChanged();
357
388
  const message = error instanceof Error ? error.message : JSON.stringify(error);
358
- logger.warn(`Failed to load runtime info (${this.runtimeUrl}/info): ${message}`);
389
+ logger.warn(
390
+ `Failed to load runtime info (${this.runtimeUrl}/info): ${message}`
391
+ );
359
392
  const runtimeError = error instanceof Error ? error : new Error(String(error));
360
393
  await this.core.emitError({
361
394
  error: runtimeError,
@@ -386,7 +419,9 @@ var AgentRegistry = class {
386
419
  ...credentials ? { credentials } : {}
387
420
  });
388
421
  if ("ok" in response2 && !response2.ok) {
389
- throw new Error(`Runtime info request failed with status ${response2.status}`);
422
+ throw new Error(
423
+ `Runtime info request failed with status ${response2.status}`
424
+ );
390
425
  }
391
426
  return await response2.json();
392
427
  }
@@ -395,7 +430,9 @@ var AgentRegistry = class {
395
430
  ...credentials ? { credentials } : {}
396
431
  });
397
432
  if ("ok" in response && !response.ok) {
398
- throw new Error(`Runtime info request failed with status ${response.status}`);
433
+ throw new Error(
434
+ `Runtime info request failed with status ${response.status}`
435
+ );
399
436
  }
400
437
  return await response.json();
401
438
  }
@@ -586,26 +623,33 @@ var SuggestionEngine = class {
586
623
  async generateSuggestions(suggestionId, config, consumerAgentId) {
587
624
  let agent = void 0;
588
625
  try {
589
- const suggestionsProviderAgent = this.core.getAgent(
590
- config.providerAgentId ?? "default"
591
- );
626
+ const suggestionsProviderAgent = this.core.getAgent(config.providerAgentId ?? "default");
592
627
  if (!suggestionsProviderAgent) {
593
- throw new Error(`Suggestions provider agent not found: ${config.providerAgentId}`);
628
+ throw new Error(
629
+ `Suggestions provider agent not found: ${config.providerAgentId}`
630
+ );
594
631
  }
595
632
  const suggestionsConsumerAgent = this.core.getAgent(consumerAgentId);
596
633
  if (!suggestionsConsumerAgent) {
597
- throw new Error(`Suggestions consumer agent not found: ${consumerAgentId}`);
634
+ throw new Error(
635
+ `Suggestions consumer agent not found: ${consumerAgentId}`
636
+ );
598
637
  }
599
638
  const clonedAgent = suggestionsProviderAgent.clone();
600
639
  agent = clonedAgent;
601
640
  agent.threadId = suggestionId;
602
- agent.messages = JSON.parse(JSON.stringify(suggestionsConsumerAgent.messages));
641
+ agent.messages = JSON.parse(
642
+ JSON.stringify(suggestionsConsumerAgent.messages)
643
+ );
603
644
  agent.state = JSON.parse(JSON.stringify(suggestionsConsumerAgent.state));
604
645
  this._suggestions[consumerAgentId] = {
605
646
  ...this._suggestions[consumerAgentId] ?? {},
606
647
  [suggestionId]: []
607
648
  };
608
- this._runningSuggestions[consumerAgentId] = [...this._runningSuggestions[consumerAgentId] ?? [], agent];
649
+ this._runningSuggestions[consumerAgentId] = [
650
+ ...this._runningSuggestions[consumerAgentId] ?? [],
651
+ agent
652
+ ];
609
653
  agent.addMessage({
610
654
  id: suggestionId,
611
655
  role: "user",
@@ -618,16 +662,26 @@ var SuggestionEngine = class {
618
662
  });
619
663
  await agent.runAgent(
620
664
  {
621
- context: Object.values(this.core.context),
665
+ context: Object.values(
666
+ this.core.context
667
+ ),
622
668
  forwardedProps: {
623
669
  ...this.core.properties,
624
- toolChoice: { type: "function", function: { name: "copilotkitSuggest" } }
670
+ toolChoice: {
671
+ type: "function",
672
+ function: { name: "copilotkitSuggest" }
673
+ }
625
674
  },
626
675
  tools: [SUGGEST_TOOL]
627
676
  },
628
677
  {
629
678
  onMessagesChanged: ({ messages }) => {
630
- this.extractSuggestions(messages, suggestionId, consumerAgentId, true);
679
+ this.extractSuggestions(
680
+ messages,
681
+ suggestionId,
682
+ consumerAgentId,
683
+ true
684
+ );
631
685
  }
632
686
  }
633
687
  );
@@ -653,7 +707,9 @@ var SuggestionEngine = class {
653
707
  const agentSuggestions = this._suggestions[consumerAgentId];
654
708
  const currentSuggestions = agentSuggestions?.[suggestionId];
655
709
  if (agentSuggestions && currentSuggestions && currentSuggestions.length > 0) {
656
- const finalizedSuggestions = currentSuggestions.filter((suggestion) => suggestion.title !== "" || suggestion.message !== "").map((suggestion) => ({
710
+ const finalizedSuggestions = currentSuggestions.filter(
711
+ (suggestion) => suggestion.title !== "" || suggestion.message !== ""
712
+ ).map((suggestion) => ({
657
713
  ...suggestion,
658
714
  isLoading: false
659
715
  }));
@@ -662,8 +718,14 @@ var SuggestionEngine = class {
662
718
  } else {
663
719
  delete agentSuggestions[suggestionId];
664
720
  }
665
- const allSuggestions = Object.values(this._suggestions[consumerAgentId] ?? {}).flat();
666
- void this.notifySuggestionsChanged(consumerAgentId, allSuggestions, "finalized");
721
+ const allSuggestions = Object.values(
722
+ this._suggestions[consumerAgentId] ?? {}
723
+ ).flat();
724
+ void this.notifySuggestionsChanged(
725
+ consumerAgentId,
726
+ allSuggestions,
727
+ "finalized"
728
+ );
667
729
  }
668
730
  }
669
731
  /**
@@ -707,8 +769,14 @@ var SuggestionEngine = class {
707
769
  const agentSuggestions = this._suggestions[consumerAgentId];
708
770
  if (agentSuggestions) {
709
771
  agentSuggestions[suggestionId] = suggestions;
710
- const allSuggestions = Object.values(this._suggestions[consumerAgentId] ?? {}).flat();
711
- void this.notifySuggestionsChanged(consumerAgentId, allSuggestions, "suggestions changed");
772
+ const allSuggestions = Object.values(
773
+ this._suggestions[consumerAgentId] ?? {}
774
+ ).flat();
775
+ void this.notifySuggestionsChanged(
776
+ consumerAgentId,
777
+ allSuggestions,
778
+ "suggestions changed"
779
+ );
712
780
  }
713
781
  }
714
782
  /**
@@ -797,8 +865,14 @@ var SuggestionEngine = class {
797
865
  ...this._suggestions[consumerAgentId] ?? {},
798
866
  [suggestionId]: suggestions
799
867
  };
800
- const allSuggestions = Object.values(this._suggestions[consumerAgentId] ?? {}).flat();
801
- void this.notifySuggestionsChanged(consumerAgentId, allSuggestions, "static suggestions added");
868
+ const allSuggestions = Object.values(
869
+ this._suggestions[consumerAgentId] ?? {}
870
+ ).flat();
871
+ void this.notifySuggestionsChanged(
872
+ consumerAgentId,
873
+ allSuggestions,
874
+ "static suggestions added"
875
+ );
802
876
  }
803
877
  };
804
878
  function isDynamicSuggestionsConfig(config) {
@@ -837,7 +911,9 @@ var SUGGEST_TOOL = {
837
911
  };
838
912
 
839
913
  // src/core/run-handler.ts
840
- import { HttpAgent as HttpAgent3 } from "@ag-ui/client";
914
+ import {
915
+ HttpAgent as HttpAgent3
916
+ } from "@ag-ui/client";
841
917
  import { randomUUID as randomUUID3, logger as logger2 } from "@copilotkitnext/shared";
842
918
  import { zodToJsonSchema } from "zod-to-json-schema";
843
919
  var RunHandler = class {
@@ -862,9 +938,13 @@ var RunHandler = class {
862
938
  * Add a tool to the registry
863
939
  */
864
940
  addTool(tool) {
865
- const existingToolIndex = this._tools.findIndex((t) => t.name === tool.name && t.agentId === tool.agentId);
941
+ const existingToolIndex = this._tools.findIndex(
942
+ (t) => t.name === tool.name && t.agentId === tool.agentId
943
+ );
866
944
  if (existingToolIndex !== -1) {
867
- logger2.warn(`Tool already exists: '${tool.name}' for agent '${tool.agentId || "global"}', skipping.`);
945
+ logger2.warn(
946
+ `Tool already exists: '${tool.name}' for agent '${tool.agentId || "global"}', skipping.`
947
+ );
868
948
  return;
869
949
  }
870
950
  this._tools.push(tool);
@@ -888,7 +968,9 @@ var RunHandler = class {
888
968
  getTool(params) {
889
969
  const { toolName, agentId } = params;
890
970
  if (agentId) {
891
- const agentTool = this._tools.find((tool) => tool.name === toolName && tool.agentId === agentId);
971
+ const agentTool = this._tools.find(
972
+ (tool) => tool.name === toolName && tool.agentId === agentId
973
+ );
892
974
  if (agentTool) {
893
975
  return agentTool;
894
976
  }
@@ -904,13 +986,17 @@ var RunHandler = class {
904
986
  /**
905
987
  * Connect an agent (establish initial connection)
906
988
  */
907
- async connectAgent({ agent }) {
989
+ async connectAgent({
990
+ agent
991
+ }) {
908
992
  try {
909
993
  await agent.detachActiveRun();
910
994
  agent.setMessages([]);
911
995
  agent.setState({});
912
996
  if (agent instanceof HttpAgent3) {
913
- agent.headers = { ...this.core.headers };
997
+ agent.headers = {
998
+ ...this.core.headers
999
+ };
914
1000
  }
915
1001
  const runAgentResult = await agent.connectAgent(
916
1002
  {
@@ -937,19 +1023,25 @@ var RunHandler = class {
937
1023
  /**
938
1024
  * Run an agent
939
1025
  */
940
- async runAgent({ agent }) {
1026
+ async runAgent({
1027
+ agent
1028
+ }) {
941
1029
  if (agent.agentId) {
942
1030
  void this.core.suggestionEngine.clearSuggestions(agent.agentId);
943
1031
  }
944
1032
  if (agent instanceof HttpAgent3) {
945
- agent.headers = { ...this.core.headers };
1033
+ agent.headers = {
1034
+ ...this.core.headers
1035
+ };
946
1036
  }
947
1037
  try {
948
1038
  const runAgentResult = await agent.runAgent(
949
1039
  {
950
1040
  forwardedProps: this.core.properties,
951
1041
  tools: this.buildFrontendTools(agent.agentId),
952
- context: Object.values(this.core.context)
1042
+ context: Object.values(
1043
+ this.core.context
1044
+ )
953
1045
  },
954
1046
  this.createAgentErrorSubscriber(agent)
955
1047
  );
@@ -981,20 +1073,37 @@ var RunHandler = class {
981
1073
  for (const message of newMessages) {
982
1074
  if (message.role === "assistant") {
983
1075
  for (const toolCall of message.toolCalls || []) {
984
- if (newMessages.findIndex((m) => m.role === "tool" && m.toolCallId === toolCall.id) === -1) {
1076
+ if (newMessages.findIndex(
1077
+ (m) => m.role === "tool" && m.toolCallId === toolCall.id
1078
+ ) === -1) {
985
1079
  const tool = this.getTool({
986
1080
  toolName: toolCall.function.name,
987
1081
  agentId: agent.agentId
988
1082
  });
989
1083
  if (tool) {
990
- const followUp = await this.executeSpecificTool(tool, toolCall, message, agent, agentId);
1084
+ const followUp = await this.executeSpecificTool(
1085
+ tool,
1086
+ toolCall,
1087
+ message,
1088
+ agent,
1089
+ agentId
1090
+ );
991
1091
  if (followUp) {
992
1092
  needsFollowUp = true;
993
1093
  }
994
1094
  } else {
995
- const wildcardTool = this.getTool({ toolName: "*", agentId: agent.agentId });
1095
+ const wildcardTool = this.getTool({
1096
+ toolName: "*",
1097
+ agentId: agent.agentId
1098
+ });
996
1099
  if (wildcardTool) {
997
- const followUp = await this.executeWildcardTool(wildcardTool, toolCall, message, agent, agentId);
1100
+ const followUp = await this.executeWildcardTool(
1101
+ wildcardTool,
1102
+ toolCall,
1103
+ message,
1104
+ agent,
1105
+ agentId
1106
+ );
998
1107
  if (followUp) {
999
1108
  needsFollowUp = true;
1000
1109
  }
@@ -1053,7 +1162,10 @@ var RunHandler = class {
1053
1162
  );
1054
1163
  if (!errorMessage) {
1055
1164
  try {
1056
- const result = await tool.handler(parsedArgs, { toolCall, agent });
1165
+ const result = await tool.handler(parsedArgs, {
1166
+ toolCall,
1167
+ agent
1168
+ });
1057
1169
  if (result === void 0 || result === null) {
1058
1170
  toolCallResult = "";
1059
1171
  } else if (typeof result === "string") {
@@ -1064,18 +1176,20 @@ var RunHandler = class {
1064
1176
  } catch (error) {
1065
1177
  const handlerError = error instanceof Error ? error : new Error(String(error));
1066
1178
  errorMessage = handlerError.message;
1067
- await this.core.emitError({
1068
- error: handlerError,
1069
- code: "tool_handler_failed" /* TOOL_HANDLER_FAILED */,
1070
- context: {
1071
- agentId,
1072
- toolCallId: toolCall.id,
1073
- toolName: toolCall.function.name,
1074
- parsedArgs,
1075
- toolType: "specific",
1076
- messageId: message.id
1179
+ await this.core.emitError(
1180
+ {
1181
+ error: handlerError,
1182
+ code: "tool_handler_failed" /* TOOL_HANDLER_FAILED */,
1183
+ context: {
1184
+ agentId,
1185
+ toolCallId: toolCall.id,
1186
+ toolName: toolCall.function.name,
1187
+ parsedArgs,
1188
+ toolType: "specific",
1189
+ messageId: message.id
1190
+ }
1077
1191
  }
1078
- });
1192
+ );
1079
1193
  }
1080
1194
  }
1081
1195
  if (errorMessage) {
@@ -1161,7 +1275,10 @@ var RunHandler = class {
1161
1275
  );
1162
1276
  if (!errorMessage) {
1163
1277
  try {
1164
- const result = await wildcardTool.handler(wildcardArgs, { toolCall, agent });
1278
+ const result = await wildcardTool.handler(wildcardArgs, {
1279
+ toolCall,
1280
+ agent
1281
+ });
1165
1282
  if (result === void 0 || result === null) {
1166
1283
  toolCallResult = "";
1167
1284
  } else if (typeof result === "string") {
@@ -1172,18 +1289,20 @@ var RunHandler = class {
1172
1289
  } catch (error) {
1173
1290
  const handlerError = error instanceof Error ? error : new Error(String(error));
1174
1291
  errorMessage = handlerError.message;
1175
- await this.core.emitError({
1176
- error: handlerError,
1177
- code: "tool_handler_failed" /* TOOL_HANDLER_FAILED */,
1178
- context: {
1179
- agentId,
1180
- toolCallId: toolCall.id,
1181
- toolName: toolCall.function.name,
1182
- parsedArgs: wildcardArgs,
1183
- toolType: "wildcard",
1184
- messageId: message.id
1292
+ await this.core.emitError(
1293
+ {
1294
+ error: handlerError,
1295
+ code: "tool_handler_failed" /* TOOL_HANDLER_FAILED */,
1296
+ context: {
1297
+ agentId,
1298
+ toolCallId: toolCall.id,
1299
+ toolName: toolCall.function.name,
1300
+ parsedArgs: wildcardArgs,
1301
+ toolType: "wildcard",
1302
+ messageId: message.id
1303
+ }
1185
1304
  }
1186
- });
1305
+ );
1187
1306
  }
1188
1307
  }
1189
1308
  if (errorMessage) {
@@ -1249,9 +1368,13 @@ var RunHandler = class {
1249
1368
  };
1250
1369
  return {
1251
1370
  onRunFailed: async ({ error }) => {
1252
- await emitAgentError(error, "agent_run_failed_event" /* AGENT_RUN_FAILED_EVENT */, {
1253
- source: "onRunFailed"
1254
- });
1371
+ await emitAgentError(
1372
+ error,
1373
+ "agent_run_failed_event" /* AGENT_RUN_FAILED_EVENT */,
1374
+ {
1375
+ source: "onRunFailed"
1376
+ }
1377
+ );
1255
1378
  },
1256
1379
  onRunErrorEvent: async ({ event }) => {
1257
1380
  const eventError = event?.rawEvent instanceof Error ? event.rawEvent : event?.rawEvent?.error instanceof Error ? event.rawEvent.error : void 0;
@@ -1260,11 +1383,15 @@ var RunHandler = class {
1260
1383
  if (event?.code && !rawError.code) {
1261
1384
  rawError.code = event.code;
1262
1385
  }
1263
- await emitAgentError(rawError, "agent_run_error_event" /* AGENT_RUN_ERROR_EVENT */, {
1264
- source: "onRunErrorEvent",
1265
- event,
1266
- runtimeErrorCode: event?.code
1267
- });
1386
+ await emitAgentError(
1387
+ rawError,
1388
+ "agent_run_error_event" /* AGENT_RUN_ERROR_EVENT */,
1389
+ {
1390
+ source: "onRunErrorEvent",
1391
+ event,
1392
+ runtimeErrorCode: event?.code
1393
+ }
1394
+ );
1268
1395
  }
1269
1396
  };
1270
1397
  }
@@ -1638,7 +1765,9 @@ var CopilotKitCore = class {
1638
1765
  */
1639
1766
  setHeaders(headers) {
1640
1767
  this._headers = headers;
1641
- this.agentRegistry.applyHeadersToAgents(this.agentRegistry.agents);
1768
+ this.agentRegistry.applyHeadersToAgents(
1769
+ this.agentRegistry.agents
1770
+ );
1642
1771
  void this.notifySubscribers(
1643
1772
  (subscriber) => subscriber.onHeadersChanged?.({
1644
1773
  copilotkit: this,
@@ -1649,7 +1778,9 @@ var CopilotKitCore = class {
1649
1778
  }
1650
1779
  setCredentials(credentials) {
1651
1780
  this._credentials = credentials;
1652
- this.agentRegistry.applyCredentialsToAgents(this.agentRegistry.agents);
1781
+ this.agentRegistry.applyCredentialsToAgents(
1782
+ this.agentRegistry.agents
1783
+ );
1653
1784
  }
1654
1785
  setProperties(properties) {
1655
1786
  this._properties = properties;