@copilotkit/web-inspector 1.55.2 → 1.55.3-canary.1776215089

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
@@ -527,6 +527,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
527
527
  onAgentsChanged: ({ agents }) => {
528
528
  this.processAgentsChanged(agents);
529
529
  },
530
+ onAgentRunStarted: ({ agent }) => {
531
+ if (agent === null || agent === void 0 ? void 0 : agent.agentId) this.subscribeToAgent(agent);
532
+ },
530
533
  onContextChanged: ({ context }) => {
531
534
  this.contextStore = this.normalizeContextStore(context);
532
535
  this.requestUpdate();
@@ -678,6 +681,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
678
681
  onMessagesChanged: () => {
679
682
  this.syncAgentMessages(agent);
680
683
  },
684
+ onStateChanged: () => {
685
+ this.syncAgentState(agent);
686
+ },
681
687
  onRawEvent: ({ event }) => {
682
688
  this.recordAgentEvent(agentId, "RAW_EVENT", event);
683
689
  },
@@ -740,17 +746,25 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
740
746
  }
741
747
  syncAgentMessages(agent) {
742
748
  if (!(agent === null || agent === void 0 ? void 0 : agent.agentId)) return;
743
- const messages = this.normalizeAgentMessages(agent.messages);
744
- if (messages) this.agentMessages.set(agent.agentId, messages);
745
- else this.agentMessages.delete(agent.agentId);
746
- 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
+ }
747
757
  }
748
758
  syncAgentState(agent) {
749
759
  if (!(agent === null || agent === void 0 ? void 0 : agent.agentId)) return;
750
- const state = agent.state;
751
- if (state === void 0 || state === null) this.agentStates.delete(agent.agentId);
752
- else this.agentStates.set(agent.agentId, this.sanitizeForLogging(state));
753
- 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
+ }
754
768
  }
755
769
  updateContextOptions(agentIds) {
756
770
  const nextOptions = [{