@industry-theme/agent-driven-ui-panels 0.1.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.
@@ -0,0 +1,1634 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React2, { forwardRef, createElement, createContext, useState, useEffect, useContext, useRef, useCallback } from "react";
3
+ /**
4
+ * @license lucide-react v0.552.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */
9
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
10
+ const toCamelCase = (string) => string.replace(
11
+ /^([A-Z])|[\s-_]+(\w)/g,
12
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
13
+ );
14
+ const toPascalCase = (string) => {
15
+ const camelCase = toCamelCase(string);
16
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
17
+ };
18
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
19
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
20
+ }).join(" ").trim();
21
+ const hasA11yProp = (props) => {
22
+ for (const prop in props) {
23
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
24
+ return true;
25
+ }
26
+ }
27
+ };
28
+ /**
29
+ * @license lucide-react v0.552.0 - ISC
30
+ *
31
+ * This source code is licensed under the ISC license.
32
+ * See the LICENSE file in the root directory of this source tree.
33
+ */
34
+ var defaultAttributes = {
35
+ xmlns: "http://www.w3.org/2000/svg",
36
+ width: 24,
37
+ height: 24,
38
+ viewBox: "0 0 24 24",
39
+ fill: "none",
40
+ stroke: "currentColor",
41
+ strokeWidth: 2,
42
+ strokeLinecap: "round",
43
+ strokeLinejoin: "round"
44
+ };
45
+ /**
46
+ * @license lucide-react v0.552.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */
51
+ const Icon = forwardRef(
52
+ ({
53
+ color = "currentColor",
54
+ size = 24,
55
+ strokeWidth = 2,
56
+ absoluteStrokeWidth,
57
+ className = "",
58
+ children,
59
+ iconNode,
60
+ ...rest
61
+ }, ref) => createElement(
62
+ "svg",
63
+ {
64
+ ref,
65
+ ...defaultAttributes,
66
+ width: size,
67
+ height: size,
68
+ stroke: color,
69
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
70
+ className: mergeClasses("lucide", className),
71
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
72
+ ...rest
73
+ },
74
+ [
75
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
76
+ ...Array.isArray(children) ? children : [children]
77
+ ]
78
+ )
79
+ );
80
+ /**
81
+ * @license lucide-react v0.552.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */
86
+ const createLucideIcon = (iconName, iconNode) => {
87
+ const Component = forwardRef(
88
+ ({ className, ...props }, ref) => createElement(Icon, {
89
+ ref,
90
+ iconNode,
91
+ className: mergeClasses(
92
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
93
+ `lucide-${iconName}`,
94
+ className
95
+ ),
96
+ ...props
97
+ })
98
+ );
99
+ Component.displayName = toPascalCase(iconName);
100
+ return Component;
101
+ };
102
+ /**
103
+ * @license lucide-react v0.552.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */
108
+ const __iconNode$b = [
109
+ [
110
+ "path",
111
+ {
112
+ d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
113
+ key: "169zse"
114
+ }
115
+ ]
116
+ ];
117
+ const Activity = createLucideIcon("activity", __iconNode$b);
118
+ /**
119
+ * @license lucide-react v0.552.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */
124
+ const __iconNode$a = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
125
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$a);
126
+ /**
127
+ * @license lucide-react v0.552.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */
132
+ const __iconNode$9 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
133
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$9);
134
+ /**
135
+ * @license lucide-react v0.552.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */
140
+ const __iconNode$8 = [
141
+ ["path", { d: "M12 20v2", key: "1lh1kg" }],
142
+ ["path", { d: "M12 2v2", key: "tus03m" }],
143
+ ["path", { d: "M17 20v2", key: "1rnc9c" }],
144
+ ["path", { d: "M17 2v2", key: "11trls" }],
145
+ ["path", { d: "M2 12h2", key: "1t8f8n" }],
146
+ ["path", { d: "M2 17h2", key: "7oei6x" }],
147
+ ["path", { d: "M2 7h2", key: "asdhe0" }],
148
+ ["path", { d: "M20 12h2", key: "1q8mjw" }],
149
+ ["path", { d: "M20 17h2", key: "1fpfkl" }],
150
+ ["path", { d: "M20 7h2", key: "1o8tra" }],
151
+ ["path", { d: "M7 20v2", key: "4gnj0m" }],
152
+ ["path", { d: "M7 2v2", key: "1i4yhu" }],
153
+ ["rect", { x: "4", y: "4", width: "16", height: "16", rx: "2", key: "1vbyd7" }],
154
+ ["rect", { x: "8", y: "8", width: "8", height: "8", rx: "1", key: "z9xiuo" }]
155
+ ];
156
+ const Cpu = createLucideIcon("cpu", __iconNode$8);
157
+ /**
158
+ * @license lucide-react v0.552.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */
163
+ const __iconNode$7 = [
164
+ [
165
+ "path",
166
+ {
167
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
168
+ key: "1oefj6"
169
+ }
170
+ ],
171
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
172
+ ["path", { d: "M10 9H8", key: "b1mrlr" }],
173
+ ["path", { d: "M16 13H8", key: "t4e002" }],
174
+ ["path", { d: "M16 17H8", key: "z1uh3a" }]
175
+ ];
176
+ const FileText = createLucideIcon("file-text", __iconNode$7);
177
+ /**
178
+ * @license lucide-react v0.552.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */
183
+ const __iconNode$6 = [
184
+ [
185
+ "path",
186
+ {
187
+ d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
188
+ key: "sc7q7i"
189
+ }
190
+ ]
191
+ ];
192
+ const Funnel = createLucideIcon("funnel", __iconNode$6);
193
+ /**
194
+ * @license lucide-react v0.552.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */
199
+ const __iconNode$5 = [
200
+ ["rect", { x: "14", y: "3", width: "5", height: "18", rx: "1", key: "kaeet6" }],
201
+ ["rect", { x: "5", y: "3", width: "5", height: "18", rx: "1", key: "1wsw3u" }]
202
+ ];
203
+ const Pause = createLucideIcon("pause", __iconNode$5);
204
+ /**
205
+ * @license lucide-react v0.552.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */
210
+ const __iconNode$4 = [
211
+ [
212
+ "path",
213
+ {
214
+ d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
215
+ key: "10ikf1"
216
+ }
217
+ ]
218
+ ];
219
+ const Play = createLucideIcon("play", __iconNode$4);
220
+ /**
221
+ * @license lucide-react v0.552.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */
226
+ const __iconNode$3 = [
227
+ [
228
+ "path",
229
+ {
230
+ d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
231
+ key: "vktsd0"
232
+ }
233
+ ],
234
+ ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
235
+ ];
236
+ const Tag = createLucideIcon("tag", __iconNode$3);
237
+ /**
238
+ * @license lucide-react v0.552.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */
243
+ const __iconNode$2 = [
244
+ ["path", { d: "M10 11v6", key: "nco0om" }],
245
+ ["path", { d: "M14 11v6", key: "outv1u" }],
246
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
247
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
248
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
249
+ ];
250
+ const Trash2 = createLucideIcon("trash-2", __iconNode$2);
251
+ /**
252
+ * @license lucide-react v0.552.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */
257
+ const __iconNode$1 = [
258
+ [
259
+ "path",
260
+ {
261
+ d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",
262
+ key: "1ngwbx"
263
+ }
264
+ ]
265
+ ];
266
+ const Wrench = createLucideIcon("wrench", __iconNode$1);
267
+ /**
268
+ * @license lucide-react v0.552.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */
273
+ const __iconNode = [
274
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
275
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
276
+ ];
277
+ const X = createLucideIcon("x", __iconNode);
278
+ var terminalTheme = {
279
+ space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
280
+ fonts: {
281
+ body: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace',
282
+ heading: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace',
283
+ monospace: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace'
284
+ },
285
+ fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],
286
+ fontScale: 1,
287
+ fontWeights: {
288
+ body: 400,
289
+ heading: 500,
290
+ bold: 600,
291
+ light: 300,
292
+ medium: 500,
293
+ semibold: 600
294
+ },
295
+ lineHeights: {
296
+ body: 1.6,
297
+ heading: 1.3,
298
+ tight: 1.4,
299
+ relaxed: 1.8
300
+ },
301
+ breakpoints: ["640px", "768px", "1024px", "1280px"],
302
+ sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],
303
+ radii: [0, 2, 4, 6, 8, 12, 16, 24],
304
+ shadows: [
305
+ "none",
306
+ "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
307
+ "0 2px 4px 0 rgba(0, 0, 0, 0.06)",
308
+ "0 4px 6px 0 rgba(0, 0, 0, 0.07)",
309
+ "0 8px 12px 0 rgba(0, 0, 0, 0.08)",
310
+ "0 16px 24px 0 rgba(0, 0, 0, 0.10)"
311
+ ],
312
+ zIndices: [0, 1, 10, 20, 30, 40, 50],
313
+ colors: {
314
+ text: "#e4e4e4",
315
+ background: "rgba(10, 10, 10, 0.85)",
316
+ primary: "#66b3ff",
317
+ secondary: "#80c4ff",
318
+ accent: "#66ff99",
319
+ highlight: "rgba(102, 179, 255, 0.15)",
320
+ muted: "rgba(26, 26, 26, 0.8)",
321
+ success: "#66ff99",
322
+ warning: "#ffcc66",
323
+ error: "#ff6666",
324
+ info: "#66b3ff",
325
+ border: "rgba(255, 255, 255, 0.1)",
326
+ backgroundSecondary: "rgba(15, 15, 15, 0.9)",
327
+ backgroundTertiary: "rgba(20, 20, 20, 0.9)",
328
+ backgroundLight: "rgba(255, 255, 255, 0.05)",
329
+ backgroundHover: "rgba(102, 179, 255, 0.08)",
330
+ surface: "rgba(15, 15, 15, 0.95)",
331
+ textSecondary: "rgba(255, 255, 255, 0.7)",
332
+ textTertiary: "rgba(255, 255, 255, 0.5)",
333
+ textMuted: "rgba(255, 255, 255, 0.4)",
334
+ highlightBg: "rgba(255, 235, 59, 0.25)",
335
+ highlightBorder: "rgba(255, 235, 59, 0.5)"
336
+ },
337
+ modes: {
338
+ light: {
339
+ text: "#1a1a1a",
340
+ background: "rgba(255, 255, 255, 0.9)",
341
+ primary: "#0066cc",
342
+ secondary: "#0052a3",
343
+ accent: "#00cc88",
344
+ highlight: "rgba(0, 102, 204, 0.08)",
345
+ muted: "rgba(245, 245, 245, 0.8)",
346
+ success: "#00cc88",
347
+ warning: "#ffaa00",
348
+ error: "#ff3333",
349
+ info: "#0066cc",
350
+ border: "rgba(0, 0, 0, 0.1)",
351
+ backgroundSecondary: "rgba(250, 250, 250, 0.9)",
352
+ backgroundTertiary: "rgba(245, 245, 245, 0.9)",
353
+ backgroundLight: "rgba(0, 0, 0, 0.02)",
354
+ backgroundHover: "rgba(0, 102, 204, 0.04)",
355
+ surface: "rgba(255, 255, 255, 0.95)",
356
+ textSecondary: "rgba(0, 0, 0, 0.6)",
357
+ textTertiary: "rgba(0, 0, 0, 0.4)",
358
+ textMuted: "rgba(0, 0, 0, 0.3)",
359
+ highlightBg: "rgba(255, 235, 59, 0.3)",
360
+ highlightBorder: "rgba(255, 235, 59, 0.6)"
361
+ }
362
+ },
363
+ buttons: {
364
+ primary: {
365
+ color: "white",
366
+ bg: "primary",
367
+ borderWidth: 0,
368
+ "&:hover": {
369
+ bg: "secondary"
370
+ }
371
+ },
372
+ secondary: {
373
+ color: "primary",
374
+ bg: "transparent",
375
+ borderWidth: 1,
376
+ borderStyle: "solid",
377
+ borderColor: "primary",
378
+ "&:hover": {
379
+ bg: "highlight"
380
+ }
381
+ },
382
+ ghost: {
383
+ color: "text",
384
+ bg: "transparent",
385
+ "&:hover": {
386
+ bg: "backgroundHover"
387
+ }
388
+ }
389
+ },
390
+ text: {
391
+ heading: {
392
+ fontFamily: "heading",
393
+ fontWeight: "heading",
394
+ lineHeight: "heading"
395
+ },
396
+ body: {
397
+ fontFamily: "body",
398
+ fontWeight: "body",
399
+ lineHeight: "body"
400
+ },
401
+ caption: {
402
+ fontSize: 1,
403
+ color: "textSecondary"
404
+ }
405
+ },
406
+ cards: {
407
+ primary: {
408
+ bg: "surface",
409
+ border: "1px solid",
410
+ borderColor: "border",
411
+ borderRadius: 1
412
+ },
413
+ secondary: {
414
+ bg: "backgroundSecondary",
415
+ border: "1px solid",
416
+ borderColor: "border",
417
+ borderRadius: 1
418
+ }
419
+ }
420
+ };
421
+ function getMode(theme2, mode) {
422
+ if (!mode || !theme2.modes || !theme2.modes[mode]) {
423
+ return theme2.colors;
424
+ }
425
+ return {
426
+ ...theme2.colors,
427
+ ...theme2.modes[mode]
428
+ };
429
+ }
430
+ var ThemeContext;
431
+ var getThemeContext = () => {
432
+ if (typeof window !== "undefined") {
433
+ const globalWindow = window;
434
+ if (!globalWindow.__principlemd_theme_context__) {
435
+ globalWindow.__principlemd_theme_context__ = createContext(void 0);
436
+ }
437
+ return globalWindow.__principlemd_theme_context__;
438
+ } else {
439
+ if (!ThemeContext) {
440
+ ThemeContext = createContext(void 0);
441
+ }
442
+ return ThemeContext;
443
+ }
444
+ };
445
+ var ThemeContextSingleton = getThemeContext();
446
+ var useTheme = () => {
447
+ const context = useContext(ThemeContextSingleton);
448
+ if (!context) {
449
+ throw new Error("useTheme must be used within a ThemeProvider");
450
+ }
451
+ return context;
452
+ };
453
+ var ThemeProvider = ({
454
+ children,
455
+ theme: customTheme = theme,
456
+ initialMode
457
+ }) => {
458
+ const [mode, setMode] = useState(initialMode);
459
+ const activeTheme = React2.useMemo(() => {
460
+ if (!mode || !customTheme.modes || !customTheme.modes[mode]) {
461
+ return customTheme;
462
+ }
463
+ return {
464
+ ...customTheme,
465
+ colors: getMode(customTheme, mode)
466
+ };
467
+ }, [customTheme, mode]);
468
+ useEffect(() => {
469
+ if (!initialMode) {
470
+ const savedMode = localStorage.getItem("principlemd-theme-mode");
471
+ if (savedMode) {
472
+ setMode(savedMode);
473
+ }
474
+ }
475
+ }, [initialMode]);
476
+ useEffect(() => {
477
+ if (mode) {
478
+ localStorage.setItem("principlemd-theme-mode", mode);
479
+ } else {
480
+ localStorage.removeItem("principlemd-theme-mode");
481
+ }
482
+ }, [mode]);
483
+ const value = {
484
+ theme: activeTheme,
485
+ mode,
486
+ setMode
487
+ };
488
+ return /* @__PURE__ */ React2.createElement(ThemeContextSingleton.Provider, {
489
+ value
490
+ }, children);
491
+ };
492
+ var theme = terminalTheme;
493
+ const EventBusPanelContent = ({
494
+ events,
495
+ maxEvents = 200
496
+ }) => {
497
+ const [capturedEvents, setCapturedEvents] = useState([]);
498
+ const [isPaused, setIsPaused] = useState(false);
499
+ const [filterType, setFilterType] = useState("");
500
+ const [filterSource, setFilterSource] = useState("");
501
+ const [showFilters, setShowFilters] = useState(false);
502
+ const eventIdRef = useRef(0);
503
+ const listRef = useRef(null);
504
+ const containerRef = useRef(null);
505
+ const isPausedRef = useRef(isPaused);
506
+ const [isNarrow, setIsNarrow] = useState(false);
507
+ const { theme: theme2 } = useTheme();
508
+ useEffect(() => {
509
+ const container = containerRef.current;
510
+ if (!container) return;
511
+ const observer = new ResizeObserver((entries) => {
512
+ var _a;
513
+ const width = ((_a = entries[0]) == null ? void 0 : _a.contentRect.width) || 0;
514
+ setIsNarrow(width < 400);
515
+ });
516
+ observer.observe(container);
517
+ return () => observer.disconnect();
518
+ }, []);
519
+ useEffect(() => {
520
+ isPausedRef.current = isPaused;
521
+ }, [isPaused]);
522
+ useEffect(() => {
523
+ const extendedEvents = events;
524
+ if (!(extendedEvents == null ? void 0 : extendedEvents.onAll)) return;
525
+ const unsubscribe = extendedEvents.onAll((event) => {
526
+ if (isPausedRef.current) return;
527
+ const id = ++eventIdRef.current;
528
+ setCapturedEvents((prev) => {
529
+ const newEvents = [...prev, { id, event, expanded: false }];
530
+ if (newEvents.length > maxEvents) {
531
+ return newEvents.slice(-maxEvents);
532
+ }
533
+ return newEvents;
534
+ });
535
+ });
536
+ return unsubscribe;
537
+ }, [events, maxEvents]);
538
+ useEffect(() => {
539
+ if (!isPaused && listRef.current) {
540
+ listRef.current.scrollTop = listRef.current.scrollHeight;
541
+ }
542
+ }, [capturedEvents, isPaused]);
543
+ const toggleExpanded = useCallback((id) => {
544
+ setCapturedEvents(
545
+ (prev) => prev.map((e) => e.id === id ? { ...e, expanded: !e.expanded } : e)
546
+ );
547
+ }, []);
548
+ const clearEvents = useCallback(() => {
549
+ setCapturedEvents([]);
550
+ }, []);
551
+ const clearFilters = useCallback(() => {
552
+ setFilterType("");
553
+ setFilterSource("");
554
+ }, []);
555
+ const hasActiveFilters = filterType || filterSource;
556
+ const filteredEvents = capturedEvents.filter((e) => {
557
+ if (filterType && !e.event.type.toLowerCase().includes(filterType.toLowerCase())) {
558
+ return false;
559
+ }
560
+ if (filterSource && !e.event.source.toLowerCase().includes(filterSource.toLowerCase())) {
561
+ return false;
562
+ }
563
+ return true;
564
+ });
565
+ const uniqueTypes = [...new Set(capturedEvents.map((e) => e.event.type))];
566
+ const uniqueSources = [...new Set(capturedEvents.map((e) => e.event.source))];
567
+ const getEventTypeColor = (type) => {
568
+ if (type.startsWith("panel:")) return theme2.colors.primary;
569
+ if (type.startsWith("file:")) return theme2.colors.success;
570
+ if (type.startsWith("repository:")) return theme2.colors.info;
571
+ if (type.startsWith("gemini:") || type.startsWith("ai:")) return theme2.colors.warning;
572
+ if (type.includes("error")) return theme2.colors.error;
573
+ return theme2.colors.textSecondary;
574
+ };
575
+ const formatTimestamp = (ts) => {
576
+ const date = new Date(ts);
577
+ const time = date.toLocaleTimeString("en-US", {
578
+ hour12: false,
579
+ hour: "2-digit",
580
+ minute: "2-digit",
581
+ second: "2-digit"
582
+ });
583
+ const ms = String(date.getMilliseconds()).padStart(3, "0");
584
+ return isNarrow ? `${time.slice(3)}` : `${time}.${ms}`;
585
+ };
586
+ const formatPayload = (payload) => {
587
+ try {
588
+ return JSON.stringify(payload, null, 2);
589
+ } catch {
590
+ return String(payload);
591
+ }
592
+ };
593
+ const buttonStyle = {
594
+ padding: isNarrow ? "6px 8px" : "6px 12px",
595
+ display: "flex",
596
+ alignItems: "center",
597
+ gap: "4px",
598
+ border: `1px solid ${theme2.colors.border}`,
599
+ borderRadius: theme2.radii[1],
600
+ background: theme2.colors.surface,
601
+ color: theme2.colors.text,
602
+ cursor: "pointer",
603
+ fontSize: theme2.fontSizes[1],
604
+ whiteSpace: "nowrap"
605
+ };
606
+ return /* @__PURE__ */ jsxs(
607
+ "div",
608
+ {
609
+ ref: containerRef,
610
+ style: {
611
+ height: "100%",
612
+ display: "flex",
613
+ flexDirection: "column",
614
+ fontFamily: theme2.fonts.body,
615
+ backgroundColor: theme2.colors.background,
616
+ color: theme2.colors.text,
617
+ minWidth: 0
618
+ },
619
+ children: [
620
+ /* @__PURE__ */ jsxs(
621
+ "div",
622
+ {
623
+ style: {
624
+ padding: isNarrow ? "8px 12px" : "12px 16px",
625
+ borderBottom: `1px solid ${theme2.colors.border}`,
626
+ display: "flex",
627
+ alignItems: "center",
628
+ gap: "8px",
629
+ flexShrink: 0,
630
+ minWidth: 0
631
+ },
632
+ children: [
633
+ /* @__PURE__ */ jsx(Activity, { size: isNarrow ? 16 : 20, color: theme2.colors.primary, style: { flexShrink: 0 } }),
634
+ !isNarrow && /* @__PURE__ */ jsx(
635
+ "h2",
636
+ {
637
+ style: {
638
+ margin: 0,
639
+ fontSize: theme2.fontSizes[3],
640
+ fontWeight: theme2.fontWeights.semibold,
641
+ whiteSpace: "nowrap"
642
+ },
643
+ children: "Event Bus"
644
+ }
645
+ ),
646
+ /* @__PURE__ */ jsxs(
647
+ "span",
648
+ {
649
+ style: {
650
+ marginLeft: "auto",
651
+ fontSize: theme2.fontSizes[1],
652
+ color: theme2.colors.textMuted,
653
+ whiteSpace: "nowrap"
654
+ },
655
+ children: [
656
+ filteredEvents.length,
657
+ !isNarrow && ` / ${capturedEvents.length}`
658
+ ]
659
+ }
660
+ )
661
+ ]
662
+ }
663
+ ),
664
+ /* @__PURE__ */ jsxs(
665
+ "div",
666
+ {
667
+ style: {
668
+ padding: isNarrow ? "6px 8px" : "8px 16px",
669
+ borderBottom: `1px solid ${theme2.colors.border}`,
670
+ display: "flex",
671
+ alignItems: "center",
672
+ gap: "6px",
673
+ flexShrink: 0,
674
+ flexWrap: "wrap"
675
+ },
676
+ children: [
677
+ /* @__PURE__ */ jsxs(
678
+ "button",
679
+ {
680
+ onClick: () => setIsPaused(!isPaused),
681
+ style: {
682
+ ...buttonStyle,
683
+ border: `1px solid ${isPaused ? theme2.colors.warning : theme2.colors.border}`,
684
+ background: isPaused ? theme2.colors.warning : theme2.colors.surface,
685
+ color: isPaused ? theme2.colors.background : theme2.colors.text
686
+ },
687
+ title: isPaused ? "Resume" : "Pause",
688
+ children: [
689
+ isPaused ? /* @__PURE__ */ jsx(Play, { size: 14 }) : /* @__PURE__ */ jsx(Pause, { size: 14 }),
690
+ !isNarrow && (isPaused ? "Resume" : "Pause")
691
+ ]
692
+ }
693
+ ),
694
+ /* @__PURE__ */ jsxs(
695
+ "button",
696
+ {
697
+ onClick: clearEvents,
698
+ style: buttonStyle,
699
+ title: "Clear events",
700
+ children: [
701
+ /* @__PURE__ */ jsx(Trash2, { size: 14 }),
702
+ !isNarrow && "Clear"
703
+ ]
704
+ }
705
+ ),
706
+ /* @__PURE__ */ jsx("div", { style: { flex: 1, minWidth: "8px" } }),
707
+ isNarrow ? /* @__PURE__ */ jsxs(
708
+ "button",
709
+ {
710
+ onClick: () => setShowFilters(!showFilters),
711
+ style: {
712
+ ...buttonStyle,
713
+ border: `1px solid ${hasActiveFilters ? theme2.colors.primary : theme2.colors.border}`,
714
+ background: hasActiveFilters ? `${theme2.colors.primary}20` : theme2.colors.surface
715
+ },
716
+ title: "Toggle filters",
717
+ children: [
718
+ /* @__PURE__ */ jsx(Funnel, { size: 14, color: hasActiveFilters ? theme2.colors.primary : theme2.colors.textMuted }),
719
+ hasActiveFilters && /* @__PURE__ */ jsx("span", { style: {
720
+ width: "6px",
721
+ height: "6px",
722
+ borderRadius: "50%",
723
+ background: theme2.colors.primary
724
+ } })
725
+ ]
726
+ }
727
+ ) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
728
+ /* @__PURE__ */ jsx(Funnel, { size: 14, color: theme2.colors.textMuted }),
729
+ /* @__PURE__ */ jsx(
730
+ "input",
731
+ {
732
+ type: "text",
733
+ placeholder: "Type...",
734
+ value: filterType,
735
+ onChange: (e) => setFilterType(e.target.value),
736
+ list: "event-types",
737
+ style: {
738
+ padding: "4px 8px",
739
+ border: `1px solid ${theme2.colors.border}`,
740
+ borderRadius: theme2.radii[1],
741
+ background: theme2.colors.surface,
742
+ color: theme2.colors.text,
743
+ fontSize: theme2.fontSizes[1],
744
+ width: "100px",
745
+ minWidth: 0
746
+ }
747
+ }
748
+ ),
749
+ /* @__PURE__ */ jsx("datalist", { id: "event-types", children: uniqueTypes.map((type) => /* @__PURE__ */ jsx("option", { value: type }, type)) }),
750
+ /* @__PURE__ */ jsx(
751
+ "input",
752
+ {
753
+ type: "text",
754
+ placeholder: "Source...",
755
+ value: filterSource,
756
+ onChange: (e) => setFilterSource(e.target.value),
757
+ list: "event-sources",
758
+ style: {
759
+ padding: "4px 8px",
760
+ border: `1px solid ${theme2.colors.border}`,
761
+ borderRadius: theme2.radii[1],
762
+ background: theme2.colors.surface,
763
+ color: theme2.colors.text,
764
+ fontSize: theme2.fontSizes[1],
765
+ width: "100px",
766
+ minWidth: 0
767
+ }
768
+ }
769
+ ),
770
+ /* @__PURE__ */ jsx("datalist", { id: "event-sources", children: uniqueSources.map((source) => /* @__PURE__ */ jsx("option", { value: source }, source)) }),
771
+ hasActiveFilters && /* @__PURE__ */ jsx(
772
+ "button",
773
+ {
774
+ onClick: clearFilters,
775
+ style: {
776
+ ...buttonStyle,
777
+ padding: "4px 6px"
778
+ },
779
+ title: "Clear filters",
780
+ children: /* @__PURE__ */ jsx(X, { size: 12 })
781
+ }
782
+ )
783
+ ] })
784
+ ]
785
+ }
786
+ ),
787
+ isNarrow && showFilters && /* @__PURE__ */ jsxs(
788
+ "div",
789
+ {
790
+ style: {
791
+ padding: "8px",
792
+ borderBottom: `1px solid ${theme2.colors.border}`,
793
+ display: "flex",
794
+ flexDirection: "column",
795
+ gap: "6px",
796
+ background: theme2.colors.backgroundSecondary
797
+ },
798
+ children: [
799
+ /* @__PURE__ */ jsx(
800
+ "input",
801
+ {
802
+ type: "text",
803
+ placeholder: "Filter by type...",
804
+ value: filterType,
805
+ onChange: (e) => setFilterType(e.target.value),
806
+ list: "event-types-narrow",
807
+ style: {
808
+ padding: "6px 8px",
809
+ border: `1px solid ${theme2.colors.border}`,
810
+ borderRadius: theme2.radii[1],
811
+ background: theme2.colors.surface,
812
+ color: theme2.colors.text,
813
+ fontSize: theme2.fontSizes[1],
814
+ width: "100%"
815
+ }
816
+ }
817
+ ),
818
+ /* @__PURE__ */ jsx("datalist", { id: "event-types-narrow", children: uniqueTypes.map((type) => /* @__PURE__ */ jsx("option", { value: type }, type)) }),
819
+ /* @__PURE__ */ jsx(
820
+ "input",
821
+ {
822
+ type: "text",
823
+ placeholder: "Filter by source...",
824
+ value: filterSource,
825
+ onChange: (e) => setFilterSource(e.target.value),
826
+ list: "event-sources-narrow",
827
+ style: {
828
+ padding: "6px 8px",
829
+ border: `1px solid ${theme2.colors.border}`,
830
+ borderRadius: theme2.radii[1],
831
+ background: theme2.colors.surface,
832
+ color: theme2.colors.text,
833
+ fontSize: theme2.fontSizes[1],
834
+ width: "100%"
835
+ }
836
+ }
837
+ ),
838
+ /* @__PURE__ */ jsx("datalist", { id: "event-sources-narrow", children: uniqueSources.map((source) => /* @__PURE__ */ jsx("option", { value: source }, source)) }),
839
+ hasActiveFilters && /* @__PURE__ */ jsxs(
840
+ "button",
841
+ {
842
+ onClick: clearFilters,
843
+ style: {
844
+ ...buttonStyle,
845
+ justifyContent: "center",
846
+ width: "100%"
847
+ },
848
+ children: [
849
+ /* @__PURE__ */ jsx(X, { size: 12 }),
850
+ "Clear Filters"
851
+ ]
852
+ }
853
+ )
854
+ ]
855
+ }
856
+ ),
857
+ /* @__PURE__ */ jsx(
858
+ "div",
859
+ {
860
+ ref: listRef,
861
+ style: {
862
+ flex: 1,
863
+ overflowY: "auto",
864
+ overflowX: "hidden",
865
+ padding: isNarrow ? "4px" : "8px",
866
+ fontFamily: theme2.fonts.monospace,
867
+ fontSize: theme2.fontSizes[1]
868
+ },
869
+ children: filteredEvents.length === 0 ? /* @__PURE__ */ jsx(
870
+ "div",
871
+ {
872
+ style: {
873
+ padding: "24px 12px",
874
+ textAlign: "center",
875
+ color: theme2.colors.textMuted
876
+ },
877
+ children: capturedEvents.length === 0 ? "Waiting for events..." : "No events match your filter"
878
+ }
879
+ ) : filteredEvents.map((captured) => /* @__PURE__ */ jsxs(
880
+ "div",
881
+ {
882
+ style: {
883
+ marginBottom: "4px",
884
+ borderRadius: theme2.radii[1],
885
+ border: `1px solid ${theme2.colors.border}`,
886
+ background: theme2.colors.surface,
887
+ overflow: "hidden"
888
+ },
889
+ children: [
890
+ /* @__PURE__ */ jsxs(
891
+ "div",
892
+ {
893
+ onClick: () => toggleExpanded(captured.id),
894
+ style: {
895
+ padding: isNarrow ? "6px 8px" : "8px 12px",
896
+ display: "flex",
897
+ alignItems: "flex-start",
898
+ gap: "6px",
899
+ cursor: "pointer",
900
+ userSelect: "none",
901
+ flexWrap: isNarrow ? "wrap" : "nowrap"
902
+ },
903
+ children: [
904
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexShrink: 0 }, children: [
905
+ captured.expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14, color: theme2.colors.textMuted }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14, color: theme2.colors.textMuted }),
906
+ /* @__PURE__ */ jsx("span", { style: { color: theme2.colors.textMuted, fontSize: theme2.fontSizes[0] }, children: formatTimestamp(captured.event.timestamp) })
907
+ ] }),
908
+ /* @__PURE__ */ jsxs("div", { style: {
909
+ flex: 1,
910
+ minWidth: 0,
911
+ display: "flex",
912
+ flexDirection: isNarrow ? "column" : "row",
913
+ alignItems: isNarrow ? "flex-start" : "center",
914
+ gap: isNarrow ? "2px" : "6px"
915
+ }, children: [
916
+ /* @__PURE__ */ jsx(
917
+ "span",
918
+ {
919
+ style: {
920
+ color: getEventTypeColor(captured.event.type),
921
+ fontWeight: theme2.fontWeights.medium,
922
+ overflow: "hidden",
923
+ textOverflow: "ellipsis",
924
+ whiteSpace: "nowrap",
925
+ maxWidth: "100%"
926
+ },
927
+ title: captured.event.type,
928
+ children: captured.event.type
929
+ }
930
+ ),
931
+ !isNarrow && /* @__PURE__ */ jsx("span", { style: { color: theme2.colors.textMuted }, children: "from" }),
932
+ /* @__PURE__ */ jsx(
933
+ "span",
934
+ {
935
+ style: {
936
+ color: theme2.colors.info,
937
+ fontSize: isNarrow ? theme2.fontSizes[0] : theme2.fontSizes[1],
938
+ overflow: "hidden",
939
+ textOverflow: "ellipsis",
940
+ whiteSpace: "nowrap"
941
+ },
942
+ title: captured.event.source,
943
+ children: isNarrow ? `← ${captured.event.source}` : captured.event.source
944
+ }
945
+ )
946
+ ] })
947
+ ]
948
+ }
949
+ ),
950
+ captured.expanded && /* @__PURE__ */ jsx(
951
+ "div",
952
+ {
953
+ style: {
954
+ padding: isNarrow ? "6px 8px" : "8px 12px",
955
+ borderTop: `1px solid ${theme2.colors.border}`,
956
+ background: theme2.colors.background,
957
+ overflow: "auto",
958
+ maxHeight: "200px"
959
+ },
960
+ children: /* @__PURE__ */ jsx(
961
+ "pre",
962
+ {
963
+ style: {
964
+ margin: 0,
965
+ whiteSpace: "pre-wrap",
966
+ wordBreak: "break-word",
967
+ color: theme2.colors.textSecondary,
968
+ fontSize: theme2.fontSizes[0]
969
+ },
970
+ children: formatPayload(captured.event.payload)
971
+ }
972
+ )
973
+ }
974
+ )
975
+ ]
976
+ },
977
+ captured.id
978
+ ))
979
+ }
980
+ ),
981
+ isPaused && /* @__PURE__ */ jsxs(
982
+ "div",
983
+ {
984
+ style: {
985
+ padding: isNarrow ? "6px 12px" : "8px 16px",
986
+ borderTop: `1px solid ${theme2.colors.warning}`,
987
+ background: `${theme2.colors.warning}20`,
988
+ color: theme2.colors.warning,
989
+ fontSize: theme2.fontSizes[1],
990
+ textAlign: "center",
991
+ flexShrink: 0
992
+ },
993
+ children: [
994
+ "⏸ ",
995
+ isNarrow ? "Paused" : "Event capture paused"
996
+ ]
997
+ }
998
+ )
999
+ ]
1000
+ }
1001
+ );
1002
+ };
1003
+ const EventBusPanel = (props) => {
1004
+ return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(EventBusPanelContent, { ...props }) });
1005
+ };
1006
+ const CapabilityBadge = ({
1007
+ name,
1008
+ enabled,
1009
+ compact
1010
+ }) => {
1011
+ const { theme: theme2 } = useTheme();
1012
+ if (!enabled) return null;
1013
+ const formatName = (n) => n.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
1014
+ return /* @__PURE__ */ jsx(
1015
+ "span",
1016
+ {
1017
+ style: {
1018
+ padding: compact ? "1px 6px" : "2px 8px",
1019
+ fontSize: theme2.fontSizes[0],
1020
+ borderRadius: theme2.radii[1],
1021
+ background: `${theme2.colors.primary}20`,
1022
+ color: theme2.colors.primary,
1023
+ border: `1px solid ${theme2.colors.primary}40`,
1024
+ whiteSpace: "nowrap"
1025
+ },
1026
+ children: formatName(name)
1027
+ }
1028
+ );
1029
+ };
1030
+ const SchemaView = ({
1031
+ schema,
1032
+ label
1033
+ }) => {
1034
+ const { theme: theme2 } = useTheme();
1035
+ if (!schema || Object.keys(schema).length === 0) {
1036
+ return /* @__PURE__ */ jsxs("div", { style: { color: theme2.colors.textMuted, fontStyle: "italic", fontSize: theme2.fontSizes[0] }, children: [
1037
+ "No ",
1038
+ label.toLowerCase(),
1039
+ " schema defined"
1040
+ ] });
1041
+ }
1042
+ return /* @__PURE__ */ jsxs("div", { children: [
1043
+ /* @__PURE__ */ jsx(
1044
+ "div",
1045
+ {
1046
+ style: {
1047
+ fontSize: theme2.fontSizes[0],
1048
+ color: theme2.colors.textMuted,
1049
+ marginBottom: "4px",
1050
+ textTransform: "uppercase",
1051
+ letterSpacing: "0.5px"
1052
+ },
1053
+ children: label
1054
+ }
1055
+ ),
1056
+ /* @__PURE__ */ jsx(
1057
+ "pre",
1058
+ {
1059
+ style: {
1060
+ margin: 0,
1061
+ padding: "6px 8px",
1062
+ background: theme2.colors.background,
1063
+ borderRadius: theme2.radii[1],
1064
+ border: `1px solid ${theme2.colors.border}`,
1065
+ fontSize: theme2.fontSizes[0],
1066
+ fontFamily: theme2.fonts.monospace,
1067
+ color: theme2.colors.textSecondary,
1068
+ overflow: "auto",
1069
+ maxHeight: "150px",
1070
+ whiteSpace: "pre-wrap",
1071
+ wordBreak: "break-word"
1072
+ },
1073
+ children: JSON.stringify(schema, null, 2)
1074
+ }
1075
+ )
1076
+ ] });
1077
+ };
1078
+ const ToolItem = ({
1079
+ tool,
1080
+ index,
1081
+ isNarrow
1082
+ }) => {
1083
+ const [expanded, setExpanded] = useState(false);
1084
+ const { theme: theme2 } = useTheme();
1085
+ return /* @__PURE__ */ jsxs(
1086
+ "div",
1087
+ {
1088
+ style: {
1089
+ borderRadius: theme2.radii[1],
1090
+ border: `1px solid ${theme2.colors.border}`,
1091
+ background: theme2.colors.surface,
1092
+ overflow: "hidden"
1093
+ },
1094
+ children: [
1095
+ /* @__PURE__ */ jsxs(
1096
+ "div",
1097
+ {
1098
+ onClick: () => setExpanded(!expanded),
1099
+ style: {
1100
+ padding: isNarrow ? "8px 10px" : "12px",
1101
+ display: "flex",
1102
+ alignItems: "flex-start",
1103
+ gap: "6px",
1104
+ cursor: "pointer",
1105
+ userSelect: "none"
1106
+ },
1107
+ children: [
1108
+ expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14, color: theme2.colors.textMuted, style: { marginTop: "2px", flexShrink: 0 } }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14, color: theme2.colors.textMuted, style: { marginTop: "2px", flexShrink: 0 } }),
1109
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
1110
+ /* @__PURE__ */ jsxs("div", { style: {
1111
+ display: "flex",
1112
+ alignItems: "center",
1113
+ gap: "6px",
1114
+ flexWrap: "wrap"
1115
+ }, children: [
1116
+ /* @__PURE__ */ jsx(
1117
+ "span",
1118
+ {
1119
+ style: {
1120
+ fontFamily: theme2.fonts.monospace,
1121
+ fontWeight: theme2.fontWeights.medium,
1122
+ color: theme2.colors.text,
1123
+ fontSize: isNarrow ? theme2.fontSizes[1] : theme2.fontSizes[2],
1124
+ wordBreak: "break-word"
1125
+ },
1126
+ children: tool.name
1127
+ }
1128
+ ),
1129
+ /* @__PURE__ */ jsxs(
1130
+ "span",
1131
+ {
1132
+ style: {
1133
+ fontSize: theme2.fontSizes[0],
1134
+ color: theme2.colors.textMuted,
1135
+ background: theme2.colors.backgroundSecondary,
1136
+ padding: "1px 5px",
1137
+ borderRadius: theme2.radii[0],
1138
+ flexShrink: 0
1139
+ },
1140
+ children: [
1141
+ "#",
1142
+ index + 1
1143
+ ]
1144
+ }
1145
+ )
1146
+ ] }),
1147
+ /* @__PURE__ */ jsx(
1148
+ "div",
1149
+ {
1150
+ style: {
1151
+ fontSize: isNarrow ? theme2.fontSizes[0] : theme2.fontSizes[1],
1152
+ color: theme2.colors.textSecondary,
1153
+ marginTop: "4px",
1154
+ lineHeight: 1.4
1155
+ },
1156
+ children: tool.description
1157
+ }
1158
+ ),
1159
+ tool.tags && tool.tags.length > 0 && /* @__PURE__ */ jsxs(
1160
+ "div",
1161
+ {
1162
+ style: {
1163
+ display: "flex",
1164
+ gap: "4px",
1165
+ marginTop: "6px",
1166
+ flexWrap: "wrap"
1167
+ },
1168
+ children: [
1169
+ tool.tags.slice(0, isNarrow ? 3 : void 0).map((tag) => /* @__PURE__ */ jsxs(
1170
+ "span",
1171
+ {
1172
+ style: {
1173
+ display: "flex",
1174
+ alignItems: "center",
1175
+ gap: "2px",
1176
+ padding: "1px 5px",
1177
+ fontSize: theme2.fontSizes[0],
1178
+ background: theme2.colors.backgroundSecondary,
1179
+ color: theme2.colors.textMuted,
1180
+ borderRadius: theme2.radii[0]
1181
+ },
1182
+ children: [
1183
+ /* @__PURE__ */ jsx(Tag, { size: 8 }),
1184
+ tag
1185
+ ]
1186
+ },
1187
+ tag
1188
+ )),
1189
+ isNarrow && tool.tags.length > 3 && /* @__PURE__ */ jsxs(
1190
+ "span",
1191
+ {
1192
+ style: {
1193
+ fontSize: theme2.fontSizes[0],
1194
+ color: theme2.colors.textMuted
1195
+ },
1196
+ children: [
1197
+ "+",
1198
+ tool.tags.length - 3
1199
+ ]
1200
+ }
1201
+ )
1202
+ ]
1203
+ }
1204
+ )
1205
+ ] })
1206
+ ]
1207
+ }
1208
+ ),
1209
+ expanded && /* @__PURE__ */ jsxs(
1210
+ "div",
1211
+ {
1212
+ style: {
1213
+ padding: isNarrow ? "8px 10px" : "12px",
1214
+ borderTop: `1px solid ${theme2.colors.border}`,
1215
+ display: "flex",
1216
+ flexDirection: "column",
1217
+ gap: "10px"
1218
+ },
1219
+ children: [
1220
+ /* @__PURE__ */ jsx(
1221
+ SchemaView,
1222
+ {
1223
+ schema: tool.inputs,
1224
+ label: "Input Schema"
1225
+ }
1226
+ ),
1227
+ /* @__PURE__ */ jsx(
1228
+ SchemaView,
1229
+ {
1230
+ schema: tool.outputs,
1231
+ label: "Output Schema"
1232
+ }
1233
+ )
1234
+ ]
1235
+ }
1236
+ )
1237
+ ]
1238
+ }
1239
+ );
1240
+ };
1241
+ const AgentToolsPanelContent = ({
1242
+ agentConfig
1243
+ }) => {
1244
+ const { theme: theme2 } = useTheme();
1245
+ const containerRef = useRef(null);
1246
+ const [isNarrow, setIsNarrow] = useState(false);
1247
+ const [activeTab, setActiveTab] = useState("prompt");
1248
+ useEffect(() => {
1249
+ const container = containerRef.current;
1250
+ if (!container) return;
1251
+ const observer = new ResizeObserver((entries) => {
1252
+ var _a;
1253
+ const width = ((_a = entries[0]) == null ? void 0 : _a.contentRect.width) || 0;
1254
+ setIsNarrow(width < 350);
1255
+ });
1256
+ observer.observe(container);
1257
+ return () => observer.disconnect();
1258
+ }, []);
1259
+ const config = agentConfig || {
1260
+ id: "no-agent",
1261
+ name: "No Agent Loaded",
1262
+ description: "Connect an agent to view its tools and configuration.",
1263
+ tools: []
1264
+ };
1265
+ const tools = config.tools || [];
1266
+ const capabilities = config.capabilities || {};
1267
+ const enabledCapabilities = Object.entries(capabilities).filter(
1268
+ ([, enabled]) => enabled
1269
+ );
1270
+ return /* @__PURE__ */ jsxs(
1271
+ "div",
1272
+ {
1273
+ ref: containerRef,
1274
+ style: {
1275
+ height: "100%",
1276
+ display: "flex",
1277
+ flexDirection: "column",
1278
+ fontFamily: theme2.fonts.body,
1279
+ backgroundColor: theme2.colors.background,
1280
+ color: theme2.colors.text,
1281
+ minWidth: 0
1282
+ },
1283
+ children: [
1284
+ /* @__PURE__ */ jsxs(
1285
+ "div",
1286
+ {
1287
+ style: {
1288
+ padding: isNarrow ? "12px" : "16px",
1289
+ borderBottom: `1px solid ${theme2.colors.border}`,
1290
+ flexShrink: 0
1291
+ },
1292
+ children: [
1293
+ /* @__PURE__ */ jsxs("div", { style: {
1294
+ display: "flex",
1295
+ alignItems: "center",
1296
+ gap: isNarrow ? "8px" : "12px"
1297
+ }, children: [
1298
+ /* @__PURE__ */ jsx(
1299
+ "div",
1300
+ {
1301
+ style: {
1302
+ width: isNarrow ? "32px" : "40px",
1303
+ height: isNarrow ? "32px" : "40px",
1304
+ borderRadius: theme2.radii[2],
1305
+ background: theme2.colors.primary,
1306
+ display: "flex",
1307
+ alignItems: "center",
1308
+ justifyContent: "center",
1309
+ fontSize: isNarrow ? "16px" : "20px",
1310
+ flexShrink: 0,
1311
+ color: theme2.colors.background
1312
+ },
1313
+ children: config.icon || /* @__PURE__ */ jsx(Cpu, { size: isNarrow ? 16 : 20, color: theme2.colors.background })
1314
+ }
1315
+ ),
1316
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
1317
+ /* @__PURE__ */ jsx(
1318
+ "h2",
1319
+ {
1320
+ style: {
1321
+ margin: 0,
1322
+ fontSize: isNarrow ? theme2.fontSizes[3] : theme2.fontSizes[4],
1323
+ fontWeight: theme2.fontWeights.semibold,
1324
+ wordBreak: "break-word"
1325
+ },
1326
+ children: config.name
1327
+ }
1328
+ ),
1329
+ config.version && /* @__PURE__ */ jsxs(
1330
+ "span",
1331
+ {
1332
+ style: {
1333
+ fontSize: theme2.fontSizes[0],
1334
+ color: theme2.colors.textMuted
1335
+ },
1336
+ children: [
1337
+ "v",
1338
+ config.version
1339
+ ]
1340
+ }
1341
+ )
1342
+ ] })
1343
+ ] }),
1344
+ /* @__PURE__ */ jsx(
1345
+ "p",
1346
+ {
1347
+ style: {
1348
+ margin: "8px 0 0 0",
1349
+ fontSize: isNarrow ? theme2.fontSizes[1] : theme2.fontSizes[2],
1350
+ color: theme2.colors.textSecondary,
1351
+ lineHeight: 1.4
1352
+ },
1353
+ children: config.description
1354
+ }
1355
+ ),
1356
+ enabledCapabilities.length > 0 && /* @__PURE__ */ jsx(
1357
+ "div",
1358
+ {
1359
+ style: {
1360
+ display: "flex",
1361
+ gap: "4px",
1362
+ marginTop: "10px",
1363
+ flexWrap: "wrap"
1364
+ },
1365
+ children: enabledCapabilities.map(([name, enabled]) => /* @__PURE__ */ jsx(CapabilityBadge, { name, enabled: !!enabled, compact: isNarrow }, name))
1366
+ }
1367
+ )
1368
+ ]
1369
+ }
1370
+ ),
1371
+ /* @__PURE__ */ jsxs(
1372
+ "div",
1373
+ {
1374
+ style: {
1375
+ display: "flex",
1376
+ borderBottom: `1px solid ${theme2.colors.border}`,
1377
+ flexShrink: 0
1378
+ },
1379
+ children: [
1380
+ /* @__PURE__ */ jsxs(
1381
+ "button",
1382
+ {
1383
+ onClick: () => setActiveTab("prompt"),
1384
+ style: {
1385
+ flex: 1,
1386
+ padding: isNarrow ? "8px 12px" : "10px 16px",
1387
+ background: "transparent",
1388
+ border: "none",
1389
+ borderBottom: activeTab === "prompt" ? `2px solid ${theme2.colors.primary}` : "2px solid transparent",
1390
+ color: activeTab === "prompt" ? theme2.colors.text : theme2.colors.textMuted,
1391
+ fontSize: isNarrow ? theme2.fontSizes[1] : theme2.fontSizes[2],
1392
+ fontWeight: theme2.fontWeights.medium,
1393
+ cursor: "pointer",
1394
+ display: "flex",
1395
+ alignItems: "center",
1396
+ justifyContent: "center",
1397
+ gap: "6px",
1398
+ fontFamily: theme2.fonts.body
1399
+ },
1400
+ children: [
1401
+ /* @__PURE__ */ jsx(FileText, { size: 14 }),
1402
+ "Prompt"
1403
+ ]
1404
+ }
1405
+ ),
1406
+ /* @__PURE__ */ jsxs(
1407
+ "button",
1408
+ {
1409
+ onClick: () => setActiveTab("tools"),
1410
+ style: {
1411
+ flex: 1,
1412
+ padding: isNarrow ? "8px 12px" : "10px 16px",
1413
+ background: "transparent",
1414
+ border: "none",
1415
+ borderBottom: activeTab === "tools" ? `2px solid ${theme2.colors.primary}` : "2px solid transparent",
1416
+ color: activeTab === "tools" ? theme2.colors.text : theme2.colors.textMuted,
1417
+ fontSize: isNarrow ? theme2.fontSizes[1] : theme2.fontSizes[2],
1418
+ fontWeight: theme2.fontWeights.medium,
1419
+ cursor: "pointer",
1420
+ display: "flex",
1421
+ alignItems: "center",
1422
+ justifyContent: "center",
1423
+ gap: "6px",
1424
+ fontFamily: theme2.fonts.body
1425
+ },
1426
+ children: [
1427
+ /* @__PURE__ */ jsx(Wrench, { size: 14 }),
1428
+ "Tools",
1429
+ /* @__PURE__ */ jsx(
1430
+ "span",
1431
+ {
1432
+ style: {
1433
+ fontSize: theme2.fontSizes[0],
1434
+ color: theme2.colors.textMuted,
1435
+ background: theme2.colors.backgroundSecondary,
1436
+ padding: "1px 5px",
1437
+ borderRadius: theme2.radii[0]
1438
+ },
1439
+ children: tools.length
1440
+ }
1441
+ )
1442
+ ]
1443
+ }
1444
+ )
1445
+ ]
1446
+ }
1447
+ ),
1448
+ /* @__PURE__ */ jsxs(
1449
+ "div",
1450
+ {
1451
+ style: {
1452
+ flex: 1,
1453
+ overflowY: "auto",
1454
+ overflowX: "hidden"
1455
+ },
1456
+ children: [
1457
+ activeTab === "prompt" && /* @__PURE__ */ jsxs(
1458
+ "div",
1459
+ {
1460
+ style: {
1461
+ padding: isNarrow ? "12px" : "16px",
1462
+ display: "flex",
1463
+ flexDirection: "column",
1464
+ gap: "12px"
1465
+ },
1466
+ children: [
1467
+ config.instructions ? /* @__PURE__ */ jsx(
1468
+ "div",
1469
+ {
1470
+ style: {
1471
+ fontSize: theme2.fontSizes[1],
1472
+ color: theme2.colors.textSecondary,
1473
+ lineHeight: 1.6,
1474
+ whiteSpace: "pre-wrap",
1475
+ fontFamily: theme2.fonts.body
1476
+ },
1477
+ children: config.instructions
1478
+ }
1479
+ ) : /* @__PURE__ */ jsx(
1480
+ "div",
1481
+ {
1482
+ style: {
1483
+ padding: "20px 12px",
1484
+ textAlign: "center",
1485
+ color: theme2.colors.textMuted,
1486
+ fontSize: theme2.fontSizes[1]
1487
+ },
1488
+ children: "No system prompt defined"
1489
+ }
1490
+ ),
1491
+ config.systemPromptRef && /* @__PURE__ */ jsxs(
1492
+ "div",
1493
+ {
1494
+ style: {
1495
+ padding: isNarrow ? "8px 12px" : "10px 16px",
1496
+ background: theme2.colors.surface,
1497
+ borderRadius: theme2.radii[1],
1498
+ border: `1px solid ${theme2.colors.border}`,
1499
+ fontSize: theme2.fontSizes[1]
1500
+ },
1501
+ children: [
1502
+ /* @__PURE__ */ jsx(
1503
+ "div",
1504
+ {
1505
+ style: {
1506
+ fontSize: theme2.fontSizes[0],
1507
+ color: theme2.colors.textMuted,
1508
+ marginBottom: "4px",
1509
+ textTransform: "uppercase",
1510
+ letterSpacing: "0.5px"
1511
+ },
1512
+ children: "Source"
1513
+ }
1514
+ ),
1515
+ /* @__PURE__ */ jsx(
1516
+ "div",
1517
+ {
1518
+ style: {
1519
+ fontFamily: theme2.fonts.monospace,
1520
+ color: theme2.colors.text,
1521
+ wordBreak: "break-all"
1522
+ },
1523
+ children: config.systemPromptRef.uri
1524
+ }
1525
+ ),
1526
+ config.systemPromptRef.label && /* @__PURE__ */ jsx(
1527
+ "div",
1528
+ {
1529
+ style: {
1530
+ marginTop: "4px",
1531
+ color: theme2.colors.textMuted
1532
+ },
1533
+ children: config.systemPromptRef.label
1534
+ }
1535
+ )
1536
+ ]
1537
+ }
1538
+ )
1539
+ ]
1540
+ }
1541
+ ),
1542
+ activeTab === "tools" && /* @__PURE__ */ jsx(
1543
+ "div",
1544
+ {
1545
+ style: {
1546
+ padding: isNarrow ? "8px" : "12px 16px",
1547
+ display: "flex",
1548
+ flexDirection: "column",
1549
+ gap: "6px"
1550
+ },
1551
+ children: tools.length === 0 ? /* @__PURE__ */ jsx(
1552
+ "div",
1553
+ {
1554
+ style: {
1555
+ padding: "20px 12px",
1556
+ textAlign: "center",
1557
+ color: theme2.colors.textMuted,
1558
+ fontSize: theme2.fontSizes[1]
1559
+ },
1560
+ children: "No tools defined"
1561
+ }
1562
+ ) : tools.map((tool, index) => /* @__PURE__ */ jsx(ToolItem, { tool, index, isNarrow }, tool.name))
1563
+ }
1564
+ )
1565
+ ]
1566
+ }
1567
+ ),
1568
+ /* @__PURE__ */ jsx(
1569
+ "div",
1570
+ {
1571
+ style: {
1572
+ padding: isNarrow ? "6px 12px" : "8px 16px",
1573
+ borderTop: `1px solid ${theme2.colors.border}`,
1574
+ fontSize: theme2.fontSizes[0],
1575
+ color: theme2.colors.textMuted,
1576
+ fontFamily: theme2.fonts.monospace,
1577
+ flexShrink: 0,
1578
+ overflow: "hidden",
1579
+ textOverflow: "ellipsis",
1580
+ whiteSpace: "nowrap"
1581
+ },
1582
+ title: config.id,
1583
+ children: config.id
1584
+ }
1585
+ )
1586
+ ]
1587
+ }
1588
+ );
1589
+ };
1590
+ const AgentToolsPanel = (props) => {
1591
+ return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(AgentToolsPanelContent, { ...props }) });
1592
+ };
1593
+ const panels = [
1594
+ {
1595
+ metadata: {
1596
+ id: "industry-theme.event-bus-panel",
1597
+ name: "Event Bus",
1598
+ icon: "radio",
1599
+ version: "0.1.0",
1600
+ author: "Industry Theme",
1601
+ description: "Real-time event bus monitor showing all events flowing through the panel system",
1602
+ slices: [],
1603
+ tools: []
1604
+ },
1605
+ component: EventBusPanel
1606
+ },
1607
+ {
1608
+ metadata: {
1609
+ id: "industry-theme.agent-tools-panel",
1610
+ name: "Agent Tools",
1611
+ icon: "wrench",
1612
+ version: "0.1.0",
1613
+ author: "Industry Theme",
1614
+ description: "Displays agent configuration, capabilities, and available tools with their schemas",
1615
+ slices: [],
1616
+ tools: []
1617
+ },
1618
+ component: AgentToolsPanel
1619
+ }
1620
+ ];
1621
+ const onPackageLoad = async () => {
1622
+ console.log("Agent Driven UI Panels loaded");
1623
+ };
1624
+ const onPackageUnload = async () => {
1625
+ console.log("Agent Driven UI Panels unloading");
1626
+ };
1627
+ export {
1628
+ AgentToolsPanel,
1629
+ EventBusPanel,
1630
+ onPackageLoad,
1631
+ onPackageUnload,
1632
+ panels
1633
+ };
1634
+ //# sourceMappingURL=panels.bundle.js.map