@copilotkit/react-core 1.62.2-canary.1785518626 → 1.62.2-canary.1786549251

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.
@@ -4494,9 +4494,9 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
4494
4494
  //#endregion
4495
4495
  //#region src/v2/hooks/use-subagent.tsx
4496
4496
  const warnedAmbiguousNames = /* @__PURE__ */ new Set();
4497
- function resolveSubagent(subagents, subagentId, subagentName) {
4498
- if (subagentId) {
4499
- const match = subagents[subagentId];
4497
+ function resolveSubagent(subagents, subagentRunId, subagentName) {
4498
+ if (subagentRunId) {
4499
+ const match = subagents[subagentRunId];
4500
4500
  return match ? { ...match } : void 0;
4501
4501
  }
4502
4502
  if (subagentName) {
@@ -4515,27 +4515,27 @@ function resolveSubagent(subagents, subagentId, subagentName) {
4515
4515
  * from the CopilotKit core subagent registry, by id or by declared name.
4516
4516
  *
4517
4517
  * @example
4518
- * const sub = useSubagent({ subagentId: message.subagentId });
4518
+ * const sub = useSubagent({ subagentRunId: message.subagentRunId });
4519
4519
  * // sub?.name, sub?.description, sub?.status
4520
4520
  */
4521
4521
  function useSubagent(params) {
4522
- const { subagentId, subagentName, agentId } = params;
4522
+ const { subagentRunId, subagentName, agentId } = params;
4523
4523
  const { copilotkit } = useCopilotKit();
4524
4524
  const config = useCopilotChatConfiguration();
4525
4525
  const resolvedAgentId = (0, react.useMemo)(() => agentId ?? config?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
4526
- const [subagent, setSubagent] = (0, react.useState)(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentId, subagentName));
4526
+ const [subagent, setSubagent] = (0, react.useState)(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
4527
4527
  (0, react.useEffect)(() => {
4528
- setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentId, subagentName));
4528
+ setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
4529
4529
  }, [
4530
4530
  copilotkit,
4531
4531
  resolvedAgentId,
4532
- subagentId,
4532
+ subagentRunId,
4533
4533
  subagentName
4534
4534
  ]);
4535
4535
  (0, react.useEffect)(() => {
4536
4536
  const subscription = copilotkit.subscribe({ onSubagentsChanged: ({ agentId: changedAgentId, subagents }) => {
4537
4537
  if (changedAgentId !== resolvedAgentId) return;
4538
- setSubagent(resolveSubagent(subagents, subagentId, subagentName));
4538
+ setSubagent(resolveSubagent(subagents, subagentRunId, subagentName));
4539
4539
  } });
4540
4540
  return () => {
4541
4541
  subscription.unsubscribe();
@@ -4543,7 +4543,7 @@ function useSubagent(params) {
4543
4543
  }, [
4544
4544
  copilotkit,
4545
4545
  resolvedAgentId,
4546
- subagentId,
4546
+ subagentRunId,
4547
4547
  subagentName
4548
4548
  ]);
4549
4549
  (0, react.useEffect)(() => {
@@ -4551,7 +4551,7 @@ function useSubagent(params) {
4551
4551
  const key = `${subagentName}:${subagent.matchCount}`;
4552
4552
  if (warnedAmbiguousNames.has(key)) return;
4553
4553
  warnedAmbiguousNames.add(key);
4554
- console.warn(`[CopilotKit] useSubagent({ subagentName: ${JSON.stringify(subagentName)} }) matched ${subagent.matchCount} subagents. Returning the most recently started one; pass a subagentId for a stable reference.`);
4554
+ console.warn(`[CopilotKit] useSubagent({ subagentName: ${JSON.stringify(subagentName)} }) matched ${subagent.matchCount} subagents. Returning the most recently started one; pass a subagentRunId for a stable reference.`);
4555
4555
  }, [
4556
4556
  subagentName,
4557
4557
  subagent?.isAmbiguous,
@@ -12150,4 +12150,4 @@ Object.defineProperty(exports, 'useToast', {
12150
12150
  return useToast;
12151
12151
  }
12152
12152
  });
12153
- //# sourceMappingURL=copilotkit-DLwoVUsE.cjs.map
12153
+ //# sourceMappingURL=copilotkit-0Qwg5vfz.cjs.map