@copilotkit/core 1.55.3 → 1.56.1

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.cjs CHANGED
@@ -516,6 +516,7 @@ var ProxiedCopilotRuntimeAgent = class ProxiedCopilotRuntimeAgent extends _ag_ui
516
516
  singleEndpointUrl;
517
517
  runtimeMode;
518
518
  intelligence;
519
+ _capabilities;
519
520
  delegate;
520
521
  runtimeInfoPromise;
521
522
  constructor(config) {
@@ -532,8 +533,16 @@ var ProxiedCopilotRuntimeAgent = class ProxiedCopilotRuntimeAgent extends _ag_ui
532
533
  this.transport = transport;
533
534
  this.runtimeMode = config.runtimeMode ?? _copilotkit_shared.RUNTIME_MODE_SSE;
534
535
  this.intelligence = config.intelligence;
536
+ this._capabilities = config.capabilities;
537
+ if (config.debug) this.debug = config.debug;
535
538
  if (this.transport === "single") this.singleEndpointUrl = this.runtimeUrl;
536
539
  }
540
+ get capabilities() {
541
+ return this._capabilities;
542
+ }
543
+ async getCapabilities() {
544
+ return this._capabilities ?? {};
545
+ }
537
546
  async detachActiveRun() {
538
547
  if (this.delegate) await this.delegate.detachActiveRun();
539
548
  await super.detachActiveRun();
@@ -661,7 +670,9 @@ var ProxiedCopilotRuntimeAgent = class ProxiedCopilotRuntimeAgent extends _ag_ui
661
670
  credentials: this.credentials,
662
671
  transport: this.transport,
663
672
  runtimeMode: this.runtimeMode,
664
- intelligence: this.intelligence
673
+ intelligence: this.intelligence,
674
+ capabilities: this._capabilities,
675
+ debug: this.debug
665
676
  });
666
677
  cloned.threadId = this.threadId;
667
678
  cloned.setState(this.state);
@@ -847,6 +858,7 @@ var AgentRegistry = class {
847
858
  initialize(agents) {
848
859
  this.localAgents = this.assignAgentIds(agents);
849
860
  this.applyHeadersToAgents(this.localAgents);
861
+ this.applyCredentialsToAgents(this.localAgents);
850
862
  this._agents = this.localAgents;
851
863
  }
852
864
  /**
@@ -876,6 +888,7 @@ var AgentRegistry = class {
876
888
  ...this.remoteAgents
877
889
  };
878
890
  this.applyHeadersToAgents(this._agents);
891
+ this.applyCredentialsToAgents(this._agents);
879
892
  this.notifyAgentsChanged();
880
893
  }
881
894
  /**
@@ -885,6 +898,7 @@ var AgentRegistry = class {
885
898
  this.validateAndAssignAgentId(id, agent);
886
899
  this.localAgents[id] = agent;
887
900
  this.applyHeadersToAgent(agent);
901
+ this.applyCredentialsToAgent(agent);
888
902
  this._agents = {
889
903
  ...this.localAgents,
890
904
  ...this.remoteAgents
@@ -963,7 +977,8 @@ var AgentRegistry = class {
963
977
  const runtimeInfoResponse = await this.fetchRuntimeInfo();
964
978
  const { version, ...runtimeInfo } = runtimeInfoResponse;
965
979
  const credentials = this.core.credentials;
966
- this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description }]) => {
980
+ const rawDebug = this.core.debug;
981
+ this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description, capabilities }]) => {
967
982
  const agent = new ProxiedCopilotRuntimeAgent({
968
983
  runtimeUrl: this.runtimeUrl,
969
984
  agentId: id,
@@ -971,7 +986,9 @@ var AgentRegistry = class {
971
986
  transport: this._runtimeTransport,
972
987
  credentials,
973
988
  runtimeMode: runtimeInfoResponse.mode ?? _copilotkit_shared.RUNTIME_MODE_SSE,
974
- intelligence: runtimeInfoResponse.intelligence
989
+ intelligence: runtimeInfoResponse.intelligence,
990
+ capabilities,
991
+ debug: rawDebug ? (0, _copilotkit_shared.resolveDebugConfig)(rawDebug) : void 0
975
992
  });
976
993
  this.applyHeadersToAgent(agent);
977
994
  return [id, agent];
@@ -1539,6 +1556,10 @@ var RunHandler = class {
1539
1556
  agent.setMessages([]);
1540
1557
  agent.setState({});
1541
1558
  if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
1559
+ await this._internal.notifySubscribers((subscriber) => subscriber.onAgentRunStarted?.({
1560
+ copilotkit: this.core,
1561
+ agent
1562
+ }), "Subscriber onAgentRunStarted error:");
1542
1563
  const runAgentResult = await agent.connectAgent({
1543
1564
  forwardedProps: this._internal.properties,
1544
1565
  tools: this.buildFrontendTools(agent.agentId),
@@ -1570,6 +1591,10 @@ var RunHandler = class {
1570
1591
  if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
1571
1592
  if (agent.detachActiveRun) await agent.detachActiveRun();
1572
1593
  this._internal.subscribeAgentToStateManager(agent);
1594
+ await this._internal.notifySubscribers((subscriber) => subscriber.onAgentRunStarted?.({
1595
+ copilotkit: this.core,
1596
+ agent
1597
+ }), "Subscriber onAgentRunStarted error:");
1573
1598
  const isTopLevel = this._runDepth === 0;
1574
1599
  let originalAbortRun;
1575
1600
  if (isTopLevel) {
@@ -1934,7 +1959,7 @@ var RunHandler = class {
1934
1959
  * Build frontend tools for an agent
1935
1960
  */
1936
1961
  buildFrontendTools(agentId) {
1937
- return this._tools.filter((tool) => tool.available !== false && (!tool.agentId || tool.agentId === agentId)).map((tool) => ({
1962
+ return this._tools.filter((tool) => tool.available !== false && tool.available !== "disabled" && (!tool.agentId || tool.agentId === agentId)).map((tool) => ({
1938
1963
  name: tool.name,
1939
1964
  description: tool.description ?? "",
1940
1965
  parameters: createToolSchema(tool)
@@ -2298,16 +2323,18 @@ var CopilotKitCore = class {
2298
2323
  _credentials;
2299
2324
  _properties;
2300
2325
  _defaultThrottleMs;
2326
+ _debug;
2301
2327
  subscribers = /* @__PURE__ */ new Set();
2302
2328
  agentRegistry;
2303
2329
  contextStore;
2304
2330
  suggestionEngine;
2305
2331
  runHandler;
2306
2332
  stateManager;
2307
- constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [] }) {
2333
+ constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [], debug }) {
2308
2334
  this._headers = headers;
2309
2335
  this._credentials = credentials;
2310
2336
  this._properties = properties;
2337
+ this._debug = debug;
2311
2338
  this.agentRegistry = new AgentRegistry(this);
2312
2339
  this.contextStore = new ContextStore(this);
2313
2340
  this.suggestionEngine = new SuggestionEngine(this);
@@ -2400,6 +2427,12 @@ var CopilotKitCore = class {
2400
2427
  }
2401
2428
  this._defaultThrottleMs = value;
2402
2429
  }
2430
+ get debug() {
2431
+ return this._debug;
2432
+ }
2433
+ setDebug(debug) {
2434
+ this._debug = debug;
2435
+ }
2403
2436
  get runtimeConnectionStatus() {
2404
2437
  return this.agentRegistry.runtimeConnectionStatus;
2405
2438
  }