Skip to content

Agent Zero AI framework

step detail modal for all events

3clyp50cc276a0f5b67
diff --git a/webui/components/messages/process-group/process-group.css b/webui/components/messages/process-group/process-group.css
index 51bd29bfd..671ed5414 100644
--- a/webui/components/messages/process-group/process-group.css
+++ b/webui/components/messages/process-group/process-group.css
@@ -893,3 +893,12 @@
.light-mode .process-step-detail-content .screenshot-img:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
+
+/* View Details button in step detail */
+.step-detail-actions {
+ display: flex;
+ padding-left: 18px;
+ margin-bottom: 1rem;
+}
+
+
diff --git a/webui/components/modals/process-step-detail/process-step-detail.html b/webui/components/modals/process-step-detail/process-step-detail.html
new file mode 100644
index 000000000..0667646b1
--- /dev/null
+++ b/webui/components/modals/process-step-detail/process-step-detail.html
@@ -0,0 +1,603 @@
+<html>
+
+<head>
+ <title>Step Details</title>
+ <script type="module">
+ import { store } from "/components/modals/process-step-detail/step-detail-store.js";
+ </script>
+</head>
+
+<body>
+ <div x-data="{ showRaw: false }"
+ x-effect="if (showRaw) { $nextTick(() => $store.stepDetail.initRawEditor()) } else { $store.stepDetail.destroyRawEditor() }">
+ <template x-if="$store.stepDetail && $store.stepDetail.selectedStepForDetail">
+ <div class="step-detail-container">
+ <!-- Compact Modal Header -->
+ <div class="modal-header modal-header-compact">
+ <div class="header-info">
+ <span class="status-badge"
+ :class="$store.processGroup.getStatusColorClass($store.stepDetail.selectedStepForDetail?.type, $store.stepDetail.selectedStepForDetail?.toolName || $store.stepDetail.selectedStepForDetail?.kvps?.tool_name)"
+ x-text="$store.processGroup.getStepCode($store.stepDetail.selectedStepForDetail?.type, $store.stepDetail.selectedStepForDetail?.toolName || $store.stepDetail.selectedStepForDetail?.kvps?.tool_name)"></span>
+ <span class="step-type-label" x-text="$store.stepDetail.formatStepType($store.stepDetail.selectedStepForDetail?.type)"></span>
+ <template x-if="$store.stepDetail.selectedStepForDetail?.toolName || $store.stepDetail.selectedStepForDetail?.kvps?.tool_name">
+ <span class="tool-name-badge" x-text="$store.stepDetail.selectedStepForDetail?.toolName || $store.stepDetail.selectedStepForDetail?.kvps?.tool_name"></span>
+ </template>
+ <template x-if="$store.stepDetail.selectedStepForDetail?.timestamp">
+ <span class="timestamp-text" x-text="$store.stepDetail.formatTimestamp($store.stepDetail.selectedStepForDetail?.timestamp)"></span>
+ </template>
+ <template x-if="$store.stepDetail.selectedStepForDetail?.durationMs">
+ <span class="duration-badge" x-text="$store.stepDetail.formatDuration($store.stepDetail.selectedStepForDetail?.durationMs)"></span>
+ </template>
+ </div>
+ <div class="header-actions">
+ <button class="btn btn-action-header copy-all"
+ @click="$store.stepDetail.copyToClipboard($store.stepDetail.formatStepForCopy($store.stepDetail.selectedStepForDetail))"
+ title="Copy Complete Step with Metadata">
+ <span class="material-symbols-outlined">copy_all</span> All
+ </button>
+ <button class="btn btn-action-header copy-content"
+ @click="$store.stepDetail.copyToClipboard($store.stepDetail.getStepPrimaryContent($store.stepDetail.selectedStepForDetail))"
+ title="Copy Primary Content Only">
+ <span class="material-symbols-outlined">content_copy</span> Content
+ </button>
+ <button class="btn btn-action-header toggle-raw"
+ @click="showRaw = !showRaw"
+ :class="{ 'active': showRaw }"
+ title="Toggle Raw JSON View">
+ <span class="material-symbols-outlined">data_object</span>
+ </button>
+ </div>
+ </div>
+
+ <!-- Modal Body -->
+ <div class="modal-body">
+ <!-- Raw JSON View with ACE Editor -->
+ <div class="raw-json-section" x-show="showRaw">
+ <div id="step-detail-raw-editor"></div>
+ </div>
+
+ <!-- Formatted View -->
+ <div class="formatted-content" x-show="!showRaw">
+ <!-- Heading/Title Section -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.heading">
+ <div class="content-block">
+ <h4>Heading</h4>
+ <div class="content-text" x-text="$store.stepDetail.cleanHeading($store.stepDetail.selectedStepForDetail?.heading)"></div>
+ </div>
+ </template>
+
+ <!-- GEN (agent) Type: Thoughts and Reasoning -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.type === 'agent'">
+ <div class="type-specific-content">
+ <!-- Reasoning (native model thinking) -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.reasoning">
+ <div class="content-block reasoning-block">
+ <h4><span class="material-symbols-outlined">psychology</span> Reasoning</h4>
+ <div class="content-text reasoning-content" x-text="$store.stepDetail.cleanTextValue($store.stepDetail.selectedStepForDetail?.kvps?.reasoning)"></div>
+ </div>
+ </template>
+ <!-- Thoughts -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.thoughts">
+ <div class="content-block thoughts-block">
+ <h4><span class="material-symbols-outlined">lightbulb</span> Thoughts</h4>
+ <div class="content-text thoughts-content" x-text="$store.stepDetail.cleanTextValue($store.stepDetail.selectedStepForDetail?.kvps?.thoughts)"></div>
+ </div>
+ </template>
+ <!-- Tool Call Preview -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.tool_name || $store.stepDetail.selectedStepForDetail?.kvps?.tool_args">
+ <div class="content-block tool-call-block">
+ <h4>
+ <span class="material-symbols-outlined">build</span>
+ <span>Tool Call</span>
+ <template x-if="$store.stepDetail.selectedStepForDetail?.toolName || $store.stepDetail.selectedStepForDetail?.kvps?.tool_name">
+ <span class="tool-name-badge" x-text="$store.stepDetail.selectedStepForDetail?.toolName || $store.stepDetail.selectedStepForDetail?.kvps?.tool_name"></span>
+ </template>
+ </h4>
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.tool_args">
+ <div class="tool-args-container">
+ <template x-for="[key, value] in Object.entries($store.stepDetail.selectedStepForDetail?.kvps?.tool_args || {})" :key="key">
+ <div class="tool-arg-row">
+ <span class="arg-key" x-text="key"></span>
+ <span class="arg-value" x-text="$store.stepDetail.formatValue(value)"></span>
+ </div>
+ </template>
+ </div>
+ </template>
+ </div>
+ </template>
+ </div>
+ </template>
+
+ <!-- EXE (code_exe) Type: Terminal Output -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.type === 'code_exe'">
+ <div class="type-specific-content">
+ <!-- Command Info -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.code">
+ <div class="content-block command-block">
+ <h4><span class="material-symbols-outlined">terminal</span> Command</h4>
+ <div class="command-info">
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.runtime">
+ <span class="runtime-badge" x-text="$store.stepDetail.selectedStepForDetail?.kvps?.runtime"></span>
+ </template>
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.session != null">
+ <span class="session-badge" x-text="'Session ' + $store.stepDetail.selectedStepForDetail?.kvps?.session"></span>
+ </template>
+ </div>
+ <pre class="command-text" x-text="$store.stepDetail.selectedStepForDetail?.kvps?.code"></pre>
+ </div>
+ </template>
+ <!-- Terminal Output -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.content">
+ <div class="content-block terminal-block">
+ <h4><span class="material-symbols-outlined">output</span> Output</h4>
+ <pre class="terminal-output terminal-output-full" x-text="$store.stepDetail.selectedStepForDetail?.content"></pre>
+ </div>
+ </template>
+ </div>
+ </template>
+
+ <!-- Tool/MCP Type: Arguments and Result -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.type === 'tool' || $store.stepDetail.selectedStepForDetail?.type === 'mcp'">
+ <div class="type-specific-content">
+ <!-- Tool Arguments -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.tool_args">
+ <div class="content-block">
+ <h4><span class="material-symbols-outlined">build</span> Arguments</h4>
+ <div class="tool-args-grid">
+ <template x-for="[key, value] in Object.entries($store.stepDetail.selectedStepForDetail?.kvps?.tool_args || {})" :key="key">
+ <div class="tool-arg-item result-content">
+ <span class="arg-key" x-text="key"></span>
+ <span class="arg-value" x-text="$store.stepDetail.formatValue(value)"></span>
+ </div>
+ </template>
+ </div>
+ </div>
+ </template>
+ <!-- Result -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.result || $store.stepDetail.selectedStepForDetail?.content">
+ <div class="content-block">
+ <h4><span class="material-symbols-outlined">output</span> Result</h4>
+ <pre class="result-content" x-text="$store.stepDetail.selectedStepForDetail?.kvps?.result || $store.stepDetail.selectedStepForDetail?.content"></pre>
+ </div>
+ </template>
+ </div>
+ </template>
+
+ <!-- Browser Type: Screenshot -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.type === 'browser'">
+ <div class="type-specific-content">
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps?.screenshot">
+ <div class="content-block">
+ <h4><span class="material-symbols-outlined">screenshot_monitor</span> Screenshot</h4>
+ <img class="screenshot-full"
+ :src="$store.stepDetail.selectedStepForDetail?.kvps?.screenshot?.replace('img://', '/image_get?path=')"
+ alt="Browser Screenshot" />
+ </div>
+ </template>
+ </div>
+ </template>
+
+ <!-- Generic KVPs for other types -->
+ <template x-if="!['agent', 'code_exe', 'tool', 'mcp', 'browser'].includes($store.stepDetail.selectedStepForDetail?.type)">
+ <div class="type-specific-content">
+ <template x-if="$store.stepDetail.selectedStepForDetail?.kvps">
+ <div class="content-block">
+ <h4>Details</h4>
+ <div class="kvps-display">
+ <template x-for="[key, value] in Object.entries($store.stepDetail.selectedStepForDetail?.kvps || {}).filter(([k]) => k !== 'reasoning')" :key="key">
+ <div class="kvp-item">
+ <span class="kvp-key" x-text="$store.stepDetail.formatKey(key)"></span>
+ <span class="kvp-value" x-text="$store.stepDetail.formatValue(value)"></span>
+ </div>
+ </template>
+ </div>
+ </div>
+ </template>
+ <!-- Content -->
+ <template x-if="$store.stepDetail.selectedStepForDetail?.content">
+ <div class="content-block">
+ <h4>Content</h4>
+ <pre class="tool-arg-item" x-text="$store.stepDetail.selectedStepForDetail?.content"></pre>
+ </div>
+ </template>
+ </div>
+ </template>
+ </div>
+ </div>
+ </div>
+ </template>
+ </div>
+
+ <style>
+ .step-detail-container {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ max-height: 80vh;
+ }
+
+ .modal-header-compact {
+ background: linear-gradient(135deg, var(--color-panel) 0%, var(--color-background) 100%);
+ position: sticky;
+ padding: 0.75rem 1rem;
+ border-radius: 6px 6px 0 0;
+ top: 0;
+ z-index: 100;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 0.5rem;
+ border-bottom: 1px solid var(--color-border);
+ }
+
+ .header-info {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ flex-wrap: wrap;
+ }
+
+ .status-badge {
+ padding: 0.25rem 0.5rem;
+ border-radius: 8px;
+ font-size: 0.75rem;
+ font-weight: 600;
+ font-family: var(--font-mono);
+ }
+
+ .step-type-label {
+ font-weight: 500;
+ color: var(--color-text);
+ }
+
+ .tool-name-badge {
+ background: var(--color-message-bg);
+ color: var(--color-text);
+ padding: 0.2rem 0.5rem;
+ border-radius: 8px;
+ font-size: 0.75rem;
+ font-family: var(--font-mono);
+ border: 1px solid var(--color-border);
+ }
+
+ .timestamp-text,
+ .duration-badge {
+ color: var(--color-text);
+ opacity: 0.7;
+ padding: 0.2rem 0.5rem;
+ border-radius: var(--border-radius);
+ font-size: 0.75rem;
+ border: 1px solid var(--color-border);
+ }
+
+ .header-actions {
+ display: flex;
+ gap: 0.5rem;
+ }
+
+ .btn-action-header {
+ padding: 0.4rem 0.6rem;
+ display: flex;
+ align-items: center;
+ gap: 0.25rem;
+ background: var(--color-message-bg);
+ color: var(--color-text);
+ border: 1px solid var(--color-border);
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 0.8rem;
+ transition: all 0.15s ease;
+ }
+
+ .btn-action-header .material-symbols-outlined {
+ font-size: 18px;
+ }
+
+ .btn-action-header:hover {
+ border-color: var(--color-primary);
+ color: var(--color-primary);
+ }
+
+ .btn-action-header.active {
+ background: var(--color-primary);
+ color: white;
+ border-color: var(--color-primary);
+ }
+
+ .modal-body {
+ flex: 1;
+ overflow-y: auto;
+ padding: 1rem;
+ }
+
+ .raw-json-section {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ }
+
+ #step-detail-raw-editor {
+ width: 100%;
+ height: 60vh;
+ border-radius: 6px;
+ overflow: hidden;
+ border: 1px solid var(--color-border);
+ }
+
+ #step-detail-raw-editor .ace_scrollbar-v {
+ overflow-y: auto;
+ }
+
+ #step-detail-raw-editor::-webkit-scrollbar {
+ width: 0;
+ }
+
+ .formatted-content {
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+ }
+
+ .content-block {
+ background: var(--color-panel);
+ border: 1px solid var(--color-border);
+ border-radius: 6px;
+ padding: 1rem;
+ }
+
+ .content-block h4 {
+ margin: 0 0 0.75rem 0;
+ color: var(--color-text);
+ font-size: 0.9rem;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ opacity: 0.8;
+ }
+
+ .content-block h4 .material-symbols-outlined {
+ font-size: 18px;
+ opacity: 0.7;
+ }
+
+ .content-block:last-child {
+ margin-top: 1rem;
+ }
+
+ .content-text {
+ color: var(--color-text);
+ line-height: 1.6;
+ white-space: pre-wrap;
+ word-break: break-word;
+ }
+
+ .thoughts-block {
+ margin-bottom: 1rem;
+ }
+
+ .thoughts-content {
+ opacity: 0.8;
+ }
+
+ .reasoning-block {
+ margin-bottom: 1rem;
+ }
+
+ .reasoning-content {
+ opacity: 0.75;
+ font-style: italic;
+ }
+
+ .tool-call-block {
+ margin-bottom: 1rem;
+ }
+
+ .tool-name-inline {
+ background: var(--color-primary);
+ color: white;
+ padding: 0.15rem 0.5rem;
+ border-radius: 4px;
+ font-size: 0.8rem;
+ font-family: var(--font-mono);
+ font-weight: 500;
+ margin-left: 0.5rem;
+ }
+
+ .command-block {
+ margin-bottom: 1rem;
+ }
+
+ .command-info {
+ display: flex;
+ gap: 0.5rem;
+ margin-bottom: 0.5rem;
+ }
+
+ .runtime-badge,
+ .session-badge {
+ background: var(--color-message-bg);
+ padding: 0.2rem 0.5rem;
+ border-radius: 8px;
+ font-size: 0.75rem;
+ font-family: var(--font-mono);
+ border: 1px solid var(--color-border);
+ }
+
+ .command-text {
+ background: var(--color-background);
+ padding: 0.75rem;
+ border-radius: 8px;
+ font-size: 0.85rem;
+ margin: 0;
+ overflow-x: auto;
+ }
+
+ .terminal-output-full {
+ background: rgba(0, 0, 0, 0.8);
+ color: var(--color-text);
+ padding: 1rem;
+ border-radius: 8px;
+ font-size: 0.85rem;
+ margin: 0;
+ max-height: 40vh;
+ overflow: auto;
+ white-space: pre-wrap;
+ word-break: break-word;
+ }
+
+ .light-mode .terminal-output-full {
+ background: rgba(0, 0, 0, 0.05);
+ scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
+ }
+
+ .tool-args-grid {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ }
+
+ .tool-arg-item {
+ display: flex;
+ gap: 0.75rem;
+ padding: 0.5rem;
+ background: var(--color-background);
+ border-radius: 8px;
+ border: 1px solid var(--color-border);
+ }
+
+ /* GEN step tool call - single container with KV rows */
+ .tool-args-container {
+ background: var(--color-background);
+ border-radius: 8px;
+ border: 1px solid var(--color-border);
+ padding: 0.5rem;
+ display: grid;
+ grid-template-columns: auto 1fr;
+ gap: 0;
+ }
+
+ .tool-arg-row {
+ display: contents;
+ }
+
+ .tool-arg-row .arg-key,
+ .tool-arg-row .arg-value {
+ padding: 0.5rem;
+ }
+
+ .arg-key {
+ font-weight: 600;
+ color: var(--color-primary);
+ font-size: 0.85rem;
+ flex-shrink: 0;
+ }
+
+ .arg-value {
+ color: var(--color-text);
+ font-family: var(--font-mono);
+ font-size: 0.85rem;
+ white-space: pre-wrap;
+ word-break: break-word;
+ flex: 1;
+ }
+
+ .result-content {
+ background: var(--color-background);
+ padding: 1rem;
+ border-radius: 8px;
+ font-family: var(--font-mono);
+ font-size: 0.85rem;
+ margin: 0;
+ max-height: 40vh;
+ overflow: auto;
+ white-space: pre-wrap;
+ word-break: break-word;
+ }
+
+ .screenshot-full {
+ max-width: 100%;
+ border-radius: 8px;
+ border: 1px solid var(--color-border);
+ cursor: pointer;
+ }
+
+ .kvps-display {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ }
+
+ .kvp-item {
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ padding: 0.5rem;
+ background: var(--color-background);
+ border-radius: 8px;
+ border: 1px solid var(--color-border);
+ }
+
+ .kvp-key {
+ font-weight: 600;
+ color: var(--color-text);
+ opacity: 0.7;
+ font-size: 0.8rem;
+ text-transform: uppercase;
+ }
+
+ .kvp-value {
+ color: var(--color-text);
+ font-size: 0.9rem;
+ white-space: pre-wrap;
+ word-break: break-word;
+ }
+
+ /* Scrollbar styling */
+ .modal-body::-webkit-scrollbar,
+ .result-content::-webkit-scrollbar {
+ width: 6px;
+ height: 6px;
+ }
+
+ .modal-body::-webkit-scrollbar-track,
+ .result-content::-webkit-scrollbar-track {
+ background: transparent;
+ }
+
+ .modal-body::-webkit-scrollbar-thumb,
+ .result-content::-webkit-scrollbar-thumb {
+ background-color: rgba(155, 155, 155, 0.5);
+ border-radius: 6px;
+ }
+
+ .modal-body::-webkit-scrollbar-thumb:hover,
+ .result-content::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(155, 155, 155, 0.7);
+ }
+
+ /* Responsive */
+ @media (max-width: 600px) {
+ .modal-header-compact {
+ flex-direction: column;
+ align-items: flex-start;
+ }
+
+ .header-actions {
+ width: 100%;
+ justify-content: flex-end;
+ }
+
+ .tool-arg-item {
+ flex-direction: column;
+ }
+
+ .arg-key {
+ min-width: unset;
+ }
+ }
+ </style>
+</body>
+
+</html>
diff --git a/webui/components/modals/process-step-detail/step-detail-store.js b/webui/components/modals/process-step-detail/step-detail-store.js
new file mode 100644
index 000000000..306bedcc6
--- /dev/null
+++ b/webui/components/modals/process-step-detail/step-detail-store.js
@@ -0,0 +1,197 @@
+import { createStore } from "/js/AlpineStore.js";
+
+// Step Detail Store - manages the step detail modal
+
+const model = {
+ // Selected step for detail modal view
+ selectedStepForDetail: null,
+
+ // ACE editor instance for raw JSON view
+ _rawEditor: null,
+
+ // Show step detail modal
+ showStepDetail(stepData) {
+ if (!stepData) return;
+ this.selectedStepForDetail = stepData;
+ window.openModal("modals/process-step-detail/process-step-detail.html");
+ },
+
+ // Close step detail modal
+ closeStepDetail() {
+ this.selectedStepForDetail = null;
+ window.closeModal();
+ },
+
+ // Copy text to clipboard
+ async copyToClipboard(text) {
+ if (!text) return false;
+ try {
+ await navigator.clipboard.writeText(text);
+ return true;
+ } catch (err) {
+ console.error("Failed to copy to clipboard:", err);
+ return false;
+ }
+ },
+
+ // Format step data for full copy (all metadata + content)
+ formatStepForCopy(step) {
+ if (!step) return "";
+ const lines = [];
+ lines.push(`Type: ${step.type || "unknown"}`);
+ if (step.heading) lines.push(`Heading: ${step.heading}`);
+ if (step.timestamp) {
+ const date = new Date(parseFloat(step.timestamp) * 1000);
+ lines.push(`Timestamp: ${date.toISOString()}`);
+ }
+ if (step.durationMs) lines.push(`Duration: ${step.durationMs}ms`);
+ if (step.kvps) {
+ lines.push("");
+ lines.push("--- Data ---");
+ for (const [key, value] of Object.entries(step.kvps)) {
+ if (key === "reasoning") continue;
+ const formattedValue = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value);
+ lines.push(`${key}: ${formattedValue}`);
+ }
+ }
+ if (step.content) {
+ lines.push("");
+ lines.push("--- Content ---");
+ lines.push(step.content);
+ }
+ return lines.join("\n");
+ },
+
+ // Get primary content for a step (type-aware)
+ getStepPrimaryContent(step) {
+ if (!step) return "";
+ if (step.type === "code_exe") {
+ return step.content || "";
+ }
+ if (step.type === "agent" && step.kvps) {
+ return step.kvps.thoughts || step.kvps.headline || step.content || "";
+ }
+ if ((step.type === "tool" || step.type === "mcp") && step.kvps) {
+ return step.kvps.result || step.content || "";
+ }
+ return step.content || "";
+ },
+
+ // Initialize ACE editor for raw JSON view
+ initRawEditor() {
+ const container = document.getElementById("step-detail-raw-editor");
+ if (!container) return;
+
+ this.destroyRawEditor();
+
+ if (!window.ace?.edit) {
+ console.warn("ACE editor not available");
+ return;
+ }
+
+ const stepData = this.selectedStepForDetail;
+ if (!stepData) return;
+
+ const editorInstance = window.ace.edit("step-detail-raw-editor");
+ if (!editorInstance) return;
+
+ this._rawEditor = editorInstance;
+
+ const darkMode = window.localStorage?.getItem("darkMode");
+ const theme = darkMode !== "false" ? "ace/theme/github_dark" : "ace/theme/tomorrow";
+
+ this._rawEditor.setTheme(theme);
+ this._rawEditor.session.setMode("ace/mode/json");
+ this._rawEditor.setValue(JSON.stringify(stepData, null, 2), -1);
+ this._rawEditor.setReadOnly(true);
+ this._rawEditor.clearSelection();
+ this._rawEditor.setOptions({
+ showPrintMargin: false,
+ highlightActiveLine: false,
+ highlightGutterLine: false
+ });
+ },
+
+ // Destroy ACE editor instance
+ destroyRawEditor() {
+ if (this._rawEditor?.destroy) {
+ this._rawEditor.destroy();
+ this._rawEditor = null;
+ }
+ },
+
+ // Format step type for display
+ formatStepType(type) {
+ const typeMap = {
+ 'agent': 'Generation',
+ 'code_exe': 'Code Execution',
+ 'tool': 'Tool Call',
+ 'mcp': 'MCP Tool',
+ 'browser': 'Browser',
+ 'response': 'Response',
+ 'info': 'Info',
+ 'hint': 'Hint',
+ 'warning': 'Warning',
+ 'error': 'Error',
+ 'util': 'Utility',
+ 'progress': 'Progress'
+ };
+ return typeMap[type] || (type ? type.charAt(0).toUpperCase() + type.slice(1) : 'Unknown');
+ },
+
+ // Format timestamp for display
+ formatTimestamp(timestamp) {
+ if (!timestamp) return '';
+ const date = new Date(parseFloat(timestamp) * 1000);
+ const hours = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ const seconds = String(date.getSeconds()).padStart(2, '0');
+ return `${hours}:${minutes}:${seconds}`;
+ },
+
+ // Format duration for display
+ formatDuration(ms) {
+ if (!ms) return '';
+ if (ms < 1000) return `${ms}ms`;
+ const seconds = Math.floor(ms / 1000);
+ if (seconds < 60) return `${seconds}s`;
+ const minutes = Math.floor(seconds / 60);
+ const remainingSeconds = seconds % 60;
+ return `${minutes}m ${remainingSeconds}s`;
+ },
+
+ // Format value for display (handles objects)
+ formatValue(value) {
+ if (value === null || value === undefined) return '';
+ if (typeof value === 'object') return JSON.stringify(value, null, 2);
+ return String(value);
+ },
+
+ // Format key for display (title case)
+ formatKey(key) {
+ return key.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
+ },
+
+ // Clean text value (handle arrays, remove brackets)
+ cleanTextValue(value) {
+ if (Array.isArray(value)) {
+ return value
+ .filter(item => item && String(item).trim() && !/^[\[\]]$/.test(String(item).trim()))
+ .join('\n');
+ }
+ if (typeof value === 'object' && value !== null) {
+ return JSON.stringify(value, null, 2);
+ }
+ return String(value).replace(/^\s*[\[\]]\s*$/gm, '').trim();
+ },
+
+ // Clean heading by removing icon:// prefixes
+ cleanHeading(text) {
+ if (!text) return "";
+ return String(text)
+ .replace(/icon:\/\/[a-zA-Z0-9_]+\s*/g, "")
+ .trim();
+ }
+};
+
+export const store = createStore("stepDetail", model);
diff --git a/webui/js/messages.js b/webui/js/messages.js
index a92bf47d7..070410ff8 100644
--- a/webui/js/messages.js
+++ b/webui/js/messages.js
@@ -5,6 +5,7 @@ import { store as _messageResizeStore } from "/components/messages/resize/messag
import { store as attachmentsStore } from "/components/chat/attachments/attachmentsStore.js";
import { addActionButtonsToElement } from "/components/messages/action-buttons/simple-action-buttons.js";
import { store as processGroupStore } from "/components/messages/process-group/process-group-store.js";
+import { store as stepDetailStore } from "/components/modals/process-step-detail/step-detail-store.js";
import { store as preferencesStore } from "/components/sidebar/bottom/preferences/preferences-store.js";
import { formatDuration } from "./time-utils.js";
@@ -1353,6 +1354,23 @@ function addProcessStep(group, id, type, heading, content, kvps, timestamp = nul
renderStepDetailContent(detailContent, content, kvps, type);
detail.appendChild(detailContent);
+
+ // Store step data on the element for fresh access on modal open
+ step._stepData = {
+ type,
+ heading,
+ content,
+ kvps,
+ timestamp,
+ durationMs,
+ agentNumber,
+ toolName: toolNameToUse
+ };
+
+ // Add "View Details" button for full modal view (reads fresh data from step._stepData)
+ const viewDetailsBtn = createViewDetailsButton(step);
+ detail.appendChild(viewDetailsBtn);
+
step.appendChild(detail);
// Track delegation steps for nesting
@@ -1462,6 +1480,19 @@ function updateProcessStep(stepElement, id, type, heading, content, kvps, durati
}
}
+ // Update stored step data for fresh access by modal
+ const timestamp = stepElement._stepData?.timestamp; // preserve original timestamp
+ stepElement._stepData = {
+ type,
+ heading,
+ content,
+ kvps,
+ timestamp,
+ durationMs,
+ agentNumber,
+ toolName: toolNameToUse
+ };
+
// Update parent group header
const group = stepElement.closest(".process-group");
if (group) {
@@ -1788,6 +1819,30 @@ function renderThoughts(container, value) {
}
}
+/**
+ * Create "View Details" button for opening step detail modal
+ * @param {HTMLElement} stepElement - The step DOM element containing _stepData property
+ */
+function createViewDetailsButton(stepElement) {
+ const btnContainer = document.createElement("div");
+ btnContainer.classList.add("step-detail-actions");
+
+ const btn = document.createElement("button");
+ btn.classList.add("btn", "text-button");
+ btn.innerHTML = '<span class="material-symbols-outlined">open_in_full</span> View Details';
+ btn.title = "Open full step details in modal";
+
+ btn.addEventListener("click", (e) => {
+ e.stopPropagation();
+ // Read fresh data from the step element at click time
+ const freshData = stepElement._stepData || {};
+ stepDetailStore.showStepDetail(freshData);
+ });
+
+ btnContainer.appendChild(btn);
+ return btnContainer;
+}
+
/**
* Update process group header with step count, status, and metrics
*/