@xcanwin/manyoyo 5.7.12 → 5.7.14

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.
@@ -1516,6 +1516,36 @@ details.trace-card > .trace-card-summary {
1516
1516
  cursor: pointer;
1517
1517
  }
1518
1518
 
1519
+ .trace-card.trace-card-compact {
1520
+ border-left-width: 2px;
1521
+ border-radius: 999px;
1522
+ background: rgba(255, 251, 245, 0.78);
1523
+ box-shadow: none;
1524
+ }
1525
+
1526
+ .trace-card.trace-card-compact .trace-card-summary {
1527
+ padding: 5px 10px;
1528
+ gap: 7px;
1529
+ }
1530
+
1531
+ .trace-card.trace-card-compact .trace-card-badge {
1532
+ min-width: 0;
1533
+ padding: 2px 6px;
1534
+ background: rgba(31, 26, 20, 0.06);
1535
+ font-size: 10px;
1536
+ }
1537
+
1538
+ .trace-card.trace-card-compact .trace-card-title {
1539
+ font-size: 11px;
1540
+ font-weight: 500;
1541
+ color: #6e6256;
1542
+ }
1543
+
1544
+ .trace-card.trace-card-compact .trace-card-phase {
1545
+ font-size: 10px;
1546
+ color: #8a7d70;
1547
+ }
1548
+
1519
1549
  .trace-card-summary::-webkit-details-marker {
1520
1550
  display: none;
1521
1551
  }
@@ -354,6 +354,34 @@
354
354
  return 'neutral';
355
355
  }
356
356
 
357
+ function shouldCompactTraceEvent(traceEvent) {
358
+ const event = traceEvent && typeof traceEvent === 'object' ? traceEvent : {};
359
+ const phase = event.phase ? String(event.phase) : '';
360
+ const kind = event.kind ? String(event.kind) : '';
361
+ if (phase !== 'completed') {
362
+ return false;
363
+ }
364
+ return kind === 'command' || kind === 'mcp' || kind === 'tool';
365
+ }
366
+
367
+ function buildCompactTraceText(traceEvent) {
368
+ const event = traceEvent && typeof traceEvent === 'object' ? traceEvent : {};
369
+ if (event.kind === 'command') {
370
+ const suffix = typeof event.exitCode === 'number'
371
+ ? `exit ${event.exitCode}`
372
+ : (event.status ? String(event.status) : 'completed');
373
+ return `${event.command || event.text || '命令'} · ${suffix}`;
374
+ }
375
+ if (event.kind === 'mcp') {
376
+ const toolLabel = [event.server, event.tool].filter(Boolean).join('.') || event.text || 'MCP';
377
+ return event.argumentSummary ? `${toolLabel} · ${event.argumentSummary}` : toolLabel;
378
+ }
379
+ if (event.kind === 'tool') {
380
+ return event.toolName || event.text || '工具';
381
+ }
382
+ return event.text || '事件';
383
+ }
384
+
357
385
  function appendTraceCardBody(cardBody, label, value) {
358
386
  const text = stringifyPrettyJson(value).trim();
359
387
  if (!text) {
@@ -377,11 +405,12 @@
377
405
 
378
406
  function createTraceEventCard(traceEvent) {
379
407
  const event = traceEvent && typeof traceEvent === 'object' ? traceEvent : {};
408
+ const compact = shouldCompactTraceEvent(event);
380
409
  const bodyParts = [];
381
- if (event.kind === 'command' && event.command) {
410
+ if (!compact && event.kind === 'command' && event.command) {
382
411
  bodyParts.push({ label: '命令', value: event.command });
383
412
  }
384
- if (event.kind === 'mcp') {
413
+ if (!compact && event.kind === 'mcp') {
385
414
  if (event.argumentSummary) {
386
415
  bodyParts.push({ label: '参数摘要', value: event.argumentSummary });
387
416
  }
@@ -395,7 +424,7 @@
395
424
  bodyParts.push({ label: '错误', value: event.error });
396
425
  }
397
426
  }
398
- if (event.kind === 'tool' && event.toolName) {
427
+ if (!compact && event.kind === 'tool' && event.toolName) {
399
428
  bodyParts.push({ label: '工具', value: event.toolName });
400
429
  }
401
430
  if ((event.kind === 'agent_message' || event.kind === 'status' || event.kind === 'error') && event.detail) {
@@ -404,7 +433,7 @@
404
433
 
405
434
  const hasBody = bodyParts.length > 0;
406
435
  const card = document.createElement(hasBody ? 'details' : 'div');
407
- card.className = 'trace-card trace-tone-' + resolveTraceTone(event);
436
+ card.className = 'trace-card trace-tone-' + resolveTraceTone(event) + (compact ? ' trace-card-compact' : '');
408
437
  if (hasBody && event.kind === 'error') {
409
438
  card.open = true;
410
439
  }
@@ -419,7 +448,7 @@
419
448
 
420
449
  const title = document.createElement('span');
421
450
  title.className = 'trace-card-title';
422
- title.textContent = event && event.text ? String(event.text) : '事件';
451
+ title.textContent = compact ? buildCompactTraceText(event) : (event && event.text ? String(event.text) : '事件');
423
452
  header.appendChild(title);
424
453
 
425
454
  const phaseText = humanizeTracePhase(event);
package/lib/web/server.js CHANGED
@@ -158,17 +158,57 @@ function normalizeWebAgentSessionRecord(agentId, rawAgent) {
158
158
  };
159
159
  }
160
160
 
161
+ function resolveEffectiveAgentPromptCommand(template, applied) {
162
+ const normalizedTemplate = normalizeAgentPromptCommandTemplate(template, 'agentPromptCommand');
163
+ if (!normalizedTemplate) {
164
+ return '';
165
+ }
166
+
167
+ const program = resolveAgentProgram(normalizedTemplate);
168
+ const defaultCommand = applied && typeof applied === 'object'
169
+ ? String(applied.defaultCommand || '').trim()
170
+ : '';
171
+ if (!program || !defaultCommand) {
172
+ return normalizedTemplate;
173
+ }
174
+
175
+ const defaultProgram = resolveAgentProgram(defaultCommand);
176
+ if (!defaultProgram || defaultProgram !== program) {
177
+ return normalizedTemplate;
178
+ }
179
+
180
+ const genericTemplate = normalizeAgentPromptCommandTemplate(
181
+ resolveAgentPromptCommandTemplate(program),
182
+ 'agentPromptCommand'
183
+ );
184
+ if (normalizedTemplate !== genericTemplate) {
185
+ return normalizedTemplate;
186
+ }
187
+
188
+ const inferredTemplate = normalizeAgentPromptCommandTemplate(
189
+ resolveAgentPromptCommandTemplate(defaultCommand),
190
+ 'agentPromptCommand'
191
+ );
192
+ if (!inferredTemplate || inferredTemplate === genericTemplate) {
193
+ return normalizedTemplate;
194
+ }
195
+
196
+ return inferredTemplate;
197
+ }
198
+
161
199
  function normalizeWebHistoryRecord(containerName, rawData) {
162
200
  const data = rawData && typeof rawData === 'object' && !Array.isArray(rawData) ? rawData : {};
201
+ const applied = data.applied && typeof data.applied === 'object' && !Array.isArray(data.applied)
202
+ ? data.applied
203
+ : null;
163
204
  const history = {
164
205
  containerName,
165
206
  updatedAt: typeof data.updatedAt === 'string' ? data.updatedAt : null,
166
- agentPromptCommand: typeof data.agentPromptCommand === 'string'
167
- ? data.agentPromptCommand
168
- : '',
169
- applied: data.applied && typeof data.applied === 'object' && !Array.isArray(data.applied)
170
- ? data.applied
171
- : null,
207
+ agentPromptCommand: resolveEffectiveAgentPromptCommand(
208
+ typeof data.agentPromptCommand === 'string' ? data.agentPromptCommand : '',
209
+ applied
210
+ ),
211
+ applied,
172
212
  agents: {}
173
213
  };
174
214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcanwin/manyoyo",
3
- "version": "5.7.12",
3
+ "version": "5.7.14",
4
4
  "imageVersion": "1.9.0-common",
5
5
  "playwrightCliVersion": "0.1.1",
6
6
  "description": "AI Agent CLI Security Sandbox for Docker and Podman",