agentgui 1.0.115 → 1.0.117

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.115",
3
+ "version": "1.0.117",
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
@@ -227,20 +227,28 @@ class GMGUIApp {
227
227
  break;
228
228
  }
229
229
 
230
- case 'tool_use':
230
+ case 'tool_use': {
231
231
  html += `<div class="block-tool-use">`;
232
232
  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>`;
233
+ const paramHtml = this.renderParameters(block.input || {});
234
+ html += `<div class="tool-input">${paramHtml}</div>`;
234
235
  html += `</div>`;
235
236
  break;
237
+ }
236
238
 
237
- case 'tool_result':
239
+ case 'tool_result': {
238
240
  html += `<div class="block-tool-result">`;
239
241
  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>`;
242
+ let resultHtml;
243
+ if (typeof block.result === 'string') {
244
+ resultHtml = `<pre>${this.escapeHtml(block.result)}</pre>`;
245
+ } else {
246
+ resultHtml = this.renderParameters(block.result);
247
+ }
248
+ html += `<div class="tool-result">${resultHtml}</div>`;
242
249
  html += `</div>`;
243
250
  break;
251
+ }
244
252
 
245
253
  case 'file_operation':
246
254
  html += `<div class="block-file-op">`;
@@ -580,6 +588,52 @@ class GMGUIApp {
580
588
  div.textContent = text;
581
589
  return div.innerHTML;
582
590
  }
591
+
592
+ renderParameters(obj, depth = 0) {
593
+ if (obj === null || obj === undefined) {
594
+ return `<span style="color: var(--text-tertiary);">null</span>`;
595
+ }
596
+
597
+ if (typeof obj === 'string') {
598
+ const isPath = obj.includes('/') || obj.includes('\\');
599
+ const isUrl = obj.startsWith('http://') || obj.startsWith('https://');
600
+ if (isPath || isUrl) {
601
+ return `<code style="color: var(--text-secondary); background: transparent;">${this.escapeHtml(obj)}</code>`;
602
+ }
603
+ return `<span>"${this.escapeHtml(obj)}"</span>`;
604
+ }
605
+
606
+ if (typeof obj === 'number' || typeof obj === 'boolean') {
607
+ return `<span style="color: var(--color-info);">${obj}</span>`;
608
+ }
609
+
610
+ if (Array.isArray(obj)) {
611
+ if (obj.length === 0) {
612
+ return `<span style="color: var(--text-tertiary);">[]</span>`;
613
+ }
614
+ const maxItems = depth === 0 ? 10 : 5;
615
+ const items = obj.slice(0, maxItems).map(item => this.renderParameters(item, depth + 1));
616
+ const more = obj.length > maxItems ? `<span style="color: var(--text-tertiary);">... ${obj.length - maxItems} more</span>` : '';
617
+ return `<span style="color: var(--text-tertiary);">[</span> ${items.join(', ')} ${more} <span style="color: var(--text-tertiary);">]</span>`;
618
+ }
619
+
620
+ if (typeof obj === 'object') {
621
+ const keys = Object.keys(obj);
622
+ if (keys.length === 0) {
623
+ return `<span style="color: var(--text-tertiary);">{}</span>`;
624
+ }
625
+ const maxKeys = depth === 0 ? 15 : 8;
626
+ const pairs = keys.slice(0, maxKeys).map(key => {
627
+ const keyHtml = `<span style="color: var(--color-primary);">${this.escapeHtml(key)}</span>`;
628
+ const valHtml = this.renderParameters(obj[key], depth + 1);
629
+ return `${keyHtml}: ${valHtml}`;
630
+ });
631
+ const more = keys.length > maxKeys ? `<span style="color: var(--text-tertiary);">... ${keys.length - maxKeys} more</span>` : '';
632
+ 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>`;
633
+ }
634
+
635
+ return `<span>${this.escapeHtml(String(obj))}</span>`;
636
+ }
583
637
  }
584
638
 
585
639
  const app = new GMGUIApp();