xonecas.io
64875
Mc

mini-coder / commit 4b9f056

feat: ui improvements

xonecas2026-04-30 4b9f056607b0b074c797cbb41efcaaa3bdc3d865 parent 9abfe96

5 files changed

bun.lock+1−1
@@ -129,7 +129,7 @@
129129
130130 "@kwsites/promise-deferred": ["@kwsites/promise-deferred@1.1.1", "", {}, "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="],
131131
132- "@mariozechner/pi-ai": ["@mariozechner/pi-ai@0.70.2", "", { "dependencies": { "@anthropic-ai/sdk": "^0.90.0", "@aws-sdk/client-bedrock-runtime": "^3.1030.0", "@google/genai": "^1.40.0", "@mistralai/mistralai": "^2.2.0", "chalk": "^5.6.2", "openai": "6.26.0", "partial-json": "^0.1.7", "proxy-agent": "^6.5.0", "typebox": "^1.1.24", "undici": "^7.19.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-+30LRPjXsXF+oI96DvGWMbdPGeqoLJvadh6UPev7wx2DzhC9FEqXkQcoMZ0usbC …
132+ "@mariozechner/pi-ai": ["@mariozechner/pi-ai@0.70.6", "", { "dependencies": { "@anthropic-ai/sdk": "^0.90.0", "@aws-sdk/client-bedrock-runtime": "^3.1030.0", "@google/genai": "^1.40.0", "@mistralai/mistralai": "^2.2.0", "chalk": "^5.6.2", "openai": "6.26.0", "partial-json": "^0.1.7", "proxy-agent": "^6.5.0", "typebox": "^1.1.24", "undici": "^7.19.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-LVAadu0Y+hb7Bj7EDiLsx6AuGxHlxDq0euLzyqX698i9qt0BW6a+oQSUIZQz4rJ …
133133
134134 "@mistralai/mistralai": ["@mistralai/mistralai@2.2.0", "", { "dependencies": { "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" } }, "sha512-JQUGIXjFWnw/J9LpTSf/ZXwVW3Sh8FBAcfTo5QvAHqkl4CfSiIwnjRJhMoAFcP6ncCe84YPU1ncDGX+p3OXnfg=="],
135135
package.json+1−1
@@ -22,7 +22,7 @@
2222 "dependencies": {
2323 "@cel-tui/components": "^0.8.3",
2424 "@cel-tui/core": "^0.8.3",
25- "@mariozechner/pi-ai": "^0.70.2",
25+ "@mariozechner/pi-ai": "^0.70.6",
2626 "diff": "^9.0.0",
2727 "simple-git": "^3.36.0",
2828 "yaml": "^2.8.3"
src/tool-edit.ts+1−1
@@ -126,7 +126,7 @@ export async function* runEditTool(
126126
127127 yield {
128128 type: "result",
129- text: `File edited: ${filePath}\n\n${patch}`,
129+ text: patch,
130130 };
131131
132132 return;
src/tui-conversation.ts+27−16
@@ -117,21 +117,31 @@ function userMessageNode(msg: UserMessage): Node {
117117
118118 function toolMessageNode(msg: ToolResultMessage): Node {
119119 // Output only shows last 10 lines of scroll.
120- return VStack(
121- {
122- height: 10,
123- padding: { x: 4 },
124- overflow: "scroll",
125- scrollOffset: Infinity,
126- onScroll: () => false,
127- },
128- msg.content.map((block) => {
129- if (block.type === "text") {
130- return Text(block.text, { wrap: "word", fgColor: theme.bblack });
131- }
132- return Text(""); // TODO: image case needs attention
120+ const text = msg.content
121+ .filter((c) => c.type === "text")
122+ .map((c) => c.text)
123+ .join("")
124+ .trim();
125+
126+ return VStack({ padding: { x: 4 }, gap: 1 }, [
127+ Text(`~${estimateTokens(text)} tokens, ${text.split("\n").length} lines.`, {
128+ fgColor: theme.bblack,
133129 }),
134- );
130+ VStack(
131+ {
132+ flex: 1,
133+ maxHeight: msg.toolName === "edit" ? 20 : 10,
134+ overflow: "scroll",
135+ scrollOffset: Infinity,
136+ onScroll: () => false,
137+ },
138+ [
139+ msg.toolName === "edit"
140+ ? SyntaxHighlight(text, "diff")
141+ : Text(text, { wrap: "word", fgColor: theme.white }),
142+ ],
143+ ),
144+ ]);
135145 }
136146
137147 const messageBodyCache = new WeakMap<Message, { key: number; node: Node }>();
@@ -187,6 +197,7 @@ function cachedMessageBody(msg: Message): Node {
187197 }
188198
189199 function conversationMessageNode(msg: Message): Node {
200+ const label = msg.role === "toolResult" ? `${msg.toolName} result` : msg.role;
190201 return VStack({ gap: 1 }, [
191202 cachedMessageBody(msg),
192203 HStack({ gap: 1, justifyContent: "end" }, [
@@ -194,7 +205,7 @@ function conversationMessageNode(msg: Message): Node {
194205 fgColor: theme.bblack,
195206 italic: true,
196207 }),
197- TextPill(msg.role, theme.bwhite, theme.bblack),
208+ TextPill(label, theme.bwhite, theme.bblack),
198209 ]),
199210 ]);
200211 }
@@ -246,7 +257,7 @@ export function Conversation(state: TUIState) {
246257 return VStack(
247258 {
248259 flex: 1,
249- gap: 1,
260+ gap: 3,
250261 overflow: "scroll",
251262 scrollOffset: state.stickToBottom ? Infinity : state.scrollOffset,
252263 onScroll(offset, maxOffset) {
src/tui.ts+1−5
@@ -1,11 +1,7 @@
11 import { cel, HStack, ProcessTerminal, VStack } from "@cel-tui/core";
22 import simpleGit from "simple-git";
33 import { compactContext, streamAgent } from "./agent";
4-import {
5- buildSystemPrompt,
6- injectEnvReminder,
7- MAIN_PROMPT,
8-} from "./prompt";
4+import { buildSystemPrompt, injectEnvReminder, MAIN_PROMPT } from "./prompt";
95 import { updateSession } from "./session";
106 import { estimateTokens, secureRandomString } from "./shared";
117 import { bash, runBashTool } from "./tool-bash";