@copilotkit/core 1.56.4 → 1.56.5

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
@@ -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
- if (!agent) return;
1200
- const messageCount = agent.messages?.length ?? 0;
1199
+ const messageCount = agent?.messages?.length ?? 0;
1201
1200
  let hasAnySuggestions = false;
1202
1201
  for (const config of Object.values(this._suggestionsConfig)) {
1203
1202
  if (config.consumerAgentId !== void 0 && config.consumerAgentId !== "*" && config.consumerAgentId !== agentId) continue;
1204
1203
  if (!this.shouldShowSuggestions(config, messageCount)) continue;
1205
1204
  const suggestionId = (0, _copilotkit_shared.randomUUID)();
1206
1205
  if (isDynamicSuggestionsConfig(config)) {
1206
+ if (!agent) continue;
1207
1207
  if (!hasAnySuggestions) {
1208
1208
  hasAnySuggestions = true;
1209
1209
  this.notifySuggestionsStartedLoading(agentId);