@copilotkit/react-core 1.10.1-next.2 → 1.10.2-next.0
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/CHANGELOG.md +18 -0
- package/dist/{chunk-WSXTUD36.mjs → chunk-A2ORBLCP.mjs} +3 -3
- package/dist/chunk-A2ORBLCP.mjs.map +1 -0
- package/dist/{chunk-BLMAVXM2.mjs → chunk-ACHZJNZF.mjs} +2 -2
- package/dist/{chunk-2GRWTU7W.mjs → chunk-AEAS6ZRO.mjs} +2 -2
- package/dist/{chunk-JY3STRON.mjs → chunk-HD2TFFAT.mjs} +5 -4
- package/dist/chunk-HD2TFFAT.mjs.map +1 -0
- package/dist/{chunk-KH27ZS4Y.mjs → chunk-HD3F6XVZ.mjs} +6 -5
- package/dist/chunk-HD3F6XVZ.mjs.map +1 -0
- package/dist/{chunk-NTH42BY5.mjs → chunk-KDE2GWEU.mjs} +2 -2
- package/dist/{chunk-BEFEBKKI.mjs → chunk-ME7RQK67.mjs} +2 -2
- package/dist/{chunk-3BASANUO.mjs → chunk-QE7Z6LQR.mjs} +3 -3
- package/dist/{chunk-3BASANUO.mjs.map → chunk-QE7Z6LQR.mjs.map} +1 -1
- package/dist/{chunk-5P46WS5M.mjs → chunk-WNMN2UNU.mjs} +2 -2
- package/dist/{chunk-YIBUNEBN.mjs → chunk-ZJYEXP6T.mjs} +2 -2
- package/dist/components/copilot-provider/copilotkit.js +3 -3
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +3 -3
- package/dist/components/copilot-provider/index.js +3 -3
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +3 -3
- package/dist/components/dev-console/console-trigger.js +3 -3
- package/dist/components/dev-console/console-trigger.js.map +1 -1
- package/dist/components/dev-console/console-trigger.mjs +2 -2
- package/dist/components/dev-console/developer-console-modal.js +2 -2
- package/dist/components/dev-console/developer-console-modal.js.map +1 -1
- package/dist/components/dev-console/developer-console-modal.mjs +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/hooks/index.js +7 -5
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +9 -9
- package/dist/hooks/use-chat.d.ts +1 -0
- package/dist/hooks/use-chat.js +5 -4
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +1 -1
- package/dist/hooks/use-coagent.js +7 -5
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +6 -6
- package/dist/hooks/use-copilot-chat-headless_c.js +7 -5
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
- package/dist/hooks/use-copilot-chat.js +7 -5
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +6 -6
- package/dist/hooks/use-copilot-chat_internal.d.ts +4 -0
- package/dist/hooks/use-copilot-chat_internal.js +7 -5
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
- package/dist/hooks/use-langgraph-interrupt.js +7 -5
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +6 -6
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/lib/copilot-task.mjs +4 -4
- package/dist/lib/index.mjs +4 -4
- package/dist/utils/extract.mjs +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/utils/suggestions.mjs +3 -3
- package/package.json +3 -3
- package/src/components/dev-console/console-trigger.tsx +2 -2
- package/src/components/dev-console/developer-console-modal.tsx +2 -2
- package/src/hooks/use-chat.ts +7 -3
- package/src/hooks/use-copilot-chat_internal.ts +6 -0
- package/dist/chunk-JY3STRON.mjs.map +0 -1
- package/dist/chunk-KH27ZS4Y.mjs.map +0 -1
- package/dist/chunk-WSXTUD36.mjs.map +0 -1
- /package/dist/{chunk-BLMAVXM2.mjs.map → chunk-ACHZJNZF.mjs.map} +0 -0
- /package/dist/{chunk-2GRWTU7W.mjs.map → chunk-AEAS6ZRO.mjs.map} +0 -0
- /package/dist/{chunk-NTH42BY5.mjs.map → chunk-KDE2GWEU.mjs.map} +0 -0
- /package/dist/{chunk-BEFEBKKI.mjs.map → chunk-ME7RQK67.mjs.map} +0 -0
- /package/dist/{chunk-5P46WS5M.mjs.map → chunk-WNMN2UNU.mjs.map} +0 -0
- /package/dist/{chunk-YIBUNEBN.mjs.map → chunk-ZJYEXP6T.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "./chunk-YPBKY4KY.mjs";
|
|
|
3
3
|
import "./chunk-LUGEI4YQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
CopilotTask
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AEAS6ZRO.mjs";
|
|
7
7
|
import "./chunk-6YOKPWQ7.mjs";
|
|
8
8
|
import "./chunk-KDAZGZ24.mjs";
|
|
9
9
|
import {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-6EKLRL7B.mjs";
|
|
12
12
|
import {
|
|
13
13
|
useLangGraphInterrupt
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KDE2GWEU.mjs";
|
|
15
15
|
import {
|
|
16
16
|
useMakeCopilotDocumentReadable
|
|
17
17
|
} from "./chunk-CLMDRYEN.mjs";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
startAgent,
|
|
24
24
|
stopAgent,
|
|
25
25
|
useCoAgent
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ME7RQK67.mjs";
|
|
27
27
|
import {
|
|
28
28
|
useCopilotAdditionalInstructions
|
|
29
29
|
} from "./chunk-3RHHNUVV.mjs";
|
|
@@ -35,28 +35,28 @@ import {
|
|
|
35
35
|
} from "./chunk-OPRDTF4S.mjs";
|
|
36
36
|
import {
|
|
37
37
|
useCopilotChatHeadless_c
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ACHZJNZF.mjs";
|
|
39
39
|
import {
|
|
40
40
|
useCopilotChat as useCopilotChat2
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ZJYEXP6T.mjs";
|
|
42
42
|
import {
|
|
43
43
|
useCopilotChat
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-HD2TFFAT.mjs";
|
|
45
45
|
import {
|
|
46
46
|
useLangGraphInterruptRender
|
|
47
47
|
} from "./chunk-IN7GE4NO.mjs";
|
|
48
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-HD3F6XVZ.mjs";
|
|
49
49
|
import "./chunk-4CEQJ2X6.mjs";
|
|
50
50
|
import {
|
|
51
51
|
CopilotKit,
|
|
52
52
|
defaultCopilotContextCategories,
|
|
53
53
|
extract,
|
|
54
54
|
reloadSuggestions
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-WNMN2UNU.mjs";
|
|
56
56
|
import "./chunk-N4VN2B5S.mjs";
|
|
57
57
|
import "./chunk-MUDXTKXE.mjs";
|
|
58
|
-
import "./chunk-
|
|
59
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-QE7Z6LQR.mjs";
|
|
59
|
+
import "./chunk-A2ORBLCP.mjs";
|
|
60
60
|
import "./chunk-PIF5KJYI.mjs";
|
|
61
61
|
import {
|
|
62
62
|
SUGGESTION_RETRY_CONFIG
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotTask
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-AEAS6ZRO.mjs";
|
|
4
4
|
import "../chunk-4CEQJ2X6.mjs";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-WNMN2UNU.mjs";
|
|
6
6
|
import "../chunk-N4VN2B5S.mjs";
|
|
7
7
|
import "../chunk-MUDXTKXE.mjs";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-QE7Z6LQR.mjs";
|
|
9
|
+
import "../chunk-A2ORBLCP.mjs";
|
|
10
10
|
import "../chunk-PIF5KJYI.mjs";
|
|
11
11
|
import "../chunk-2IDV5OHF.mjs";
|
|
12
12
|
import "../chunk-PMAFHQ7P.mjs";
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../chunk-LUGEI4YQ.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotTask
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-AEAS6ZRO.mjs";
|
|
5
5
|
import "../chunk-4CEQJ2X6.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-WNMN2UNU.mjs";
|
|
7
7
|
import "../chunk-N4VN2B5S.mjs";
|
|
8
8
|
import "../chunk-MUDXTKXE.mjs";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-QE7Z6LQR.mjs";
|
|
10
|
+
import "../chunk-A2ORBLCP.mjs";
|
|
11
11
|
import "../chunk-PIF5KJYI.mjs";
|
|
12
12
|
import "../chunk-2IDV5OHF.mjs";
|
|
13
13
|
import "../chunk-PMAFHQ7P.mjs";
|
package/dist/utils/extract.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extract
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WNMN2UNU.mjs";
|
|
4
4
|
import "../chunk-N4VN2B5S.mjs";
|
|
5
5
|
import "../chunk-MUDXTKXE.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-QE7Z6LQR.mjs";
|
|
7
|
+
import "../chunk-A2ORBLCP.mjs";
|
|
8
8
|
import "../chunk-PIF5KJYI.mjs";
|
|
9
9
|
import "../chunk-2IDV5OHF.mjs";
|
|
10
10
|
import "../chunk-PMAFHQ7P.mjs";
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extract,
|
|
3
3
|
reloadSuggestions
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-WNMN2UNU.mjs";
|
|
5
5
|
import "../chunk-N4VN2B5S.mjs";
|
|
6
6
|
import "../chunk-MUDXTKXE.mjs";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-QE7Z6LQR.mjs";
|
|
8
|
+
import "../chunk-A2ORBLCP.mjs";
|
|
9
9
|
import "../chunk-PIF5KJYI.mjs";
|
|
10
10
|
import {
|
|
11
11
|
SUGGESTION_RETRY_CONFIG
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
reloadSuggestions
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WNMN2UNU.mjs";
|
|
4
4
|
import "../chunk-N4VN2B5S.mjs";
|
|
5
5
|
import "../chunk-MUDXTKXE.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-QE7Z6LQR.mjs";
|
|
7
|
+
import "../chunk-A2ORBLCP.mjs";
|
|
8
8
|
import "../chunk-PIF5KJYI.mjs";
|
|
9
9
|
import "../chunk-2IDV5OHF.mjs";
|
|
10
10
|
import "../chunk-PMAFHQ7P.mjs";
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.10.
|
|
12
|
+
"version": "1.10.2-next.0",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@scarf/scarf": "^1.3.0",
|
|
48
48
|
"react-markdown": "^8.0.7",
|
|
49
49
|
"untruncate-json": "^0.0.1",
|
|
50
|
-
"@copilotkit/runtime-client-gql": "1.10.
|
|
51
|
-
"@copilotkit/shared": "1.10.
|
|
50
|
+
"@copilotkit/runtime-client-gql": "1.10.2-next.0",
|
|
51
|
+
"@copilotkit/shared": "1.10.2-next.0"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"copilotkit",
|
|
@@ -142,8 +142,8 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
142
142
|
}}
|
|
143
143
|
title={
|
|
144
144
|
hasApiKey
|
|
145
|
-
? "Open
|
|
146
|
-
: "
|
|
145
|
+
? "Open Inspector (Drag to move)"
|
|
146
|
+
: "Inspector (License Key Required, Drag to move)"
|
|
147
147
|
}
|
|
148
148
|
>
|
|
149
149
|
<div
|
|
@@ -230,7 +230,7 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
230
230
|
margin: 0,
|
|
231
231
|
}}
|
|
232
232
|
>
|
|
233
|
-
|
|
233
|
+
Inspector
|
|
234
234
|
</h1>
|
|
235
235
|
<span
|
|
236
236
|
style={{
|
|
@@ -465,7 +465,7 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
465
465
|
e.currentTarget.style.outline = "none";
|
|
466
466
|
}}
|
|
467
467
|
>
|
|
468
|
-
Get
|
|
468
|
+
Get License Key
|
|
469
469
|
<span style={{ fontSize: "16px", marginLeft: "-4px" }}>→</span>
|
|
470
470
|
</button>
|
|
471
471
|
</div>
|
package/src/hooks/use-chat.ts
CHANGED
|
@@ -159,6 +159,8 @@ export type UseChatOptions = {
|
|
|
159
159
|
langGraphInterruptAction: LangGraphInterruptAction | null;
|
|
160
160
|
|
|
161
161
|
setLangGraphInterruptAction: LangGraphInterruptActionSetter;
|
|
162
|
+
|
|
163
|
+
disableSystemMessage?: boolean;
|
|
162
164
|
};
|
|
163
165
|
|
|
164
166
|
export type UseChatHelpers = {
|
|
@@ -222,6 +224,7 @@ export function useChat(options: UseChatOptions): UseChatHelpers {
|
|
|
222
224
|
setExtensions,
|
|
223
225
|
langGraphInterruptAction,
|
|
224
226
|
setLangGraphInterruptAction,
|
|
227
|
+
disableSystemMessage = false,
|
|
225
228
|
} = options;
|
|
226
229
|
const runChatCompletionRef = useRef<(previousMessages: Message[]) => Promise<Message[]>>();
|
|
227
230
|
const addErrorToast = useErrorToast();
|
|
@@ -321,9 +324,9 @@ export function useChat(options: UseChatOptions): UseChatHelpers {
|
|
|
321
324
|
|
|
322
325
|
setMessages([...previousMessages, ...newMessages]);
|
|
323
326
|
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
const messagesWithContext = disableSystemMessage
|
|
328
|
+
? [...(initialMessages || []), ...previousMessages]
|
|
329
|
+
: [makeSystemMessageCallback(), ...(initialMessages || []), ...previousMessages];
|
|
327
330
|
|
|
328
331
|
// ----- Set mcpServers in properties -----
|
|
329
332
|
// Create a copy of properties to avoid modifying the original object
|
|
@@ -871,6 +874,7 @@ export function useChat(options: UseChatOptions): UseChatHelpers {
|
|
|
871
874
|
coagentStatesRef,
|
|
872
875
|
agentSession,
|
|
873
876
|
setAgentSession,
|
|
877
|
+
disableSystemMessage,
|
|
874
878
|
],
|
|
875
879
|
);
|
|
876
880
|
|
|
@@ -41,6 +41,11 @@ export interface UseCopilotChatOptions {
|
|
|
41
41
|
* A function to generate the system message. Defaults to `defaultSystemMessage`.
|
|
42
42
|
*/
|
|
43
43
|
makeSystemMessage?: SystemMessageFunction;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from <code>makeSystemMessage</code>).
|
|
47
|
+
*/
|
|
48
|
+
disableSystemMessage?: boolean;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
export interface MCPServerConfig {
|
|
@@ -390,6 +395,7 @@ export function useCopilotChat(options: UseCopilotChatOptions = {}): UseCopilotC
|
|
|
390
395
|
setExtensions,
|
|
391
396
|
langGraphInterruptAction,
|
|
392
397
|
setLangGraphInterruptAction,
|
|
398
|
+
disableSystemMessage: options.disableSystemMessage,
|
|
393
399
|
});
|
|
394
400
|
|
|
395
401
|
const latestAppend = useUpdatedRef(append);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-copilot-chat_internal.ts"],"sourcesContent":["import { useRef, useEffect, useCallback, useState, useMemo } from \"react\";\nimport { AgentSession, useCopilotContext, CopilotContextParams } from \"../context/copilot-context\";\nimport { useCopilotMessagesContext, CopilotMessagesContextParams } from \"../context\";\nimport { SystemMessageFunction } from \"../types\";\nimport { useChat, AppendMessageOptions } from \"./use-chat\";\nimport { defaultCopilotContextCategories } from \"../components\";\nimport { CoAgentStateRenderHandlerArguments } from \"@copilotkit/shared\";\nimport { useAsyncCallback } from \"../components/error-boundary/error-utils\";\nimport { reloadSuggestions as generateSuggestions } from \"../utils\";\nimport type { SuggestionItem } from \"../utils\";\n\nimport { Message } from \"@copilotkit/shared\";\nimport {\n Role as gqlRole,\n TextMessage,\n aguiToGQL,\n gqlToAGUI,\n Message as DeprecatedGqlMessage,\n} from \"@copilotkit/runtime-client-gql\";\nimport { useLangGraphInterruptRender } from \"./use-langgraph-interrupt-render\";\n\nexport interface UseCopilotChatOptions {\n /**\n * A unique identifier for the chat. If not provided, a random one will be\n * generated. When provided, the `useChat` hook with the same `id` will\n * have shared states across components.\n */\n id?: string;\n\n /**\n * HTTP headers to be sent with the API request.\n */\n headers?: Record<string, string> | Headers;\n\n /**\n * Initial messages to populate the chat with.\n */\n initialMessages?: Message[];\n\n /**\n * A function to generate the system message. Defaults to `defaultSystemMessage`.\n */\n makeSystemMessage?: SystemMessageFunction;\n}\n\nexport interface MCPServerConfig {\n endpoint: string;\n apiKey?: string;\n}\n\nexport interface UseCopilotChatReturn {\n /**\n * @deprecated use `messages` instead, this is an old non ag-ui version of the messages\n * Array of messages currently visible in the chat interface\n *\n * This is the visible messages, not the raw messages from the runtime client.\n */\n visibleMessages: DeprecatedGqlMessage[];\n\n /**\n * The messages that are currently in the chat in AG-UI format.\n */\n messages: Message[];\n\n /** @deprecated use `sendMessage` instead */\n appendMessage: (message: DeprecatedGqlMessage, options?: AppendMessageOptions) => Promise<void>;\n\n /**\n * Send a new message to the chat\n *\n * ```tsx\n * await sendMessage({\n * id: \"123\",\n * role: \"user\",\n * content: \"Hello, process this request\",\n * });\n * ```\n */\n sendMessage: (message: Message, options?: AppendMessageOptions) => Promise<void>;\n\n /**\n * Replace all messages in the chat\n *\n * ```tsx\n * setMessages([\n * { id: \"123\", role: \"user\", content: \"Hello, process this request\" },\n * { id: \"456\", role: \"assistant\", content: \"Hello, I'm the assistant\" },\n * ]);\n * ```\n *\n * **Deprecated** non-ag-ui version:\n *\n * ```tsx\n * setMessages([\n * new TextMessage({\n * content: \"Hello, process this request\",\n * role: gqlRole.User,\n * }),\n * new TextMessage({\n * content: \"Hello, I'm the assistant\",\n * role: gqlRole.Assistant,\n * ]);\n * ```\n *\n */\n setMessages: (messages: Message[] | DeprecatedGqlMessage[]) => void;\n\n /**\n * Remove a specific message by ID\n *\n * ```tsx\n * deleteMessage(\"123\");\n * ```\n */\n deleteMessage: (messageId: string) => void;\n\n /**\n * Regenerate the response for a specific message\n *\n * ```tsx\n * reloadMessages(\"123\");\n * ```\n */\n reloadMessages: (messageId: string) => Promise<void>;\n\n /**\n * Stop the current message generation\n *\n * ```tsx\n * if (isLoading) {\n * stopGeneration();\n * }\n * ```\n */\n stopGeneration: () => void;\n\n /**\n * Clear all messages and reset chat state\n *\n * ```tsx\n * reset();\n * console.log(messages); // []\n * ```\n */\n reset: () => void;\n\n /**\n * Whether the chat is currently generating a response\n *\n * ```tsx\n * if (isLoading) {\n * console.log(\"Loading...\");\n * } else {\n * console.log(\"Not loading\");\n * }\n */\n isLoading: boolean;\n\n /** Manually trigger chat completion (advanced usage) */\n runChatCompletion: () => Promise<Message[]>;\n\n /** MCP (Model Context Protocol) server configurations */\n mcpServers: MCPServerConfig[];\n\n /** Update MCP server configurations */\n setMcpServers: (mcpServers: MCPServerConfig[]) => void;\n\n /**\n * Current suggestions array\n * Use this to read the current suggestions or in conjunction with setSuggestions for manual control\n */\n suggestions: SuggestionItem[];\n\n /**\n * Manually set suggestions\n * Useful for manual mode or custom suggestion workflows\n */\n setSuggestions: (suggestions: SuggestionItem[]) => void;\n\n /**\n * Trigger AI-powered suggestion generation\n * Uses configurations from useCopilotChatSuggestions hooks\n * Respects global debouncing - only one generation can run at a time\n *\n * ```tsx\n * generateSuggestions();\n * console.log(suggestions); // [suggestion1, suggestion2, suggestion3]\n * ```\n */\n generateSuggestions: () => Promise<void>;\n\n /**\n * Clear all current suggestions\n * Also resets suggestion generation state\n */\n resetSuggestions: () => void;\n\n /** Whether suggestions are currently being generated */\n isLoadingSuggestions: boolean;\n\n /** Interrupt content for human-in-the-loop workflows */\n interrupt: string | React.ReactElement | null;\n}\n\nlet globalSuggestionPromise: Promise<void> | null = null;\n\nexport function useCopilotChat(options: UseCopilotChatOptions = {}): UseCopilotChatReturn {\n const makeSystemMessage = options.makeSystemMessage ?? defaultSystemMessage;\n const {\n getContextString,\n getFunctionCallHandler,\n copilotApiConfig,\n isLoading,\n setIsLoading,\n chatInstructions,\n actions,\n coagentStatesRef,\n setCoagentStatesWithRef,\n coAgentStateRenders,\n agentSession,\n setAgentSession,\n forwardedParameters,\n agentLock,\n threadId,\n setThreadId,\n runId,\n setRunId,\n chatAbortControllerRef,\n extensions,\n setExtensions,\n langGraphInterruptAction,\n setLangGraphInterruptAction,\n chatSuggestionConfiguration,\n\n runtimeClient,\n } = useCopilotContext();\n const { messages, setMessages, suggestions, setSuggestions } = useCopilotMessagesContext();\n\n // Simple state for MCP servers (keep for interface compatibility)\n const [mcpServers, setLocalMcpServers] = useState<MCPServerConfig[]>([]);\n\n // Basic suggestion state for programmatic control\n const suggestionsAbortControllerRef = useRef<AbortController | null>(null);\n const isLoadingSuggestionsRef = useRef<boolean>(false);\n\n const abortSuggestions = useCallback(\n (clear: boolean = true) => {\n suggestionsAbortControllerRef.current?.abort(\"suggestions aborted by user\");\n suggestionsAbortControllerRef.current = null;\n if (clear) {\n setSuggestions([]);\n }\n },\n [setSuggestions],\n );\n\n // Memoize context with stable dependencies only\n const stableContext = useMemo(() => {\n return {\n actions,\n copilotApiConfig,\n chatSuggestionConfiguration,\n messages,\n setMessages,\n getContextString,\n runtimeClient,\n };\n }, [\n JSON.stringify(Object.keys(actions)),\n copilotApiConfig.chatApiEndpoint,\n messages.length,\n Object.keys(chatSuggestionConfiguration).length,\n ]);\n\n // Programmatic suggestion generation function\n const generateSuggestionsFunc = useCallback(async () => {\n // If a global suggestion is running, ignore this call\n if (globalSuggestionPromise) {\n return globalSuggestionPromise;\n }\n\n globalSuggestionPromise = (async () => {\n try {\n abortSuggestions();\n isLoadingSuggestionsRef.current = true;\n suggestionsAbortControllerRef.current = new AbortController();\n\n setSuggestions([]);\n\n await generateSuggestions(\n stableContext as CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration,\n setSuggestions,\n suggestionsAbortControllerRef,\n );\n } catch (error) {\n // Re-throw to allow caller to handle the error\n throw error;\n } finally {\n isLoadingSuggestionsRef.current = false;\n globalSuggestionPromise = null;\n }\n })();\n\n return globalSuggestionPromise;\n }, [stableContext, chatSuggestionConfiguration, setSuggestions, abortSuggestions]);\n\n const resetSuggestions = useCallback(() => {\n setSuggestions([]);\n }, [setSuggestions]);\n\n // MCP servers logic\n useEffect(() => {\n if (mcpServers.length > 0) {\n const serversCopy = [...mcpServers];\n copilotApiConfig.mcpServers = serversCopy;\n if (!copilotApiConfig.properties) {\n copilotApiConfig.properties = {};\n }\n copilotApiConfig.properties.mcpServers = serversCopy;\n }\n }, [mcpServers, copilotApiConfig]);\n\n const setMcpServers = useCallback((servers: MCPServerConfig[]) => {\n setLocalMcpServers(servers);\n }, []);\n\n // Move these function declarations above the useChat call\n const onCoAgentStateRender = useAsyncCallback(\n async (args: CoAgentStateRenderHandlerArguments) => {\n const { name, nodeName, state } = args;\n let action = Object.values(coAgentStateRenders).find(\n (action) => action.name === name && action.nodeName === nodeName,\n );\n if (!action) {\n action = Object.values(coAgentStateRenders).find(\n (action) => action.name === name && !action.nodeName,\n );\n }\n if (action) {\n await action.handler?.({ state, nodeName });\n }\n },\n [coAgentStateRenders],\n );\n\n const makeSystemMessageCallback = useCallback(() => {\n const systemMessageMaker = makeSystemMessage || defaultSystemMessage;\n // this always gets the latest context string\n const contextString = getContextString([], defaultCopilotContextCategories); // TODO: make the context categories configurable\n\n return new TextMessage({\n content: systemMessageMaker(contextString, chatInstructions),\n role: gqlRole.System,\n });\n }, [getContextString, makeSystemMessage, chatInstructions]);\n\n const deleteMessage = useCallback(\n (messageId: string) => {\n setMessages((prev) => prev.filter((message) => message.id !== messageId));\n },\n [setMessages],\n );\n\n // Get chat helpers with updated config\n const { append, reload, stop, runChatCompletion } = useChat({\n ...options,\n actions: Object.values(actions),\n copilotConfig: copilotApiConfig,\n initialMessages: aguiToGQL(options.initialMessages || []),\n onFunctionCall: getFunctionCallHandler(),\n onCoAgentStateRender,\n messages,\n setMessages,\n makeSystemMessageCallback,\n isLoading,\n setIsLoading,\n coagentStatesRef,\n setCoagentStatesWithRef,\n agentSession,\n setAgentSession,\n forwardedParameters,\n threadId,\n setThreadId,\n runId,\n setRunId,\n chatAbortControllerRef,\n agentLock,\n extensions,\n setExtensions,\n langGraphInterruptAction,\n setLangGraphInterruptAction,\n });\n\n const latestAppend = useUpdatedRef(append);\n const latestAppendFunc = useAsyncCallback(\n async (message: DeprecatedGqlMessage, options?: AppendMessageOptions) => {\n abortSuggestions(options?.clearSuggestions);\n return await latestAppend.current(message, options);\n },\n [latestAppend],\n );\n\n const latestSendMessageFunc = useAsyncCallback(\n async (message: Message, options?: AppendMessageOptions) => {\n abortSuggestions(options?.clearSuggestions);\n return await latestAppend.current(aguiToGQL([message])[0] as DeprecatedGqlMessage, options);\n },\n [latestAppend],\n );\n\n const latestReload = useUpdatedRef(reload);\n const latestReloadFunc = useAsyncCallback(\n async (messageId: string) => {\n return await latestReload.current(messageId);\n },\n [latestReload],\n );\n\n const latestStop = useUpdatedRef(stop);\n const latestStopFunc = useCallback(() => {\n return latestStop.current();\n }, [latestStop]);\n\n const latestDelete = useUpdatedRef(deleteMessage);\n const latestDeleteFunc = useCallback(\n (messageId: string) => {\n return latestDelete.current(messageId);\n },\n [latestDelete],\n );\n\n const latestSetMessages = useUpdatedRef(setMessages);\n const latestSetMessagesFunc = useCallback(\n (messages: Message[] | DeprecatedGqlMessage[]) => {\n if (messages.every((message) => message instanceof DeprecatedGqlMessage)) {\n return latestSetMessages.current(messages as DeprecatedGqlMessage[]);\n }\n return latestSetMessages.current(aguiToGQL(messages));\n },\n [latestSetMessages],\n );\n\n const latestRunChatCompletion = useUpdatedRef(runChatCompletion);\n const latestRunChatCompletionFunc = useAsyncCallback(async () => {\n return await latestRunChatCompletion.current!();\n }, [latestRunChatCompletion]);\n\n const reset = useCallback(() => {\n latestStopFunc();\n setMessages([]);\n setRunId(null);\n setCoagentStatesWithRef({});\n let initialAgentSession: AgentSession | null = null;\n if (agentLock) {\n initialAgentSession = {\n agentName: agentLock,\n };\n }\n setAgentSession(initialAgentSession);\n // Reset suggestions when chat is reset\n resetSuggestions();\n }, [\n latestStopFunc,\n setMessages,\n setThreadId,\n setCoagentStatesWithRef,\n setAgentSession,\n agentLock,\n resetSuggestions,\n ]);\n\n const latestReset = useUpdatedRef(reset);\n const latestResetFunc = useCallback(() => {\n return latestReset.current();\n }, [latestReset]);\n\n const interrupt = useLangGraphInterruptRender();\n\n return {\n visibleMessages: messages,\n messages: gqlToAGUI(messages, actions, coAgentStateRenders),\n sendMessage: latestSendMessageFunc,\n appendMessage: latestAppendFunc,\n setMessages: latestSetMessagesFunc,\n reloadMessages: latestReloadFunc,\n stopGeneration: latestStopFunc,\n reset: latestResetFunc,\n deleteMessage: latestDeleteFunc,\n runChatCompletion: latestRunChatCompletionFunc,\n isLoading,\n mcpServers,\n setMcpServers,\n suggestions,\n setSuggestions,\n generateSuggestions: generateSuggestionsFunc,\n resetSuggestions,\n isLoadingSuggestions: isLoadingSuggestionsRef.current,\n interrupt,\n };\n}\n\n// store `value` in a ref and update\n// it whenever it changes.\nfunction useUpdatedRef<T>(value: T) {\n const ref = useRef(value);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n}\n\nexport function defaultSystemMessage(\n contextString: string,\n additionalInstructions?: string,\n): string {\n return (\n `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.\n\nPlease assist them as best you can.\n\nYou can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.\n\nIf you would like to call a function, call it without saying anything else.\nIn case of a function error:\n- If this error stems from incorrect function parameters or syntax, you may retry with corrected arguments.\n- If the error's source is unclear or seems unrelated to your input, do not attempt further retries.\n` + (additionalInstructions ? `\\n\\n${additionalInstructions}` : \"\")\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,WAAW,aAAa,UAAU,eAAe;AAYlE;AAAA,EACE,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,OACN;AA0LP,IAAI,0BAAgD;AAE7C,SAAS,eAAe,UAAiC,CAAC,GAAyB;AA9M1F;AA+ME,QAAM,qBAAoB,aAAQ,sBAAR,YAA6B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,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,cAAc,cAAc,KAAK;AACvC,QAAM,kBAAkB,YAAY,MAAM;AACxC,WAAO,YAAY,QAAQ;AAAA,EAC7B,GAAG,CAAC,WAAW,CAAC;AAEhB,QAAM,YAAY,4BAA4B;AAE9C,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,UAAU,UAAU,UAAU,SAAS,mBAAmB;AAAA,IAC1D,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IACrB;AAAA,IACA,sBAAsB,wBAAwB;AAAA,IAC9C;AAAA,EACF;AACF;AAIA,SAAS,cAAiB,OAAU;AAClC,QAAM,MAAM,OAAO,KAAK;AAExB,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;AAEO,SAAS,qBACd,eACA,wBACQ;AACR,SACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAaG,yBAAyB;AAAA;AAAA,EAAO,2BAA2B;AAEhE;","names":["_a","action","options","messages"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-chat.ts"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport {\n FunctionCallHandler,\n COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,\n CoAgentStateRenderHandler,\n randomId,\n parseJson,\n CopilotKitError,\n CopilotKitErrorCode,\n} from \"@copilotkit/shared\";\nimport {\n Message,\n TextMessage,\n ResultMessage,\n convertMessagesToGqlInput,\n filterAdjacentAgentStateMessages,\n filterAgentStateMessages,\n convertGqlOutputToMessages,\n MessageStatusCode,\n MessageRole,\n Role,\n CopilotRequestType,\n ForwardedParametersInput,\n loadMessagesFromJsonRepresentation,\n ExtensionsInput,\n CopilotRuntimeClient,\n langGraphInterruptEvent,\n MetaEvent,\n MetaEventName,\n ActionExecutionMessage,\n CopilotKitLangGraphInterruptEvent,\n LangGraphInterruptEvent,\n MetaEventInput,\n AgentStateInput,\n} from \"@copilotkit/runtime-client-gql\";\n\nimport { CopilotApiConfig } from \"../context\";\nimport { FrontendAction, processActionsForRuntimeRequest } from \"../types/frontend-action\";\nimport { CoagentState } from \"../types/coagent-state\";\nimport { AgentSession, useCopilotContext } from \"../context/copilot-context\";\nimport { useCopilotRuntimeClient } from \"./use-copilot-runtime-client\";\nimport { useAsyncCallback, useErrorToast } from \"../components/error-boundary/error-utils\";\nimport { useToast } from \"../components/toast/toast-provider\";\nimport {\n LangGraphInterruptAction,\n LangGraphInterruptActionSetter,\n} from \"../types/interrupt-action\";\n\nexport type UseChatOptions = {\n /**\n * System messages of the chat. Defaults to an empty array.\n */\n initialMessages?: Message[];\n /**\n * Callback function to be called when a function call is received.\n * If the function returns a `ChatRequest` object, the request will be sent\n * automatically to the API and will be used to update the chat.\n */\n onFunctionCall?: FunctionCallHandler;\n\n /**\n * Callback function to be called when a coagent action is received.\n */\n onCoAgentStateRender?: CoAgentStateRenderHandler;\n\n /**\n * Function definitions to be sent to the API.\n */\n actions: FrontendAction<any>[];\n\n /**\n * The CopilotKit API configuration.\n */\n copilotConfig: CopilotApiConfig;\n\n /**\n * The current list of messages in the chat.\n */\n messages: Message[];\n /**\n * The setState-powered method to update the chat messages.\n */\n setMessages: React.Dispatch<React.SetStateAction<Message[]>>;\n\n /**\n * A callback to get the latest system message.\n */\n makeSystemMessageCallback: () => TextMessage;\n\n /**\n * Whether the API request is in progress\n */\n isLoading: boolean;\n\n /**\n * setState-powered method to update the isChatLoading value\n */\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\n /**\n * The current list of coagent states.\n */\n coagentStatesRef: React.RefObject<Record<string, CoagentState>>;\n\n /**\n * setState-powered method to update the agent states\n */\n setCoagentStatesWithRef: React.Dispatch<React.SetStateAction<Record<string, CoagentState>>>;\n\n /**\n * The current agent session.\n */\n agentSession: AgentSession | null;\n\n /**\n * setState-powered method to update the agent session\n */\n setAgentSession: React.Dispatch<React.SetStateAction<AgentSession | null>>;\n\n /**\n * The forwarded parameters.\n */\n forwardedParameters?: Pick<ForwardedParametersInput, \"temperature\">;\n\n /**\n * The current thread ID.\n */\n threadId: string;\n /**\n * set the current thread ID\n */\n setThreadId: (threadId: string) => void;\n /**\n * The current run ID.\n */\n runId: string | null;\n /**\n * set the current run ID\n */\n setRunId: (runId: string | null) => void;\n /**\n * The global chat abort controller.\n */\n chatAbortControllerRef: React.MutableRefObject<AbortController | null>;\n /**\n * The agent lock.\n */\n agentLock: string | null;\n /**\n * The extensions.\n */\n extensions: ExtensionsInput;\n /**\n * The setState-powered method to update the extensions.\n */\n setExtensions: React.Dispatch<React.SetStateAction<ExtensionsInput>>;\n\n langGraphInterruptAction: LangGraphInterruptAction | null;\n\n setLangGraphInterruptAction: LangGraphInterruptActionSetter;\n};\n\nexport type UseChatHelpers = {\n /**\n * Append a user message to the chat list. This triggers the API call to fetch\n * the assistant's response.\n * @param message The message to append\n */\n append: (message: Message, options?: AppendMessageOptions) => Promise<void>;\n /**\n * Reload the last AI chat response for the given chat history. If the last\n * message isn't from the assistant, it will request the API to generate a\n * new response.\n */\n reload: (messageId: string) => Promise<void>;\n /**\n * Abort the current request immediately, keep the generated tokens if any.\n */\n stop: () => void;\n\n /**\n * Run the chat completion.\n */\n runChatCompletion: () => Promise<Message[]>;\n};\n\nexport interface AppendMessageOptions {\n /**\n * Whether to run the chat completion after appending the message. Defaults to `true`.\n */\n followUp?: boolean;\n /**\n * Whether to clear the suggestions after appending the message. Defaults to `true`.\n */\n clearSuggestions?: boolean;\n}\n\nexport function useChat(options: UseChatOptions): UseChatHelpers {\n const {\n messages,\n setMessages,\n makeSystemMessageCallback,\n copilotConfig,\n setIsLoading,\n initialMessages,\n isLoading,\n actions,\n onFunctionCall,\n onCoAgentStateRender,\n setCoagentStatesWithRef,\n coagentStatesRef,\n agentSession,\n setAgentSession,\n threadId,\n setThreadId,\n runId,\n setRunId,\n chatAbortControllerRef,\n agentLock,\n extensions,\n setExtensions,\n langGraphInterruptAction,\n setLangGraphInterruptAction,\n } = options;\n const runChatCompletionRef = useRef<(previousMessages: Message[]) => Promise<Message[]>>();\n const addErrorToast = useErrorToast();\n const { setBannerError } = useToast();\n\n // Get onError from context since it's not part of copilotConfig\n const { onError } = useCopilotContext();\n\n // Add tracing functionality to use-chat\n const traceUIError = async (error: CopilotKitError, originalError?: any) => {\n // Just check if onError and publicApiKey are defined\n if (!onError || !copilotConfig?.publicApiKey) return;\n\n try {\n const traceEvent = {\n type: \"error\" as const,\n timestamp: Date.now(),\n context: {\n source: \"ui\" as const,\n request: {\n operation: \"useChatCompletion\",\n url: copilotConfig.chatApiEndpoint,\n startTime: Date.now(),\n },\n technical: {\n environment: \"browser\",\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : undefined,\n stackTrace: originalError instanceof Error ? originalError.stack : undefined,\n },\n },\n error,\n };\n\n await onError(traceEvent);\n } catch (traceError) {\n console.error(\"Error in use-chat onError handler:\", traceError);\n }\n };\n // We need to keep a ref of coagent states and session because of renderAndWait - making sure\n // the latest state is sent to the API\n // This is a workaround and needs to be addressed in the future\n const agentSessionRef = useRef<AgentSession | null>(agentSession);\n agentSessionRef.current = agentSession;\n\n const runIdRef = useRef<string | null>(runId);\n runIdRef.current = runId;\n const extensionsRef = useRef<ExtensionsInput>(extensions);\n extensionsRef.current = extensions;\n\n const publicApiKey = copilotConfig.publicApiKey;\n\n const headers = {\n ...(copilotConfig.headers || {}),\n ...(publicApiKey ? { [COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {}),\n };\n\n const { showDevConsole } = useCopilotContext();\n\n const runtimeClient = useCopilotRuntimeClient({\n url: copilotConfig.chatApiEndpoint,\n publicApiKey: copilotConfig.publicApiKey,\n headers,\n credentials: copilotConfig.credentials,\n showDevConsole,\n });\n\n const pendingAppendsRef = useRef<{ message: Message; followUp: boolean }[]>([]);\n\n const runChatCompletion = useAsyncCallback(\n async (previousMessages: Message[]): Promise<Message[]> => {\n setIsLoading(true);\n const interruptEvent = langGraphInterruptAction?.event;\n // In case an interrupt event exist and valid but has no response yet, we cannot process further messages to an agent\n if (\n interruptEvent?.name === MetaEventName.LangGraphInterruptEvent &&\n interruptEvent?.value &&\n !interruptEvent?.response &&\n agentSessionRef.current\n ) {\n addErrorToast([\n new Error(\n \"A message was sent while interrupt is active. This will cause failure on the agent side\",\n ),\n ]);\n }\n\n // this message is just a placeholder. It will disappear once the first real message\n // is received\n let newMessages: Message[] = [\n new TextMessage({\n content: \"\",\n role: Role.Assistant,\n }),\n ];\n\n chatAbortControllerRef.current = new AbortController();\n\n setMessages([...previousMessages, ...newMessages]);\n\n const systemMessage = makeSystemMessageCallback();\n\n const messagesWithContext = [systemMessage, ...(initialMessages || []), ...previousMessages];\n\n // ----- Set mcpServers in properties -----\n // Create a copy of properties to avoid modifying the original object\n const finalProperties = { ...(copilotConfig.properties || {}) };\n\n // Look for mcpServers in either direct property or properties\n let mcpServersToUse = null;\n\n // First check direct mcpServers property\n if (\n copilotConfig.mcpServers &&\n Array.isArray(copilotConfig.mcpServers) &&\n copilotConfig.mcpServers.length > 0\n ) {\n mcpServersToUse = copilotConfig.mcpServers;\n }\n // Then check mcpServers in properties\n else if (\n copilotConfig.properties?.mcpServers &&\n Array.isArray(copilotConfig.properties.mcpServers) &&\n copilotConfig.properties.mcpServers.length > 0\n ) {\n mcpServersToUse = copilotConfig.properties.mcpServers;\n }\n\n // Apply the mcpServers to properties if found\n if (mcpServersToUse) {\n // Set in finalProperties\n finalProperties.mcpServers = mcpServersToUse;\n\n // Also set in copilotConfig directly for future use\n copilotConfig.mcpServers = mcpServersToUse;\n }\n // -------------------------------------------------------------\n\n const isAgentRun = agentSessionRef.current !== null;\n\n const stream = runtimeClient.asStream(\n runtimeClient.generateCopilotResponse({\n data: {\n frontend: {\n actions: processActionsForRuntimeRequest(actions),\n url: window.location.href,\n },\n threadId: threadId,\n runId: runIdRef.current,\n extensions: extensionsRef.current,\n metaEvents: composeAndFlushMetaEventsInput([langGraphInterruptAction?.event]),\n messages: convertMessagesToGqlInput(filterAgentStateMessages(messagesWithContext)),\n ...(copilotConfig.cloud\n ? {\n cloud: {\n ...(copilotConfig.cloud.guardrails?.input?.restrictToTopic?.enabled\n ? {\n guardrails: {\n inputValidationRules: {\n allowList:\n copilotConfig.cloud.guardrails.input.restrictToTopic.validTopics,\n denyList:\n copilotConfig.cloud.guardrails.input.restrictToTopic.invalidTopics,\n },\n },\n }\n : {}),\n },\n }\n : {}),\n metadata: {\n requestType: CopilotRequestType.Chat,\n },\n ...(agentSessionRef.current\n ? {\n agentSession: agentSessionRef.current,\n }\n : {}),\n agentStates: Object.values(coagentStatesRef.current!).map((state) => {\n const stateObject: AgentStateInput = {\n agentName: state.name,\n state: JSON.stringify(state.state),\n };\n\n if (state.config !== undefined) {\n stateObject.config = JSON.stringify(state.config);\n }\n\n return stateObject;\n }),\n forwardedParameters: options.forwardedParameters || {},\n },\n properties: finalProperties,\n signal: chatAbortControllerRef.current?.signal,\n }),\n );\n\n const guardrailsEnabled =\n copilotConfig.cloud?.guardrails?.input?.restrictToTopic.enabled || false;\n\n const reader = stream.getReader();\n\n let executedCoAgentStateRenders: string[] = [];\n let followUp: FrontendAction[\"followUp\"] = undefined;\n\n let messages: Message[] = [];\n let syncedMessages: Message[] = [];\n let interruptMessages: Message[] = [];\n\n try {\n while (true) {\n let done, value;\n\n try {\n const readResult = await reader.read();\n done = readResult.done;\n value = readResult.value;\n } catch (readError) {\n break;\n }\n\n if (done) {\n if (chatAbortControllerRef.current.signal.aborted) {\n return [];\n }\n break;\n }\n\n if (!value?.generateCopilotResponse) {\n continue;\n }\n\n runIdRef.current = value.generateCopilotResponse.runId || null;\n\n // in the output, graphql inserts __typename, which leads to an error when sending it along\n // as input to the next request.\n extensionsRef.current = CopilotRuntimeClient.removeGraphQLTypename(\n value.generateCopilotResponse.extensions || {},\n );\n\n // setThreadId(threadIdRef.current);\n setRunId(runIdRef.current);\n setExtensions(extensionsRef.current);\n let rawMessagesResponse = value.generateCopilotResponse.messages;\n\n const metaEvents: MetaEvent[] | undefined =\n value.generateCopilotResponse?.metaEvents ?? [];\n (metaEvents ?? []).forEach((ev) => {\n if (ev.name === MetaEventName.LangGraphInterruptEvent) {\n let eventValue = langGraphInterruptEvent(ev as LangGraphInterruptEvent).value;\n eventValue = parseJson(eventValue, eventValue);\n setLangGraphInterruptAction({\n event: {\n ...langGraphInterruptEvent(ev as LangGraphInterruptEvent),\n value: eventValue,\n },\n });\n }\n if (ev.name === MetaEventName.CopilotKitLangGraphInterruptEvent) {\n const data = (ev as CopilotKitLangGraphInterruptEvent).data;\n\n // @ts-expect-error -- same type of messages\n rawMessagesResponse = [...rawMessagesResponse, ...data.messages];\n interruptMessages = convertGqlOutputToMessages(\n // @ts-ignore\n filterAdjacentAgentStateMessages(data.messages),\n );\n }\n });\n\n messages = convertGqlOutputToMessages(\n filterAdjacentAgentStateMessages(rawMessagesResponse),\n );\n\n newMessages = [];\n\n // Handle error statuses BEFORE checking if there are messages\n // (errors can come in chunks with no messages)\n\n // request failed, display error message and quit\n if (\n value.generateCopilotResponse.status?.__typename === \"FailedResponseStatus\" &&\n value.generateCopilotResponse.status.reason === \"GUARDRAILS_VALIDATION_FAILED\"\n ) {\n const guardrailsReason =\n value.generateCopilotResponse.status.details?.guardrailsReason || \"\";\n\n newMessages = [\n new TextMessage({\n role: MessageRole.Assistant,\n content: guardrailsReason,\n }),\n ];\n\n // Trace guardrails validation failure\n const guardrailsError = new CopilotKitError({\n message: `Guardrails validation failed: ${guardrailsReason}`,\n code: CopilotKitErrorCode.MISUSE,\n });\n await traceUIError(guardrailsError, {\n statusReason: value.generateCopilotResponse.status.reason,\n statusDetails: value.generateCopilotResponse.status.details,\n });\n\n setMessages([...previousMessages, ...newMessages]);\n break;\n }\n\n // Handle UNKNOWN_ERROR failures (like authentication errors) by routing to banner error system\n if (\n value.generateCopilotResponse.status?.__typename === \"FailedResponseStatus\" &&\n value.generateCopilotResponse.status.reason === \"UNKNOWN_ERROR\"\n ) {\n const errorMessage =\n value.generateCopilotResponse.status.details?.description ||\n \"An unknown error occurred\";\n\n // Try to extract original error information from the response details\n const statusDetails = value.generateCopilotResponse.status.details;\n const originalError = statusDetails?.originalError || statusDetails?.error;\n\n // Extract structured error information if available (prioritize top-level over extensions)\n const originalCode = originalError?.code || originalError?.extensions?.code;\n const originalSeverity = originalError?.severity || originalError?.extensions?.severity;\n const originalVisibility =\n originalError?.visibility || originalError?.extensions?.visibility;\n\n // Use the original error code if available, otherwise default to NETWORK_ERROR\n let errorCode = CopilotKitErrorCode.NETWORK_ERROR;\n if (originalCode && Object.values(CopilotKitErrorCode).includes(originalCode)) {\n errorCode = originalCode;\n }\n\n // Create a structured CopilotKitError preserving original error information\n const structuredError = new CopilotKitError({\n message: errorMessage,\n code: errorCode,\n severity: originalSeverity,\n visibility: originalVisibility,\n });\n\n // Display the error in the banner\n setBannerError(structuredError);\n\n // Trace the error for debugging/observability\n await traceUIError(structuredError, {\n statusReason: value.generateCopilotResponse.status.reason,\n statusDetails: value.generateCopilotResponse.status.details,\n originalErrorCode: originalCode,\n preservedStructure: !!originalCode,\n });\n\n // Stop processing and break from the loop\n setIsLoading(false);\n break;\n }\n\n // add messages to the chat\n else if (messages.length > 0) {\n newMessages = [...messages];\n\n for (const message of messages) {\n // execute onCoAgentStateRender handler\n if (\n message.isAgentStateMessage() &&\n !message.active &&\n !executedCoAgentStateRenders.includes(message.id) &&\n onCoAgentStateRender\n ) {\n // Do not execute a coagent action if guardrails are enabled but the status is not known\n if (guardrailsEnabled && value.generateCopilotResponse.status === undefined) {\n break;\n }\n // execute coagent action\n await onCoAgentStateRender({\n name: message.agentName,\n nodeName: message.nodeName,\n state: message.state,\n });\n executedCoAgentStateRenders.push(message.id);\n }\n }\n\n const lastAgentStateMessage = [...messages]\n .reverse()\n .find((message) => message.isAgentStateMessage());\n\n if (lastAgentStateMessage) {\n if (\n lastAgentStateMessage.state.messages &&\n lastAgentStateMessage.state.messages.length > 0\n ) {\n syncedMessages = loadMessagesFromJsonRepresentation(\n lastAgentStateMessage.state.messages,\n );\n }\n setCoagentStatesWithRef((prevAgentStates) => ({\n ...prevAgentStates,\n [lastAgentStateMessage.agentName]: {\n name: lastAgentStateMessage.agentName,\n state: lastAgentStateMessage.state,\n running: lastAgentStateMessage.running,\n active: lastAgentStateMessage.active,\n threadId: lastAgentStateMessage.threadId,\n nodeName: lastAgentStateMessage.nodeName,\n runId: lastAgentStateMessage.runId,\n // Preserve existing config from previous state\n config: prevAgentStates[lastAgentStateMessage.agentName]?.config,\n },\n }));\n if (lastAgentStateMessage.running) {\n setAgentSession({\n threadId: lastAgentStateMessage.threadId,\n agentName: lastAgentStateMessage.agentName,\n nodeName: lastAgentStateMessage.nodeName,\n });\n } else {\n if (agentLock) {\n setAgentSession({\n threadId: randomId(),\n agentName: agentLock,\n nodeName: undefined,\n });\n } else {\n setAgentSession(null);\n }\n }\n }\n }\n\n if (newMessages.length > 0) {\n // Update message state\n setMessages([...previousMessages, ...newMessages]);\n }\n }\n let finalMessages = constructFinalMessages(\n [...syncedMessages, ...interruptMessages],\n previousMessages,\n newMessages,\n );\n\n let didExecuteAction = false;\n\n // ----- Helper function to execute an action and manage its lifecycle -----\n const executeActionFromMessage = async (\n currentAction: FrontendAction<any>,\n actionMessage: ActionExecutionMessage,\n ) => {\n const isInterruptAction = interruptMessages.find((m) => m.id === actionMessage.id);\n // Determine follow-up behavior: use action's specific setting if defined, otherwise default based on interrupt status.\n followUp = currentAction?.followUp ?? !isInterruptAction;\n\n // Call _setActivatingMessageId before executing the action for HITL correlation\n if ((currentAction as any)?._setActivatingMessageId) {\n (currentAction as any)._setActivatingMessageId(actionMessage.id);\n }\n\n const resultMessage = await executeAction({\n onFunctionCall: onFunctionCall!,\n message: actionMessage,\n chatAbortControllerRef,\n onError: (error: Error) => {\n addErrorToast([error]);\n // console.error is kept here as it's a genuine error in action execution\n console.error(`Failed to execute action ${actionMessage.name}: ${error}`);\n },\n setMessages,\n getFinalMessages: () => finalMessages,\n isRenderAndWait: (currentAction as any)?._isRenderAndWait || false,\n });\n didExecuteAction = true;\n const messageIndex = finalMessages.findIndex((msg) => msg.id === actionMessage.id);\n finalMessages.splice(messageIndex + 1, 0, resultMessage);\n\n // If the executed action was a renderAndWaitForResponse type, update messages immediately\n // to reflect its completion in the UI, making it interactive promptly.\n if ((currentAction as any)?._isRenderAndWait) {\n const messagesForImmediateUpdate = [...finalMessages];\n flushSync(() => {\n setMessages(messagesForImmediateUpdate);\n });\n }\n\n // Clear _setActivatingMessageId after the action is done\n if ((currentAction as any)?._setActivatingMessageId) {\n (currentAction as any)._setActivatingMessageId(null);\n }\n\n return resultMessage;\n };\n // ----------------------------------------------------------------------\n\n // execute regular action executions that are specific to the frontend (last actions)\n if (onFunctionCall) {\n // Find consecutive action execution messages at the end\n const lastMessages = [];\n\n for (let i = finalMessages.length - 1; i >= 0; i--) {\n const message = finalMessages[i];\n if (\n (message.isActionExecutionMessage() || message.isResultMessage()) &&\n message.status.code !== MessageStatusCode.Pending\n ) {\n lastMessages.unshift(message);\n } else if (!message.isAgentStateMessage()) {\n break;\n }\n }\n\n for (const message of lastMessages) {\n // We update the message state before calling the handler so that the render\n // function can be called with `executing` state\n setMessages(finalMessages);\n\n const action = actions.find(\n (action) => action.name === (message as ActionExecutionMessage).name,\n );\n if (action && action.available === \"frontend\") {\n // never execute frontend actions\n continue;\n }\n const currentResultMessagePairedFeAction = message.isResultMessage()\n ? getPairedFeAction(actions, message)\n : null;\n\n // execution message which has an action registered with the hook (remote availability):\n // execute that action first, and then the \"paired FE action\"\n if (action && message.isActionExecutionMessage()) {\n // For HITL actions, check if they've already been processed to avoid redundant handler calls.\n const isRenderAndWaitAction = (action as any)?._isRenderAndWait || false;\n const alreadyProcessed =\n isRenderAndWaitAction &&\n finalMessages.some(\n (fm) => fm.isResultMessage() && fm.actionExecutionId === message.id,\n );\n\n if (alreadyProcessed) {\n // Skip re-execution if already processed\n } else {\n // Call the single, externally defined executeActionFromMessage\n const resultMessage = await executeActionFromMessage(\n action,\n message as ActionExecutionMessage,\n );\n const pairedFeAction = getPairedFeAction(actions, resultMessage);\n\n if (pairedFeAction) {\n const newExecutionMessage = new ActionExecutionMessage({\n name: pairedFeAction.name,\n arguments: parseJson(resultMessage.result, resultMessage.result),\n status: message.status,\n createdAt: message.createdAt,\n parentMessageId: message.parentMessageId,\n });\n // Call the single, externally defined executeActionFromMessage\n await executeActionFromMessage(pairedFeAction, newExecutionMessage);\n }\n }\n } else if (message.isResultMessage() && currentResultMessagePairedFeAction) {\n // Actions which are set up in runtime actions array: Grab the result, executed paired FE action with it as args.\n const newExecutionMessage = new ActionExecutionMessage({\n name: currentResultMessagePairedFeAction.name,\n arguments: parseJson(message.result, message.result),\n status: message.status,\n createdAt: message.createdAt,\n });\n finalMessages.push(newExecutionMessage);\n // Call the single, externally defined executeActionFromMessage\n await executeActionFromMessage(\n currentResultMessagePairedFeAction,\n newExecutionMessage,\n );\n }\n }\n\n setMessages(finalMessages);\n }\n\n // Conditionally run chat completion again if followUp is not explicitly false\n // and an action was executed or the last message is a server-side result (for non-agent runs).\n if (\n followUp !== false &&\n (didExecuteAction ||\n // the last message is a server side result\n (!isAgentRun &&\n finalMessages.length &&\n finalMessages[finalMessages.length - 1].isResultMessage())) &&\n // the user did not stop generation\n !chatAbortControllerRef.current?.signal.aborted\n ) {\n // run the completion again and return the result\n\n // wait for next tick to make sure all the react state updates\n // - tried using react-dom's flushSync, but it did not work\n await new Promise((resolve) => setTimeout(resolve, 10));\n\n return await runChatCompletionRef.current!(finalMessages);\n } else if (chatAbortControllerRef.current?.signal.aborted) {\n // filter out all the action execution messages that do not have a consecutive matching result message\n const repairedMessages = finalMessages.filter((message, actionExecutionIndex) => {\n if (message.isActionExecutionMessage()) {\n return finalMessages.find(\n (msg, resultIndex) =>\n msg.isResultMessage() &&\n msg.actionExecutionId === message.id &&\n resultIndex === actionExecutionIndex + 1,\n );\n }\n return true;\n });\n const repairedMessageIds = repairedMessages.map((message) => message.id);\n setMessages(repairedMessages);\n\n // LangGraph needs two pieces of information to continue execution:\n // 1. The threadId\n // 2. The nodeName it came from\n // When stopping the agent, we don't know the nodeName the agent would have ended with\n // Therefore, we set the nodeName to the most reasonable thing we can guess, which\n // is \"__end__\"\n if (agentSessionRef.current?.nodeName) {\n setAgentSession({\n threadId: agentSessionRef.current.threadId,\n agentName: agentSessionRef.current.agentName,\n nodeName: \"__end__\",\n });\n }\n // only return new messages that were not filtered out\n return newMessages.filter((message) => repairedMessageIds.includes(message.id));\n } else {\n return newMessages.slice();\n }\n } finally {\n setIsLoading(false);\n }\n },\n [\n messages,\n setMessages,\n makeSystemMessageCallback,\n copilotConfig,\n setIsLoading,\n initialMessages,\n isLoading,\n actions,\n onFunctionCall,\n onCoAgentStateRender,\n setCoagentStatesWithRef,\n coagentStatesRef,\n agentSession,\n setAgentSession,\n ],\n );\n\n runChatCompletionRef.current = runChatCompletion;\n\n const runChatCompletionAndHandleFunctionCall = useAsyncCallback(\n async (messages: Message[]): Promise<void> => {\n await runChatCompletionRef.current!(messages);\n },\n [messages],\n );\n\n useEffect(() => {\n if (!isLoading && pendingAppendsRef.current.length > 0) {\n const pending = pendingAppendsRef.current.splice(0);\n const followUp = pending.some((p) => p.followUp);\n const newMessages = [...messages, ...pending.map((p) => p.message)];\n setMessages(newMessages);\n if (followUp) {\n runChatCompletionAndHandleFunctionCall(newMessages);\n }\n }\n }, [isLoading, messages, setMessages, runChatCompletionAndHandleFunctionCall]);\n\n // Go over all events and see that they include data that should be returned to the agent\n const composeAndFlushMetaEventsInput = useCallback(\n (metaEvents: (MetaEvent | undefined | null)[]) => {\n return metaEvents.reduce((acc: MetaEventInput[], event) => {\n if (!event) return acc;\n\n switch (event.name) {\n case MetaEventName.LangGraphInterruptEvent:\n if (event.response) {\n // Flush interrupt event from state\n setLangGraphInterruptAction(null);\n const value = (event as LangGraphInterruptEvent).value;\n return [\n ...acc,\n {\n name: event.name,\n value: typeof value === \"string\" ? value : JSON.stringify(value),\n response:\n typeof event.response === \"string\"\n ? event.response\n : JSON.stringify(event.response),\n },\n ];\n }\n return acc;\n default:\n return acc;\n }\n }, []);\n },\n [setLangGraphInterruptAction],\n );\n\n const append = useAsyncCallback(\n async (message: Message, options?: AppendMessageOptions): Promise<void> => {\n const followUp = options?.followUp ?? true;\n if (isLoading) {\n pendingAppendsRef.current.push({ message, followUp });\n return;\n }\n\n const newMessages = [...messages, message];\n setMessages(newMessages);\n if (followUp) {\n return runChatCompletionAndHandleFunctionCall(newMessages);\n }\n },\n [isLoading, messages, setMessages, runChatCompletionAndHandleFunctionCall],\n );\n\n const reload = useAsyncCallback(\n async (reloadMessageId: string): Promise<void> => {\n if (isLoading || messages.length === 0) {\n return;\n }\n\n const reloadMessageIndex = messages.findIndex((msg) => msg.id === reloadMessageId);\n if (reloadMessageIndex === -1) {\n console.warn(`Message with id ${reloadMessageId} not found`);\n return;\n }\n\n // @ts-expect-error -- message has role\n const reloadMessageRole = messages[reloadMessageIndex].role;\n if (reloadMessageRole !== MessageRole.Assistant) {\n console.warn(`Regenerate cannot be performed on ${reloadMessageRole} role`);\n return;\n }\n\n let historyCutoff: Message[] = [];\n if (messages.length > 2) {\n // message to regenerate from is now first.\n // Work backwards to find the first the closest user message\n const lastUserMessageBeforeRegenerate = messages\n .slice(0, reloadMessageIndex)\n .reverse()\n .find(\n (msg) =>\n // @ts-expect-error -- message has role\n msg.role === MessageRole.User,\n );\n const indexOfLastUserMessageBeforeRegenerate = messages.findIndex(\n (msg) => msg.id === lastUserMessageBeforeRegenerate!.id,\n );\n\n // Include the user message, remove everything after it\n historyCutoff = messages.slice(0, indexOfLastUserMessageBeforeRegenerate + 1);\n }\n\n setMessages(historyCutoff);\n\n return runChatCompletionAndHandleFunctionCall(historyCutoff);\n },\n [isLoading, messages, setMessages, runChatCompletionAndHandleFunctionCall],\n );\n\n const stop = (): void => {\n chatAbortControllerRef.current?.abort(\"Stop was called\");\n };\n\n return {\n append,\n reload,\n stop,\n runChatCompletion: () => runChatCompletionRef.current!(messages),\n };\n}\n\nfunction constructFinalMessages(\n syncedMessages: Message[],\n previousMessages: Message[],\n newMessages: Message[],\n): Message[] {\n const finalMessages =\n syncedMessages.length > 0 ? [...syncedMessages] : [...previousMessages, ...newMessages];\n\n if (syncedMessages.length > 0) {\n const messagesWithAgentState = [...previousMessages, ...newMessages];\n\n let previousMessageId: string | undefined = undefined;\n\n for (const message of messagesWithAgentState) {\n if (message.isAgentStateMessage()) {\n // insert this message into finalMessages after the position of previousMessageId\n const index = finalMessages.findIndex((msg) => msg.id === previousMessageId);\n if (index !== -1) {\n finalMessages.splice(index + 1, 0, message);\n }\n }\n\n previousMessageId = message.id;\n }\n }\n\n return finalMessages;\n}\n\nasync function executeAction({\n onFunctionCall,\n message,\n chatAbortControllerRef,\n onError,\n setMessages,\n getFinalMessages,\n isRenderAndWait,\n}: {\n onFunctionCall: FunctionCallHandler;\n message: ActionExecutionMessage;\n chatAbortControllerRef: React.MutableRefObject<AbortController | null>;\n onError: (error: Error) => void;\n setMessages: React.Dispatch<React.SetStateAction<Message[]>>;\n getFinalMessages: () => Message[];\n isRenderAndWait: boolean;\n}) {\n let result: any;\n let error: Error | null = null;\n\n const currentMessagesForHandler = getFinalMessages();\n\n // The handler (onFunctionCall) runs its synchronous part here, potentially setting up\n // renderAndWaitRef.current for HITL actions via useCopilotAction's transformed handler.\n const handlerReturnedPromise = onFunctionCall({\n messages: currentMessagesForHandler,\n name: message.name,\n args: message.arguments,\n });\n\n // For HITL actions, call flushSync immediately after their handler has set up the promise\n // and before awaiting the promise. This ensures the UI updates to an interactive state.\n if (isRenderAndWait) {\n const currentMessagesForRender = getFinalMessages();\n flushSync(() => {\n setMessages([...currentMessagesForRender]);\n });\n }\n\n try {\n result = await Promise.race([\n handlerReturnedPromise, // Await the promise returned by the handler\n new Promise((resolve) =>\n chatAbortControllerRef.current?.signal.addEventListener(\"abort\", () =>\n resolve(\"Operation was aborted by the user\"),\n ),\n ),\n // if the user stopped generation, we also abort consecutive actions\n new Promise((resolve) => {\n if (chatAbortControllerRef.current?.signal.aborted) {\n resolve(\"Operation was aborted by the user\");\n }\n }),\n ]);\n } catch (e) {\n onError(e as Error);\n }\n return new ResultMessage({\n id: \"result-\" + message.id,\n result: ResultMessage.encodeResult(\n error\n ? {\n content: result,\n error: JSON.parse(JSON.stringify(error, Object.getOwnPropertyNames(error))),\n }\n : result,\n ),\n actionExecutionId: message.id,\n actionName: message.name,\n });\n}\n\nfunction getPairedFeAction(\n actions: FrontendAction<any>[],\n message: ActionExecutionMessage | ResultMessage,\n) {\n let actionName = null;\n if (message.isActionExecutionMessage()) {\n actionName = message.name;\n } else if (message.isResultMessage()) {\n actionName = message.actionName;\n }\n return actions.find(\n (action) =>\n (action.name === actionName && action.available === \"frontend\") ||\n action.pairedAction === actionName,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAgB,aAAa,WAAW,cAAc;AACtD,SAAS,iBAAiB;AAC1B;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EAEA;AAAA,E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,CAAU;AAAA,IACpB;AACA,WAAO,IAAI,cAAc;AAAA,MACvB,IAAI,YAAY,QAAQ;AAAA,MACxB,QAAQ,cAAc;AAAA,QACpB,QACI;AAAA,UACE,SAAS;AAAA,UACT,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC;AAAA,QAC5E,IACA;AAAA,MACN;AAAA,MACA,mBAAmB,QAAQ;AAAA,MAC3B,YAAY,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH;AAAA;AAEA,SAAS,kBACP,SACA,SACA;AACA,MAAI,aAAa;AACjB,MAAI,QAAQ,yBAAyB,GAAG;AACtC,iBAAa,QAAQ;AAAA,EACvB,WAAW,QAAQ,gBAAgB,GAAG;AACpC,iBAAa,QAAQ;AAAA,EACvB;AACA,SAAO,QAAQ;AAAA,IACb,CAAC,WACE,OAAO,SAAS,cAAc,OAAO,cAAc,cACpD,OAAO,iBAAiB;AAAA,EAC5B;AACF;","names":["messages","_a","action","options"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/dev-console/developer-console-modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCopilotContext } from \"../../context/copilot-context\";\nimport { useCopilotMessagesContext } from \"../../context/copilot-messages-context\";\nimport { COPILOTKIT_VERSION } from \"@copilotkit/shared\";\nimport { useEffect, useState } from \"react\";\nimport { CheckIcon, CopilotKitIcon, ExclamationMarkTriangleIcon } from \"./icons\";\n\n// Type definitions for the developer console\ninterface ActionParameter {\n name: string;\n required?: boolean;\n type?: string;\n}\n\ninterface Action {\n name: string;\n description?: string;\n parameters?: ActionParameter[];\n status?: string;\n}\n\ninterface Readable {\n name?: string;\n description?: string;\n value?: any;\n content?: string;\n metadata?: Record<string, any>;\n}\n\ninterface AgentState {\n status?: string;\n state?: any;\n running?: boolean;\n lastUpdate?: number;\n}\n\ninterface Message {\n id?: string;\n role?: \"user\" | \"assistant\" | \"system\";\n content?: string;\n timestamp?: number;\n [key: string]: any; // Allow additional properties from CopilotKit\n}\n\ninterface Document {\n name?: string;\n content?: string;\n metadata?: Record<string, any>;\n}\n\ninterface DisplayContext {\n actions: Record<string, Action>;\n getAllContext: () => Readable[];\n coagentStates: Record<string, AgentState>;\n getDocumentsContext: (args?: any[]) => Document[];\n}\n\ninterface MessagesContext {\n messages: Message[];\n}\n\ninterface DeveloperConsoleModalProps {\n isOpen: boolean;\n onClose: () => void;\n hasApiKey: boolean;\n}\n\nexport function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperConsoleModalProps) {\n const context = useCopilotContext();\n const messagesContext = useCopilotMessagesContext();\n const [activeTab, setActiveTab] = useState(\"actions\");\n\n // Handle escape key\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n onClose();\n }\n };\n\n if (isOpen) {\n document.addEventListener(\"keydown\", handleEscape);\n document.body.style.overflow = \"hidden\";\n }\n\n return () => {\n document.removeEventListener(\"keydown\", handleEscape);\n document.body.style.overflow = \"unset\";\n };\n }, [isOpen, onClose]);\n\n if (!isOpen) return null;\n\n // Create mock data for preview when no API key\n const displayContext: DisplayContext = hasApiKey\n ? (context as DisplayContext)\n : {\n actions: {\n search_web: { name: \"search_web\", description: \"Search the web for information\" },\n send_email: { name: \"send_email\", description: \"Send an email to a contact\" },\n create_document: { name: \"create_document\", description: \"Create a new document\" },\n analyze_code: {\n name: \"analyze_code\",\n description: \"Analyze code for issues and improvements\",\n },\n generate_tests: {\n name: \"generate_tests\",\n description: \"Generate unit tests for functions\",\n },\n },\n getAllContext: () => [\n {\n content: \"User preferences: dark mode enabled, TypeScript preferred\",\n metadata: { source: \"settings\" },\n },\n {\n content: \"Current project: Building a React application with CopilotKit\",\n metadata: { source: \"project\" },\n },\n {\n content: \"Recent activity: Implemented authentication system\",\n metadata: { source: \"activity\" },\n },\n {\n content: \"Development environment: VS Code, Node.js 18, React 18\",\n metadata: { source: \"environment\" },\n },\n ],\n coagentStates: {\n \"main-agent\": { status: \"active\", lastUpdate: Date.now() },\n \"code-assistant\": { status: \"active\", lastUpdate: Date.now() - 15000 },\n \"search-agent\": { status: \"idle\", lastUpdate: Date.now() - 60000 },\n },\n getDocumentsContext: () => [\n {\n content: \"README.md: Project setup and installation instructions\",\n metadata: { type: \"documentation\" },\n },\n {\n content: \"API Documentation: CopilotKit integration guide\",\n metadata: { type: \"documentation\" },\n },\n {\n content: \"package.json: Project dependencies and scripts\",\n metadata: { type: \"configuration\" },\n },\n ],\n };\n\n const displayMessagesContext: MessagesContext = hasApiKey\n ? (messagesContext as MessagesContext)\n : {\n messages: [\n {\n id: \"1\",\n role: \"user\",\n content: \"Help me implement a todo list with drag and drop functionality\",\n },\n {\n id: \"2\",\n role: \"assistant\",\n content:\n \"I'll help you create a todo list with drag and drop. Let me start by setting up the basic components and then add the drag and drop functionality using React DnD.\",\n },\n { id: \"3\", role: \"user\", content: \"Can you also add priority levels and due dates?\" },\n {\n id: \"4\",\n role: \"assistant\",\n content:\n \"Absolutely! I'll enhance the todo items with priority levels (high, medium, low) and due date functionality. This will make your todo list much more powerful for task management.\",\n },\n { id: \"5\", role: \"user\", content: \"Perfect! How about adding categories or tags?\" },\n ],\n };\n\n return (\n <div\n style={{\n position: \"fixed\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 9999,\n backgroundColor: \"rgba(0, 0, 0, 0.3)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"16px\",\n }}\n onClick={onClose}\n >\n <div\n style={{\n width: \"1152px\",\n maxWidth: \"95vw\",\n height: \"80vh\",\n backgroundColor: \"white\",\n borderRadius: \"12px\",\n boxShadow: \"0 25px 50px -12px rgba(0, 0, 0, 0.25)\",\n display: \"flex\",\n flexDirection: \"column\",\n overflow: \"hidden\",\n position: \"relative\",\n }}\n onClick={(e) => e.stopPropagation()}\n >\n {/* Header */}\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n padding: \"24px\",\n borderBottom: \"1px solid #e5e7eb\",\n minHeight: \"73px\",\n flexShrink: 0,\n filter: !hasApiKey ? \"blur(0.3px)\" : \"none\",\n opacity: !hasApiKey ? 0.95 : 1,\n }}\n >\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"12px\" }}>\n <CopilotKitIcon />\n <h1\n style={{\n fontWeight: \"bold\",\n fontSize: \"20px\",\n color: \"#1f2937\",\n margin: 0,\n }}\n >\n Developer Console\n </h1>\n <span\n style={{\n fontSize: \"14px\",\n color: \"#6b7280\",\n backgroundColor: \"#f3f4f6\",\n padding: \"4px 8px\",\n borderRadius: \"4px\",\n }}\n >\n v{COPILOTKIT_VERSION}\n </span>\n </div>\n <button\n onClick={onClose}\n style={{\n color: \"#9ca3af\",\n fontSize: \"24px\",\n fontWeight: \"300\",\n border: \"none\",\n background: \"none\",\n cursor: \"pointer\",\n padding: \"4px\",\n }}\n onMouseEnter={(e) => (e.currentTarget.style.color = \"#4b5563\")}\n onMouseLeave={(e) => (e.currentTarget.style.color = \"#9ca3af\")}\n >\n ×\n </button>\n </div>\n\n {/* Tab Navigation */}\n <div\n style={{\n display: \"flex\",\n borderBottom: \"1px solid #e5e7eb\",\n backgroundColor: \"#f9fafb\",\n minHeight: \"50px\",\n flexShrink: 0,\n filter: !hasApiKey ? \"blur(0.3px)\" : \"none\",\n opacity: !hasApiKey ? 0.9 : 1,\n }}\n >\n {[\n { id: \"actions\", label: \"Actions\", count: Object.keys(displayContext.actions).length },\n { id: \"readables\", label: \"Readables\", count: displayContext.getAllContext().length },\n {\n id: \"agent\",\n label: \"Agent Status\",\n count: Object.keys(displayContext.coagentStates).length,\n },\n { id: \"messages\", label: \"Messages\", count: displayMessagesContext.messages.length },\n {\n id: \"context\",\n label: \"Context\",\n count: displayContext.getDocumentsContext([]).length,\n },\n ].map((tab) => (\n <button\n key={tab.id}\n onClick={() => setActiveTab(tab.id)}\n style={{\n padding: \"12px 24px\",\n fontSize: \"14px\",\n fontWeight: \"500\",\n border: \"none\",\n cursor: \"pointer\",\n backgroundColor: activeTab === tab.id ? \"white\" : \"transparent\",\n color: activeTab === tab.id ? \"#2563eb\" : \"#6b7280\",\n borderBottom: activeTab === tab.id ? \"2px solid #2563eb\" : \"none\",\n transition: \"all 0.2s\",\n }}\n onMouseEnter={(e) => {\n if (activeTab !== tab.id) {\n e.currentTarget.style.color = \"#1f2937\";\n e.currentTarget.style.backgroundColor = \"#f3f4f6\";\n }\n }}\n onMouseLeave={(e) => {\n if (activeTab !== tab.id) {\n e.currentTarget.style.color = \"#6b7280\";\n e.currentTarget.style.backgroundColor = \"transparent\";\n }\n }}\n >\n {tab.label}\n {tab.count > 0 && (\n <span\n style={{\n marginLeft: \"8px\",\n backgroundColor: \"#e5e7eb\",\n color: \"#374151\",\n padding: \"2px 8px\",\n borderRadius: \"9999px\",\n fontSize: \"12px\",\n }}\n >\n {tab.count}\n </span>\n )}\n </button>\n ))}\n </div>\n\n {/* Content */}\n <div\n style={{\n height: \"calc(100% - 142px)\",\n overflow: \"auto\",\n padding: \"24px\",\n backgroundColor: \"#f9fafb\",\n filter: !hasApiKey ? \"blur(0.3px)\" : \"none\",\n opacity: !hasApiKey ? 0.85 : 1,\n }}\n >\n {activeTab === \"actions\" && <ActionsTab context={displayContext} />}\n {activeTab === \"readables\" && <ReadablesTab context={displayContext} />}\n {activeTab === \"agent\" && <AgentStatusTab context={displayContext} />}\n {activeTab === \"messages\" && <MessagesTab messagesContext={displayMessagesContext} />}\n {activeTab === \"context\" && <ContextTab context={displayContext} />}\n </div>\n\n {/* Footer */}\n <div\n style={{\n padding: \"16px 24px\",\n borderTop: \"1px solid #e5e7eb\",\n backgroundColor: \"white\",\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n minHeight: \"57px\",\n flexShrink: 0,\n filter: !hasApiKey ? \"blur(0.3px)\" : \"none\",\n opacity: !hasApiKey ? 0.9 : 1,\n }}\n >\n <div style={{ fontSize: \"14px\", color: \"#6b7280\" }}>\n <a\n href=\"https://github.com/CopilotKit/CopilotKit/issues\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={{ color: \"#2563eb\", textDecoration: \"none\" }}\n onMouseEnter={(e) => (e.currentTarget.style.textDecoration = \"underline\")}\n onMouseLeave={(e) => (e.currentTarget.style.textDecoration = \"none\")}\n >\n Report an issue\n </a>\n </div>\n <div style={{ fontSize: \"14px\", color: \"#6b7280\" }}>\n <a\n href=\"https://mcp.copilotkit.ai/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={{ color: \"#2563eb\", textDecoration: \"none\" }}\n onMouseEnter={(e) => (e.currentTarget.style.textDecoration = \"underline\")}\n onMouseLeave={(e) => (e.currentTarget.style.textDecoration = \"none\")}\n >\n Add MCP Server →\n </a>\n </div>\n </div>\n\n {/* Enhanced CTA Overlay */}\n {!hasApiKey && (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: \"rgba(255, 255, 255, 0.2)\",\n backdropFilter: \"blur(2px)\",\n WebkitBackdropFilter: \"blur(2px)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: \"12px\",\n zIndex: 10,\n }}\n onClick={(e) => e.stopPropagation()}\n >\n <button\n onClick={() => window.open(\"https://cloud.copilotkit.ai/sign-in\", \"_blank\")}\n style={{\n // Following button system specifications\n height: \"48px\",\n padding: \"12px 24px\",\n backgroundColor: \"#030507\", // textPrimary token\n color: \"#FFFFFF\",\n borderRadius: \"12px\", // Medium radius token\n border: \"none\",\n cursor: \"pointer\",\n fontSize: \"14px\", // Medium Semi Bold typography\n fontWeight: \"600\",\n fontFamily: \"'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif\",\n lineHeight: \"22px\",\n boxShadow: \"0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)\",\n transition: \"all 200ms ease\", // 200ms ease as per specs\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"8px\",\n textTransform: \"uppercase\",\n letterSpacing: \"0.5px\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = \"#575758\"; // textSecondary token for hover\n e.currentTarget.style.transform = \"translateY(-1px)\";\n e.currentTarget.style.boxShadow =\n \"0 6px 20px rgba(3, 5, 7, 0.25), 0 2px 4px rgba(3, 5, 7, 0.15)\";\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = \"#030507\";\n e.currentTarget.style.transform = \"translateY(0)\";\n e.currentTarget.style.boxShadow =\n \"0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)\";\n }}\n onMouseDown={(e) => {\n e.currentTarget.style.backgroundColor = \"#858589\"; // textDisabled token for pressed\n e.currentTarget.style.transform = \"translateY(0)\";\n }}\n onMouseUp={(e) => {\n e.currentTarget.style.backgroundColor = \"#575758\";\n e.currentTarget.style.transform = \"translateY(-1px)\";\n }}\n onFocus={(e) => {\n e.currentTarget.style.outline = \"2px solid #BEC9FF\";\n e.currentTarget.style.outlineOffset = \"2px\";\n }}\n onBlur={(e) => {\n e.currentTarget.style.outline = \"none\";\n }}\n >\n Get API Key\n <span style={{ fontSize: \"16px\", marginLeft: \"-4px\" }}>→</span>\n </button>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n// Tab Components\nfunction ActionsTab({ context }: { context: DisplayContext }) {\n const actions = Object.values(context.actions);\n\n if (actions.length === 0) {\n return (\n <div style={{ textAlign: \"center\", padding: \"48px 0\", color: \"#6b7280\" }}>\n <p style={{ fontSize: \"18px\", margin: \"0 0 8px 0\" }}>No actions available</p>\n <p style={{ fontSize: \"14px\", margin: 0 }}>Actions will appear here when registered</p>\n </div>\n );\n }\n\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"16px\" }}>\n {actions.map((action: Action, index: number) => (\n <div\n key={index}\n style={{\n backgroundColor: \"white\",\n padding: \"16px\",\n borderRadius: \"8px\",\n boxShadow: \"0 1px 3px 0 rgba(0, 0, 0, 0.1)\",\n border: \"1px solid #e5e7eb\",\n }}\n >\n <div\n style={{ display: \"flex\", alignItems: \"flex-start\", justifyContent: \"space-between\" }}\n >\n <div style={{ flex: 1 }}>\n <h3 style={{ fontWeight: \"600\", color: \"#1f2937\", margin: \"0 0 4px 0\" }}>\n {action.name}\n </h3>\n {action.description && (\n <p style={{ fontSize: \"14px\", color: \"#4b5563\", margin: \"0 0 12px 0\" }}>\n {action.description}\n </p>\n )}\n {action.parameters && action.parameters.length > 0 && (\n <div style={{ marginTop: \"12px\" }}>\n <p\n style={{\n fontSize: \"12px\",\n fontWeight: \"500\",\n color: \"#6b7280\",\n textTransform: \"uppercase\",\n margin: \"0 0 4px 0\",\n }}\n >\n Parameters:\n </p>\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"4px\" }}>\n {action.parameters.map((param: ActionParameter, pIndex: number) => (\n <div key={pIndex} style={{ fontSize: \"14px\" }}>\n <span style={{ fontFamily: \"monospace\", color: \"#374151\" }}>\n {param.name}\n </span>\n {param.required && (\n <span style={{ marginLeft: \"4px\", fontSize: \"12px\", color: \"#ef4444\" }}>\n *required\n </span>\n )}\n {param.type && (\n <span style={{ marginLeft: \"8px\", fontSize: \"12px\", color: \"#6b7280\" }}>\n ({param.type})\n </span>\n )}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n <div style={{ marginLeft: \"16px\" }}>\n {action.status === \"available\" ? <CheckIcon /> : <ExclamationMarkTriangleIcon />}\n </div>\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction ReadablesTab({ context }: { context: DisplayContext }) {\n const readables = context.getAllContext();\n\n if (readables.length === 0) {\n return (\n <div style={{ textAlign: \"center\", padding: \"48px 0\", color: \"#6b7280\" }}>\n <p style={{ fontSize: \"18px\", margin: \"0 0 8px 0\" }}>No readable context available</p>\n <p style={{ fontSize: \"14px\", margin: 0 }}>\n Readable context will appear here when provided\n </p>\n </div>\n );\n }\n\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"16px\" }}>\n {readables.map((readable: Readable, index: number) => (\n <div\n key={index}\n style={{\n backgroundColor: \"white\",\n padding: \"16px\",\n borderRadius: \"8px\",\n boxShadow: \"0 1px 3px 0 rgba(0, 0, 0, 0.1)\",\n border: \"1px solid #e5e7eb\",\n }}\n >\n <div\n style={{ display: \"flex\", alignItems: \"flex-start\", justifyContent: \"space-between\" }}\n >\n <div style={{ flex: 1 }}>\n <h3 style={{ fontWeight: \"600\", color: \"#1f2937\", margin: \"0 0 4px 0\" }}>\n {readable.name || `Readable ${index + 1}`}\n </h3>\n {readable.description && (\n <p style={{ fontSize: \"14px\", color: \"#4b5563\", margin: \"0 0 12px 0\" }}>\n {readable.description}\n </p>\n )}\n {readable.value && (\n <pre\n style={{\n marginTop: \"12px\",\n padding: \"8px\",\n backgroundColor: \"#f9fafb\",\n borderRadius: \"4px\",\n fontSize: \"12px\",\n overflowX: \"auto\",\n margin: \"12px 0 0 0\",\n }}\n >\n {JSON.stringify(readable.value, null, 2)}\n </pre>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction AgentStatusTab({ context }: { context: DisplayContext }) {\n const agentStates = context.coagentStates || {};\n const agentStateEntries = Object.entries(agentStates);\n\n if (agentStateEntries.length === 0) {\n return (\n <div style={{ textAlign: \"center\", padding: \"48px 0\", color: \"#6b7280\" }}>\n <p style={{ fontSize: \"18px\", margin: \"0 0 8px 0\" }}>No agent states available</p>\n <p style={{ fontSize: \"14px\", margin: 0 }}>\n Agent states will appear here when agents are active\n </p>\n </div>\n );\n }\n\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"24px\" }}>\n {agentStateEntries.map(([agentName, state]: [string, AgentState]) => (\n <div\n key={agentName}\n style={{\n backgroundColor: \"white\",\n padding: \"24px\",\n borderRadius: \"8px\",\n boxShadow: \"0 1px 3px 0 rgba(0, 0, 0, 0.1)\",\n border: \"1px solid #e5e7eb\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n marginBottom: \"16px\",\n }}\n >\n <h3 style={{ fontWeight: \"600\", fontSize: \"18px\", color: \"#1f2937\", margin: 0 }}>\n {agentName}\n </h3>\n <span\n style={{\n padding: \"4px 12px\",\n borderRadius: \"9999px\",\n fontSize: \"12px\",\n fontWeight: \"500\",\n backgroundColor:\n state.status === \"running\"\n ? \"#dcfce7\"\n : state.status === \"complete\"\n ? \"#dbeafe\"\n : \"#f3f4f6\",\n color:\n state.status === \"running\"\n ? \"#166534\"\n : state.status === \"complete\"\n ? \"#1e40af\"\n : \"#1f2937\",\n }}\n >\n {state.status || \"idle\"}\n </span>\n </div>\n\n {state.state && (\n <div style={{ marginBottom: \"12px\" }}>\n <p\n style={{\n fontSize: \"12px\",\n fontWeight: \"500\",\n color: \"#6b7280\",\n textTransform: \"uppercase\",\n margin: \"0 0 4px 0\",\n }}\n >\n Current State:\n </p>\n <pre\n style={{\n padding: \"12px\",\n backgroundColor: \"#f9fafb\",\n borderRadius: \"4px\",\n fontSize: \"12px\",\n overflowX: \"auto\",\n margin: 0,\n }}\n >\n {JSON.stringify(state.state, null, 2)}\n </pre>\n </div>\n )}\n\n {state.running && (\n <div\n style={{\n marginTop: \"16px\",\n display: \"flex\",\n alignItems: \"center\",\n fontSize: \"14px\",\n color: \"#4b5563\",\n }}\n >\n <div style={{ marginRight: \"8px\" }}>\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n style={{ animation: \"spin 1s linear infinite\" }}\n >\n <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>\n <circle\n cx=\"8\"\n cy=\"8\"\n r=\"6\"\n fill=\"none\"\n stroke=\"#4b5563\"\n strokeWidth=\"2\"\n strokeDasharray=\"9 3\"\n />\n </svg>\n </div>\n <span>Agent is currently running...</span>\n </div>\n )}\n </div>\n ))}\n </div>\n );\n}\n\nfunction MessagesTab({ messagesContext }: { messagesContext: MessagesContext }) {\n const messages = messagesContext.messages || [];\n\n if (messages.length === 0) {\n return (\n <div style={{ textAlign: \"center\", padding: \"48px 0\", color: \"#6b7280\" }}>\n <p style={{ fontSize: \"18px\", margin: \"0 0 8px 0\" }}>No messages yet</p>\n <p style={{ fontSize: \"14px\", margin: 0 }}>\n Messages will appear here as the conversation progresses\n </p>\n </div>\n );\n }\n\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"16px\" }}>\n {messages.map((message: Message, index: number) => (\n <div\n key={index}\n style={{\n padding: \"16px\",\n borderRadius: \"8px\",\n backgroundColor:\n message.role === \"user\"\n ? \"#eff6ff\"\n : message.role === \"assistant\"\n ? \"#f9fafb\"\n : \"#fefce8\",\n border: `1px solid ${message.role === \"user\" ? \"#c7d2fe\" : message.role === \"assistant\" ? \"#e5e7eb\" : \"#fde047\"}`,\n marginLeft: message.role === \"user\" ? \"48px\" : \"0\",\n marginRight: message.role === \"assistant\" ? \"48px\" : \"0\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"flex-start\",\n justifyContent: \"space-between\",\n marginBottom: \"8px\",\n }}\n >\n <span\n style={{\n fontWeight: \"500\",\n fontSize: \"14px\",\n color: \"#374151\",\n textTransform: \"capitalize\",\n }}\n >\n {message.role || \"system\"}\n </span>\n {message.timestamp && (\n <span style={{ fontSize: \"12px\", color: \"#6b7280\" }}>\n {new Date(message.timestamp).toLocaleTimeString()}\n </span>\n )}\n </div>\n <div style={{ fontSize: \"14px\", color: \"#1f2937\", whiteSpace: \"pre-wrap\" }}>\n {message.content || \"\"}\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction ContextTab({ context }: { context: DisplayContext }) {\n const documents = context.getDocumentsContext([]);\n\n if (documents.length === 0) {\n return (\n <div style={{ textAlign: \"center\", padding: \"48px 0\", color: \"#6b7280\" }}>\n <p style={{ fontSize: \"18px\", margin: \"0 0 8px 0\" }}>No document context available</p>\n <p style={{ fontSize: \"14px\", margin: 0 }}>\n Document context will appear here when provided\n </p>\n </div>\n );\n }\n\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"16px\" }}>\n {documents.map((doc: Document, index: number) => (\n <div\n key={index}\n style={{\n backgroundColor: \"white\",\n padding: \"16px\",\n borderRadius: \"8px\",\n boxShadow: \"0 1px 3px 0 rgba(0, 0, 0, 0.1)\",\n border: \"1px solid #e5e7eb\",\n }}\n >\n <h3 style={{ fontWeight: \"600\", color: \"#1f2937\", margin: \"0 0 8px 0\" }}>\n {doc.name || `Document ${index + 1}`}\n </h3>\n {doc.content && (\n <pre\n style={{\n padding: \"12px\",\n backgroundColor: \"#f9fafb\",\n borderRadius: \"4px\",\n fontSize: \"12px\",\n overflowX: \"auto\",\n margin: 0,\n }}\n >\n {doc.content}\n </pre>\n )}\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAS,0BAA0B;AACnC,SAAS,WAAW,gBAAgB;AA0NxB,cAWA,YAXA;AA3JL,SAAS,sBAAsB,EAAE,QAAQ,SAAS,UAAU,GAA+B;AAChG,QAAM,UAAU,kBAAkB;AAClC,QAAM,kBAAkB,0BAA0B;AAClD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,SAAS;AAGpD,YAAU,MAAM;AACd,UAAM,eAAe,CAAC,MAAqB;AACzC,UAAI,EAAE,QAAQ,UAAU;AACtB,gBAAQ;AAAA,MACV;AAAA,IACF;AAEA,QAAI,QAAQ;AACV,eAAS,iBAAiB,WAAW,YAAY;AACjD,eAAS,KAAK,MAAM,WAAW;AAAA,IACjC;AAEA,WAAO,MAAM;AACX,eAAS,oBAAoB,WAAW,YAAY;AACpD,eAAS,KAAK,MAAM,WAAW;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,QAAQ,OAAO,CAAC;AAEpB,MAAI,CAAC;AAAQ,WAAO;AAGpB,QAAM,iBAAiC,YAClC,UACD;AAAA,IACE,SAAS;AAAA,MACP,YAAY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cAAI,QAAQ,YAAY,QAAQ,KACnC;AAAA,QACC,IAAI,WACH;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,cACT,iBAAiB;AAAA,cACjB,cAAc;AAAA,cACd,UAAU;AAAA,cACV,WAAW;AAAA,cACX,QAAQ;AAAA,YACV;AAAA,YAEC,cAAI;AAAA;AAAA,QACP;AAAA;AAAA;AAAA,IAxBG;AAAA,EA0BP,CACD,GACH;AAEJ;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|