agentgui 1.0.116 → 1.0.118

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.116",
3
+ "version": "1.0.118",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/static/app.js CHANGED
@@ -203,9 +203,14 @@ class GMGUIApp {
203
203
  throw new Error('Not a claude_execution message');
204
204
  }
205
205
  } catch (e) {
206
- // Fallback: render as plain text
207
- const text = typeof message.content === 'string' ? message.content : JSON.stringify(message.content);
208
- contentHtml = `<div class="message-content">${this.escapeHtml(text)}</div>`;
206
+ // Fallback: try to parse and beautify, or render as plain text
207
+ try {
208
+ const parsed = typeof message.content === 'string' ? JSON.parse(message.content) : message.content;
209
+ contentHtml = `<div class="message-content">${this.renderParameters(parsed)}</div>`;
210
+ } catch (parseErr) {
211
+ const text = typeof message.content === 'string' ? message.content : JSON.stringify(message.content);
212
+ contentHtml = `<div class="message-content"><pre>${this.escapeHtml(text)}</pre></div>`;
213
+ }
209
214
  }
210
215
 
211
216
  msgEl.innerHTML = contentHtml;
@@ -227,20 +232,33 @@ class GMGUIApp {
227
232
  break;
228
233
  }
229
234
 
230
- case 'tool_use':
235
+ case 'tool_use': {
231
236
  html += `<div class="block-tool-use">`;
232
237
  html += `<strong class="tool-name">${this.escapeHtml(block.name || 'Tool')}</strong>`;
233
- html += `<div class="tool-input"><pre>${this.escapeHtml(JSON.stringify(block.input || {}, null, 2))}</pre></div>`;
238
+ const paramHtml = this.renderParameters(block.input || {});
239
+ html += `<div class="tool-input">${paramHtml}</div>`;
234
240
  html += `</div>`;
235
241
  break;
242
+ }
236
243
 
237
- case 'tool_result':
244
+ case 'tool_result': {
238
245
  html += `<div class="block-tool-result">`;
239
246
  html += `<strong>Result:</strong>`;
240
- const resultText = typeof block.result === 'string' ? block.result : JSON.stringify(block.result, null, 2);
241
- html += `<div class="tool-result"><pre>${this.escapeHtml(resultText)}</pre></div>`;
247
+ let resultHtml;
248
+ if (typeof block.result === 'string') {
249
+ try {
250
+ const parsed = JSON.parse(block.result);
251
+ resultHtml = this.renderParameters(parsed);
252
+ } catch (e) {
253
+ resultHtml = `<pre>${this.escapeHtml(block.result)}</pre>`;
254
+ }
255
+ } else {
256
+ resultHtml = this.renderParameters(block.result);
257
+ }
258
+ html += `<div class="tool-result">${resultHtml}</div>`;
242
259
  html += `</div>`;
243
260
  break;
261
+ }
244
262
 
245
263
  case 'file_operation':
246
264
  html += `<div class="block-file-op">`;
@@ -350,9 +368,14 @@ class GMGUIApp {
350
368
  throw new Error('Not a claude_execution message');
351
369
  }
352
370
  } catch (e) {
353
- // Fallback: render as plain text
354
- const text = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);
355
- contentHtml = `<div class="message-content">${this.escapeHtml(text)}</div>`;
371
+ // Fallback: try to parse and beautify, or render as plain text
372
+ try {
373
+ const parsed = typeof msg.content === 'string' ? JSON.parse(msg.content) : msg.content;
374
+ contentHtml = `<div class="message-content">${this.renderParameters(parsed)}</div>`;
375
+ } catch (parseErr) {
376
+ const text = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);
377
+ contentHtml = `<div class="message-content"><pre>${this.escapeHtml(text)}</pre></div>`;
378
+ }
356
379
  }
357
380
 
358
381
  msgEl.innerHTML = contentHtml;
@@ -580,6 +603,52 @@ class GMGUIApp {
580
603
  div.textContent = text;
581
604
  return div.innerHTML;
582
605
  }
606
+
607
+ renderParameters(obj, depth = 0) {
608
+ if (obj === null || obj === undefined) {
609
+ return `<span style="color: var(--text-tertiary);">null</span>`;
610
+ }
611
+
612
+ if (typeof obj === 'string') {
613
+ const isPath = obj.includes('/') || obj.includes('\\');
614
+ const isUrl = obj.startsWith('http://') || obj.startsWith('https://');
615
+ if (isPath || isUrl) {
616
+ return `<code style="color: var(--text-secondary); background: transparent;">${this.escapeHtml(obj)}</code>`;
617
+ }
618
+ return `<span>"${this.escapeHtml(obj)}"</span>`;
619
+ }
620
+
621
+ if (typeof obj === 'number' || typeof obj === 'boolean') {
622
+ return `<span style="color: var(--color-info);">${obj}</span>`;
623
+ }
624
+
625
+ if (Array.isArray(obj)) {
626
+ if (obj.length === 0) {
627
+ return `<span style="color: var(--text-tertiary);">[]</span>`;
628
+ }
629
+ const maxItems = depth === 0 ? 10 : 5;
630
+ const items = obj.slice(0, maxItems).map(item => this.renderParameters(item, depth + 1));
631
+ const more = obj.length > maxItems ? `<span style="color: var(--text-tertiary);">... ${obj.length - maxItems} more</span>` : '';
632
+ return `<span style="color: var(--text-tertiary);">[</span> ${items.join(', ')} ${more} <span style="color: var(--text-tertiary);">]</span>`;
633
+ }
634
+
635
+ if (typeof obj === 'object') {
636
+ const keys = Object.keys(obj);
637
+ if (keys.length === 0) {
638
+ return `<span style="color: var(--text-tertiary);">{}</span>`;
639
+ }
640
+ const maxKeys = depth === 0 ? 15 : 8;
641
+ const pairs = keys.slice(0, maxKeys).map(key => {
642
+ const keyHtml = `<span style="color: var(--color-primary);">${this.escapeHtml(key)}</span>`;
643
+ const valHtml = this.renderParameters(obj[key], depth + 1);
644
+ return `${keyHtml}: ${valHtml}`;
645
+ });
646
+ const more = keys.length > maxKeys ? `<span style="color: var(--text-tertiary);">... ${keys.length - maxKeys} more</span>` : '';
647
+ return `<div style="margin-left: ${depth * 1.5}rem;"><span style="color: var(--text-tertiary);">{</span><br/>${pairs.map(p => `&nbsp;&nbsp;${p}`).join(',<br/>')}<br/>${more}<span style="color: var(--text-tertiary);">}</span></div>`;
648
+ }
649
+
650
+ return `<span>${this.escapeHtml(String(obj))}</span>`;
651
+ }
583
652
  }
584
653
 
585
654
  const app = new GMGUIApp();
package/static/styles.css CHANGED
@@ -739,7 +739,6 @@ html, body {
739
739
  align-items: center;
740
740
  justify-content: center;
741
741
  background: var(--bg-secondary);
742
- border: 1px solid var(--border-color);
743
742
  border-radius: 0.25rem;
744
743
  font-family: monospace;
745
744
  font-size: 0.75rem;
@@ -787,7 +786,6 @@ html, body {
787
786
  max-height: 300px;
788
787
  overflow-y: auto;
789
788
  background: var(--bg-secondary);
790
- border-top: 1px solid var(--border-color);
791
789
  }
792
790
 
793
791
  .tool-block.collapsed .tool-body {
@@ -812,7 +810,6 @@ html, body {
812
810
  padding: 0.375rem 0.75rem;
813
811
  font-size: 0.8rem;
814
812
  color: var(--text-secondary);
815
- border-top: 1px solid var(--border-color);
816
813
  }
817
814
 
818
815
  .html-block {
@@ -1792,12 +1789,13 @@ p code {
1792
1789
  }
1793
1790
 
1794
1791
  .tool-input {
1795
- background: var(--bg-tertiary);
1792
+ background: transparent;
1796
1793
  border-radius: 0.375rem;
1797
- padding: 0.5rem;
1794
+ padding: 0.5rem 0;
1798
1795
  overflow-x: auto;
1799
1796
  font-size: 0.8rem;
1800
1797
  font-family: 'Courier New', monospace;
1798
+ line-height: 1.5;
1801
1799
  }
1802
1800
 
1803
1801
  .tool-input pre {
@@ -1805,6 +1803,17 @@ p code {
1805
1803
  color: var(--text-secondary);
1806
1804
  }
1807
1805
 
1806
+ .tool-input code {
1807
+ color: var(--text-secondary);
1808
+ background: transparent;
1809
+ padding: 0;
1810
+ font-family: inherit;
1811
+ }
1812
+
1813
+ .tool-input span {
1814
+ font-family: 'Courier New', monospace;
1815
+ }
1816
+
1808
1817
  .block-tool-result {
1809
1818
  background: rgba(16, 185, 129, 0.05);
1810
1819
  border: 1px solid rgba(16, 185, 129, 0.2);
@@ -1819,14 +1828,15 @@ p code {
1819
1828
  }
1820
1829
 
1821
1830
  .tool-result {
1822
- background: var(--bg-tertiary);
1831
+ background: transparent;
1823
1832
  border-radius: 0.375rem;
1824
- padding: 0.5rem;
1833
+ padding: 0.5rem 0;
1825
1834
  overflow-x: auto;
1826
1835
  font-size: 0.8rem;
1827
1836
  font-family: 'Courier New', monospace;
1828
1837
  max-height: 300px;
1829
1838
  overflow-y: auto;
1839
+ line-height: 1.5;
1830
1840
  }
1831
1841
 
1832
1842
  .tool-result pre {
@@ -1834,6 +1844,13 @@ p code {
1834
1844
  color: var(--text-secondary);
1835
1845
  }
1836
1846
 
1847
+ .tool-result code {
1848
+ color: var(--text-secondary);
1849
+ background: transparent;
1850
+ padding: 0;
1851
+ font-family: inherit;
1852
+ }
1853
+
1837
1854
  .block-file-op {
1838
1855
  background: rgba(245, 158, 11, 0.05);
1839
1856
  border: 1px solid rgba(245, 158, 11, 0.2);
@@ -1853,15 +1870,15 @@ p code {
1853
1870
  font-size: 0.875rem;
1854
1871
  font-family: 'Courier New', monospace;
1855
1872
  margin-bottom: 0.5rem;
1856
- padding: 0.25rem 0.5rem;
1857
- background: var(--bg-tertiary);
1873
+ padding: 0.25rem 0;
1874
+ background: transparent;
1858
1875
  border-radius: 0.25rem;
1859
1876
  }
1860
1877
 
1861
1878
  .file-content {
1862
- background: var(--bg-tertiary);
1879
+ background: transparent;
1863
1880
  border-radius: 0.375rem;
1864
- padding: 0.5rem;
1881
+ padding: 0.5rem 0;
1865
1882
  overflow-x: auto;
1866
1883
  font-size: 0.8rem;
1867
1884
  font-family: 'Courier New', monospace;
package/.prd DELETED
File without changes