xonecas.io
64875
Mc

mini-coder / commit e3879f9

fix: pass effort level to streamSimple in agent loop

RunAgentOpts gains optional effort: ThinkingLevel field.
The streamSimple call now includes reasoning: effort when set.
ui.ts passes state.effort when invoking the agent loop.

Previously /effort updated UI state but had no effect on model
behavior — reasoning levels were silently ignored.

xonecas2026-04-05 e3879f9304aab7972a59d2335701f77724e07c1c parent fecb868

3 files changed

TODO.md+0−10
@@ -134,21 +134,11 @@
134134 **Bugs / missing behavior:**
135135
136136 - `agent.ts` never passes `reasoning` (effort level) to `streamSimple()`. The `/effort` command updates `state.effort` but it has no effect on the LLM call. `RunAgentOpts` needs an `effort` field, and the `streamSimple` call needs `{ signal, reasoning: effort }`.
137-- `/model` spec says "readImage tool is re-evaluated (added/removed based on the new model's capabilities)" — currently `/model` updates `state.model` but `buildToolList` is only called at submit time, so this works implicitly. Correct.
138137 - Shell tool rendering doesn't show exit code (spec: "Shows the command, head + tail truncated output with a visual marker, and exit code"). `ToolExecResult` carries `isError` but not the numeric exit code.
139138 - Status bar CWD truncation from the left (`…/mini-coder`) on narrow terminals — not implemented, just shows full abbreviated path.
140139 - `Ctrl+Z` suspend/background — not implemented (spec lists it in key bindings).
141140 - `/session` spec says "list, resume, delete" — we intentionally deferred delete (design decision).
142141
143-**Not yet implemented (tracked in 4c/4d):**
144-
145-- `/new`, `/fork`, `/undo`, `/reasoning`, `/verbose` — simple commands, no UI complexity.
146-- `/login`, `/logout` — OAuth flows.
147-- `/help` — info display.
148-- `/` + Tab command autocomplete, Tab file path autocomplete.
149-- `/skill:name` input handling, image embedding.
150-- Context limit compaction.
151-
152142 ### 4d — Polish
153143
154144 - [ ] Tab file path autocomplete in input
src/agent.ts+8−1
@@ -13,6 +13,7 @@ import type {
1313 AssistantMessage,
1414 Message,
1515 Model,
16+ ThinkingLevel,
1617 Tool,
1718 ToolCall,
1819 ToolResultMessage,
@@ -69,6 +70,8 @@ export interface RunAgentOpts {
6970 messages: Message[];
7071 /** Working directory for tool execution. */
7172 cwd: string;
73+ /** Reasoning effort level (e.g. "low", "medium", "high", "xhigh"). */
74+ effort?: ThinkingLevel;
7275 /** Abort signal for interruption. */
7376 signal?: AbortSignal;
7477 /** Callback for UI events. */
@@ -111,6 +114,7 @@ export async function runAgentLoop(
111114 toolHandlers,
112115 messages,
113116 cwd,
117+ effort,
114118 signal,
115119 onEvent,
116120 } = opts;
@@ -123,7 +127,10 @@ export async function runAgentLoop(
123127 : { systemPrompt, messages };
124128
125129 // Stream to LLM
126- const streamOpts = signal ? { signal } : {};
130+ const streamOpts = {
131+ ...(effort ? { reasoning: effort } : {}),
132+ ...(signal ? { signal } : {}),
133+ };
127134 const eventStream = streamSimple(model, context, streamOpts);
128135 let assistantMessage: AssistantMessage | undefined;
129136
src/ui.ts+1−0
@@ -826,6 +826,7 @@ async function submitMessage(text: string, state: AppState): Promise<void> {
826826 toolHandlers,
827827 messages: state.messages,
828828 cwd: state.cwd,
829+ effort: state.effort,
829830 signal: state.abortController.signal,
830831 onEvent: (event) => handleAgentEvent(event, state),
831832 });