@copilotkit/react-core 1.55.3-canary.1776243725 → 1.55.3-canary.1776260990

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/react-core",
3
- "version": "1.55.3-canary.1776243725",
3
+ "version": "1.55.3-canary.1776260990",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -73,11 +73,11 @@
73
73
  "untruncate-json": "^0.0.1",
74
74
  "use-stick-to-bottom": "^1.1.1",
75
75
  "zod-to-json-schema": "^3.24.5",
76
- "@copilotkit/a2ui-renderer": "1.55.3-canary.1776243725",
77
- "@copilotkit/core": "1.55.3-canary.1776243725",
78
- "@copilotkit/shared": "1.55.3-canary.1776243725",
79
- "@copilotkit/runtime-client-gql": "1.55.3-canary.1776243725",
80
- "@copilotkit/web-inspector": "1.55.3-canary.1776243725"
76
+ "@copilotkit/a2ui-renderer": "1.55.3-canary.1776260990",
77
+ "@copilotkit/core": "1.55.3-canary.1776260990",
78
+ "@copilotkit/web-inspector": "1.55.3-canary.1776260990",
79
+ "@copilotkit/runtime-client-gql": "1.55.3-canary.1776260990",
80
+ "@copilotkit/shared": "1.55.3-canary.1776260990"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@tailwindcss/cli": "^4.1.11",
@@ -7,6 +7,7 @@ import React, {
7
7
  } from "react";
8
8
  import { useCopilotKit } from "../providers/CopilotKitProvider";
9
9
  import { useAgent } from "./use-agent";
10
+ import type { AbstractAgent } from "@ag-ui/client";
10
11
  import type {
11
12
  InterruptEvent,
12
13
  InterruptRenderProps,
@@ -79,6 +80,13 @@ interface UseInterruptConfigBase<TValue = unknown, TResult = never> {
79
80
  enabled?: (event: InterruptEvent<TValue>) => boolean;
80
81
  /** Optional agent id. Defaults to the current configured chat agent. */
81
82
  agentId?: string;
83
+ /**
84
+ * Optional agent instance to subscribe to. When provided, the hook uses
85
+ * this instance directly instead of creating one internally via `useAgent`.
86
+ * This is useful in multiplexer setups where the consumer already holds
87
+ * the agent instance that `runAgent` will execute on.
88
+ */
89
+ agent?: AbstractAgent;
82
90
  }
83
91
 
84
92
  export interface UseInterruptInChatConfig<
@@ -183,7 +191,8 @@ export function useInterrupt<
183
191
  ): UseInterruptReturn<TRenderInChat> {
184
192
  /* eslint-enable @typescript-eslint/no-explicit-any */
185
193
  const { copilotkit } = useCopilotKit();
186
- const { agent } = useAgent({ agentId: config.agentId });
194
+ const { agent: internalAgent } = useAgent({ agentId: config.agentId });
195
+ const agent = config.agent ?? internalAgent;
187
196
  const [pendingEvent, setPendingEvent] = useState<InterruptEvent | null>(null);
188
197
  const pendingEventRef = useRef(pendingEvent);
189
198
  pendingEventRef.current = pendingEvent;