@copilotkit/core 1.56.4-canary.1777531098 → 1.56.4-canary.1777629975
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 +3 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -16
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +3 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1196,14 +1196,14 @@ var SuggestionEngine = class {
|
|
|
1196
1196
|
reloadSuggestions(agentId, consumerAgent) {
|
|
1197
1197
|
this.clearSuggestions(agentId);
|
|
1198
1198
|
const agent = consumerAgent ?? this.core.getAgent(agentId);
|
|
1199
|
-
|
|
1199
|
+
if (!agent) return;
|
|
1200
|
+
const messageCount = agent.messages?.length ?? 0;
|
|
1200
1201
|
let hasAnySuggestions = false;
|
|
1201
1202
|
for (const config of Object.values(this._suggestionsConfig)) {
|
|
1202
1203
|
if (config.consumerAgentId !== void 0 && config.consumerAgentId !== "*" && config.consumerAgentId !== agentId) continue;
|
|
1203
1204
|
if (!this.shouldShowSuggestions(config, messageCount)) continue;
|
|
1204
1205
|
const suggestionId = (0, _copilotkit_shared.randomUUID)();
|
|
1205
1206
|
if (isDynamicSuggestionsConfig(config)) {
|
|
1206
|
-
if (!agent) continue;
|
|
1207
1207
|
if (!hasAnySuggestions) {
|
|
1208
1208
|
hasAnySuggestions = true;
|
|
1209
1209
|
this.notifySuggestionsStartedLoading(agentId);
|
|
@@ -1225,19 +1225,6 @@ var SuggestionEngine = class {
|
|
|
1225
1225
|
this.notifySuggestionsChanged(agentId, []);
|
|
1226
1226
|
}
|
|
1227
1227
|
/**
|
|
1228
|
-
* Clear suggestions at the start of a run, but immediately restore static
|
|
1229
|
-
* suggestions that have `available: "always"` so they remain visible
|
|
1230
|
-
* throughout the run.
|
|
1231
|
-
*/
|
|
1232
|
-
clearSuggestionsForRun(agentId) {
|
|
1233
|
-
this.clearSuggestions(agentId);
|
|
1234
|
-
for (const config of Object.values(this._suggestionsConfig)) {
|
|
1235
|
-
if (config.consumerAgentId !== void 0 && config.consumerAgentId !== "*" && config.consumerAgentId !== agentId) continue;
|
|
1236
|
-
if (config.available !== "always") continue;
|
|
1237
|
-
if (isStaticSuggestionsConfig(config)) this.addStaticSuggestions((0, _copilotkit_shared.randomUUID)(), config, agentId);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
1228
|
* Get current suggestions for an agent
|
|
1242
1229
|
*/
|
|
1243
1230
|
getSuggestions(agentId) {
|
|
@@ -1590,7 +1577,7 @@ var RunHandler = class {
|
|
|
1590
1577
|
* Run an agent
|
|
1591
1578
|
*/
|
|
1592
1579
|
async runAgent({ agent, forwardedProps }) {
|
|
1593
|
-
if (agent.agentId) this._internal.suggestionEngine.
|
|
1580
|
+
if (agent.agentId) this._internal.suggestionEngine.clearSuggestions(agent.agentId);
|
|
1594
1581
|
if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...this._internal.headers };
|
|
1595
1582
|
if (agent.detachActiveRun) await agent.detachActiveRun();
|
|
1596
1583
|
this._internal.subscribeAgentToStateManager(agent);
|