@copilotkit/react-core 1.62.2 → 1.62.3
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-lHheGQWt.cjs → copilotkit-5MptLWNR.cjs} +127 -24
- package/dist/copilotkit-5MptLWNR.cjs.map +1 -0
- package/dist/{copilotkit-Cga6AHO0.d.cts → copilotkit-BfFY1fzd.d.cts} +153 -6
- package/dist/copilotkit-BfFY1fzd.d.cts.map +1 -0
- package/dist/{copilotkit-DnLpJ2Cl.d.mts → copilotkit-Bp6BD8xe.d.mts} +153 -6
- package/dist/copilotkit-Bp6BD8xe.d.mts.map +1 -0
- package/dist/{copilotkit-CmcMFc8o.mjs → copilotkit-ympAovXs.mjs} +123 -26
- package/dist/copilotkit-ympAovXs.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 +121 -23
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/dist/copilotkit-Cga6AHO0.d.cts.map +0 -1
- package/dist/copilotkit-CmcMFc8o.mjs.map +0 -1
- package/dist/copilotkit-DnLpJ2Cl.d.mts.map +0 -1
- package/dist/copilotkit-lHheGQWt.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)(() => {
|
|
@@ -4494,13 +4494,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
|
4494
4494
|
//#endregion
|
|
4495
4495
|
//#region src/v2/hooks/use-capabilities.tsx
|
|
4496
4496
|
/**
|
|
4497
|
-
* Returns the capabilities declared by the given agent (or the
|
|
4497
|
+
* Returns the capabilities declared by the given agent (or the agent resolved
|
|
4498
|
+
* from the surrounding chat configuration, falling back to the default agent).
|
|
4498
4499
|
* Capabilities are populated from the runtime `/info` response at connection
|
|
4499
4500
|
* time. The hook reads them synchronously from the agent instance — there is
|
|
4500
4501
|
* no separate loading state, but the value will be `undefined` until the
|
|
4501
4502
|
* runtime handshake completes.
|
|
4502
4503
|
*
|
|
4503
|
-
* @param agentId - Optional agent ID. If omitted,
|
|
4504
|
+
* @param agentId - Optional agent ID. If omitted, inherits the surrounding
|
|
4505
|
+
* chat configuration's agent, falling back to the default agent.
|
|
4504
4506
|
* @returns The agent's capabilities, or `undefined` if the agent doesn't
|
|
4505
4507
|
* declare capabilities.
|
|
4506
4508
|
*/
|
|
@@ -5073,6 +5075,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5073
5075
|
})), [coreThreads]);
|
|
5074
5076
|
const storeIsLoading = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreadsIsLoading);
|
|
5075
5077
|
const storeError = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreadsError);
|
|
5078
|
+
const fetchMoreError = useThreadStoreSelector(store, _copilotkit_core.ɵselectFetchMoreError);
|
|
5076
5079
|
const hasMoreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectHasNextPage);
|
|
5077
5080
|
const isFetchingMoreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectIsFetchingNextPage);
|
|
5078
5081
|
const isMutating = useThreadStoreSelector(store, _copilotkit_core.ɵselectIsMutating);
|
|
@@ -5178,6 +5181,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5178
5181
|
isLoading,
|
|
5179
5182
|
error,
|
|
5180
5183
|
listError,
|
|
5184
|
+
fetchMoreError,
|
|
5181
5185
|
hasMoreThreads,
|
|
5182
5186
|
isFetchingMoreThreads,
|
|
5183
5187
|
isMutating,
|
|
@@ -5194,6 +5198,70 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5194
5198
|
};
|
|
5195
5199
|
}
|
|
5196
5200
|
|
|
5201
|
+
//#endregion
|
|
5202
|
+
//#region src/v2/hooks/use-memories.tsx
|
|
5203
|
+
function useMemoryStoreSelector(store, selector) {
|
|
5204
|
+
return (0, react.useSyncExternalStore)((0, react.useCallback)((onStoreChange) => {
|
|
5205
|
+
const subscription = store.select(selector).subscribe(onStoreChange);
|
|
5206
|
+
return () => subscription.unsubscribe();
|
|
5207
|
+
}, [store, selector]), () => selector(store.getState()), () => selector(store.getServerState()));
|
|
5208
|
+
}
|
|
5209
|
+
/**
|
|
5210
|
+
* React hook for listing and managing platform memories.
|
|
5211
|
+
*
|
|
5212
|
+
* Reads the memory store owned and wired by `CopilotKitCore`. On mount the
|
|
5213
|
+
* hook exposes the live list plus stable `addMemory` / `updateMemory` /
|
|
5214
|
+
* `removeMemory` / `refresh` callbacks. Mutations are server-authoritative:
|
|
5215
|
+
* each resolves once the platform confirms the operation and rejects with an
|
|
5216
|
+
* `Error` on failure.
|
|
5217
|
+
*
|
|
5218
|
+
* Realtime updates are automatic: the core's memory store opens its own
|
|
5219
|
+
* `user_meta:memories:<joinCode>` channel and applies `memory_metadata` deltas
|
|
5220
|
+
* to the list. You can still call `refresh()` to re-pull the REST snapshot on
|
|
5221
|
+
* demand.
|
|
5222
|
+
*
|
|
5223
|
+
* @returns Memory list state and stable mutation callbacks.
|
|
5224
|
+
*
|
|
5225
|
+
* @example
|
|
5226
|
+
* ```tsx
|
|
5227
|
+
* import { useMemories } from "@copilotkit/react-core";
|
|
5228
|
+
*
|
|
5229
|
+
* function MemoryList() {
|
|
5230
|
+
* const { memories, isLoading, isAvailable, addMemory, removeMemory } =
|
|
5231
|
+
* useMemories();
|
|
5232
|
+
*
|
|
5233
|
+
* if (!isAvailable) return null;
|
|
5234
|
+
* if (isLoading) return <p>Loading…</p>;
|
|
5235
|
+
*
|
|
5236
|
+
* return (
|
|
5237
|
+
* <ul>
|
|
5238
|
+
* {memories.map((m) => (
|
|
5239
|
+
* <li key={m.id}>
|
|
5240
|
+
* {m.content}
|
|
5241
|
+
* <button onClick={() => removeMemory(m.id)}>Delete</button>
|
|
5242
|
+
* </li>
|
|
5243
|
+
* ))}
|
|
5244
|
+
* </ul>
|
|
5245
|
+
* );
|
|
5246
|
+
* }
|
|
5247
|
+
* ```
|
|
5248
|
+
*/
|
|
5249
|
+
function useMemories() {
|
|
5250
|
+
const { copilotkit } = useCopilotKit();
|
|
5251
|
+
const store = copilotkit.getMemoryStore();
|
|
5252
|
+
return {
|
|
5253
|
+
memories: useMemoryStoreSelector(store, _copilotkit_core.ɵselectMemories),
|
|
5254
|
+
isLoading: useMemoryStoreSelector(store, _copilotkit_core.ɵselectMemoriesIsLoading),
|
|
5255
|
+
error: useMemoryStoreSelector(store, _copilotkit_core.ɵselectMemoriesError),
|
|
5256
|
+
isAvailable: useMemoryStoreSelector(store, _copilotkit_core.ɵselectMemoriesAvailable),
|
|
5257
|
+
realtimeStatus: useMemoryStoreSelector(store, _copilotkit_core.ɵselectMemoriesRealtimeStatus),
|
|
5258
|
+
refresh: (0, react.useCallback)(() => store.refresh(), [store]),
|
|
5259
|
+
addMemory: (0, react.useCallback)((input) => store.addMemory(input), [store]),
|
|
5260
|
+
updateMemory: (0, react.useCallback)((id, changes) => store.updateMemory(id, changes), [store]),
|
|
5261
|
+
removeMemory: (0, react.useCallback)((id) => store.removeMemory(id), [store])
|
|
5262
|
+
};
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5197
5265
|
//#endregion
|
|
5198
5266
|
//#region src/v2/lib/record-annotation.ts
|
|
5199
5267
|
/**
|
|
@@ -9055,7 +9123,7 @@ function findChatInput(origin) {
|
|
|
9055
9123
|
* during prerender to avoid hydration mismatch).
|
|
9056
9124
|
* - Feeds the element domain data: `threads`, `loading`, `error`,
|
|
9057
9125
|
* `activeThreadId`, `licensed`, fetch-more state.
|
|
9058
|
-
* - Routes the element's
|
|
9126
|
+
* - Routes the element's outbound events to core thread operations
|
|
9059
9127
|
* ({@link useThreads}) and chat-configuration changes.
|
|
9060
9128
|
* - Registers with the surrounding chat configuration so the header
|
|
9061
9129
|
* thread-list launcher appears, and binds the element `open` state to the
|
|
@@ -9082,16 +9150,16 @@ function findChatInput(origin) {
|
|
|
9082
9150
|
* </CopilotKitProvider>
|
|
9083
9151
|
* ```
|
|
9084
9152
|
*/
|
|
9085
|
-
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
9153
|
+
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, recentLabel, collapsible, onCollapseChange, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
9086
9154
|
const configuration = useCopilotChatConfiguration();
|
|
9087
9155
|
const { status, checkFeature } = useLicenseContext();
|
|
9088
9156
|
const licensePresent = status === "valid" || status === "expiring";
|
|
9089
9157
|
const featureLicensed = checkFeature("threads");
|
|
9090
9158
|
const licensed = licensePresent && featureLicensed;
|
|
9091
9159
|
const licensePending = status === null;
|
|
9092
|
-
const resolvedAgentId = agentId ?? configuration?.agentId ??
|
|
9160
|
+
const resolvedAgentId = agentId ?? configuration?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
9093
9161
|
const activeThreadId = configuration?.threadId ?? null;
|
|
9094
|
-
const { threads, isLoading, listError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
9162
|
+
const { threads, isLoading, listError, fetchMoreError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
9095
9163
|
agentId: resolvedAgentId,
|
|
9096
9164
|
includeArchived: true,
|
|
9097
9165
|
enabled: licensed,
|
|
@@ -9172,6 +9240,9 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9172
9240
|
const handleLoadMore = (0, react.useCallback)(() => {
|
|
9173
9241
|
fetchMoreThreads();
|
|
9174
9242
|
}, [fetchMoreThreads]);
|
|
9243
|
+
const handleCollapseChange = (0, react.useCallback)((collapsed) => {
|
|
9244
|
+
onCollapseChange?.(collapsed);
|
|
9245
|
+
}, [onCollapseChange]);
|
|
9175
9246
|
const handlersRef = (0, react.useRef)({
|
|
9176
9247
|
handleThreadSelected,
|
|
9177
9248
|
handleNewThread,
|
|
@@ -9182,7 +9253,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9182
9253
|
handleRetry,
|
|
9183
9254
|
handleOpenChange,
|
|
9184
9255
|
handleLicensed,
|
|
9185
|
-
handleLoadMore
|
|
9256
|
+
handleLoadMore,
|
|
9257
|
+
handleCollapseChange
|
|
9186
9258
|
});
|
|
9187
9259
|
handlersRef.current = {
|
|
9188
9260
|
handleThreadSelected,
|
|
@@ -9194,7 +9266,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9194
9266
|
handleRetry,
|
|
9195
9267
|
handleOpenChange,
|
|
9196
9268
|
handleLicensed,
|
|
9197
|
-
handleLoadMore
|
|
9269
|
+
handleLoadMore,
|
|
9270
|
+
handleCollapseChange
|
|
9198
9271
|
};
|
|
9199
9272
|
(0, react.useEffect)(() => {
|
|
9200
9273
|
const el = elementRef.current;
|
|
@@ -9229,6 +9302,10 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9229
9302
|
};
|
|
9230
9303
|
const onLicensedEvent = () => handlersRef.current.handleLicensed();
|
|
9231
9304
|
const onLoadMore = () => handlersRef.current.handleLoadMore();
|
|
9305
|
+
const onCollapseChangeEvent = (event) => {
|
|
9306
|
+
const detail = event.detail;
|
|
9307
|
+
handlersRef.current.handleCollapseChange(detail.collapsed);
|
|
9308
|
+
};
|
|
9232
9309
|
el.addEventListener("thread-selected", onThreadSelected);
|
|
9233
9310
|
el.addEventListener("new-thread", onNewThreadEvent);
|
|
9234
9311
|
el.addEventListener("archive", onArchive);
|
|
@@ -9239,6 +9316,7 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9239
9316
|
el.addEventListener("retry", onRetry);
|
|
9240
9317
|
el.addEventListener("licensed", onLicensedEvent);
|
|
9241
9318
|
el.addEventListener("load-more", onLoadMore);
|
|
9319
|
+
el.addEventListener("collapse-change", onCollapseChangeEvent);
|
|
9242
9320
|
return () => {
|
|
9243
9321
|
el.removeEventListener("thread-selected", onThreadSelected);
|
|
9244
9322
|
el.removeEventListener("new-thread", onNewThreadEvent);
|
|
@@ -9250,6 +9328,7 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9250
9328
|
el.removeEventListener("retry", onRetry);
|
|
9251
9329
|
el.removeEventListener("licensed", onLicensedEvent);
|
|
9252
9330
|
el.removeEventListener("load-more", onLoadMore);
|
|
9331
|
+
el.removeEventListener("collapse-change", onCollapseChangeEvent);
|
|
9253
9332
|
};
|
|
9254
9333
|
}, [mounted]);
|
|
9255
9334
|
(0, react.useEffect)(() => {
|
|
@@ -9266,9 +9345,11 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9266
9345
|
el.licensed = licensed || licensePending;
|
|
9267
9346
|
el.hasMore = hasMoreThreads;
|
|
9268
9347
|
el.fetchingMore = isFetchingMoreThreads;
|
|
9348
|
+
el.fetchMoreError = fetchMoreError ? fetchMoreError.message : null;
|
|
9269
9349
|
}, [
|
|
9270
9350
|
isLoading,
|
|
9271
9351
|
listError,
|
|
9352
|
+
fetchMoreError,
|
|
9272
9353
|
activeThreadId,
|
|
9273
9354
|
licensed,
|
|
9274
9355
|
licensePending,
|
|
@@ -9291,6 +9372,11 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9291
9372
|
if (!el) return;
|
|
9292
9373
|
if (licenseUrl !== void 0) el.licenseUrl = licenseUrl;
|
|
9293
9374
|
}, [licenseUrl, mounted]);
|
|
9375
|
+
(0, react.useEffect)(() => {
|
|
9376
|
+
const el = elementRef.current;
|
|
9377
|
+
if (!el) return;
|
|
9378
|
+
if (collapsible !== void 0) el.collapsible = collapsible;
|
|
9379
|
+
}, [collapsible, mounted]);
|
|
9294
9380
|
const rowChildren = (0, react.useMemo)(() => {
|
|
9295
9381
|
if (!renderRow) return null;
|
|
9296
9382
|
return drawerThreads.map((drawerThread) => {
|
|
@@ -9311,7 +9397,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
9311
9397
|
if (!mounted) return null;
|
|
9312
9398
|
return react.default.createElement(_copilotkit_web_components_threads_drawer.COPILOTKIT_THREADS_DRAWER_TAG, {
|
|
9313
9399
|
ref: elementRef,
|
|
9314
|
-
"data-testid": dataTestId
|
|
9400
|
+
"data-testid": dataTestId,
|
|
9401
|
+
...recentLabel !== void 0 ? { "recent-label": recentLabel } : {}
|
|
9315
9402
|
}, rowChildren);
|
|
9316
9403
|
}
|
|
9317
9404
|
CopilotThreadsDrawer.displayName = "CopilotThreadsDrawer";
|
|
@@ -10964,8 +11051,18 @@ const usePredictStateSubscription = (agent) => {
|
|
|
10964
11051
|
}, [agent, getSubscriber]);
|
|
10965
11052
|
};
|
|
10966
11053
|
function CopilotListenersAgentSubscription() {
|
|
10967
|
-
const
|
|
10968
|
-
const
|
|
11054
|
+
const { copilotkit } = useCopilotKit();
|
|
11055
|
+
const configAgentId = useCopilotChatConfiguration()?.agentId;
|
|
11056
|
+
const { agent } = useAgent({ agentId: (0, react.useMemo)(() => {
|
|
11057
|
+
const requested = configAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
11058
|
+
const registered = copilotkit.agents ?? {};
|
|
11059
|
+
if (registered[requested]) return requested;
|
|
11060
|
+
if (requested === _copilotkit_shared.DEFAULT_AGENT_ID) {
|
|
11061
|
+
const firstRegistered = Object.keys(registered)[0];
|
|
11062
|
+
if (firstRegistered) return firstRegistered;
|
|
11063
|
+
}
|
|
11064
|
+
return requested;
|
|
11065
|
+
}, [configAgentId, copilotkit.agents]) });
|
|
10969
11066
|
usePredictStateSubscription(agent);
|
|
10970
11067
|
return null;
|
|
10971
11068
|
}
|
|
@@ -11918,6 +12015,12 @@ Object.defineProperty(exports, 'useLearningContainersInCurrentThread', {
|
|
|
11918
12015
|
return useLearningContainersInCurrentThread;
|
|
11919
12016
|
}
|
|
11920
12017
|
});
|
|
12018
|
+
Object.defineProperty(exports, 'useMemories', {
|
|
12019
|
+
enumerable: true,
|
|
12020
|
+
get: function () {
|
|
12021
|
+
return useMemories;
|
|
12022
|
+
}
|
|
12023
|
+
});
|
|
11921
12024
|
Object.defineProperty(exports, 'useRenderActivityMessage', {
|
|
11922
12025
|
enumerable: true,
|
|
11923
12026
|
get: function () {
|
|
@@ -11972,4 +12075,4 @@ Object.defineProperty(exports, 'useToast', {
|
|
|
11972
12075
|
return useToast;
|
|
11973
12076
|
}
|
|
11974
12077
|
});
|
|
11975
|
-
//# sourceMappingURL=copilotkit-
|
|
12078
|
+
//# sourceMappingURL=copilotkit-5MptLWNR.cjs.map
|