@yemi33/minions 0.1.1591 → 0.1.1593

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/CHANGELOG.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.1591 (2026-04-28)
3
+ ## 0.1.1593 (2026-04-28)
4
+
5
+ ### Features
6
+ - replace runtime text tag with inline SVG logos
7
+
8
+ ## 0.1.1592 (2026-04-28)
4
9
 
5
10
  ### Features
6
11
  - show runtime tag (Claude/Copilot/...) next to agent name
7
12
 
13
+ ### Other
14
+ - Pretty-print Copilot live output
15
+
8
16
  ## 0.1.1590 (2026-04-28)
9
17
 
10
18
  ### Features
@@ -6,6 +6,11 @@ let _steerInFlight = false;
6
6
  let _lastRenderedText = '';
7
7
  let _runtimeTimer = null;
8
8
 
9
+ function _currentAgentRuntime() {
10
+ var agent = (agentData || []).find(function(a) { return a.id === currentAgentId; });
11
+ return agent && agent.runtime ? agent.runtime : '';
12
+ }
13
+
9
14
  function _updateRuntimeCounter() {
10
15
  var el = document.getElementById('live-runtime');
11
16
  if (!el) return;
@@ -75,8 +80,9 @@ async function refreshLiveOutput() {
75
80
  const el = document.getElementById('live-messages');
76
81
  if (el) {
77
82
  const wasAtBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 150;
83
+ const incrementalSafe = _currentAgentRuntime() !== 'copilot';
78
84
  // Incremental render: only parse new content if text is an extension of previous
79
- if (_lastRenderedText && text.length > _lastRenderedText.length && text.startsWith(_lastRenderedText.slice(0, 200))) {
85
+ if (incrementalSafe && _lastRenderedText && text.length > _lastRenderedText.length && text.startsWith(_lastRenderedText.slice(0, 200))) {
80
86
  renderLiveChatMessage(text.slice(_lastRenderedText.length));
81
87
  } else {
82
88
  el.innerHTML = '';
@@ -1,14 +1,31 @@
1
1
  // dashboard/js/render-agents.js — Agent grid rendering extracted from dashboard.html
2
2
 
3
- // Per-runtime display labels and accent colors. Add a new entry here when a
4
- // new runtime is registered in engine/runtimes/index.js.
3
+ // Per-runtime inline SVG logo + accent color. Each entry must define `label`
4
+ // (used as title/tooltip + accessibility fallback) and `svg` (full inline
5
+ // markup, currentColor-themed). Add a new entry here when a new runtime is
6
+ // registered in engine/runtimes/index.js.
5
7
  const RUNTIME_TAGS = {
6
- claude: { label: 'Claude', color: 'var(--blue)' },
7
- copilot: { label: 'Copilot', color: 'var(--purple)' },
8
+ // Anthropic Claude 8-pointed orange asterisk/burst
9
+ claude: {
10
+ label: 'Claude',
11
+ color: '#cc785c',
12
+ svg: '<svg viewBox="-12 -12 24 24" width="13" height="13" aria-hidden="true" focusable="false" style="display:inline-block;vertical-align:-2px"><g fill="currentColor"><path d="M-1.6 -10 L1.6 -10 L1 -1 L10 -1.6 L10 1.6 L1 1 L1.6 10 L-1.6 10 L-1 1 L-10 1.6 L-10 -1.6 L-1 -1 Z"/><path d="M-1.6 -10 L1.6 -10 L1 -1 L10 -1.6 L10 1.6 L1 1 L1.6 10 L-1.6 10 L-1 1 L-10 1.6 L-10 -1.6 L-1 -1 Z" transform="rotate(45)"/></g></svg>',
13
+ },
14
+ // GitHub Copilot — rounded "pilot" face from the official Octicons set
15
+ copilot: {
16
+ label: 'Copilot',
17
+ color: '#8957e5',
18
+ svg: '<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true" focusable="false" style="display:inline-block;vertical-align:-2px;fill:currentColor"><path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.71.354-2.434.13-.418.305-.808.516-1.142.218-.345.516-.648.886-.804.397-.167.832-.156 1.236-.014.404.142.858.396 1.342.762.227.171.487.367.733.557l.083.064c.16.124.305.236.434.337.265-.077.566-.142.879-.198a.877.877 0 0 1 .093-.013l.045-.005c.135-.018.273-.029.41-.034.137.005.275.016.41.034l.045.005a.877.877 0 0 1 .093.013c.313.056.614.121.879.198.129-.101.274-.213.434-.337l.083-.064c.246-.19.506-.386.733-.557.484-.366.938-.62 1.342-.762.404-.142.839-.153 1.236.014.37.156.668.459.886.804.21.334.385.724.516 1.142.226.724.354 1.564.354 2.434 0 .572-.053 1.148-.254 1.656.066.228.097.429.126.612.012.075.023.148.036.218.911.379 1.503 1.437 1.588 2.065v1.948c-.125.835-3.436 3.749-7.998 3.749ZM5.485 12.343a4.07 4.07 0 0 0 1.014-.214 1 1 0 0 1 .622-.001c.14.045.31.097.502.143.456.111.99.196 1.379.196.39 0 .923-.085 1.379-.196.192-.046.362-.098.502-.143a1 1 0 0 1 .622.001c.31.105.65.184 1.014.214.348.029.674-.027.927-.114a.535.535 0 0 0 .362-.51v-1.61a4.474 4.474 0 0 0-1.5-.339c-.456 0-.923.085-1.379.196-.192.046-.362.098-.502.143a1 1 0 0 1-.622-.001 11.91 11.91 0 0 1-1.014-.214 4.07 4.07 0 0 0-1.014.214 1 1 0 0 1-.622.001 13.92 13.92 0 0 0-.502-.143A6.474 6.474 0 0 0 4.5 9.769a4.474 4.474 0 0 0-1.5.339v1.611a.535.535 0 0 0 .362.51 1.95 1.95 0 0 0 .927.113Z"/></svg>',
19
+ },
8
20
  };
9
21
  function _runtimeTagHtml(runtime) {
10
- const meta = RUNTIME_TAGS[runtime] || { label: runtime || 'unknown', color: 'var(--muted)' };
11
- return '<span class="agent-runtime-tag" title="Runtime: ' + escapeHtml(runtime || 'unknown') + '" style="font-size:9px;font-weight:600;letter-spacing:0.4px;text-transform:uppercase;padding:1px 5px;margin-left:6px;border:1px solid ' + meta.color + ';border-radius:3px;color:' + meta.color + ';background:transparent">' + escapeHtml(meta.label) + '</span>';
22
+ const meta = RUNTIME_TAGS[runtime];
23
+ if (meta && meta.svg) {
24
+ return '<span class="agent-runtime-tag" title="Runtime: ' + escapeHtml(meta.label) + '" style="display:inline-block;margin-left:6px;color:' + meta.color + '" aria-label="' + escapeHtml(meta.label) + ' runtime">' + meta.svg + '</span>';
25
+ }
26
+ // Unknown runtime — fall back to a small text pill so the user still sees something
27
+ const fallback = runtime || 'unknown';
28
+ return '<span class="agent-runtime-tag" title="Runtime: ' + escapeHtml(fallback) + '" style="font-size:9px;font-weight:600;letter-spacing:0.4px;text-transform:uppercase;padding:1px 5px;margin-left:6px;border:1px solid var(--muted);border-radius:3px;color:var(--muted);background:transparent">' + escapeHtml(fallback) + '</span>';
12
29
  }
13
30
 
14
31
  function renderAgents(agents) {
@@ -49,13 +66,23 @@ async function openAgentDetail(id) {
49
66
  const emojiSpan = document.createElement('span');
50
67
  emojiSpan.style.fontSize = '22px';
51
68
  emojiSpan.textContent = agent.emoji || '';
52
- // Runtime tag rendered as a separate span so the textContent path keeps its
53
- // SEC-03-Phase-A safety for the user-controlled name/role fields.
54
- const runtimeMeta = RUNTIME_TAGS[agent.runtime] || { label: agent.runtime || 'unknown', color: 'var(--muted)' };
69
+ // Runtime tag \u2014 uses the inline-SVG logo from the same RUNTIME_TAGS map the
70
+ // card uses, so the visual is consistent. The container's user-controlled
71
+ // text fields stay on the textContent path; the SVG is a hardcoded literal
72
+ // from RUNTIME_TAGS keyed by the runtime string (server-controlled, finite
73
+ // set), so injecting via innerHTML on the icon-only span is safe.
74
+ const runtimeMeta = RUNTIME_TAGS[agent.runtime];
55
75
  const runtimeSpan = document.createElement('span');
56
- runtimeSpan.style.cssText = 'font-size:10px;font-weight:600;letter-spacing:0.4px;text-transform:uppercase;padding:2px 6px;margin-left:10px;border:1px solid ' + runtimeMeta.color + ';border-radius:3px;color:' + runtimeMeta.color;
57
- runtimeSpan.title = 'Runtime: ' + (agent.runtime || 'unknown');
58
- runtimeSpan.textContent = runtimeMeta.label;
76
+ runtimeSpan.title = 'Runtime: ' + (runtimeMeta?.label || agent.runtime || 'unknown');
77
+ runtimeSpan.style.cssText = 'display:inline-block;margin-left:10px';
78
+ if (runtimeMeta && runtimeMeta.svg) {
79
+ runtimeSpan.style.color = runtimeMeta.color;
80
+ runtimeSpan.innerHTML = runtimeMeta.svg.replace('width="13"', 'width="18"').replace('height="13"', 'height="18"');
81
+ runtimeSpan.setAttribute('aria-label', runtimeMeta.label + ' runtime');
82
+ } else {
83
+ runtimeSpan.style.cssText += ';font-size:10px;font-weight:600;letter-spacing:0.4px;text-transform:uppercase;padding:2px 6px;border:1px solid var(--muted);border-radius:3px;color:var(--muted)';
84
+ runtimeSpan.textContent = agent.runtime || 'unknown';
85
+ }
59
86
  nameEl.replaceChildren(
60
87
  emojiSpan,
61
88
  document.createTextNode(' ' + (agent.name || '') + ' \u2014 ' + (agent.role || '')),
@@ -54,8 +54,39 @@ function formatToolSummary(name, input) {
54
54
  * @param {object} obj - Parsed JSON object from agent JSONL output
55
55
  * @returns {string} HTML fragment
56
56
  */
57
- function _renderJsonObj(obj) {
57
+ function _renderJsonObj(obj, state) {
58
+ state = state || {};
58
59
  var parts = [];
60
+ if (!(state.copilotToolKeys instanceof Set)) state.copilotToolKeys = new Set();
61
+ if (typeof state.copilotDeltaBuffer !== 'string') state.copilotDeltaBuffer = '';
62
+ if (typeof state.copilotReasoningPending !== 'boolean') state.copilotReasoningPending = false;
63
+
64
+ function assistantBubbleHtml(text) {
65
+ return '<div style="display:flex;align-items:baseline;gap:6px;margin:4px 0">' +
66
+ '<span style="color:var(--muted);font-size:10px;flex-shrink:0">&#9679;</span>' +
67
+ '<div style="background:var(--surface2);padding:8px 12px;border-radius:12px 12px 12px 2px;max-width:90%;font-size:12px;word-break:break-word">' + renderMd(text) + '</div>' +
68
+ '</div>';
69
+ }
70
+ function toolUseHtml(name, input) {
71
+ var summary = formatToolSummary(name || 'tool', input || {});
72
+ var rawJson = escHtml(JSON.stringify(input || {}, null, 2).slice(0, 500));
73
+ return '<div style="display:flex;align-items:center;gap:4px;margin:2px 0;font-size:10px;color:var(--muted);font-family:monospace">' +
74
+ '<span style="flex-shrink:0">&#9679;</span>' +
75
+ '<span>' + summary + '</span>' +
76
+ '<span style="cursor:pointer;opacity:0.6;margin-left:4px" onclick="var t=this.parentElement.nextElementSibling;t.style.display=t.style.display===\'none\'?\'block\':\'none\';this.textContent=t.style.display===\'none\'?\'[+]\':\'[-]\'">[+]</span>' +
77
+ '</div>' +
78
+ '<div style="display:none;background:var(--bg);padding:4px 8px;border-radius:4px;margin:0 0 4px 16px;font-size:10px;font-family:monospace;white-space:pre-wrap;max-height:200px;overflow-y:auto;color:var(--muted)">' + rawJson + '</div>';
79
+ }
80
+ function toolResultHtml(text) {
81
+ if (!text || text.length <= 10) return '';
82
+ var truncated = text.length > 3000;
83
+ var displayText = truncated ? text.slice(0, 3000) + '...' : text;
84
+ return '<div style="background:var(--surface);border-left:2px solid var(--border);padding:2px 8px;margin:0 0 2px 16px;font-size:9px;font-family:monospace;color:var(--muted);max-height:160px;overflow-y:auto;white-space:pre-wrap;cursor:pointer" onclick="this.style.maxHeight=this.style.maxHeight===\'160px\'?\'none\':\'160px\'">' + escHtml(displayText) + '</div>';
85
+ }
86
+ function toolKey(name, input) {
87
+ try { return String(name || 'tool') + '|' + JSON.stringify(input || {}); }
88
+ catch { return String(name || 'tool'); }
89
+ }
59
90
 
60
91
  if (obj.type === 'assistant' && obj.message && obj.message.content) {
61
92
  var content = obj.message.content;
@@ -65,22 +96,10 @@ function _renderJsonObj(obj) {
65
96
  parts.push('<div style="font-size:10px;color:var(--muted);padding:2px 8px;font-style:italic">\u{1F4AD} Thinking...</div>');
66
97
  }
67
98
  if (block.type === 'text' && block.text) {
68
- parts.push('<div style="display:flex;align-items:baseline;gap:6px;margin:4px 0">' +
69
- '<span style="color:var(--muted);font-size:10px;flex-shrink:0">&#9679;</span>' +
70
- '<div style="background:var(--surface2);padding:8px 12px;border-radius:12px 12px 12px 2px;max-width:90%;font-size:12px;word-break:break-word">' + renderMd(block.text) + '</div>' +
71
- '</div>');
99
+ parts.push(assistantBubbleHtml(block.text));
72
100
  }
73
101
  if (block.type === 'tool_use') {
74
- var summary = formatToolSummary(block.name || 'tool', block.input || {});
75
- var rawJson = escHtml(JSON.stringify(block.input || {}, null, 2).slice(0, 500));
76
- parts.push(
77
- '<div style="display:flex;align-items:center;gap:4px;margin:2px 0;font-size:10px;color:var(--muted);font-family:monospace">' +
78
- '<span style="flex-shrink:0">&#9679;</span>' +
79
- '<span>' + summary + '</span>' +
80
- '<span style="cursor:pointer;opacity:0.6;margin-left:4px" onclick="var t=this.parentElement.nextElementSibling;t.style.display=t.style.display===\'none\'?\'block\':\'none\';this.textContent=t.style.display===\'none\'?\'[+]\':\'[-]\'">[+]</span>' +
81
- '</div>' +
82
- '<div style="display:none;background:var(--bg);padding:4px 8px;border-radius:4px;margin:0 0 4px 16px;font-size:10px;font-family:monospace;white-space:pre-wrap;max-height:200px;overflow-y:auto;color:var(--muted)">' + rawJson + '</div>'
83
- );
102
+ parts.push(toolUseHtml(block.name, block.input));
84
103
  }
85
104
  }
86
105
  }
@@ -88,11 +107,57 @@ function _renderJsonObj(obj) {
88
107
  if (obj.type === 'tool_result' || (obj.type === 'user' && obj.message && obj.message.content && obj.message.content[0] && obj.message.content[0].type === 'tool_result')) {
89
108
  var tc = (obj.message && obj.message.content && obj.message.content[0] && obj.message.content[0].content) || obj.content || '';
90
109
  var text = typeof tc === 'string' ? tc : JSON.stringify(tc);
91
- if (text.length > 10) {
92
- var truncated = text.length > 3000;
93
- var displayText = truncated ? text.slice(0, 3000) + '...' : text;
94
- parts.push('<div style="background:var(--surface);border-left:2px solid var(--border);padding:2px 8px;margin:0 0 2px 16px;font-size:9px;font-family:monospace;color:var(--muted);max-height:160px;overflow-y:auto;white-space:pre-wrap;cursor:pointer" onclick="this.style.maxHeight=this.style.maxHeight===\'160px\'?\'none\':\'160px\'">' + escHtml(displayText) + '</div>');
110
+ parts.push(toolResultHtml(text));
111
+ }
112
+
113
+ if (obj.type === 'assistant.reasoning' || obj.type === 'assistant.reasoning_delta') {
114
+ state.copilotReasoningPending = true;
115
+ }
116
+
117
+ if (obj.type === 'assistant.message_delta' && typeof obj.data?.deltaContent === 'string') {
118
+ if (state.copilotReasoningPending) {
119
+ parts.push('<div style="font-size:10px;color:var(--muted);padding:2px 8px;font-style:italic">\u{1F4AD} Thinking...</div>');
120
+ state.copilotReasoningPending = false;
95
121
  }
122
+ state.copilotDeltaBuffer += obj.data.deltaContent;
123
+ }
124
+
125
+ if (obj.type === 'assistant.message') {
126
+ if (state.copilotReasoningPending) {
127
+ parts.push('<div style="font-size:10px;color:var(--muted);padding:2px 8px;font-style:italic">\u{1F4AD} Thinking...</div>');
128
+ state.copilotReasoningPending = false;
129
+ }
130
+ state.copilotDeltaBuffer = '';
131
+ if (typeof obj.data?.content === 'string' && obj.data.content) {
132
+ parts.push(assistantBubbleHtml(obj.data.content));
133
+ }
134
+ var toolRequests = Array.isArray(obj.data?.toolRequests) ? obj.data.toolRequests : [];
135
+ for (var trIdx = 0; trIdx < toolRequests.length; trIdx++) {
136
+ var tr = toolRequests[trIdx];
137
+ if (!tr || !tr.name) continue;
138
+ var trInput = tr.arguments || {};
139
+ var trKey = toolKey(tr.name, trInput);
140
+ if (state.copilotToolKeys.has(trKey)) continue;
141
+ state.copilotToolKeys.add(trKey);
142
+ parts.push(toolUseHtml(tr.name, trInput));
143
+ }
144
+ }
145
+
146
+ if (obj.type === 'tool.execution_start' && obj.data?.toolName) {
147
+ var startInput = obj.data.arguments || {};
148
+ var startKey = toolKey(obj.data.toolName, startInput);
149
+ if (!state.copilotToolKeys.has(startKey)) {
150
+ state.copilotToolKeys.add(startKey);
151
+ parts.push(toolUseHtml(obj.data.toolName, startInput));
152
+ }
153
+ }
154
+
155
+ if (obj.type === 'tool.execution_complete') {
156
+ var resultData = obj.data?.result;
157
+ var resultText = resultData?.content || resultData?.detailedContent || '';
158
+ if (!resultText && resultData && typeof resultData !== 'string') resultText = JSON.stringify(resultData);
159
+ if (!resultText && obj.data?.success === false) resultText = 'Tool failed';
160
+ parts.push(toolResultHtml(typeof resultText === 'string' ? resultText : String(resultText || '')));
96
161
  }
97
162
 
98
163
  if (obj.type === 'result') {
@@ -116,6 +181,21 @@ function renderAgentOutput(text) {
116
181
  if (!text) return '';
117
182
  var fragments = [];
118
183
  var lines = text.split('\n');
184
+ var state = { copilotDeltaBuffer: '', copilotToolKeys: new Set(), copilotReasoningPending: false };
185
+
186
+ function flushCopilotPending() {
187
+ if (state.copilotReasoningPending) {
188
+ fragments.push('<div style="font-size:10px;color:var(--muted);padding:2px 8px;font-style:italic">\u{1F4AD} Thinking...</div>');
189
+ state.copilotReasoningPending = false;
190
+ }
191
+ if (state.copilotDeltaBuffer) {
192
+ fragments.push('<div style="display:flex;align-items:baseline;gap:6px;margin:4px 0">' +
193
+ '<span style="color:var(--muted);font-size:10px;flex-shrink:0">&#9679;</span>' +
194
+ '<div style="background:var(--surface2);padding:8px 12px;border-radius:12px 12px 12px 2px;max-width:90%;font-size:12px;word-break:break-word">' + renderMd(state.copilotDeltaBuffer) + '</div>' +
195
+ '</div>');
196
+ state.copilotDeltaBuffer = '';
197
+ }
198
+ }
119
199
 
120
200
  for (var i = 0; i < lines.length; i++) {
121
201
  var trimmed = lines[i].trim();
@@ -145,7 +225,7 @@ function renderAgentOutput(text) {
145
225
  try {
146
226
  var arr = JSON.parse(trimmed);
147
227
  if (Array.isArray(arr)) {
148
- for (var j = 0; j < arr.length; j++) fragments.push(_renderJsonObj(arr[j]));
228
+ for (var j = 0; j < arr.length; j++) fragments.push(_renderJsonObj(arr[j], state));
149
229
  continue;
150
230
  }
151
231
  } catch (e) { /* fall through */ }
@@ -154,11 +234,17 @@ function renderAgentOutput(text) {
154
234
  // JSON object line
155
235
  if (trimmed.startsWith('{')) {
156
236
  try {
157
- fragments.push(_renderJsonObj(JSON.parse(trimmed)));
237
+ var obj = JSON.parse(trimmed);
238
+ if (obj.type !== 'assistant.message_delta' && obj.type !== 'assistant.reasoning' && obj.type !== 'assistant.reasoning_delta' && obj.type !== 'assistant.message') {
239
+ flushCopilotPending();
240
+ }
241
+ fragments.push(_renderJsonObj(obj, state));
158
242
  continue;
159
243
  } catch (e) { /* fall through */ }
160
244
  }
161
245
 
246
+ flushCopilotPending();
247
+
162
248
  // Stderr
163
249
  if (trimmed.startsWith('[stderr]')) {
164
250
  fragments.push('<div style="font-size:9px;color:var(--red);font-family:monospace;padding:1px 4px">' + escHtml(trimmed) + '</div>');
@@ -168,6 +254,7 @@ function renderAgentOutput(text) {
168
254
  }
169
255
  }
170
256
 
257
+ flushCopilotPending();
171
258
  return fragments.join('');
172
259
  }
173
260
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.1591",
3
+ "version": "0.1.1593",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"