@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 +38 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +24 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +39 -6
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +45 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
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);
|
|
@@ -955,6 +967,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
955
967
|
initialize(agents) {
|
|
956
968
|
this.localAgents = this.assignAgentIds(agents);
|
|
957
969
|
this.applyHeadersToAgents(this.localAgents);
|
|
970
|
+
this.applyCredentialsToAgents(this.localAgents);
|
|
958
971
|
this._agents = this.localAgents;
|
|
959
972
|
}
|
|
960
973
|
/**
|
|
@@ -984,6 +997,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
984
997
|
...this.remoteAgents
|
|
985
998
|
};
|
|
986
999
|
this.applyHeadersToAgents(this._agents);
|
|
1000
|
+
this.applyCredentialsToAgents(this._agents);
|
|
987
1001
|
this.notifyAgentsChanged();
|
|
988
1002
|
}
|
|
989
1003
|
/**
|
|
@@ -993,6 +1007,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
993
1007
|
this.validateAndAssignAgentId(id, agent);
|
|
994
1008
|
this.localAgents[id] = agent;
|
|
995
1009
|
this.applyHeadersToAgent(agent);
|
|
1010
|
+
this.applyCredentialsToAgent(agent);
|
|
996
1011
|
this._agents = {
|
|
997
1012
|
...this.localAgents,
|
|
998
1013
|
...this.remoteAgents
|
|
@@ -1072,7 +1087,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1072
1087
|
const runtimeInfoResponse = await this.fetchRuntimeInfo();
|
|
1073
1088
|
const { version, ...runtimeInfo } = runtimeInfoResponse;
|
|
1074
1089
|
const credentials = this.core.credentials;
|
|
1075
|
-
|
|
1090
|
+
const rawDebug = this.core.debug;
|
|
1091
|
+
this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description, capabilities }]) => {
|
|
1076
1092
|
var _runtimeInfoResponse$;
|
|
1077
1093
|
const agent = new ProxiedCopilotRuntimeAgent({
|
|
1078
1094
|
runtimeUrl: this.runtimeUrl,
|
|
@@ -1081,7 +1097,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1081
1097
|
transport: this._runtimeTransport,
|
|
1082
1098
|
credentials,
|
|
1083
1099
|
runtimeMode: (_runtimeInfoResponse$ = runtimeInfoResponse.mode) !== null && _runtimeInfoResponse$ !== void 0 ? _runtimeInfoResponse$ : _copilotkit_shared.RUNTIME_MODE_SSE,
|
|
1084
|
-
intelligence: runtimeInfoResponse.intelligence
|
|
1100
|
+
intelligence: runtimeInfoResponse.intelligence,
|
|
1101
|
+
capabilities,
|
|
1102
|
+
debug: rawDebug ? (0, _copilotkit_shared.resolveDebugConfig)(rawDebug) : void 0
|
|
1085
1103
|
});
|
|
1086
1104
|
this.applyHeadersToAgent(agent);
|
|
1087
1105
|
return [id, agent];
|
|
@@ -1669,6 +1687,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1669
1687
|
agent.setMessages([]);
|
|
1670
1688
|
agent.setState({});
|
|
1671
1689
|
if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
|
|
1690
|
+
await this._internal.notifySubscribers((subscriber) => {
|
|
1691
|
+
var _subscriber$onAgentRu;
|
|
1692
|
+
return (_subscriber$onAgentRu = subscriber.onAgentRunStarted) === null || _subscriber$onAgentRu === void 0 ? void 0 : _subscriber$onAgentRu.call(subscriber, {
|
|
1693
|
+
copilotkit: this.core,
|
|
1694
|
+
agent
|
|
1695
|
+
});
|
|
1696
|
+
}, "Subscriber onAgentRunStarted error:");
|
|
1672
1697
|
const runAgentResult = await agent.connectAgent({
|
|
1673
1698
|
forwardedProps: this._internal.properties,
|
|
1674
1699
|
tools: this.buildFrontendTools(agent.agentId),
|
|
@@ -1700,6 +1725,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1700
1725
|
if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
|
|
1701
1726
|
if (agent.detachActiveRun) await agent.detachActiveRun();
|
|
1702
1727
|
this._internal.subscribeAgentToStateManager(agent);
|
|
1728
|
+
await this._internal.notifySubscribers((subscriber) => {
|
|
1729
|
+
var _subscriber$onAgentRu2;
|
|
1730
|
+
return (_subscriber$onAgentRu2 = subscriber.onAgentRunStarted) === null || _subscriber$onAgentRu2 === void 0 ? void 0 : _subscriber$onAgentRu2.call(subscriber, {
|
|
1731
|
+
copilotkit: this.core,
|
|
1732
|
+
agent
|
|
1733
|
+
});
|
|
1734
|
+
}, "Subscriber onAgentRunStarted error:");
|
|
1703
1735
|
const isTopLevel = this._runDepth === 0;
|
|
1704
1736
|
let originalAbortRun;
|
|
1705
1737
|
if (isTopLevel) {
|
|
@@ -2078,7 +2110,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2078
2110
|
* Build frontend tools for an agent
|
|
2079
2111
|
*/
|
|
2080
2112
|
buildFrontendTools(agentId) {
|
|
2081
|
-
return this._tools.filter((tool) => tool.available !== false && (!tool.agentId || tool.agentId === agentId)).map((tool) => {
|
|
2113
|
+
return this._tools.filter((tool) => tool.available !== false && tool.available !== "disabled" && (!tool.agentId || tool.agentId === agentId)).map((tool) => {
|
|
2082
2114
|
var _tool$description;
|
|
2083
2115
|
return {
|
|
2084
2116
|
name: tool.name,
|
|
@@ -2451,11 +2483,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2451
2483
|
return CopilotKitCoreRuntimeConnectionStatus;
|
|
2452
2484
|
}({});
|
|
2453
2485
|
var CopilotKitCore = class {
|
|
2454
|
-
constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [] }) {
|
|
2486
|
+
constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [], debug }) {
|
|
2455
2487
|
_defineProperty(this, "_headers", void 0);
|
|
2456
2488
|
_defineProperty(this, "_credentials", void 0);
|
|
2457
2489
|
_defineProperty(this, "_properties", void 0);
|
|
2458
2490
|
_defineProperty(this, "_defaultThrottleMs", void 0);
|
|
2491
|
+
_defineProperty(this, "_debug", void 0);
|
|
2459
2492
|
_defineProperty(this, "subscribers", /* @__PURE__ */ new Set());
|
|
2460
2493
|
_defineProperty(this, "agentRegistry", void 0);
|
|
2461
2494
|
_defineProperty(this, "contextStore", void 0);
|
|
@@ -2465,6 +2498,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2465
2498
|
this._headers = headers;
|
|
2466
2499
|
this._credentials = credentials;
|
|
2467
2500
|
this._properties = properties;
|
|
2501
|
+
this._debug = debug;
|
|
2468
2502
|
this.agentRegistry = new AgentRegistry(this);
|
|
2469
2503
|
this.contextStore = new ContextStore(this);
|
|
2470
2504
|
this.suggestionEngine = new SuggestionEngine(this);
|
|
@@ -2560,6 +2594,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2560
2594
|
}
|
|
2561
2595
|
this._defaultThrottleMs = value;
|
|
2562
2596
|
}
|
|
2597
|
+
get debug() {
|
|
2598
|
+
return this._debug;
|
|
2599
|
+
}
|
|
2600
|
+
setDebug(debug) {
|
|
2601
|
+
this._debug = debug;
|
|
2602
|
+
}
|
|
2563
2603
|
get runtimeConnectionStatus() {
|
|
2564
2604
|
return this.agentRegistry.runtimeConnectionStatus;
|
|
2565
2605
|
}
|