@copilotkitnext/react 1.54.1-next.5 → 1.54.1-next.6
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/components/chat/CopilotChat.cjs +3 -2
- package/dist/components/chat/CopilotChat.cjs.map +1 -1
- package/dist/components/chat/CopilotChat.d.cts +2 -0
- package/dist/components/chat/CopilotChat.d.cts.map +1 -1
- package/dist/components/chat/CopilotChat.d.mts +2 -0
- package/dist/components/chat/CopilotChat.d.mts.map +1 -1
- package/dist/components/chat/CopilotChat.mjs +3 -2
- package/dist/components/chat/CopilotChat.mjs.map +1 -1
- package/dist/components/chat/CopilotPopup.cjs +1 -0
- package/dist/components/chat/CopilotPopup.cjs.map +1 -1
- package/dist/components/chat/CopilotPopup.mjs +1 -0
- package/dist/components/chat/CopilotPopup.mjs.map +1 -1
- package/dist/components/chat/CopilotSidebar.cjs +1 -0
- package/dist/components/chat/CopilotSidebar.cjs.map +1 -1
- package/dist/components/chat/CopilotSidebar.mjs +1 -0
- package/dist/components/chat/CopilotSidebar.mjs.map +1 -1
- package/dist/hooks/use-threads.cjs +18 -6
- package/dist/hooks/use-threads.cjs.map +1 -1
- package/dist/hooks/use-threads.d.cts +24 -4
- package/dist/hooks/use-threads.d.cts.map +1 -1
- package/dist/hooks/use-threads.d.mts +24 -4
- package/dist/hooks/use-threads.d.mts.map +1 -1
- package/dist/hooks/use-threads.mjs +19 -7
- package/dist/hooks/use-threads.mjs.map +1 -1
- package/dist/index.umd.js +40 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/providers/CopilotChatConfigurationProvider.cjs +17 -2
- package/dist/providers/CopilotChatConfigurationProvider.cjs.map +1 -1
- package/dist/providers/CopilotChatConfigurationProvider.d.cts.map +1 -1
- package/dist/providers/CopilotChatConfigurationProvider.d.mts.map +1 -1
- package/dist/providers/CopilotChatConfigurationProvider.mjs +18 -3
- package/dist/providers/CopilotChatConfigurationProvider.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCopilotKit } from "../providers/CopilotKitProvider.mjs";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { ɵcreateThreadStore, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading } from "@copilotkitnext/core";
|
|
3
|
+
import { ɵcreateThreadStore, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading } from "@copilotkitnext/core";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/use-threads.tsx
|
|
6
6
|
function useThreadStoreSelector(store, selector) {
|
|
@@ -51,12 +51,14 @@ function useThreadStoreSelector(store, selector) {
|
|
|
51
51
|
* }
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
function useThreads({ userId, agentId }) {
|
|
54
|
+
function useThreads({ userId, agentId, includeArchived, limit }) {
|
|
55
55
|
const { copilotkit } = useCopilotKit();
|
|
56
56
|
const [store] = useState(() => ɵcreateThreadStore({ fetch: globalThis.fetch }));
|
|
57
57
|
const threads = useThreadStoreSelector(store, ɵselectThreads);
|
|
58
58
|
const storeIsLoading = useThreadStoreSelector(store, ɵselectThreadsIsLoading);
|
|
59
59
|
const storeError = useThreadStoreSelector(store, ɵselectThreadsError);
|
|
60
|
+
const hasNextPage = useThreadStoreSelector(store, ɵselectHasNextPage);
|
|
61
|
+
const isFetchingNextPage = useThreadStoreSelector(store, ɵselectIsFetchingNextPage);
|
|
60
62
|
const headersKey = useMemo(() => {
|
|
61
63
|
return JSON.stringify(Object.entries(copilotkit.headers ?? {}).sort(([left], [right]) => left.localeCompare(right)));
|
|
62
64
|
}, [copilotkit.headers]);
|
|
@@ -78,7 +80,9 @@ function useThreads({ userId, agentId }) {
|
|
|
78
80
|
headers: { ...copilotkit.headers },
|
|
79
81
|
wsUrl: copilotkit.intelligence?.wsUrl,
|
|
80
82
|
userId,
|
|
81
|
-
agentId
|
|
83
|
+
agentId,
|
|
84
|
+
includeArchived,
|
|
85
|
+
limit
|
|
82
86
|
} : null;
|
|
83
87
|
store.setContext(context);
|
|
84
88
|
}, [
|
|
@@ -88,15 +92,23 @@ function useThreads({ userId, agentId }) {
|
|
|
88
92
|
copilotkit.intelligence?.wsUrl,
|
|
89
93
|
userId,
|
|
90
94
|
agentId,
|
|
91
|
-
copilotkit.headers
|
|
95
|
+
copilotkit.headers,
|
|
96
|
+
includeArchived,
|
|
97
|
+
limit
|
|
92
98
|
]);
|
|
99
|
+
const renameThread = useCallback((threadId, name) => store.renameThread(threadId, name), [store]);
|
|
100
|
+
const archiveThread = useCallback((threadId) => store.archiveThread(threadId), [store]);
|
|
101
|
+
const deleteThread = useCallback((threadId) => store.deleteThread(threadId), [store]);
|
|
93
102
|
return {
|
|
94
103
|
threads,
|
|
95
104
|
isLoading,
|
|
96
105
|
error,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
hasNextPage,
|
|
107
|
+
isFetchingNextPage,
|
|
108
|
+
fetchNextPage: useCallback(() => store.fetchNextPage(), [store]),
|
|
109
|
+
renameThread,
|
|
110
|
+
archiveThread,
|
|
111
|
+
deleteThread
|
|
100
112
|
};
|
|
101
113
|
}
|
|
102
114
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-threads.mjs","names":[],"sources":["../../src/hooks/use-threads.tsx"],"sourcesContent":["import { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport {\n ɵcreateThreadStore,\n ɵselectThreads,\n ɵselectThreadsError,\n ɵselectThreadsIsLoading,\n type ɵThread as CoreThread,\n type ɵThreadRuntimeContext,\n type ɵThreadStore,\n} from \"@copilotkitnext/core\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n} from \"react\";\n\n/**\n * A conversation thread managed by the Intelligence platform.\n *\n * Each thread has a unique `id`, an optional human-readable `name`, and\n * timestamp fields tracking creation and update times.\n */\nexport interface Thread extends CoreThread {}\n\n/**\n * Configuration for the {@link useThreads} hook.\n *\n * Both fields are required — they scope the thread list and all mutations\n * to a specific user/agent pair on the Intelligence platform.\n */\nexport interface UseThreadsInput {\n /** The ID of the current user. Thread queries and mutations are scoped to this user. */\n userId: string;\n /** The ID of the agent whose threads to list and manage. */\n agentId: string;\n}\n\n/**\n * Return value of the {@link useThreads} hook.\n *\n * The `threads` array is kept in sync with the platform via a realtime\n * WebSocket subscription (when available) and is sorted most-recently-updated\n * first. Mutations reject with an `Error` if the platform request fails.\n */\nexport interface UseThreadsResult {\n /**\n *
|
|
1
|
+
{"version":3,"file":"use-threads.mjs","names":[],"sources":["../../src/hooks/use-threads.tsx"],"sourcesContent":["import { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport {\n ɵcreateThreadStore,\n ɵselectThreads,\n ɵselectThreadsError,\n ɵselectThreadsIsLoading,\n ɵselectHasNextPage,\n ɵselectIsFetchingNextPage,\n type ɵThread as CoreThread,\n type ɵThreadRuntimeContext,\n type ɵThreadStore,\n} from \"@copilotkitnext/core\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n} from \"react\";\n\n/**\n * A conversation thread managed by the Intelligence platform.\n *\n * Each thread has a unique `id`, an optional human-readable `name`, and\n * timestamp fields tracking creation and update times.\n */\nexport interface Thread extends CoreThread {}\n\n/**\n * Configuration for the {@link useThreads} hook.\n *\n * Both fields are required — they scope the thread list and all mutations\n * to a specific user/agent pair on the Intelligence platform.\n */\nexport interface UseThreadsInput {\n /** The ID of the current user. Thread queries and mutations are scoped to this user. */\n userId: string;\n /** The ID of the agent whose threads to list and manage. */\n agentId: string;\n /** When `true`, archived threads are included in the list. Defaults to `false`. */\n includeArchived?: boolean;\n /** Maximum number of threads to fetch per page. When set, enables cursor-based pagination. */\n limit?: number;\n}\n\n/**\n * Return value of the {@link useThreads} hook.\n *\n * The `threads` array is kept in sync with the platform via a realtime\n * WebSocket subscription (when available) and is sorted most-recently-updated\n * first. Mutations reject with an `Error` if the platform request fails.\n */\nexport interface UseThreadsResult {\n /**\n * Threads for the current user/agent pair, sorted by most recently\n * updated first. Updated in realtime when the platform pushes metadata\n * events. Includes archived threads only when `includeArchived` is set.\n */\n threads: Thread[];\n /**\n * `true` while the initial thread list is being fetched from the platform.\n * Subsequent realtime updates do not re-enter the loading state.\n */\n isLoading: boolean;\n /**\n * The most recent error from fetching threads or executing a mutation,\n * or `null` when there is no error. Reset to `null` on the next\n * successful fetch.\n */\n error: Error | null;\n /**\n * `true` when there are more threads available to fetch via\n * {@link fetchNextPage}. Only meaningful when `limit` is set.\n */\n hasNextPage: boolean;\n /**\n * `true` while a subsequent page of threads is being fetched.\n */\n isFetchingNextPage: boolean;\n /**\n * Fetch the next page of threads. No-op when {@link hasNextPage} is\n * `false` or a page fetch is already in progress.\n */\n fetchNextPage: () => void;\n /**\n * Rename a thread on the platform.\n * Resolves when the server confirms the update; rejects on failure.\n */\n renameThread: (threadId: string, name: string) => Promise<void>;\n /**\n * Archive a thread on the platform.\n * Archived threads are excluded from subsequent list results.\n * Resolves when the server confirms the update; rejects on failure.\n */\n archiveThread: (threadId: string) => Promise<void>;\n /**\n * Permanently delete a thread from the platform.\n * This is irreversible. Resolves when the server confirms deletion;\n * rejects on failure.\n */\n deleteThread: (threadId: string) => Promise<void>;\n}\n\nfunction useThreadStoreSelector<T>(\n store: ɵThreadStore,\n selector: (state: ReturnType<ɵThreadStore[\"getState\"]>) => T,\n): T {\n return useSyncExternalStore(\n useCallback(\n (onStoreChange) => {\n const subscription = store.select(selector).subscribe(onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, selector],\n ),\n () => selector(store.getState()),\n );\n}\n\n/**\n * React hook for listing and managing Intelligence platform threads.\n *\n * On mount the hook fetches the thread list for the given `userId`/`agentId`\n * pair. When the Intelligence platform exposes a WebSocket URL, it also opens\n * a realtime subscription so the `threads` array stays current without\n * polling — thread creates, renames, archives, and deletes from any client\n * are reflected immediately.\n *\n * Mutation methods (`renameThread`, `archiveThread`, `deleteThread`) return\n * promises that resolve once the platform confirms the operation and reject\n * with an `Error` on failure.\n *\n * @param input - User and agent identifiers that scope the thread list.\n * @returns Thread list state and stable mutation callbacks.\n *\n * @example\n * ```tsx\n * import { useThreads } from \"@copilotkitnext/react\";\n *\n * function ThreadList() {\n * const { threads, isLoading, renameThread, deleteThread } = useThreads({\n * userId: \"user-1\",\n * agentId: \"agent-1\",\n * });\n *\n * if (isLoading) return <p>Loading…</p>;\n *\n * return (\n * <ul>\n * {threads.map((t) => (\n * <li key={t.id}>\n * {t.name ?? \"Untitled\"}\n * <button onClick={() => renameThread(t.id, \"New name\")}>Rename</button>\n * <button onClick={() => deleteThread(t.id)}>Delete</button>\n * </li>\n * ))}\n * </ul>\n * );\n * }\n * ```\n */\nexport function useThreads({\n userId,\n agentId,\n includeArchived,\n limit,\n}: UseThreadsInput): UseThreadsResult {\n const { copilotkit } = useCopilotKit();\n\n const [store] = useState(() =>\n ɵcreateThreadStore({\n fetch: globalThis.fetch,\n }),\n );\n\n const threads = useThreadStoreSelector(store, ɵselectThreads);\n const storeIsLoading = useThreadStoreSelector(store, ɵselectThreadsIsLoading);\n const storeError = useThreadStoreSelector(store, ɵselectThreadsError);\n const hasNextPage = useThreadStoreSelector(store, ɵselectHasNextPage);\n const isFetchingNextPage = useThreadStoreSelector(\n store,\n ɵselectIsFetchingNextPage,\n );\n const headersKey = useMemo(() => {\n return JSON.stringify(\n Object.entries(copilotkit.headers ?? {}).sort(([left], [right]) =>\n left.localeCompare(right),\n ),\n );\n }, [copilotkit.headers]);\n const runtimeError = useMemo(() => {\n if (copilotkit.runtimeUrl) {\n return null;\n }\n\n return new Error(\"Runtime URL is not configured\");\n }, [copilotkit.runtimeUrl]);\n const isLoading = runtimeError ? false : storeIsLoading;\n const error = runtimeError ?? storeError;\n\n useEffect(() => {\n store.start();\n return () => {\n store.stop();\n };\n }, [store]);\n\n useEffect(() => {\n const context: ɵThreadRuntimeContext | null = copilotkit.runtimeUrl\n ? {\n runtimeUrl: copilotkit.runtimeUrl,\n headers: { ...copilotkit.headers },\n wsUrl: copilotkit.intelligence?.wsUrl,\n userId,\n agentId,\n includeArchived,\n limit,\n }\n : null;\n\n store.setContext(context);\n }, [\n store,\n copilotkit.runtimeUrl,\n headersKey,\n copilotkit.intelligence?.wsUrl,\n userId,\n agentId,\n copilotkit.headers,\n includeArchived,\n limit,\n ]);\n\n const renameThread = useCallback(\n (threadId: string, name: string) => store.renameThread(threadId, name),\n [store],\n );\n\n const archiveThread = useCallback(\n (threadId: string) => store.archiveThread(threadId),\n [store],\n );\n\n const deleteThread = useCallback(\n (threadId: string) => store.deleteThread(threadId),\n [store],\n );\n\n const fetchNextPage = useCallback(() => store.fetchNextPage(), [store]);\n\n return {\n threads,\n isLoading,\n error,\n hasNextPage,\n isFetchingNextPage,\n fetchNextPage,\n renameThread,\n archiveThread,\n deleteThread,\n };\n}\n"],"mappings":";;;;;AAuGA,SAAS,uBACP,OACA,UACG;AACH,QAAO,qBACL,aACG,kBAAkB;EACjB,MAAM,eAAe,MAAM,OAAO,SAAS,CAAC,UAAU,cAAc;AACpE,eAAa,aAAa,aAAa;IAEzC,CAAC,OAAO,SAAS,CAClB,QACK,SAAS,MAAM,UAAU,CAAC,CACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CH,SAAgB,WAAW,EACzB,QACA,SACA,iBACA,SACoC;CACpC,MAAM,EAAE,eAAe,eAAe;CAEtC,MAAM,CAAC,SAAS,eACd,mBAAmB,EACjB,OAAO,WAAW,OACnB,CAAC,CACH;CAED,MAAM,UAAU,uBAAuB,OAAO,eAAe;CAC7D,MAAM,iBAAiB,uBAAuB,OAAO,wBAAwB;CAC7E,MAAM,aAAa,uBAAuB,OAAO,oBAAoB;CACrE,MAAM,cAAc,uBAAuB,OAAO,mBAAmB;CACrE,MAAM,qBAAqB,uBACzB,OACA,0BACD;CACD,MAAM,aAAa,cAAc;AAC/B,SAAO,KAAK,UACV,OAAO,QAAQ,WAAW,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WACtD,KAAK,cAAc,MAAM,CAC1B,CACF;IACA,CAAC,WAAW,QAAQ,CAAC;CACxB,MAAM,eAAe,cAAc;AACjC,MAAI,WAAW,WACb,QAAO;AAGT,yBAAO,IAAI,MAAM,gCAAgC;IAChD,CAAC,WAAW,WAAW,CAAC;CAC3B,MAAM,YAAY,eAAe,QAAQ;CACzC,MAAM,QAAQ,gBAAgB;AAE9B,iBAAgB;AACd,QAAM,OAAO;AACb,eAAa;AACX,SAAM,MAAM;;IAEb,CAAC,MAAM,CAAC;AAEX,iBAAgB;EACd,MAAM,UAAwC,WAAW,aACrD;GACE,YAAY,WAAW;GACvB,SAAS,EAAE,GAAG,WAAW,SAAS;GAClC,OAAO,WAAW,cAAc;GAChC;GACA;GACA;GACA;GACD,GACD;AAEJ,QAAM,WAAW,QAAQ;IACxB;EACD;EACA,WAAW;EACX;EACA,WAAW,cAAc;EACzB;EACA;EACA,WAAW;EACX;EACA;EACD,CAAC;CAEF,MAAM,eAAe,aAClB,UAAkB,SAAiB,MAAM,aAAa,UAAU,KAAK,EACtE,CAAC,MAAM,CACR;CAED,MAAM,gBAAgB,aACnB,aAAqB,MAAM,cAAc,SAAS,EACnD,CAAC,MAAM,CACR;CAED,MAAM,eAAe,aAClB,aAAqB,MAAM,aAAa,SAAS,EAClD,CAAC,MAAM,CACR;AAID,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,eARoB,kBAAkB,MAAM,eAAe,EAAE,CAAC,MAAM,CAAC;EASrE;EACA;EACA;EACD"}
|
package/dist/index.umd.js
CHANGED
|
@@ -79,8 +79,23 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
79
79
|
return (0, _copilotkitnext_shared.randomUUID)();
|
|
80
80
|
}, [threadId, parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.threadId]);
|
|
81
81
|
const [internalModalOpen, setInternalModalOpen] = (0, react.useState)(isModalDefaultOpen !== null && isModalDefaultOpen !== void 0 ? isModalDefaultOpen : true);
|
|
82
|
-
const
|
|
83
|
-
const
|
|
82
|
+
const hasExplicitDefault = isModalDefaultOpen !== void 0;
|
|
83
|
+
const setAndSync = (0, react.useCallback)((open) => {
|
|
84
|
+
setInternalModalOpen(open);
|
|
85
|
+
parentConfig === null || parentConfig === void 0 || parentConfig.setModalOpen(open);
|
|
86
|
+
}, [parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.setModalOpen]);
|
|
87
|
+
const isMounted = (0, react.useRef)(false);
|
|
88
|
+
(0, react.useEffect)(() => {
|
|
89
|
+
if (!hasExplicitDefault) return;
|
|
90
|
+
if (!isMounted.current) {
|
|
91
|
+
isMounted.current = true;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if ((parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.isModalOpen) === void 0) return;
|
|
95
|
+
setInternalModalOpen(parentConfig.isModalOpen);
|
|
96
|
+
}, [parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.isModalOpen, hasExplicitDefault]);
|
|
97
|
+
const resolvedIsModalOpen = hasExplicitDefault ? internalModalOpen : (_parentConfig$isModal = parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.isModalOpen) !== null && _parentConfig$isModal !== void 0 ? _parentConfig$isModal : internalModalOpen;
|
|
98
|
+
const resolvedSetModalOpen = hasExplicitDefault ? setAndSync : (_parentConfig$setModa = parentConfig === null || parentConfig === void 0 ? void 0 : parentConfig.setModalOpen) !== null && _parentConfig$setModa !== void 0 ? _parentConfig$setModa : setInternalModalOpen;
|
|
84
99
|
const configurationValue = (0, react.useMemo)(() => ({
|
|
85
100
|
labels: mergedLabels,
|
|
86
101
|
agentId: resolvedAgentId,
|
|
@@ -3431,13 +3446,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3431
3446
|
* }
|
|
3432
3447
|
* ```
|
|
3433
3448
|
*/
|
|
3434
|
-
function useThreads({ userId, agentId }) {
|
|
3449
|
+
function useThreads({ userId, agentId, includeArchived, limit }) {
|
|
3435
3450
|
var _copilotkit$intellige2;
|
|
3436
3451
|
const { copilotkit } = useCopilotKit();
|
|
3437
3452
|
const [store] = (0, react.useState)(() => (0, _copilotkitnext_core.ɵcreateThreadStore)({ fetch: globalThis.fetch }));
|
|
3438
3453
|
const threads = useThreadStoreSelector(store, _copilotkitnext_core.ɵselectThreads);
|
|
3439
3454
|
const storeIsLoading = useThreadStoreSelector(store, _copilotkitnext_core.ɵselectThreadsIsLoading);
|
|
3440
3455
|
const storeError = useThreadStoreSelector(store, _copilotkitnext_core.ɵselectThreadsError);
|
|
3456
|
+
const hasNextPage = useThreadStoreSelector(store, _copilotkitnext_core.ɵselectHasNextPage);
|
|
3457
|
+
const isFetchingNextPage = useThreadStoreSelector(store, _copilotkitnext_core.ɵselectIsFetchingNextPage);
|
|
3441
3458
|
const headersKey = (0, react.useMemo)(() => {
|
|
3442
3459
|
var _copilotkit$headers;
|
|
3443
3460
|
return JSON.stringify(Object.entries((_copilotkit$headers = copilotkit.headers) !== null && _copilotkit$headers !== void 0 ? _copilotkit$headers : {}).sort(([left], [right]) => left.localeCompare(right)));
|
|
@@ -3461,7 +3478,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3461
3478
|
headers: { ...copilotkit.headers },
|
|
3462
3479
|
wsUrl: (_copilotkit$intellige = copilotkit.intelligence) === null || _copilotkit$intellige === void 0 ? void 0 : _copilotkit$intellige.wsUrl,
|
|
3463
3480
|
userId,
|
|
3464
|
-
agentId
|
|
3481
|
+
agentId,
|
|
3482
|
+
includeArchived,
|
|
3483
|
+
limit
|
|
3465
3484
|
} : null;
|
|
3466
3485
|
store.setContext(context);
|
|
3467
3486
|
}, [
|
|
@@ -3471,15 +3490,23 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3471
3490
|
(_copilotkit$intellige2 = copilotkit.intelligence) === null || _copilotkit$intellige2 === void 0 ? void 0 : _copilotkit$intellige2.wsUrl,
|
|
3472
3491
|
userId,
|
|
3473
3492
|
agentId,
|
|
3474
|
-
copilotkit.headers
|
|
3493
|
+
copilotkit.headers,
|
|
3494
|
+
includeArchived,
|
|
3495
|
+
limit
|
|
3475
3496
|
]);
|
|
3497
|
+
const renameThread = (0, react.useCallback)((threadId, name) => store.renameThread(threadId, name), [store]);
|
|
3498
|
+
const archiveThread = (0, react.useCallback)((threadId) => store.archiveThread(threadId), [store]);
|
|
3499
|
+
const deleteThread = (0, react.useCallback)((threadId) => store.deleteThread(threadId), [store]);
|
|
3476
3500
|
return {
|
|
3477
3501
|
threads,
|
|
3478
3502
|
isLoading,
|
|
3479
3503
|
error,
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3504
|
+
hasNextPage,
|
|
3505
|
+
isFetchingNextPage,
|
|
3506
|
+
fetchNextPage: (0, react.useCallback)(() => store.fetchNextPage(), [store]),
|
|
3507
|
+
renameThread,
|
|
3508
|
+
archiveThread,
|
|
3509
|
+
deleteThread
|
|
3483
3510
|
};
|
|
3484
3511
|
}
|
|
3485
3512
|
|
|
@@ -4735,7 +4762,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4735
4762
|
|
|
4736
4763
|
//#endregion
|
|
4737
4764
|
//#region src/components/chat/CopilotChat.tsx
|
|
4738
|
-
function CopilotChat({ agentId, threadId, labels, chatView, onError, ...props }) {
|
|
4765
|
+
function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, onError, ...props }) {
|
|
4739
4766
|
var _ref;
|
|
4740
4767
|
const existingConfig = useCopilotChatConfiguration();
|
|
4741
4768
|
const resolvedAgentId = (_ref = agentId !== null && agentId !== void 0 ? agentId : existingConfig === null || existingConfig === void 0 ? void 0 : existingConfig.agentId) !== null && _ref !== void 0 ? _ref : _copilotkitnext_shared.DEFAULT_AGENT_ID;
|
|
@@ -4791,7 +4818,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4791
4818
|
return () => {
|
|
4792
4819
|
detached = true;
|
|
4793
4820
|
connectAbortController.abort();
|
|
4794
|
-
agent.detachActiveRun();
|
|
4821
|
+
agent.detachActiveRun().catch(() => {});
|
|
4795
4822
|
};
|
|
4796
4823
|
}, [
|
|
4797
4824
|
resolvedThreadId,
|
|
@@ -4926,6 +4953,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4926
4953
|
agentId: resolvedAgentId,
|
|
4927
4954
|
threadId: resolvedThreadId,
|
|
4928
4955
|
labels,
|
|
4956
|
+
isModalDefaultOpen,
|
|
4929
4957
|
children: [transcriptionError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4930
4958
|
style: {
|
|
4931
4959
|
position: "absolute",
|
|
@@ -5395,6 +5423,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5395
5423
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
|
|
5396
5424
|
welcomeScreen: CopilotSidebarView.WelcomeScreen,
|
|
5397
5425
|
...chatProps,
|
|
5426
|
+
isModalDefaultOpen: defaultOpen,
|
|
5398
5427
|
chatView: SidebarViewOverride
|
|
5399
5428
|
});
|
|
5400
5429
|
}
|
|
@@ -5428,6 +5457,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5428
5457
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
|
|
5429
5458
|
welcomeScreen: CopilotPopupView_default.WelcomeScreen,
|
|
5430
5459
|
...chatProps,
|
|
5460
|
+
isModalDefaultOpen: defaultOpen,
|
|
5431
5461
|
chatView: PopupViewOverride
|
|
5432
5462
|
});
|
|
5433
5463
|
}
|