@copilotkit/web-inspector 1.56.2 → 1.56.4

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
@@ -681,6 +681,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
681
681
  onMessagesChanged: () => {
682
682
  this.syncAgentMessages(agent);
683
683
  },
684
+ onStateChanged: () => {
685
+ this.syncAgentState(agent);
686
+ },
684
687
  onRawEvent: ({ event }) => {
685
688
  this.recordAgentEvent(agentId, "RAW_EVENT", event);
686
689
  },
@@ -743,17 +746,25 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
743
746
  }
744
747
  syncAgentMessages(agent) {
745
748
  if (!(agent === null || agent === void 0 ? void 0 : agent.agentId)) return;
746
- const messages = this.normalizeAgentMessages(agent.messages);
747
- if (messages) this.agentMessages.set(agent.agentId, messages);
748
- else this.agentMessages.delete(agent.agentId);
749
- this.requestUpdate();
749
+ try {
750
+ const messages = this.normalizeAgentMessages(agent.messages);
751
+ if (messages) this.agentMessages.set(agent.agentId, messages);
752
+ else this.agentMessages.delete(agent.agentId);
753
+ this.requestUpdate();
754
+ } catch (error) {
755
+ console.error(`[CopilotKit Inspector] Failed to sync messages for agent "${agent.agentId}":`, error);
756
+ }
750
757
  }
751
758
  syncAgentState(agent) {
752
759
  if (!(agent === null || agent === void 0 ? void 0 : agent.agentId)) return;
753
- const state = agent.state;
754
- if (state === void 0 || state === null) this.agentStates.delete(agent.agentId);
755
- else this.agentStates.set(agent.agentId, this.sanitizeForLogging(state));
756
- this.requestUpdate();
760
+ try {
761
+ const state = agent.state;
762
+ if (state === void 0 || state === null) this.agentStates.delete(agent.agentId);
763
+ else this.agentStates.set(agent.agentId, this.sanitizeForLogging(state));
764
+ this.requestUpdate();
765
+ } catch (error) {
766
+ console.error(`[CopilotKit Inspector] Failed to sync state for agent "${agent.agentId}":`, error);
767
+ }
757
768
  }
758
769
  updateContextOptions(agentIds) {
759
770
  const nextOptions = [{