@copilotkit/react-core 1.62.2-canary.1783457132 → 1.62.2-canary.1785518626
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import React, { createContext, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { CopilotKitCore, CopilotKitCoreRuntimeConnectionStatus, ProxiedCopilotRuntimeAgent, ToolCallStatus, isRunCompletionAware, ɵcreateThreadStore, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading } from "@copilotkit/core";
|
|
3
|
+
import { CopilotKitCore, CopilotKitCoreRuntimeConnectionStatus, ProxiedCopilotRuntimeAgent, ToolCallStatus, isRunCompletionAware, ɵcreateThreadStore, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading } from "@copilotkit/core";
|
|
4
4
|
import { HttpAgent, buildResumeArray, isInterruptExpired, randomUUID } from "@ag-ui/client";
|
|
5
5
|
import { extendTailwindMerge, twMerge } from "tailwind-merge";
|
|
6
6
|
import { ArrowUp, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronRightIcon, Copy, Edit, Loader2, MessageCircle, Mic, PanelLeftOpen, Play, Plus, RefreshCw, Square, ThumbsDown, ThumbsUp, Upload, Volume2, X } from "lucide-react";
|
|
@@ -4352,57 +4352,58 @@ const ALL_UPDATES = [
|
|
|
4352
4352
|
UseAgentUpdate.OnRunStatusChanged
|
|
4353
4353
|
];
|
|
4354
4354
|
function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
4355
|
-
|
|
4355
|
+
const chatConfig = useCopilotChatConfiguration();
|
|
4356
|
+
const resolvedAgentId = agentId ?? chatConfig?.agentId ?? DEFAULT_AGENT_ID;
|
|
4356
4357
|
const { copilotkit } = useCopilotKit();
|
|
4357
4358
|
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
4358
4359
|
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
4359
4360
|
const updateFlags = useMemo(() => updates ?? ALL_UPDATES, [JSON.stringify(updates)]);
|
|
4360
4361
|
const provisionalAgentCache = useRef(/* @__PURE__ */ new Map());
|
|
4361
4362
|
const agent = useMemo(() => {
|
|
4362
|
-
const existing = copilotkit.getAgent(
|
|
4363
|
+
const existing = copilotkit.getAgent(resolvedAgentId);
|
|
4363
4364
|
if (existing) {
|
|
4364
|
-
provisionalAgentCache.current.delete(
|
|
4365
|
+
provisionalAgentCache.current.delete(resolvedAgentId);
|
|
4365
4366
|
return existing;
|
|
4366
4367
|
}
|
|
4367
4368
|
const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
|
|
4368
4369
|
const status = copilotkit.runtimeConnectionStatus;
|
|
4369
4370
|
if (isRuntimeConfigured && (status === CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
|
|
4370
|
-
const cached = provisionalAgentCache.current.get(
|
|
4371
|
+
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
4371
4372
|
if (cached) {
|
|
4372
4373
|
copilotkit.applyHeadersToAgent(cached);
|
|
4373
4374
|
return cached;
|
|
4374
4375
|
}
|
|
4375
4376
|
const provisional = new ProxiedCopilotRuntimeAgent({
|
|
4376
4377
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
4377
|
-
agentId,
|
|
4378
|
+
agentId: resolvedAgentId,
|
|
4378
4379
|
transport: copilotkit.runtimeTransport,
|
|
4379
4380
|
runtimeMode: "pending"
|
|
4380
4381
|
});
|
|
4381
4382
|
copilotkit.applyHeadersToAgent(provisional);
|
|
4382
|
-
provisionalAgentCache.current.set(
|
|
4383
|
+
provisionalAgentCache.current.set(resolvedAgentId, provisional);
|
|
4383
4384
|
return provisional;
|
|
4384
4385
|
}
|
|
4385
4386
|
if (isRuntimeConfigured && status === CopilotKitCoreRuntimeConnectionStatus.Error) {
|
|
4386
|
-
const cached = provisionalAgentCache.current.get(
|
|
4387
|
+
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
4387
4388
|
if (cached) {
|
|
4388
4389
|
copilotkit.applyHeadersToAgent(cached);
|
|
4389
4390
|
return cached;
|
|
4390
4391
|
}
|
|
4391
4392
|
const provisional = new ProxiedCopilotRuntimeAgent({
|
|
4392
4393
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
4393
|
-
agentId,
|
|
4394
|
+
agentId: resolvedAgentId,
|
|
4394
4395
|
transport: copilotkit.runtimeTransport,
|
|
4395
4396
|
runtimeMode: "pending"
|
|
4396
4397
|
});
|
|
4397
4398
|
copilotkit.applyHeadersToAgent(provisional);
|
|
4398
|
-
provisionalAgentCache.current.set(
|
|
4399
|
+
provisionalAgentCache.current.set(resolvedAgentId, provisional);
|
|
4399
4400
|
return provisional;
|
|
4400
4401
|
}
|
|
4401
4402
|
const knownAgents = Object.keys(copilotkit.agents ?? {});
|
|
4402
4403
|
const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
|
|
4403
|
-
throw new Error(`useAgent: Agent '${
|
|
4404
|
+
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.");
|
|
4404
4405
|
}, [
|
|
4405
|
-
|
|
4406
|
+
resolvedAgentId,
|
|
4406
4407
|
copilotkit.agents,
|
|
4407
4408
|
copilotkit.runtimeConnectionStatus,
|
|
4408
4409
|
copilotkit.runtimeUrl,
|
|
@@ -4447,7 +4448,6 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
|
4447
4448
|
useEffect(() => {
|
|
4448
4449
|
if (agent instanceof HttpAgent) copilotkit.applyHeadersToAgent(agent);
|
|
4449
4450
|
}, [agent, JSON.stringify(copilotkit.headers)]);
|
|
4450
|
-
const chatConfig = useCopilotChatConfiguration();
|
|
4451
4451
|
const configThreadId = chatConfig?.threadId;
|
|
4452
4452
|
const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
|
|
4453
4453
|
useEffect(() => {
|
|
@@ -4461,16 +4461,87 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
|
4461
4461
|
return { agent };
|
|
4462
4462
|
}
|
|
4463
4463
|
|
|
4464
|
+
//#endregion
|
|
4465
|
+
//#region src/v2/hooks/use-subagent.tsx
|
|
4466
|
+
const warnedAmbiguousNames = /* @__PURE__ */ new Set();
|
|
4467
|
+
function resolveSubagent(subagents, subagentId, subagentName) {
|
|
4468
|
+
if (subagentId) {
|
|
4469
|
+
const match = subagents[subagentId];
|
|
4470
|
+
return match ? { ...match } : void 0;
|
|
4471
|
+
}
|
|
4472
|
+
if (subagentName) {
|
|
4473
|
+
const matches = Object.values(subagents).filter((s) => s.name === subagentName);
|
|
4474
|
+
if (matches.length === 0) return;
|
|
4475
|
+
const chosen = matches[matches.length - 1];
|
|
4476
|
+
return matches.length > 1 ? {
|
|
4477
|
+
...chosen,
|
|
4478
|
+
isAmbiguous: true,
|
|
4479
|
+
matchCount: matches.length
|
|
4480
|
+
} : { ...chosen };
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
/**
|
|
4484
|
+
* Read a subagent's live lifecycle state (name, description, running status)
|
|
4485
|
+
* from the CopilotKit core subagent registry, by id or by declared name.
|
|
4486
|
+
*
|
|
4487
|
+
* @example
|
|
4488
|
+
* const sub = useSubagent({ subagentId: message.subagentId });
|
|
4489
|
+
* // sub?.name, sub?.description, sub?.status
|
|
4490
|
+
*/
|
|
4491
|
+
function useSubagent(params) {
|
|
4492
|
+
const { subagentId, subagentName, agentId } = params;
|
|
4493
|
+
const { copilotkit } = useCopilotKit();
|
|
4494
|
+
const config = useCopilotChatConfiguration();
|
|
4495
|
+
const resolvedAgentId = useMemo(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID, [agentId, config?.agentId]);
|
|
4496
|
+
const [subagent, setSubagent] = useState(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentId, subagentName));
|
|
4497
|
+
useEffect(() => {
|
|
4498
|
+
setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentId, subagentName));
|
|
4499
|
+
}, [
|
|
4500
|
+
copilotkit,
|
|
4501
|
+
resolvedAgentId,
|
|
4502
|
+
subagentId,
|
|
4503
|
+
subagentName
|
|
4504
|
+
]);
|
|
4505
|
+
useEffect(() => {
|
|
4506
|
+
const subscription = copilotkit.subscribe({ onSubagentsChanged: ({ agentId: changedAgentId, subagents }) => {
|
|
4507
|
+
if (changedAgentId !== resolvedAgentId) return;
|
|
4508
|
+
setSubagent(resolveSubagent(subagents, subagentId, subagentName));
|
|
4509
|
+
} });
|
|
4510
|
+
return () => {
|
|
4511
|
+
subscription.unsubscribe();
|
|
4512
|
+
};
|
|
4513
|
+
}, [
|
|
4514
|
+
copilotkit,
|
|
4515
|
+
resolvedAgentId,
|
|
4516
|
+
subagentId,
|
|
4517
|
+
subagentName
|
|
4518
|
+
]);
|
|
4519
|
+
useEffect(() => {
|
|
4520
|
+
if (process.env.NODE_ENV === "production" || !subagentName || !subagent?.isAmbiguous) return;
|
|
4521
|
+
const key = `${subagentName}:${subagent.matchCount}`;
|
|
4522
|
+
if (warnedAmbiguousNames.has(key)) return;
|
|
4523
|
+
warnedAmbiguousNames.add(key);
|
|
4524
|
+
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.`);
|
|
4525
|
+
}, [
|
|
4526
|
+
subagentName,
|
|
4527
|
+
subagent?.isAmbiguous,
|
|
4528
|
+
subagent?.matchCount
|
|
4529
|
+
]);
|
|
4530
|
+
return subagent;
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4464
4533
|
//#endregion
|
|
4465
4534
|
//#region src/v2/hooks/use-capabilities.tsx
|
|
4466
4535
|
/**
|
|
4467
|
-
* Returns the capabilities declared by the given agent (or the
|
|
4536
|
+
* Returns the capabilities declared by the given agent (or the agent resolved
|
|
4537
|
+
* from the surrounding chat configuration, falling back to the default agent).
|
|
4468
4538
|
* Capabilities are populated from the runtime `/info` response at connection
|
|
4469
4539
|
* time. The hook reads them synchronously from the agent instance — there is
|
|
4470
4540
|
* no separate loading state, but the value will be `undefined` until the
|
|
4471
4541
|
* runtime handshake completes.
|
|
4472
4542
|
*
|
|
4473
|
-
* @param agentId - Optional agent ID. If omitted,
|
|
4543
|
+
* @param agentId - Optional agent ID. If omitted, inherits the surrounding
|
|
4544
|
+
* chat configuration's agent, falling back to the default agent.
|
|
4474
4545
|
* @returns The agent's capabilities, or `undefined` if the agent doesn't
|
|
4475
4546
|
* declare capabilities.
|
|
4476
4547
|
*/
|
|
@@ -5043,6 +5114,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5043
5114
|
})), [coreThreads]);
|
|
5044
5115
|
const storeIsLoading = useThreadStoreSelector(store, ɵselectThreadsIsLoading);
|
|
5045
5116
|
const storeError = useThreadStoreSelector(store, ɵselectThreadsError);
|
|
5117
|
+
const fetchMoreError = useThreadStoreSelector(store, ɵselectFetchMoreError);
|
|
5046
5118
|
const hasMoreThreads = useThreadStoreSelector(store, ɵselectHasNextPage);
|
|
5047
5119
|
const isFetchingMoreThreads = useThreadStoreSelector(store, ɵselectIsFetchingNextPage);
|
|
5048
5120
|
const isMutating = useThreadStoreSelector(store, ɵselectIsMutating);
|
|
@@ -5148,6 +5220,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5148
5220
|
isLoading,
|
|
5149
5221
|
error,
|
|
5150
5222
|
listError,
|
|
5223
|
+
fetchMoreError,
|
|
5151
5224
|
hasMoreThreads,
|
|
5152
5225
|
isFetchingMoreThreads,
|
|
5153
5226
|
isMutating,
|
|
@@ -9089,7 +9162,7 @@ function findChatInput(origin) {
|
|
|
9089
9162
|
* during prerender to avoid hydration mismatch).
|
|
9090
9163
|
* - Feeds the element domain data: `threads`, `loading`, `error`,
|
|
9091
9164
|
* `activeThreadId`, `licensed`, fetch-more state.
|
|
9092
|
-
* - Routes the element's
|
|
9165
|
+
* - Routes the element's outbound events to core thread operations
|
|
9093
9166
|
* ({@link useThreads}) and chat-configuration changes.
|
|
9094
9167
|
* - Registers with the surrounding chat configuration so the header
|
|
9095
9168
|
* thread-list launcher appears, and binds the element `open` state to the
|
|
@@ -9116,16 +9189,16 @@ function findChatInput(origin) {
|
|
|
9116
9189
|
* </CopilotKitProvider>
|
|
9117
9190
|
* ```
|
|
9118
9191
|
*/
|
|
9119
|
-
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
9192
|
+
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, recentLabel, collapsible, onCollapseChange, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
9120
9193
|
const configuration = useCopilotChatConfiguration();
|
|
9121
9194
|
const { status, checkFeature } = useLicenseContext();
|
|
9122
9195
|
const licensePresent = status === "valid" || status === "expiring";
|
|
9123
9196
|
const featureLicensed = checkFeature("threads");
|
|
9124
9197
|
const licensed = licensePresent && featureLicensed;
|
|
9125
9198
|
const licensePending = status === null;
|
|
9126
|
-
const resolvedAgentId = agentId ?? configuration?.agentId ??
|
|
9199
|
+
const resolvedAgentId = agentId ?? configuration?.agentId ?? DEFAULT_AGENT_ID;
|
|
9127
9200
|
const activeThreadId = configuration?.threadId ?? null;
|
|
9128
|
-
const { threads, isLoading, listError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
9201
|
+
const { threads, isLoading, listError, fetchMoreError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
9129
9202
|
agentId: resolvedAgentId,
|
|
9130
9203
|
includeArchived: true,
|
|
9131
9204
|
enabled: licensed,
|
|
@@ -9206,6 +9279,9 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9206
9279
|
const handleLoadMore = useCallback(() => {
|
|
9207
9280
|
fetchMoreThreads();
|
|
9208
9281
|
}, [fetchMoreThreads]);
|
|
9282
|
+
const handleCollapseChange = useCallback((collapsed) => {
|
|
9283
|
+
onCollapseChange?.(collapsed);
|
|
9284
|
+
}, [onCollapseChange]);
|
|
9209
9285
|
const handlersRef = useRef({
|
|
9210
9286
|
handleThreadSelected,
|
|
9211
9287
|
handleNewThread,
|
|
@@ -9216,7 +9292,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9216
9292
|
handleRetry,
|
|
9217
9293
|
handleOpenChange,
|
|
9218
9294
|
handleLicensed,
|
|
9219
|
-
handleLoadMore
|
|
9295
|
+
handleLoadMore,
|
|
9296
|
+
handleCollapseChange
|
|
9220
9297
|
});
|
|
9221
9298
|
handlersRef.current = {
|
|
9222
9299
|
handleThreadSelected,
|
|
@@ -9228,7 +9305,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9228
9305
|
handleRetry,
|
|
9229
9306
|
handleOpenChange,
|
|
9230
9307
|
handleLicensed,
|
|
9231
|
-
handleLoadMore
|
|
9308
|
+
handleLoadMore,
|
|
9309
|
+
handleCollapseChange
|
|
9232
9310
|
};
|
|
9233
9311
|
useEffect(() => {
|
|
9234
9312
|
const el = elementRef.current;
|
|
@@ -9263,6 +9341,10 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9263
9341
|
};
|
|
9264
9342
|
const onLicensedEvent = () => handlersRef.current.handleLicensed();
|
|
9265
9343
|
const onLoadMore = () => handlersRef.current.handleLoadMore();
|
|
9344
|
+
const onCollapseChangeEvent = (event) => {
|
|
9345
|
+
const detail = event.detail;
|
|
9346
|
+
handlersRef.current.handleCollapseChange(detail.collapsed);
|
|
9347
|
+
};
|
|
9266
9348
|
el.addEventListener("thread-selected", onThreadSelected);
|
|
9267
9349
|
el.addEventListener("new-thread", onNewThreadEvent);
|
|
9268
9350
|
el.addEventListener("archive", onArchive);
|
|
@@ -9273,6 +9355,7 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9273
9355
|
el.addEventListener("retry", onRetry);
|
|
9274
9356
|
el.addEventListener("licensed", onLicensedEvent);
|
|
9275
9357
|
el.addEventListener("load-more", onLoadMore);
|
|
9358
|
+
el.addEventListener("collapse-change", onCollapseChangeEvent);
|
|
9276
9359
|
return () => {
|
|
9277
9360
|
el.removeEventListener("thread-selected", onThreadSelected);
|
|
9278
9361
|
el.removeEventListener("new-thread", onNewThreadEvent);
|
|
@@ -9284,6 +9367,7 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9284
9367
|
el.removeEventListener("retry", onRetry);
|
|
9285
9368
|
el.removeEventListener("licensed", onLicensedEvent);
|
|
9286
9369
|
el.removeEventListener("load-more", onLoadMore);
|
|
9370
|
+
el.removeEventListener("collapse-change", onCollapseChangeEvent);
|
|
9287
9371
|
};
|
|
9288
9372
|
}, [mounted]);
|
|
9289
9373
|
useEffect(() => {
|
|
@@ -9300,9 +9384,11 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9300
9384
|
el.licensed = licensed || licensePending;
|
|
9301
9385
|
el.hasMore = hasMoreThreads;
|
|
9302
9386
|
el.fetchingMore = isFetchingMoreThreads;
|
|
9387
|
+
el.fetchMoreError = fetchMoreError ? fetchMoreError.message : null;
|
|
9303
9388
|
}, [
|
|
9304
9389
|
isLoading,
|
|
9305
9390
|
listError,
|
|
9391
|
+
fetchMoreError,
|
|
9306
9392
|
activeThreadId,
|
|
9307
9393
|
licensed,
|
|
9308
9394
|
licensePending,
|
|
@@ -9325,6 +9411,11 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9325
9411
|
if (!el) return;
|
|
9326
9412
|
if (licenseUrl !== void 0) el.licenseUrl = licenseUrl;
|
|
9327
9413
|
}, [licenseUrl, mounted]);
|
|
9414
|
+
useEffect(() => {
|
|
9415
|
+
const el = elementRef.current;
|
|
9416
|
+
if (!el) return;
|
|
9417
|
+
if (collapsible !== void 0) el.collapsible = collapsible;
|
|
9418
|
+
}, [collapsible, mounted]);
|
|
9328
9419
|
const rowChildren = useMemo(() => {
|
|
9329
9420
|
if (!renderRow) return null;
|
|
9330
9421
|
return drawerThreads.map((drawerThread) => {
|
|
@@ -9345,7 +9436,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9345
9436
|
if (!mounted) return null;
|
|
9346
9437
|
return React.createElement(COPILOTKIT_THREADS_DRAWER_TAG, {
|
|
9347
9438
|
ref: elementRef,
|
|
9348
|
-
"data-testid": dataTestId
|
|
9439
|
+
"data-testid": dataTestId,
|
|
9440
|
+
...recentLabel !== void 0 ? { "recent-label": recentLabel } : {}
|
|
9349
9441
|
}, rowChildren);
|
|
9350
9442
|
}
|
|
9351
9443
|
CopilotThreadsDrawer.displayName = "CopilotThreadsDrawer";
|
|
@@ -10998,8 +11090,18 @@ const usePredictStateSubscription = (agent) => {
|
|
|
10998
11090
|
}, [agent, getSubscriber]);
|
|
10999
11091
|
};
|
|
11000
11092
|
function CopilotListenersAgentSubscription() {
|
|
11001
|
-
const
|
|
11002
|
-
const
|
|
11093
|
+
const { copilotkit } = useCopilotKit();
|
|
11094
|
+
const configAgentId = useCopilotChatConfiguration()?.agentId;
|
|
11095
|
+
const { agent } = useAgent({ agentId: useMemo(() => {
|
|
11096
|
+
const requested = configAgentId ?? DEFAULT_AGENT_ID;
|
|
11097
|
+
const registered = copilotkit.agents ?? {};
|
|
11098
|
+
if (registered[requested]) return requested;
|
|
11099
|
+
if (requested === DEFAULT_AGENT_ID) {
|
|
11100
|
+
const firstRegistered = Object.keys(registered)[0];
|
|
11101
|
+
if (firstRegistered) return firstRegistered;
|
|
11102
|
+
}
|
|
11103
|
+
return requested;
|
|
11104
|
+
}, [configAgentId, copilotkit.agents]) });
|
|
11003
11105
|
usePredictStateSubscription(agent);
|
|
11004
11106
|
return null;
|
|
11005
11107
|
}
|
|
@@ -11532,5 +11634,5 @@ function validateProps(props) {
|
|
|
11532
11634
|
}
|
|
11533
11635
|
|
|
11534
11636
|
//#endregion
|
|
11535
|
-
export { useCapabilities as $, CopilotChatMessageView as A, CopilotChatAssistantMessage_default as B, CopilotModalHeader as C,
|
|
11536
|
-
//# sourceMappingURL=copilotkit-
|
|
11637
|
+
export { useCapabilities as $, CopilotChatMessageView as A, CopilotChatAssistantMessage_default as B, CopilotModalHeader as C, AudioRecorderError as Ct, CopilotChat as D, DefaultOpenIcon as E, useCopilotChatConfiguration as Et, CopilotChatSuggestionView as F, useLearnFromUserActionInCurrentThread as G, useLearningContainersInCurrentThread as H, CopilotChatSuggestionPill as I, useThreads$1 as J, useLearnFromUserAction as K, CopilotChatReasoningMessage_default as L, IntelligenceIndicator as M, getIntelligenceTurnAnchors as N, CopilotChatView_default as O, IntelligenceIndicatorView as P, useAgentContext as Q, CopilotChatUserMessage_default as R, CopilotSidebarView as S, CopilotChatInput_default as St, DefaultCloseIcon as T, CopilotChatConfigurationProvider as Tt, useLearningContainers as U, CopilotChatToolCallsView as V, useAttachments as W, useConfigureSuggestions as X, useInterrupt as Y, useSuggestions as Z, WildcardToolCallRender as _, MCPAppsActivityType as _t, ThreadsProvider as a, useRenderTool as at, CopilotSidebar as b, useCopilotKit as bt, CoAgentStateRendersProvider as c, useRenderActivityMessage as ct, shouldShowDevConsole as d, defineToolCallRenderer as dt, useSubagent as et, useToast as f, createA2UIMessageRenderer as ft, useCopilotContext as g, MCPAppsActivityRenderer as gt, CopilotContext as h, MCPAppsActivityContentSchema as ht, ThreadsContext as i, useDefaultRenderTool as it, INTELLIGENCE_TURN_HEAD as j, CopilotChatAttachmentQueue as k, useCoAgentStateRenders as l, useRenderCustomMessages as lt, useCopilotMessagesContext as m, useSandboxFunctions as mt, defaultCopilotContextCategories as n, useAgent as nt, useThreads as o, useComponent as ot, CopilotMessagesContext as p, SandboxFunctionsContext as pt, useMemories as q, CoAgentStateRenderBridge as r, useHumanInTheLoop as rt, CoAgentStateRendersContext as s, useFrontendTool as st, CopilotKit as t, UseAgentUpdate as tt, useAsyncCallback as u, CopilotKitProvider as ut, CopilotThreadsDrawer as v, CopilotKitInspector as vt, CopilotChatToggleButton as w, CopilotChatAudioRecorder as wt, CopilotPopupView as x, CopilotKitCoreReact as xt, CopilotPopup as y, useRenderToolCall as yt, CopilotChatAttachmentRenderer as z };
|
|
11638
|
+
//# sourceMappingURL=copilotkit-dtSVHJCs.mjs.map
|