@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.cjs CHANGED
@@ -398,6 +398,9 @@ var WebInspectorElement = class extends lit.LitElement {
398
398
  onAgentsChanged: ({ agents }) => {
399
399
  this.processAgentsChanged(agents);
400
400
  },
401
+ onAgentRunStarted: ({ agent }) => {
402
+ if (agent?.agentId) this.subscribeToAgent(agent);
403
+ },
401
404
  onContextChanged: ({ context }) => {
402
405
  this.contextStore = this.normalizeContextStore(context);
403
406
  this.requestUpdate();
@@ -548,6 +551,9 @@ var WebInspectorElement = class extends lit.LitElement {
548
551
  onMessagesChanged: () => {
549
552
  this.syncAgentMessages(agent);
550
553
  },
554
+ onStateChanged: () => {
555
+ this.syncAgentState(agent);
556
+ },
551
557
  onRawEvent: ({ event }) => {
552
558
  this.recordAgentEvent(agentId, "RAW_EVENT", event);
553
559
  },
@@ -609,17 +615,25 @@ var WebInspectorElement = class extends lit.LitElement {
609
615
  }
610
616
  syncAgentMessages(agent) {
611
617
  if (!agent?.agentId) return;
612
- const messages = this.normalizeAgentMessages(agent.messages);
613
- if (messages) this.agentMessages.set(agent.agentId, messages);
614
- else this.agentMessages.delete(agent.agentId);
615
- this.requestUpdate();
618
+ try {
619
+ const messages = this.normalizeAgentMessages(agent.messages);
620
+ if (messages) this.agentMessages.set(agent.agentId, messages);
621
+ else this.agentMessages.delete(agent.agentId);
622
+ this.requestUpdate();
623
+ } catch (error) {
624
+ console.error(`[CopilotKit Inspector] Failed to sync messages for agent "${agent.agentId}":`, error);
625
+ }
616
626
  }
617
627
  syncAgentState(agent) {
618
628
  if (!agent?.agentId) return;
619
- const state = agent.state;
620
- if (state === void 0 || state === null) this.agentStates.delete(agent.agentId);
621
- else this.agentStates.set(agent.agentId, this.sanitizeForLogging(state));
622
- this.requestUpdate();
629
+ try {
630
+ const state = agent.state;
631
+ if (state === void 0 || state === null) this.agentStates.delete(agent.agentId);
632
+ else this.agentStates.set(agent.agentId, this.sanitizeForLogging(state));
633
+ this.requestUpdate();
634
+ } catch (error) {
635
+ console.error(`[CopilotKit Inspector] Failed to sync state for agent "${agent.agentId}":`, error);
636
+ }
623
637
  }
624
638
  updateContextOptions(agentIds) {
625
639
  const nextOptions = [{