@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.
- package/dist/{copilotkit-DLwoVUsE.cjs → copilotkit-0Qwg5vfz.cjs} +12 -12
- package/dist/copilotkit-0Qwg5vfz.cjs.map +1 -0
- package/dist/{copilotkit-D6Wy_7iY.d.mts → copilotkit-BtmlSPLa.d.mts} +4 -4
- package/dist/{copilotkit-C-k8T6fY.d.cts.map → copilotkit-BtmlSPLa.d.mts.map} +1 -1
- package/dist/{copilotkit-dtSVHJCs.mjs → copilotkit-CtC1h-Aa.mjs} +12 -12
- package/dist/copilotkit-CtC1h-Aa.mjs.map +1 -0
- package/dist/{copilotkit-C-k8T6fY.d.cts → copilotkit-SKdHi-6M.d.cts} +4 -4
- package/dist/{copilotkit-D6Wy_7iY.d.mts.map → copilotkit-SKdHi-6M.d.cts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +11 -11
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/dist/copilotkit-DLwoVUsE.cjs.map +0 -1
- package/dist/copilotkit-dtSVHJCs.mjs.map +0 -1
|
@@ -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,
|
|
4498
|
-
if (
|
|
4499
|
-
const match = subagents[
|
|
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({
|
|
4518
|
+
* const sub = useSubagent({ subagentRunId: message.subagentRunId });
|
|
4519
4519
|
* // sub?.name, sub?.description, sub?.status
|
|
4520
4520
|
*/
|
|
4521
4521
|
function useSubagent(params) {
|
|
4522
|
-
const {
|
|
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),
|
|
4526
|
+
const [subagent, setSubagent] = (0, react.useState)(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
|
|
4527
4527
|
(0, react.useEffect)(() => {
|
|
4528
|
-
setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId),
|
|
4528
|
+
setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
|
|
4529
4529
|
}, [
|
|
4530
4530
|
copilotkit,
|
|
4531
4531
|
resolvedAgentId,
|
|
4532
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
|
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-
|
|
12153
|
+
//# sourceMappingURL=copilotkit-0Qwg5vfz.cjs.map
|