@cueloop/client 0.1.0-alpha.100 → 0.1.0-alpha.102

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.
@@ -8,7 +8,7 @@ export type ThreadAgentClient = Pick<
8
8
  DaemonClient,
9
9
  "agentGet" | "agentPrompt" | "agentCancel" | "agentComment" | "agentPermission"
10
10
  > &
11
- Partial<Pick<DaemonClient, "agentConfigure">>;
11
+ Partial<Pick<DaemonClient, "agentConfigure" | "onEvent">> & { canControlAgent?: boolean };
12
12
 
13
13
  /** Subscribe to durable agent state; unmount closes only this client connection. */
14
14
  export function useThreadAgent(id: string, home?: string, injected?: ThreadAgentClient) {
@@ -48,6 +48,12 @@ export function useThreadAgent(id: string, home?: string, injected?: ThreadAgent
48
48
  void (async () => {
49
49
  try {
50
50
  if (injected) {
51
+ unsubscribe = injected.onEvent?.((event) => {
52
+ if (event.event === "agent.updated" && event.sessionId === id)
53
+ void refresh(injected).catch((error) => {
54
+ if (!cancelled) setError(String(error));
55
+ });
56
+ });
51
57
  await refresh(injected);
52
58
  await configure(injected);
53
59