@copilotkit/core 1.55.3 → 1.56.0

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.umd.js CHANGED
@@ -628,6 +628,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
628
628
  _defineProperty(this, "singleEndpointUrl", void 0);
629
629
  _defineProperty(this, "runtimeMode", void 0);
630
630
  _defineProperty(this, "intelligence", void 0);
631
+ _defineProperty(this, "_capabilities", void 0);
631
632
  _defineProperty(this, "delegate", void 0);
632
633
  _defineProperty(this, "runtimeInfoPromise", void 0);
633
634
  this.runtimeUrl = normalizedRuntimeUrl !== null && normalizedRuntimeUrl !== void 0 ? normalizedRuntimeUrl : config.runtimeUrl;
@@ -635,8 +636,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
635
636
  this.transport = transport;
636
637
  this.runtimeMode = (_config$runtimeMode = config.runtimeMode) !== null && _config$runtimeMode !== void 0 ? _config$runtimeMode : _copilotkit_shared.RUNTIME_MODE_SSE;
637
638
  this.intelligence = config.intelligence;
639
+ this._capabilities = config.capabilities;
640
+ if (config.debug) this.debug = config.debug;
638
641
  if (this.transport === "single") this.singleEndpointUrl = this.runtimeUrl;
639
642
  }
643
+ get capabilities() {
644
+ return this._capabilities;
645
+ }
646
+ async getCapabilities() {
647
+ var _this$_capabilities;
648
+ return (_this$_capabilities = this._capabilities) !== null && _this$_capabilities !== void 0 ? _this$_capabilities : {};
649
+ }
640
650
  async detachActiveRun() {
641
651
  if (this.delegate) await this.delegate.detachActiveRun();
642
652
  await super.detachActiveRun();
@@ -742,7 +752,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
742
752
  credentials: this.credentials,
743
753
  transport: this.transport,
744
754
  runtimeMode: this.runtimeMode,
745
- intelligence: this.intelligence
755
+ intelligence: this.intelligence,
756
+ capabilities: this._capabilities,
757
+ debug: this.debug
746
758
  });
747
759
  cloned.threadId = this.threadId;
748
760
  cloned.setState(this.state);
@@ -1072,7 +1084,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1072
1084
  const runtimeInfoResponse = await this.fetchRuntimeInfo();
1073
1085
  const { version, ...runtimeInfo } = runtimeInfoResponse;
1074
1086
  const credentials = this.core.credentials;
1075
- this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description }]) => {
1087
+ const rawDebug = this.core.debug;
1088
+ this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description, capabilities }]) => {
1076
1089
  var _runtimeInfoResponse$;
1077
1090
  const agent = new ProxiedCopilotRuntimeAgent({
1078
1091
  runtimeUrl: this.runtimeUrl,
@@ -1081,7 +1094,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1081
1094
  transport: this._runtimeTransport,
1082
1095
  credentials,
1083
1096
  runtimeMode: (_runtimeInfoResponse$ = runtimeInfoResponse.mode) !== null && _runtimeInfoResponse$ !== void 0 ? _runtimeInfoResponse$ : _copilotkit_shared.RUNTIME_MODE_SSE,
1084
- intelligence: runtimeInfoResponse.intelligence
1097
+ intelligence: runtimeInfoResponse.intelligence,
1098
+ capabilities,
1099
+ debug: rawDebug ? (0, _copilotkit_shared.resolveDebugConfig)(rawDebug) : void 0
1085
1100
  });
1086
1101
  this.applyHeadersToAgent(agent);
1087
1102
  return [id, agent];
@@ -1669,6 +1684,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1669
1684
  agent.setMessages([]);
1670
1685
  agent.setState({});
1671
1686
  if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
1687
+ await this._internal.notifySubscribers((subscriber) => {
1688
+ var _subscriber$onAgentRu;
1689
+ return (_subscriber$onAgentRu = subscriber.onAgentRunStarted) === null || _subscriber$onAgentRu === void 0 ? void 0 : _subscriber$onAgentRu.call(subscriber, {
1690
+ copilotkit: this.core,
1691
+ agent
1692
+ });
1693
+ }, "Subscriber onAgentRunStarted error:");
1672
1694
  const runAgentResult = await agent.connectAgent({
1673
1695
  forwardedProps: this._internal.properties,
1674
1696
  tools: this.buildFrontendTools(agent.agentId),
@@ -1700,6 +1722,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1700
1722
  if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
1701
1723
  if (agent.detachActiveRun) await agent.detachActiveRun();
1702
1724
  this._internal.subscribeAgentToStateManager(agent);
1725
+ await this._internal.notifySubscribers((subscriber) => {
1726
+ var _subscriber$onAgentRu2;
1727
+ return (_subscriber$onAgentRu2 = subscriber.onAgentRunStarted) === null || _subscriber$onAgentRu2 === void 0 ? void 0 : _subscriber$onAgentRu2.call(subscriber, {
1728
+ copilotkit: this.core,
1729
+ agent
1730
+ });
1731
+ }, "Subscriber onAgentRunStarted error:");
1703
1732
  const isTopLevel = this._runDepth === 0;
1704
1733
  let originalAbortRun;
1705
1734
  if (isTopLevel) {
@@ -2451,11 +2480,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2451
2480
  return CopilotKitCoreRuntimeConnectionStatus;
2452
2481
  }({});
2453
2482
  var CopilotKitCore = class {
2454
- constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [] }) {
2483
+ constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [], debug }) {
2455
2484
  _defineProperty(this, "_headers", void 0);
2456
2485
  _defineProperty(this, "_credentials", void 0);
2457
2486
  _defineProperty(this, "_properties", void 0);
2458
2487
  _defineProperty(this, "_defaultThrottleMs", void 0);
2488
+ _defineProperty(this, "_debug", void 0);
2459
2489
  _defineProperty(this, "subscribers", /* @__PURE__ */ new Set());
2460
2490
  _defineProperty(this, "agentRegistry", void 0);
2461
2491
  _defineProperty(this, "contextStore", void 0);
@@ -2465,6 +2495,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2465
2495
  this._headers = headers;
2466
2496
  this._credentials = credentials;
2467
2497
  this._properties = properties;
2498
+ this._debug = debug;
2468
2499
  this.agentRegistry = new AgentRegistry(this);
2469
2500
  this.contextStore = new ContextStore(this);
2470
2501
  this.suggestionEngine = new SuggestionEngine(this);
@@ -2560,6 +2591,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2560
2591
  }
2561
2592
  this._defaultThrottleMs = value;
2562
2593
  }
2594
+ get debug() {
2595
+ return this._debug;
2596
+ }
2597
+ setDebug(debug) {
2598
+ this._debug = debug;
2599
+ }
2563
2600
  get runtimeConnectionStatus() {
2564
2601
  return this.agentRegistry.runtimeConnectionStatus;
2565
2602
  }