@copilotkit/react-core 1.62.2-canary.1783457132 → 1.62.2-canary.1784333495
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-BnaWY11A.d.cts → copilotkit-C-k8T6fY.d.cts} +71 -6
- package/dist/copilotkit-C-k8T6fY.d.cts.map +1 -0
- package/dist/{copilotkit-BpR0k6_Z.d.mts → copilotkit-D6Wy_7iY.d.mts} +71 -6
- package/dist/copilotkit-D6Wy_7iY.d.mts.map +1 -0
- package/dist/{copilotkit-Ces-OkSR.cjs → copilotkit-DLwoVUsE.cjs} +132 -24
- package/dist/copilotkit-DLwoVUsE.cjs.map +1 -0
- package/dist/{copilotkit-BQT2ngSh.mjs → copilotkit-dtSVHJCs.mjs} +128 -26
- package/dist/copilotkit-dtSVHJCs.mjs.map +1 -0
- 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/index.umd.js +24 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +18 -14
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +16 -2
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +16 -2
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +19 -15
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +2 -1
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +126 -23
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/dist/copilotkit-BQT2ngSh.mjs.map +0 -1
- package/dist/copilotkit-BnaWY11A.d.cts.map +0 -1
- package/dist/copilotkit-BpR0k6_Z.d.mts.map +0 -1
- package/dist/copilotkit-Ces-OkSR.cjs.map +0 -1
|
@@ -4382,57 +4382,58 @@ const ALL_UPDATES = [
|
|
|
4382
4382
|
UseAgentUpdate.OnRunStatusChanged
|
|
4383
4383
|
];
|
|
4384
4384
|
function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
4385
|
-
|
|
4385
|
+
const chatConfig = useCopilotChatConfiguration();
|
|
4386
|
+
const resolvedAgentId = agentId ?? chatConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
4386
4387
|
const { copilotkit } = useCopilotKit();
|
|
4387
4388
|
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
4388
4389
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
4389
4390
|
const updateFlags = (0, react.useMemo)(() => updates ?? ALL_UPDATES, [JSON.stringify(updates)]);
|
|
4390
4391
|
const provisionalAgentCache = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
4391
4392
|
const agent = (0, react.useMemo)(() => {
|
|
4392
|
-
const existing = copilotkit.getAgent(
|
|
4393
|
+
const existing = copilotkit.getAgent(resolvedAgentId);
|
|
4393
4394
|
if (existing) {
|
|
4394
|
-
provisionalAgentCache.current.delete(
|
|
4395
|
+
provisionalAgentCache.current.delete(resolvedAgentId);
|
|
4395
4396
|
return existing;
|
|
4396
4397
|
}
|
|
4397
4398
|
const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
|
|
4398
4399
|
const status = copilotkit.runtimeConnectionStatus;
|
|
4399
4400
|
if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
|
|
4400
|
-
const cached = provisionalAgentCache.current.get(
|
|
4401
|
+
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
4401
4402
|
if (cached) {
|
|
4402
4403
|
copilotkit.applyHeadersToAgent(cached);
|
|
4403
4404
|
return cached;
|
|
4404
4405
|
}
|
|
4405
4406
|
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
4406
4407
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
4407
|
-
agentId,
|
|
4408
|
+
agentId: resolvedAgentId,
|
|
4408
4409
|
transport: copilotkit.runtimeTransport,
|
|
4409
4410
|
runtimeMode: "pending"
|
|
4410
4411
|
});
|
|
4411
4412
|
copilotkit.applyHeadersToAgent(provisional);
|
|
4412
|
-
provisionalAgentCache.current.set(
|
|
4413
|
+
provisionalAgentCache.current.set(resolvedAgentId, provisional);
|
|
4413
4414
|
return provisional;
|
|
4414
4415
|
}
|
|
4415
4416
|
if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
|
|
4416
|
-
const cached = provisionalAgentCache.current.get(
|
|
4417
|
+
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
4417
4418
|
if (cached) {
|
|
4418
4419
|
copilotkit.applyHeadersToAgent(cached);
|
|
4419
4420
|
return cached;
|
|
4420
4421
|
}
|
|
4421
4422
|
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
4422
4423
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
4423
|
-
agentId,
|
|
4424
|
+
agentId: resolvedAgentId,
|
|
4424
4425
|
transport: copilotkit.runtimeTransport,
|
|
4425
4426
|
runtimeMode: "pending"
|
|
4426
4427
|
});
|
|
4427
4428
|
copilotkit.applyHeadersToAgent(provisional);
|
|
4428
|
-
provisionalAgentCache.current.set(
|
|
4429
|
+
provisionalAgentCache.current.set(resolvedAgentId, provisional);
|
|
4429
4430
|
return provisional;
|
|
4430
4431
|
}
|
|
4431
4432
|
const knownAgents = Object.keys(copilotkit.agents ?? {});
|
|
4432
4433
|
const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
|
|
4433
|
-
throw new Error(`useAgent: Agent '${
|
|
4434
|
+
throw new Error(`useAgent: Agent '${resolvedAgentId}' not found after runtime sync (${runtimePart}). ` + (knownAgents.length ? `Known agents: [${knownAgents.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only.");
|
|
4434
4435
|
}, [
|
|
4435
|
-
|
|
4436
|
+
resolvedAgentId,
|
|
4436
4437
|
copilotkit.agents,
|
|
4437
4438
|
copilotkit.runtimeConnectionStatus,
|
|
4438
4439
|
copilotkit.runtimeUrl,
|
|
@@ -4477,7 +4478,6 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
|
4477
4478
|
(0, react.useEffect)(() => {
|
|
4478
4479
|
if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
|
|
4479
4480
|
}, [agent, JSON.stringify(copilotkit.headers)]);
|
|
4480
|
-
const chatConfig = useCopilotChatConfiguration();
|
|
4481
4481
|
const configThreadId = chatConfig?.threadId;
|
|
4482
4482
|
const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
|
|
4483
4483
|
(0, react.useEffect)(() => {
|
|
@@ -4491,16 +4491,87 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
|
4491
4491
|
return { agent };
|
|
4492
4492
|
}
|
|
4493
4493
|
|
|
4494
|
+
//#endregion
|
|
4495
|
+
//#region src/v2/hooks/use-subagent.tsx
|
|
4496
|
+
const warnedAmbiguousNames = /* @__PURE__ */ new Set();
|
|
4497
|
+
function resolveSubagent(subagents, subagentId, subagentName) {
|
|
4498
|
+
if (subagentId) {
|
|
4499
|
+
const match = subagents[subagentId];
|
|
4500
|
+
return match ? { ...match } : void 0;
|
|
4501
|
+
}
|
|
4502
|
+
if (subagentName) {
|
|
4503
|
+
const matches = Object.values(subagents).filter((s) => s.name === subagentName);
|
|
4504
|
+
if (matches.length === 0) return;
|
|
4505
|
+
const chosen = matches[matches.length - 1];
|
|
4506
|
+
return matches.length > 1 ? {
|
|
4507
|
+
...chosen,
|
|
4508
|
+
isAmbiguous: true,
|
|
4509
|
+
matchCount: matches.length
|
|
4510
|
+
} : { ...chosen };
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
/**
|
|
4514
|
+
* Read a subagent's live lifecycle state (name, description, running status)
|
|
4515
|
+
* from the CopilotKit core subagent registry, by id or by declared name.
|
|
4516
|
+
*
|
|
4517
|
+
* @example
|
|
4518
|
+
* const sub = useSubagent({ subagentId: message.subagentId });
|
|
4519
|
+
* // sub?.name, sub?.description, sub?.status
|
|
4520
|
+
*/
|
|
4521
|
+
function useSubagent(params) {
|
|
4522
|
+
const { subagentId, subagentName, agentId } = params;
|
|
4523
|
+
const { copilotkit } = useCopilotKit();
|
|
4524
|
+
const config = useCopilotChatConfiguration();
|
|
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));
|
|
4527
|
+
(0, react.useEffect)(() => {
|
|
4528
|
+
setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentId, subagentName));
|
|
4529
|
+
}, [
|
|
4530
|
+
copilotkit,
|
|
4531
|
+
resolvedAgentId,
|
|
4532
|
+
subagentId,
|
|
4533
|
+
subagentName
|
|
4534
|
+
]);
|
|
4535
|
+
(0, react.useEffect)(() => {
|
|
4536
|
+
const subscription = copilotkit.subscribe({ onSubagentsChanged: ({ agentId: changedAgentId, subagents }) => {
|
|
4537
|
+
if (changedAgentId !== resolvedAgentId) return;
|
|
4538
|
+
setSubagent(resolveSubagent(subagents, subagentId, subagentName));
|
|
4539
|
+
} });
|
|
4540
|
+
return () => {
|
|
4541
|
+
subscription.unsubscribe();
|
|
4542
|
+
};
|
|
4543
|
+
}, [
|
|
4544
|
+
copilotkit,
|
|
4545
|
+
resolvedAgentId,
|
|
4546
|
+
subagentId,
|
|
4547
|
+
subagentName
|
|
4548
|
+
]);
|
|
4549
|
+
(0, react.useEffect)(() => {
|
|
4550
|
+
if (process.env.NODE_ENV === "production" || !subagentName || !subagent?.isAmbiguous) return;
|
|
4551
|
+
const key = `${subagentName}:${subagent.matchCount}`;
|
|
4552
|
+
if (warnedAmbiguousNames.has(key)) return;
|
|
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.`);
|
|
4555
|
+
}, [
|
|
4556
|
+
subagentName,
|
|
4557
|
+
subagent?.isAmbiguous,
|
|
4558
|
+
subagent?.matchCount
|
|
4559
|
+
]);
|
|
4560
|
+
return subagent;
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4494
4563
|
//#endregion
|
|
4495
4564
|
//#region src/v2/hooks/use-capabilities.tsx
|
|
4496
4565
|
/**
|
|
4497
|
-
* Returns the capabilities declared by the given agent (or the
|
|
4566
|
+
* Returns the capabilities declared by the given agent (or the agent resolved
|
|
4567
|
+
* from the surrounding chat configuration, falling back to the default agent).
|
|
4498
4568
|
* Capabilities are populated from the runtime `/info` response at connection
|
|
4499
4569
|
* time. The hook reads them synchronously from the agent instance — there is
|
|
4500
4570
|
* no separate loading state, but the value will be `undefined` until the
|
|
4501
4571
|
* runtime handshake completes.
|
|
4502
4572
|
*
|
|
4503
|
-
* @param agentId - Optional agent ID. If omitted,
|
|
4573
|
+
* @param agentId - Optional agent ID. If omitted, inherits the surrounding
|
|
4574
|
+
* chat configuration's agent, falling back to the default agent.
|
|
4504
4575
|
* @returns The agent's capabilities, or `undefined` if the agent doesn't
|
|
4505
4576
|
* declare capabilities.
|
|
4506
4577
|
*/
|
|
@@ -5073,6 +5144,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5073
5144
|
})), [coreThreads]);
|
|
5074
5145
|
const storeIsLoading = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreadsIsLoading);
|
|
5075
5146
|
const storeError = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreadsError);
|
|
5147
|
+
const fetchMoreError = useThreadStoreSelector(store, _copilotkit_core.ɵselectFetchMoreError);
|
|
5076
5148
|
const hasMoreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectHasNextPage);
|
|
5077
5149
|
const isFetchingMoreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectIsFetchingNextPage);
|
|
5078
5150
|
const isMutating = useThreadStoreSelector(store, _copilotkit_core.ɵselectIsMutating);
|
|
@@ -5178,6 +5250,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5178
5250
|
isLoading,
|
|
5179
5251
|
error,
|
|
5180
5252
|
listError,
|
|
5253
|
+
fetchMoreError,
|
|
5181
5254
|
hasMoreThreads,
|
|
5182
5255
|
isFetchingMoreThreads,
|
|
5183
5256
|
isMutating,
|
|
@@ -9119,7 +9192,7 @@ function findChatInput(origin) {
|
|
|
9119
9192
|
* during prerender to avoid hydration mismatch).
|
|
9120
9193
|
* - Feeds the element domain data: `threads`, `loading`, `error`,
|
|
9121
9194
|
* `activeThreadId`, `licensed`, fetch-more state.
|
|
9122
|
-
* - Routes the element's
|
|
9195
|
+
* - Routes the element's outbound events to core thread operations
|
|
9123
9196
|
* ({@link useThreads}) and chat-configuration changes.
|
|
9124
9197
|
* - Registers with the surrounding chat configuration so the header
|
|
9125
9198
|
* thread-list launcher appears, and binds the element `open` state to the
|
|
@@ -9146,16 +9219,16 @@ function findChatInput(origin) {
|
|
|
9146
9219
|
* </CopilotKitProvider>
|
|
9147
9220
|
* ```
|
|
9148
9221
|
*/
|
|
9149
|
-
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
9222
|
+
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, recentLabel, collapsible, onCollapseChange, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
9150
9223
|
const configuration = useCopilotChatConfiguration();
|
|
9151
9224
|
const { status, checkFeature } = useLicenseContext();
|
|
9152
9225
|
const licensePresent = status === "valid" || status === "expiring";
|
|
9153
9226
|
const featureLicensed = checkFeature("threads");
|
|
9154
9227
|
const licensed = licensePresent && featureLicensed;
|
|
9155
9228
|
const licensePending = status === null;
|
|
9156
|
-
const resolvedAgentId = agentId ?? configuration?.agentId ??
|
|
9229
|
+
const resolvedAgentId = agentId ?? configuration?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
9157
9230
|
const activeThreadId = configuration?.threadId ?? null;
|
|
9158
|
-
const { threads, isLoading, listError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
9231
|
+
const { threads, isLoading, listError, fetchMoreError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
9159
9232
|
agentId: resolvedAgentId,
|
|
9160
9233
|
includeArchived: true,
|
|
9161
9234
|
enabled: licensed,
|
|
@@ -9236,6 +9309,9 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9236
9309
|
const handleLoadMore = (0, react.useCallback)(() => {
|
|
9237
9310
|
fetchMoreThreads();
|
|
9238
9311
|
}, [fetchMoreThreads]);
|
|
9312
|
+
const handleCollapseChange = (0, react.useCallback)((collapsed) => {
|
|
9313
|
+
onCollapseChange?.(collapsed);
|
|
9314
|
+
}, [onCollapseChange]);
|
|
9239
9315
|
const handlersRef = (0, react.useRef)({
|
|
9240
9316
|
handleThreadSelected,
|
|
9241
9317
|
handleNewThread,
|
|
@@ -9246,7 +9322,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9246
9322
|
handleRetry,
|
|
9247
9323
|
handleOpenChange,
|
|
9248
9324
|
handleLicensed,
|
|
9249
|
-
handleLoadMore
|
|
9325
|
+
handleLoadMore,
|
|
9326
|
+
handleCollapseChange
|
|
9250
9327
|
});
|
|
9251
9328
|
handlersRef.current = {
|
|
9252
9329
|
handleThreadSelected,
|
|
@@ -9258,7 +9335,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9258
9335
|
handleRetry,
|
|
9259
9336
|
handleOpenChange,
|
|
9260
9337
|
handleLicensed,
|
|
9261
|
-
handleLoadMore
|
|
9338
|
+
handleLoadMore,
|
|
9339
|
+
handleCollapseChange
|
|
9262
9340
|
};
|
|
9263
9341
|
(0, react.useEffect)(() => {
|
|
9264
9342
|
const el = elementRef.current;
|
|
@@ -9293,6 +9371,10 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9293
9371
|
};
|
|
9294
9372
|
const onLicensedEvent = () => handlersRef.current.handleLicensed();
|
|
9295
9373
|
const onLoadMore = () => handlersRef.current.handleLoadMore();
|
|
9374
|
+
const onCollapseChangeEvent = (event) => {
|
|
9375
|
+
const detail = event.detail;
|
|
9376
|
+
handlersRef.current.handleCollapseChange(detail.collapsed);
|
|
9377
|
+
};
|
|
9296
9378
|
el.addEventListener("thread-selected", onThreadSelected);
|
|
9297
9379
|
el.addEventListener("new-thread", onNewThreadEvent);
|
|
9298
9380
|
el.addEventListener("archive", onArchive);
|
|
@@ -9303,6 +9385,7 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9303
9385
|
el.addEventListener("retry", onRetry);
|
|
9304
9386
|
el.addEventListener("licensed", onLicensedEvent);
|
|
9305
9387
|
el.addEventListener("load-more", onLoadMore);
|
|
9388
|
+
el.addEventListener("collapse-change", onCollapseChangeEvent);
|
|
9306
9389
|
return () => {
|
|
9307
9390
|
el.removeEventListener("thread-selected", onThreadSelected);
|
|
9308
9391
|
el.removeEventListener("new-thread", onNewThreadEvent);
|
|
@@ -9314,6 +9397,7 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9314
9397
|
el.removeEventListener("retry", onRetry);
|
|
9315
9398
|
el.removeEventListener("licensed", onLicensedEvent);
|
|
9316
9399
|
el.removeEventListener("load-more", onLoadMore);
|
|
9400
|
+
el.removeEventListener("collapse-change", onCollapseChangeEvent);
|
|
9317
9401
|
};
|
|
9318
9402
|
}, [mounted]);
|
|
9319
9403
|
(0, react.useEffect)(() => {
|
|
@@ -9330,9 +9414,11 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9330
9414
|
el.licensed = licensed || licensePending;
|
|
9331
9415
|
el.hasMore = hasMoreThreads;
|
|
9332
9416
|
el.fetchingMore = isFetchingMoreThreads;
|
|
9417
|
+
el.fetchMoreError = fetchMoreError ? fetchMoreError.message : null;
|
|
9333
9418
|
}, [
|
|
9334
9419
|
isLoading,
|
|
9335
9420
|
listError,
|
|
9421
|
+
fetchMoreError,
|
|
9336
9422
|
activeThreadId,
|
|
9337
9423
|
licensed,
|
|
9338
9424
|
licensePending,
|
|
@@ -9355,6 +9441,11 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9355
9441
|
if (!el) return;
|
|
9356
9442
|
if (licenseUrl !== void 0) el.licenseUrl = licenseUrl;
|
|
9357
9443
|
}, [licenseUrl, mounted]);
|
|
9444
|
+
(0, react.useEffect)(() => {
|
|
9445
|
+
const el = elementRef.current;
|
|
9446
|
+
if (!el) return;
|
|
9447
|
+
if (collapsible !== void 0) el.collapsible = collapsible;
|
|
9448
|
+
}, [collapsible, mounted]);
|
|
9358
9449
|
const rowChildren = (0, react.useMemo)(() => {
|
|
9359
9450
|
if (!renderRow) return null;
|
|
9360
9451
|
return drawerThreads.map((drawerThread) => {
|
|
@@ -9375,7 +9466,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9375
9466
|
if (!mounted) return null;
|
|
9376
9467
|
return react.default.createElement(_copilotkit_web_components_threads_drawer.COPILOTKIT_THREADS_DRAWER_TAG, {
|
|
9377
9468
|
ref: elementRef,
|
|
9378
|
-
"data-testid": dataTestId
|
|
9469
|
+
"data-testid": dataTestId,
|
|
9470
|
+
...recentLabel !== void 0 ? { "recent-label": recentLabel } : {}
|
|
9379
9471
|
}, rowChildren);
|
|
9380
9472
|
}
|
|
9381
9473
|
CopilotThreadsDrawer.displayName = "CopilotThreadsDrawer";
|
|
@@ -11028,8 +11120,18 @@ const usePredictStateSubscription = (agent) => {
|
|
|
11028
11120
|
}, [agent, getSubscriber]);
|
|
11029
11121
|
};
|
|
11030
11122
|
function CopilotListenersAgentSubscription() {
|
|
11031
|
-
const
|
|
11032
|
-
const
|
|
11123
|
+
const { copilotkit } = useCopilotKit();
|
|
11124
|
+
const configAgentId = useCopilotChatConfiguration()?.agentId;
|
|
11125
|
+
const { agent } = useAgent({ agentId: (0, react.useMemo)(() => {
|
|
11126
|
+
const requested = configAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
11127
|
+
const registered = copilotkit.agents ?? {};
|
|
11128
|
+
if (registered[requested]) return requested;
|
|
11129
|
+
if (requested === _copilotkit_shared.DEFAULT_AGENT_ID) {
|
|
11130
|
+
const firstRegistered = Object.keys(registered)[0];
|
|
11131
|
+
if (firstRegistered) return firstRegistered;
|
|
11132
|
+
}
|
|
11133
|
+
return requested;
|
|
11134
|
+
}, [configAgentId, copilotkit.agents]) });
|
|
11033
11135
|
usePredictStateSubscription(agent);
|
|
11034
11136
|
return null;
|
|
11035
11137
|
}
|
|
@@ -12018,6 +12120,12 @@ Object.defineProperty(exports, 'useSandboxFunctions', {
|
|
|
12018
12120
|
return useSandboxFunctions;
|
|
12019
12121
|
}
|
|
12020
12122
|
});
|
|
12123
|
+
Object.defineProperty(exports, 'useSubagent', {
|
|
12124
|
+
enumerable: true,
|
|
12125
|
+
get: function () {
|
|
12126
|
+
return useSubagent;
|
|
12127
|
+
}
|
|
12128
|
+
});
|
|
12021
12129
|
Object.defineProperty(exports, 'useSuggestions', {
|
|
12022
12130
|
enumerable: true,
|
|
12023
12131
|
get: function () {
|
|
@@ -12042,4 +12150,4 @@ Object.defineProperty(exports, 'useToast', {
|
|
|
12042
12150
|
return useToast;
|
|
12043
12151
|
}
|
|
12044
12152
|
});
|
|
12045
|
-
//# sourceMappingURL=copilotkit-
|
|
12153
|
+
//# sourceMappingURL=copilotkit-DLwoVUsE.cjs.map
|