@echothink-ui/agent 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.
Files changed (56) hide show
  1. package/README.md +5 -0
  2. package/dist/components/AgentApprovalGate.d.ts +10 -0
  3. package/dist/components/AgentContextViewer.d.ts +7 -0
  4. package/dist/components/AgentGeneratedArtifactPanel.d.ts +8 -0
  5. package/dist/components/AgentHandoffPanel.d.ts +22 -0
  6. package/dist/components/AgentInterruptionPanel.d.ts +13 -0
  7. package/dist/components/AgentMemoryPanel.d.ts +9 -0
  8. package/dist/components/AgentMessageList.d.ts +8 -0
  9. package/dist/components/AgentPlanDiff.d.ts +7 -0
  10. package/dist/components/AgentPlanPreview.d.ts +6 -0
  11. package/dist/components/AgentPromptBox.d.ts +15 -0
  12. package/dist/components/AgentRunControls.d.ts +10 -0
  13. package/dist/components/AgentSafetyPanel.d.ts +6 -0
  14. package/dist/components/AgentStateBadge.d.ts +6 -0
  15. package/dist/components/AgentThinkingChain.d.ts +8 -0
  16. package/dist/components/AgentThinkingPanel.d.ts +8 -0
  17. package/dist/components/AgentToolCallLog.d.ts +7 -0
  18. package/dist/components/AgentTraceViewer.d.ts +6 -0
  19. package/dist/components/AppDomainAgentPanel.d.ts +17 -0
  20. package/dist/components/ChatAgentRail.d.ts +24 -0
  21. package/dist/components/ScopeAttachmentPanel.d.ts +7 -0
  22. package/dist/components/utils.d.ts +20 -0
  23. package/dist/index.cjs +2709 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.css +2433 -0
  26. package/dist/index.css.map +1 -0
  27. package/dist/index.d.ts +44 -0
  28. package/dist/index.js +2666 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/types.d.ts +128 -0
  31. package/package.json +45 -0
  32. package/src/components/AgentApprovalGate.tsx +165 -0
  33. package/src/components/AgentContextViewer.tsx +161 -0
  34. package/src/components/AgentGeneratedArtifactPanel.tsx +224 -0
  35. package/src/components/AgentHandoffPanel.tsx +154 -0
  36. package/src/components/AgentInterruptionPanel.tsx +85 -0
  37. package/src/components/AgentMemoryPanel.tsx +167 -0
  38. package/src/components/AgentMessageList.tsx +209 -0
  39. package/src/components/AgentPlanDiff.tsx +149 -0
  40. package/src/components/AgentPlanPreview.tsx +106 -0
  41. package/src/components/AgentPromptBox.tsx +163 -0
  42. package/src/components/AgentRunControls.tsx +221 -0
  43. package/src/components/AgentSafetyPanel.tsx +113 -0
  44. package/src/components/AgentStateBadge.tsx +30 -0
  45. package/src/components/AgentThinkingChain.tsx +151 -0
  46. package/src/components/AgentThinkingPanel.tsx +56 -0
  47. package/src/components/AgentToolCallLog.tsx +262 -0
  48. package/src/components/AgentTraceViewer.tsx +218 -0
  49. package/src/components/AppDomainAgentPanel.tsx +66 -0
  50. package/src/components/ChatAgentRail.tsx +192 -0
  51. package/src/components/ScopeAttachmentPanel.tsx +130 -0
  52. package/src/components/utils.ts +186 -0
  53. package/src/index.test.tsx +212 -0
  54. package/src/index.tsx +88 -0
  55. package/src/styles.css +2902 -0
  56. package/src/types.ts +158 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,2709 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AgentApprovalGate: () => AgentApprovalGate,
34
+ AgentComponentNames: () => AgentComponentNames,
35
+ AgentContextViewer: () => AgentContextViewer,
36
+ AgentGeneratedArtifactPanel: () => AgentGeneratedArtifactPanel,
37
+ AgentHandoffPanel: () => AgentHandoffPanel,
38
+ AgentInterruptionPanel: () => AgentInterruptionPanel,
39
+ AgentMemoryPanel: () => AgentMemoryPanel,
40
+ AgentMessageList: () => AgentMessageList,
41
+ AgentPlanDiff: () => AgentPlanDiff,
42
+ AgentPlanPreview: () => AgentPlanPreview,
43
+ AgentPromptBox: () => AgentPromptBox,
44
+ AgentRunControls: () => AgentRunControls,
45
+ AgentSafetyPanel: () => AgentSafetyPanel,
46
+ AgentStateBadge: () => AgentStateBadge,
47
+ AgentThinkingChain: () => AgentThinkingChain,
48
+ AgentThinkingPanel: () => AgentThinkingPanel,
49
+ AgentToolCallLog: () => AgentToolCallLog,
50
+ AgentTraceViewer: () => AgentTraceViewer,
51
+ AppDomainAgentPanel: () => AppDomainAgentPanel,
52
+ ChatAgentRail: () => ChatAgentRail,
53
+ LeftAgentRail: () => LeftAgentRail,
54
+ ScopeAttachmentPanel: () => ScopeAttachmentPanel
55
+ });
56
+ module.exports = __toCommonJS(index_exports);
57
+
58
+ // src/components/ChatAgentRail.tsx
59
+ var import_clsx5 = __toESM(require("clsx"), 1);
60
+
61
+ // src/components/AgentMessageList.tsx
62
+ var React = __toESM(require("react"), 1);
63
+ var import_clsx = __toESM(require("clsx"), 1);
64
+ var import_core = require("@echothink-ui/core");
65
+
66
+ // src/components/utils.ts
67
+ var EMPTY_MARK = "\u2014";
68
+ function formatDateTime(value) {
69
+ const date = new Date(value);
70
+ if (Number.isNaN(date.getTime())) return value;
71
+ return new Intl.DateTimeFormat(void 0, {
72
+ dateStyle: "medium",
73
+ timeStyle: "short"
74
+ }).format(date);
75
+ }
76
+ function formatTime(value) {
77
+ const date = new Date(value);
78
+ if (Number.isNaN(date.getTime())) return value;
79
+ return new Intl.DateTimeFormat(void 0, {
80
+ hour: "2-digit",
81
+ minute: "2-digit",
82
+ second: "2-digit"
83
+ }).format(date);
84
+ }
85
+ function formatDuration(durationMs) {
86
+ if (durationMs == null) return EMPTY_MARK;
87
+ if (durationMs < 1e3) return `${Math.round(durationMs)} ms`;
88
+ return `${(durationMs / 1e3).toFixed(durationMs < 1e4 ? 1 : 0)} s`;
89
+ }
90
+ function jsonPreview(value, redacted = false, maxLength = 120) {
91
+ if (redacted) return "[redacted]";
92
+ if (value == null) return EMPTY_MARK;
93
+ const text = typeof value === "string" ? value : JSON.stringify(value);
94
+ if (!text) return EMPTY_MARK;
95
+ return text.length > maxLength ? `${text.slice(0, maxLength - 1)}\u2026` : text;
96
+ }
97
+ function prettyJson(value, redacted = false) {
98
+ if (redacted) return "[redacted]";
99
+ if (value == null) return EMPTY_MARK;
100
+ if (typeof value === "string") return value;
101
+ return JSON.stringify(value, null, 2);
102
+ }
103
+ function stateLabel(state) {
104
+ switch (state) {
105
+ case "idle":
106
+ return "Idle";
107
+ case "listening":
108
+ return "Listening";
109
+ case "thinking":
110
+ return "Thinking";
111
+ case "tool-calling":
112
+ return "Calling tools";
113
+ case "waiting-for-user":
114
+ return "Waiting for user";
115
+ case "interrupted":
116
+ return "Interrupted";
117
+ case "failed":
118
+ return "Failed";
119
+ case "completed":
120
+ return "Completed";
121
+ }
122
+ }
123
+ function isActiveAgentState(state) {
124
+ return state === "listening" || state === "thinking" || state === "tool-calling";
125
+ }
126
+ function statusSeverity(status) {
127
+ if (status === "failed" || status === "blocked" || status === "approval-required") {
128
+ return "danger";
129
+ }
130
+ if (status === "warning" || status === "pending-approval") return "warning";
131
+ if (status === "completed" || status === "succeeded" || status === "synced") return "success";
132
+ if (status === "running" || status === "in-progress" || status === "active") return "info";
133
+ return "neutral";
134
+ }
135
+ function riskSeverity(riskLevel = "low") {
136
+ if (riskLevel === "critical" || riskLevel === "high") return "danger";
137
+ if (riskLevel === "medium") return "warning";
138
+ return "info";
139
+ }
140
+ function safetySeverity(check) {
141
+ if (check.status === "pass") return "success";
142
+ if (check.status === "warn") return "warning";
143
+ return "danger";
144
+ }
145
+ function mergeStyle(base, incoming) {
146
+ return incoming ? { ...base, ...incoming } : base;
147
+ }
148
+ function diffPlanSteps(before, after) {
149
+ const beforeById = new Map(before.map((step) => [step.id, step]));
150
+ const afterById = new Map(after.map((step) => [step.id, step]));
151
+ const ids = Array.from(
152
+ /* @__PURE__ */ new Set([...after.map((step) => step.id), ...before.map((step) => step.id)])
153
+ );
154
+ return ids.map((id) => {
155
+ const beforeStep = beforeById.get(id);
156
+ const afterStep = afterById.get(id);
157
+ if (!beforeStep && afterStep) {
158
+ return { id, after: afterStep, status: "added", severity: "success" };
159
+ }
160
+ if (beforeStep && !afterStep) {
161
+ return { id, before: beforeStep, status: "removed", severity: "danger" };
162
+ }
163
+ const changed = JSON.stringify(beforeStep) !== JSON.stringify(afterStep);
164
+ return {
165
+ id,
166
+ before: beforeStep,
167
+ after: afterStep,
168
+ status: changed ? "modified" : "unchanged",
169
+ severity: changed ? "warning" : "neutral"
170
+ };
171
+ });
172
+ }
173
+
174
+ // src/components/AgentMessageList.tsx
175
+ var import_jsx_runtime = require("react/jsx-runtime");
176
+ var roleLabels = {
177
+ user: "You",
178
+ agent: "Agent",
179
+ system: "System",
180
+ tool: "Tool"
181
+ };
182
+ function AgentMessageList({
183
+ messages,
184
+ streaming,
185
+ autoScroll = true,
186
+ className,
187
+ style,
188
+ ...props
189
+ }) {
190
+ const listRef = React.useRef(null);
191
+ React.useEffect(() => {
192
+ if (!autoScroll) return;
193
+ const node = listRef.current;
194
+ if (!node) return;
195
+ node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
196
+ }, [autoScroll, messages.length, streaming]);
197
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
198
+ "div",
199
+ {
200
+ ...props,
201
+ ref: listRef,
202
+ role: "log",
203
+ "aria-live": streaming ? "polite" : "off",
204
+ "aria-relevant": "additions text",
205
+ className: (0, import_clsx.default)("eth-message-list", "eth-agent-message-list", className),
206
+ "data-eth-component": "AgentMessageList",
207
+ style: mergeStyle(
208
+ {
209
+ background: "var(--eth-color-layer-01)",
210
+ display: "flex",
211
+ flexDirection: "column",
212
+ gap: "1rem",
213
+ maxHeight: "100%",
214
+ overflowY: "auto",
215
+ padding: "1rem"
216
+ },
217
+ style
218
+ ),
219
+ children: messages.map((message, index) => {
220
+ const isStreaming = Boolean(message.streaming || streaming && index === messages.length - 1);
221
+ const isUser = message.role === "user";
222
+ const isSystem = message.role === "system";
223
+ const isTool = message.role === "tool";
224
+ const accentBorder = isTool ? "3px solid var(--eth-color-border-strong)" : "3px solid var(--eth-color-interactive-primary)";
225
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
226
+ "article",
227
+ {
228
+ className: (0, import_clsx.default)(
229
+ "eth-message-list__item",
230
+ "eth-agent-message",
231
+ `eth-agent-message--${message.role}`,
232
+ isStreaming && "eth-agent-message--streaming"
233
+ ),
234
+ "aria-busy": isStreaming || void 0,
235
+ style: {
236
+ alignSelf: isSystem ? "stretch" : isUser ? "flex-end" : "flex-start",
237
+ contentVisibility: "auto",
238
+ containIntrinsicSize: "1px 96px",
239
+ display: "grid",
240
+ gap: "0.375rem",
241
+ maxWidth: isSystem ? "100%" : "min(100%, 42rem)",
242
+ minWidth: 0,
243
+ textAlign: isSystem ? "center" : "start",
244
+ width: isSystem ? "100%" : "fit-content"
245
+ },
246
+ children: [
247
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
248
+ "header",
249
+ {
250
+ className: "eth-agent-message__header",
251
+ style: {
252
+ alignItems: "center",
253
+ color: "var(--eth-color-text-secondary)",
254
+ display: "flex",
255
+ flexWrap: "wrap",
256
+ fontSize: "0.75rem",
257
+ gap: "0.5rem",
258
+ justifyContent: isUser ? "flex-end" : isSystem ? "center" : "flex-start",
259
+ lineHeight: 1.333
260
+ },
261
+ children: [
262
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
263
+ "span",
264
+ {
265
+ className: "eth-agent-message__avatar",
266
+ "aria-hidden": true,
267
+ style: {
268
+ alignItems: "center",
269
+ background: isSystem ? "transparent" : isUser ? "var(--eth-color-interactive-primary)" : "var(--eth-color-layer-02)",
270
+ border: isSystem ? "1px dashed var(--eth-color-border-subtle)" : "1px solid var(--eth-color-border-subtle)",
271
+ borderRadius: "var(--eth-radius-none)",
272
+ color: isUser ? "#fff" : "var(--eth-color-text-primary)",
273
+ display: "inline-flex",
274
+ fontSize: "0.72rem",
275
+ fontWeight: 700,
276
+ height: 24,
277
+ justifyContent: "center",
278
+ width: 24
279
+ },
280
+ children: roleLabels[message.role].slice(0, 1)
281
+ }
282
+ ),
283
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: roleLabels[message.role] }),
284
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { dateTime: message.createdAt, children: formatDateTime(message.createdAt) }),
285
+ message.status ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.StatusDot, { status: message.status, label: (0, import_core.statusLabel)(message.status) }) : null
286
+ ]
287
+ }
288
+ ),
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
290
+ "div",
291
+ {
292
+ className: "eth-agent-message__bubble",
293
+ style: {
294
+ background: isSystem ? "var(--eth-color-layer-02)" : isUser ? "var(--eth-color-navy)" : "var(--eth-color-layer-02)",
295
+ border: isSystem ? "1px dashed var(--eth-color-border-subtle)" : "1px solid var(--eth-color-border-subtle)",
296
+ borderInlineEnd: isStreaming ? accentBorder : void 0,
297
+ borderInlineStart: isUser || isSystem ? void 0 : accentBorder,
298
+ borderRadius: "var(--eth-radius-panel)",
299
+ color: isUser ? "#fff" : "var(--eth-color-text-primary)",
300
+ fontFamily: isTool ? "ui-monospace, SFMono-Regular, Menlo, monospace" : void 0,
301
+ fontSize: isTool ? "0.875rem" : void 0,
302
+ lineHeight: 1.5,
303
+ overflowWrap: "anywhere",
304
+ padding: isSystem ? "0.5rem 0.75rem" : "0.875rem 1rem",
305
+ whiteSpace: isTool ? "pre-wrap" : "normal",
306
+ wordBreak: "normal"
307
+ },
308
+ children: [
309
+ message.content,
310
+ isStreaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
311
+ "span",
312
+ {
313
+ className: "eth-agent-message__cursor",
314
+ "aria-hidden": true,
315
+ style: {
316
+ animation: "eth-pulse 0.8s infinite",
317
+ color: "var(--eth-color-interactive-primary)",
318
+ display: "inline-block",
319
+ fontWeight: 600,
320
+ marginInlineStart: 3,
321
+ transform: "translateY(1px)"
322
+ },
323
+ children: "\u258C"
324
+ }
325
+ ) : null
326
+ ]
327
+ }
328
+ ),
329
+ message.citations?.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
330
+ "div",
331
+ {
332
+ className: "eth-agent-message__citations",
333
+ "aria-label": "Citations",
334
+ style: {
335
+ display: "flex",
336
+ flexWrap: "wrap",
337
+ gap: "0.375rem",
338
+ justifyContent: isUser ? "flex-end" : isSystem ? "center" : "flex-start"
339
+ },
340
+ children: message.citations.map(
341
+ (citation) => citation.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
342
+ "a",
343
+ {
344
+ className: "eth-agent-message__citation-link eth-tag",
345
+ href: citation.href,
346
+ children: citation.label
347
+ },
348
+ citation.id
349
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Tag, { children: citation.label }, citation.id)
350
+ )
351
+ }
352
+ ) : null
353
+ ]
354
+ },
355
+ message.id
356
+ );
357
+ })
358
+ }
359
+ );
360
+ }
361
+
362
+ // src/components/AgentPromptBox.tsx
363
+ var React2 = __toESM(require("react"), 1);
364
+ var import_clsx2 = __toESM(require("clsx"), 1);
365
+ var import_core2 = require("@echothink-ui/core");
366
+ var import_icons = require("@echothink-ui/icons");
367
+ var import_jsx_runtime2 = require("react/jsx-runtime");
368
+ function AgentPromptBox({
369
+ value,
370
+ onChange,
371
+ onSubmit,
372
+ placeholder = "Message the agent...",
373
+ disabled,
374
+ scopeLabel,
375
+ attachments = [],
376
+ onAttach,
377
+ onAttachmentRemove,
378
+ onSlash,
379
+ className,
380
+ style,
381
+ ...props
382
+ }) {
383
+ const canSubmit = value.trim().length > 0 && !disabled;
384
+ const hasContext = Boolean(scopeLabel) || attachments.length > 0;
385
+ const submit = React2.useCallback(() => {
386
+ if (!canSubmit) return;
387
+ onSubmit?.(value);
388
+ }, [canSubmit, onSubmit, value]);
389
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
390
+ "form",
391
+ {
392
+ ...props,
393
+ className: (0, import_clsx2.default)("eth-agent-prompt-box", className),
394
+ "data-eth-component": "AgentPromptBox",
395
+ style,
396
+ onSubmit: (event) => {
397
+ event.preventDefault();
398
+ submit();
399
+ },
400
+ children: [
401
+ hasContext ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "eth-agent-prompt-box__context", children: [
402
+ scopeLabel ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "eth-agent-prompt-box__scope", children: [
403
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Scope" }),
404
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: scopeLabel })
405
+ ] }) : null,
406
+ attachments.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "eth-agent-prompt-box__attachments", "aria-label": "Attached context", children: attachments.map((attachment) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
407
+ import_core2.Tag,
408
+ {
409
+ removable: Boolean(onAttachmentRemove),
410
+ onRemove: onAttachmentRemove ? () => onAttachmentRemove(attachment.id) : void 0,
411
+ children: [
412
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "eth-agent-prompt-box__attachment-kind", children: kindLabel(attachment.kind) }),
413
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "eth-agent-prompt-box__attachment-label", children: attachment.label }),
414
+ attachment.status ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
415
+ "span",
416
+ {
417
+ className: "eth-agent-prompt-box__attachment-status",
418
+ "data-status": attachment.status,
419
+ role: "img",
420
+ "aria-label": `Status: ${statusLabel2(attachment.status)}`
421
+ }
422
+ ) : null
423
+ ]
424
+ },
425
+ attachment.id
426
+ )) }) : null
427
+ ] }) : null,
428
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
429
+ import_core2.Textarea,
430
+ {
431
+ "aria-label": "Agent prompt",
432
+ className: "eth-agent-prompt-box__input",
433
+ disabled,
434
+ placeholder,
435
+ rows: 3,
436
+ value,
437
+ onChange: (event) => onChange(event.currentTarget.value),
438
+ onKeyDown: (event) => {
439
+ if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
440
+ event.preventDefault();
441
+ submit();
442
+ }
443
+ }
444
+ }
445
+ ),
446
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "eth-agent-prompt-box__actions", children: [
447
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "eth-agent-prompt-box__tools", children: [
448
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
449
+ import_core2.IconButton,
450
+ {
451
+ label: "Attach scope or file",
452
+ intent: "ghost",
453
+ density: "compact",
454
+ disabled: disabled || !onAttach,
455
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.PlusIcon, { size: 16 }),
456
+ onClick: onAttach
457
+ }
458
+ ),
459
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
460
+ import_core2.IconButton,
461
+ {
462
+ label: "Open slash commands",
463
+ intent: "ghost",
464
+ density: "compact",
465
+ disabled,
466
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "eth-agent-prompt-box__command-icon", "aria-hidden": true, children: "/" }),
467
+ onClick: () => {
468
+ if (onSlash) {
469
+ onSlash();
470
+ return;
471
+ }
472
+ if (!value) onChange("/");
473
+ }
474
+ }
475
+ )
476
+ ] }),
477
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "eth-agent-prompt-box__spacer" }),
478
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
479
+ import_core2.IconButton,
480
+ {
481
+ className: "eth-agent-prompt-box__submit",
482
+ label: "Submit prompt",
483
+ intent: "primary",
484
+ density: "compact",
485
+ disabled: !canSubmit,
486
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronRightIcon, { size: 16 }),
487
+ type: "submit"
488
+ }
489
+ )
490
+ ] })
491
+ ]
492
+ }
493
+ );
494
+ }
495
+ function kindLabel(kind) {
496
+ switch (kind) {
497
+ case "app-domain":
498
+ return "App";
499
+ case "document":
500
+ return "Doc";
501
+ default:
502
+ return kind.charAt(0).toUpperCase() + kind.slice(1);
503
+ }
504
+ }
505
+ function statusLabel2(status) {
506
+ return status.replace(/-/g, " ");
507
+ }
508
+
509
+ // src/components/AgentStateBadge.tsx
510
+ var import_clsx3 = __toESM(require("clsx"), 1);
511
+ var import_jsx_runtime3 = require("react/jsx-runtime");
512
+ function AgentStateBadge({ state = "idle", className, ...props }) {
513
+ const active = isActiveAgentState(state);
514
+ const label = stateLabel(state);
515
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
516
+ "span",
517
+ {
518
+ ...props,
519
+ className: (0, import_clsx3.default)(
520
+ "eth-agent-state-badge",
521
+ `eth-agent-state-badge--${state}`,
522
+ active && "eth-agent-state-badge--active",
523
+ className
524
+ ),
525
+ "data-eth-component": "AgentStateBadge",
526
+ "data-state": state,
527
+ children: [
528
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "eth-agent-state-badge__dot", "aria-hidden": "true" }),
529
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "eth-agent-state-badge__label", children: label })
530
+ ]
531
+ }
532
+ );
533
+ }
534
+
535
+ // src/components/ScopeAttachmentPanel.tsx
536
+ var import_clsx4 = __toESM(require("clsx"), 1);
537
+ var import_core3 = require("@echothink-ui/core");
538
+ var import_jsx_runtime4 = require("react/jsx-runtime");
539
+ var attentionStatuses = /* @__PURE__ */ new Set([
540
+ "approval-required",
541
+ "blocked",
542
+ "failed",
543
+ "pending-approval",
544
+ "stale",
545
+ "warning"
546
+ ]);
547
+ function ScopeAttachmentPanel({
548
+ attachments,
549
+ onRemove,
550
+ title = "Attached context",
551
+ subtitle,
552
+ severity,
553
+ className,
554
+ ...props
555
+ }) {
556
+ if (!attachments.length) return null;
557
+ const hasAttention = attachments.some(
558
+ (attachment) => attachment.status ? attentionStatuses.has(attachment.status) : false
559
+ );
560
+ const listLabel = typeof title === "string" ? `${title} items` : "Attached context items";
561
+ const renderedSubtitle = subtitle ?? `${attachments.length} ${attachments.length === 1 ? "scope is" : "scopes are"} available to the agent run`;
562
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
563
+ import_core3.Surface,
564
+ {
565
+ ...props,
566
+ className: (0, import_clsx4.default)("eth-agent-scope-attachments", className),
567
+ "data-eth-component": "ScopeAttachmentPanel",
568
+ severity: severity ?? (hasAttention ? "warning" : void 0),
569
+ subtitle: renderedSubtitle,
570
+ title,
571
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "eth-agent-scope-attachments__list", "aria-label": listLabel, children: attachments.map((attachment) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
572
+ "li",
573
+ {
574
+ className: "eth-agent-scope-attachments__item",
575
+ "data-kind": attachment.kind,
576
+ "data-status": attachment.status,
577
+ children: [
578
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "eth-agent-scope-attachments__icon", "aria-hidden": "true", children: kindInitial(attachment.kind) }),
579
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "eth-agent-scope-attachments__main", children: [
580
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "eth-agent-scope-attachments__topline", children: [
581
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { className: "eth-agent-scope-attachments__label", children: attachment.label }),
582
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core3.Badge, { severity: "neutral", children: kindLabel2(attachment.kind) })
583
+ ] }),
584
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "eth-agent-scope-attachments__meta", children: kindDescription(attachment.kind) })
585
+ ] }),
586
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "eth-agent-scope-attachments__aside", children: [
587
+ attachment.status ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core3.StatusDot, { status: attachment.status, label: (0, import_core3.statusLabel)(attachment.status) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "eth-agent-scope-attachments__untracked", children: "No status" }),
588
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
589
+ import_core3.Button,
590
+ {
591
+ "aria-label": `Remove ${attachment.label}`,
592
+ density: "compact",
593
+ intent: "ghost",
594
+ onClick: () => onRemove(attachment.id),
595
+ children: "Remove"
596
+ }
597
+ ) : null
598
+ ] })
599
+ ]
600
+ },
601
+ attachment.id
602
+ )) })
603
+ }
604
+ );
605
+ }
606
+ function kindLabel2(kind) {
607
+ switch (kind) {
608
+ case "app-domain":
609
+ return "App domain";
610
+ case "document":
611
+ return "Document";
612
+ default:
613
+ return kind.charAt(0).toUpperCase() + kind.slice(1);
614
+ }
615
+ }
616
+ function kindDescription(kind) {
617
+ switch (kind) {
618
+ case "app-domain":
619
+ return "Runnable application boundary";
620
+ case "document":
621
+ return "Source document";
622
+ case "project":
623
+ return "Project scope";
624
+ case "resource":
625
+ return "External resource";
626
+ case "task":
627
+ return "Task context";
628
+ case "scope":
629
+ return "General scope";
630
+ default:
631
+ return "Attached context";
632
+ }
633
+ }
634
+ function kindInitial(kind) {
635
+ return kindLabel2(kind).charAt(0);
636
+ }
637
+
638
+ // src/components/ChatAgentRail.tsx
639
+ var import_jsx_runtime5 = require("react/jsx-runtime");
640
+ function ChatAgentRail(props) {
641
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
642
+ AgentRailBase,
643
+ {
644
+ ...props,
645
+ componentName: "ChatAgentRail",
646
+ railClassName: "eth-agent-chat-rail",
647
+ placement: "right"
648
+ }
649
+ );
650
+ }
651
+ function LeftAgentRail(props) {
652
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
653
+ AgentRailBase,
654
+ {
655
+ ...props,
656
+ componentName: "LeftAgentRail",
657
+ railClassName: "eth-left-agent-rail eth-agent-left-rail",
658
+ placement: "left"
659
+ }
660
+ );
661
+ }
662
+ function AgentRailBase({
663
+ agentRef,
664
+ projectRef,
665
+ messages,
666
+ state = "idle",
667
+ prompt,
668
+ onPromptChange,
669
+ onSubmit,
670
+ attachments = [],
671
+ onAttachmentRemove,
672
+ onAttach,
673
+ onSlash,
674
+ autoScroll = true,
675
+ runControls,
676
+ header,
677
+ scopeLabel,
678
+ width = 360,
679
+ className,
680
+ style,
681
+ componentName,
682
+ railClassName,
683
+ placement,
684
+ "aria-label": ariaLabel,
685
+ ...props
686
+ }) {
687
+ const streaming = messages.some((message) => message.streaming) || isActiveAgentState(state);
688
+ const border = "1px solid var(--eth-color-border-subtle)";
689
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
690
+ "aside",
691
+ {
692
+ ...props,
693
+ "aria-label": ariaLabel ?? "Agent collaboration rail",
694
+ className: (0, import_clsx5.default)("eth-chat-rail", railClassName, className),
695
+ "data-eth-component": componentName,
696
+ "data-placement": placement,
697
+ style: mergeStyle(
698
+ {
699
+ background: "var(--eth-color-layer-01)",
700
+ borderInlineEnd: placement === "left" ? border : 0,
701
+ borderInlineStart: placement === "right" ? border : 0,
702
+ display: "grid",
703
+ flex: `0 0 ${typeof width === "number" ? `${width}px` : width}`,
704
+ gridTemplateRows: "auto minmax(0, 1fr) auto",
705
+ height: "100%",
706
+ maxWidth: "100%",
707
+ minHeight: 0,
708
+ width
709
+ },
710
+ style
711
+ ),
712
+ children: [
713
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
714
+ "header",
715
+ {
716
+ className: "eth-chat-rail__header",
717
+ style: {
718
+ borderBottom: "1px solid var(--eth-color-border-subtle)",
719
+ display: "grid",
720
+ gap: "0.75rem",
721
+ padding: "1rem"
722
+ },
723
+ children: [
724
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
725
+ "div",
726
+ {
727
+ className: "eth-chat-rail__header-main",
728
+ style: {
729
+ alignItems: "flex-start",
730
+ display: "flex",
731
+ gap: "0.75rem",
732
+ justifyContent: "space-between"
733
+ },
734
+ children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { minWidth: 0 }, children: header ?? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
736
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "eth-chat-rail__title", style: { fontSize: "1rem", margin: 0 }, children: "Agent" }),
737
+ agentRef || projectRef ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
738
+ "p",
739
+ {
740
+ className: "eth-chat-rail__meta",
741
+ style: {
742
+ color: "var(--eth-color-text-secondary)",
743
+ fontSize: "0.8rem",
744
+ margin: "0.25rem 0 0"
745
+ },
746
+ children: [agentRef, projectRef].filter(Boolean).join(" \xB7 ")
747
+ }
748
+ ) : null
749
+ ] }) }),
750
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AgentStateBadge, { state })
751
+ ]
752
+ }
753
+ ),
754
+ runControls ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "eth-chat-rail__run-controls", children: runControls }) : null
755
+ ]
756
+ }
757
+ ),
758
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
759
+ AgentMessageList,
760
+ {
761
+ className: "eth-chat-rail__messages",
762
+ autoScroll,
763
+ messages,
764
+ streaming,
765
+ style: { minHeight: 0, padding: "1rem" }
766
+ }
767
+ ),
768
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
769
+ "footer",
770
+ {
771
+ className: "eth-chat-rail__footer",
772
+ style: {
773
+ borderTop: "1px solid var(--eth-color-border-subtle)",
774
+ display: "grid",
775
+ gap: "0.75rem",
776
+ padding: "1rem"
777
+ },
778
+ children: [
779
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
780
+ ScopeAttachmentPanel,
781
+ {
782
+ attachments: attachments.map((attachment) => ({
783
+ ...attachment,
784
+ kind: attachment.kind === "file" ? "document" : attachment.kind
785
+ })),
786
+ onRemove: onAttachmentRemove
787
+ }
788
+ ),
789
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
790
+ AgentPromptBox,
791
+ {
792
+ value: prompt,
793
+ onChange: onPromptChange,
794
+ scopeLabel,
795
+ onAttach,
796
+ onSlash,
797
+ onSubmit: (value) => onSubmit?.(value, attachments)
798
+ }
799
+ )
800
+ ]
801
+ }
802
+ )
803
+ ]
804
+ }
805
+ );
806
+ }
807
+
808
+ // src/components/AgentThinkingPanel.tsx
809
+ var import_clsx6 = __toESM(require("clsx"), 1);
810
+ var import_core4 = require("@echothink-ui/core");
811
+ var import_jsx_runtime6 = require("react/jsx-runtime");
812
+ function AgentThinkingPanel({
813
+ currentStep,
814
+ summary,
815
+ progress,
816
+ lastUpdatedAt,
817
+ title = "Agent thinking",
818
+ subtitle,
819
+ metadata = [],
820
+ className,
821
+ ...props
822
+ }) {
823
+ const normalizedProgress = typeof progress === "number" && Number.isFinite(progress) ? Math.max(0, Math.min(100, Math.round(progress))) : void 0;
824
+ const panelMetadata = lastUpdatedAt ? [{ label: "Last updated", value: formatDateTime(lastUpdatedAt) }, ...metadata] : metadata;
825
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
826
+ import_core4.Surface,
827
+ {
828
+ ...props,
829
+ className: (0, import_clsx6.default)("eth-agent-thinking-panel", className),
830
+ "data-eth-component": "AgentThinkingPanel",
831
+ title,
832
+ subtitle: currentStep ?? subtitle,
833
+ metadata: panelMetadata.length ? panelMetadata : void 0,
834
+ children: [
835
+ summary ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "eth-agent-thinking-panel__summary", children: summary }) : null,
836
+ normalizedProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "eth-agent-thinking-panel__progress", children: [
837
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "eth-agent-thinking-panel__progress-label", children: [
838
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Progress" }),
839
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("strong", { children: [
840
+ normalizedProgress,
841
+ "%"
842
+ ] })
843
+ ] }),
844
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("progress", { max: 100, value: normalizedProgress, "aria-label": "Agent progress", children: [
845
+ normalizedProgress,
846
+ "%"
847
+ ] })
848
+ ] }) : null
849
+ ]
850
+ }
851
+ );
852
+ }
853
+
854
+ // src/components/AgentThinkingChain.tsx
855
+ var import_clsx7 = __toESM(require("clsx"), 1);
856
+ var import_core5 = require("@echothink-ui/core");
857
+ var import_jsx_runtime7 = require("react/jsx-runtime");
858
+ function AgentThinkingChain({
859
+ steps,
860
+ streaming,
861
+ redactionPolicy,
862
+ title = "Thinking chain",
863
+ className,
864
+ ...props
865
+ }) {
866
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
867
+ import_core5.Surface,
868
+ {
869
+ ...props,
870
+ className: (0, import_clsx7.default)("eth-agent-thinking-chain", className),
871
+ "data-eth-component": "AgentThinkingChain",
872
+ title,
873
+ subtitle: redactionPolicy ? `Redaction policy: ${redactionPolicy}` : void 0,
874
+ children: steps.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { className: "eth-agent-thinking-chain__steps", "aria-live": streaming ? "polite" : "off", children: steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThinkingStep, { step, depth: 0 }, step.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
875
+ import_core5.EmptyState,
876
+ {
877
+ title: "No thinking steps",
878
+ description: "Steps will appear as the agent records observations, actions, or blockers."
879
+ }
880
+ )
881
+ }
882
+ );
883
+ }
884
+ function ThinkingStep({ step, depth }) {
885
+ const hasChildren = Boolean(step.children?.length);
886
+ const stepClassName = (0, import_clsx7.default)(
887
+ "eth-agent-thinking-chain__step",
888
+ `eth-agent-thinking-chain__step--${step.status}`,
889
+ hasChildren && "eth-agent-thinking-chain__step--branch"
890
+ );
891
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
892
+ "li",
893
+ {
894
+ className: (0, import_clsx7.default)(
895
+ "eth-agent-thinking-chain__item",
896
+ `eth-agent-thinking-chain__item--${step.status}`
897
+ ),
898
+ style: {
899
+ "--eth-agent-thinking-chain-depth-offset": `${depth * 1.5}rem`
900
+ },
901
+ children: [
902
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "eth-agent-thinking-chain__marker", "aria-hidden": "true" }),
903
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "eth-agent-thinking-chain__item-body", children: [
904
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: stepClassName, children: [
905
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StepHeader, { step, hasChildren }),
906
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StepDetails, { step })
907
+ ] }),
908
+ hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { className: "eth-agent-thinking-chain__children", children: step.children?.map((child) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThinkingStep, { step: child, depth: depth + 1 }, child.id)) }) : null
909
+ ] })
910
+ ]
911
+ }
912
+ );
913
+ }
914
+ function StepHeader({ step, hasChildren }) {
915
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { className: "eth-agent-thinking-chain__step-header", children: [
916
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "eth-agent-thinking-chain__step-heading", children: [
917
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { className: "eth-agent-thinking-chain__step-title", children: step.title }),
918
+ hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "eth-agent-thinking-chain__branch-count", children: [
919
+ step.children?.length,
920
+ " ",
921
+ step.children?.length === 1 ? "substep" : "substeps"
922
+ ] }) : null
923
+ ] }),
924
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "eth-agent-thinking-chain__step-meta", children: [
925
+ step.redacted ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core5.Badge, { severity: "warning", children: "Redacted" }) : null,
926
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core5.StatusDot, { status: step.status, label: (0, import_core5.statusLabel)(step.status) }),
927
+ step.durationMs != null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "eth-agent-thinking-chain__duration", children: formatDuration(step.durationMs) }) : null
928
+ ] })
929
+ ] });
930
+ }
931
+ function StepDetails({ step }) {
932
+ const hasDetails = Boolean(step.observation || step.action || step.blocker);
933
+ if (step.redacted) {
934
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "eth-agent-thinking-chain__redacted", children: "Details are hidden by policy." });
935
+ }
936
+ if (!hasDetails) {
937
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "eth-agent-thinking-chain__empty-detail", children: "No public details recorded." });
938
+ }
939
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("dl", { className: "eth-agent-thinking-chain__fields", children: [
940
+ step.observation ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StepField, { label: "Observation", value: step.observation }) : null,
941
+ step.action ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StepField, { label: "Action", value: step.action, monospaced: true }) : null,
942
+ step.blocker ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
943
+ StepField,
944
+ {
945
+ label: "Blocker",
946
+ value: step.blocker,
947
+ className: "eth-agent-thinking-chain__field--blocker"
948
+ }
949
+ ) : null
950
+ ] });
951
+ }
952
+ function StepField({
953
+ label,
954
+ value,
955
+ monospaced,
956
+ className
957
+ }) {
958
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_clsx7.default)("eth-agent-thinking-chain__field", className), children: [
959
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: label }),
960
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { className: (0, import_clsx7.default)(monospaced && "eth-agent-thinking-chain__field-value--mono"), children: value })
961
+ ] });
962
+ }
963
+
964
+ // src/components/AgentTraceViewer.tsx
965
+ var React3 = __toESM(require("react"), 1);
966
+ var import_clsx8 = __toESM(require("clsx"), 1);
967
+ var import_core6 = require("@echothink-ui/core");
968
+ var import_jsx_runtime8 = require("react/jsx-runtime");
969
+ function AgentTraceViewer({
970
+ spans,
971
+ title = "Trace viewer",
972
+ className,
973
+ ...props
974
+ }) {
975
+ const [selectedSpanId, setSelectedSpanId] = React3.useState(spans[0]?.id);
976
+ const timeline = React3.useMemo(() => buildTimeline(spans), [spans]);
977
+ const selectedSpan = spans.find((span) => span.id === selectedSpanId) ?? spans[0];
978
+ const selectedTimelineItem = timeline.items.find((item) => item.span.id === selectedSpan?.id);
979
+ const activeCount = spans.filter(
980
+ (span) => ["running", "in-progress", "pending-approval", "approval-required"].includes(span.status)
981
+ ).length;
982
+ const selectedAttributes = Object.entries(selectedSpan?.attributes ?? {});
983
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
984
+ import_core6.Surface,
985
+ {
986
+ ...props,
987
+ className: (0, import_clsx8.default)("eth-trace", "eth-agent-trace-viewer", className),
988
+ "data-eth-component": "AgentTraceViewer",
989
+ title,
990
+ children: !spans.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core6.EmptyState, { title: "No trace spans" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
991
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("dl", { className: "eth-trace__summary", "aria-label": "Trace summary", children: [
992
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
993
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Spans" }),
994
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: spans.length })
995
+ ] }),
996
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
997
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Window" }),
998
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: formatDuration(timeline.total) })
999
+ ] }),
1000
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1001
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Active" }),
1002
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: activeCount })
1003
+ ] })
1004
+ ] }),
1005
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "eth-trace__layout", children: [
1006
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "eth-trace__timeline-panel", "aria-label": "Trace timeline", children: [
1007
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "eth-trace__axis", "aria-hidden": "true", children: [
1008
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "0 ms" }),
1009
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: formatDuration(timeline.total / 2) }),
1010
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: formatDuration(timeline.total) })
1011
+ ] }),
1012
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "eth-trace__timeline", role: "list", children: timeline.items.map(({ span, start, end, depth }) => {
1013
+ const left = (start - timeline.min) / timeline.total * 100;
1014
+ const width = Math.max((end - start) / timeline.total * 100, 1);
1015
+ const selected = selectedSpan?.id === span.id;
1016
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1017
+ "div",
1018
+ {
1019
+ className: (0, import_clsx8.default)("eth-trace__row", selected && "eth-trace__row--selected"),
1020
+ role: "listitem",
1021
+ style: {
1022
+ "--eth-trace-indent": `${depth}rem`,
1023
+ "--eth-trace-left": `${left}%`,
1024
+ "--eth-trace-width": `${width}%`
1025
+ },
1026
+ children: [
1027
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1028
+ "button",
1029
+ {
1030
+ type: "button",
1031
+ className: (0, import_clsx8.default)(
1032
+ "eth-trace__span-label",
1033
+ selected && "eth-trace__span-label--selected"
1034
+ ),
1035
+ "aria-pressed": selected,
1036
+ onClick: () => setSelectedSpanId(span.id),
1037
+ children: [
1038
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "eth-trace__span-title", children: [
1039
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core6.StatusDot, { status: span.status, label: (0, import_core6.statusLabel)(span.status) }),
1040
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "eth-trace__span-name", children: span.name })
1041
+ ] }),
1042
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "eth-trace__span-meta", children: [
1043
+ formatTime(span.startedAt),
1044
+ " \xB7 ",
1045
+ formatDuration(span.durationMs)
1046
+ ] })
1047
+ ]
1048
+ }
1049
+ ),
1050
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1051
+ "div",
1052
+ {
1053
+ className: "eth-trace__track",
1054
+ role: "group",
1055
+ "aria-label": `${span.name}, ${(0, import_core6.statusLabel)(span.status)}, ${formatDuration(span.durationMs)}`,
1056
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1057
+ "button",
1058
+ {
1059
+ type: "button",
1060
+ className: (0, import_clsx8.default)(
1061
+ "eth-trace__bar",
1062
+ `eth-trace__bar--${span.status}`,
1063
+ selected && "eth-trace__bar--selected"
1064
+ ),
1065
+ "aria-label": `Select ${span.name}`,
1066
+ onClick: () => setSelectedSpanId(span.id)
1067
+ }
1068
+ )
1069
+ }
1070
+ )
1071
+ ]
1072
+ },
1073
+ span.id
1074
+ );
1075
+ }) })
1076
+ ] }),
1077
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("aside", { className: "eth-trace__details", "aria-label": "Selected span details", children: selectedSpan ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1078
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { className: "eth-trace__details-header", children: [
1079
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1080
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "eth-trace__details-eyebrow", children: "Selected span" }),
1081
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { children: selectedSpan.name })
1082
+ ] }),
1083
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core6.Badge, { severity: statusSeverity(selectedSpan.status), children: (0, import_core6.statusLabel)(selectedSpan.status) })
1084
+ ] }),
1085
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("dl", { className: "eth-trace__detail-grid", children: [
1086
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1087
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Started" }),
1088
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: formatTime(selectedSpan.startedAt) })
1089
+ ] }),
1090
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1091
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Duration" }),
1092
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: formatDuration(selectedSpan.durationMs) })
1093
+ ] }),
1094
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1095
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Depth" }),
1096
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: selectedTimelineItem?.depth ?? 0 })
1097
+ ] }),
1098
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1099
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Span ID" }),
1100
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: selectedSpan.id })
1101
+ ] }),
1102
+ selectedSpan.parentId ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1103
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: "Parent" }),
1104
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: selectedSpan.parentId })
1105
+ ] }) : null
1106
+ ] }),
1107
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "eth-trace__attributes", children: [
1108
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "eth-trace__attributes-header", children: [
1109
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h4", { children: "Attributes" }),
1110
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core6.Badge, { severity: "neutral", children: selectedAttributes.length })
1111
+ ] }),
1112
+ selectedAttributes.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("pre", { children: prettyJson(selectedSpan.attributes) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: "No attributes recorded." })
1113
+ ] })
1114
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core6.EmptyState, { title: "Select a span" }) })
1115
+ ] })
1116
+ ] })
1117
+ }
1118
+ );
1119
+ }
1120
+ function buildTimeline(spans) {
1121
+ if (!spans.length) return { items: [], min: 0, total: 1 };
1122
+ const spansById = new Map(spans.map((span) => [span.id, span]));
1123
+ const depthById = /* @__PURE__ */ new Map();
1124
+ const depthFor = (span, seen = /* @__PURE__ */ new Set()) => {
1125
+ if (depthById.has(span.id)) return depthById.get(span.id) ?? 0;
1126
+ if (!span.parentId || seen.has(span.id)) {
1127
+ depthById.set(span.id, 0);
1128
+ return 0;
1129
+ }
1130
+ const parent = spansById.get(span.parentId);
1131
+ const depth = parent ? depthFor(parent, new Set(seen).add(span.id)) + 1 : 0;
1132
+ depthById.set(span.id, depth);
1133
+ return depth;
1134
+ };
1135
+ const items = spans.map((span, index) => {
1136
+ const parsed = new Date(span.startedAt).getTime();
1137
+ const start = Number.isNaN(parsed) ? index * 10 : parsed;
1138
+ const end = start + Math.max(span.durationMs, 1);
1139
+ return { span, start, end, depth: depthFor(span) };
1140
+ }).sort((a, b) => a.start - b.start);
1141
+ const min = Math.min(...items.map((item) => item.start));
1142
+ const max = Math.max(...items.map((item) => item.end));
1143
+ return { items, min, total: Math.max(max - min, 1) };
1144
+ }
1145
+
1146
+ // src/components/AgentToolCallLog.tsx
1147
+ var React4 = __toESM(require("react"), 1);
1148
+ var import_clsx9 = __toESM(require("clsx"), 1);
1149
+ var import_core7 = require("@echothink-ui/core");
1150
+ var import_data = require("@echothink-ui/data");
1151
+ var import_icons2 = require("@echothink-ui/icons");
1152
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1153
+ function AgentToolCallLog({
1154
+ calls,
1155
+ onSelect,
1156
+ title = "Tool calls",
1157
+ subtitle,
1158
+ className,
1159
+ ...props
1160
+ }) {
1161
+ const [selectedCall, setSelectedCall] = React4.useState();
1162
+ const rows = React4.useMemo(
1163
+ () => calls.map((call) => {
1164
+ const argsPreview = jsonPreview(call.args, call.redacted);
1165
+ const resultPreview = call.error ?? jsonPreview(call.result, call.redacted);
1166
+ return {
1167
+ id: call.id,
1168
+ call,
1169
+ time: formatTime(call.startedAt),
1170
+ toolName: call.toolName,
1171
+ status: call.status,
1172
+ duration: formatDuration(call.durationMs),
1173
+ argsPreview,
1174
+ argsTone: previewTone(argsPreview, call.redacted),
1175
+ resultPreview,
1176
+ resultTone: call.error ? "error" : previewTone(resultPreview, call.redacted)
1177
+ };
1178
+ }),
1179
+ [calls]
1180
+ );
1181
+ const openCall = React4.useCallback(
1182
+ (call) => {
1183
+ setSelectedCall(call);
1184
+ onSelect?.(call);
1185
+ },
1186
+ [onSelect]
1187
+ );
1188
+ const columns = React4.useMemo(
1189
+ () => [
1190
+ {
1191
+ key: "time",
1192
+ header: "Time",
1193
+ width: "7rem",
1194
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("time", { className: "eth-agent-tool-call-log__time", dateTime: row.call.startedAt, children: row.time })
1195
+ },
1196
+ {
1197
+ key: "toolName",
1198
+ header: "Tool",
1199
+ width: "13rem",
1200
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "eth-agent-tool-call-log__tool", children: row.toolName })
1201
+ },
1202
+ {
1203
+ key: "status",
1204
+ header: "Status",
1205
+ width: "11rem",
1206
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core7.StatusDot, { status: row.status, label: (0, import_core7.statusLabel)(row.status) })
1207
+ },
1208
+ {
1209
+ key: "duration",
1210
+ header: "Duration",
1211
+ width: "7rem",
1212
+ align: "end",
1213
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PreviewText, { value: row.duration, tone: previewTone(row.duration) })
1214
+ },
1215
+ {
1216
+ key: "argsPreview",
1217
+ header: "Args",
1218
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PreviewText, { value: row.argsPreview, tone: row.argsTone })
1219
+ },
1220
+ {
1221
+ key: "resultPreview",
1222
+ header: "Result",
1223
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PreviewText, { value: row.resultPreview, tone: row.resultTone })
1224
+ },
1225
+ {
1226
+ key: "actions",
1227
+ header: "Actions",
1228
+ width: "7.5rem",
1229
+ align: "end",
1230
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1231
+ import_core7.Button,
1232
+ {
1233
+ "aria-label": `Inspect ${row.toolName} tool call`,
1234
+ className: "eth-agent-tool-call-log__inspect",
1235
+ density: "compact",
1236
+ icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons2.SearchIcon, { size: 16 }),
1237
+ intent: "ghost",
1238
+ onClick: () => openCall(row.call),
1239
+ children: "Inspect"
1240
+ }
1241
+ )
1242
+ }
1243
+ ],
1244
+ [openCall]
1245
+ );
1246
+ const defaultSubtitle = React4.useMemo(() => summarizeCalls(calls), [calls]);
1247
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1248
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1249
+ import_core7.Surface,
1250
+ {
1251
+ ...props,
1252
+ className: (0, import_clsx9.default)("eth-agent-tool-call-log", className),
1253
+ "data-eth-component": "AgentToolCallLog",
1254
+ subtitle: subtitle ?? defaultSubtitle,
1255
+ title,
1256
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1257
+ import_data.DataTable,
1258
+ {
1259
+ rows,
1260
+ columns,
1261
+ rowKey: "id",
1262
+ density: "compact",
1263
+ className: "eth-agent-tool-call-log__table",
1264
+ emptyState: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core7.EmptyState, { title: "No tool calls" })
1265
+ }
1266
+ )
1267
+ }
1268
+ ),
1269
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1270
+ import_core7.Drawer,
1271
+ {
1272
+ open: Boolean(selectedCall),
1273
+ title: selectedCall?.toolName ?? "Tool call",
1274
+ onClose: () => setSelectedCall(void 0),
1275
+ children: selectedCall ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "eth-agent-tool-call-log__drawer", children: [
1276
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "eth-agent-tool-call-log__drawer-status", children: [
1277
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core7.StatusDot, { status: selectedCall.status, label: (0, import_core7.statusLabel)(selectedCall.status) }),
1278
+ selectedCall.redacted ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "eth-agent-tool-call-log__redaction-note", children: "Redaction applied" }) : null
1279
+ ] }),
1280
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("dl", { className: "eth-agent-tool-call-log__meta", children: [
1281
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
1282
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: "Started" }),
1283
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: formatTime(selectedCall.startedAt) })
1284
+ ] }),
1285
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
1286
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: "Duration" }),
1287
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: formatDuration(selectedCall.durationMs) })
1288
+ ] }),
1289
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
1290
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: "Tool" }),
1291
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: selectedCall.toolName }) })
1292
+ ] }),
1293
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
1294
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: "Redaction" }),
1295
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: selectedCall.redacted ? "Applied" : "None" })
1296
+ ] })
1297
+ ] }),
1298
+ selectedCall.error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "eth-agent-tool-call-log__error", children: [
1299
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: "Error" }),
1300
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { tabIndex: 0, children: selectedCall.error })
1301
+ ] }) : null,
1302
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1303
+ JsonBlock,
1304
+ {
1305
+ title: "Arguments",
1306
+ value: prettyJson(selectedCall.args, selectedCall.redacted)
1307
+ }
1308
+ ),
1309
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1310
+ JsonBlock,
1311
+ {
1312
+ title: "Result",
1313
+ value: prettyJson(selectedCall.result, selectedCall.redacted)
1314
+ }
1315
+ )
1316
+ ] }) : null
1317
+ }
1318
+ )
1319
+ ] });
1320
+ }
1321
+ function summarizeCalls(calls) {
1322
+ if (!calls.length) return void 0;
1323
+ const active = calls.filter(
1324
+ (call) => ["queued", "running", "in-progress", "pending-approval", "approval-required"].includes(
1325
+ call.status
1326
+ )
1327
+ ).length;
1328
+ const redacted = calls.filter((call) => call.redacted).length;
1329
+ return [
1330
+ `${calls.length} call${calls.length === 1 ? "" : "s"}`,
1331
+ active ? `${active} active` : null,
1332
+ redacted ? `${redacted} redacted` : null
1333
+ ].filter(Boolean).join(" | ");
1334
+ }
1335
+ function previewTone(value, redacted = false) {
1336
+ if (redacted && value === "[redacted]") return "redacted";
1337
+ if (value === EMPTY_MARK) return "empty";
1338
+ return "default";
1339
+ }
1340
+ function PreviewText({ value, tone = "default" }) {
1341
+ if (tone === "redacted") {
1342
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "eth-agent-tool-call-log__preview eth-agent-tool-call-log__preview--redacted", children: "Redacted" });
1343
+ }
1344
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1345
+ "span",
1346
+ {
1347
+ className: (0, import_clsx9.default)(
1348
+ "eth-agent-tool-call-log__preview",
1349
+ tone !== "default" && `eth-agent-tool-call-log__preview--${tone}`
1350
+ ),
1351
+ title: value === EMPTY_MARK ? void 0 : value,
1352
+ children: value
1353
+ }
1354
+ );
1355
+ }
1356
+ function JsonBlock({ title, value }) {
1357
+ const headingId = React4.useId();
1358
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "eth-agent-tool-call-log__json", "aria-labelledby": headingId, children: [
1359
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { id: headingId, children: title }),
1360
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { tabIndex: 0, children: value })
1361
+ ] });
1362
+ }
1363
+
1364
+ // src/components/AgentApprovalGate.tsx
1365
+ var React5 = __toESM(require("react"), 1);
1366
+ var import_clsx10 = __toESM(require("clsx"), 1);
1367
+ var import_core8 = require("@echothink-ui/core");
1368
+ var import_icons3 = require("@echothink-ui/icons");
1369
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1370
+ function AgentApprovalGate({
1371
+ action,
1372
+ evidence = [],
1373
+ onApprove,
1374
+ onReject,
1375
+ state = "idle",
1376
+ title = "Approval required",
1377
+ className,
1378
+ ...props
1379
+ }) {
1380
+ const [reason, setReason] = React5.useState("");
1381
+ const severity = riskSeverity(action.riskLevel);
1382
+ const locked = state === "pending" || state === "approved" || state === "rejected";
1383
+ const stateLabel2 = approvalStateLabel(state);
1384
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1385
+ import_core8.Surface,
1386
+ {
1387
+ ...props,
1388
+ className: (0, import_clsx10.default)("eth-agent-approval-gate", `eth-agent-approval-gate--${state}`, className),
1389
+ "data-eth-component": "AgentApprovalGate",
1390
+ severity,
1391
+ status: approvalStatus(state),
1392
+ title,
1393
+ subtitle: action.label,
1394
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "eth-agent-approval-gate__layout", children: [
1395
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1396
+ import_core8.InlineNotification,
1397
+ {
1398
+ severity,
1399
+ title: `${riskLabel(action.riskLevel)} risk action`,
1400
+ children: action.description
1401
+ }
1402
+ ),
1403
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("dl", { className: "eth-agent-approval-gate__summary", "aria-label": "Approval action details", children: [
1404
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
1405
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dt", { children: "Action" }),
1406
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { children: action.id })
1407
+ ] }),
1408
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
1409
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dt", { children: "Risk" }),
1410
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { children: riskLabel(action.riskLevel) })
1411
+ ] }),
1412
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
1413
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dt", { children: "Status" }),
1414
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { children: stateLabel2 })
1415
+ ] })
1416
+ ] }),
1417
+ evidence.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "eth-agent-approval-gate__evidence", children: [
1418
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "eth-agent-approval-gate__section-header", children: [
1419
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: "Evidence" }),
1420
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1421
+ evidence.length,
1422
+ " reference",
1423
+ evidence.length === 1 ? "" : "s"
1424
+ ] })
1425
+ ] }),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "eth-agent-approval-gate__evidence-list", children: evidence.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(EvidenceItem, { item }, item.id)) })
1427
+ ] }) : null,
1428
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1429
+ import_core8.Textarea,
1430
+ {
1431
+ className: "eth-agent-approval-gate__reason",
1432
+ "aria-label": "Approval reason",
1433
+ disabled: locked,
1434
+ labelText: "Approval rationale",
1435
+ placeholder: "Optional reason",
1436
+ rows: 2,
1437
+ value: reason,
1438
+ onChange: (event) => setReason(event.currentTarget.value)
1439
+ }
1440
+ ),
1441
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "eth-agent-approval-gate__actions", children: [
1442
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1443
+ import_core8.Button,
1444
+ {
1445
+ density: "default",
1446
+ intent: "success",
1447
+ loading: state === "pending",
1448
+ disabled: locked,
1449
+ onClick: () => onApprove?.(reason || void 0),
1450
+ children: state === "approved" ? "Approved" : "Approve"
1451
+ }
1452
+ ),
1453
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1454
+ import_core8.Button,
1455
+ {
1456
+ density: "default",
1457
+ intent: "danger",
1458
+ disabled: locked,
1459
+ onClick: () => onReject?.(reason || void 0),
1460
+ children: state === "rejected" ? "Rejected" : "Reject"
1461
+ }
1462
+ )
1463
+ ] })
1464
+ ] })
1465
+ }
1466
+ );
1467
+ }
1468
+ function EvidenceItem({ item }) {
1469
+ const content = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1470
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "eth-agent-approval-gate__evidence-copy", children: [
1471
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "eth-agent-approval-gate__evidence-label", children: item.label }),
1472
+ item.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "eth-agent-approval-gate__evidence-description", children: item.description }) : null
1473
+ ] }),
1474
+ item.meta ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "eth-agent-approval-gate__evidence-meta", children: item.meta }) : null,
1475
+ item.href ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons3.ExternalLinkIcon, { className: "eth-agent-approval-gate__evidence-icon", size: 16 }) : null
1476
+ ] });
1477
+ if (item.href) {
1478
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1479
+ "a",
1480
+ {
1481
+ className: "eth-agent-approval-gate__evidence-item eth-agent-approval-gate__evidence-item--link",
1482
+ href: item.href,
1483
+ children: content
1484
+ }
1485
+ );
1486
+ }
1487
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "eth-agent-approval-gate__evidence-item", children: content });
1488
+ }
1489
+ function riskLabel(riskLevel) {
1490
+ if (!riskLevel) return "Low";
1491
+ return riskLevel.charAt(0).toUpperCase() + riskLevel.slice(1);
1492
+ }
1493
+ function approvalStateLabel(state) {
1494
+ if (state === "pending") return "Submitting";
1495
+ if (state === "approved") return "Approved";
1496
+ if (state === "rejected") return "Rejected";
1497
+ return "Awaiting decision";
1498
+ }
1499
+ function approvalStatus(state) {
1500
+ if (state === "pending") return "running";
1501
+ if (state === "approved") return "completed";
1502
+ if (state === "rejected") return "blocked";
1503
+ return "approval-required";
1504
+ }
1505
+
1506
+ // src/components/AgentPlanPreview.tsx
1507
+ var import_clsx11 = __toESM(require("clsx"), 1);
1508
+ var import_core9 = require("@echothink-ui/core");
1509
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1510
+ function AgentPlanPreview({ plan, title, className, ...props }) {
1511
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1512
+ import_core9.Surface,
1513
+ {
1514
+ ...props,
1515
+ className: (0, import_clsx11.default)("eth-agent-plan-preview", className),
1516
+ "data-eth-component": "AgentPlanPreview",
1517
+ title: title ?? "Proposed plan",
1518
+ subtitle: "Plan before execution",
1519
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "eth-agent-plan-preview__body", children: [
1520
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "eth-agent-plan-preview__summary", "aria-label": "Plan summary", children: [
1521
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
1522
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "eth-agent-plan-preview__summary-label", children: "Execution plan" }),
1523
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "eth-agent-plan-preview__summary-title", children: plan.title })
1524
+ ] }),
1525
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "eth-agent-plan-preview__summary-count", children: [
1526
+ plan.steps.length,
1527
+ " ",
1528
+ plan.steps.length === 1 ? "step" : "steps"
1529
+ ] })
1530
+ ] }),
1531
+ plan.steps.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ol", { className: "eth-agent-plan-preview__steps", "aria-label": "Proposed execution steps", children: plan.steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1532
+ "li",
1533
+ {
1534
+ className: (0, import_clsx11.default)(
1535
+ "eth-agent-plan-preview__step",
1536
+ step.risks?.length && "eth-agent-plan-preview__step--risk"
1537
+ ),
1538
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("article", { className: "eth-agent-plan-preview__step-card", children: [
1539
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "eth-agent-plan-preview__step-index", "aria-hidden": "true", children: String(index + 1).padStart(2, "0") }),
1540
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "eth-agent-plan-preview__step-main", children: [
1541
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "eth-agent-plan-preview__step-description", children: step.description }),
1542
+ step.durationEstimate || step.risks?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "eth-agent-plan-preview__step-meta", "aria-label": "Step metadata", children: [
1543
+ step.durationEstimate ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core9.Badge, { children: step.durationEstimate }) : null,
1544
+ step.risks?.map((risk) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core9.Badge, { severity: "warning", children: risk }, risk))
1545
+ ] }) : null
1546
+ ] })
1547
+ ] })
1548
+ },
1549
+ step.id
1550
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "eth-agent-plan-preview__empty", children: "No execution steps have been proposed." }),
1551
+ plan.assumptions?.length || plan.risks?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "eth-agent-plan-preview__supporting", children: [
1552
+ plan.assumptions?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TextList, { title: "Assumptions", items: plan.assumptions }) : null,
1553
+ plan.risks?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TextList, { title: "Risks", items: plan.risks, tone: "risk" }) : null
1554
+ ] }) : null
1555
+ ] })
1556
+ }
1557
+ );
1558
+ }
1559
+ function TextList({
1560
+ title,
1561
+ items,
1562
+ tone = "neutral"
1563
+ }) {
1564
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1565
+ "section",
1566
+ {
1567
+ className: (0, import_clsx11.default)(
1568
+ "eth-agent-plan-preview__note-section",
1569
+ `eth-agent-plan-preview__note-section--${tone}`
1570
+ ),
1571
+ children: [
1572
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "eth-agent-plan-preview__note-title", children: title }),
1573
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "eth-agent-plan-preview__note-list", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { children: [
1574
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "eth-agent-plan-preview__note-marker", "aria-hidden": "true" }),
1575
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: item })
1576
+ ] }, item)) })
1577
+ ]
1578
+ }
1579
+ );
1580
+ }
1581
+
1582
+ // src/components/AgentPlanDiff.tsx
1583
+ var React6 = __toESM(require("react"), 1);
1584
+ var import_clsx12 = __toESM(require("clsx"), 1);
1585
+ var import_core10 = require("@echothink-ui/core");
1586
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1587
+ function AgentPlanDiff({
1588
+ before,
1589
+ after,
1590
+ title = "Plan diff",
1591
+ subtitle = "Compare proposed plan changes before execution",
1592
+ className,
1593
+ ...props
1594
+ }) {
1595
+ const diff = React6.useMemo(() => diffPlanSteps(before, after), [before, after]);
1596
+ const summary = React6.useMemo(
1597
+ () => ({
1598
+ added: diff.filter((item) => item.status === "added").length,
1599
+ modified: diff.filter((item) => item.status === "modified").length,
1600
+ removed: diff.filter((item) => item.status === "removed").length,
1601
+ unchanged: diff.filter((item) => item.status === "unchanged").length
1602
+ }),
1603
+ [diff]
1604
+ );
1605
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1606
+ import_core10.Surface,
1607
+ {
1608
+ ...props,
1609
+ className: (0, import_clsx12.default)("eth-agent-plan-diff", className),
1610
+ "data-eth-component": "AgentPlanDiff",
1611
+ subtitle,
1612
+ title,
1613
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "eth-agent-plan-diff__body", children: [
1614
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("dl", { className: "eth-agent-plan-diff__summary", "aria-label": "Plan diff summary", children: [
1615
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SummaryItem, { label: "Added", value: summary.added, tone: "added" }),
1616
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SummaryItem, { label: "Modified", value: summary.modified, tone: "modified" }),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SummaryItem, { label: "Removed", value: summary.removed, tone: "removed" }),
1618
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SummaryItem, { label: "Unchanged", value: summary.unchanged, tone: "unchanged" })
1619
+ ] }),
1620
+ diff.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ol", { className: "eth-agent-plan-diff__list", "aria-label": "Plan step changes", children: diff.map((item) => {
1621
+ const stepId = item.after?.id ?? item.before?.id ?? item.id;
1622
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { className: "eth-agent-plan-diff__entry", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1623
+ "article",
1624
+ {
1625
+ className: (0, import_clsx12.default)(
1626
+ "eth-agent-plan-diff__item",
1627
+ `eth-agent-plan-diff__item--${item.status}`
1628
+ ),
1629
+ children: [
1630
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("header", { className: "eth-agent-plan-diff__item-header", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "eth-agent-plan-diff__item-heading", children: [
1631
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "eth-agent-plan-diff__step-id", children: [
1632
+ "Step ",
1633
+ stepId
1634
+ ] }),
1635
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core10.Badge, { severity: item.severity, children: statusLabelFor(item.status) })
1636
+ ] }) }),
1637
+ item.status === "modified" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "eth-agent-plan-diff__comparison", children: [
1638
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StepSnapshot, { label: "Before", step: item.before }),
1639
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StepSnapshot, { label: "After", step: item.after })
1640
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1641
+ StepSnapshot,
1642
+ {
1643
+ label: snapshotLabelFor(item.status),
1644
+ step: item.after ?? item.before
1645
+ }
1646
+ )
1647
+ ]
1648
+ }
1649
+ ) }, item.id);
1650
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "eth-agent-plan-diff__empty", children: "No plan steps to compare." })
1651
+ ] })
1652
+ }
1653
+ );
1654
+ }
1655
+ function StepSnapshot({ label, step }) {
1656
+ if (!step) return null;
1657
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: "eth-agent-plan-diff__snapshot", children: [
1658
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "eth-agent-plan-diff__snapshot-label", children: label }),
1659
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "eth-agent-plan-diff__snapshot-description", children: step.description }),
1660
+ step.durationEstimate || step.risks?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "eth-agent-plan-diff__snapshot-meta", "aria-label": `${label} metadata`, children: [
1661
+ step.durationEstimate ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core10.Badge, { children: step.durationEstimate }) : null,
1662
+ step.risks?.map((risk) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core10.Badge, { severity: "warning", children: risk }, risk))
1663
+ ] }) : null
1664
+ ] });
1665
+ }
1666
+ function SummaryItem({
1667
+ label,
1668
+ value,
1669
+ tone
1670
+ }) {
1671
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1672
+ "div",
1673
+ {
1674
+ className: (0, import_clsx12.default)(
1675
+ "eth-agent-plan-diff__summary-item",
1676
+ `eth-agent-plan-diff__summary-item--${tone}`
1677
+ ),
1678
+ children: [
1679
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: label }),
1680
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: value })
1681
+ ]
1682
+ }
1683
+ );
1684
+ }
1685
+ function statusLabelFor(status) {
1686
+ switch (status) {
1687
+ case "added":
1688
+ return "Added";
1689
+ case "removed":
1690
+ return "Removed";
1691
+ case "modified":
1692
+ return "Modified";
1693
+ case "unchanged":
1694
+ return "Unchanged";
1695
+ }
1696
+ }
1697
+ function snapshotLabelFor(status) {
1698
+ if (status === "added") return "Added step";
1699
+ if (status === "removed") return "Removed step";
1700
+ return "Step";
1701
+ }
1702
+
1703
+ // src/components/AgentMemoryPanel.tsx
1704
+ var React7 = __toESM(require("react"), 1);
1705
+ var import_clsx13 = __toESM(require("clsx"), 1);
1706
+ var import_core11 = require("@echothink-ui/core");
1707
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1708
+ var kinds = ["user", "project", "feedback", "reference"];
1709
+ function AgentMemoryPanel({
1710
+ entries,
1711
+ onPin,
1712
+ onEdit,
1713
+ onDelete,
1714
+ title = "Agent memory",
1715
+ subtitle = "Stored instructions and retrieved context available to the agent",
1716
+ className,
1717
+ ...props
1718
+ }) {
1719
+ const headingPrefix = React7.useId();
1720
+ const groups = React7.useMemo(
1721
+ () => kinds.map((kind) => ({ kind, entries: entries.filter((entry) => entry.kind === kind) })).filter((group) => group.entries.length),
1722
+ [entries]
1723
+ );
1724
+ const pinnedCount = React7.useMemo(
1725
+ () => entries.filter((entry) => entry.pinned).length,
1726
+ [entries]
1727
+ );
1728
+ const latestUpdatedAt = React7.useMemo(() => {
1729
+ const sortedEntries = entries.filter(
1730
+ (entry) => Boolean(entry.lastUpdatedAt && !Number.isNaN(new Date(entry.lastUpdatedAt).getTime()))
1731
+ ).sort((a, b) => new Date(b.lastUpdatedAt).getTime() - new Date(a.lastUpdatedAt).getTime());
1732
+ return sortedEntries[0]?.lastUpdatedAt;
1733
+ }, [entries]);
1734
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1735
+ import_core11.Surface,
1736
+ {
1737
+ ...props,
1738
+ className: (0, import_clsx13.default)("eth-agent-memory-panel", className),
1739
+ "data-eth-component": "AgentMemoryPanel",
1740
+ subtitle,
1741
+ title,
1742
+ children: !groups.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core11.EmptyState, { title: "No memory entries" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "eth-agent-memory-panel__body", children: [
1743
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("dl", { className: "eth-agent-memory-panel__summary", "aria-label": "Memory summary", children: [
1744
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "eth-agent-memory-panel__summary-item", children: [
1745
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: "Total entries" }),
1746
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: entries.length })
1747
+ ] }),
1748
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "eth-agent-memory-panel__summary-item", children: [
1749
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: "Pinned" }),
1750
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: pinnedCount })
1751
+ ] }),
1752
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "eth-agent-memory-panel__summary-item", children: [
1753
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: "Latest update" }),
1754
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: latestUpdatedAt ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("time", { dateTime: latestUpdatedAt, children: formatDateTime(latestUpdatedAt) }) : "Not recorded" })
1755
+ ] })
1756
+ ] }),
1757
+ groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1758
+ "section",
1759
+ {
1760
+ className: "eth-agent-memory-panel__group",
1761
+ "aria-labelledby": `${headingPrefix}-${group.kind}`,
1762
+ children: [
1763
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: "eth-agent-memory-panel__group-header", children: [
1764
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { id: `${headingPrefix}-${group.kind}`, children: kindTitle(group.kind) }),
1765
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core11.Badge, { severity: "neutral", children: [
1766
+ group.entries.length,
1767
+ " ",
1768
+ group.entries.length === 1 ? "entry" : "entries"
1769
+ ] })
1770
+ ] }),
1771
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "eth-agent-memory-panel__entries", children: group.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1772
+ "article",
1773
+ {
1774
+ className: (0, import_clsx13.default)(
1775
+ "eth-agent-memory-panel__entry",
1776
+ entry.pinned && "eth-agent-memory-panel__entry--pinned"
1777
+ ),
1778
+ children: [
1779
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: "eth-agent-memory-panel__entry-header", children: [
1780
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "eth-agent-memory-panel__entry-title", children: [
1781
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: entry.key }),
1782
+ entry.pinned ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core11.Badge, { severity: "info", children: "Pinned" }) : null
1783
+ ] }),
1784
+ entry.lastUpdatedAt ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1785
+ "time",
1786
+ {
1787
+ className: "eth-agent-memory-panel__updated-at",
1788
+ dateTime: entry.lastUpdatedAt,
1789
+ children: formatDateTime(entry.lastUpdatedAt)
1790
+ }
1791
+ ) : null
1792
+ ] }),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "eth-agent-memory-panel__value", children: entry.value }),
1794
+ onPin || onEdit || onDelete ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1795
+ "div",
1796
+ {
1797
+ className: "eth-agent-memory-panel__actions",
1798
+ "aria-label": `${entry.key} memory actions`,
1799
+ children: [
1800
+ onPin ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1801
+ import_core11.Button,
1802
+ {
1803
+ "aria-label": `${entry.pinned ? "Unpin" : "Pin"} ${entry.key}`,
1804
+ density: "compact",
1805
+ intent: "secondary",
1806
+ onClick: () => onPin(entry.id),
1807
+ children: entry.pinned ? "Unpin" : "Pin"
1808
+ }
1809
+ ) : null,
1810
+ onEdit ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1811
+ import_core11.Button,
1812
+ {
1813
+ "aria-label": `Edit ${entry.key}`,
1814
+ density: "compact",
1815
+ intent: "secondary",
1816
+ onClick: () => onEdit(entry.id),
1817
+ children: "Edit"
1818
+ }
1819
+ ) : null,
1820
+ onDelete ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1821
+ import_core11.Button,
1822
+ {
1823
+ "aria-label": `Delete ${entry.key}`,
1824
+ density: "compact",
1825
+ intent: "danger",
1826
+ onClick: () => onDelete(entry.id),
1827
+ children: "Delete"
1828
+ }
1829
+ ) : null
1830
+ ]
1831
+ }
1832
+ ) : null
1833
+ ]
1834
+ },
1835
+ entry.id
1836
+ )) })
1837
+ ]
1838
+ },
1839
+ group.kind
1840
+ ))
1841
+ ] })
1842
+ }
1843
+ );
1844
+ }
1845
+ function kindTitle(kind) {
1846
+ return kind.charAt(0).toUpperCase() + kind.slice(1);
1847
+ }
1848
+
1849
+ // src/components/AgentContextViewer.tsx
1850
+ var React8 = __toESM(require("react"), 1);
1851
+ var import_clsx14 = __toESM(require("clsx"), 1);
1852
+ var import_core12 = require("@echothink-ui/core");
1853
+ var import_icons4 = require("@echothink-ui/icons");
1854
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1855
+ function AgentContextViewer({
1856
+ sources,
1857
+ onSelect,
1858
+ title = "Context sources",
1859
+ className,
1860
+ ...props
1861
+ }) {
1862
+ const sourceListLabel = typeof title === "string" ? title : "Context sources";
1863
+ const sortedSources = React8.useMemo(
1864
+ () => [...sources].sort((a, b) => (b.relevance ?? -1) - (a.relevance ?? -1)),
1865
+ [sources]
1866
+ );
1867
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1868
+ import_core12.Surface,
1869
+ {
1870
+ ...props,
1871
+ className: (0, import_clsx14.default)("eth-agent-context-viewer", className),
1872
+ "data-eth-component": "AgentContextViewer",
1873
+ title,
1874
+ children: !sortedSources.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core12.EmptyState, { title: "No context sources" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "eth-agent-context-viewer__sources", "aria-label": sourceListLabel, children: sortedSources.map((source) => {
1875
+ const SourceIcon = sourceIcon(source.type);
1876
+ const relevance = source.relevance == null ? null : formatRelevance(source.relevance);
1877
+ const relevanceValue = source.relevance == null ? null : normalizedRelevance(source.relevance);
1878
+ const isInteractive = Boolean(source.href || onSelect);
1879
+ const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1880
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "eth-agent-context-viewer__kind-icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SourceIcon, { size: 18 }) }),
1881
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "eth-agent-context-viewer__main", children: [
1882
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "eth-agent-context-viewer__topline", children: [
1883
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "eth-agent-context-viewer__label", children: source.label }),
1884
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core12.Badge, { severity: "neutral", children: typeLabel(source.type) })
1885
+ ] }),
1886
+ source.excerpt ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "eth-agent-context-viewer__excerpt", children: source.excerpt }) : null
1887
+ ] }),
1888
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "eth-agent-context-viewer__aside", children: [
1889
+ relevance != null && relevanceValue != null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1890
+ "span",
1891
+ {
1892
+ className: "eth-agent-context-viewer__relevance",
1893
+ "aria-label": `Relevance ${relevance}`,
1894
+ children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "eth-agent-context-viewer__relevance-value", children: [
1896
+ "Relevance ",
1897
+ relevance
1898
+ ] }),
1899
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1900
+ "span",
1901
+ {
1902
+ className: "eth-agent-context-viewer__relevance-meter",
1903
+ "aria-hidden": "true",
1904
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { inlineSize: `${relevanceValue}%` } })
1905
+ }
1906
+ )
1907
+ ]
1908
+ }
1909
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "eth-agent-context-viewer__unranked", children: "Unranked" }),
1910
+ source.href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.ExternalLinkIcon, { className: "eth-agent-context-viewer__indicator", size: 16 }) : isInteractive ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.ChevronRightIcon, { className: "eth-agent-context-viewer__indicator", size: 16 }) : null
1911
+ ] })
1912
+ ] });
1913
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { children: source.href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1914
+ "a",
1915
+ {
1916
+ className: (0, import_clsx14.default)(
1917
+ "eth-agent-context-viewer__source",
1918
+ "eth-agent-context-viewer__source--interactive"
1919
+ ),
1920
+ href: source.href,
1921
+ onClick: () => onSelect?.(source),
1922
+ children: content
1923
+ }
1924
+ ) : onSelect ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1925
+ "button",
1926
+ {
1927
+ type: "button",
1928
+ className: (0, import_clsx14.default)(
1929
+ "eth-agent-context-viewer__source",
1930
+ "eth-agent-context-viewer__source--interactive"
1931
+ ),
1932
+ onClick: () => onSelect(source),
1933
+ children: content
1934
+ }
1935
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("article", { className: "eth-agent-context-viewer__source", children: content }) }, source.id);
1936
+ }) })
1937
+ }
1938
+ );
1939
+ }
1940
+ function sourceIcon(type) {
1941
+ switch (type) {
1942
+ case "document":
1943
+ return import_icons4.DocumentIcon;
1944
+ case "query":
1945
+ return import_icons4.SearchIcon;
1946
+ case "tool-result":
1947
+ return import_icons4.AgentRunningIcon;
1948
+ case "message":
1949
+ default:
1950
+ return import_icons4.MessageIcon;
1951
+ }
1952
+ }
1953
+ function typeLabel(type) {
1954
+ return type.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
1955
+ }
1956
+ function formatRelevance(relevance) {
1957
+ return `${normalizedRelevance(relevance)}%`;
1958
+ }
1959
+ function normalizedRelevance(relevance) {
1960
+ const normalized = relevance <= 1 ? relevance * 100 : relevance;
1961
+ return Math.min(100, Math.max(0, Math.round(normalized)));
1962
+ }
1963
+
1964
+ // src/components/AgentRunControls.tsx
1965
+ var React9 = __toESM(require("react"), 1);
1966
+ var import_clsx15 = __toESM(require("clsx"), 1);
1967
+ var import_core13 = require("@echothink-ui/core");
1968
+ var import_icons5 = require("@echothink-ui/icons");
1969
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1970
+ var stateMeta = {
1971
+ running: {
1972
+ label: "Running",
1973
+ severity: "info",
1974
+ description: "The agent is actively executing; pause for review, interrupt with steering, or stop the run."
1975
+ },
1976
+ paused: {
1977
+ label: "Paused",
1978
+ severity: "warning",
1979
+ description: "Execution is held. Resume when the run can continue or stop it to cancel remaining work."
1980
+ },
1981
+ stopped: {
1982
+ label: "Stopped",
1983
+ severity: "neutral",
1984
+ description: "The run was stopped before completion. Retry to start a fresh attempt."
1985
+ },
1986
+ failed: {
1987
+ label: "Failed",
1988
+ severity: "danger",
1989
+ description: "The last run failed. Retry after reviewing the failure context."
1990
+ },
1991
+ completed: {
1992
+ label: "Completed",
1993
+ severity: "success",
1994
+ description: "The run completed. Retry only when a new pass is required."
1995
+ }
1996
+ };
1997
+ function AgentRunControls({
1998
+ state,
1999
+ onPause,
2000
+ onResume,
2001
+ onStop,
2002
+ onRetry,
2003
+ onInterrupt,
2004
+ className,
2005
+ style,
2006
+ "aria-label": ariaLabel,
2007
+ "aria-describedby": ariaDescribedBy,
2008
+ ...props
2009
+ }) {
2010
+ const [interrupting, setInterrupting] = React9.useState(false);
2011
+ const [reason, setReason] = React9.useState("");
2012
+ const descriptionId = React9.useId();
2013
+ const meta = stateMeta[state];
2014
+ const canInterrupt = Boolean((state === "running" || state === "paused") && onInterrupt);
2015
+ React9.useEffect(() => {
2016
+ if (!canInterrupt && interrupting) {
2017
+ setInterrupting(false);
2018
+ setReason("");
2019
+ }
2020
+ }, [canInterrupt, interrupting]);
2021
+ const actions = React9.useMemo(() => {
2022
+ const next = [];
2023
+ if (state === "running") {
2024
+ next.push({
2025
+ id: "pause",
2026
+ label: "Pause",
2027
+ intent: "secondary",
2028
+ disabled: !onPause,
2029
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.PauseIcon, { size: 16 }),
2030
+ onSelect: onPause
2031
+ });
2032
+ }
2033
+ if (state === "paused") {
2034
+ next.push({
2035
+ id: "resume",
2036
+ label: "Resume",
2037
+ intent: "primary",
2038
+ disabled: !onResume,
2039
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.PlayIcon, { size: 16 }),
2040
+ onSelect: onResume
2041
+ });
2042
+ }
2043
+ if ((state === "running" || state === "paused") && onInterrupt) {
2044
+ next.push({
2045
+ id: "interrupt",
2046
+ label: "Interrupt",
2047
+ intent: "tertiary",
2048
+ disabled: false,
2049
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.InterruptIcon, { size: 16 }),
2050
+ onSelect: () => setInterrupting(true)
2051
+ });
2052
+ }
2053
+ if (state === "running" || state === "paused") {
2054
+ next.push({
2055
+ id: "stop",
2056
+ label: "Stop",
2057
+ intent: "danger",
2058
+ disabled: !onStop,
2059
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.StopIcon, { size: 16 }),
2060
+ onSelect: onStop
2061
+ });
2062
+ }
2063
+ if (state === "failed" || state === "stopped" || state === "completed") {
2064
+ next.push({
2065
+ id: "retry",
2066
+ label: "Retry",
2067
+ intent: state === "completed" ? "secondary" : "primary",
2068
+ disabled: !onRetry,
2069
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.RetryIcon, { size: 16 }),
2070
+ onSelect: onRetry
2071
+ });
2072
+ }
2073
+ return next;
2074
+ }, [onInterrupt, onPause, onResume, onRetry, onStop, state]);
2075
+ const describedBy = ariaDescribedBy ? `${ariaDescribedBy} ${descriptionId}` : descriptionId;
2076
+ const sendInterrupt = () => {
2077
+ const trimmedReason = reason.trim();
2078
+ if (!trimmedReason) return;
2079
+ onInterrupt?.(trimmedReason);
2080
+ setReason("");
2081
+ setInterrupting(false);
2082
+ };
2083
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2084
+ "section",
2085
+ {
2086
+ ...props,
2087
+ "aria-label": ariaLabel ?? `${meta.label} agent run controls`,
2088
+ "aria-describedby": describedBy,
2089
+ className: (0, import_clsx15.default)("eth-agent-run-controls", className),
2090
+ "data-eth-component": "AgentRunControls",
2091
+ "data-state": state,
2092
+ style,
2093
+ children: [
2094
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "eth-agent-run-controls__summary", children: [
2095
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "eth-agent-run-controls__heading", children: [
2096
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "eth-agent-run-controls__state-dot", "aria-hidden": "true" }),
2097
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "eth-agent-run-controls__title", children: "Agent run" }),
2098
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core13.Badge, { severity: meta.severity, children: meta.label })
2099
+ ] }),
2100
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { id: descriptionId, className: "eth-agent-run-controls__description", children: meta.description })
2101
+ ] }),
2102
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2103
+ "div",
2104
+ {
2105
+ className: "eth-agent-run-controls__actions",
2106
+ role: "group",
2107
+ "aria-label": `${meta.label} run controls`,
2108
+ children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2109
+ import_core13.Button,
2110
+ {
2111
+ density: "compact",
2112
+ intent: action.intent,
2113
+ disabled: action.disabled,
2114
+ icon: action.icon,
2115
+ onClick: action.onSelect,
2116
+ children: action.label
2117
+ },
2118
+ action.id
2119
+ ))
2120
+ }
2121
+ ),
2122
+ interrupting ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "eth-agent-run-controls__interrupt", children: [
2123
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core13.InlineNotification, { severity: "warning", title: "Interrupt run", children: "Send steering instructions before the agent continues." }),
2124
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2125
+ import_core13.Textarea,
2126
+ {
2127
+ "aria-label": "Interrupt reason",
2128
+ rows: 3,
2129
+ value: reason,
2130
+ onChange: (event) => setReason(event.currentTarget.value)
2131
+ }
2132
+ ),
2133
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "eth-agent-run-controls__interrupt-actions", children: [
2134
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2135
+ import_core13.Button,
2136
+ {
2137
+ density: "compact",
2138
+ intent: "primary",
2139
+ disabled: !reason.trim(),
2140
+ onClick: sendInterrupt,
2141
+ children: "Send interrupt"
2142
+ }
2143
+ ),
2144
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core13.Button, { density: "compact", intent: "ghost", onClick: () => setInterrupting(false), children: "Cancel" })
2145
+ ] })
2146
+ ] }) : null
2147
+ ]
2148
+ }
2149
+ );
2150
+ }
2151
+
2152
+ // src/components/AgentSafetyPanel.tsx
2153
+ var import_clsx16 = __toESM(require("clsx"), 1);
2154
+ var import_core14 = require("@echothink-ui/core");
2155
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2156
+ function AgentSafetyPanel({
2157
+ checks,
2158
+ title = "Safety checks",
2159
+ subtitle,
2160
+ className,
2161
+ ...props
2162
+ }) {
2163
+ const summary = summarizeChecks(checks);
2164
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2165
+ import_core14.Surface,
2166
+ {
2167
+ ...props,
2168
+ className: (0, import_clsx16.default)("eth-agent-safety-panel", className),
2169
+ "data-eth-component": "AgentSafetyPanel",
2170
+ subtitle: subtitle ?? summaryLabel(summary),
2171
+ title,
2172
+ children: !checks.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_core14.EmptyState, { title: "No safety checks", description: "No policy gates are attached to this run." }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__body", children: [
2173
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("dl", { className: "eth-agent-safety-panel__summary", "aria-label": "Safety check summary", children: [
2174
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__summary-item", children: [
2175
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: "Total" }),
2176
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: summary.total })
2177
+ ] }),
2178
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__summary-item eth-agent-safety-panel__summary-item--pass", children: [
2179
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: "Passed" }),
2180
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: summary.pass })
2181
+ ] }),
2182
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__summary-item eth-agent-safety-panel__summary-item--warn", children: [
2183
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: "Review" }),
2184
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: summary.warn })
2185
+ ] }),
2186
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__summary-item eth-agent-safety-panel__summary-item--fail", children: [
2187
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: "Blocked" }),
2188
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: summary.fail })
2189
+ ] })
2190
+ ] }),
2191
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "eth-agent-safety-panel__list", role: "list", children: checks.map((check) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2192
+ "article",
2193
+ {
2194
+ className: (0, import_clsx16.default)(
2195
+ "eth-agent-safety-panel__check",
2196
+ `eth-agent-safety-panel__check--${check.status}`
2197
+ ),
2198
+ role: "listitem",
2199
+ children: [
2200
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "eth-agent-safety-panel__indicator", "aria-hidden": "true" }),
2201
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__check-content", children: [
2202
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "eth-agent-safety-panel__check-main", children: [
2203
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { children: check.label }),
2204
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_core14.Badge, { severity: safetySeverity(check), children: statusLabel7(check.status) })
2205
+ ] }),
2206
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: check.details ?? statusDescription(check.status) })
2207
+ ] })
2208
+ ]
2209
+ },
2210
+ check.id
2211
+ )) })
2212
+ ] })
2213
+ }
2214
+ );
2215
+ }
2216
+ function summarizeChecks(checks) {
2217
+ return checks.reduce(
2218
+ (summary, check) => {
2219
+ summary.total += 1;
2220
+ summary[check.status] += 1;
2221
+ return summary;
2222
+ },
2223
+ { fail: 0, pass: 0, total: 0, warn: 0 }
2224
+ );
2225
+ }
2226
+ function summaryLabel(summary) {
2227
+ if (summary.total === 0) return "No policy gates are active.";
2228
+ if (summary.fail > 0) return `${summary.fail} blocking ${plural("issue", summary.fail)} found.`;
2229
+ if (summary.warn > 0) {
2230
+ return summary.warn === 1 ? "1 check needs review." : `${summary.warn} checks need review.`;
2231
+ }
2232
+ return "All policy checks passed.";
2233
+ }
2234
+ function statusLabel7(status) {
2235
+ if (status === "pass") return "Passed";
2236
+ if (status === "warn") return "Review needed";
2237
+ return "Blocked";
2238
+ }
2239
+ function statusDescription(status) {
2240
+ if (status === "pass") return "No policy issue detected.";
2241
+ if (status === "warn") return "Review recommended before proceeding.";
2242
+ return "Policy gate blocked this action.";
2243
+ }
2244
+ function plural(label, count) {
2245
+ return count === 1 ? label : `${label}s`;
2246
+ }
2247
+
2248
+ // src/components/AgentInterruptionPanel.tsx
2249
+ var import_clsx17 = __toESM(require("clsx"), 1);
2250
+ var import_core15 = require("@echothink-ui/core");
2251
+ var import_icons6 = require("@echothink-ui/icons");
2252
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2253
+ var defaultMetadata = [
2254
+ { label: "Mode", value: "Steering interrupt" },
2255
+ { label: "Delivery", value: "Before next agent step" }
2256
+ ];
2257
+ function AgentInterruptionPanel({
2258
+ prompt,
2259
+ onChange,
2260
+ onSubmit,
2261
+ disabled,
2262
+ title = "Interrupt agent",
2263
+ subtitle = "Send operator guidance before the agent continues.",
2264
+ metadata = defaultMetadata,
2265
+ promptLabel = "Steering instruction",
2266
+ helperText = "Delivered before the next agent step.",
2267
+ placeholder = "Tell the agent what to change, stop, or prioritize.",
2268
+ submitLabel = "Send interruption",
2269
+ className,
2270
+ ...props
2271
+ }) {
2272
+ const hasPrompt = Boolean(prompt.trim());
2273
+ const submit = () => {
2274
+ if (!disabled && hasPrompt) onSubmit?.(prompt);
2275
+ };
2276
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2277
+ import_core15.Surface,
2278
+ {
2279
+ ...props,
2280
+ className: (0, import_clsx17.default)("eth-agent-interruption-panel", className),
2281
+ "data-eth-component": "AgentInterruptionPanel",
2282
+ metadata,
2283
+ subtitle,
2284
+ title,
2285
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "eth-agent-interruption-panel__body", children: [
2286
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core15.InlineNotification, { severity: "warning", title: "Steering interrupt", children: "The agent will receive this instruction before continuing the current run." }),
2287
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2288
+ import_core15.Textarea,
2289
+ {
2290
+ className: "eth-agent-interruption-panel__prompt",
2291
+ disabled,
2292
+ helperText,
2293
+ labelText: promptLabel,
2294
+ placeholder,
2295
+ rows: 4,
2296
+ value: prompt,
2297
+ onChange: (event) => onChange(event.currentTarget.value),
2298
+ onKeyDown: (event) => {
2299
+ if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
2300
+ event.preventDefault();
2301
+ submit();
2302
+ }
2303
+ }
2304
+ }
2305
+ ),
2306
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "eth-agent-interruption-panel__actions", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2307
+ import_core15.Button,
2308
+ {
2309
+ disabled: disabled || !hasPrompt,
2310
+ icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons6.InterruptIcon, { size: 16 }),
2311
+ onClick: submit,
2312
+ children: submitLabel
2313
+ }
2314
+ ) })
2315
+ ] })
2316
+ }
2317
+ );
2318
+ }
2319
+
2320
+ // src/components/AgentHandoffPanel.tsx
2321
+ var React10 = __toESM(require("react"), 1);
2322
+ var import_clsx18 = __toESM(require("clsx"), 1);
2323
+ var import_core16 = require("@echothink-ui/core");
2324
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2325
+ function AgentHandoffPanel({
2326
+ itemRef,
2327
+ agentRef,
2328
+ assigneeOptions = [],
2329
+ selectedAssigneeId,
2330
+ reason,
2331
+ reasonSchema,
2332
+ disabled,
2333
+ onAssigneeChange,
2334
+ onReasonChange,
2335
+ onSubmit,
2336
+ title = "Agent handoff",
2337
+ className,
2338
+ ...props
2339
+ }) {
2340
+ const [internalAssigneeId, setInternalAssigneeId] = React10.useState(selectedAssigneeId);
2341
+ const [internalReason, setInternalReason] = React10.useState(reason ?? "");
2342
+ const assigneeId = selectedAssigneeId ?? internalAssigneeId;
2343
+ const handoffReason = reason ?? internalReason;
2344
+ const reasonRequired = reasonSchema?.required ?? true;
2345
+ const canSubmit = Boolean(assigneeId) && (!reasonRequired || Boolean(handoffReason.trim()));
2346
+ const selectAssignee = (id) => {
2347
+ setInternalAssigneeId(id);
2348
+ onAssigneeChange?.(id);
2349
+ };
2350
+ const changeReason = (value) => {
2351
+ setInternalReason(value);
2352
+ onReasonChange?.(value);
2353
+ };
2354
+ const reasonId = React10.useId();
2355
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2356
+ import_core16.Surface,
2357
+ {
2358
+ ...props,
2359
+ className: (0, import_clsx18.default)("eth-agent-handoff-panel", className),
2360
+ "data-eth-component": "AgentHandoffPanel",
2361
+ title,
2362
+ subtitle: [agentRef, itemRef].filter(Boolean).join(" \xB7 ") || void 0,
2363
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "eth-agent-handoff-panel__body", children: [
2364
+ !assigneeOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_core16.EmptyState, { title: "No handoff targets" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2365
+ "div",
2366
+ {
2367
+ className: "eth-agent-handoff-panel__target-list",
2368
+ role: "listbox",
2369
+ "aria-label": "Handoff targets",
2370
+ children: assigneeOptions.map((target) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2371
+ "button",
2372
+ {
2373
+ type: "button",
2374
+ role: "option",
2375
+ "aria-selected": assigneeId === target.id,
2376
+ className: (0, import_clsx18.default)(
2377
+ "eth-agent-handoff-panel__target",
2378
+ assigneeId === target.id && "eth-agent-handoff-panel__target--selected"
2379
+ ),
2380
+ disabled,
2381
+ onClick: () => selectAssignee(target.id),
2382
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "eth-agent-handoff-panel__target-main", children: [
2383
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "eth-agent-handoff-panel__target-copy", children: [
2384
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { className: "eth-agent-handoff-panel__target-label", children: target.label }),
2385
+ target.description ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "eth-agent-handoff-panel__target-description", children: target.description }) : null
2386
+ ] }),
2387
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "eth-agent-handoff-panel__target-meta", children: [
2388
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_core16.Badge, { severity: "neutral", children: target.type }),
2389
+ target.status ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2390
+ import_core16.StatusDot,
2391
+ {
2392
+ status: target.status,
2393
+ label: formatHandoffStatus(target.status)
2394
+ }
2395
+ ) : null
2396
+ ] })
2397
+ ] })
2398
+ },
2399
+ target.id
2400
+ ))
2401
+ }
2402
+ ),
2403
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2404
+ import_core16.FormField,
2405
+ {
2406
+ id: reasonId,
2407
+ label: reasonSchema?.label ?? "Handoff reason",
2408
+ required: reasonRequired,
2409
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2410
+ import_core16.Textarea,
2411
+ {
2412
+ className: "eth-agent-handoff-panel__reason",
2413
+ disabled,
2414
+ placeholder: reasonSchema?.placeholder ?? "Explain what the next owner should do.",
2415
+ required: reasonRequired,
2416
+ rows: 3,
2417
+ value: handoffReason,
2418
+ onChange: (event) => changeReason(event.currentTarget.value)
2419
+ }
2420
+ )
2421
+ }
2422
+ ),
2423
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "eth-agent-handoff-panel__actions", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2424
+ import_core16.Button,
2425
+ {
2426
+ disabled: disabled || !canSubmit,
2427
+ onClick: () => onSubmit?.({ assigneeId, reason: handoffReason }),
2428
+ children: "Handoff"
2429
+ }
2430
+ ) })
2431
+ ] })
2432
+ }
2433
+ );
2434
+ }
2435
+ function formatHandoffStatus(status) {
2436
+ return status ? status.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ") : void 0;
2437
+ }
2438
+
2439
+ // src/components/AgentGeneratedArtifactPanel.tsx
2440
+ var React11 = __toESM(require("react"), 1);
2441
+ var import_clsx19 = __toESM(require("clsx"), 1);
2442
+ var import_core17 = require("@echothink-ui/core");
2443
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2444
+ function AgentGeneratedArtifactPanel({
2445
+ artifacts,
2446
+ onSelect,
2447
+ selectedId,
2448
+ density,
2449
+ title = "Generated artifacts",
2450
+ className,
2451
+ ...props
2452
+ }) {
2453
+ const [internalSelectedId, setInternalSelectedId] = React11.useState(
2454
+ selectedId ?? artifacts[0]?.id
2455
+ );
2456
+ const [previewOpen, setPreviewOpen] = React11.useState(false);
2457
+ const selectedArtifact = artifacts.find((artifact) => artifact.id === (selectedId ?? internalSelectedId)) ?? artifacts[0];
2458
+ const compact = density === "compact";
2459
+ const selectArtifact = (artifact) => {
2460
+ setInternalSelectedId(artifact.id);
2461
+ setPreviewOpen(true);
2462
+ onSelect?.(artifact);
2463
+ };
2464
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2465
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2466
+ import_core17.Surface,
2467
+ {
2468
+ ...props,
2469
+ density,
2470
+ className: (0, import_clsx19.default)("eth-agent-generated-artifact-panel", className),
2471
+ "data-eth-component": "AgentGeneratedArtifactPanel",
2472
+ title,
2473
+ children: !artifacts.length ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core17.EmptyState, { title: "No artifacts generated" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2474
+ "div",
2475
+ {
2476
+ className: "eth-agent-generated-artifact-panel__layout",
2477
+ style: {
2478
+ gridTemplateColumns: compact ? "1fr" : "minmax(220px, 320px) minmax(0, 1fr)"
2479
+ },
2480
+ children: [
2481
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2482
+ ArtifactList,
2483
+ {
2484
+ artifacts,
2485
+ selectedId: selectedArtifact?.id,
2486
+ onSelect: selectArtifact
2487
+ }
2488
+ ),
2489
+ !compact ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactPreview, { artifact: selectedArtifact }) : null
2490
+ ]
2491
+ }
2492
+ )
2493
+ }
2494
+ ),
2495
+ compact ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2496
+ import_core17.Drawer,
2497
+ {
2498
+ open: previewOpen && Boolean(selectedArtifact),
2499
+ title: selectedArtifact?.label ?? "Artifact preview",
2500
+ onClose: () => setPreviewOpen(false),
2501
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactPreview, { artifact: selectedArtifact })
2502
+ }
2503
+ ) : null
2504
+ ] });
2505
+ }
2506
+ function ArtifactList({
2507
+ artifacts,
2508
+ selectedId,
2509
+ onSelect
2510
+ }) {
2511
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2512
+ "div",
2513
+ {
2514
+ className: "eth-agent-generated-artifact-panel__list",
2515
+ role: "group",
2516
+ "aria-label": "Generated artifacts",
2517
+ children: artifacts.map((artifact) => {
2518
+ const selected = selectedId === artifact.id;
2519
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2520
+ "button",
2521
+ {
2522
+ type: "button",
2523
+ "aria-pressed": selected,
2524
+ className: (0, import_clsx19.default)(
2525
+ "eth-agent-generated-artifact-panel__item",
2526
+ selected && "eth-agent-generated-artifact-panel__item--selected"
2527
+ ),
2528
+ onClick: () => onSelect(artifact),
2529
+ children: [
2530
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "eth-agent-generated-artifact-panel__item-topline", children: [
2531
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "eth-agent-generated-artifact-panel__item-title", children: artifact.label }),
2532
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "eth-agent-generated-artifact-panel__kind", children: artifactKindLabel(artifact.kind) })
2533
+ ] }),
2534
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "eth-agent-generated-artifact-panel__item-meta", children: artifactMeta(artifact).join(" \xB7 ") }),
2535
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "eth-agent-generated-artifact-panel__item-status", children: artifactPreviewStatus(artifact) })
2536
+ ]
2537
+ },
2538
+ artifact.id
2539
+ );
2540
+ })
2541
+ }
2542
+ );
2543
+ }
2544
+ function ArtifactPreview({ artifact }) {
2545
+ const headingId = React11.useId();
2546
+ if (!artifact) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core17.EmptyState, { title: "Select an artifact" });
2547
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "eth-agent-generated-artifact-panel__preview", "aria-labelledby": headingId, children: [
2548
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "eth-agent-generated-artifact-panel__preview-header", children: [
2549
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "eth-agent-generated-artifact-panel__preview-heading", children: [
2550
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { id: headingId, children: artifact.label }),
2551
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "eth-agent-generated-artifact-panel__preview-meta", children: [
2552
+ artifactMeta(artifact).map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: item }, item)),
2553
+ artifact.mimeType ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: artifact.mimeType }) : null
2554
+ ] })
2555
+ ] }),
2556
+ artifact.href ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core17.LinkButton, { href: artifact.href, density: "compact", intent: "secondary", children: "Open" }) : null
2557
+ ] }),
2558
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "eth-agent-generated-artifact-panel__preview-body", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactPreviewBody, { artifact }) })
2559
+ ] });
2560
+ }
2561
+ function ArtifactPreviewBody({ artifact }) {
2562
+ const content = artifact.content?.trim();
2563
+ if (artifact.kind === "image" && artifact.previewUrl) {
2564
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { alt: artifact.label, src: artifact.previewUrl });
2565
+ }
2566
+ if (artifact.kind === "code" && content) {
2567
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { children: content }) });
2568
+ }
2569
+ if (artifact.previewUrl) {
2570
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("iframe", { title: artifact.label, src: artifact.previewUrl });
2571
+ }
2572
+ if (content) {
2573
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "eth-agent-generated-artifact-panel__text-preview", children: content });
2574
+ }
2575
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "eth-agent-generated-artifact-panel__empty-preview", role: "status", children: [
2576
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "eth-agent-generated-artifact-panel__empty-title", children: "Preview unavailable" }),
2577
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "eth-agent-generated-artifact-panel__empty-description", children: artifact.href ? "Open the artifact to inspect the generated output." : "Artifact saved without an inline preview." })
2578
+ ] });
2579
+ }
2580
+ function artifactMeta(artifact) {
2581
+ return [artifact.size, formatDateTime(artifact.createdAt)].filter(
2582
+ (item) => Boolean(item)
2583
+ );
2584
+ }
2585
+ function artifactKindLabel(kind) {
2586
+ switch (kind) {
2587
+ case "chart":
2588
+ return "Chart";
2589
+ case "code":
2590
+ return "Code";
2591
+ case "doc":
2592
+ return "Doc";
2593
+ case "file":
2594
+ return "File";
2595
+ case "image":
2596
+ return "Image";
2597
+ }
2598
+ }
2599
+ function artifactPreviewStatus(artifact) {
2600
+ if (artifact.kind === "image" && artifact.previewUrl) return "Inline image preview";
2601
+ if (artifact.kind === "code" && artifact.content?.trim()) return "Inline code preview";
2602
+ if (artifact.previewUrl) return "Embedded preview";
2603
+ if (artifact.content?.trim()) return "Inline text preview";
2604
+ if (artifact.href) return "Open externally";
2605
+ return "No inline preview";
2606
+ }
2607
+
2608
+ // src/components/AppDomainAgentPanel.tsx
2609
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2610
+ function AppDomainAgentPanel({
2611
+ appDomainRef,
2612
+ agentRef,
2613
+ projectRef,
2614
+ messages = [],
2615
+ state,
2616
+ prompt = "",
2617
+ onPromptChange,
2618
+ onSubmit,
2619
+ attachments,
2620
+ onAttachmentRemove,
2621
+ runControls,
2622
+ children,
2623
+ ...props
2624
+ }) {
2625
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2626
+ ChatAgentRail,
2627
+ {
2628
+ ...props,
2629
+ agentRef,
2630
+ projectRef,
2631
+ messages,
2632
+ state,
2633
+ prompt,
2634
+ onPromptChange: onPromptChange ?? (() => void 0),
2635
+ onSubmit,
2636
+ attachments,
2637
+ onAttachmentRemove,
2638
+ runControls,
2639
+ scopeLabel: appDomainRef,
2640
+ header: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "eth-agent-app-domain-panel__header", children: [
2641
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "eth-agent-app-domain-panel__eyebrow", children: "App domain" }),
2642
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h2", { className: "eth-agent-app-domain-panel__title", children: appDomainRef }),
2643
+ agentRef || projectRef ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "eth-agent-app-domain-panel__meta", "aria-label": "Agent panel scope", children: [
2644
+ agentRef ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
2645
+ "Agent ",
2646
+ agentRef
2647
+ ] }) : null,
2648
+ projectRef ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
2649
+ "Project ",
2650
+ projectRef
2651
+ ] }) : null
2652
+ ] }) : null,
2653
+ children ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "eth-agent-app-domain-panel__slot", children }) : null
2654
+ ] }),
2655
+ "data-eth-component": "AppDomainAgentPanel"
2656
+ }
2657
+ );
2658
+ }
2659
+
2660
+ // src/index.tsx
2661
+ var AgentComponentNames = [
2662
+ "LeftAgentRail",
2663
+ "ChatAgentRail",
2664
+ "AgentMessageList",
2665
+ "AgentPromptBox",
2666
+ "ScopeAttachmentPanel",
2667
+ "AgentStateBadge",
2668
+ "AgentThinkingPanel",
2669
+ "AgentThinkingChain",
2670
+ "AgentTraceViewer",
2671
+ "AgentToolCallLog",
2672
+ "AgentApprovalGate",
2673
+ "AgentPlanPreview",
2674
+ "AgentPlanDiff",
2675
+ "AgentMemoryPanel",
2676
+ "AgentContextViewer",
2677
+ "AgentRunControls",
2678
+ "AgentSafetyPanel",
2679
+ "AgentInterruptionPanel",
2680
+ "AgentHandoffPanel",
2681
+ "AgentGeneratedArtifactPanel",
2682
+ "AppDomainAgentPanel"
2683
+ ];
2684
+ // Annotate the CommonJS export names for ESM import in node:
2685
+ 0 && (module.exports = {
2686
+ AgentApprovalGate,
2687
+ AgentComponentNames,
2688
+ AgentContextViewer,
2689
+ AgentGeneratedArtifactPanel,
2690
+ AgentHandoffPanel,
2691
+ AgentInterruptionPanel,
2692
+ AgentMemoryPanel,
2693
+ AgentMessageList,
2694
+ AgentPlanDiff,
2695
+ AgentPlanPreview,
2696
+ AgentPromptBox,
2697
+ AgentRunControls,
2698
+ AgentSafetyPanel,
2699
+ AgentStateBadge,
2700
+ AgentThinkingChain,
2701
+ AgentThinkingPanel,
2702
+ AgentToolCallLog,
2703
+ AgentTraceViewer,
2704
+ AppDomainAgentPanel,
2705
+ ChatAgentRail,
2706
+ LeftAgentRail,
2707
+ ScopeAttachmentPanel
2708
+ });
2709
+ //# sourceMappingURL=index.cjs.map