xonecas.io
79113
Ma

mini-coding-agent / commit b238a4c

chore: models catalog gen and cleanup

xonecas2026-10-25 b238a4c268f932e2f950137ba077b7afb9629c0e parent 57c0485

7 files changed

src/models_dev.json+1−1
@@ -1 +1 @@
1-{"opencode":{"id":"opencode","env":["OPENCODE_API_KEY"],"npm":"@ai-sdk/openai-compatible","api":"https://opencode.ai/inference/openai/v1","name":"OpenCode","doc":"https://opencode.ai/v2/docs/console/models/","models":{"muse-spark-1.3":{"id":"muse-spark-1.3","name":"Muse Spark 1.3","description":"Muse Spark 1.3 is a multimodal reasoning model from Meta for long-running agentic, multi-agent, and coding workflows. It improves long-horizon agent collaboration, instruction following, and coding effic …
1+{"opencode":{"id":"opencode","env":["OPENCODE_API_KEY"],"npm":"@ai-sdk/openai-compatible","api":"https://opencode.ai/inference/openai/v1","name":"OpenCode","doc":"https://opencode.ai/v2/docs/console/models/","models":{"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","description":"Claude model for creative writing, analysis, and controlled agent workflows","family":"claude-fable","attachment":true,"reasoning":true,"reasoning_options":[{"type":"effort","values":["low","medium","hig …
src/tui/render.zig+7−7
@@ -215,22 +215,22 @@ pub fn paintRow(a: std.mem.Allocator, line: []const u8) []const u8 {
215215 return std.fmt.allocPrint(a, "{s}{s}\x1b[K", .{ styles.SGR_PLAIN, line }) catch line;
216216 }
217217
218-pub fn styleLine(a: std.mem.Allocator, line: BodyLine) []const u8 {
218+pub fn styleLine(a: std.mem.Allocator, line: BodyLine, base: styles.Style) []const u8 {
219219 const safe = sanitize(a, line.text);
220220 const expanded = expandTabs(a, safe, 4);
221221 if (expanded.len == 0) return "";
222- if (line.style) |s| return styles.styledWith(a, s, expanded);
223- return expanded;
222+ if (line.style == null and !styles.anySet(base)) return expanded;
223+ return std.fmt.allocPrint(a, "{s}{s}{s}", .{ styles.sgrOn(a, line.style orelse .{}, base), expanded, styles.SGR_PLAIN }) catch expanded;
224224 }
225225
226-pub fn plainRows(a: std.mem.Allocator, lines: []const BodyLine) []const []const u8 {
226+pub fn plainRows(a: std.mem.Allocator, lines: []const BodyLine, base: styles.Style) []const []const u8 {
227227 var out: std.ArrayList([]const u8) = .empty;
228- for (lines) |line| out.append(a, styleLine(a, line)) catch {};
228+ for (lines) |line| out.append(a, styleLine(a, line, base)) catch {};
229229 return out.items;
230230 }
231231
232-pub fn bodyRows(a: std.mem.Allocator, lines: []const BodyLine, width: usize) []const []const u8 {
233- const rows = plainRows(a, lines);
232+pub fn bodyRows(a: std.mem.Allocator, lines: []const BodyLine, width: usize, base: styles.Style) []const []const u8 {
233+ const rows = plainRows(a, lines, base);
234234 var height: usize = 0;
235235 for (rows) |r| height += physicalRows(r, width);
236236 if (height <= max_body_rows or rows.len <= elided_head + elided_tail) return rows;
src/tui/screen.zig+1−1
@@ -116,7 +116,7 @@ pub const Scrollback = struct {
116116 }
117117
118118 pub fn commitLines(self: *Scrollback, lines: []const render.BodyLine) void {
119- for (lines) |line| self.push(render.styleLine(self.scratch, line));
119+ for (lines) |line| self.push(render.styleLine(self.scratch, line, .{}));
120120 }
121121
122122 pub fn note(self: *Scrollback, line: []const u8) void {
src/tui/styles.zig+4−0
@@ -91,6 +91,10 @@ pub fn styledWith(a: std.mem.Allocator, style: Style, text: []const u8) []const
9191 return std.fmt.allocPrint(a, "{s}{s}{s}", .{ sgr(a, style), text, SGR_PLAIN }) catch text;
9292 }
9393
94+pub fn anySet(style: Style) bool {
95+ return style.fg != null or style.bold or style.italic or style.underline or style.dim;
96+}
97+
9498 fn colored(a: std.mem.Allocator, color: Color, text: []const u8) []const u8 {
9599 return std.fmt.allocPrint(a, "{s}{s}{s}", .{ sgrFg(a, color), text, SGR_NORMAL_FG }) catch text;
96100 }
src/tui/tool_view.zig+1−1
@@ -8,7 +8,7 @@ const BodyLine = render.BodyLine;
88 pub const PendingCall = struct { name: []const u8, summary: []const u8, rendered: bool = false };
99
1010 fn callHead(a: std.mem.Allocator, name: []const u8) []const u8 {
11- return styles.accent(a, std.fmt.allocPrint(a, "-> {s}", .{name}) catch "->");
11+ return styles.accent(a, std.fmt.allocPrint(a, "{s}", .{name}) catch "tool");
1212 }
1313
1414 pub fn diffHead(a: std.mem.Allocator, name: []const u8, path: []const u8) []const u8 {
src/tui/tui.zig+4−3
@@ -25,8 +25,9 @@ const status = @import("../status.zig");
2525
2626 const SPINNER = "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐ …
2727 const SPINNER_MS = 120;
28-const BODY_PREFIX = " | ";
28+const BODY_PREFIX = " │ ";
2929 const ERROR_PREFIX = " ! ";
30+const TOOL_BODY: styles.Style = .{ .dim = true };
3031
3132 const physicalRows = render.physicalRows;
3233 const rowsForCells = render.rowsForCells;
@@ -511,7 +512,7 @@ const Tui = struct {
511512 const is_bash = std.mem.eql(u8, name, "bash");
512513 const bash_exit: ?[]const u8 = if (is_bash) tool_view.exitLine(self.s, shown) else null;
513514 const result = tool_view.resultLines(self.s, name, shown, self.cfg.max_diff_lines);
514- const rows = if (std.mem.eql(u8, name, "edit")) render.plainRows(self.s, result.lines) else render.bodyRows(self.s, result.lines, width);
515+ const rows = if (std.mem.eql(u8, name, "edit")) render.plainRows(self.s, result.lines, TOOL_BODY) else render.bodyRows(self.s, result.lines, width, TOOL_BODY);
515516 const mark_error = is_error and bash_exit == null;
516517 for (rows, 0..) |row, i| {
517518 const prefix = if (mark_error and i == rows.len - 1) styles.err(self.s, ERROR_PREFIX) else styles.comment(self.s, BODY_PREFIX);
@@ -523,7 +524,7 @@ const Tui = struct {
523524 for (diffs) |d| {
524525 self.push(tool_view.diffHead(self.s, name, d.path));
525526 const r = diff_view.diffBody(self.s, d, self.cfg.max_diff_lines);
526- for (render.plainRows(self.s, r.lines)) |row| {
527+ for (render.plainRows(self.s, r.lines, TOOL_BODY)) |row| {
527528 self.push(std.fmt.allocPrint(self.s, "{s}{s}", .{ styles.comment(self.s, BODY_PREFIX), row }) catch row);
528529 }
529530 if (tool_view.diffFooter(self.s, r)) |footer| self.push(footer);
tools/gen_models_dev.py+2−9
@@ -13,11 +13,7 @@ import urllib.request
1313
1414 MODELS_DEV = "https://models.dev/api.json"
1515
16-PROVIDERS = ["opencode", "opencode-go", "openai"]
17-
18-# models.dev omits `api` where the AI SDK default applies. Storing it here keeps
19-# the agent free of per-provider facts: it only ever reads the document.
20-API_DEFAULTS = {"openai": "https://api.openai.com/v1"}
16+PROVIDERS = ["opencode", "opencode-go"]
2117
2218
2319 def main():
@@ -30,10 +26,7 @@ def main():
3026 for pid in PROVIDERS:
3127 if pid not in data:
3228 sys.exit("models.dev: provider %r missing" % pid)
33- provider = dict(data[pid])
34- if not provider.get("api") and pid in API_DEFAULTS:
35- provider["api"] = API_DEFAULTS[pid]
36- kept[pid] = provider
29+ kept[pid] = dict(data[pid])
3730
3831 with open(out, "w") as f:
3932 json.dump(kept, f, separators=(",", ":"))