@copilotkit/react-core 1.10.0-next.10 → 1.10.0-next.12

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-LVWV62JZ.mjs → chunk-2PL3WCKM.mjs} +18 -17
  3. package/dist/chunk-2PL3WCKM.mjs.map +1 -0
  4. package/dist/chunk-3BASANUO.mjs +170 -0
  5. package/dist/chunk-3BASANUO.mjs.map +1 -0
  6. package/dist/{chunk-L6HQIJ74.mjs → chunk-7TFJCTYY.mjs} +8 -8
  7. package/dist/{chunk-2TSNHEIS.mjs → chunk-BVRWKRDI.mjs} +5 -5
  8. package/dist/{chunk-DLEXVOQE.mjs → chunk-GEKWHETN.mjs} +4 -4
  9. package/dist/{chunk-Q42NJFXR.mjs → chunk-IKWGQG5V.mjs} +4 -4
  10. package/dist/{chunk-JJDXTTEN.mjs → chunk-K4HXT453.mjs} +2 -2
  11. package/dist/{chunk-JBLMXZ3O.mjs → chunk-KH27ZS4Y.mjs} +6 -6
  12. package/dist/{chunk-QGE7U4NV.mjs → chunk-MO2BUFJD.mjs} +2 -2
  13. package/dist/{chunk-TWYUYC4F.mjs → chunk-MUDXTKXE.mjs} +6 -6
  14. package/dist/{chunk-COEUPDRL.mjs → chunk-OGXCE54J.mjs} +8 -8
  15. package/dist/{chunk-X2DNXTME.mjs → chunk-OPRDTF4S.mjs} +4 -4
  16. package/dist/chunk-PIF5KJYI.mjs +103 -0
  17. package/dist/chunk-PIF5KJYI.mjs.map +1 -0
  18. package/dist/{chunk-IHAZJF3V.mjs → chunk-PYPPRFZ6.mjs} +2 -2
  19. package/dist/{chunk-ADZDXHVC.mjs → chunk-Q573EMPD.mjs} +4 -4
  20. package/dist/chunk-WSXTUD36.mjs +759 -0
  21. package/dist/chunk-WSXTUD36.mjs.map +1 -0
  22. package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
  23. package/dist/components/copilot-provider/copilotkit.js +1034 -63
  24. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  25. package/dist/components/copilot-provider/copilotkit.mjs +11 -8
  26. package/dist/components/copilot-provider/index.js +1034 -63
  27. package/dist/components/copilot-provider/index.js.map +1 -1
  28. package/dist/components/copilot-provider/index.mjs +11 -8
  29. package/dist/components/dev-console/console-trigger.d.ts +8 -0
  30. package/dist/components/dev-console/console-trigger.js +1131 -0
  31. package/dist/components/dev-console/console-trigger.js.map +1 -0
  32. package/dist/components/dev-console/console-trigger.mjs +13 -0
  33. package/dist/components/dev-console/console-trigger.mjs.map +1 -0
  34. package/dist/components/dev-console/developer-console-modal.d.ts +10 -0
  35. package/dist/components/dev-console/developer-console-modal.js +977 -0
  36. package/dist/components/dev-console/developer-console-modal.js.map +1 -0
  37. package/dist/components/dev-console/developer-console-modal.mjs +12 -0
  38. package/dist/components/dev-console/developer-console-modal.mjs.map +1 -0
  39. package/dist/components/dev-console/icons.d.ts +9 -0
  40. package/dist/components/dev-console/icons.js +131 -0
  41. package/dist/components/dev-console/icons.js.map +1 -0
  42. package/dist/components/dev-console/icons.mjs +16 -0
  43. package/dist/components/dev-console/icons.mjs.map +1 -0
  44. package/dist/components/error-boundary/error-boundary.mjs +2 -2
  45. package/dist/components/index.js +1034 -63
  46. package/dist/components/index.js.map +1 -1
  47. package/dist/components/index.mjs +11 -8
  48. package/dist/context/index.mjs +4 -4
  49. package/dist/hooks/index.js.map +1 -1
  50. package/dist/hooks/index.mjs +32 -29
  51. package/dist/hooks/use-chat.mjs +4 -4
  52. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  53. package/dist/hooks/use-coagent.js.map +1 -1
  54. package/dist/hooks/use-coagent.mjs +16 -13
  55. package/dist/hooks/use-copilot-action.mjs +2 -2
  56. package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
  57. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  58. package/dist/hooks/use-copilot-chat-headless_c.mjs +16 -13
  59. package/dist/hooks/use-copilot-chat.js.map +1 -1
  60. package/dist/hooks/use-copilot-chat.mjs +16 -13
  61. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  62. package/dist/hooks/use-copilot-chat_internal.mjs +15 -12
  63. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  64. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  65. package/dist/hooks/use-langgraph-interrupt.mjs +16 -13
  66. package/dist/index.js +1131 -169
  67. package/dist/index.js.map +1 -1
  68. package/dist/index.mjs +36 -33
  69. package/dist/lib/copilot-task.js.map +1 -1
  70. package/dist/lib/copilot-task.mjs +13 -10
  71. package/dist/lib/index.js.map +1 -1
  72. package/dist/lib/index.mjs +13 -10
  73. package/dist/utils/extract.js.map +1 -1
  74. package/dist/utils/extract.mjs +11 -8
  75. package/dist/utils/index.js.map +1 -1
  76. package/dist/utils/index.mjs +11 -8
  77. package/dist/utils/suggestions.js.map +1 -1
  78. package/dist/utils/suggestions.mjs +11 -8
  79. package/package.json +3 -3
  80. package/src/components/copilot-provider/copilotkit.tsx +5 -6
  81. package/src/components/dev-console/console-trigger.tsx +190 -0
  82. package/src/components/dev-console/developer-console-modal.tsx +866 -0
  83. package/src/components/dev-console/icons.tsx +101 -0
  84. package/dist/chunk-LVWV62JZ.mjs.map +0 -1
  85. /package/dist/{chunk-L6HQIJ74.mjs.map → chunk-7TFJCTYY.mjs.map} +0 -0
  86. /package/dist/{chunk-2TSNHEIS.mjs.map → chunk-BVRWKRDI.mjs.map} +0 -0
  87. /package/dist/{chunk-DLEXVOQE.mjs.map → chunk-GEKWHETN.mjs.map} +0 -0
  88. /package/dist/{chunk-Q42NJFXR.mjs.map → chunk-IKWGQG5V.mjs.map} +0 -0
  89. /package/dist/{chunk-JJDXTTEN.mjs.map → chunk-K4HXT453.mjs.map} +0 -0
  90. /package/dist/{chunk-JBLMXZ3O.mjs.map → chunk-KH27ZS4Y.mjs.map} +0 -0
  91. /package/dist/{chunk-QGE7U4NV.mjs.map → chunk-MO2BUFJD.mjs.map} +0 -0
  92. /package/dist/{chunk-TWYUYC4F.mjs.map → chunk-MUDXTKXE.mjs.map} +0 -0
  93. /package/dist/{chunk-COEUPDRL.mjs.map → chunk-OGXCE54J.mjs.map} +0 -0
  94. /package/dist/{chunk-X2DNXTME.mjs.map → chunk-OPRDTF4S.mjs.map} +0 -0
  95. /package/dist/{chunk-IHAZJF3V.mjs.map → chunk-PYPPRFZ6.mjs.map} +0 -0
  96. /package/dist/{chunk-ADZDXHVC.mjs.map → chunk-Q573EMPD.mjs.map} +0 -0
@@ -0,0 +1,866 @@
1
+ "use client";
2
+
3
+ import { useCopilotContext } from "../../context/copilot-context";
4
+ import { useCopilotMessagesContext } from "../../context/copilot-messages-context";
5
+ import { COPILOTKIT_VERSION } from "@copilotkit/shared";
6
+ import { useEffect, useState } from "react";
7
+ import { CheckIcon, CopilotKitIcon, ExclamationMarkTriangleIcon } from "./icons";
8
+
9
+ // Type definitions for the developer console
10
+ interface ActionParameter {
11
+ name: string;
12
+ required?: boolean;
13
+ type?: string;
14
+ }
15
+
16
+ interface Action {
17
+ name: string;
18
+ description?: string;
19
+ parameters?: ActionParameter[];
20
+ status?: string;
21
+ }
22
+
23
+ interface Readable {
24
+ name?: string;
25
+ description?: string;
26
+ value?: any;
27
+ content?: string;
28
+ metadata?: Record<string, any>;
29
+ }
30
+
31
+ interface AgentState {
32
+ status?: string;
33
+ state?: any;
34
+ running?: boolean;
35
+ lastUpdate?: number;
36
+ }
37
+
38
+ interface Message {
39
+ id?: string;
40
+ role?: "user" | "assistant" | "system";
41
+ content?: string;
42
+ timestamp?: number;
43
+ [key: string]: any; // Allow additional properties from CopilotKit
44
+ }
45
+
46
+ interface Document {
47
+ name?: string;
48
+ content?: string;
49
+ metadata?: Record<string, any>;
50
+ }
51
+
52
+ interface DisplayContext {
53
+ actions: Record<string, Action>;
54
+ getAllContext: () => Readable[];
55
+ coagentStates: Record<string, AgentState>;
56
+ getDocumentsContext: (args?: any[]) => Document[];
57
+ }
58
+
59
+ interface MessagesContext {
60
+ messages: Message[];
61
+ }
62
+
63
+ interface DeveloperConsoleModalProps {
64
+ isOpen: boolean;
65
+ onClose: () => void;
66
+ hasApiKey: boolean;
67
+ }
68
+
69
+ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperConsoleModalProps) {
70
+ const context = useCopilotContext();
71
+ const messagesContext = useCopilotMessagesContext();
72
+ const [activeTab, setActiveTab] = useState("actions");
73
+
74
+ // Handle escape key
75
+ useEffect(() => {
76
+ const handleEscape = (e: KeyboardEvent) => {
77
+ if (e.key === "Escape") {
78
+ onClose();
79
+ }
80
+ };
81
+
82
+ if (isOpen) {
83
+ document.addEventListener("keydown", handleEscape);
84
+ document.body.style.overflow = "hidden";
85
+ }
86
+
87
+ return () => {
88
+ document.removeEventListener("keydown", handleEscape);
89
+ document.body.style.overflow = "unset";
90
+ };
91
+ }, [isOpen, onClose]);
92
+
93
+ if (!isOpen) return null;
94
+
95
+ // Create mock data for preview when no API key
96
+ const displayContext: DisplayContext = hasApiKey
97
+ ? (context as DisplayContext)
98
+ : {
99
+ actions: {
100
+ search_web: { name: "search_web", description: "Search the web for information" },
101
+ send_email: { name: "send_email", description: "Send an email to a contact" },
102
+ create_document: { name: "create_document", description: "Create a new document" },
103
+ analyze_code: {
104
+ name: "analyze_code",
105
+ description: "Analyze code for issues and improvements",
106
+ },
107
+ generate_tests: {
108
+ name: "generate_tests",
109
+ description: "Generate unit tests for functions",
110
+ },
111
+ },
112
+ getAllContext: () => [
113
+ {
114
+ content: "User preferences: dark mode enabled, TypeScript preferred",
115
+ metadata: { source: "settings" },
116
+ },
117
+ {
118
+ content: "Current project: Building a React application with CopilotKit",
119
+ metadata: { source: "project" },
120
+ },
121
+ {
122
+ content: "Recent activity: Implemented authentication system",
123
+ metadata: { source: "activity" },
124
+ },
125
+ {
126
+ content: "Development environment: VS Code, Node.js 18, React 18",
127
+ metadata: { source: "environment" },
128
+ },
129
+ ],
130
+ coagentStates: {
131
+ "main-agent": { status: "active", lastUpdate: Date.now() },
132
+ "code-assistant": { status: "active", lastUpdate: Date.now() - 15000 },
133
+ "search-agent": { status: "idle", lastUpdate: Date.now() - 60000 },
134
+ },
135
+ getDocumentsContext: () => [
136
+ {
137
+ content: "README.md: Project setup and installation instructions",
138
+ metadata: { type: "documentation" },
139
+ },
140
+ {
141
+ content: "API Documentation: CopilotKit integration guide",
142
+ metadata: { type: "documentation" },
143
+ },
144
+ {
145
+ content: "package.json: Project dependencies and scripts",
146
+ metadata: { type: "configuration" },
147
+ },
148
+ ],
149
+ };
150
+
151
+ const displayMessagesContext: MessagesContext = hasApiKey
152
+ ? (messagesContext as MessagesContext)
153
+ : {
154
+ messages: [
155
+ {
156
+ id: "1",
157
+ role: "user",
158
+ content: "Help me implement a todo list with drag and drop functionality",
159
+ },
160
+ {
161
+ id: "2",
162
+ role: "assistant",
163
+ content:
164
+ "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.",
165
+ },
166
+ { id: "3", role: "user", content: "Can you also add priority levels and due dates?" },
167
+ {
168
+ id: "4",
169
+ role: "assistant",
170
+ content:
171
+ "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.",
172
+ },
173
+ { id: "5", role: "user", content: "Perfect! How about adding categories or tags?" },
174
+ ],
175
+ };
176
+
177
+ return (
178
+ <div
179
+ style={{
180
+ position: "fixed",
181
+ top: 0,
182
+ left: 0,
183
+ right: 0,
184
+ bottom: 0,
185
+ zIndex: 9999,
186
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
187
+ display: "flex",
188
+ alignItems: "center",
189
+ justifyContent: "center",
190
+ padding: "16px",
191
+ }}
192
+ onClick={onClose}
193
+ >
194
+ <div
195
+ style={{
196
+ width: "1152px",
197
+ maxWidth: "95vw",
198
+ height: "80vh",
199
+ backgroundColor: "white",
200
+ borderRadius: "12px",
201
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
202
+ display: "flex",
203
+ flexDirection: "column",
204
+ overflow: "hidden",
205
+ position: "relative",
206
+ }}
207
+ onClick={(e) => e.stopPropagation()}
208
+ >
209
+ {/* Header */}
210
+ <div
211
+ style={{
212
+ display: "flex",
213
+ alignItems: "center",
214
+ justifyContent: "space-between",
215
+ padding: "24px",
216
+ borderBottom: "1px solid #e5e7eb",
217
+ minHeight: "73px",
218
+ flexShrink: 0,
219
+ filter: !hasApiKey ? "blur(0.3px)" : "none",
220
+ opacity: !hasApiKey ? 0.95 : 1,
221
+ }}
222
+ >
223
+ <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
224
+ <CopilotKitIcon />
225
+ <h1
226
+ style={{
227
+ fontWeight: "bold",
228
+ fontSize: "20px",
229
+ color: "#1f2937",
230
+ margin: 0,
231
+ }}
232
+ >
233
+ Developer Console
234
+ </h1>
235
+ <span
236
+ style={{
237
+ fontSize: "14px",
238
+ color: "#6b7280",
239
+ backgroundColor: "#f3f4f6",
240
+ padding: "4px 8px",
241
+ borderRadius: "4px",
242
+ }}
243
+ >
244
+ v{COPILOTKIT_VERSION}
245
+ </span>
246
+ </div>
247
+ <button
248
+ onClick={onClose}
249
+ style={{
250
+ color: "#9ca3af",
251
+ fontSize: "24px",
252
+ fontWeight: "300",
253
+ border: "none",
254
+ background: "none",
255
+ cursor: "pointer",
256
+ padding: "4px",
257
+ }}
258
+ onMouseEnter={(e) => (e.currentTarget.style.color = "#4b5563")}
259
+ onMouseLeave={(e) => (e.currentTarget.style.color = "#9ca3af")}
260
+ >
261
+ ×
262
+ </button>
263
+ </div>
264
+
265
+ {/* Tab Navigation */}
266
+ <div
267
+ style={{
268
+ display: "flex",
269
+ borderBottom: "1px solid #e5e7eb",
270
+ backgroundColor: "#f9fafb",
271
+ minHeight: "50px",
272
+ flexShrink: 0,
273
+ filter: !hasApiKey ? "blur(0.3px)" : "none",
274
+ opacity: !hasApiKey ? 0.9 : 1,
275
+ }}
276
+ >
277
+ {[
278
+ { id: "actions", label: "Actions", count: Object.keys(displayContext.actions).length },
279
+ { id: "readables", label: "Readables", count: displayContext.getAllContext().length },
280
+ {
281
+ id: "agent",
282
+ label: "Agent Status",
283
+ count: Object.keys(displayContext.coagentStates).length,
284
+ },
285
+ { id: "messages", label: "Messages", count: displayMessagesContext.messages.length },
286
+ {
287
+ id: "context",
288
+ label: "Context",
289
+ count: displayContext.getDocumentsContext([]).length,
290
+ },
291
+ ].map((tab) => (
292
+ <button
293
+ key={tab.id}
294
+ onClick={() => setActiveTab(tab.id)}
295
+ style={{
296
+ padding: "12px 24px",
297
+ fontSize: "14px",
298
+ fontWeight: "500",
299
+ border: "none",
300
+ cursor: "pointer",
301
+ backgroundColor: activeTab === tab.id ? "white" : "transparent",
302
+ color: activeTab === tab.id ? "#2563eb" : "#6b7280",
303
+ borderBottom: activeTab === tab.id ? "2px solid #2563eb" : "none",
304
+ transition: "all 0.2s",
305
+ }}
306
+ onMouseEnter={(e) => {
307
+ if (activeTab !== tab.id) {
308
+ e.currentTarget.style.color = "#1f2937";
309
+ e.currentTarget.style.backgroundColor = "#f3f4f6";
310
+ }
311
+ }}
312
+ onMouseLeave={(e) => {
313
+ if (activeTab !== tab.id) {
314
+ e.currentTarget.style.color = "#6b7280";
315
+ e.currentTarget.style.backgroundColor = "transparent";
316
+ }
317
+ }}
318
+ >
319
+ {tab.label}
320
+ {tab.count > 0 && (
321
+ <span
322
+ style={{
323
+ marginLeft: "8px",
324
+ backgroundColor: "#e5e7eb",
325
+ color: "#374151",
326
+ padding: "2px 8px",
327
+ borderRadius: "9999px",
328
+ fontSize: "12px",
329
+ }}
330
+ >
331
+ {tab.count}
332
+ </span>
333
+ )}
334
+ </button>
335
+ ))}
336
+ </div>
337
+
338
+ {/* Content */}
339
+ <div
340
+ style={{
341
+ height: "calc(100% - 142px)",
342
+ overflow: "auto",
343
+ padding: "24px",
344
+ backgroundColor: "#f9fafb",
345
+ filter: !hasApiKey ? "blur(0.3px)" : "none",
346
+ opacity: !hasApiKey ? 0.85 : 1,
347
+ }}
348
+ >
349
+ {activeTab === "actions" && <ActionsTab context={displayContext} />}
350
+ {activeTab === "readables" && <ReadablesTab context={displayContext} />}
351
+ {activeTab === "agent" && <AgentStatusTab context={displayContext} />}
352
+ {activeTab === "messages" && <MessagesTab messagesContext={displayMessagesContext} />}
353
+ {activeTab === "context" && <ContextTab context={displayContext} />}
354
+ </div>
355
+
356
+ {/* Footer */}
357
+ <div
358
+ style={{
359
+ padding: "16px 24px",
360
+ borderTop: "1px solid #e5e7eb",
361
+ backgroundColor: "white",
362
+ display: "flex",
363
+ justifyContent: "space-between",
364
+ alignItems: "center",
365
+ minHeight: "57px",
366
+ flexShrink: 0,
367
+ filter: !hasApiKey ? "blur(0.3px)" : "none",
368
+ opacity: !hasApiKey ? 0.9 : 1,
369
+ }}
370
+ >
371
+ <div style={{ fontSize: "14px", color: "#6b7280" }}>
372
+ <a
373
+ href="https://github.com/CopilotKit/CopilotKit/issues"
374
+ target="_blank"
375
+ rel="noopener noreferrer"
376
+ style={{ color: "#2563eb", textDecoration: "none" }}
377
+ onMouseEnter={(e) => (e.currentTarget.style.textDecoration = "underline")}
378
+ onMouseLeave={(e) => (e.currentTarget.style.textDecoration = "none")}
379
+ >
380
+ Report an issue
381
+ </a>
382
+ </div>
383
+ <div style={{ fontSize: "14px", color: "#6b7280" }}>
384
+ <a
385
+ href="https://mcp.copilotkit.ai/"
386
+ target="_blank"
387
+ rel="noopener noreferrer"
388
+ style={{ color: "#2563eb", textDecoration: "none" }}
389
+ onMouseEnter={(e) => (e.currentTarget.style.textDecoration = "underline")}
390
+ onMouseLeave={(e) => (e.currentTarget.style.textDecoration = "none")}
391
+ >
392
+ Add MCP Server →
393
+ </a>
394
+ </div>
395
+ </div>
396
+
397
+ {/* Enhanced CTA Overlay */}
398
+ {!hasApiKey && (
399
+ <div
400
+ style={{
401
+ position: "absolute",
402
+ top: 0,
403
+ left: 0,
404
+ right: 0,
405
+ bottom: 0,
406
+ backgroundColor: "rgba(255, 255, 255, 0.2)",
407
+ backdropFilter: "blur(2px)",
408
+ WebkitBackdropFilter: "blur(2px)",
409
+ display: "flex",
410
+ alignItems: "center",
411
+ justifyContent: "center",
412
+ borderRadius: "12px",
413
+ zIndex: 10,
414
+ }}
415
+ onClick={(e) => e.stopPropagation()}
416
+ >
417
+ <button
418
+ onClick={() => window.open("https://cloud.copilotkit.ai/sign-in", "_blank")}
419
+ style={{
420
+ // Following button system specifications
421
+ height: "48px",
422
+ padding: "12px 24px",
423
+ backgroundColor: "#030507", // textPrimary token
424
+ color: "#FFFFFF",
425
+ borderRadius: "12px", // Medium radius token
426
+ border: "none",
427
+ cursor: "pointer",
428
+ fontSize: "14px", // Medium Semi Bold typography
429
+ fontWeight: "600",
430
+ fontFamily: "'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif",
431
+ lineHeight: "22px",
432
+ boxShadow: "0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)",
433
+ transition: "all 200ms ease", // 200ms ease as per specs
434
+ display: "inline-flex",
435
+ alignItems: "center",
436
+ gap: "8px",
437
+ textTransform: "uppercase",
438
+ letterSpacing: "0.5px",
439
+ }}
440
+ onMouseEnter={(e) => {
441
+ e.currentTarget.style.backgroundColor = "#575758"; // textSecondary token for hover
442
+ e.currentTarget.style.transform = "translateY(-1px)";
443
+ e.currentTarget.style.boxShadow =
444
+ "0 6px 20px rgba(3, 5, 7, 0.25), 0 2px 4px rgba(3, 5, 7, 0.15)";
445
+ }}
446
+ onMouseLeave={(e) => {
447
+ e.currentTarget.style.backgroundColor = "#030507";
448
+ e.currentTarget.style.transform = "translateY(0)";
449
+ e.currentTarget.style.boxShadow =
450
+ "0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)";
451
+ }}
452
+ onMouseDown={(e) => {
453
+ e.currentTarget.style.backgroundColor = "#858589"; // textDisabled token for pressed
454
+ e.currentTarget.style.transform = "translateY(0)";
455
+ }}
456
+ onMouseUp={(e) => {
457
+ e.currentTarget.style.backgroundColor = "#575758";
458
+ e.currentTarget.style.transform = "translateY(-1px)";
459
+ }}
460
+ onFocus={(e) => {
461
+ e.currentTarget.style.outline = "2px solid #BEC9FF";
462
+ e.currentTarget.style.outlineOffset = "2px";
463
+ }}
464
+ onBlur={(e) => {
465
+ e.currentTarget.style.outline = "none";
466
+ }}
467
+ >
468
+ Get API Key
469
+ <span style={{ fontSize: "16px", marginLeft: "-4px" }}>→</span>
470
+ </button>
471
+ </div>
472
+ )}
473
+ </div>
474
+ </div>
475
+ );
476
+ }
477
+
478
+ // Tab Components
479
+ function ActionsTab({ context }: { context: DisplayContext }) {
480
+ const actions = Object.values(context.actions);
481
+
482
+ if (actions.length === 0) {
483
+ return (
484
+ <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
485
+ <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>No actions available</p>
486
+ <p style={{ fontSize: "14px", margin: 0 }}>Actions will appear here when registered</p>
487
+ </div>
488
+ );
489
+ }
490
+
491
+ return (
492
+ <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
493
+ {actions.map((action: Action, index: number) => (
494
+ <div
495
+ key={index}
496
+ style={{
497
+ backgroundColor: "white",
498
+ padding: "16px",
499
+ borderRadius: "8px",
500
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
501
+ border: "1px solid #e5e7eb",
502
+ }}
503
+ >
504
+ <div
505
+ style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between" }}
506
+ >
507
+ <div style={{ flex: 1 }}>
508
+ <h3 style={{ fontWeight: "600", color: "#1f2937", margin: "0 0 4px 0" }}>
509
+ {action.name}
510
+ </h3>
511
+ {action.description && (
512
+ <p style={{ fontSize: "14px", color: "#4b5563", margin: "0 0 12px 0" }}>
513
+ {action.description}
514
+ </p>
515
+ )}
516
+ {action.parameters && action.parameters.length > 0 && (
517
+ <div style={{ marginTop: "12px" }}>
518
+ <p
519
+ style={{
520
+ fontSize: "12px",
521
+ fontWeight: "500",
522
+ color: "#6b7280",
523
+ textTransform: "uppercase",
524
+ margin: "0 0 4px 0",
525
+ }}
526
+ >
527
+ Parameters:
528
+ </p>
529
+ <div style={{ display: "flex", flexDirection: "column", gap: "4px" }}>
530
+ {action.parameters.map((param: ActionParameter, pIndex: number) => (
531
+ <div key={pIndex} style={{ fontSize: "14px" }}>
532
+ <span style={{ fontFamily: "monospace", color: "#374151" }}>
533
+ {param.name}
534
+ </span>
535
+ {param.required && (
536
+ <span style={{ marginLeft: "4px", fontSize: "12px", color: "#ef4444" }}>
537
+ *required
538
+ </span>
539
+ )}
540
+ {param.type && (
541
+ <span style={{ marginLeft: "8px", fontSize: "12px", color: "#6b7280" }}>
542
+ ({param.type})
543
+ </span>
544
+ )}
545
+ </div>
546
+ ))}
547
+ </div>
548
+ </div>
549
+ )}
550
+ </div>
551
+ <div style={{ marginLeft: "16px" }}>
552
+ {action.status === "available" ? <CheckIcon /> : <ExclamationMarkTriangleIcon />}
553
+ </div>
554
+ </div>
555
+ </div>
556
+ ))}
557
+ </div>
558
+ );
559
+ }
560
+
561
+ function ReadablesTab({ context }: { context: DisplayContext }) {
562
+ const readables = context.getAllContext();
563
+
564
+ if (readables.length === 0) {
565
+ return (
566
+ <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
567
+ <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>No readable context available</p>
568
+ <p style={{ fontSize: "14px", margin: 0 }}>
569
+ Readable context will appear here when provided
570
+ </p>
571
+ </div>
572
+ );
573
+ }
574
+
575
+ return (
576
+ <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
577
+ {readables.map((readable: Readable, index: number) => (
578
+ <div
579
+ key={index}
580
+ style={{
581
+ backgroundColor: "white",
582
+ padding: "16px",
583
+ borderRadius: "8px",
584
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
585
+ border: "1px solid #e5e7eb",
586
+ }}
587
+ >
588
+ <div
589
+ style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between" }}
590
+ >
591
+ <div style={{ flex: 1 }}>
592
+ <h3 style={{ fontWeight: "600", color: "#1f2937", margin: "0 0 4px 0" }}>
593
+ {readable.name || `Readable ${index + 1}`}
594
+ </h3>
595
+ {readable.description && (
596
+ <p style={{ fontSize: "14px", color: "#4b5563", margin: "0 0 12px 0" }}>
597
+ {readable.description}
598
+ </p>
599
+ )}
600
+ {readable.value && (
601
+ <pre
602
+ style={{
603
+ marginTop: "12px",
604
+ padding: "8px",
605
+ backgroundColor: "#f9fafb",
606
+ borderRadius: "4px",
607
+ fontSize: "12px",
608
+ overflowX: "auto",
609
+ margin: "12px 0 0 0",
610
+ }}
611
+ >
612
+ {JSON.stringify(readable.value, null, 2)}
613
+ </pre>
614
+ )}
615
+ </div>
616
+ </div>
617
+ </div>
618
+ ))}
619
+ </div>
620
+ );
621
+ }
622
+
623
+ function AgentStatusTab({ context }: { context: DisplayContext }) {
624
+ const agentStates = context.coagentStates || {};
625
+ const agentStateEntries = Object.entries(agentStates);
626
+
627
+ if (agentStateEntries.length === 0) {
628
+ return (
629
+ <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
630
+ <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>No agent states available</p>
631
+ <p style={{ fontSize: "14px", margin: 0 }}>
632
+ Agent states will appear here when agents are active
633
+ </p>
634
+ </div>
635
+ );
636
+ }
637
+
638
+ return (
639
+ <div style={{ display: "flex", flexDirection: "column", gap: "24px" }}>
640
+ {agentStateEntries.map(([agentName, state]: [string, AgentState]) => (
641
+ <div
642
+ key={agentName}
643
+ style={{
644
+ backgroundColor: "white",
645
+ padding: "24px",
646
+ borderRadius: "8px",
647
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
648
+ border: "1px solid #e5e7eb",
649
+ }}
650
+ >
651
+ <div
652
+ style={{
653
+ display: "flex",
654
+ alignItems: "center",
655
+ justifyContent: "space-between",
656
+ marginBottom: "16px",
657
+ }}
658
+ >
659
+ <h3 style={{ fontWeight: "600", fontSize: "18px", color: "#1f2937", margin: 0 }}>
660
+ {agentName}
661
+ </h3>
662
+ <span
663
+ style={{
664
+ padding: "4px 12px",
665
+ borderRadius: "9999px",
666
+ fontSize: "12px",
667
+ fontWeight: "500",
668
+ backgroundColor:
669
+ state.status === "running"
670
+ ? "#dcfce7"
671
+ : state.status === "complete"
672
+ ? "#dbeafe"
673
+ : "#f3f4f6",
674
+ color:
675
+ state.status === "running"
676
+ ? "#166534"
677
+ : state.status === "complete"
678
+ ? "#1e40af"
679
+ : "#1f2937",
680
+ }}
681
+ >
682
+ {state.status || "idle"}
683
+ </span>
684
+ </div>
685
+
686
+ {state.state && (
687
+ <div style={{ marginBottom: "12px" }}>
688
+ <p
689
+ style={{
690
+ fontSize: "12px",
691
+ fontWeight: "500",
692
+ color: "#6b7280",
693
+ textTransform: "uppercase",
694
+ margin: "0 0 4px 0",
695
+ }}
696
+ >
697
+ Current State:
698
+ </p>
699
+ <pre
700
+ style={{
701
+ padding: "12px",
702
+ backgroundColor: "#f9fafb",
703
+ borderRadius: "4px",
704
+ fontSize: "12px",
705
+ overflowX: "auto",
706
+ margin: 0,
707
+ }}
708
+ >
709
+ {JSON.stringify(state.state, null, 2)}
710
+ </pre>
711
+ </div>
712
+ )}
713
+
714
+ {state.running && (
715
+ <div
716
+ style={{
717
+ marginTop: "16px",
718
+ display: "flex",
719
+ alignItems: "center",
720
+ fontSize: "14px",
721
+ color: "#4b5563",
722
+ }}
723
+ >
724
+ <div style={{ marginRight: "8px" }}>
725
+ <svg
726
+ width="16"
727
+ height="16"
728
+ viewBox="0 0 16 16"
729
+ style={{ animation: "spin 1s linear infinite" }}
730
+ >
731
+ <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>
732
+ <circle
733
+ cx="8"
734
+ cy="8"
735
+ r="6"
736
+ fill="none"
737
+ stroke="#4b5563"
738
+ strokeWidth="2"
739
+ strokeDasharray="9 3"
740
+ />
741
+ </svg>
742
+ </div>
743
+ <span>Agent is currently running...</span>
744
+ </div>
745
+ )}
746
+ </div>
747
+ ))}
748
+ </div>
749
+ );
750
+ }
751
+
752
+ function MessagesTab({ messagesContext }: { messagesContext: MessagesContext }) {
753
+ const messages = messagesContext.messages || [];
754
+
755
+ if (messages.length === 0) {
756
+ return (
757
+ <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
758
+ <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>No messages yet</p>
759
+ <p style={{ fontSize: "14px", margin: 0 }}>
760
+ Messages will appear here as the conversation progresses
761
+ </p>
762
+ </div>
763
+ );
764
+ }
765
+
766
+ return (
767
+ <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
768
+ {messages.map((message: Message, index: number) => (
769
+ <div
770
+ key={index}
771
+ style={{
772
+ padding: "16px",
773
+ borderRadius: "8px",
774
+ backgroundColor:
775
+ message.role === "user"
776
+ ? "#eff6ff"
777
+ : message.role === "assistant"
778
+ ? "#f9fafb"
779
+ : "#fefce8",
780
+ border: `1px solid ${message.role === "user" ? "#c7d2fe" : message.role === "assistant" ? "#e5e7eb" : "#fde047"}`,
781
+ marginLeft: message.role === "user" ? "48px" : "0",
782
+ marginRight: message.role === "assistant" ? "48px" : "0",
783
+ }}
784
+ >
785
+ <div
786
+ style={{
787
+ display: "flex",
788
+ alignItems: "flex-start",
789
+ justifyContent: "space-between",
790
+ marginBottom: "8px",
791
+ }}
792
+ >
793
+ <span
794
+ style={{
795
+ fontWeight: "500",
796
+ fontSize: "14px",
797
+ color: "#374151",
798
+ textTransform: "capitalize",
799
+ }}
800
+ >
801
+ {message.role || "system"}
802
+ </span>
803
+ {message.timestamp && (
804
+ <span style={{ fontSize: "12px", color: "#6b7280" }}>
805
+ {new Date(message.timestamp).toLocaleTimeString()}
806
+ </span>
807
+ )}
808
+ </div>
809
+ <div style={{ fontSize: "14px", color: "#1f2937", whiteSpace: "pre-wrap" }}>
810
+ {message.content || ""}
811
+ </div>
812
+ </div>
813
+ ))}
814
+ </div>
815
+ );
816
+ }
817
+
818
+ function ContextTab({ context }: { context: DisplayContext }) {
819
+ const documents = context.getDocumentsContext([]);
820
+
821
+ if (documents.length === 0) {
822
+ return (
823
+ <div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
824
+ <p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>No document context available</p>
825
+ <p style={{ fontSize: "14px", margin: 0 }}>
826
+ Document context will appear here when provided
827
+ </p>
828
+ </div>
829
+ );
830
+ }
831
+
832
+ return (
833
+ <div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
834
+ {documents.map((doc: Document, index: number) => (
835
+ <div
836
+ key={index}
837
+ style={{
838
+ backgroundColor: "white",
839
+ padding: "16px",
840
+ borderRadius: "8px",
841
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
842
+ border: "1px solid #e5e7eb",
843
+ }}
844
+ >
845
+ <h3 style={{ fontWeight: "600", color: "#1f2937", margin: "0 0 8px 0" }}>
846
+ {doc.name || `Document ${index + 1}`}
847
+ </h3>
848
+ {doc.content && (
849
+ <pre
850
+ style={{
851
+ padding: "12px",
852
+ backgroundColor: "#f9fafb",
853
+ borderRadius: "4px",
854
+ fontSize: "12px",
855
+ overflowX: "auto",
856
+ margin: 0,
857
+ }}
858
+ >
859
+ {doc.content}
860
+ </pre>
861
+ )}
862
+ </div>
863
+ ))}
864
+ </div>
865
+ );
866
+ }