agentgui 1.0.122 → 1.0.124
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 +27 -11
package/package.json
CHANGED
|
@@ -451,8 +451,10 @@ class StreamingRenderer {
|
|
|
451
451
|
});
|
|
452
452
|
});
|
|
453
453
|
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
// Use syntax highlighting instead of just escaping
|
|
455
|
+
const highlightedHTML = StreamingRenderer.renderCodeWithHighlight(code, this.escapeHtml.bind(this));
|
|
456
|
+
const codeContainer = document.createElement('div');
|
|
457
|
+
codeContainer.innerHTML = highlightedHTML;
|
|
456
458
|
|
|
457
459
|
div.appendChild(header);
|
|
458
460
|
div.appendChild(codeContainer);
|
|
@@ -760,16 +762,22 @@ class StreamingRenderer {
|
|
|
760
762
|
}
|
|
761
763
|
}
|
|
762
764
|
|
|
763
|
-
// Check if this looks like `cat -n` output
|
|
765
|
+
// Check if this looks like `cat -n` output or grep with line numbers
|
|
764
766
|
const lines = trimmed.split('\n');
|
|
765
767
|
const isCatNOutput = lines.length > 1 && lines[0].match(/^\s*\d+→/);
|
|
768
|
+
const isGrepOutput = lines.length > 1 && lines[0].match(/^\s*\d+-/);
|
|
766
769
|
|
|
767
|
-
if (isCatNOutput) {
|
|
768
|
-
// Strip line numbers and arrows from
|
|
770
|
+
if (isCatNOutput || isGrepOutput) {
|
|
771
|
+
// Strip line numbers and arrows/hyphens from output
|
|
769
772
|
const cleanedLines = lines.map(line => {
|
|
770
|
-
|
|
773
|
+
// Skip grep context separator lines
|
|
774
|
+
if (line === '--') return null;
|
|
775
|
+
|
|
776
|
+
// Handle both cat -n (→) and grep (-n) formats
|
|
777
|
+
// Also handle grep with colon (:) for matching lines
|
|
778
|
+
const match = line.match(/^\s*\d+[→\-:](.*)/);
|
|
771
779
|
return match ? match[1] : line;
|
|
772
|
-
});
|
|
780
|
+
}).filter(line => line !== null);
|
|
773
781
|
const cleanedContent = cleanedLines.join('\n');
|
|
774
782
|
|
|
775
783
|
// Try to detect and highlight code based on content patterns
|
|
@@ -1151,11 +1159,19 @@ class StreamingRenderer {
|
|
|
1151
1159
|
const command = block.command || block.code || '';
|
|
1152
1160
|
const output = block.output || '';
|
|
1153
1161
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
${output ? `<pre class="bash-output"><code>${this.escapeHtml(output)}</code></pre>` : ''}
|
|
1157
|
-
`;
|
|
1162
|
+
// For the command, use simple escaping
|
|
1163
|
+
let html = `<div class="bash-command"><span class="prompt">$</span><code>${this.escapeHtml(command)}</code></div>`;
|
|
1158
1164
|
|
|
1165
|
+
// For output, check if it looks like code and use syntax highlighting
|
|
1166
|
+
if (output) {
|
|
1167
|
+
if (StreamingRenderer.detectCodeContent(output)) {
|
|
1168
|
+
html += StreamingRenderer.renderCodeWithHighlight(output, this.escapeHtml.bind(this));
|
|
1169
|
+
} else {
|
|
1170
|
+
html += `<pre class="bash-output"><code>${this.escapeHtml(output)}</code></pre>`;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
div.innerHTML = html;
|
|
1159
1175
|
return div;
|
|
1160
1176
|
}
|
|
1161
1177
|
|