agentgui 1.0.125 → 1.0.127
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.
- package/package.json +1 -1
- package/static/js/streaming-renderer.js +45 -32
package/package.json
CHANGED
|
@@ -581,41 +581,32 @@ class StreamingRenderer {
|
|
|
581
581
|
case 'dev__execute':
|
|
582
582
|
case 'dev_execute':
|
|
583
583
|
case 'execute': {
|
|
584
|
-
// Handle mcp__plugin_gm_dev__execute and similar dev execution tools
|
|
585
584
|
let html = '<div class="tool-params">';
|
|
586
585
|
|
|
587
|
-
// Show working directory if present
|
|
588
586
|
if (input.workingDirectory) {
|
|
589
|
-
html += `<div style="margin-bottom:0.5rem;font-size:0.75rem;color:var(--color-text-secondary)">
|
|
590
|
-
<span style="opacity:0.7">📁</span> ${this.escapeHtml(input.workingDirectory)}
|
|
591
|
-
</div>`;
|
|
587
|
+
html += `<div style="margin-bottom:0.5rem;font-size:0.75rem;color:var(--color-text-secondary)"><span style="opacity:0.7">📁</span> ${this.escapeHtml(input.workingDirectory)}</div>`;
|
|
592
588
|
}
|
|
593
589
|
|
|
594
|
-
// Show timeout if present
|
|
595
590
|
if (input.timeout) {
|
|
596
|
-
|
|
597
|
-
html += `<div style="margin-bottom:0.5rem;font-size:0.75rem;color:var(--color-text-secondary)">
|
|
598
|
-
<span style="opacity:0.7">⏱️</span> Timeout: ${seconds}s
|
|
599
|
-
</div>`;
|
|
591
|
+
html += `<div style="margin-bottom:0.5rem;font-size:0.75rem;color:var(--color-text-secondary)"><span style="opacity:0.7">⏱️</span> Timeout: ${Math.round(input.timeout / 1000)}s</div>`;
|
|
600
592
|
}
|
|
601
593
|
|
|
602
|
-
// Render code
|
|
594
|
+
// Render code with syntax highlighting
|
|
603
595
|
if (input.code) {
|
|
604
|
-
const
|
|
605
|
-
const lineCount =
|
|
596
|
+
const codeLines = input.code.split('\n');
|
|
597
|
+
const lineCount = codeLines.length;
|
|
606
598
|
const truncated = lineCount > 50;
|
|
607
|
-
const
|
|
599
|
+
const displayCode = truncated ? codeLines.slice(0, 50).join('\n') : input.code;
|
|
600
|
+
const lang = input.runtime || 'javascript';
|
|
601
|
+
html += `<div style="margin-top:0.5rem"><div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:0.25rem"><span style="font-size:0.7rem;font-weight:600;color:#0891b2;text-transform:uppercase">${this.escapeHtml(lang)}</span><span style="font-size:0.7rem;color:var(--color-text-secondary)">${lineCount} lines</span></div>${StreamingRenderer.renderCodeWithHighlight(displayCode, this.escapeHtml.bind(this))}${truncated ? `<div style="font-size:0.7rem;color:var(--color-text-secondary);text-align:center;padding:0.25rem">... ${lineCount - 50} more lines</div>` : ''}</div>`;
|
|
602
|
+
}
|
|
608
603
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
</div
|
|
614
|
-
|
|
615
|
-
<pre style="margin:0;font-family:'Monaco','Menlo','Ubuntu Mono',monospace;font-size:0.75rem;line-height:1.5;color:#d1d5db">${this.escapeHtml(displayLines.join('\n'))}</pre>
|
|
616
|
-
${truncated ? `<div style="margin-top:0.5rem;padding-top:0.5rem;border-top:1px solid var(--color-border);font-size:0.7rem;color:var(--color-text-secondary);text-align:center">... ${lineCount - 50} more lines truncated ...</div>` : ''}
|
|
617
|
-
</div>
|
|
618
|
-
</div>`;
|
|
604
|
+
// Render commands (bash commands)
|
|
605
|
+
if (input.commands) {
|
|
606
|
+
const cmds = Array.isArray(input.commands) ? input.commands : [input.commands];
|
|
607
|
+
cmds.forEach(cmd => {
|
|
608
|
+
html += `<div style="margin-top:0.375rem"><div class="tool-param-command"><span class="prompt-char">$</span><span class="command-text">${this.escapeHtml(typeof cmd === 'string' ? cmd : JSON.stringify(cmd))}</span></div></div>`;
|
|
609
|
+
});
|
|
619
610
|
}
|
|
620
611
|
|
|
621
612
|
html += '</div>';
|
|
@@ -635,14 +626,17 @@ class StreamingRenderer {
|
|
|
635
626
|
const truncated = content.length > maxLen;
|
|
636
627
|
const displayContent = truncated ? content.substring(0, maxLen) : content;
|
|
637
628
|
const lineCount = content.split('\n').length;
|
|
638
|
-
|
|
629
|
+
const codeBody = StreamingRenderer.detectCodeContent(displayContent)
|
|
630
|
+
? StreamingRenderer.renderCodeWithHighlight(displayContent, this.escapeHtml.bind(this))
|
|
631
|
+
: `<div class="preview-body">${this.escapeHtml(displayContent)}</div>`;
|
|
632
|
+
return `<div class="tool-param-content-preview" style="margin-top:0.5rem"><div class="preview-header"><span>${this.escapeHtml(label)}</span><span style="font-weight:400">${lineCount} lines${truncated ? ' (truncated)' : ''}</span></div>${codeBody}${truncated ? '<div class="preview-truncated">... ' + (content.length - maxLen) + ' more characters</div>' : ''}</div>`;
|
|
639
633
|
}
|
|
640
634
|
|
|
641
635
|
/**
|
|
642
636
|
* Render params as formatted JSON (default fallback for unknown tools)
|
|
643
637
|
*/
|
|
644
638
|
renderJsonParams(input) {
|
|
645
|
-
return `<div class="tool-params"
|
|
639
|
+
return `<div class="tool-params">${this.renderParametersBeautiful(input)}</div>`;
|
|
646
640
|
}
|
|
647
641
|
|
|
648
642
|
/**
|
|
@@ -712,6 +706,11 @@ class StreamingRenderer {
|
|
|
712
706
|
if (typeof data === 'number') return `<span style="color:#7c3aed;font-weight:600">${data}</span>`;
|
|
713
707
|
|
|
714
708
|
if (typeof data === 'string') {
|
|
709
|
+
if (data.length > 200 && StreamingRenderer.detectCodeContent(data)) {
|
|
710
|
+
const displayData = data.length > 1000 ? data.substring(0, 1000) : data;
|
|
711
|
+
const suffix = data.length > 1000 ? `<div style="font-size:0.7rem;color:var(--color-text-secondary);text-align:center;padding:0.25rem">... ${data.length - 1000} more characters</div>` : '';
|
|
712
|
+
return `<div style="max-height:200px;overflow-y:auto">${StreamingRenderer.renderCodeWithHighlight(displayData, this.escapeHtml.bind(this))}${suffix}</div>`;
|
|
713
|
+
}
|
|
715
714
|
if (data.length > 500) {
|
|
716
715
|
const lines = data.split('\n').length;
|
|
717
716
|
return `<div style="font-family:'Monaco','Menlo','Ubuntu Mono',monospace;font-size:0.75rem;white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto;background:var(--color-bg-code);color:#d1d5db;padding:0.5rem;border-radius:0.375rem;line-height:1.5">${this.escapeHtml(data.substring(0, 1000))}${data.length > 1000 ? '\n... (' + (data.length - 1000) + ' more chars, ' + lines + ' lines)' : ''}</div>`;
|
|
@@ -749,14 +748,23 @@ class StreamingRenderer {
|
|
|
749
748
|
return `<div style="padding:0.5rem"><img src="${esc(trimmed)}" style="max-width:100%;max-height:24rem;border-radius:0.375rem" loading="lazy"></div>`;
|
|
750
749
|
}
|
|
751
750
|
|
|
752
|
-
//
|
|
751
|
+
// Parse JSON and render as structured content
|
|
753
752
|
if ((trimmed.startsWith('{') && trimmed.endsWith('}')) || (trimmed.startsWith('[') && trimmed.endsWith(']'))) {
|
|
754
753
|
try {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
//
|
|
758
|
-
|
|
759
|
-
|
|
754
|
+
const parsed = JSON.parse(trimmed);
|
|
755
|
+
|
|
756
|
+
// Handle Claude content block arrays: [{type:"text", text:"..."}]
|
|
757
|
+
if (Array.isArray(parsed) && parsed.length > 0 && parsed[0] && parsed[0].type === 'text') {
|
|
758
|
+
const textParts = parsed.filter(b => b.type === 'text' && b.text);
|
|
759
|
+
if (textParts.length > 0) {
|
|
760
|
+
const combined = textParts.map(b => b.text).join('\n');
|
|
761
|
+
// Re-enter renderSmartContentHTML with the extracted text
|
|
762
|
+
return StreamingRenderer.renderSmartContentHTML(combined, esc);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// For other JSON, render as itemized key-value structure
|
|
767
|
+
return `<div style="padding:0.5rem 0.75rem">${StreamingRenderer.renderParamsHTML(parsed, 0, esc)}</div>`;
|
|
760
768
|
} catch (e) {
|
|
761
769
|
// Not valid JSON, might be code with braces
|
|
762
770
|
}
|
|
@@ -1069,6 +1077,11 @@ class StreamingRenderer {
|
|
|
1069
1077
|
if (typeof data === 'number') return `<span style="color:#7c3aed;font-weight:600">${data}</span>`;
|
|
1070
1078
|
|
|
1071
1079
|
if (typeof data === 'string') {
|
|
1080
|
+
if (data.length > 200 && StreamingRenderer.detectCodeContent(data)) {
|
|
1081
|
+
const displayData = data.length > 1000 ? data.substring(0, 1000) : data;
|
|
1082
|
+
const suffix = data.length > 1000 ? `<div style="font-size:0.7rem;color:var(--color-text-secondary);text-align:center;padding:0.25rem">... ${data.length - 1000} more characters</div>` : '';
|
|
1083
|
+
return `<div style="max-height:200px;overflow-y:auto">${StreamingRenderer.renderCodeWithHighlight(displayData, esc)}${suffix}</div>`;
|
|
1084
|
+
}
|
|
1072
1085
|
if (data.length > 500) {
|
|
1073
1086
|
return `<div style="font-family:'Monaco','Menlo','Ubuntu Mono',monospace;font-size:0.75rem;white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto;background:var(--color-bg-code);color:#d1d5db;padding:0.5rem;border-radius:0.375rem;line-height:1.5">${esc(data.substring(0, 1000))}${data.length > 1000 ? '\n... (' + (data.length - 1000) + ' more chars)' : ''}</div>`;
|
|
1074
1087
|
}
|