xonecas.io
64875
Mc

mini-coder / commit 641461b

refactor: group parallel tool calls without blank lines and add web/skill tool rendering

- Remove blank line between consecutive parallel tool calls in a batch
  so they appear as a visually grouped block
- Add dedicated buildToolCallLine rendering for webSearch (? search ...)
  and webContent (← fetch ...) with appropriate glyphs
- Add webSearch, webContent, and listSkills glyphs to toolGlyph()
- Add 3 new one-shot scenarios: web search, web content, list skills
- Update parallel call test to assert adjacency instead of separation

xonecas2026-03-16 641461ba3e94287579cd2f8b5e2c35ca871db54c parent 209d29a

4 files changed

scripts/ui-oneshot.ts+104−0
@@ -443,6 +443,110 @@ async function main() {
443443 new Spinner(),
444444 );
445445
446+ // ── Web search ──────────────────────────────────────────
447+ separator("15. Web search results");
448+ await renderTurn(
449+ eventsFrom([
450+ {
451+ type: "tool-call-start",
452+ toolName: "webSearch",
453+ toolCallId: "ws1",
454+ args: { query: "bun test runner docs" },
455+ },
456+ {
457+ type: "tool-result",
458+ toolName: "webSearch",
459+ toolCallId: "ws1",
460+ isError: false,
461+ result: {
462+ results: [
463+ {
464+ title: "Bun Test Runner Documentation",
465+ url: "https://bun.sh/docs/cli/test",
466+ score: 0.95,
467+ },
468+ {
469+ title: "Testing with Bun - Getting Started",
470+ url: "https://bun.sh/guides/test/getting-started",
471+ score: 0.87,
472+ },
473+ ],
474+ },
475+ },
476+ {
477+ type: "text-delta",
478+ delta: "Found the relevant documentation.",
479+ },
480+ done(),
481+ ]),
482+ new Spinner(),
483+ );
484+
485+ // ── Web content ─────────────────────────────────────────
486+ separator("16. Web content fetch");
487+ await renderTurn(
488+ eventsFrom([
489+ {
490+ type: "tool-call-start",
491+ toolName: "webContent",
492+ toolCallId: "wc1",
493+ args: { urls: ["https://bun.sh/docs/cli/test"] },
494+ },
495+ {
496+ type: "tool-result",
497+ toolName: "webContent",
498+ toolCallId: "wc1",
499+ isError: false,
500+ result: {
501+ results: [
502+ {
503+ title: "Bun Test Runner Documentation",
504+ url: "https://bun.sh/docs/cli/test",
505+ text: "Bun ships with a fast built-in test runner. Tests are written in TypeScript or JavaScript using a familiar Jest-like API.",
506+ },
507+ ],
508+ },
509+ },
510+ {
511+ type: "text-delta",
512+ delta: "The docs confirm Bun uses a Jest-like API.",
513+ },
514+ done(),
515+ ]),
516+ new Spinner(),
517+ );
518+
519+ // ── List skills ─────────────────────────────────────────
520+ separator("17. List skills");
521+ await renderTurn(
522+ eventsFrom([
523+ {
524+ type: "tool-call-start",
525+ toolName: "listSkills",
526+ toolCallId: "ls1",
527+ args: {},
528+ },
529+ {
530+ type: "tool-result",
531+ toolName: "listSkills",
532+ toolCallId: "ls1",
533+ isError: false,
534+ result: {
535+ skills: [
536+ { name: "mini-coder", description: "How to use the mc CLI coding agent", source: "local" },
537+ { name: "deploy", description: "Deployment guidelines", source: "global" },
538+ ],
539+ },
540+ },
541+ {
542+ type: "text-delta",
543+ delta: "Found 2 available skills.",
544+ },
545+ done(),
546+ ]),
547+ new Spinner(),
548+ );
549+
446550 writeln("");
447551 }
448552
src/cli/stream-render.ts+3−1
@@ -78,6 +78,8 @@ export async function renderTurn(
7878 if (startedToolCalls.has(event.toolCallId)) {
7979 break;
8080 }
81+ const isConsecutiveToolCall =
82+ startedToolCalls.size > 0 && toolCallInfo.size > 0;
8183 startedToolCalls.add(event.toolCallId);
8284 toolCallInfo.set(event.toolCallId, {
8385 toolName: event.toolName,
@@ -89,7 +91,7 @@ export async function renderTurn(
8991 liveReasoning.finish();
9092 content.flushOpenContent();
9193 spinner.stop();
92- if (renderedVisibleOutput) writeln();
94+ if (renderedVisibleOutput && !isConsecutiveToolCall) writeln();
9395 renderToolCall(event.toolName, event.args);
9496 renderedVisibleOutput = true;
9597
src/cli/tool-render.ts+18−0
@@ -7,6 +7,8 @@ function toolGlyph(name: string): string {
77 if (name === "subagent") return G.agent;
88 if (name === "readSkill") return G.read;
99 if (name === "listSkills") return G.search;
10+ if (name === "webSearch") return G.search;
11+ if (name === "webContent") return G.read;
1012 if (name.startsWith("mcp_")) return G.mcp;
1113 return G.info;
1214 }
@@ -40,6 +42,22 @@ export function buildToolCallLine(name: string, args: unknown): string {
4042 return `${G.read} ${c.dim("read skill")}${skillName ? ` ${skillName}` : ""}`;
4143 }
4244
45+ if (name === "webSearch") {
46+ const query = typeof a.query === "string" ? a.query : "";
47+ const short = query.length > 60 ? `${query.slice(0, 57)}…` : query;
48+ return `${G.search} ${c.dim("search")}${short ? ` ${short}` : ""}`;
49+ }
50+
51+ if (name === "webContent") {
52+ const urls = Array.isArray(a.urls) ? a.urls : [];
53+ const label =
54+ urls.length === 1
55+ ? String(urls[0])
56+ : `${urls.length} url${urls.length !== 1 ? "s" : ""}`;
57+ const short = label.length > 60 ? `${label.slice(0, 57)}…` : label;
58+ return `${G.read} ${c.dim("fetch")} ${short}`;
59+ }
60+
4361 if (name.startsWith("mcp_")) {
4462 return `${G.mcp} ${c.dim(name)}`;
4563 }
src/cli/ui-audit.test.ts+3−6
@@ -499,7 +499,7 @@ describe("UI audit: parallel tool calls", () => {
499499 expect(plain).toMatch(/^ {4}·/m);
500500 });
501501
502- test("parallel calls: blank line separates second call from first call", async () => {
502+ test("parallel calls: no blank line between consecutive tool calls in a batch", async () => {
503503 captureStdout();
504504
505505 await renderTurn(
@@ -538,13 +538,10 @@ describe("UI audit: parallel tool calls", () => {
538538 const plain = simulateTerminal(getCapturedStdout());
539539 const lines = plain.split("\n");
540540
541- // There should be a blank line between the two tool call lines
541+ // Consecutive parallel tool calls should be adjacent (no blank line)
542542 const idx1 = lines.findIndex((l) => l.includes("$ echo one"));
543543 const idx2 = lines.findIndex((l) => l.includes("$ echo two"));
544- expect(idx2).toBeGreaterThan(idx1);
545- // At least one blank line between them
546- const between = lines.slice(idx1 + 1, idx2);
547- expect(between.some((l) => l.trim() === "")).toBe(true);
544+ expect(idx2).toBe(idx1 + 1);
548545 });
549546
550547 test("parallel calls with one error and one success", async () => {