xonecas.io
7814
Ta

tiny-c-agent / commit 328a826

feat: more syntax highlighting variety

Also adds a vendor and build changeset that allows us to build these
grammars and queries into tiny

Also adds the missing tool_call_start event to better show status to the
user in the TUI

xonecas2026-10-03 328a826a8723556bb0edcf284cbc2845b9ea2542 parent bdc2437

48 files changed

This diff is too big to show in full. The first 1000 lines are below, and every file is listed with its counts.

Makefile+23−2
@@ -15,19 +15,31 @@ BIN := $(BUILD)/tiny
1515
1616 PKGS := libcurl yyjson tree-sitter \
1717 tree-sitter-javascript tree-sitter-bash \
18+ tree-sitter-c tree-sitter-python \
1819 tree-sitter-markdown tree-sitter-markdown-inline
1920
2021 SRCS := $(shell find src -name '*.c' | sort)
2122 OBJS := $(patsubst src/%.c,$(BUILD)/obj/%.o,$(SRCS))
2223 DEPS := $(OBJS:.o=.d)
2324
25+# Grammars with no distro package are vendored and built into the binary.
26+VENDOR_SRCS := $(wildcard vendor/make/src/*.c) \
27+ $(wildcard vendor/typescript/typescript/src/*.c) \
28+ $(wildcard vendor/typescript/tsx/src/*.c)
29+VENDOR_OBJS := $(patsubst vendor/%.c,$(BUILD)/obj/vendor/%.o,$(VENDOR_SRCS))
30+OBJS += $(VENDOR_OBJS)
31+VENDOR_CPPFLAGS := -D_GNU_SOURCE -std=$(STD) $(OPT) -pthread -w -fPIC -MMD -MP \
32+ -Ivendor/make/src \
33+ -Ivendor/typescript/typescript/src \
34+ -Ivendor/typescript/tsx/src
35+
2436 BASE := -std=$(STD) $(OPT) -pthread
2537
26-CPPFLAGS += -D_GNU_SOURCE -Isrc -MMD -MP
38+CPPFLAGS += -D_GNU_SOURCE -Isrc -Ivendor/make -Ivendor/typescript -MMD -MP
2739 CFLAGS += $(BASE) $(WARN) $(shell pkg-config --cflags $(PKGS))
2840 LDLIBS += $(shell pkg-config --libs $(PKGS)) -pthread
2941
30-.PHONY: all deps catalog run clean
42+.PHONY: all deps catalog queries run clean
3143 all: $(BIN)
3244
3345 # Regenerates the committed catalog from models.dev. Run at release time, then
@@ -35,6 +47,11 @@ all: $(BIN)
3547 catalog:
3648 python3 tools/gen_catalog.py
3749
50+# Regenerates the committed highlight queries from vendor/queries. Run after
51+# editing a .scm file, then commit src/queries.generated.c.
52+queries:
53+ python3 tools/gen_queries.py
54+
3855 $(BIN): $(OBJS)
3956 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
4057
@@ -42,6 +59,10 @@ $(BUILD)/obj/%.o: src/%.c
4259 @mkdir -p $(dir $@)
4360 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
4461
62+$(BUILD)/obj/vendor/%.o: vendor/%.c
63+ @mkdir -p $(dir $@)
64+ $(CC) $(VENDOR_CPPFLAGS) -c -o $@ $<
65+
4566 deps:
4667 @for p in $(PKGS); do \
4768 if pkg-config --exists $$p; then \
src/agent.c+8−2
@@ -111,6 +111,10 @@ static void on_stream(const tiny_stream_event *ev, void *user) {
111111 e.type = TINY_EVENT_REASONING;
112112 e.u.reasoning.delta = ev->delta;
113113 break;
114+ case TINY_STREAM_TOOL_CALL_START:
115+ e.type = TINY_EVENT_TOOL_CALL_START;
116+ e.u.tool_call_start.name = ev->tool_name;
117+ break;
114118 case TINY_STREAM_TOOL_CALL:
115119 e.type = TINY_EVENT_TOOL_CALL;
116120 e.u.tool_call.name = ev->tool_name;
@@ -133,8 +137,10 @@ static tiny_tool_result run_tool(tiny_agent *a, turn_state *st, const tiny_block
133137 const char *name = b->tool_name ? b->tool_name : "";
134138 const char *args = b->arguments ? b->arguments : "{}";
135139
136- // Only the tools that can write get a tree diff around them.
137- if (strcmp(name, "edit") != 0 && strcmp(name, "bash") != 0)
140+ // Only bash can write anywhere under the working directory, so a diff of
141+ // the tree around it is the only way to report what changed. `edit` reports
142+ // its own diff from the content it already read.
143+ if (strcmp(name, "bash") != 0)
138144 return tiny_tool_run(name, args, a->model.supports_images, on_tool_output, st, a->cancel);
139145
140146 // The tool may write anywhere under the working directory, so a diff of the
src/api.h+4−0
@@ -15,6 +15,10 @@ void tiny_json_tool(yyjson_mut_doc *doc, yyjson_mut_val *obj, const tiny_tool *t
1515 // Emits one delta to the adapter's stream callback, if any.
1616 void tiny_emit_delta(tiny_stream_fn emit, void *user, tiny_stream_type type, const char *delta);
1717
18+// Emits TINY_STREAM_TOOL_CALL_START. Call once per tool call block, as soon as
19+// its name is known, before the arguments have finished streaming.
20+void tiny_emit_tool_start(tiny_stream_fn emit, void *user, const char *id, const char *name);
21+
1822 // Appends a text/thinking block when `text` is non-NULL and non-empty.
1923 void tiny_add_text_block(tiny_message *out, tiny_block_type type, const char *text);
2024
src/api/anthropic_messages.c+5−0
@@ -178,6 +178,7 @@ typedef struct {
178178 char *id;
179179 char *name;
180180 tiny_buf args;
181+ bool started;
181182 } block_acc;
182183
183184 typedef struct {
@@ -240,6 +241,10 @@ static void on_data(const char *json, size_t len, void *user) {
240241 yyjson_val *nm = yyjson_obj_get(cb, "name");
241242 if (yyjson_is_str(id)) tiny_set_str(&b->id, yyjson_get_str(id));
242243 if (yyjson_is_str(nm)) tiny_set_str(&b->name, yyjson_get_str(nm));
244+ if (!b->started && b->name && b->name[0]) {
245+ b->started = true;
246+ tiny_emit_tool_start(st->emit, st->user, b->id, b->name);
247+ }
243248 } else if (strcmp(bts, "thinking") == 0 || strcmp(bts, "redacted_thinking") == 0) {
244249 b->type = BLK_THINKING;
245250 } else {
src/api/google_generative_ai.c+1−0
@@ -201,6 +201,7 @@ static void add_call(google_state *st, const char *name, yyjson_val *args) {
201201 char id[64];
202202 snprintf(id, sizeof id, "%s_%zu", c->name, st->calls_len);
203203 c->id = xstrdup(id);
204+ if (c->name[0]) tiny_emit_tool_start(st->emit, st->user, c->id, c->name);
204205 if (args) {
205206 size_t len = 0;
206207 char *txt = yyjson_val_write(args, 0, &len);
src/api/openai_completions.c+5−0
@@ -166,6 +166,7 @@ typedef struct {
166166 char *id;
167167 char *name;
168168 tiny_buf args;
169+ bool started;
169170 } tool_acc;
170171
171172 typedef struct {
@@ -229,6 +230,10 @@ static void handle_delta(sse_state *st, yyjson_val *delta) {
229230 free(a->name);
230231 a->name = xstrdup(yyjson_get_str(name));
231232 }
233+ if (!a->started && a->name && a->name[0]) {
234+ a->started = true;
235+ tiny_emit_tool_start(st->emit, st->user, a->id, a->name);
236+ }
232237 yyjson_val *args = yyjson_obj_get(fn, "arguments");
233238 if (yyjson_is_str(args)) {
234239 const char *s = yyjson_get_str(args);
src/api/openai_responses.c+9−0
@@ -129,6 +129,7 @@ typedef struct {
129129 char *call_id;
130130 char *name;
131131 tiny_buf args;
132+ bool started;
132133 } call_acc;
133134
134135 typedef struct {
@@ -186,6 +187,10 @@ static void on_data(const char *json, size_t len, void *user) {
186187 yyjson_val *nm = yyjson_obj_get(item, "name");
187188 if (yyjson_is_str(id)) tiny_set_str(&a->call_id, yyjson_get_str(id));
188189 if (yyjson_is_str(nm)) tiny_set_str(&a->name, yyjson_get_str(nm));
190+ if (!a->started && a->name && a->name[0]) {
191+ a->started = true;
192+ tiny_emit_tool_start(st->emit, st->user, a->call_id, a->name);
193+ }
189194 }
190195 } else if (strcmp(type, "response.output_text.delta") == 0 ||
191196 strcmp(type, "response.refusal.delta") == 0) {
@@ -234,6 +239,10 @@ static void on_data(const char *json, size_t len, void *user) {
234239 yyjson_val *ar = yyjson_obj_get(item, "arguments");
235240 if (yyjson_is_str(id)) tiny_set_str(&a->call_id, yyjson_get_str(id));
236241 if (yyjson_is_str(nm)) tiny_set_str(&a->name, yyjson_get_str(nm));
242+ if (!a->started && a->name && a->name[0]) {
243+ a->started = true;
244+ tiny_emit_tool_start(st->emit, st->user, a->call_id, a->name);
245+ }
237246 if (yyjson_is_str(ar) && !a->args.len)
238247 buf_add(&a->args, yyjson_get_str(ar), strlen(yyjson_get_str(ar)));
239248 }
src/catalog.generated.c+149−149
@@ -22,155 +22,155 @@ static const char *const effort_15[] = {"low", "medium", "xhigh"};
2222 static const char *const effort_16[] = {"none", "low", "high"};
2323
2424 const tiny_model_info tiny_catalog_entries[] = {
25- {"opencode", "big-pickle", "Big Pickle", false, 200000L, NULL, 0},
26- {"opencode", "claude-3-5-haiku", "Claude Haiku 3.5", true, 200000L, NULL, 0},
27- {"opencode", "claude-fable-5", "Claude Fable 5", true, 1000000L, effort_0, 5},
28- {"opencode", "claude-fable-5-1", "Claude Fable 5.1", true, 1000000L, effort_0, 5},
29- {"opencode", "claude-haiku-4-5", "Claude Haiku 4.5", true, 200000L, NULL, 0},
30- {"opencode", "claude-opus-4-1", "Claude Opus 4.1", true, 200000L, NULL, 0},
31- {"opencode", "claude-opus-4-5", "Claude Opus 4.5", true, 200000L, effort_1, 3},
32- {"opencode", "claude-opus-4-6", "Claude Opus 4.6", true, 1000000L, effort_2, 4},
33- {"opencode", "claude-opus-4-7", "Claude Opus 4.7", true, 1000000L, effort_0, 5},
34- {"opencode", "claude-opus-4-8", "Claude Opus 4.8", true, 1000000L, effort_0, 5},
35- {"opencode", "claude-opus-5", "Claude Opus 5", true, 1000000L, effort_0, 5},
36- {"opencode", "claude-opus-5-5", "Claude Opus 5.5", true, 1000000L, effort_0, 5},
37- {"opencode", "claude-sonnet-4", "Claude Sonnet 4", true, 1000000L, NULL, 0},
38- {"opencode", "claude-sonnet-4-5", "Claude Sonnet 4.5", true, 1000000L, NULL, 0},
39- {"opencode", "claude-sonnet-4-6", "Claude Sonnet 4.6", true, 1000000L, effort_2, 4},
40- {"opencode", "claude-sonnet-5", "Claude Sonnet 5", true, 1000000L, effort_0, 5},
41- {"opencode", "claude-sonnet-5-5", "Claude Sonnet 5.5", true, 1000000L, effort_0, 5},
42- {"opencode", "deepseek-v4-flash", "DeepSeek V4 Flash", false, 1000000L, effort_3, 3},
43- {"opencode", "deepseek-v4-flash-free", "DeepSeek V4 Flash Free", false, 200000L, effort_3, 3},
44- {"opencode", "deepseek-v4-flash-vision-exp", "DeepSeek V4 Flash Vision Exp", true, 1000000L, effort_3, 3},
45- {"opencode", "deepseek-v4-pro", "DeepSeek V4 Pro", false, 1000000L, effort_4, 2},
46- {"opencode", "deepseek-v4.1-flash", "DeepSeek V4.1 Flash", true, 1000000L, effort_3, 3},
47- {"opencode", "fledge-alpha-free", "Fledge Alpha Free", true, 1048576L, effort_3, 3},
48- {"opencode", "gemini-3-flash", "Gemini 3 Flash", true, 1048576L, effort_5, 4},
49- {"opencode", "gemini-3-pro", "Gemini 3 Pro", true, 1048576L, effort_6, 2},
50- {"opencode", "gemini-3.1-pro", "Gemini 3.1 Pro Preview", true, 1048576L, effort_1, 3},
51- {"opencode", "gemini-3.5-flash", "Gemini 3.5 Flash", true, 1048576L, effort_5, 4},
52- {"opencode", "gemini-3.5-flash-lite", "Gemini 3.5 Flash Lite", true, 1048576L, effort_5, 4},
53- {"opencode", "gemini-3.6-flash", "Gemini 3.6 Flash", true, 1048576L, effort_5, 4},
54- {"opencode", "gemini-3.7-flash", "Gemini 3.7 Flash", true, 1048576L, effort_1, 3},
55- {"opencode", "gemini-3.8-flash", "Gemini 3.8 Flash", true, 1048576L, effort_1, 3},
56- {"opencode", "glm-4.6", "GLM-4.6", false, 204800L, NULL, 0},
57- {"opencode", "glm-4.7", "GLM-4.7", false, 204800L, NULL, 0},
58- {"opencode", "glm-4.7-free", "GLM-4.7 Free", false, 204800L, NULL, 0},
59- {"opencode", "glm-5", "GLM-5", false, 204800L, NULL, 0},
60- {"opencode", "glm-5-free", "GLM-5 Free", false, 204800L, NULL, 0},
61- {"opencode", "glm-5.1", "GLM-5.1", false, 204800L, NULL, 0},
62- {"opencode", "glm-5.2", "GLM-5.2", false, 1000000L, effort_4, 2},
63- {"opencode", "glm-5.3", "GLM-5.3", false, 1000000L, effort_3, 3},
64- {"opencode", "glm-5.3-flash", "GLM-5.3-Flash", true, 1000000L, effort_3, 3},
65- {"opencode", "gpt-5", "GPT-5", true, 400000L, effort_5, 4},
66- {"opencode", "gpt-5-codex", "GPT-5 Codex", true, 400000L, effort_1, 3},
67- {"opencode", "gpt-5-nano", "GPT-5 Nano", true, 400000L, effort_5, 4},
68- {"opencode", "gpt-5.1", "GPT-5.1", true, 400000L, effort_7, 4},
69- {"opencode", "gpt-5.1-codex", "GPT-5.1 Codex", true, 400000L, effort_1, 3},
70- {"opencode", "gpt-5.1-codex-max", "GPT-5.1 Codex Max", true, 400000L, effort_8, 4},
71- {"opencode", "gpt-5.1-codex-mini", "GPT-5.1 Codex Mini", true, 400000L, effort_1, 3},
72- {"opencode", "gpt-5.2", "GPT-5.2", true, 400000L, effort_9, 5},
73- {"opencode", "gpt-5.2-codex", "GPT-5.2 Codex", true, 400000L, effort_8, 4},
74- {"opencode", "gpt-5.3-codex", "GPT-5.3 Codex", true, 400000L, effort_9, 5},
75- {"opencode", "gpt-5.3-codex-spark", "GPT-5.3 Codex Spark", false, 128000L, effort_8, 4},
76- {"opencode", "gpt-5.4", "GPT-5.4", true, 1050000L, effort_9, 5},
77- {"opencode", "gpt-5.4-mini", "GPT-5.4 Mini", true, 400000L, effort_9, 5},
78- {"opencode", "gpt-5.4-nano", "GPT-5.4 Nano", true, 400000L, effort_9, 5},
79- {"opencode", "gpt-5.4-pro", "GPT-5.4 Pro", true, 1050000L, effort_10, 3},
80- {"opencode", "gpt-5.5", "GPT-5.5", true, 1050000L, effort_9, 5},
81- {"opencode", "gpt-5.5-pro", "GPT-5.5 Pro", true, 1050000L, effort_10, 3},
82- {"opencode", "gpt-5.6-luna", "GPT-5.6 Luna", true, 1050000L, effort_11, 6},
83- {"opencode", "gpt-5.6-sol", "GPT-5.6 Sol", true, 1050000L, effort_11, 6},
84- {"opencode", "gpt-5.6-terra", "GPT-5.6 Terra", true, 1050000L, effort_11, 6},
85- {"opencode", "gpt-6-astra", "GPT-6 Astra", true, 1050000L, effort_0, 5},
86- {"opencode", "gpt-6-luna", "GPT-6 Luna", true, 1050000L, effort_11, 6},
87- {"opencode", "gpt-6-sol", "GPT-6 Sol", true, 1050000L, effort_11, 6},
88- {"opencode", "gpt-6.1-sol", "GPT-6.1 Sol", true, 1050000L, effort_0, 5},
89- {"opencode", "grok-4.5", "Grok 4.5", true, 500000L, effort_1, 3},
90- {"opencode", "grok-4.6", "Grok 4.6", true, 500000L, effort_8, 4},
91- {"opencode", "grok-4.7", "Grok 4.7", true, 500000L, effort_8, 4},
92- {"opencode", "grok-build-0.1", "Grok Build 0.1", true, 256000L, NULL, 0},
93- {"opencode", "grok-code", "Grok Code Fast 1", false, 256000L, NULL, 0},
94- {"opencode", "hy3-free", "Hy3 Free", false, 190000L, effort_1, 3},
95- {"opencode", "hy3-preview-free", "Hy3 preview Free", false, 256000L, NULL, 0},
96- {"opencode", "kimi-k2", "Kimi K2", false, 262144L, NULL, 0},
97- {"opencode", "kimi-k2-thinking", "Kimi K2 Thinking", false, 262144L, NULL, 0},
98- {"opencode", "kimi-k2.5", "Kimi K2.5", true, 262144L, NULL, 0},
99- {"opencode", "kimi-k2.5-free", "Kimi K2.5 Free", true, 262144L, NULL, 0},
100- {"opencode", "kimi-k2.6", "Kimi K2.6", true, 262144L, NULL, 0},
101- {"opencode", "kimi-k2.7-code", "Kimi K2.7 Code", true, 262144L, NULL, 0},
102- {"opencode", "kimi-k3", "Kimi K3", true, 1048576L, effort_12, 1},
103- {"opencode", "laguna-s-2.1-free", "Laguna S 2.1 Free", false, 256000L, effort_1, 3},
104- {"opencode", "ling-2.6-flash-free", "Ling 2.6 Flash Free", false, 262100L, NULL, 0},
105- {"opencode", "ling-3.0-flash-fin-free", "Ling 3.0 Flash Fin Free", false, 262144L, NULL, 0},
106- {"opencode", "ling-3.0-flash-free", "Ling-3.0-flash Free", false, 262144L, effort_1, 3},
107- {"opencode", "ling-3.0-tiny-free", "Ling-3.0-tiny Free", false, 262144L, NULL, 0},
108- {"opencode", "ling-3.1-flash-free", "Ling 3.1 Flash Free", false, 262144L, NULL, 0},
109- {"opencode", "longcat-2.0-free", "LongCat-2.0 Free", false, 1000000L, NULL, 0},
110- {"opencode", "longcat-2.5-preview-free", "LongCat 2.5 Preview Free", true, 1000000L, NULL, 0},
111- {"opencode", "mimo-v2-flash-free", "MiMo V2 Flash Free", false, 262144L, NULL, 0},
112- {"opencode", "mimo-v2-omni-free", "MiMo V2 Omni Free", true, 262144L, NULL, 0},
113- {"opencode", "mimo-v2-pro-free", "MiMo V2 Pro Free", true, 1048576L, NULL, 0},
114- {"opencode", "mimo-v2.5-free", "MiMo V2.5 Free", true, 200000L, NULL, 0},
115- {"opencode", "mimo-v2.6-flash-free", "MiMo-V2.6-Flash Free", true, 200000L, NULL, 0},
116- {"opencode", "minimax-m2.1", "MiniMax-M2.1", false, 204800L, NULL, 0},
117- {"opencode", "minimax-m2.1-free", "MiniMax-M2.1 Free", false, 204800L, NULL, 0},
118- {"opencode", "minimax-m2.5", "MiniMax-M2.5", false, 204800L, NULL, 0},
119- {"opencode", "minimax-m2.5-free", "MiniMax-M2.5 Free", false, 204800L, NULL, 0},
120- {"opencode", "minimax-m2.7", "MiniMax-M2.7", false, 204800L, NULL, 0},
121- {"opencode", "minimax-m3", "MiniMax-M3", true, 512000L, NULL, 0},
122- {"opencode", "minimax-m3-free", "MiniMax-M3 Free", false, 200000L, NULL, 0},
123- {"opencode", "muse-spark-1.2", "Muse Spark 1.2", true, 1048576L, effort_13, 5},
124- {"opencode", "muse-spark-1.2-contributor-free", "Muse Spark 1.2 Free", true, 1048576L, effort_13, 5},
125- {"opencode", "muse-spark-1.3", "Muse Spark 1.3", true, 1048576L, effort_13, 5},
126- {"opencode", "muse-spark-1.3-contributor-free", "Muse Spark 1.3 Free", true, 1048576L, effort_13, 5},
127- {"opencode", "nemotron-3-super-free", "Nemotron 3 Super Free", false, 204800L, NULL, 0},
128- {"opencode", "nemotron-3-ultra-free", "Nemotron 3 Ultra Free", false, 1000000L, NULL, 0},
129- {"opencode", "nemotron-3.5-lightning-free", "Nemotron 3.5 Lightning Free", false, 262144L, NULL, 0},
130- {"opencode", "north-mini-code-free", "North Mini Code Free", false, 256000L, effort_14, 2},
131- {"opencode", "qwen3-coder", "Qwen3 Coder", false, 262144L, NULL, 0},
132- {"opencode", "qwen3.5-plus", "Qwen3.5 Plus", true, 262144L, NULL, 0},
133- {"opencode", "qwen3.6-plus", "Qwen3.6 Plus", true, 262144L, NULL, 0},
134- {"opencode", "qwen3.6-plus-free", "Qwen3.6 Plus Free", true, 262144L, NULL, 0},
135- {"opencode", "qwen3.8-flash", "Qwen3.8 Flash", true, 1000000L, effort_15, 3},
136- {"opencode", "qwen3.8-max", "Qwen3.8 Max", true, 262144L, NULL, 0},
137- {"opencode", "ring-2.6-1t-free", "Ring 2.6 1T Free", false, 262000L, NULL, 0},
138- {"opencode", "space-bunny-free", "Space Bunny Free", true, 1048576L, effort_0, 5},
139- {"opencode", "trinity-large-preview-free", "Trinity Large Preview", false, 131072L, NULL, 0},
140- {"opencode", "x-preview-f-free", "Ox Alpha Free (Unlimited)", true, 1000000L, effort_3, 3},
141- {"opencode-go", "deepseek-v4-flash", "DeepSeek V4 Flash", false, 1000000L, effort_3, 3},
142- {"opencode-go", "deepseek-v4-flash-vision-exp", "DeepSeek V4 Flash Vision Exp", true, 1000000L, effort_3, 3},
143- {"opencode-go", "deepseek-v4-pro", "DeepSeek V4 Pro (New)", false, 1000000L, effort_4, 2},
144- {"opencode-go", "deepseek-v4.1-flash", "DeepSeek V4.1 Flash", true, 1000000L, effort_3, 3},
145- {"opencode-go", "glm-5.2", "GLM-5.2", false, 1000000L, effort_4, 2},
146- {"opencode-go", "glm-5.3", "GLM-5.3", false, 1000000L, effort_3, 3},
147- {"opencode-go", "glm-5.3-flash", "GLM-5.3-Flash", true, 1000000L, effort_3, 3},
148- {"opencode-go", "gpt-5.6-luna", "GPT-5.6 Luna", true, 1050000L, effort_11, 6},
149- {"opencode-go", "gpt-6-luna", "GPT-6 Luna", true, 1050000L, effort_11, 6},
150- {"opencode-go", "grok-4.5", "Grok 4.5", true, 500000L, effort_1, 3},
151- {"opencode-go", "grok-4.6", "Grok 4.6", true, 500000L, effort_8, 4},
152- {"opencode-go", "grok-4.7", "Grok 4.7", true, 500000L, effort_8, 4},
153- {"opencode-go", "hy3", "Hy3", false, 256000L, effort_16, 3},
154- {"opencode-go", "hy4-preview", "Hy4 preview", false, 1024000L, effort_14, 2},
155- {"opencode-go", "kimi-k2.6", "Kimi K2.6", true, 262144L, NULL, 0},
156- {"opencode-go", "kimi-k2.7-code", "Kimi K2.7 Code", true, 262144L, NULL, 0},
157- {"opencode-go", "kimi-k3", "Kimi K3", true, 1048576L, effort_12, 1},
158- {"opencode-go", "longcat-2.0", "LongCat-2.0", false, 1000000L, NULL, 0},
159- {"opencode-go", "longcat-2.5-preview-free", "LongCat 2.5 Preview Free", true, 1000000L, NULL, 0},
160- {"opencode-go", "mimo-v2.5", "MiMo V2.5", true, 1000000L, NULL, 0},
161- {"opencode-go", "mimo-v2.5-pro", "MiMo V2.5 Pro", true, 1048576L, NULL, 0},
162- {"opencode-go", "mimo-v2.6-flash", "MiMo-V2.6-Flash", true, 1048576L, NULL, 0},
163- {"opencode-go", "mimo-v2.6-pro", "MiMo-V2.6-Pro", true, 1048576L, NULL, 0},
164- {"opencode-go", "minimax-m2.7", "MiniMax-M2.7", false, 204800L, NULL, 0},
165- {"opencode-go", "minimax-m3", "MiniMax-M3", false, 1000000L, NULL, 0},
166- {"opencode-go", "muse-spark-1.2-contributor", "Muse Spark 1.2 Contributor", true, 1048576L, effort_13, 5},
167- {"opencode-go", "muse-spark-1.3-contributor", "Muse Spark 1.3 Contributor", true, 1048576L, effort_13, 5},
168- {"opencode-go", "qwen3.6-plus", "Qwen3.6 Plus", true, 1000000L, NULL, 0},
169- {"opencode-go", "qwen3.7-max", "Qwen3.7 Max", false, 1000000L, NULL, 0},
170- {"opencode-go", "qwen3.7-plus", "Qwen3.7 Plus", true, 1000000L, NULL, 0},
171- {"opencode-go", "qwen3.8-flash", "Qwen3.8 Flash", true, 1000000L, effort_15, 3},
172- {"opencode-go", "qwen3.8-max", "Qwen3.8 Max", true, 1000000L, effort_15, 3},
173- {"opencode-go", "space-bunny-free", "Space Bunny Free", true, 1048576L, effort_0, 5},
25+ {"opencode", "big-pickle", "Big Pickle", false, 200000L, 32000L, NULL, 0},
26+ {"opencode", "claude-3-5-haiku", "Claude Haiku 3.5", true, 200000L, 8192L, NULL, 0},
27+ {"opencode", "claude-fable-5", "Claude Fable 5", true, 1000000L, 128000L, effort_0, 5},
28+ {"opencode", "claude-fable-5-1", "Claude Fable 5.1", true, 1000000L, 128000L, effort_0, 5},
29+ {"opencode", "claude-haiku-4-5", "Claude Haiku 4.5", true, 200000L, 64000L, NULL, 0},
30+ {"opencode", "claude-opus-4-1", "Claude Opus 4.1", true, 200000L, 32000L, NULL, 0},
31+ {"opencode", "claude-opus-4-5", "Claude Opus 4.5", true, 200000L, 64000L, effort_1, 3},
32+ {"opencode", "claude-opus-4-6", "Claude Opus 4.6", true, 1000000L, 128000L, effort_2, 4},
33+ {"opencode", "claude-opus-4-7", "Claude Opus 4.7", true, 1000000L, 128000L, effort_0, 5},
34+ {"opencode", "claude-opus-4-8", "Claude Opus 4.8", true, 1000000L, 128000L, effort_0, 5},
35+ {"opencode", "claude-opus-5", "Claude Opus 5", true, 1000000L, 128000L, effort_0, 5},
36+ {"opencode", "claude-opus-5-5", "Claude Opus 5.5", true, 1000000L, 128000L, effort_0, 5},
37+ {"opencode", "claude-sonnet-4", "Claude Sonnet 4", true, 1000000L, 64000L, NULL, 0},
38+ {"opencode", "claude-sonnet-4-5", "Claude Sonnet 4.5", true, 1000000L, 64000L, NULL, 0},
39+ {"opencode", "claude-sonnet-4-6", "Claude Sonnet 4.6", true, 1000000L, 64000L, effort_2, 4},
40+ {"opencode", "claude-sonnet-5", "Claude Sonnet 5", true, 1000000L, 128000L, effort_0, 5},
41+ {"opencode", "claude-sonnet-5-5", "Claude Sonnet 5.5", true, 1000000L, 128000L, effort_0, 5},
42+ {"opencode", "deepseek-v4-flash", "DeepSeek V4 Flash", false, 1000000L, 384000L, effort_3, 3},
43+ {"opencode", "deepseek-v4-flash-free", "DeepSeek V4 Flash Free", false, 200000L, 128000L, effort_3, 3},
44+ {"opencode", "deepseek-v4-flash-vision-exp", "DeepSeek V4 Flash Vision Exp", true, 1000000L, 384000L, effort_3, 3},
45+ {"opencode", "deepseek-v4-pro", "DeepSeek V4 Pro", false, 1000000L, 384000L, effort_4, 2},
46+ {"opencode", "deepseek-v4.1-flash", "DeepSeek V4.1 Flash", true, 1000000L, 384000L, effort_3, 3},
47+ {"opencode", "fledge-alpha-free", "Fledge Alpha Free", true, 1048576L, 131072L, effort_3, 3},
48+ {"opencode", "gemini-3-flash", "Gemini 3 Flash", true, 1048576L, 65536L, effort_5, 4},
49+ {"opencode", "gemini-3-pro", "Gemini 3 Pro", true, 1048576L, 65536L, effort_6, 2},
50+ {"opencode", "gemini-3.1-pro", "Gemini 3.1 Pro Preview", true, 1048576L, 65536L, effort_1, 3},
51+ {"opencode", "gemini-3.5-flash", "Gemini 3.5 Flash", true, 1048576L, 65536L, effort_5, 4},
52+ {"opencode", "gemini-3.5-flash-lite", "Gemini 3.5 Flash Lite", true, 1048576L, 65536L, effort_5, 4},
53+ {"opencode", "gemini-3.6-flash", "Gemini 3.6 Flash", true, 1048576L, 65536L, effort_5, 4},
54+ {"opencode", "gemini-3.7-flash", "Gemini 3.7 Flash", true, 1048576L, 65536L, effort_1, 3},
55+ {"opencode", "gemini-3.8-flash", "Gemini 3.8 Flash", true, 1048576L, 65536L, effort_1, 3},
56+ {"opencode", "glm-4.6", "GLM-4.6", false, 204800L, 131072L, NULL, 0},
57+ {"opencode", "glm-4.7", "GLM-4.7", false, 204800L, 131072L, NULL, 0},
58+ {"opencode", "glm-4.7-free", "GLM-4.7 Free", false, 204800L, 131072L, NULL, 0},
59+ {"opencode", "glm-5", "GLM-5", false, 204800L, 131072L, NULL, 0},
60+ {"opencode", "glm-5-free", "GLM-5 Free", false, 204800L, 131072L, NULL, 0},
61+ {"opencode", "glm-5.1", "GLM-5.1", false, 204800L, 131072L, NULL, 0},
62+ {"opencode", "glm-5.2", "GLM-5.2", false, 1000000L, 131072L, effort_4, 2},
63+ {"opencode", "glm-5.3", "GLM-5.3", false, 1000000L, 131072L, effort_3, 3},
64+ {"opencode", "glm-5.3-flash", "GLM-5.3-Flash", true, 1000000L, 131072L, effort_3, 3},
65+ {"opencode", "gpt-5", "GPT-5", true, 400000L, 128000L, effort_5, 4},
66+ {"opencode", "gpt-5-codex", "GPT-5 Codex", true, 400000L, 128000L, effort_1, 3},
67+ {"opencode", "gpt-5-nano", "GPT-5 Nano", true, 400000L, 128000L, effort_5, 4},
68+ {"opencode", "gpt-5.1", "GPT-5.1", true, 400000L, 128000L, effort_7, 4},
69+ {"opencode", "gpt-5.1-codex", "GPT-5.1 Codex", true, 400000L, 128000L, effort_1, 3},
70+ {"opencode", "gpt-5.1-codex-max", "GPT-5.1 Codex Max", true, 400000L, 128000L, effort_8, 4},
71+ {"opencode", "gpt-5.1-codex-mini", "GPT-5.1 Codex Mini", true, 400000L, 128000L, effort_1, 3},
72+ {"opencode", "gpt-5.2", "GPT-5.2", true, 400000L, 128000L, effort_9, 5},
73+ {"opencode", "gpt-5.2-codex", "GPT-5.2 Codex", true, 400000L, 128000L, effort_8, 4},
74+ {"opencode", "gpt-5.3-codex", "GPT-5.3 Codex", true, 400000L, 128000L, effort_9, 5},
75+ {"opencode", "gpt-5.3-codex-spark", "GPT-5.3 Codex Spark", false, 128000L, 128000L, effort_8, 4},
76+ {"opencode", "gpt-5.4", "GPT-5.4", true, 1050000L, 128000L, effort_9, 5},
77+ {"opencode", "gpt-5.4-mini", "GPT-5.4 Mini", true, 400000L, 128000L, effort_9, 5},
78+ {"opencode", "gpt-5.4-nano", "GPT-5.4 Nano", true, 400000L, 128000L, effort_9, 5},
79+ {"opencode", "gpt-5.4-pro", "GPT-5.4 Pro", true, 1050000L, 128000L, effort_10, 3},
80+ {"opencode", "gpt-5.5", "GPT-5.5", true, 1050000L, 128000L, effort_9, 5},
81+ {"opencode", "gpt-5.5-pro", "GPT-5.5 Pro", true, 1050000L, 128000L, effort_10, 3},
82+ {"opencode", "gpt-5.6-luna", "GPT-5.6 Luna", true, 1050000L, 128000L, effort_11, 6},
83+ {"opencode", "gpt-5.6-sol", "GPT-5.6 Sol", true, 1050000L, 128000L, effort_11, 6},
84+ {"opencode", "gpt-5.6-terra", "GPT-5.6 Terra", true, 1050000L, 128000L, effort_11, 6},
85+ {"opencode", "gpt-6-astra", "GPT-6 Astra", true, 1050000L, 128000L, effort_0, 5},
86+ {"opencode", "gpt-6-luna", "GPT-6 Luna", true, 1050000L, 128000L, effort_11, 6},
87+ {"opencode", "gpt-6-sol", "GPT-6 Sol", true, 1050000L, 128000L, effort_11, 6},
88+ {"opencode", "gpt-6.1-sol", "GPT-6.1 Sol", true, 1050000L, 128000L, effort_0, 5},
89+ {"opencode", "grok-4.5", "Grok 4.5", true, 500000L, 500000L, effort_1, 3},
90+ {"opencode", "grok-4.6", "Grok 4.6", true, 500000L, 500000L, effort_8, 4},
91+ {"opencode", "grok-4.7", "Grok 4.7", true, 500000L, 500000L, effort_8, 4},
92+ {"opencode", "grok-build-0.1", "Grok Build 0.1", true, 256000L, 256000L, NULL, 0},
93+ {"opencode", "grok-code", "Grok Code Fast 1", false, 256000L, 256000L, NULL, 0},
94+ {"opencode", "hy3-free", "Hy3 Free", false, 190000L, 64000L, effort_1, 3},
95+ {"opencode", "hy3-preview-free", "Hy3 preview Free", false, 256000L, 64000L, NULL, 0},
96+ {"opencode", "kimi-k2", "Kimi K2", false, 262144L, 262144L, NULL, 0},
97+ {"opencode", "kimi-k2-thinking", "Kimi K2 Thinking", false, 262144L, 262144L, NULL, 0},
98+ {"opencode", "kimi-k2.5", "Kimi K2.5", true, 262144L, 65536L, NULL, 0},
99+ {"opencode", "kimi-k2.5-free", "Kimi K2.5 Free", true, 262144L, 262144L, NULL, 0},
100+ {"opencode", "kimi-k2.6", "Kimi K2.6", true, 262144L, 65536L, NULL, 0},
101+ {"opencode", "kimi-k2.7-code", "Kimi K2.7 Code", true, 262144L, 262144L, NULL, 0},
102+ {"opencode", "kimi-k3", "Kimi K3", true, 1048576L, 131072L, effort_12, 1},
103+ {"opencode", "laguna-s-2.1-free", "Laguna S 2.1 Free", false, 256000L, 32000L, effort_1, 3},
104+ {"opencode", "ling-2.6-flash-free", "Ling 2.6 Flash Free", false, 262100L, 32800L, NULL, 0},
105+ {"opencode", "ling-3.0-flash-fin-free", "Ling 3.0 Flash Fin Free", false, 262144L, 32768L, NULL, 0},
106+ {"opencode", "ling-3.0-flash-free", "Ling-3.0-flash Free", false, 262144L, 32768L, effort_1, 3},
107+ {"opencode", "ling-3.0-tiny-free", "Ling-3.0-tiny Free", false, 262144L, 32768L, NULL, 0},
108+ {"opencode", "ling-3.1-flash-free", "Ling 3.1 Flash Free", false, 262144L, 32768L, NULL, 0},
109+ {"opencode", "longcat-2.0-free", "LongCat-2.0 Free", false, 1000000L, 131072L, NULL, 0},
110+ {"opencode", "longcat-2.5-preview-free", "LongCat 2.5 Preview Free", true, 1000000L, 131072L, NULL, 0},
111+ {"opencode", "mimo-v2-flash-free", "MiMo V2 Flash Free", false, 262144L, 65536L, NULL, 0},
112+ {"opencode", "mimo-v2-omni-free", "MiMo V2 Omni Free", true, 262144L, 64000L, NULL, 0},
113+ {"opencode", "mimo-v2-pro-free", "MiMo V2 Pro Free", true, 1048576L, 64000L, NULL, 0},
114+ {"opencode", "mimo-v2.5-free", "MiMo V2.5 Free", true, 200000L, 32000L, NULL, 0},
115+ {"opencode", "mimo-v2.6-flash-free", "MiMo-V2.6-Flash Free", true, 200000L, 32000L, NULL, 0},
116+ {"opencode", "minimax-m2.1", "MiniMax-M2.1", false, 204800L, 131072L, NULL, 0},
117+ {"opencode", "minimax-m2.1-free", "MiniMax-M2.1 Free", false, 204800L, 131072L, NULL, 0},
118+ {"opencode", "minimax-m2.5", "MiniMax-M2.5", false, 204800L, 131072L, NULL, 0},
119+ {"opencode", "minimax-m2.5-free", "MiniMax-M2.5 Free", false, 204800L, 131072L, NULL, 0},
120+ {"opencode", "minimax-m2.7", "MiniMax-M2.7", false, 204800L, 131072L, NULL, 0},
121+ {"opencode", "minimax-m3", "MiniMax-M3", true, 512000L, 128000L, NULL, 0},
122+ {"opencode", "minimax-m3-free", "MiniMax-M3 Free", false, 200000L, 32000L, NULL, 0},
123+ {"opencode", "muse-spark-1.2", "Muse Spark 1.2", true, 1048576L, 131072L, effort_13, 5},
124+ {"opencode", "muse-spark-1.2-contributor-free", "Muse Spark 1.2 Free", true, 1048576L, 131072L, effort_13, 5},
125+ {"opencode", "muse-spark-1.3", "Muse Spark 1.3", true, 1048576L, 131072L, effort_13, 5},
126+ {"opencode", "muse-spark-1.3-contributor-free", "Muse Spark 1.3 Free", true, 1048576L, 131072L, effort_13, 5},
127+ {"opencode", "nemotron-3-super-free", "Nemotron 3 Super Free", false, 204800L, 128000L, NULL, 0},
128+ {"opencode", "nemotron-3-ultra-free", "Nemotron 3 Ultra Free", false, 1000000L, 128000L, NULL, 0},
129+ {"opencode", "nemotron-3.5-lightning-free", "Nemotron 3.5 Lightning Free", false, 262144L, 262144L, NULL, 0},
130+ {"opencode", "north-mini-code-free", "North Mini Code Free", false, 256000L, 64000L, effort_14, 2},
131+ {"opencode", "qwen3-coder", "Qwen3 Coder", false, 262144L, 65536L, NULL, 0},
132+ {"opencode", "qwen3.5-plus", "Qwen3.5 Plus", true, 262144L, 65536L, NULL, 0},
133+ {"opencode", "qwen3.6-plus", "Qwen3.6 Plus", true, 262144L, 65536L, NULL, 0},
134+ {"opencode", "qwen3.6-plus-free", "Qwen3.6 Plus Free", true, 262144L, 65536L, NULL, 0},
135+ {"opencode", "qwen3.8-flash", "Qwen3.8 Flash", true, 1000000L, 131072L, effort_15, 3},
136+ {"opencode", "qwen3.8-max", "Qwen3.8 Max", true, 262144L, 131072L, NULL, 0},
137+ {"opencode", "ring-2.6-1t-free", "Ring 2.6 1T Free", false, 262000L, 66000L, NULL, 0},
138+ {"opencode", "space-bunny-free", "Space Bunny Free", true, 1048576L, 524288L, effort_0, 5},
139+ {"opencode", "trinity-large-preview-free", "Trinity Large Preview", false, 131072L, 131072L, NULL, 0},
140+ {"opencode", "x-preview-f-free", "Ox Alpha Free (Unlimited)", true, 1000000L, 131072L, effort_3, 3},
141+ {"opencode-go", "deepseek-v4-flash", "DeepSeek V4 Flash", false, 1000000L, 384000L, effort_3, 3},
142+ {"opencode-go", "deepseek-v4-flash-vision-exp", "DeepSeek V4 Flash Vision Exp", true, 1000000L, 384000L, effort_3, 3},
143+ {"opencode-go", "deepseek-v4-pro", "DeepSeek V4 Pro (New)", false, 1000000L, 384000L, effort_4, 2},
144+ {"opencode-go", "deepseek-v4.1-flash", "DeepSeek V4.1 Flash", true, 1000000L, 384000L, effort_3, 3},
145+ {"opencode-go", "glm-5.2", "GLM-5.2", false, 1000000L, 131072L, effort_4, 2},
146+ {"opencode-go", "glm-5.3", "GLM-5.3", false, 1000000L, 131072L, effort_3, 3},
147+ {"opencode-go", "glm-5.3-flash", "GLM-5.3-Flash", true, 1000000L, 131072L, effort_3, 3},
148+ {"opencode-go", "gpt-5.6-luna", "GPT-5.6 Luna", true, 1050000L, 128000L, effort_11, 6},
149+ {"opencode-go", "gpt-6-luna", "GPT-6 Luna", true, 1050000L, 128000L, effort_11, 6},
150+ {"opencode-go", "grok-4.5", "Grok 4.5", true, 500000L, 500000L, effort_1, 3},
151+ {"opencode-go", "grok-4.6", "Grok 4.6", true, 500000L, 500000L, effort_8, 4},
152+ {"opencode-go", "grok-4.7", "Grok 4.7", true, 500000L, 500000L, effort_8, 4},
153+ {"opencode-go", "hy3", "Hy3", false, 256000L, 128000L, effort_16, 3},
154+ {"opencode-go", "hy4-preview", "Hy4 preview", false, 1024000L, 64000L, effort_14, 2},
155+ {"opencode-go", "kimi-k2.6", "Kimi K2.6", true, 262144L, 65536L, NULL, 0},
156+ {"opencode-go", "kimi-k2.7-code", "Kimi K2.7 Code", true, 262144L, 262144L, NULL, 0},
157+ {"opencode-go", "kimi-k3", "Kimi K3", true, 1048576L, 131072L, effort_12, 1},
158+ {"opencode-go", "longcat-2.0", "LongCat-2.0", false, 1000000L, 131072L, NULL, 0},
159+ {"opencode-go", "longcat-2.5-preview-free", "LongCat 2.5 Preview Free", true, 1000000L, 131072L, NULL, 0},
160+ {"opencode-go", "mimo-v2.5", "MiMo V2.5", true, 1000000L, 128000L, NULL, 0},
161+ {"opencode-go", "mimo-v2.5-pro", "MiMo V2.5 Pro", true, 1048576L, 128000L, NULL, 0},
162+ {"opencode-go", "mimo-v2.6-flash", "MiMo-V2.6-Flash", true, 1048576L, 131072L, NULL, 0},
163+ {"opencode-go", "mimo-v2.6-pro", "MiMo-V2.6-Pro", true, 1048576L, 131072L, NULL, 0},
164+ {"opencode-go", "minimax-m2.7", "MiniMax-M2.7", false, 204800L, 131072L, NULL, 0},
165+ {"opencode-go", "minimax-m3", "MiniMax-M3", false, 1000000L, 131072L, NULL, 0},
166+ {"opencode-go", "muse-spark-1.2-contributor", "Muse Spark 1.2 Contributor", true, 1048576L, 131072L, effort_13, 5},
167+ {"opencode-go", "muse-spark-1.3-contributor", "Muse Spark 1.3 Contributor", true, 1048576L, 131072L, effort_13, 5},
168+ {"opencode-go", "qwen3.6-plus", "Qwen3.6 Plus", true, 1000000L, 65536L, NULL, 0},
169+ {"opencode-go", "qwen3.7-max", "Qwen3.7 Max", false, 1000000L, 65536L, NULL, 0},
170+ {"opencode-go", "qwen3.7-plus", "Qwen3.7 Plus", true, 1000000L, 65536L, NULL, 0},
171+ {"opencode-go", "qwen3.8-flash", "Qwen3.8 Flash", true, 1000000L, 131072L, effort_15, 3},
172+ {"opencode-go", "qwen3.8-max", "Qwen3.8 Max", true, 1000000L, 131072L, effort_15, 3},
173+ {"opencode-go", "space-bunny-free", "Space Bunny Free", true, 1048576L, 524288L, effort_0, 5},
174174 };
175175
176176 const size_t tiny_catalog_entries_len =
src/catalog.h+1−0
@@ -15,6 +15,7 @@ typedef struct {
1515 const char *name; // human-readable name
1616 bool supports_images; // whether the model accepts image input
1717 long context_limit; // context window in tokens, 0 when unknown
18+ long max_output; // maximum reply tokens, 0 when unknown
1819 const char *const *effort; // accepted reasoning_effort values; NULL when the
1920 size_t effort_len; // model exposes no effort option
2021 } tiny_model_info;
src/diff.c+5−5
@@ -435,8 +435,8 @@ static void add_range(char *dst, size_t cap, size_t start, size_t count) {
435435 else snprintf(dst, cap, "%zu,%zu", start, count);
436436 }
437437
438-static char *unified(const char *path, const char *a, size_t alen,
439- const char *b, size_t blen) {
438+char *tiny_unified_diff(const char *path, const char *a, size_t alen,
439+ const char *b, size_t blen) {
440440 size_t na, nb;
441441 line *la = split_lines(a, alen, &na);
442442 line *lb = split_lines(b, blen, &nb);
@@ -532,7 +532,7 @@ static bool diff_one(const char *path, const file_state *before,
532532 } else if (after->content == NULL) {
533533 out->note = note_text(after->kind, "created");
534534 } else {
535- out->patch = unified(path, "", 0, after->content, after->size);
535+ out->patch = tiny_unified_diff(path, "", 0, after->content, after->size);
536536 }
537537 return true;
538538 }
@@ -542,7 +542,7 @@ static bool diff_one(const char *path, const file_state *before,
542542 } else if (before->content == NULL) {
543543 out->note = note_text(before->kind, "deleted");
544544 } else {
545- out->patch = unified(path, before->content, before->size, "", 0);
545+ out->patch = tiny_unified_diff(path, before->content, before->size, "", 0);
546546 }
547547 return true;
548548 }
@@ -557,7 +557,7 @@ static bool diff_one(const char *path, const file_state *before,
557557 if (before->content != NULL && after->content != NULL) {
558558 if (before->size == after->size && memcmp(before->content, after->content, before->size) == 0)
559559 return false;
560- out->patch = unified(path, before->content, before->size, after->content, after->size);
560+ out->patch = tiny_unified_diff(path, before->content, before->size, after->content, after->size);
561561 return true;
562562 }
563563 if (before->size == after->size && before->ino == after->ino &&
src/diff.h+6−0
@@ -28,4 +28,10 @@ tiny_file_diff *tiny_snapshot_diff(const struct tiny_snapshot *before,
2828 const struct tiny_snapshot *after, size_t *len);
2929 void tiny_file_diffs_free(tiny_file_diff *diffs, size_t len);
3030
31+// A unified diff of two in-memory texts, with the same header a working-tree
32+// patch carries. `a`/`b` may be NULL when their length is 0. The caller owns
33+// the result.
34+char *tiny_unified_diff(const char *path, const char *a, size_t alen,
35+ const char *b, size_t blen);
36+
3137 #endif
src/event.h+2−0
@@ -25,6 +25,7 @@ typedef enum {
2525 TINY_EVENT_PHASE,
2626 TINY_EVENT_TEXT, // assistant text delta
2727 TINY_EVENT_REASONING, // reasoning delta
28+ TINY_EVENT_TOOL_CALL_START, // the model began the tool call; name is known
2829 TINY_EVENT_TOOL_CALL, // the model requested the tool; arguments is JSON
2930 TINY_EVENT_TOOL_OUTPUT, // stdout/stdout-like chunk from the tool
3031 TINY_EVENT_TOOL_RESULT, // the tool finished
@@ -41,6 +42,7 @@ typedef struct {
4142 struct { tiny_phase phase; const char *detail; } phase;
4243 struct { const char *delta; } text;
4344 struct { const char *delta; } reasoning;
45+ struct { const char *name; } tool_call_start;
4446 struct { const char *name; const char *arguments; } tool_call;
4547 struct { const char *chunk; } tool_output;
4648 struct {
src/headless.c+1−0
@@ -71,6 +71,7 @@ void tiny_headless_event(const tiny_event *e, void *user) {
7171 break;
7272 case TINY_EVENT_MESSAGE:
7373 case TINY_EVENT_REASONING:
74+ case TINY_EVENT_TOOL_CALL_START:
7475 case TINY_EVENT_COMPLETE:
7576 break;
7677 }
src/provider.c+10−0
@@ -26,6 +26,16 @@ void tiny_emit_delta(tiny_stream_fn emit, void *user, tiny_stream_type type, con
2626 emit(&ev, user);
2727 }
2828
29+void tiny_emit_tool_start(tiny_stream_fn emit, void *user, const char *id, const char *name) {
30+ if (!emit) return;
31+ tiny_stream_event ev = {
32+ .type = TINY_STREAM_TOOL_CALL_START,
33+ .tool_call_id = id,
34+ .tool_name = name,
35+ };
36+ emit(&ev, user);
37+}
38+
2939 void tiny_add_text_block(tiny_message *out, tiny_block_type type, const char *text) {
3040 if (!text || !text[0]) return;
3141 tiny_block *b = tiny_message_add_block(out, type);
src/provider.h+5−1
@@ -25,6 +25,9 @@ typedef struct {
2525 // Whether the model accepts image input. Gates whether `read` attaches
2626 // images. The generated catalog will set this per model.
2727 bool supports_images;
28+ // The largest reply the model accepts, from the catalog. 0 when unknown.
29+ // The context readout uses it to tell when the next request could not fit.
30+ long max_tokens;
2831 // Providers that route by conversation send this header with the session
2932 // id. NULL when the provider does not need one.
3033 const char *session_header;
@@ -53,7 +56,8 @@ typedef struct {
5356 typedef enum {
5457 TINY_STREAM_TEXT_DELTA,
5558 TINY_STREAM_REASONING_DELTA,
56- TINY_STREAM_TOOL_CALL,
59+ TINY_STREAM_TOOL_CALL_START, // a tool call block began; name is known
60+ TINY_STREAM_TOOL_CALL, // a tool call block finished
5761 } tiny_stream_type;
5862
5963 typedef struct {
src/queries.generated.c+29−0
@@ -0,0 +1,29 @@
1+// Generated by tools/gen_queries.py from vendor/queries. Do not edit.
2+// Refresh with `make queries`.
3+
4+#include "queries.h"
5+
6+static const tiny_query tiny_queries[] = {
7+ {"bash",
8+ "[\n (string)\n (raw_string)\n (heredoc_body)\n (heredoc_start)\n] @string\n\n(command_name) @function\n\n(variable_name) @property\n\n[\n \"case\"\n \"do\"\n \"done\"\n \"elif\"\n \"else\"\n \"esac\"\n \"export\"\n \"fi\"\n \"for\"\n \"function\"\n \"if\"\n \"in\"\n \"select\"\n \"then\"\n \"unset\"\n \"until\"\n \"while\"\n] @keyword\n\n(comment) @comment\n\n(function_definition name: (word) @function)\n\n(file_descriptor) @number\n\n[\n (command_substitution)\n (pr …
9+ {"c",
10+ "(identifier) @variable\n\n((identifier) @constant\n (#match\? @constant \"^[A-Z][A-Z\\\\d_]*$\"))\n\n\"break\" @keyword\n\"case\" @keyword\n\"const\" @keyword\n\"continue\" @keyword\n\"default\" @keyword\n\"do\" @keyword\n\"else\" @keyword\n\"enum\" @keyword\n\"extern\" @keyword\n\"for\" @keyword\n\"if\" @keyword\n\"inline\" @keyword\n\"return\" @keyword\n\"sizeof\" @keyword\n\"static\" @keyword\n\"struct\" @keyword\n\"switch\" @keyword\n\"typedef\" @keyword\n\"union\" @keyword\n\"volatile …
11+ {"javascript",
12+ "; Variables\n;----------\n\n(identifier) @variable\n\n; Properties\n;-----------\n\n(property_identifier) @property\n\n; Function and method definitions\n;--------------------------------\n\n(function_expression\n name: (identifier) @function)\n(function_declaration\n name: (identifier) @function)\n(method_definition\n name: (property_identifier) @function.method)\n\n(pair\n key: (property_identifier) @function.method\n value: [(function_expression) (arrow_function)])\n\n(assignment_e …
13+ {"make",
14+ "(comment) @comment @spell\n\n(conditional\n (_\n [\n \"ifeq\"\n \"else\"\n \"ifneq\"\n \"ifdef\"\n \"ifndef\"\n ] @keyword.conditional)\n \"endif\" @keyword.conditional)\n\n(rule\n (targets\n (word) @function))\n\n(rule\n (targets) @_target\n (prerequisites\n (word) @function\n (#eq\? @_target \".PHONY\")))\n\n(rule\n (targets\n (word) @function.builtin\n (#any-of\? @function.builtin\n \".DEFAULT\" \".SUFFIXES\" \".DELETE_ON_ERROR\" …
15+ {"markdown",
16+ ";From nvim-treesitter/nvim-treesitter\n(atx_heading\n (inline) @text.title)\n\n(setext_heading\n (paragraph) @text.title)\n\n[\n (atx_h1_marker)\n (atx_h2_marker)\n (atx_h3_marker)\n (atx_h4_marker)\n (atx_h5_marker)\n (atx_h6_marker)\n (setext_h1_underline)\n (setext_h2_underline)\n] @punctuation.special\n\n[\n (link_title)\n (indented_code_block)\n (fenced_code_block)\n] @text.literal\n\n(fenced_code_block_delimiter) @punctuation.delimiter\n\n(code_fence_content) @none\n\n(l …
17+ {"markdown_inline",
18+ "; From nvim-treesitter/nvim-treesitter\n[\n (code_span)\n (link_title)\n] @text.literal\n\n[\n (emphasis_delimiter)\n (code_span_delimiter)\n] @punctuation.delimiter\n\n(emphasis) @text.emphasis\n\n(strong_emphasis) @text.strong\n\n[\n (link_destination)\n (uri_autolink)\n] @text.uri\n\n[\n (link_label)\n (link_text)\n (image_description)\n] @text.reference\n\n[\n (backslash_escape)\n (hard_line_break)\n] @string.escape\n\n(image\n [\n \"!\"\n \"[\"\n \"]\"\n \"(\"\ …
19+ {"python",
20+ "; Identifier naming conventions\n\n(identifier) @variable\n\n((identifier) @constructor\n (#match\? @constructor \"^[A-Z]\"))\n\n((identifier) @constant\n (#match\? @constant \"^[A-Z][A-Z_]*$\"))\n\n; Function calls\n\n(decorator) @function\n(decorator\n (identifier) @function)\n\n(call\n function: (attribute attribute: (identifier) @function.method))\n(call\n function: (identifier) @function)\n\n; Builtin functions\n\n((call\n function: (identifier) @function.builtin)\n (#match\?\n …
21+ {"typescript",
22+ "; Variables\n;----------\n\n(identifier) @variable\n\n; Properties\n;-----------\n\n(property_identifier) @property\n\n; Function and method definitions\n;--------------------------------\n\n(function_expression\n name: (identifier) @function)\n(function_declaration\n name: (identifier) @function)\n(method_definition\n name: (property_identifier) @function.method)\n\n(pair\n key: (property_identifier) @function.method\n value: [(function_expression) (arrow_function)])\n\n(assignment_e …
23+};
24+
25+const char *tiny_query_for(const char *lang) {
26+ for (size_t i = 0; i < sizeof tiny_queries / sizeof tiny_queries[0]; i++)
27+ if (strcmp(tiny_queries[i].lang, lang) == 0) return tiny_queries[i].text;
28+ return NULL;
29+}
src/queries.h+21−0
@@ -0,0 +1,21 @@
1+// Compiled-in tree-sitter highlight queries.
2+//
3+// The text lives in src/queries.generated.c, generated from vendor/queries by
4+// tools/gen_queries.py. Keeping them in the binary avoids any runtime lookup
5+// path.
6+
7+#ifndef TINY_QUERIES_H
8+#define TINY_QUERIES_H
9+
10+#include <stddef.h>
11+#include <string.h>
12+
13+typedef struct {
14+ const char *lang;
15+ const char *text;
16+} tiny_query;
17+
18+// Returns the highlights query for `lang`, or NULL when none is compiled in.
19+const char *tiny_query_for(const char *lang);
20+
21+#endif
src/resolve.c+1−0
@@ -28,6 +28,7 @@ int tiny_resolve_model(const tiny_config *cfg, tiny_model *out, char **err) {
2828 // images surfaces the provider error as-is.
2929 const tiny_model_info *info = tiny_catalog_lookup(tiny_provider_canonical(cfg->provider), cfg->model);
3030 out->supports_images = info ? info->supports_images : true;
31+ out->max_tokens = info ? info->max_output : 0;
3132 out->effort = tiny_catalog_clamp_effort(info, cfg->effort);
3233
3334 if (strcmp(cfg->provider, "opencode-go") == 0) {
src/tool.c+17−4
@@ -18,6 +18,7 @@
1818
1919 #include <yyjson.h>
2020
21+#include "diff.h"
2122 #include "util.h"
2223
2324 #define MAX_TEXT 100000
@@ -304,8 +305,14 @@ static void tool_edit(const char *args, tiny_tool_result *res) {
304305 yyjson_doc_free(doc);
305306 return;
306307 }
307- res->text = xmalloc(strlen(path) + 16);
308- sprintf(res->text, "created %s", path);
308+ char *patch = tiny_unified_diff(path, "", 0, nw, new_len);
309+ tui_buf b;
310+ buf_init(&b);
311+ buf_addf(&b, "created %s\n", path);
312+ buf_adds(&b, patch);
313+ res->text = buf_steal(&b);
314+ buf_free(&b);
315+ free(patch);
309316 yyjson_doc_free(doc);
310317 return;
311318 }
@@ -345,8 +352,14 @@ static void tool_edit(const char *args, tiny_tool_result *res) {
345352 return;
346353 }
347354
348- res->text = xmalloc(strlen(path) + 16);
349- sprintf(res->text, "edited %s", path);
355+ char *patch = tiny_unified_diff(path, data.data, data.len, out.data, out.len);
356+ tui_buf b;
357+ buf_init(&b);
358+ buf_addf(&b, "edited %s\n", path);
359+ buf_adds(&b, patch);
360+ res->text = buf_steal(&b);
361+ buf_free(&b);
362+ free(patch);
350363 free(out.data);
351364 free(data.data);
352365 yyjson_doc_free(doc);
src/tui/highlight.c+63−59
@@ -6,75 +6,41 @@
66
77 #include <tree_sitter/api.h>
88
9+#include <tree_sitter/tree-sitter-c.h>
10+#include <tree_sitter/tree-sitter-python.h>
911 #include <tree_sitter/tree-sitter-javascript.h>
1012 #include <tree_sitter/tree-sitter-bash.h>
1113 #include <tree_sitter/tree-sitter-markdown.h>
1214 #include <tree_sitter/tree-sitter-markdown-inline.h>
1315
16+#include "tree-sitter-make.h"
17+#include "tree-sitter-typescript.h"
18+#include "tree-sitter-tsx.h"
19+
20+#include "queries.h"
1421 #include "util.h"
1522 #include "theme.h"
16-#include "util.h"
1723
1824 typedef struct {
1925 TSParser *parser;
2026 TSQuery *query;
2127 } syntax;
2228
23-// Reads a highlights query for `lang` from the usual locations, or NULL.
24-static char *read_query(const char *lang) {
25- const char *env = getenv("TINY_QUERIES_DIR");
26- const char *home = getenv("HOME");
27- char path[4096];
28- if (env && env[0]) {
29- snprintf(path, sizeof path, "%s/%s/highlights.scm", env, lang);
30- char *q = tiny_read_file(path);
31- if (q) return q;
32- }
33- const char *tmpl[] = {
34- "/usr/share/tree-sitter/queries/%s/highlights.scm",
35- "/usr/share/nvim/runtime/queries/%s/highlights.scm",
36- "%s/.local/share/nvim/lazy/nvim-treesitter/runtime/queries/%s/highlights.scm",
37- };
38- for (size_t i = 0; i < sizeof tmpl / sizeof tmpl[0]; i++) {
39- if (i == 2) {
40- if (!home || !home[0]) break;
41- snprintf(path, sizeof path, tmpl[i], home, lang);
42- } else {
43- snprintf(path, sizeof path, tmpl[i], lang);
44- }
45- char *q = tiny_read_file(path);
46- if (q) return q;
47- }
48- return NULL;
49-}
50-
51-static syntax *syntax_open(const TSLanguage *lang, const char *const *langs, size_t nlangs) {
29+static syntax *syntax_open(const TSLanguage *lang, const char *name) {
5230 if (!lang) return NULL;
5331 TSParser *parser = ts_parser_new();
5432 if (!ts_parser_set_language(parser, lang)) {
5533 ts_parser_delete(parser);
5634 return NULL;
5735 }
58- tui_buf src;
59- buf_init(&src);
60- bool any = false;
61- for (size_t i = 0; i < nlangs; i++) {
62- char *q = read_query(langs[i]);
63- if (!q) continue;
64- if (any) buf_addc(&src, '\n');
65- buf_adds(&src, q);
66- any = true;
67- free(q);
68- }
69- if (!any) {
70- buf_free(&src);
36+ const char *src = tiny_query_for(name);
37+ if (!src) {
7138 ts_parser_delete(parser);
7239 return NULL;
7340 }
7441 uint32_t error_offset = 0;
7542 TSQueryError error_type = TSQueryErrorNone;
76- TSQuery *query = ts_query_new(lang, src.data, (uint32_t)src.len, &error_offset, &error_type);
77- buf_free(&src);
43+ TSQuery *query = ts_query_new(lang, src, (uint32_t)strlen(src), &error_offset, &error_type);
7844 if (!query) {
7945 ts_parser_delete(parser);
8046 return NULL;
@@ -88,44 +54,77 @@ static syntax *syntax_open(const TSLanguage *lang, const char *const *langs, siz
8854
8955 // Lazily built grammars; `seen` records that we tried, so a missing grammar is
9056 // not re-probed on every block.
91-static syntax *JS;
92-static syntax *BASH;
93-static syntax *MD;
94-static syntax *MD_INLINE;
95-static bool js_seen, bash_seen, md_seen, md_inline_seen;
57+static syntax *C, *PY, *JS, *BASH, *MAKE, *TS, *TSX, *MD, *MD_INLINE;
58+static bool c_seen, py_seen, js_seen, bash_seen, make_seen, ts_seen, tsx_seen, md_seen, md_inline_seen;
59+
60+static syntax *grammar_c(void) {
61+ if (!c_seen) {
62+ c_seen = true;
63+ C = syntax_open(tree_sitter_c(), "c");
64+ }
65+ return C;
66+}
67+
68+static syntax *grammar_python(void) {
69+ if (!py_seen) {
70+ py_seen = true;
71+ PY = syntax_open(tree_sitter_python(), "python");
72+ }
73+ return PY;
74+}
9675
9776 static syntax *grammar_js(void) {
98- static const char *langs[] = {"javascript"};
9977 if (!js_seen) {
10078 js_seen = true;
101- JS = syntax_open(tree_sitter_javascript(), langs, 1);
79+ JS = syntax_open(tree_sitter_javascript(), "javascript");
10280 }
10381 return JS;
10482 }
10583
10684 static syntax *grammar_bash(void) {
107- static const char *langs[] = {"bash"};
10885 if (!bash_seen) {
10986 bash_seen = true;
110- BASH = syntax_open(tree_sitter_bash(), langs, 1);
87+ BASH = syntax_open(tree_sitter_bash(), "bash");
11188 }
11289 return BASH;
11390 }
11491
92+static syntax *grammar_make(void) {
93+ if (!make_seen) {
94+ make_seen = true;
95+ MAKE = syntax_open(tree_sitter_make(), "make");
96+ }
97+ return MAKE;
98+}
99+
100+static syntax *grammar_ts(void) {
101+ if (!ts_seen) {
102+ ts_seen = true;
103+ TS = syntax_open(tree_sitter_typescript(), "typescript");
104+ }
105+ return TS;
106+}
107+
108+static syntax *grammar_tsx(void) {
109+ if (!tsx_seen) {
110+ tsx_seen = true;
111+ TSX = syntax_open(tree_sitter_tsx(), "typescript");
112+ }
113+ return TSX;
114+}
115+
115116 static syntax *grammar_md(void) {
116- static const char *langs[] = {"markdown"};
117117 if (!md_seen) {
118118 md_seen = true;
119- MD = syntax_open(tree_sitter_markdown(), langs, 1);
119+ MD = syntax_open(tree_sitter_markdown(), "markdown");
120120 }
121121 return MD;
122122 }
123123
124124 static syntax *grammar_md_inline(void) {
125- static const char *langs[] = {"markdown_inline"};
126125 if (!md_inline_seen) {
127126 md_inline_seen = true;
128- MD_INLINE = syntax_open(tree_sitter_markdown_inline(), langs, 1);
127+ MD_INLINE = syntax_open(tree_sitter_markdown_inline(), "markdown_inline");
129128 }
130129 return MD_INLINE;
131130 }
@@ -379,7 +378,12 @@ char *tiny_highlight_code(const char *info, const char *text) {
379378 i++;
380379 }
381380 lang[i] = '\0';
382- if (strcmp(lang, "js") == 0 || strcmp(lang, "javascript") == 0 || strcmp(lang, "jsx") == 0) s = grammar_js();
381+ if (strcmp(lang, "c") == 0) s = grammar_c();
382+ else if (strcmp(lang, "python") == 0 || strcmp(lang, "py") == 0) s = grammar_python();
383+ else if (strcmp(lang, "js") == 0 || strcmp(lang, "javascript") == 0 || strcmp(lang, "jsx") == 0) s = grammar_js();
384+ else if (strcmp(lang, "ts") == 0 || strcmp(lang, "typescript") == 0) s = grammar_ts();
385+ else if (strcmp(lang, "tsx") == 0) s = grammar_tsx();
386+ else if (strcmp(lang, "make") == 0 || strcmp(lang, "makefile") == 0) s = grammar_make();
383387 else if (strcmp(lang, "bash") == 0 || strcmp(lang, "sh") == 0 || strcmp(lang, "shell") == 0) s = grammar_bash();
384388 if (!s) return strdup(text);
385389 size_t len = strlen(text);
src/tui/highlight.h+5−4
@@ -1,9 +1,10 @@
11 // tiny TUI syntax highlighting, over a committed block, once.
22 //
3-// Grammars come from tree-sitter; queries ship as data and are read from the
4-// usual nvim / tree-sitter query directories. Only a capture name reaches the
5-// palette. When no grammar or query is available, the text passes through
6-// unchanged.
3+// Grammars are compiled in: some come from pkg-config, the rest are vendored
4+// and built from source. The highlights queries live in vendor/queries and are
5+// compiled into the binary (src/queries.generated.c). Only a capture name
6+// reaches the palette. When no grammar is available for a language, the text
7+// passes through unchanged.
78
89 #ifndef TINY_TUI_HIGHLIGHT_H
910 #define TINY_TUI_HIGHLIGHT_H
src/tui/tui.c+37−9
@@ -36,8 +36,24 @@
3636 #define ELIDED_HEAD 4
3737 #define ELIDED_TAIL 4
3838
39-static const char *const SPINNER[] = {
40- "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏",
39+// The braille patterns in mini-coder's order: frame i is U+2800 + SPINNER[i].
40+static const unsigned char SPINNER[] = {
41+ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71,
42+ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79,
43+ 16, 17, 18, 19, 20, 21, 22, 23, 80, 81, 82, 83, 84, 85, 86, 87,
44+ 24, 25, 26, 27, 28, 29, 30, 31, 88, 89, 90, 91, 92, 93, 94, 95,
45+ 32, 33, 34, 35, 36, 37, 38, 39, 96, 97, 98, 99, 100, 101, 102, 103,
46+ 40, 41, 42, 43, 44, 45, 46, 47, 104, 105, 106, 107, 108, 109, 110, 111,
47+ 48, 49, 50, 51, 52, 53, 54, 55, 112, 113, 114, 115, 116, 117, 118, 119,
48+ 56, 57, 58, 59, 60, 61, 62, 63, 120, 121, 122, 123, 124, 125, 126, 127,
49+ 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,
50+ 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,
51+ 144, 145, 146, 147, 148, 149, 150, 151, 208, 209, 210, 211, 212, 213, 214, 215,
52+ 152, 153, 154, 155, 156, 157, 158, 159, 216, 217, 218, 219, 220, 221, 222, 223,
53+ 160, 161, 162, 163, 164, 165, 166, 167, 224, 225, 226, 227, 228, 229, 230, 231,
54+ 168, 169, 170, 171, 172, 173, 174, 175, 232, 233, 234, 235, 236, 237, 238, 239,
55+ 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247,
56+ 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255,
4157 };
4258
4359 static const char *const BODY_PREFIX = " | ";
@@ -455,7 +471,7 @@ static char *call_summary(const char *name, const char *arguments) {
455471 // ---- status ----------------------------------------------------------------
456472
457473 static char *status_line(tui *t) {
458- char *usage = tiny_context_usage_line(t->ctx_used, t->context_window, 0);
474+ char *usage = tiny_context_usage_line(t->ctx_used, t->context_window, t->model.max_tokens);
459475 if (t->paused || t->phase == TINY_PHASE_PAUSING) {
460476 tui_buf b;
461477 buf_init(&b);
@@ -488,9 +504,11 @@ static char *status_line(tui *t) {
488504 }
489505 tui_buf phase;
490506 buf_init(&phase);
507+ char spin[8];
508+ int sn = tiny_utf8_encode(0x2800u + SPINNER[t->frame % (int)(sizeof SPINNER / sizeof SPINNER[0])], spin);
509+ spin[sn] = '\0';
491510 char text[192];
492- snprintf(text, sizeof text, "%s %s · %ds", SPINNER[t->frame % (int)(sizeof SPINNER / sizeof SPINNER[0])],
493- label, (int)elapsed(t));
511+ snprintf(text, sizeof text, "%s %s · %ds", spin, label, (int)elapsed(t));
494512 fg_dim(&phase, text);
495513
496514 tui_buf out;
@@ -733,6 +751,10 @@ static void on_event(const tiny_event *e, void *user) {
733751 }
734752 break;
735753 }
754+ case TINY_EVENT_TOOL_CALL_START:
755+ free(t->writing_tool);
756+ t->writing_tool = e->u.tool_call_start.name ? xstrdup(e->u.tool_call_start.name) : NULL;
757+ break;
736758 case TINY_EVENT_TOOL_CALL: {
737759 free(t->writing_tool);
738760 t->writing_tool = NULL;
@@ -758,9 +780,11 @@ static void on_event(const tiny_event *e, void *user) {
758780 buf_free(&b);
759781 break;
760782 }
761- case TINY_EVENT_TOOL_OUTPUT:
762- // Tool output is not streamed live; the result carries it.
783+ case TINY_EVENT_TOOL_OUTPUT: {
784+ size_t z;
785+ tiny_tailstream_feed(&t->activity, e->u.tool_output.chunk, &z);
763786 break;
787+ }
764788 case TINY_EVENT_TOOL_RESULT:
765789 activity_reset(t);
766790 commit_tool_result(t, e->u.tool_result.name, e->u.tool_result.text, e->u.tool_result.is_error,
@@ -781,9 +805,13 @@ static void on_event(const tiny_event *e, void *user) {
781805 end_turn_buf(t, &b);
782806 break;
783807 }
784- case TINY_EVENT_NO_MODEL:
785- end_turn(t, "\x1b[38;2;247;118;142m! no model configured\x1b[39m");
808+ case TINY_EVENT_NO_MODEL: {
809+ tui_buf b;
810+ buf_init(&b);
811+ fg_red(&b, "! no model configured");
812+ end_turn_buf(t, &b);
786813 break;
814+ }
787815 case TINY_EVENT_CANCELLED: {
788816 tui_buf b;
789817 buf_init(&b);
src/tui/usage.c+14−7
@@ -18,17 +18,24 @@ static void trim_zeros(char *s) {
1818 }
1919
2020 char *tiny_format_tokens(long n) {
21- char tmp[48];
21+ char num[48];
22+ const char *unit = "";
2223 if (n < 1000) {
23- snprintf(tmp, sizeof tmp, "%ld", n);
Cut short: this commit's diff is over 1000 lines.
tools/gen_catalog.py+4−3
Cut short: this commit's diff is over 1000 lines.
tools/gen_queries.py+77−0
Cut short: this commit's diff is over 1000 lines.
vendor/make/LICENSE+21−0
Cut short: this commit's diff is over 1000 lines.
vendor/make/src/parser.c+36302−0
Cut short: this commit's diff is over 1000 lines.
vendor/make/src/tree_sitter/parser.h+286−0
Cut short: this commit's diff is over 1000 lines.
vendor/make/tree-sitter-make.h+16−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/bash/highlights.scm+56−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/c/LICENSE+21−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/c/highlights.scm+81−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/javascript/highlights.scm+204−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/make/highlights.scm+172−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/markdown/highlights.scm+47−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/markdown_inline/highlights.scm+56−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/python/highlights.scm+137−0
Cut short: this commit's diff is over 1000 lines.
vendor/queries/typescript/highlights.scm+239−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/LICENSE+21−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/common/scanner.h+347−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/tree-sitter-tsx.h+16−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/tree-sitter-typescript.h+16−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/tsx/src/parser.c+282955−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/tsx/src/scanner.c+13−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/tsx/src/tree_sitter/parser.h+266−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/typescript/src/parser.c+282437−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/typescript/src/scanner.c+13−0
Cut short: this commit's diff is over 1000 lines.
vendor/typescript/typescript/src/tree_sitter/parser.h+266−0
Cut short: this commit's diff is over 1000 lines.