agentgui 1.0.87 → 1.0.88

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/.prd CHANGED
@@ -0,0 +1,44 @@
1
+ HTML Code Block Rendering Implementation
2
+
3
+ GOAL: Render HTML code blocks as actual HTML elements instead of escaped text
4
+
5
+ DEPENDENCIES:
6
+ - streaming-renderer.js renderCode() method modification
7
+ - client.js renderMessageContent() method modification
8
+ - client.js renderMessages() method modification
9
+
10
+ COMPLETED ITEMS:
11
+
12
+ 1. DONE: Update streaming-renderer.js renderCode() to detect HTML blocks
13
+ - Check if language === 'html' ✓
14
+ - If HTML: render content with innerHTML (Claude responses trusted) ✓
15
+ - If not HTML: keep existing escaped text rendering ✓
16
+ - Wrap HTML output in styled container ✓
17
+
18
+ 2. DONE: Update client.js renderMessageContent() to handle HTML code blocks
19
+ - Detect block.type === 'code_block' AND block.language === 'html' ✓
20
+ - If HTML: render with innerHTML in wrapper div ✓
21
+ - If not HTML: escape and display as text ✓
22
+
23
+ 3. DONE: Update client.js renderMessages() to handle HTML code blocks
24
+ - Detect block.type === 'code_block' AND block.language === 'html' ✓
25
+ - If HTML: render with innerHTML in wrapper div ✓
26
+ - If not HTML: escape and display as text ✓
27
+
28
+ 4. DONE: Style HTML rendered blocks appropriately
29
+ - Add CSS classes for container styling ✓
30
+ - Ensure proper padding and borders ✓
31
+ - Add label indicating "Rendered HTML" ✓
32
+
33
+ 5. DONE: Test implementation
34
+ - Created test cases for HTML detection logic ✓
35
+ - Verified HTML detection correctly identifies html language ✓
36
+ - Verified non-HTML code blocks use escaped rendering ✓
37
+ - Confirmed no breaking changes to existing logic ✓
38
+
39
+ 6. DONE: Commit changes
40
+ - Stage modified files ✓
41
+ - Create meaningful commit message ✓
42
+ - Commit hash: 13ee551 ✓
43
+
44
+ ALL WORK COMPLETED ✓
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.87",
3
+ "version": "1.0.88",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -376,7 +376,21 @@ class AgentGUIClient {
376
376
  if (block.type === 'text') {
377
377
  html += `<div class="message-text">${this.escapeHtml(block.text)}</div>`;
378
378
  } else if (block.type === 'code_block') {
379
- html += `<div class="message-code"><pre>${this.escapeHtml(block.code)}</pre></div>`;
379
+ // Render HTML code blocks as actual HTML elements
380
+ if (block.language === 'html') {
381
+ html += `
382
+ <div class="message-code">
383
+ <div class="html-rendered-label mb-2 p-2 bg-blue-50 dark:bg-blue-900 rounded border border-blue-200 dark:border-blue-700 text-xs text-blue-700 dark:text-blue-300">
384
+ Rendered HTML
385
+ </div>
386
+ <div class="html-content bg-white dark:bg-gray-800 p-4 rounded border border-gray-200 dark:border-gray-700 overflow-x-auto">
387
+ ${block.code}
388
+ </div>
389
+ </div>
390
+ `;
391
+ } else {
392
+ html += `<div class="message-code"><pre>${this.escapeHtml(block.code)}</pre></div>`;
393
+ }
380
394
  } else if (block.type === 'tool_use') {
381
395
  html += `<div class="message-tool">[Tool: ${this.escapeHtml(block.name)}]</div>`;
382
396
  }
@@ -643,7 +657,21 @@ class AgentGUIClient {
643
657
  if (block.type === 'text') {
644
658
  contentHtml += `<div class="message-text">${this.escapeHtml(block.text)}</div>`;
645
659
  } else if (block.type === 'code_block') {
646
- contentHtml += `<div class="message-code"><pre>${this.escapeHtml(block.code)}</pre></div>`;
660
+ // Render HTML code blocks as actual HTML elements
661
+ if (block.language === 'html') {
662
+ contentHtml += `
663
+ <div class="message-code">
664
+ <div class="html-rendered-label mb-2 p-2 bg-blue-50 dark:bg-blue-900 rounded border border-blue-200 dark:border-blue-700 text-xs text-blue-700 dark:text-blue-300">
665
+ Rendered HTML
666
+ </div>
667
+ <div class="html-content bg-white dark:bg-gray-800 p-4 rounded border border-gray-200 dark:border-gray-700 overflow-x-auto">
668
+ ${block.code}
669
+ </div>
670
+ </div>
671
+ `;
672
+ } else {
673
+ contentHtml += `<div class="message-code"><pre>${this.escapeHtml(block.code)}</pre></div>`;
674
+ }
647
675
  } else if (block.type === 'tool_use') {
648
676
  contentHtml += `<div class="message-tool">[Tool: ${this.escapeHtml(block.name)}]</div>`;
649
677
  }
@@ -595,9 +595,21 @@ class StreamingRenderer {
595
595
  const code = event.code || event.content || '';
596
596
  const language = event.language || 'plaintext';
597
597
 
598
- div.innerHTML = `
599
- <pre class="bg-gray-900 text-gray-100 p-4 rounded overflow-x-auto"><code class="language-${this.escapeHtml(language)}">${this.escapeHtml(code)}</code></pre>
600
- `;
598
+ // Render HTML code blocks as actual HTML elements
599
+ if (language === 'html') {
600
+ div.innerHTML = `
601
+ <div class="html-rendered-container mb-2 p-2 bg-blue-50 dark:bg-blue-900 rounded border border-blue-200 dark:border-blue-700 text-xs text-blue-700 dark:text-blue-300">
602
+ Rendered HTML
603
+ </div>
604
+ <div class="html-content bg-white dark:bg-gray-800 p-4 rounded border border-gray-200 dark:border-gray-700 overflow-x-auto">
605
+ ${code}
606
+ </div>
607
+ `;
608
+ } else {
609
+ div.innerHTML = `
610
+ <pre class="bg-gray-900 text-gray-100 p-4 rounded overflow-x-auto"><code class="language-${this.escapeHtml(language)}">${this.escapeHtml(code)}</code></pre>
611
+ `;
612
+ }
601
613
  return div;
602
614
  }
603
615