Agent Zero AI framework
generic modals with kvps for step detail
3clyp5028c0fd8693f2
diff --git a/webui/components/modals/process-step-detail/process-step-detail.html b/webui/components/modals/process-step-detail/process-step-detail.htmlindex a49daeb71..4a162db64 100644--- a/webui/components/modals/process-step-detail/process-step-detail.html+++ b/webui/components/modals/process-step-detail/process-step-detail.html@@ -19,14 +19,10 @@:class="$store.stepDetail.selectedStepForDetail?.statusClass || ''"x-text="$store.stepDetail.selectedStepForDetail?.statusCode || ''"></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 x-if="$store.stepDetail.selectedStepForDetail?.headerLabels">+ <template x-for="(label, index) in $store.stepDetail.selectedStepForDetail?.headerLabels || []" :key="index">+ <span :class="label.class || 'header-label'" x-text="label.label"></span>+ </template></template></div><div class="header-actions">@@ -66,147 +62,26 @@</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>- <!-- Raw LLM Response (content field) -->- <template x-if="$store.stepDetail.selectedStepForDetail?.content">- <div class="content-block raw-response-block">- <h4><span class="material-symbols-outlined">smart_toy</span> Raw Response</h4>- <pre class="raw-response-content" x-text="$store.stepDetail.selectedStepForDetail?.content"></pre>- </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>+ <!-- Generic KVPs for all types -->+ <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 || {})" :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>- </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>+ </template>+ </div></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>+ <!-- Content -->+ <template x-if="$store.stepDetail.selectedStepForDetail?.content">+ <div class="content-block">+ <h4>Content</h4>+ <pre class="result-content" x-text="$store.stepDetail.selectedStepForDetail?.content"></pre></div></template></div>@@ -245,19 +120,12 @@flex-wrap: wrap;}- .step-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);}+ .header-label,.tool-name-badge {background: var(--color-message-bg);color: var(--color-text);@@ -268,16 +136,6 @@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;@@ -318,10 +176,6 @@color: white;}- .btn-action-header.copied .material-symbols-outlined::before {- content: 'check';- }-.modal-body {flex: 1;overflow-y: auto;@@ -368,21 +222,9 @@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;@@ -390,154 +232,6 @@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;- }-- .raw-response-block {- margin-top: 1rem;- }-- .raw-response-content {- background: var(--color-background);- padding: 1rem;- border-radius: 8px;- font-family: var(--font-mono);- font-size: 0.85rem;- margin: 0;- max-height: 50vh;- overflow: auto;- white-space: pre-wrap;- word-break: break-word;- color: var(--color-text);- }-- .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;@@ -551,13 +245,6 @@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;@@ -589,7 +276,6 @@word-break: break-word;}- /* Scrollbar styling */.modal-body::-webkit-scrollbar,.result-content::-webkit-scrollbar {width: 6px;@@ -607,12 +293,6 @@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;@@ -623,14 +303,6 @@width: 100%;justify-content: flex-end;}-- .tool-arg-item {- flex-direction: column;- }-- .arg-key {- min-width: unset;- }}</style></body>diff --git a/webui/components/modals/process-step-detail/step-detail-store.js b/webui/components/modals/process-step-detail/step-detail-store.jsindex aa968310c..604d9bae7 100644--- a/webui/components/modals/process-step-detail/step-detail-store.js+++ b/webui/components/modals/process-step-detail/step-detail-store.js@@ -49,7 +49,6 @@ const model = {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}`);}diff --git a/webui/js/messages.js b/webui/js/messages.jsindex 3337b5f09..f86280f63 100644--- a/webui/js/messages.js+++ b/webui/js/messages.js@@ -339,7 +339,7 @@ function getOrCreateProcessGroup(id, allowCompleted = true) {return group;}-function buildDetailPayload(stepData) {+function buildDetailPayload(stepData, extras = {}) {if (!stepData) return null;return {type: stepData.type,@@ -351,6 +351,7 @@ function buildDetailPayload(stepData) {toolName: stepData.toolName,statusCode: stepData.statusCode,statusClass: stepData.statusClass,+ ...extras,};}@@ -883,10 +884,13 @@ export function drawMessageAgent({if (kvps?.thoughts) displayKvps["icon://lightbulb"] = kvps.thoughts;if (kvps?.step) displayKvps["icon://step"] = kvps.step;const thoughtsText = String(kvps?.thoughts ?? "");+ const headerLabels = [+ kvps?.tool_name && { label: kvps.tool_name, class: "tool-name-badge" },+ ].filter(Boolean);const actionButtons = thoughtsText.trim()? [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels })),),createActionButton("speak", "", () => speechStore.speak(thoughtsText)),createActionButton("copy", "", () => copyToClipboard(thoughtsText)),@@ -1138,11 +1142,14 @@ export function drawMessageTool({}) {const title = cleanStepTitle(heading);let displayKvps = { ...kvps };+ const headerLabels = [+ kvps?.tool_name && { label: kvps.tool_name, class: "tool-name-badge" },+ ].filter(Boolean);const contentText = String(content ?? "");const actionButtons = contentText.trim()? [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels })),),createActionButton("speak", "", () => speechStore.speak(contentText)),createActionButton("copy", "", () => copyToClipboard(contentText)),@@ -1190,12 +1197,17 @@ export function drawMessageCodeExe({if (kvps?.runtime) displayKvps.runtime = kvps.runtime;if (kvps?.session) displayKvps.session = kvps.session;+ const headerLabels = [+ kvps?.runtime && { label: kvps.runtime, class: "tool-name-badge" },+ kvps?.session != null && { label: `Session ${kvps.session}`, class: "header-label" },+ ].filter(Boolean);+// render the standard stepconst commandText = String(kvps?.code ?? "");const outputText = String(content ?? "");const actionButtons = [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels })),),commandText.trim()? createActionButton("copy", "Command", () =>@@ -1235,7 +1247,7 @@ export function drawMessageBrowser({const actionButtons = answerText.trim()? [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels: [] })),),createActionButton("speak", "", () => speechStore.speak(answerText)),createActionButton("copy", "", () => copyToClipboard(answerText)),@@ -1267,11 +1279,14 @@ export function drawMessageMcp({}) {const title = cleanStepTitle(heading);let displayKvps = { ...kvps };+ const headerLabels = [+ kvps?.tool_name && { label: kvps.tool_name, class: "tool-name-badge" },+ ].filter(Boolean);const contentText = String(content ?? "");const actionButtons = contentText.trim()? [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels })),),createActionButton("speak", "", () => speechStore.speak(contentText)),createActionButton("copy", "", () => copyToClipboard(contentText)),@@ -1303,11 +1318,14 @@ export function drawMessageSubagent({}) {const title = cleanStepTitle(heading);let displayKvps = { ...kvps };+ const headerLabels = [+ kvps?.tool_name && { label: kvps.tool_name, class: "tool-name-badge" },+ ].filter(Boolean);const contentText = String(content ?? "");const actionButtons = contentText.trim()? [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels })),),createActionButton("speak", "", () => speechStore.speak(contentText)),createActionButton("copy", "", () => copyToClipboard(contentText)),@@ -1501,7 +1519,7 @@ export function drawMessageError({const contentText = String(content ?? "");const actionButtons = [createActionButton("detail", "", () =>- stepDetailStore.showStepDetail(buildDetailPayload(arguments[0])),+ stepDetailStore.showStepDetail(buildDetailPayload(arguments[0], { headerLabels: [] })),),contentText.trim()? createActionButton("copy", "", () => copyToClipboard(contentText))